1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 11:10:33 +00:00

Linear regressor implemented in observables

This commit is contained in:
Javier Arribas 2015-11-24 13:37:01 +01:00
parent 411c8cedb0
commit 15c4882af9
5 changed files with 68 additions and 9 deletions

View File

@ -158,7 +158,7 @@ Resampler.sample_freq_out=2600000
;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available GPS satellite channels.
Channels_1C.count=6
Channels_1C.count=10
;#count: Number of available Galileo satellite channels.
Channels_1B.count=0
;#in_acquisition: Number of channels simultaneously acquiring for the whole receiver

View File

@ -220,14 +220,55 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
desired_symbol_TOW[0]=symbol_TOW_vec_s[GPS_L1_CA_HISTORY_DEEP-1]+delta_rx_time_ms/1000.0;
//std::cout<<"desired_symbol_TOW="<<desired_symbol_TOW[0]<<std::endl;
arma::interp1(symbol_TOW_vec_s,dopper_vec_hz,desired_symbol_TOW,dopper_vec_interp_hz);
arma::interp1(symbol_TOW_vec_s,acc_phase_vec_rads,desired_symbol_TOW,acc_phase_vec_interp_rads);
// arma::interp1(symbol_TOW_vec_s,dopper_vec_hz,desired_symbol_TOW,dopper_vec_interp_hz);
// arma::interp1(symbol_TOW_vec_s,acc_phase_vec_rads,desired_symbol_TOW,acc_phase_vec_interp_rads);
// linear regression
arma::mat A=arma::ones<arma::mat> (GPS_L1_CA_HISTORY_DEEP,2);
A.col(1)=symbol_TOW_vec_s;
arma::mat coef_acc_phase(1,2);
coef_acc_phase=arma::pinv(A.t()*A)*A.t()*acc_phase_vec_rads;
arma::mat coef_doppler(1,2);
coef_doppler=arma::pinv(A.t()*A)*A.t()*dopper_vec_hz;
arma::vec acc_phase_lin;
arma::vec carrier_doppler_lin;
acc_phase_lin=coef_acc_phase[0]+coef_acc_phase[1]*desired_symbol_TOW[0];
carrier_doppler_lin=coef_doppler[0]+coef_doppler[1]*desired_symbol_TOW[0];
//std::cout<<"acc_phase_vec_interp_rads="<<acc_phase_vec_interp_rads[0]<<std::endl;
//std::cout<<"dopper_vec_interp_hz="<<dopper_vec_interp_hz[0]<<std::endl;
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_phase_rads =acc_phase_vec_interp_rads[0];
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_Doppler_hz =dopper_vec_interp_hz[0];
// if (std::isnan(acc_phase_vec_interp_rads[0]) != true and std::isnan(dopper_vec_interp_hz[0]) != true)
// {
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_phase_rads =acc_phase_lin[0];
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Carrier_Doppler_hz =carrier_doppler_lin[0];
// }else{
// std::cout<<"NaN detected in interpolation output, desired_symbol_TOW[0]= "<<desired_symbol_TOW[0]<<std::endl;
// std::cout<<"symbol_TOW_vec_s[0]="<<symbol_TOW_vec_s[0]<<std::endl;
// std::cout<<"symbol_TOW_vec_s[GPS_L1_CA_HISTORY_DEEP-1]="<<symbol_TOW_vec_s[GPS_L1_CA_HISTORY_DEEP-1]<<std::endl;
//
// for (int n=0;n<symbol_TOW_vec_s.size();n++)
// {
// if (std::isnan(symbol_TOW_vec_s[n])==true)
// {
// std::cout<<"NaN detected in symbol_TOW_vec_s index "<<n<<std::endl;
// //std::cout<<"symbol_TOW_vec_s="<<symbol_TOW_vec_s<<std::endl;
// //std::cout<<"acc_phase_vec_rads="<<acc_phase_vec_rads<<std::endl;
// }
// if (std::isnan(dopper_vec_hz[n])==true)
// {
// std::cout<<"NaN detected in dopper_vec_hz index "<<n<<std::endl;
// //std::cout<<"symbol_TOW_vec_s="<<symbol_TOW_vec_s<<std::endl;
// //std::cout<<"acc_phase_vec_rads="<<acc_phase_vec_rads<<std::endl;
// }
// if (std::isnan(acc_phase_vec_rads[n])==true)
// {
// std::cout<<"NaN detected in acc_phase_vec_rads index "<<n<<std::endl;
// //std::cout<<"symbol_TOW_vec_s="<<symbol_TOW_vec_s<<std::endl;
// //std::cout<<"acc_phase_vec_rads="<<acc_phase_vec_rads<<std::endl;
// }
// }
//
// }
}
}

View File

@ -135,6 +135,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
d_decimation_output_factor = 1;
d_channel = 0;
Prn_timestamp_at_preamble_ms = 0.0;
flag_PLL_180_deg_phase_locked=false;
//set_history(d_samples_per_bit*8); // At least a history of 8 bits are needed to correlate with the preamble
}
@ -224,6 +225,13 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
if (corr_value<0)
{
flag_PLL_180_deg_phase_locked=true; //PLL is locked to opposite phase!
std::cout<<"PLL in opposite phase for Sat "<<this->d_satellite.get_PRN()<<std::endl;
}else{
flag_PLL_180_deg_phase_locked=false;
}
LOG(INFO) <<" Frame sync SAT " << this->d_satellite << " with preamble start at " << d_preamble_time_seconds << " [s]";
}
}
@ -331,8 +339,13 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_flag_parity == true and flag_TOW_set == true);
current_synchro_data.Flag_preamble = d_flag_preamble;
current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0;
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;
if (flag_PLL_180_deg_phase_locked==true)
{
//correct the accumulated phase for the costas loop phase shift, if required
current_synchro_data.Carrier_phase_rads+=GPS_PI;
}
if(d_dump == true)
{
// MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -150,6 +150,7 @@ private:
double Prn_timestamp_at_preamble_ms;
bool flag_TOW_set;
bool flag_PLL_180_deg_phase_locked;
std::string d_dump_filename;
std::ofstream d_dump_file;

View File

@ -345,18 +345,22 @@ int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_
//carrier phase accumulator for (K) doppler estimation
//d_acc_carrier_phase_cycles -= (d_carrier_doppler_hz*INTEGRATION_TIME);
old_d_acc_carrier_phase_cycles=d_acc_carrier_phase_cycles;
d_acc_carrier_phase_cycles -= static_cast<double>(d_carrier_doppler_hz)*INTEGRATION_TIME;
d_acc_carrier_phase_cycles += static_cast<double>(d_carrier_doppler_hz)*d_current_prn_length_samples/static_cast<double>(d_fs_in);//INTEGRATION_TIME;
// PLL to DLL assistance [Secs/Ti]
d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz*GPS_L1_CA_CODE_PERIOD)/GPS_L1_FREQ_HZ;
// code frequency (include code Doppler estimation here)
d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ;
d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ);//GPS_L1_CA_CODE_RATE_HZ;
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
// keep alignment parameters for the next input buffer
double T_chip_seconds;
double T_prn_seconds;
double T_prn_samples;
double K_blk_samples;
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
T_prn_samples = GPS_L1_CA_CODE_PERIOD * static_cast<double>(d_fs_in);
T_chip_seconds = 1 / static_cast<double>(d_code_freq_chips);
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
K_blk_samples = T_prn_samples + d_rem_code_phase_samples - static_cast<double>(dll_code_error_secs_Ti) * static_cast<double>(d_fs_in);
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples
old_d_rem_code_phase_samples=d_rem_code_phase_samples;