From 15c4882af917919f466b2c73731c903bb2382c5a Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Tue, 24 Nov 2015 13:37:01 +0100 Subject: [PATCH] Linear regressor implemented in observables --- conf/gnss-sdr_Hybrid_byte_sim.conf | 2 +- .../gps_l1_ca_observables_cc.cc | 49 +++++++++++++++++-- .../gps_l1_ca_telemetry_decoder_cc.cc | 15 +++++- .../gps_l1_ca_telemetry_decoder_cc.h | 1 + .../gps_l1_ca_dll_pll_artemisa_tracking_cc.cc | 10 ++-- 5 files changed, 68 insertions(+), 9 deletions(-) diff --git a/conf/gnss-sdr_Hybrid_byte_sim.conf b/conf/gnss-sdr_Hybrid_byte_sim.conf index 186d73aff..1ebb882fc 100644 --- a/conf/gnss-sdr_Hybrid_byte_sim.conf +++ b/conf/gnss-sdr_Hybrid_byte_sim.conf @@ -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 diff --git a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc index d11b06c92..5e7cc382a 100644 --- a/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/gps_l1_ca_observables_cc.cc @@ -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="< (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="<d_satellite.get_PRN()<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 diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h index beae77847..10f305ca3 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h @@ -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; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc index 282ba2116..9cc70d150 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc @@ -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(d_carrier_doppler_hz)*INTEGRATION_TIME; + d_acc_carrier_phase_cycles += static_cast(d_carrier_doppler_hz)*d_current_prn_length_samples/static_cast(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(d_fs_in); + T_chip_seconds = 1 / static_cast(d_code_freq_chips); + T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; + T_prn_samples = T_prn_seconds * static_cast(d_fs_in); K_blk_samples = T_prn_samples + d_rem_code_phase_samples - static_cast(dll_code_error_secs_Ti) * static_cast(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;