Professional Documents
Culture Documents
m 24/01/2018
1
Doppler_Delay_Profile_v0d2_36bit_X_VINAG.m 24/01/2018
end
Sin_samples_period = Sin_period/Update_Rate_s;
y = Sin_freq_offset + Sin_max_doppler*sin(t1+Sin_ph_offset);
nperiods = floor(Sim_length/Sin_period);
ytot = y;
for t=2:nperiods
ytot = [ytot y];
end
Sim_length_samples = Sim_length/Update_Rate_s;
fract_samples = Sim_length_samples-length(ytot);
Doppler_Hz_av = doppler_Hz(1:end-1)+Doppler_Rate/2;
clear doppler_Hz;
ytot = Doppler_Hz_av;
Sim_length = length(ytot)*Update_Rate_s;
end
doppler_Hz = ytot;
l_res_NCO_F_REG_VAL_acc = 0;
NCO_FREQ_d = (doppler_Hz)/(F_NCO_Hz)*MAX_NCO_FREQ;
NCO_FREQ_REG_VALS = floor(NCO_FREQ_d + 0.5);
if (l_res_NCO_F_REG_VAL_acc > 1)
NCO_FREQ_REG_VALS = NCO_FREQ_REG_VALS + 1;
l_res_NCO_F_REG_VAL_acc = l_res_NCO_F_REG_VAL_acc - 1;
end
%NCO_FREQ_REG_VALS = (dop_Hz)/(F_NCO_Hz)*MAX_NCO_FREQ;
2
Doppler_Delay_Profile_v0d2_36bit_X_VINAG.m 24/01/2018
%delta_del_ns = - doppler_Hz*(1/
Doppler_Sampling_Rate_Hz)*lambda_PSL_ns;
delta_del_ns = + doppler_Hz*(1/
Doppler_Sampling_Rate_Hz)*lambda_PSL_ns; %% inversion 15/01/2018
delta_del_ns_at_up_Update = delta_del_ns*(Doppler_Sampling_Rate_Hz/ (1/
Counter_up_Update_ms*1000));
delta_del_ns_2_NCO = delta_del_ns_at_up_Update/( (Counter_up_Update_ms/
Counter_Update_ms) * Counter_active_samples);
%%% Taking into account the residual part for the next word
l_res_NCO_T_REG_VAL = 0;
l_res_NCO_T_REG_VAL_acc = 0;
for tn=1:length(delta_del_ns_2_NCO)
l_NCO_T_REG_VAL_i = round((delta_del_ns_2_NCO(tn) * NCO_STEP/T_NCO_ns))
;
l_res_NCO_T_REG_VAL = (delta_del_ns_2_NCO(tn) * NCO_STEP/T_NCO_ns) -
l_NCO_T_REG_VAL_i;
l_res_NCO_T_REG_VAL_acc = l_res_NCO_T_REG_VAL +
l_res_NCO_T_REG_VAL_acc;
if (l_res_NCO_T_REG_VAL_acc > 1)
l_NCO_T_REG_VAL_i = l_NCO_T_REG_VAL_i + 1;
l_res_NCO_T_REG_VAL_acc = l_res_NCO_T_REG_VAL_acc - 1;
end
if (l_res_NCO_T_REG_VAL_acc < -1)
l_NCO_T_REG_VAL_i = l_NCO_T_REG_VAL_i - 1;
l_res_NCO_T_REG_VAL_acc = l_res_NCO_T_REG_VAL_acc + 1;
end
l_res_NCO_T_REG_VAL_t(tn) = l_NCO_T_REG_VAL_i;
end
% if no taking into account residuals...
%NCO_TIMING_REG_VALS = round(delta_del_ns_2_NCO * NCO_STEP/T_NCO_ns);
%CW_DELAY =NCO_TIMING_REG_VALS;
%Insert_Zeros = input('Please insert Initial Propagation Offset in ms (will
be rounded by 10 ms step) [default: 1000 ms = 1sec] : ');
%if (isempty(Insert_Zeros))
% Insert_Zeros = 1000;
%end
clear CW_DELAY CW_DOPPLER
CW_DELAY(1:0)=0;
CW_DOPPLER(1:0)=0;
cwa=0;
for t2=2:length(delta_del_ns)
cwa(t2)=cwa(t2-1)+delta_del_ns(t2);
end
tp = 0:Update_Rate_s:Sim_length-Update_Rate_s; % to plot seconds on x axis
figure;
subplot(2,1,1)
h1=plot(tp,doppler_Hz,'r');
hold on
grid on
set(gca,'FontSize',18);
set(h1,'LineWidth',2);
title('Doppler Frequency Profile');
ylabel('Frequency [Hz]');
xlabel('Time [s]');
subplot(2,1,2);
%%h1=plot(tp, cwa*c*10^-9,'b');
h1=plot(tp, -cwa*c*10^-9,'b'); % inversion 15/01/2018
grid on
hold on
set(gca,'FontSize',18);
set(h1,'LineWidth',2);
3
Doppler_Delay_Profile_v0d2_36bit_X_VINAG.m 24/01/2018
if (isempty(savesimparams))
savesimparams = 'y';
end
if ((savesimparams == 'y') || (savesimparams == 'Y'))
l_Save_Out_s = input('Insert Output mat variable name: ','s');
l_Save_Out_mat_s = strcat(l_Save_Out_s,'.mat');
assignin('base',strcat('CW_DELAY_',l_Save_Out_s),CW_DELAY);
assignin('base',strcat('CW_DOPPLER_',l_Save_Out_s),CW_DOPPLER);
assignin('base',strcat('Sim_length_',l_Save_Out_s),Sim_length);
assignin('base',strcat('Sin_freq_offset_',l_Save_Out_s),Sin_freq_offset
assignin('base',strcat('Sin_period_',l_Save_Out_s),Sin_period);
assignin('base',strcat('Sin_max_doppler_',l_Save_Out_s),Sin_max_doppler
l_save_vars = strcat('*',l_Save_Out_s);
save(l_Save_Out_mat_s,l_save_vars);
h6=gcf;
l_TEST = strcat('TEST-VINAG_MODULATOR_',l_Save_Out_s);
print(h6,'-djpeg', '-noui', l_TEST);
saveas(h6,l_TEST,'fig');
end
%
save(l_Save_Out_mat_s,'CN0_calc_all','DLL_DUT_all','PLL_DUT_all','PI_PLL_
all','PQ_PLL_all','PI_FLL_all','PQ_FLL_all','SState','CN0_calc_SS','DLL_D
UT_SS','PLL_DUT_SS','PI_PLL_SS','PQ_PLL_SS','PI_FLL_SS','PQ_FLL_SS','BW_P
LL','BW_DLL','SigmaPLL_TEO_Meas_Filt','SigmaDLL_TEO_Meas_Filt',...
%
'PLL_Filt_deg','DLL_Filt_meters','PR_BY_DOPPLER','PR_BY_DELAY');
clear l_*