mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	Improving tracking stability of carrier lock detector
This commit is contained in:
		| @@ -65,9 +65,12 @@ DEFINE_int32(cn0_samples, 20, "Number of correlator outputs used for CN0 estimat | ||||
|  | ||||
| DEFINE_int32(cn0_min, 25, "Minimum valid CN0 (in dB-Hz)."); | ||||
|  | ||||
| DEFINE_int32(max_lock_fail, 50, "Maximum number of lock failures before dropping a satellite."); | ||||
| DEFINE_int32(max_carrier_lock_fail, 5000, "Maximum number of carrier lock failures before dropping a satellite."); | ||||
|  | ||||
| DEFINE_double(carrier_lock_th, 0.85, "Carrier lock threshold (in rad)."); | ||||
| DEFINE_int32(max_lock_fail, 50, "Maximum number of code lock failures before dropping a satellite."); | ||||
|  | ||||
| //cos(2xError_angle)=0.7 -> Error_angle=22 deg | ||||
| DEFINE_double(carrier_lock_th, 0.7, "Carrier lock threshold (in rad)."); | ||||
|  | ||||
| DEFINE_string(RINEX_version, "-", "If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file."); | ||||
|  | ||||
|   | ||||
| @@ -50,7 +50,8 @@ DECLARE_int32(doppler_step);  //!< If defined, sets the frequency step in the se | ||||
| // Declare flags for tracking blocks | ||||
| DECLARE_int32(cn0_samples);            //!< Number of correlator outputs used for CN0 estimation. | ||||
| DECLARE_int32(cn0_min);                //!< Minimum valid CN0 (in dB-Hz). | ||||
| DECLARE_int32(max_lock_fail);     //!< Maximum number of lock failures before dropping a satellite. | ||||
| DECLARE_int32(max_lock_fail);          //!< Maximum number of code lock failures before dropping a satellite. | ||||
| DECLARE_int32(max_carrier_lock_fail);  //!< Maximum number of carrier lock failures before dropping a satellite. | ||||
| DECLARE_double(carrier_lock_th);       //!< Carrier lock threshold (in rad). | ||||
| DECLARE_double(dll_bw_hz);             //!< Bandwidth of the DLL low pass filter, in Hz (overrides the configuration file). | ||||
| DECLARE_double(pll_bw_hz);             //!< Bandwidth of the PLL low pass filter, in Hz (overrides the configuration file). | ||||
|   | ||||
| @@ -430,7 +430,14 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__ | ||||
|                             { | ||||
|                                 DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite; | ||||
|                                 d_preamble_index = d_sample_counter;  // record the preamble sample stamp | ||||
|                                 if (corr_value < 0) flag_PLL_180_deg_phase_locked = true; | ||||
|                                 if (corr_value < 0) | ||||
|                                     { | ||||
|                                         flag_PLL_180_deg_phase_locked = true; | ||||
|                                     } | ||||
|                                 else | ||||
|                                     { | ||||
|                                         flag_PLL_180_deg_phase_locked = false; | ||||
|                                     } | ||||
|                                 d_stat = 2; | ||||
|                             } | ||||
|                         else | ||||
|   | ||||
| @@ -64,7 +64,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( | ||||
|     this->message_port_register_out(pmt::mp("telemetry_to_trk")); | ||||
|     d_last_valid_preamble = 0; | ||||
|     d_sent_tlm_failed_msg = false; | ||||
|     d_max_symbols_without_valid_frame = GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SAMPLES_PER_SYMBOL * GPS_L5_SYMBOLS_PER_BIT * 5;  //rise alarm if 5 consecutive subframes have no valid CRC | ||||
|     d_max_symbols_without_valid_frame = GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SAMPLES_PER_SYMBOL * GPS_L5_SYMBOLS_PER_BIT * 10;  //rise alarm if 10 consecutive subframes have no valid CRC | ||||
|  | ||||
|     // initialize internal vars | ||||
|     d_dump = dump; | ||||
|   | ||||
| @@ -152,30 +152,12 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( | ||||
|     trk_param.system = 'C'; | ||||
|     char sig_[3] = "B1"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) | ||||
|         { | ||||
|             cn0_samples = FLAGS_cn0_samples; | ||||
|         } | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 25); | ||||
|     if (FLAGS_cn0_min != 25) | ||||
|         { | ||||
|             cn0_min = FLAGS_cn0_min; | ||||
|         } | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) | ||||
|         { | ||||
|             max_lock_fail = FLAGS_max_lock_fail; | ||||
|         } | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) | ||||
|         { | ||||
|             carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|         } | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|  | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -147,18 +147,11 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( | ||||
|     trk_param.system = 'C'; | ||||
|     char sig_[3] = "B3"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples; | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 25); | ||||
|     if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min; | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail; | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -162,30 +162,11 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( | ||||
|     trk_param.system = 'E'; | ||||
|     char sig_[3] = "1B"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) | ||||
|         { | ||||
|             cn0_samples = FLAGS_cn0_samples; | ||||
|         } | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 25); | ||||
|     if (FLAGS_cn0_min != 25) | ||||
|         { | ||||
|             cn0_min = FLAGS_cn0_min; | ||||
|         } | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) | ||||
|         { | ||||
|             max_lock_fail = FLAGS_max_lock_fail; | ||||
|         } | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) | ||||
|         { | ||||
|             carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|         } | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -159,30 +159,11 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( | ||||
|     trk_param.system = 'E'; | ||||
|     char sig_[3] = "5X"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) | ||||
|         { | ||||
|             cn0_samples = FLAGS_cn0_samples; | ||||
|         } | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 25); | ||||
|     if (FLAGS_cn0_min != 25) | ||||
|         { | ||||
|             cn0_min = FLAGS_cn0_min; | ||||
|         } | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) | ||||
|         { | ||||
|             max_lock_fail = FLAGS_max_lock_fail; | ||||
|         } | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) | ||||
|         { | ||||
|             carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|         } | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -165,30 +165,11 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( | ||||
|     trk_param.system = 'G'; | ||||
|     char sig_[3] = "1C"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) | ||||
|         { | ||||
|             cn0_samples = FLAGS_cn0_samples; | ||||
|         } | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 30); | ||||
|     if (FLAGS_cn0_min != 25) | ||||
|         { | ||||
|             cn0_min = FLAGS_cn0_min; | ||||
|         } | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) | ||||
|         { | ||||
|             max_lock_fail = FLAGS_max_lock_fail; | ||||
|         } | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.80); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) | ||||
|         { | ||||
|             carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|         } | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -141,30 +141,11 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( | ||||
|     trk_param.system = 'G'; | ||||
|     char sig_[3] = "2S"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) | ||||
|         { | ||||
|             cn0_samples = FLAGS_cn0_samples; | ||||
|         } | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 25); | ||||
|     if (FLAGS_cn0_min != 25) | ||||
|         { | ||||
|             cn0_min = FLAGS_cn0_min; | ||||
|         } | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) | ||||
|         { | ||||
|             max_lock_fail = FLAGS_max_lock_fail; | ||||
|         } | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) | ||||
|         { | ||||
|             carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|         } | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -160,30 +160,12 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( | ||||
|     trk_param.system = 'G'; | ||||
|     char sig_[3] = "L5"; | ||||
|     std::memcpy(trk_param.signal, sig_, 3); | ||||
|     int cn0_samples = configuration->property(role + ".cn0_samples", 20); | ||||
|     if (FLAGS_cn0_samples != 20) | ||||
|         { | ||||
|             cn0_samples = FLAGS_cn0_samples; | ||||
|         } | ||||
|     trk_param.cn0_samples = cn0_samples; | ||||
|     int cn0_min = configuration->property(role + ".cn0_min", 25); | ||||
|     if (FLAGS_cn0_min != 25) | ||||
|         { | ||||
|             cn0_min = FLAGS_cn0_min; | ||||
|         } | ||||
|     trk_param.cn0_min = cn0_min; | ||||
|     int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); | ||||
|     if (FLAGS_max_lock_fail != 50) | ||||
|         { | ||||
|             max_lock_fail = FLAGS_max_lock_fail; | ||||
|         } | ||||
|     trk_param.max_lock_fail = max_lock_fail; | ||||
|     double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.75); | ||||
|     if (FLAGS_carrier_lock_th != 0.85) | ||||
|         { | ||||
|             carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|         } | ||||
|     trk_param.carrier_lock_th = carrier_lock_th; | ||||
|  | ||||
|     trk_param.cn0_samples = configuration->property(role + ".cn0_samples", trk_param.cn0_samples); | ||||
|     trk_param.cn0_min = configuration->property(role + ".cn0_min", trk_param.cn0_min); | ||||
|     trk_param.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param.max_code_lock_fail); | ||||
|     trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); | ||||
|     trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     if (item_type == "gr_complex") | ||||
|   | ||||
| @@ -444,6 +444,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl | ||||
|     d_carrier_lock_test = 1.0; | ||||
|     d_CN0_SNV_dB_Hz = 0.0; | ||||
|     d_carrier_lock_fail_counter = 0; | ||||
|     d_code_lock_fail_counter = 0; | ||||
|     d_carrier_lock_threshold = trk_parameters.carrier_lock_th; | ||||
|     d_Prompt_Data = static_cast<gr_complex *>(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment())); | ||||
|     d_cn0_smoother = Exponential_Smoother(); | ||||
| @@ -451,6 +452,13 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl | ||||
|         { | ||||
|             d_cn0_smoother.set_samples_for_initialization(200 / static_cast<int>(d_code_period * 1000.0)); | ||||
|         } | ||||
|  | ||||
|     d_carrier_lock_test_smoother = Exponential_Smoother(); | ||||
|     d_carrier_lock_test_smoother.set_alpha(0.002); | ||||
|     d_carrier_lock_test_smoother.set_min_value(-1.0); | ||||
|     d_carrier_lock_test_smoother.set_offset(0.0); | ||||
|     d_carrier_lock_test_smoother.set_samples_for_initialization(25); | ||||
|  | ||||
|     d_acquisition_gnss_synchro = nullptr; | ||||
|     d_channel = 0; | ||||
|     d_acq_code_phase_samples = 0.0; | ||||
| @@ -717,6 +725,7 @@ void dll_pll_veml_tracking::start_tracking() | ||||
|     std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0)); | ||||
|  | ||||
|     d_carrier_lock_fail_counter = 0; | ||||
|     d_code_lock_fail_counter = 0; | ||||
|     d_rem_code_phase_samples = 0.0; | ||||
|     d_rem_carr_phase_rad = 0.0; | ||||
|     d_rem_code_phase_chips = 0.0; | ||||
| @@ -866,11 +875,13 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_ | ||||
|     float d_CN0_SNV_dB_Hz_raw = cn0_svn_estimator(d_Prompt_buffer, trk_parameters.cn0_samples, static_cast<float>(coh_integration_time_s)); | ||||
|     d_CN0_SNV_dB_Hz = d_cn0_smoother.smooth(d_CN0_SNV_dB_Hz_raw); | ||||
|     // Carrier lock indicator | ||||
|     d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples); | ||||
|     d_carrier_lock_test = d_carrier_lock_test_smoother.smooth(carrier_lock_detector(d_Prompt_buffer, 1)); | ||||
|     //d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, trk_parameters.cn0_samples); | ||||
|     // Loss of lock detection | ||||
|     if (!d_pull_in_transitory) | ||||
|         { | ||||
|             if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) | ||||
|             //d_carrier_lock_test < d_carrier_lock_threshold or | ||||
|             if (d_carrier_lock_test < d_carrier_lock_threshold) | ||||
|                 { | ||||
|                     d_carrier_lock_fail_counter++; | ||||
|                 } | ||||
| @@ -881,13 +892,28 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_ | ||||
|                             d_carrier_lock_fail_counter--; | ||||
|                         } | ||||
|                 } | ||||
|  | ||||
|             if (d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) | ||||
|                 { | ||||
|                     d_code_lock_fail_counter++; | ||||
|                 } | ||||
|     if (d_carrier_lock_fail_counter > trk_parameters.max_lock_fail) | ||||
|             else | ||||
|                 { | ||||
|                     if (d_code_lock_fail_counter > 0) | ||||
|                         { | ||||
|                             d_code_lock_fail_counter--; | ||||
|                         } | ||||
|                 } | ||||
|         } | ||||
|     if (d_carrier_lock_fail_counter > trk_parameters.max_carrier_lock_fail or d_code_lock_fail_counter > trk_parameters.max_code_lock_fail) | ||||
|         { | ||||
|             std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; | ||||
|             LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; | ||||
|             LOG(INFO) << "Loss of lock in channel " << d_channel | ||||
|                       << " (carrier_lock_fail_counter:" << d_carrier_lock_fail_counter | ||||
|                       << " code_lock_fail_counter : " << d_code_lock_fail_counter << ")"; | ||||
|             this->message_port_pub(pmt::mp("events"), pmt::from_long(3));  // 3 -> loss of lock | ||||
|             d_carrier_lock_fail_counter = 0; | ||||
|             d_code_lock_fail_counter = 0; | ||||
|             return false; | ||||
|         } | ||||
|     return true; | ||||
| @@ -1573,6 +1599,8 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) | ||||
|             if (trk_parameters.pull_in_time_s < (d_sample_counter - d_acq_sample_stamp) / static_cast<int>(trk_parameters.fs_in)) | ||||
|                 { | ||||
|                     d_pull_in_transitory = false; | ||||
|                     d_carrier_lock_fail_counter = 0; | ||||
|                     d_code_lock_fail_counter = 0; | ||||
|                 } | ||||
|         } | ||||
|     switch (d_state) | ||||
| @@ -1606,6 +1634,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) | ||||
|                 d_state = 2; | ||||
|                 d_sample_counter += samples_offset;  // count for the processed samples | ||||
|                 d_cn0_smoother.reset(); | ||||
|                 d_carrier_lock_test_smoother.reset(); | ||||
|  | ||||
|                 DLOG(INFO) << "Number of samples between Acquisition and Tracking = " << acq_trk_diff_samples << " ( " << acq_trk_diff_seconds << " s)"; | ||||
|                 DLOG(INFO) << "PULL-IN Doppler [Hz] = " << d_carrier_doppler_hz | ||||
| @@ -1642,6 +1671,9 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) | ||||
|  | ||||
|                         // enable write dump file this cycle (valid DLL/PLL cycle) | ||||
|                         log_data(false); | ||||
|  | ||||
|                         if (!d_pull_in_transitory) | ||||
|                             { | ||||
|                                 if (d_secondary) | ||||
|                                     { | ||||
|                                         // ####### SECONDARY CODE LOCK ##### | ||||
| @@ -1702,7 +1734,11 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) | ||||
|                                     { | ||||
|                                         next_state = true; | ||||
|                                     } | ||||
|  | ||||
|                             } | ||||
|                         else | ||||
|                             { | ||||
|                                 next_state = false;  //keep in state 2 during pull-in transitory | ||||
|                             } | ||||
|                         // ########### Output the tracking results to Telemetry block ########## | ||||
|                         if (interchange_iq) | ||||
|                             { | ||||
| @@ -1837,7 +1873,6 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) | ||||
|                         d_extend_correlation_symbols_count = 0; | ||||
|                         d_state = 4; | ||||
|                     } | ||||
|                 log_data(true); | ||||
|                 break; | ||||
|             } | ||||
|         case 4:  // narrow tracking | ||||
|   | ||||
| @@ -193,13 +193,14 @@ private: | ||||
|     // CN0 estimation and lock detector | ||||
|     int32_t d_cn0_estimation_counter; | ||||
|     int32_t d_carrier_lock_fail_counter; | ||||
|     int32_t d_code_lock_fail_counter; | ||||
|     double d_carrier_lock_test; | ||||
|     double d_CN0_SNV_dB_Hz; | ||||
|     double d_carrier_lock_threshold; | ||||
|     boost::circular_buffer<gr_complex> d_Prompt_circular_buffer; | ||||
|     gr_complex *d_Prompt_buffer; | ||||
|     Exponential_Smoother d_cn0_smoother; | ||||
|  | ||||
|     Exponential_Smoother d_carrier_lock_test_smoother; | ||||
|     // file dump | ||||
|     std::ofstream d_dump_file; | ||||
|     std::string d_dump_filename; | ||||
|   | ||||
| @@ -82,6 +82,7 @@ target_link_libraries(tracking_libs | ||||
|         Gnuradio::runtime | ||||
|         Volkgnsssdr::volkgnsssdr | ||||
|         core_system_parameters | ||||
|         algorithms_libs | ||||
|         ${OPT_TRACKING_LIBRARIES} | ||||
|     PRIVATE | ||||
|         Gflags::gflags | ||||
|   | ||||
| @@ -31,6 +31,7 @@ | ||||
|  | ||||
|  | ||||
| #include "dll_pll_conf.h" | ||||
| #include "gnss_sdr_flags.h" | ||||
| #include <cstring> | ||||
|  | ||||
| Dll_Pll_Conf::Dll_Pll_Conf() | ||||
| @@ -61,11 +62,12 @@ Dll_Pll_Conf::Dll_Pll_Conf() | ||||
|     early_late_space_narrow_chips = 0.1; | ||||
|     very_early_late_space_narrow_chips = 0.1; | ||||
|     extend_correlation_symbols = 5; | ||||
|     cn0_samples = 20; | ||||
|     carrier_lock_det_mav_samples = 20; | ||||
|     cn0_min = 25; | ||||
|     max_lock_fail = 50; | ||||
|     carrier_lock_th = 0.85; | ||||
|     cn0_samples = FLAGS_cn0_samples; | ||||
|     carrier_lock_det_mav_samples = FLAGS_cn0_samples; | ||||
|     cn0_min = FLAGS_cn0_min; | ||||
|     max_carrier_lock_fail = FLAGS_max_carrier_lock_fail; | ||||
|     max_code_lock_fail = FLAGS_max_lock_fail; | ||||
|     carrier_lock_th = FLAGS_carrier_lock_th; | ||||
|     track_pilot = false; | ||||
|     system = 'G'; | ||||
|     char sig_[3] = "1C"; | ||||
|   | ||||
| @@ -69,7 +69,8 @@ public: | ||||
|     int32_t cn0_samples; | ||||
|     int32_t carrier_lock_det_mav_samples; | ||||
|     int32_t cn0_min; | ||||
|     int32_t max_lock_fail; | ||||
|     int32_t max_code_lock_fail; | ||||
|     int32_t max_carrier_lock_fail; | ||||
|     uint32_t smoother_length; | ||||
|     double carrier_lock_th; | ||||
|     bool track_pilot; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas