From d467874a407dd32d2978e119fe12684bce1be5cd Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Thu, 19 Apr 2012 18:18:53 +0000 Subject: [PATCH] Bug correction in tracking lock detector threshold comparison algorithm. git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@196 64b25241-fba3-4117-9849-534c7e92360d --- .../gps_l1_ca_dll_fll_pll_tracking_cc.cc | 5 ++--- .../gps_l1_ca_dll_pll_tracking_cc.cc | 5 ++--- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 13 +++++-------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc index acb8e8fb7..f65ee73ed 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc @@ -159,7 +159,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = 5; + d_carrier_lock_threshold = 20; systemName["G"] = std::string("GPS"); systemName["R"] = std::string("GLONASS"); @@ -465,8 +465,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in); d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); // ###### TRACKING UNLOCK NOTIFICATION ##### - //int tracking_message; - if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0) + if (std::abs(d_carrier_lock_test) > d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index efcccd396..716afd8a3 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -169,7 +169,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = 5; + d_carrier_lock_threshold = 20; systemName["G"] = std::string("GPS"); systemName["R"] = std::string("GLONASS"); @@ -456,8 +456,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in); d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); // ###### TRACKING UNLOCK NOTIFICATION ##### - //int tracking_message; - if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0) + if (std::abs(d_carrier_lock_test) > d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index e4bdf2235..790365f65 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -183,7 +183,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = 5; + d_carrier_lock_threshold = 20; systemName["G"] = std::string("GPS"); systemName["R"] = std::string("GLONASS"); @@ -465,10 +465,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec // Compute DLL error and update code NCO //SIM code_error = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); - // Implement code loop filter and generate NCO command - code_nco = d_code_loop_filter.get_code_nco(code_error); // Modify code freq based on NCO command - d_code_freq_hz = GPS_L1_CA_CODE_RATE_HZ - code_nco; + d_code_freq_hz = 1/(1/GPS_L1_CA_CODE_RATE_HZ - code_nco/GPS_L1_CA_CODE_LENGTH_CHIPS); // Update the phasestep based on code freq (variable) and // sampling frequency (fixed) @@ -502,8 +500,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in); d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); // ###### TRACKING UNLOCK NOTIFICATION ##### - //int tracking_message; - if (d_carrier_lock_test < d_carrier_lock_threshold or d_carrier_lock_test > MINIMUM_VALID_CN0) + if (std::abs(d_carrier_lock_test) > d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } @@ -558,8 +555,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec // ########### Output the tracking data to navigation and PVT ########## - current_synchro_data.Prompt_I = (double)(*d_Prompt).real(); - current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag(); + current_synchro_data.Prompt_I = (double)(*d_Prompt).imag(); + current_synchro_data.Prompt_Q = (double)(*d_Prompt).real(); // Tracking_timestamp_secs is aligned with the PRN start sample current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in; // This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, Code_phase_secs=0