diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 3573a25fe..8ec6257ef 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -89,10 +89,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl { // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); - trk_parameters = conf_; + d_trk_parameters = conf_; // Telemetry bit synchronization message port input this->message_port_register_out(pmt::mp("events")); - this->set_relative_rate(1.0 / static_cast(trk_parameters.vector_length)); + this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); @@ -119,8 +119,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_data_secondary_code_length = 0U; d_data_secondary_code_string = nullptr; d_preamble_length_symbols = 0; - interchange_iq = false; - signal_type = std::string(trk_parameters.signal); + d_interchange_iq = false; + d_signal_type = std::string(d_trk_parameters.signal); std::map map_signal_pretty_name; map_signal_pretty_name["1C"] = "L1 C/A"; @@ -133,12 +133,12 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl map_signal_pretty_name["B1"] = "B1I"; map_signal_pretty_name["B3"] = "B3I"; - signal_pretty_name = map_signal_pretty_name[signal_type]; + d_signal_pretty_name = map_signal_pretty_name[d_signal_type]; - if (trk_parameters.system == 'G') + if (d_trk_parameters.system == 'G') { - systemName = "GPS"; - if (signal_type == "1C") + d_systemName = "GPS"; + if (d_signal_type == "1C") { d_signal_carrier_freq = GPS_L1_FREQ_HZ; d_code_period = GPS_L1_CA_CODE_PERIOD_S; @@ -148,17 +148,17 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_code_length_chips = static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS); // GPS L1 C/A does not have pilot component nor secondary code d_secondary = false; - trk_parameters.track_pilot = false; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.track_pilot = false; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; // symbol integration: 20 trk symbols (20 ms) = 1 tlm bit // set the preamble in the secondary code acquisition to obtain tlm symbol synchronization d_secondary_code_length = static_cast(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); d_secondary_code_string = const_cast(&GPS_CA_PREAMBLE_SYMBOLS_STR); d_symbols_per_bit = GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; } - else if (signal_type == "2S") + else if (d_signal_type == "2S") { d_signal_carrier_freq = GPS_L2_FREQ_HZ; d_code_period = GPS_L2_M_PERIOD_S; @@ -170,12 +170,12 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_code_samples_per_chip = 1; // GPS L2 does not have pilot component nor secondary code d_secondary = false; - trk_parameters.track_pilot = false; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.track_pilot = false; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; } - else if (signal_type == "L5") + else if (d_signal_type == "L5") { d_signal_carrier_freq = GPS_L5_FREQ_HZ; d_code_period = GPS_L5I_PERIOD_S; @@ -186,10 +186,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_code_samples_per_chip = 1; d_code_length_chips = static_cast(GPS_L5I_CODE_LENGTH_CHIPS); d_secondary = true; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; - if (trk_parameters.track_pilot) + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; + if (d_trk_parameters.track_pilot) { // synchronize pilot secondary code d_secondary_code_length = static_cast(GPS_L5Q_NH_CODE_LENGTH); @@ -198,7 +198,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl // remove Neuman-Hofman Code (see IS-GPS-705D) d_data_secondary_code_length = static_cast(GPS_L5I_NH_CODE_LENGTH); d_data_secondary_code_string = const_cast(&GPS_L5I_NH_CODE_STR); - signal_pretty_name = signal_pretty_name + "Q"; + d_signal_pretty_name = d_signal_pretty_name + "Q"; } else { @@ -206,8 +206,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl // remove Neuman-Hofman Code (see IS-GPS-705D) d_secondary_code_length = static_cast(GPS_L5I_NH_CODE_LENGTH); d_secondary_code_string = const_cast(&GPS_L5I_NH_CODE_STR); - signal_pretty_name = signal_pretty_name + "I"; - interchange_iq = true; + d_signal_pretty_name = d_signal_pretty_name + "I"; + d_interchange_iq = true; } } else @@ -223,10 +223,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_symbols_per_bit = 0; } } - else if (trk_parameters.system == 'E') + else if (d_trk_parameters.system == 'E') { - systemName = "Galileo"; - if (signal_type == "1B") + d_systemName = "Galileo"; + if (d_signal_type == "1B") { d_signal_carrier_freq = GALILEO_E1_FREQ_HZ; d_code_period = GALILEO_E1_CODE_PERIOD_S; @@ -237,24 +237,24 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_correlation_length_ms = 4; d_code_samples_per_chip = 2; // CBOC disabled: 2 samples per chip. CBOC enabled: 12 samples per chip d_veml = true; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - if (trk_parameters.track_pilot) + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + d_trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + if (d_trk_parameters.track_pilot) { d_secondary = true; d_secondary_code_length = static_cast(GALILEO_E1_C_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&GALILEO_E1_C_SECONDARY_CODE); - signal_pretty_name = signal_pretty_name + "C"; + d_signal_pretty_name = d_signal_pretty_name + "C"; } else { d_secondary = false; - signal_pretty_name = signal_pretty_name + "B"; + d_signal_pretty_name = d_signal_pretty_name + "B"; } // Note that E1-B and E1-C are in anti-phase, NOT IN QUADRATURE. See Galileo ICD. } - else if (signal_type == "5X") + else if (d_signal_type == "5X") { d_signal_carrier_freq = GALILEO_E5A_FREQ_HZ; d_code_period = GALILEO_E5A_CODE_PERIOD_S; @@ -264,14 +264,14 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_code_samples_per_chip = 1; d_code_length_chips = static_cast(GALILEO_E5A_CODE_LENGTH_CHIPS); d_secondary = true; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; - if (trk_parameters.track_pilot) + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; + if (d_trk_parameters.track_pilot) { // synchronize pilot secondary code d_secondary_code_length = static_cast(GALILEO_E5A_Q_SECONDARY_CODE_LENGTH); - signal_pretty_name = signal_pretty_name + "Q"; + d_signal_pretty_name = d_signal_pretty_name + "Q"; // remove data secondary code d_data_secondary_code_length = static_cast(GALILEO_E5A_I_SECONDARY_CODE_LENGTH); d_data_secondary_code_string = const_cast(&GALILEO_E5A_I_SECONDARY_CODE); @@ -281,8 +281,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl // synchronize and remove data secondary code d_secondary_code_length = static_cast(GALILEO_E5A_I_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&GALILEO_E5A_I_SECONDARY_CODE); - signal_pretty_name = signal_pretty_name + "I"; - interchange_iq = true; + d_signal_pretty_name = d_signal_pretty_name + "I"; + d_interchange_iq = true; } } else @@ -298,10 +298,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_symbols_per_bit = 0; } } - else if (trk_parameters.system == 'C') + else if (d_trk_parameters.system == 'C') { - systemName = "Beidou"; - if (signal_type == "B1") + d_systemName = "Beidou"; + if (d_signal_type == "B1") { // GEO Satellites use different secondary code d_signal_carrier_freq = BEIDOU_B1I_FREQ_HZ; @@ -312,17 +312,17 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_correlation_length_ms = 1; d_code_samples_per_chip = 1; d_secondary = true; - trk_parameters.track_pilot = false; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.track_pilot = false; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; // synchronize and remove data secondary code d_secondary_code_length = static_cast(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&BEIDOU_B1I_SECONDARY_CODE_STR); d_data_secondary_code_length = static_cast(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_data_secondary_code_string = const_cast(&BEIDOU_B1I_SECONDARY_CODE_STR); } - else if (signal_type == "B3") + else if (d_signal_type == "B3") { // GEO Satellites use different secondary code d_signal_carrier_freq = BEIDOU_B3I_FREQ_HZ; @@ -333,10 +333,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_correlation_length_ms = 1; d_code_samples_per_chip = 1; d_secondary = false; - trk_parameters.track_pilot = false; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.track_pilot = false; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; d_secondary_code_length = static_cast(BEIDOU_B3I_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&BEIDOU_B3I_SECONDARY_CODE_STR); d_data_secondary_code_length = static_cast(BEIDOU_B3I_SECONDARY_CODE_LENGTH); @@ -367,14 +367,14 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_code_samples_per_chip = 0U; d_symbols_per_bit = 0; } - T_chip_seconds = 0.0; - T_prn_seconds = 0.0; - T_prn_samples = 0.0; - K_blk_samples = 0.0; + d_T_chip_seconds = 0.0; + d_T_prn_seconds = 0.0; + d_T_prn_samples = 0.0; + d_K_blk_samples = 0.0; // Initialize tracking ========================================== - d_code_loop_filter = Tracking_loop_filter(d_code_period, trk_parameters.dll_bw_hz, trk_parameters.dll_filter_order, false); - d_carrier_loop_filter.set_params(trk_parameters.fll_bw_hz, trk_parameters.pll_bw_hz, trk_parameters.pll_filter_order); + d_code_loop_filter = Tracking_loop_filter(d_code_period, d_trk_parameters.dll_bw_hz, d_trk_parameters.dll_filter_order, false); + d_carrier_loop_filter.set_params(d_trk_parameters.fll_bw_hz, d_trk_parameters.pll_bw_hz, d_trk_parameters.pll_filter_order); // Initialization of local code replica // Get space for a vector with the sinboc(1,1) replica sampled 2x/chip @@ -401,11 +401,11 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_Prompt = &d_correlator_outs[2]; d_Late = &d_correlator_outs[3]; d_Very_Late = &d_correlator_outs[4]; - d_local_code_shift_chips[0] = -trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[1] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[1] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); d_local_code_shift_chips[2] = 0.0; - d_local_code_shift_chips[3] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[4] = trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[3] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[4] = d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); d_prompt_data_shift = &d_local_code_shift_chips[2]; } else @@ -415,36 +415,36 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_Prompt = &d_correlator_outs[1]; d_Late = &d_correlator_outs[2]; d_Very_Late = nullptr; - d_local_code_shift_chips[0] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); d_local_code_shift_chips[1] = 0.0; - d_local_code_shift_chips[2] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[2] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); d_prompt_data_shift = &d_local_code_shift_chips[1]; } - multicorrelator_cpu.init(2 * trk_parameters.vector_length, d_n_correlator_taps); + d_multicorrelator_cpu.init(2 * d_trk_parameters.vector_length, d_n_correlator_taps); - if (trk_parameters.extend_correlation_symbols > 1) + if (d_trk_parameters.extend_correlation_symbols > 1) { d_enable_extended_integration = true; } else { d_enable_extended_integration = false; - trk_parameters.extend_correlation_symbols = 1; + d_trk_parameters.extend_correlation_symbols = 1; } // Enable Data component prompt correlator (slave to Pilot prompt) if tracking uses Pilot signal - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { // Extra correlator for the data component - correlator_data_cpu.init(2 * trk_parameters.vector_length, 1); - correlator_data_cpu.set_high_dynamics_resampler(trk_parameters.high_dyn); + d_correlator_data_cpu.init(2 * d_trk_parameters.vector_length, 1); + d_correlator_data_cpu.set_high_dynamics_resampler(d_trk_parameters.high_dyn); d_data_code.resize(2 * d_code_length_chips, 0.0); } // --- Initializations --- d_Prompt_circular_buffer.set_capacity(d_secondary_code_length); - multicorrelator_cpu.set_high_dynamics_resampler(trk_parameters.high_dyn); + d_multicorrelator_cpu.set_high_dynamics_resampler(d_trk_parameters.high_dyn); // Initial code frequency basis of NCO d_code_freq_chips = d_code_chip_rate; // Residual code phase (in chips) @@ -456,31 +456,31 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_sample_counter = 0ULL; d_acq_sample_stamp = 0ULL; - d_current_prn_length_samples = static_cast(trk_parameters.vector_length); + d_current_prn_length_samples = static_cast(d_trk_parameters.vector_length); d_current_correlation_time_s = 0.0; // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer.reserve(trk_parameters.cn0_samples); + d_Prompt_buffer.reserve(d_trk_parameters.cn0_samples); 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_carrier_lock_threshold = d_trk_parameters.carrier_lock_th; d_Prompt_Data.reserve(1); d_cn0_smoother = Exponential_Smoother(); - d_cn0_smoother.set_alpha(trk_parameters.cn0_smoother_alpha); + d_cn0_smoother.set_alpha(d_trk_parameters.cn0_smoother_alpha); if (d_code_period > 0.0) { - d_cn0_smoother.set_samples_for_initialization(trk_parameters.cn0_smoother_samples / static_cast(d_code_period * 1000.0)); + d_cn0_smoother.set_samples_for_initialization(d_trk_parameters.cn0_smoother_samples / static_cast(d_code_period * 1000.0)); } d_carrier_lock_test_smoother = Exponential_Smoother(); - d_carrier_lock_test_smoother.set_alpha(trk_parameters.carrier_lock_test_smoother_alpha); + d_carrier_lock_test_smoother.set_alpha(d_trk_parameters.carrier_lock_test_smoother_alpha); 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(trk_parameters.carrier_lock_test_smoother_samples); + d_carrier_lock_test_smoother.set_samples_for_initialization(d_trk_parameters.carrier_lock_test_smoother_samples); d_acquisition_gnss_synchro = nullptr; d_channel = 0; @@ -497,10 +497,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_rem_code_phase_chips = 0.0; d_state = 0; // initial state: standby clear_tracking_vars(); - if (trk_parameters.smoother_length > 0) + if (d_trk_parameters.smoother_length > 0) { - d_carr_ph_history.set_capacity(trk_parameters.smoother_length * 2); - d_code_ph_history.set_capacity(trk_parameters.smoother_length * 2); + d_carr_ph_history.set_capacity(d_trk_parameters.smoother_length * 2); + d_code_ph_history.set_capacity(d_trk_parameters.smoother_length * 2); } else { @@ -508,11 +508,11 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl d_code_ph_history.set_capacity(1); } - d_dump = trk_parameters.dump; - d_dump_mat = trk_parameters.dump_mat and d_dump; + d_dump = d_trk_parameters.dump; + d_dump_mat = d_trk_parameters.dump_mat and d_dump; if (d_dump) { - d_dump_filename = trk_parameters.dump_filename; + d_dump_filename = d_trk_parameters.dump_filename; std::string dump_path; // Get path if (d_dump_filename.find_last_of('/') != std::string::npos) @@ -553,7 +553,7 @@ void dll_pll_veml_tracking::forecast(int noutput_items, { if (noutput_items != 0) { - ninput_items_required[0] = static_cast(trk_parameters.vector_length) * 2; + ninput_items_required[0] = static_cast(d_trk_parameters.vector_length) * 2; } } @@ -591,7 +591,7 @@ void dll_pll_veml_tracking::start_tracking() d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; d_carrier_doppler_hz = d_acq_carrier_doppler_hz; - d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / trk_parameters.fs_in; + d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / d_trk_parameters.fs_in; d_carrier_phase_rate_step_rad = 0.0; d_carr_ph_history.clear(); d_code_ph_history.clear(); @@ -600,49 +600,49 @@ void dll_pll_veml_tracking::start_tracking() Signal_[1] = d_acquisition_gnss_synchro->Signal[1]; Signal_[2] = d_acquisition_gnss_synchro->Signal[2]; - if (systemName == "GPS" and signal_type == "1C") + if (d_systemName == "GPS" and d_signal_type == "1C") { gps_l1_ca_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); } - else if (systemName == "GPS" and signal_type == "2S") + else if (d_systemName == "GPS" and d_signal_type == "2S") { gps_l2c_m_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN); } - else if (systemName == "GPS" and signal_type == "L5") + else if (d_systemName == "GPS" and d_signal_type == "L5") { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { gps_l5q_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN); gps_l5i_code_gen_float(d_data_code, d_acquisition_gnss_synchro->PRN); d_Prompt_Data[0] = gr_complex(0.0, 0.0); - correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code.data(), d_prompt_data_shift); + d_correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code.data(), d_prompt_data_shift); } else { gps_l5i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN); } } - else if (systemName == "Galileo" and signal_type == "1B") + else if (d_systemName == "Galileo" and d_signal_type == "1B") { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { std::array pilot_signal = {{'1', 'C', '\0'}}; galileo_e1_code_gen_sinboc11_float(d_tracking_code, pilot_signal, d_acquisition_gnss_synchro->PRN); galileo_e1_code_gen_sinboc11_float(d_data_code, Signal_, d_acquisition_gnss_synchro->PRN); d_Prompt_Data[0] = gr_complex(0.0, 0.0); - correlator_data_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_data_code.data(), d_prompt_data_shift); + d_correlator_data_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_data_code.data(), d_prompt_data_shift); } else { galileo_e1_code_gen_sinboc11_float(d_tracking_code, Signal_, d_acquisition_gnss_synchro->PRN); } } - else if (systemName == "Galileo" and signal_type == "5X") + else if (d_systemName == "Galileo" and d_signal_type == "5X") { volk_gnsssdr::vector aux_code(d_code_length_chips); std::array signal_type_ = {{'5', 'X', '\0'}}; galileo_e5_a_code_gen_complex_primary(aux_code, d_acquisition_gnss_synchro->PRN, signal_type_); - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_secondary_code_string = const_cast(&GALILEO_E5A_Q_SECONDARY_CODE[d_acquisition_gnss_synchro->PRN - 1]); for (uint32_t i = 0; i < d_code_length_chips; i++) @@ -651,7 +651,7 @@ void dll_pll_veml_tracking::start_tracking() d_data_code[i] = aux_code[i].real(); // the same because it is generated the full signal (E5aI + E5aQ) } d_Prompt_Data[0] = gr_complex(0.0, 0.0); - correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code.data(), d_prompt_data_shift); + d_correlator_data_cpu.set_local_code_and_taps(d_code_length_chips, d_data_code.data(), d_prompt_data_shift); } else { @@ -661,7 +661,7 @@ void dll_pll_veml_tracking::start_tracking() } } } - else if (systemName == "Beidou" and signal_type == "B1") + else if (d_systemName == "Beidou" and d_signal_type == "B1") { beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); // GEO Satellites use different secondary code @@ -671,7 +671,7 @@ void dll_pll_veml_tracking::start_tracking() d_correlation_length_ms = 1; d_code_samples_per_chip = 1; d_secondary = false; - trk_parameters.track_pilot = false; + d_trk_parameters.track_pilot = false; // set the preamble in the secondary code acquisition d_secondary_code_length = static_cast(BEIDOU_B1I_GEO_PREAMBLE_LENGTH_SYMBOLS); d_secondary_code_string = const_cast(&BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR); @@ -684,7 +684,7 @@ void dll_pll_veml_tracking::start_tracking() d_correlation_length_ms = 1; d_code_samples_per_chip = 1; d_secondary = true; - trk_parameters.track_pilot = false; + d_trk_parameters.track_pilot = false; // synchronize and remove data secondary code d_secondary_code_length = static_cast(BEIDOU_B1I_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&BEIDOU_B1I_SECONDARY_CODE_STR); @@ -694,7 +694,7 @@ void dll_pll_veml_tracking::start_tracking() } } - else if (systemName == "Beidou" and signal_type == "B3") + else if (d_systemName == "Beidou" and d_signal_type == "B3") { beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); // Update secondary code settings for geo satellites @@ -704,7 +704,7 @@ void dll_pll_veml_tracking::start_tracking() d_correlation_length_ms = 1; d_code_samples_per_chip = 1; d_secondary = false; - trk_parameters.track_pilot = false; + d_trk_parameters.track_pilot = false; // set the preamble in the secondary code acquisition d_secondary_code_length = static_cast(BEIDOU_B3I_GEO_PREAMBLE_LENGTH_SYMBOLS); d_secondary_code_string = const_cast(&BEIDOU_B3I_GEO_PREAMBLE_SYMBOLS_STR); @@ -717,7 +717,7 @@ void dll_pll_veml_tracking::start_tracking() d_correlation_length_ms = 1; d_code_samples_per_chip = 1; d_secondary = true; - trk_parameters.track_pilot = false; + d_trk_parameters.track_pilot = false; // synchronize and remove data secondary code d_secondary_code_length = static_cast(BEIDOU_B3I_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&BEIDOU_B3I_SECONDARY_CODE_STR); @@ -727,7 +727,7 @@ void dll_pll_veml_tracking::start_tracking() } } - multicorrelator_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_tracking_code.data(), d_local_code_shift_chips.data()); + d_multicorrelator_cpu.set_local_code_and_taps(d_code_samples_per_chip * d_code_length_chips, d_tracking_code.data(), d_local_code_shift_chips.data()); std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); d_carrier_lock_fail_counter = 0; @@ -742,30 +742,30 @@ void dll_pll_veml_tracking::start_tracking() if (d_veml) { - d_local_code_shift_chips[0] = -trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[1] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[3] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[4] = trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[1] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[3] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[4] = d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); } else { - d_local_code_shift_chips[0] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[2] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[2] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); } d_current_correlation_time_s = d_code_period; // Initialize tracking ========================================== - d_carrier_loop_filter.set_params(trk_parameters.fll_bw_hz, trk_parameters.pll_bw_hz, trk_parameters.pll_filter_order); - d_code_loop_filter.set_noise_bandwidth(trk_parameters.dll_bw_hz); + d_carrier_loop_filter.set_params(d_trk_parameters.fll_bw_hz, d_trk_parameters.pll_bw_hz, d_trk_parameters.pll_filter_order); + d_code_loop_filter.set_noise_bandwidth(d_trk_parameters.dll_bw_hz); d_code_loop_filter.set_update_interval(d_code_period); // DLL/PLL filter initialization d_carrier_loop_filter.initialize(static_cast(d_acq_carrier_doppler_hz)); // initialize the carrier filter d_code_loop_filter.initialize(); // initialize the code filter // DEBUG OUTPUT - std::cout << "Tracking of " << systemName << " " << signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; - DLOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; + std::cout << "Tracking of " << d_systemName << " " << d_signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + DLOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; // enable tracking pull-in d_state = 1; @@ -803,11 +803,11 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking() } try { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { - correlator_data_cpu.free(); + d_correlator_data_cpu.free(); } - multicorrelator_cpu.free(); + d_multicorrelator_cpu.free(); } catch (const std::exception &ex) { @@ -858,7 +858,7 @@ bool dll_pll_veml_tracking::acquire_secondary() bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_time_s) { // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < trk_parameters.cn0_samples) + if (d_cn0_estimation_counter < d_trk_parameters.cn0_samples) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_P_accu; @@ -866,10 +866,10 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_ return true; } - d_Prompt_buffer[d_cn0_estimation_counter % trk_parameters.cn0_samples] = d_P_accu; + d_Prompt_buffer[d_cn0_estimation_counter % d_trk_parameters.cn0_samples] = d_P_accu; d_cn0_estimation_counter++; // Code lock indicator - float d_CN0_SNV_dB_Hz_raw = cn0_m2m4_estimator(d_Prompt_buffer.data(), trk_parameters.cn0_samples, static_cast(coh_integration_time_s)); + float d_CN0_SNV_dB_Hz_raw = cn0_m2m4_estimator(d_Prompt_buffer.data(), d_trk_parameters.cn0_samples, static_cast(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 = d_carrier_lock_test_smoother.smooth(carrier_lock_detector(d_Prompt_buffer.data(), 1)); @@ -888,7 +888,7 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_ } } - if (d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) + if (d_CN0_SNV_dB_Hz < d_trk_parameters.cn0_min) { d_code_lock_fail_counter++; } @@ -900,7 +900,7 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status(double coh_integration_ } } } - if (d_carrier_lock_fail_counter > trk_parameters.max_carrier_lock_fail or d_code_lock_fail_counter > trk_parameters.max_code_lock_fail) + if (d_carrier_lock_fail_counter > d_trk_parameters.max_carrier_lock_fail or d_code_lock_fail_counter > d_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 @@ -924,26 +924,26 @@ void dll_pll_veml_tracking::do_correlation_step(const gr_complex *input_samples) { // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation - multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), input_samples); - multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler( + d_multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), input_samples); + d_multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler( d_rem_carr_phase_rad, d_carrier_phase_step_rad, d_carrier_phase_rate_step_rad, static_cast(d_rem_code_phase_chips) * static_cast(d_code_samples_per_chip), static_cast(d_code_phase_step_chips) * static_cast(d_code_samples_per_chip), static_cast(d_code_phase_rate_step_chips) * static_cast(d_code_samples_per_chip), - trk_parameters.vector_length); + d_trk_parameters.vector_length); // DATA CORRELATOR (if tracking tracks the pilot signal) - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { - correlator_data_cpu.set_input_output_vectors(d_Prompt_Data.data(), input_samples); - correlator_data_cpu.Carrier_wipeoff_multicorrelator_resampler( + d_correlator_data_cpu.set_input_output_vectors(d_Prompt_Data.data(), input_samples); + d_correlator_data_cpu.Carrier_wipeoff_multicorrelator_resampler( d_rem_carr_phase_rad, d_carrier_phase_step_rad, d_carrier_phase_rate_step_rad, static_cast(d_rem_code_phase_chips) * static_cast(d_code_samples_per_chip), static_cast(d_code_phase_step_chips) * static_cast(d_code_samples_per_chip), static_cast(d_code_phase_rate_step_chips) * static_cast(d_code_samples_per_chip), - trk_parameters.vector_length); + d_trk_parameters.vector_length); } } @@ -963,7 +963,7 @@ void dll_pll_veml_tracking::run_dll_pll() d_carr_phase_error_hz = pll_four_quadrant_atan(d_P_accu) / PI_2; } - if ((d_pull_in_transitory == true and trk_parameters.enable_fll_pull_in == true) or trk_parameters.enable_fll_steady_state) + if ((d_pull_in_transitory == true and d_trk_parameters.enable_fll_pull_in == true) or d_trk_parameters.enable_fll_steady_state) { // FLL discriminator // d_carr_freq_error_hz = fll_four_quadrant_atan(d_P_accu_old, d_P_accu, 0, d_current_correlation_time_s) / GPS_TWO_PI; @@ -972,7 +972,7 @@ void dll_pll_veml_tracking::run_dll_pll() d_P_accu_old = d_P_accu; // std::cout << "d_carr_freq_error_hz: " << d_carr_freq_error_hz << std::endl; // Carrier discriminator filter - if ((d_pull_in_transitory == true and trk_parameters.enable_fll_pull_in == true)) + if ((d_pull_in_transitory == true and d_trk_parameters.enable_fll_pull_in == true)) { // pure FLL, disable PLL d_carr_error_filt_hz = d_carrier_loop_filter.get_carrier_error(d_carr_freq_error_hz, 0, d_current_correlation_time_s); @@ -1003,19 +1003,19 @@ void dll_pll_veml_tracking::run_dll_pll() } else { - d_code_error_chips = dll_nc_e_minus_l_normalized(d_E_accu, d_L_accu, trk_parameters.spc, trk_parameters.slope, trk_parameters.y_intercept); // [chips/Ti] + d_code_error_chips = dll_nc_e_minus_l_normalized(d_E_accu, d_L_accu, d_trk_parameters.spc, d_trk_parameters.slope, d_trk_parameters.y_intercept); // [chips/Ti] } // Code discriminator filter d_code_error_filt_chips = d_code_loop_filter.apply(d_code_error_chips); // [chips/second] // New code Doppler frequency estimation d_code_freq_chips = d_code_chip_rate - d_code_error_filt_chips; - if (trk_parameters.carrier_aiding) + if (d_trk_parameters.carrier_aiding) { d_code_freq_chips += d_carrier_doppler_hz * d_code_chip_rate / d_signal_carrier_freq; } // Experimental: detect Carrier Doppler vs. Code Doppler incoherence and correct the Carrier Doppler - if (trk_parameters.enable_doppler_correction == true) + if (d_trk_parameters.enable_doppler_correction == true) { if (d_pull_in_transitory == false and d_corrected_doppler == false) { @@ -1027,7 +1027,7 @@ void dll_pll_veml_tracking::run_dll_pll() if (std::fabs(avg_code_error_chips_s) > 1.0) { float carrier_doppler_error_hz = static_cast(d_signal_carrier_freq) * avg_code_error_chips_s / static_cast(d_code_chip_rate); - LOG(INFO) << "Detected and corrected carrier doppler error: " << carrier_doppler_error_hz << " [Hz] on sat " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN); + LOG(INFO) << "Detected and corrected carrier doppler error: " << carrier_doppler_error_hz << " [Hz] on sat " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); d_carrier_loop_filter.initialize(d_carrier_doppler_hz - carrier_doppler_error_hz); d_corrected_doppler = true; } @@ -1051,7 +1051,7 @@ void dll_pll_veml_tracking::check_carrier_phase_coherent_initialization() void dll_pll_veml_tracking::clear_tracking_vars() { std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_Prompt_Data[0] = gr_complex(0.0, 0.0); d_P_data_accu = gr_complex(0.0, 0.0); @@ -1074,21 +1074,21 @@ void dll_pll_veml_tracking::clear_tracking_vars() void dll_pll_veml_tracking::update_tracking_vars() { - T_chip_seconds = 1.0 / d_code_freq_chips; - T_prn_seconds = T_chip_seconds * static_cast(d_code_length_chips); + d_T_chip_seconds = 1.0 / d_code_freq_chips; + d_T_prn_seconds = d_T_chip_seconds * static_cast(d_code_length_chips); // ################## CARRIER AND CODE NCO BUFFER ALIGNMENT ####################### // keep alignment parameters for the next input buffer // Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation - T_prn_samples = T_prn_seconds * trk_parameters.fs_in; - K_blk_samples = T_prn_samples + d_rem_code_phase_samples; - d_current_prn_length_samples = static_cast(std::floor(K_blk_samples)); // round to a discrete number of samples + d_T_prn_samples = d_T_prn_seconds * d_trk_parameters.fs_in; + d_K_blk_samples = d_T_prn_samples + d_rem_code_phase_samples; + d_current_prn_length_samples = static_cast(std::floor(d_K_blk_samples)); // round to a discrete number of samples // ################### PLL COMMANDS ################################################# // carrier phase step (NCO phase increment per sample) [rads/sample] - d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / trk_parameters.fs_in; + d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / d_trk_parameters.fs_in; // carrier phase rate step (NCO phase increment rate per sample) [rads/sample^2] - if (trk_parameters.high_dyn) + if (d_trk_parameters.high_dyn) { d_carr_ph_history.push_back(std::pair(d_carrier_phase_step_rad, static_cast(d_current_prn_length_samples))); if (d_carr_ph_history.full()) @@ -1096,18 +1096,18 @@ void dll_pll_veml_tracking::update_tracking_vars() double tmp_cp1 = 0.0; double tmp_cp2 = 0.0; double tmp_samples = 0.0; - for (unsigned int k = 0; k < trk_parameters.smoother_length; k++) + for (unsigned int k = 0; k < d_trk_parameters.smoother_length; k++) { tmp_cp1 += d_carr_ph_history[k].first; - tmp_cp2 += d_carr_ph_history[trk_parameters.smoother_length * 2 - k - 1].first; - tmp_samples += d_carr_ph_history[trk_parameters.smoother_length * 2 - k - 1].second; + tmp_cp2 += d_carr_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].first; + tmp_samples += d_carr_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].second; } - tmp_cp1 /= static_cast(trk_parameters.smoother_length); - tmp_cp2 /= static_cast(trk_parameters.smoother_length); + tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); + tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples; } } - // std::cout << d_carrier_phase_rate_step_rad * trk_parameters.fs_in * trk_parameters.fs_in / PI_2 << std::endl; + // std::cout << d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / PI_2 << std::endl; // remnant carrier phase to prevent overflow in the code NCO d_rem_carr_phase_rad += static_cast(d_carrier_phase_step_rad * static_cast(d_current_prn_length_samples) + 0.5 * d_carrier_phase_rate_step_rad * static_cast(d_current_prn_length_samples) * static_cast(d_current_prn_length_samples)); d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, PI_2); @@ -1120,8 +1120,8 @@ void dll_pll_veml_tracking::update_tracking_vars() // ################### DLL COMMANDS ################################################# // code phase step (Code resampler phase increment per sample) [chips/sample] - d_code_phase_step_chips = d_code_freq_chips / trk_parameters.fs_in; - if (trk_parameters.high_dyn) + d_code_phase_step_chips = d_code_freq_chips / d_trk_parameters.fs_in; + if (d_trk_parameters.high_dyn) { d_code_ph_history.push_back(std::pair(d_code_phase_step_chips, static_cast(d_current_prn_length_samples))); if (d_code_ph_history.full()) @@ -1129,20 +1129,20 @@ void dll_pll_veml_tracking::update_tracking_vars() double tmp_cp1 = 0.0; double tmp_cp2 = 0.0; double tmp_samples = 0.0; - for (unsigned int k = 0; k < trk_parameters.smoother_length; k++) + for (unsigned int k = 0; k < d_trk_parameters.smoother_length; k++) { tmp_cp1 += d_code_ph_history[k].first; - tmp_cp2 += d_code_ph_history[trk_parameters.smoother_length * 2 - k - 1].first; - tmp_samples += d_code_ph_history[trk_parameters.smoother_length * 2 - k - 1].second; + tmp_cp2 += d_code_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].first; + tmp_samples += d_code_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].second; } - tmp_cp1 /= static_cast(trk_parameters.smoother_length); - tmp_cp2 /= static_cast(trk_parameters.smoother_length); + tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); + tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples; } } // remnant code phase [chips] - d_rem_code_phase_samples = K_blk_samples - static_cast(d_current_prn_length_samples); // rounding error < 1 sample - d_rem_code_phase_chips = d_code_freq_chips * d_rem_code_phase_samples / trk_parameters.fs_in; + d_rem_code_phase_samples = d_K_blk_samples - static_cast(d_current_prn_length_samples); // rounding error < 1 sample + d_rem_code_phase_chips = d_code_freq_chips * d_rem_code_phase_samples / d_trk_parameters.fs_in; } @@ -1193,7 +1193,7 @@ void dll_pll_veml_tracking::save_correlation_results() { if (d_data_secondary_code_length > 0) { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { if (d_data_secondary_code_string->at(d_current_data_symbol) == '0') { @@ -1222,7 +1222,7 @@ void dll_pll_veml_tracking::save_correlation_results() } else { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_P_data_accu += d_Prompt_Data[0]; } @@ -1237,7 +1237,7 @@ void dll_pll_veml_tracking::save_correlation_results() } else { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_P_data_accu = d_Prompt_Data[0]; } @@ -1247,7 +1247,7 @@ void dll_pll_veml_tracking::save_correlation_results() } } - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { // If tracking pilot, disable Costas loop d_cloop = false; @@ -1274,7 +1274,7 @@ void dll_pll_veml_tracking::log_data() float tmp_float; double tmp_double; uint64_t tmp_long_int; - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { prompt_I = d_Prompt_Data.data()->real(); prompt_Q = d_Prompt_Data.data()->imag(); @@ -1319,12 +1319,12 @@ void dll_pll_veml_tracking::log_data() tmp_float = d_carrier_doppler_hz; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier phase rate [Hz/s] - tmp_float = d_carrier_phase_rate_step_rad * trk_parameters.fs_in * trk_parameters.fs_in / PI_2; + tmp_float = d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / PI_2; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); tmp_float = d_code_freq_chips; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // code phase rate [chips/s^2] - tmp_float = d_code_phase_rate_step_chips * trk_parameters.fs_in * trk_parameters.fs_in; + tmp_float = d_code_phase_rate_step_chips * d_trk_parameters.fs_in * d_trk_parameters.fs_in; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands tmp_float = d_carr_phase_error_hz; @@ -1614,7 +1614,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) if (d_pull_in_transitory == true) { - if (trk_parameters.pull_in_time_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(trk_parameters.fs_in)) + if (d_trk_parameters.pull_in_time_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(d_trk_parameters.fs_in)) { d_pull_in_transitory = false; d_carrier_lock_fail_counter = 0; @@ -1634,15 +1634,15 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) { // Signal alignment (skip samples until the incoming signal is aligned with local replica) int64_t acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); - double acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / trk_parameters.fs_in; + double acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / d_trk_parameters.fs_in; double delta_trk_to_acq_prn_start_samples = static_cast(acq_trk_diff_samples) - d_acq_code_phase_samples; d_code_freq_chips = d_code_chip_rate; - d_code_phase_step_chips = d_code_freq_chips / trk_parameters.fs_in; + d_code_phase_step_chips = d_code_freq_chips / d_trk_parameters.fs_in; d_code_phase_rate_step_chips = 0.0; double T_chip_mod_seconds = 1.0 / d_code_freq_chips; double T_prn_mod_seconds = T_chip_mod_seconds * static_cast(d_code_length_chips); - double T_prn_mod_samples = T_prn_mod_seconds * trk_parameters.fs_in; + double T_prn_mod_samples = T_prn_mod_seconds * d_trk_parameters.fs_in; d_acq_code_phase_samples = T_prn_mod_samples - std::fmod(delta_trk_to_acq_prn_start_samples, T_prn_mod_samples); d_current_prn_length_samples = round(T_prn_mod_samples); @@ -1673,19 +1673,19 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) d_E_accu = *d_Early; d_P_accu = *d_Prompt; d_L_accu = *d_Late; - trk_parameters.spc = trk_parameters.early_late_space_chips; - // if (std::string(trk_parameters.signal) == "E1") + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + // if (std::string(d_trk_parameters.signal) == "E1") // { - // trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - // trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); + // d_trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + // d_trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); // } // fail-safe: check if the secondary code or bit synchronization has not succeeded in a limited time period - if (trk_parameters.bit_synchronization_time_limit_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(trk_parameters.fs_in)) + if (d_trk_parameters.bit_synchronization_time_limit_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(d_trk_parameters.fs_in)) { d_carrier_lock_fail_counter = 300000; // force loss-of-lock condition - LOG(INFO) << systemName << " " << signal_pretty_name << " tracking synchronization time limit reached in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " tracking synchronization time limit reached in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } // Check lock status if (!cn0_and_tracking_lock_status(d_code_period)) @@ -1714,10 +1714,10 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) next_state = acquire_secondary(); if (next_state) { - LOG(INFO) << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; - std::cout << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " secondary code locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + std::cout << d_systemName << " " << d_signal_pretty_name << " secondary code locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } } } @@ -1730,10 +1730,10 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) next_state = acquire_secondary(); if (next_state) { - LOG(INFO) << systemName << " " << signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; - std::cout << systemName << " " << signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + std::cout << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } } } @@ -1762,36 +1762,36 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) { // UPDATE INTEGRATION TIME d_extend_correlation_symbols_count = 0; - d_current_correlation_time_s = static_cast(trk_parameters.extend_correlation_symbols) * static_cast(d_code_period); + d_current_correlation_time_s = static_cast(d_trk_parameters.extend_correlation_symbols) * static_cast(d_code_period); d_state = 3; // next state is the extended correlator integrator - LOG(INFO) << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " + LOG(INFO) << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN); - std::cout << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); + std::cout << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; // Set narrow taps delay values [chips] d_code_loop_filter.set_update_interval(d_current_correlation_time_s); - d_code_loop_filter.set_noise_bandwidth(trk_parameters.dll_bw_narrow_hz); - d_carrier_loop_filter.set_params(trk_parameters.fll_bw_hz, trk_parameters.pll_bw_narrow_hz, trk_parameters.pll_filter_order); + d_code_loop_filter.set_noise_bandwidth(d_trk_parameters.dll_bw_narrow_hz); + d_carrier_loop_filter.set_params(d_trk_parameters.fll_bw_hz, d_trk_parameters.pll_bw_narrow_hz, d_trk_parameters.pll_filter_order); if (d_veml) { - d_local_code_shift_chips[0] = -trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[1] = -trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[3] = trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[4] = trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - trk_parameters.spc = trk_parameters.early_late_space_narrow_chips; - // if (std::string(trk_parameters.signal) == "E1") + d_local_code_shift_chips[0] = -d_trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[1] = -d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[3] = d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[4] = d_trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_trk_parameters.spc = d_trk_parameters.early_late_space_narrow_chips; + // if (std::string(d_trk_parameters.signal) == "E1") // { - // trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - // trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); + // d_trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + // d_trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); // } } else { - d_local_code_shift_chips[0] = -trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[2] = trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - trk_parameters.spc = trk_parameters.early_late_space_narrow_chips; + d_local_code_shift_chips[0] = -d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[2] = d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_trk_parameters.spc = d_trk_parameters.early_late_space_narrow_chips; } } else @@ -1814,7 +1814,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - if (interchange_iq) + if (d_interchange_iq) { current_synchro_data.Prompt_I = static_cast(d_P_data_accu.imag()); current_synchro_data.Prompt_Q = static_cast(d_P_data_accu.real()); @@ -1833,7 +1833,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) d_P_data_accu = gr_complex(0.0, 0.0); } d_extend_correlation_symbols_count++; - if (d_extend_correlation_symbols_count == (trk_parameters.extend_correlation_symbols - 1)) + if (d_extend_correlation_symbols_count == (d_trk_parameters.extend_correlation_symbols - 1)) { d_extend_correlation_symbols_count = 0; d_state = 4; @@ -1847,7 +1847,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) save_correlation_results(); // check lock status - if (!cn0_and_tracking_lock_status(d_code_period * static_cast(trk_parameters.extend_correlation_symbols))) + if (!cn0_and_tracking_lock_status(d_code_period * static_cast(d_trk_parameters.extend_correlation_symbols))) { clear_tracking_vars(); d_state = 0; // loss-of-lock detected @@ -1864,7 +1864,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - if (interchange_iq) + if (d_interchange_iq) { current_synchro_data.Prompt_I = static_cast(d_P_data_accu.imag()); current_synchro_data.Prompt_Q = static_cast(d_P_data_accu.real()); @@ -1900,7 +1900,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) d_sample_counter += static_cast(d_current_prn_length_samples); if (current_synchro_data.Flag_valid_symbol_output) { - current_synchro_data.fs = static_cast(trk_parameters.fs_in); + current_synchro_data.fs = static_cast(d_trk_parameters.fs_in); current_synchro_data.Tracking_sample_counter = d_sample_counter; *out[0] = current_synchro_data; return 1; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index dfec925e8..f76668273 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -74,111 +74,49 @@ public: private: friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_); - void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg); explicit dll_pll_veml_tracking(const Dll_Pll_Conf &conf_); - bool cn0_and_tracking_lock_status(double coh_integration_time_s); - bool acquire_secondary(); - void do_correlation_step(const gr_complex *input_samples); - void run_dll_pll(); - void check_carrier_phase_coherent_initialization(); - void update_tracking_vars(); - void clear_tracking_vars(); - void save_correlation_results(); - void log_data(); - int32_t save_matfile(); - - // tracking configuration vars - Dll_Pll_Conf trk_parameters; + bool d_pull_in_transitory; + bool d_corrected_doppler; + bool d_interchange_iq; bool d_veml; bool d_cloop; - uint32_t d_channel; - Gnss_Synchro *d_acquisition_gnss_synchro; - - // Signal parameters bool d_secondary; - double d_signal_carrier_freq; - double d_code_period; - double d_code_chip_rate; + bool d_dump; + bool d_dump_mat; + bool d_acc_carrier_phase_initialized; + bool d_enable_extended_integration; + + int32_t d_symbols_per_bit; + int32_t d_preamble_length_symbols; + int32_t d_state; + int32_t d_correlation_length_ms; + int32_t d_n_correlator_taps; + int32_t d_current_prn_length_samples; + int32_t d_extend_correlation_symbols_count; + int32_t d_current_symbol; + int32_t d_current_data_symbol; + int32_t d_cn0_estimation_counter; + int32_t d_carrier_lock_fail_counter; + int32_t d_code_lock_fail_counter; + + uint32_t d_channel; uint32_t d_secondary_code_length; uint32_t d_data_secondary_code_length; uint32_t d_code_length_chips; uint32_t d_code_samples_per_chip; // All signals have 1 sample per chip code except Gal. E1 which has 2 (CBOC disabled) or 12 (CBOC enabled) - int32_t d_symbols_per_bit; - std::string systemName; - std::string signal_type; - std::string *d_secondary_code_string; - std::string *d_data_secondary_code_string; - std::string signal_pretty_name; - int32_t d_preamble_length_symbols; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; - // dll filter buffer - boost::circular_buffer d_dll_filt_history; - // tracking state machine - int32_t d_state; - bool d_acc_carrier_phase_initialized; - - // Integration period in samples - int32_t d_correlation_length_ms; - int32_t d_n_correlator_taps; - - volk_gnsssdr::vector d_tracking_code; - volk_gnsssdr::vector d_data_code; - volk_gnsssdr::vector d_local_code_shift_chips; float *d_prompt_data_shift; - Cpu_Multicorrelator_Real_Codes multicorrelator_cpu; - Cpu_Multicorrelator_Real_Codes correlator_data_cpu; // for data channel - - /* TODO: currently the multicorrelator does not support adding extra correlator - with different local code, thus we need extra multicorrelator instance. - Implement this functionality inside multicorrelator class - as an enhancement to increase the performance - */ - volk_gnsssdr::vector d_correlator_outs; - gr_complex *d_Very_Early; - gr_complex *d_Early; - gr_complex *d_Prompt; - gr_complex *d_Late; - gr_complex *d_Very_Late; - - bool d_enable_extended_integration; - int32_t d_extend_correlation_symbols_count; - int32_t d_current_symbol; - int32_t d_current_data_symbol; - - gr_complex d_VE_accu; - gr_complex d_E_accu; - gr_complex d_P_accu; - gr_complex d_P_accu_old; - gr_complex d_L_accu; - gr_complex d_VL_accu; - - gr_complex d_P_data_accu; - volk_gnsssdr::vector d_Prompt_Data; - - double d_code_phase_step_chips; - double d_code_phase_rate_step_chips; - boost::circular_buffer> d_code_ph_history; - double d_carrier_phase_step_rad; - double d_carrier_phase_rate_step_rad; - boost::circular_buffer> d_carr_ph_history; - - // remaining code phase and carrier phase between tracking loops - double d_rem_code_phase_samples; float d_rem_carr_phase_rad; - Tracking_loop_filter d_code_loop_filter; - Tracking_FLL_PLL_filter d_carrier_loop_filter; - - // acquisition + double d_signal_carrier_freq; + double d_code_period; + double d_code_chip_rate; double d_acq_code_phase_samples; double d_acq_carrier_doppler_hz; - - // tracking vars - bool d_pull_in_transitory; - bool d_corrected_doppler; - bool interchange_iq; double d_current_correlation_time_s; double d_carr_phase_error_hz; double d_carr_freq_error_hz; @@ -189,32 +127,78 @@ private: double d_carrier_doppler_hz; double d_acc_carrier_phase_rad; double d_rem_code_phase_chips; - double T_chip_seconds; - double T_prn_seconds; - double T_prn_samples; - double K_blk_samples; - // PRN period in samples - int32_t d_current_prn_length_samples; - // processing samples counters - uint64_t d_sample_counter; - uint64_t d_acq_sample_stamp; - - // 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_T_chip_seconds; + double d_T_prn_seconds; + double d_T_prn_samples; + double d_K_blk_samples; double d_carrier_lock_test; double d_CN0_SNV_dB_Hz; double d_carrier_lock_threshold; + double d_carrier_phase_step_rad; + double d_carrier_phase_rate_step_rad; + double d_code_phase_step_chips; + double d_code_phase_rate_step_chips; + double d_rem_code_phase_samples; + + gr_complex *d_Very_Early; + gr_complex *d_Early; + gr_complex *d_Prompt; + gr_complex *d_Late; + gr_complex *d_Very_Late; + + gr_complex d_VE_accu; + gr_complex d_E_accu; + gr_complex d_P_accu; + gr_complex d_P_accu_old; + gr_complex d_L_accu; + gr_complex d_VL_accu; + gr_complex d_P_data_accu; + + std::string *d_secondary_code_string; + std::string *d_data_secondary_code_string; + std::string d_systemName; + std::string d_signal_type; + std::string d_signal_pretty_name; + std::string d_dump_filename; + + std::ofstream d_dump_file; + + boost::circular_buffer d_dll_filt_history; + boost::circular_buffer> d_code_ph_history; + boost::circular_buffer> d_carr_ph_history; boost::circular_buffer d_Prompt_circular_buffer; + + volk_gnsssdr::vector d_tracking_code; + volk_gnsssdr::vector d_data_code; + volk_gnsssdr::vector d_local_code_shift_chips; + volk_gnsssdr::vector d_correlator_outs; + volk_gnsssdr::vector d_Prompt_Data; volk_gnsssdr::vector d_Prompt_buffer; + + Cpu_Multicorrelator_Real_Codes d_multicorrelator_cpu; + Cpu_Multicorrelator_Real_Codes d_correlator_data_cpu; // for data channel + + Dll_Pll_Conf d_trk_parameters; + Exponential_Smoother d_cn0_smoother; Exponential_Smoother d_carrier_lock_test_smoother; - // file dump - std::ofstream d_dump_file; - std::string d_dump_filename; - bool d_dump; - bool d_dump_mat; + + Gnss_Synchro *d_acquisition_gnss_synchro; + + Tracking_loop_filter d_code_loop_filter; + Tracking_FLL_PLL_filter d_carrier_loop_filter; + + void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg); + void do_correlation_step(const gr_complex *input_samples); + void run_dll_pll(); + void check_carrier_phase_coherent_initialization(); + void update_tracking_vars(); + void clear_tracking_vars(); + void save_correlation_results(); + void log_data(); + bool cn0_and_tracking_lock_status(double coh_integration_time_s); + bool acquire_secondary(); + int32_t save_matfile(); }; #endif // GNSS_SDR_DLL_PLL_VEML_TRACKING_H diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 3552dd3be..62d449743 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -80,10 +80,10 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); - trk_parameters = conf_; + d_trk_parameters = conf_; // Telemetry bit synchronization message port input this->message_port_register_out(pmt::mp("events")); - this->set_relative_rate(1.0 / static_cast(trk_parameters.vector_length)); + this->set_relative_rate(1.0 / static_cast(d_trk_parameters.vector_length)); // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); @@ -107,8 +107,8 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_secondary_code_string = nullptr; d_data_secondary_code_length = 0U; d_data_secondary_code_string = nullptr; - signal_type = std::string(trk_parameters.signal); - interchange_iq = false; + d_signal_type = std::string(d_trk_parameters.signal); + d_interchange_iq = false; std::map map_signal_pretty_name; map_signal_pretty_name["1C"] = "L1 C/A"; @@ -119,21 +119,21 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & map_signal_pretty_name["5X"] = "E5a"; map_signal_pretty_name["L5"] = "L5"; - signal_pretty_name = map_signal_pretty_name[signal_type]; + d_signal_pretty_name = map_signal_pretty_name[d_signal_type]; - d_code_samples_per_chip = trk_parameters.code_samples_per_chip; // number of samples per chip - d_code_length_chips = trk_parameters.code_length_chips; - d_extended_correlation_in_fpga = trk_parameters.extended_correlation_in_fpga; + d_code_samples_per_chip = d_trk_parameters.code_samples_per_chip; // number of samples per chip + d_code_length_chips = d_trk_parameters.code_length_chips; + d_extended_correlation_in_fpga = d_trk_parameters.extended_correlation_in_fpga; d_current_extended_correlation_in_fpga = false; - d_extend_fpga_integration_periods = trk_parameters.extend_fpga_integration_periods; // by default - d_fpga_integration_period = trk_parameters.fpga_integration_period; // by default + d_extend_fpga_integration_periods = d_trk_parameters.extend_fpga_integration_periods; // by default + d_fpga_integration_period = d_trk_parameters.fpga_integration_period; // by default d_current_fpga_integration_period = 1; d_sc_demodulate_enabled = false; - if (trk_parameters.system == 'G') + if (d_trk_parameters.system == 'G') { - systemName = "GPS"; - if (signal_type == "1C") + d_systemName = "GPS"; + if (d_signal_type == "1C") { d_signal_carrier_freq = GPS_L1_FREQ_HZ; d_code_period = GPS_L1_CA_CODE_PERIOD_S; @@ -141,17 +141,17 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_correlation_length_ms = 1; // GPS L1 C/A does not have pilot component nor secondary code d_secondary = false; - trk_parameters.track_pilot = false; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.track_pilot = false; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; // symbol integration: 20 trk symbols (20 ms) = 1 tlm bit // set the preamble in the secondary code acquisition to obtain tlm symbol synchronization d_secondary_code_length = static_cast(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); d_secondary_code_string = const_cast(&GPS_CA_PREAMBLE_SYMBOLS_STR); d_symbols_per_bit = GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; } - else if (signal_type == "2S") + else if (d_signal_type == "2S") { d_signal_carrier_freq = GPS_L2_FREQ_HZ; d_code_period = GPS_L2_M_PERIOD_S; @@ -159,14 +159,14 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // GPS L2C has 1 trk symbol (20 ms) per tlm bit, no symbol integration required d_symbols_per_bit = GPS_L2_SAMPLES_PER_SYMBOL; d_correlation_length_ms = 20; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; // GPS L2 does not have pilot component nor secondary code d_secondary = false; - trk_parameters.track_pilot = false; + d_trk_parameters.track_pilot = false; } - else if (signal_type == "L5") + else if (d_signal_type == "L5") { d_signal_carrier_freq = GPS_L5_FREQ_HZ; d_code_period = GPS_L5I_PERIOD_S; @@ -175,17 +175,17 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_symbols_per_bit = GPS_L5_SAMPLES_PER_SYMBOL; d_correlation_length_ms = 1; d_secondary = true; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; if (d_extended_correlation_in_fpga == true) { - if (trk_parameters.extend_correlation_symbols > 1) + if (d_trk_parameters.extend_correlation_symbols > 1) { d_sc_demodulate_enabled = true; } } - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { // synchronize pilot secondary code d_secondary_code_length = static_cast(GPS_L5Q_NH_CODE_LENGTH); @@ -194,7 +194,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // remove Neuman-Hofman Code (see IS-GPS-705D) d_data_secondary_code_length = static_cast(GPS_L5I_NH_CODE_LENGTH); d_data_secondary_code_string = const_cast(&GPS_L5I_NH_CODE_STR); - signal_pretty_name = signal_pretty_name + "Q"; + d_signal_pretty_name = d_signal_pretty_name + "Q"; } else { @@ -202,8 +202,8 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // remove Neuman-Hofman Code (see IS-GPS-705D) d_secondary_code_length = static_cast(GPS_L5I_NH_CODE_LENGTH); d_secondary_code_string = const_cast(&GPS_L5I_NH_CODE_STR); - signal_pretty_name = signal_pretty_name + "I"; - interchange_iq = true; + d_signal_pretty_name = d_signal_pretty_name + "I"; + d_interchange_iq = true; } } else @@ -217,10 +217,10 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_symbols_per_bit = 0; } } - else if (trk_parameters.system == 'E') + else if (d_trk_parameters.system == 'E') { - systemName = "Galileo"; - if (signal_type == "1B") + d_systemName = "Galileo"; + if (d_signal_type == "1B") { d_signal_carrier_freq = GALILEO_E1_FREQ_HZ; d_code_period = GALILEO_E1_CODE_PERIOD_S; @@ -229,24 +229,24 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_symbols_per_bit = 1; d_correlation_length_ms = 4; d_veml = true; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - if (trk_parameters.track_pilot) + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + d_trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + if (d_trk_parameters.track_pilot) { d_secondary = true; d_secondary_code_length = static_cast(GALILEO_E1_C_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&GALILEO_E1_C_SECONDARY_CODE); - signal_pretty_name = signal_pretty_name + "C"; + d_signal_pretty_name = d_signal_pretty_name + "C"; } else { d_secondary = false; - signal_pretty_name = signal_pretty_name + "B"; + d_signal_pretty_name = d_signal_pretty_name + "B"; } // Note that E1-B and E1-C are in anti-phase, NOT IN QUADRATURE. See Galileo ICD. } - else if (signal_type == "5X") + else if (d_signal_type == "5X") { d_signal_carrier_freq = GALILEO_E5A_FREQ_HZ; d_code_period = GALILEO_E5A_CODE_PERIOD_S; @@ -254,21 +254,21 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_symbols_per_bit = 20; d_correlation_length_ms = 1; d_secondary = true; - trk_parameters.slope = 1.0; - trk_parameters.spc = trk_parameters.early_late_space_chips; - trk_parameters.y_intercept = 1.0; + d_trk_parameters.slope = 1.0; + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + d_trk_parameters.y_intercept = 1.0; if (d_extended_correlation_in_fpga == true) { - if (trk_parameters.extend_correlation_symbols > 1) + if (d_trk_parameters.extend_correlation_symbols > 1) { d_sc_demodulate_enabled = true; } } - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { // synchronize pilot secondary code d_secondary_code_length = static_cast(GALILEO_E5A_Q_SECONDARY_CODE_LENGTH); - signal_pretty_name = signal_pretty_name + "Q"; + d_signal_pretty_name = d_signal_pretty_name + "Q"; // remove data secondary code d_data_secondary_code_length = static_cast(GALILEO_E5A_I_SECONDARY_CODE_LENGTH); d_data_secondary_code_string = const_cast(&GALILEO_E5A_I_SECONDARY_CODE); @@ -280,8 +280,8 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & // synchronize and remove data secondary code d_secondary_code_length = static_cast(GALILEO_E5A_I_SECONDARY_CODE_LENGTH); d_secondary_code_string = const_cast(&GALILEO_E5A_I_SECONDARY_CODE); - signal_pretty_name = signal_pretty_name + "I"; - interchange_iq = true; + d_signal_pretty_name = d_signal_pretty_name + "I"; + d_interchange_iq = true; } } else @@ -305,14 +305,14 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_code_period = 0.0; d_symbols_per_bit = 0; } - T_chip_seconds = 0.0; - T_prn_seconds = 0.0; - T_prn_samples = 0.0; - K_blk_samples = 0.0; + d_T_chip_seconds = 0.0; + d_T_prn_seconds = 0.0; + d_T_prn_samples = 0.0; + d_K_blk_samples = 0.0; // Initialize tracking ========================================== - d_code_loop_filter = Tracking_loop_filter(d_code_period, trk_parameters.dll_bw_hz, trk_parameters.dll_filter_order, false); - d_carrier_loop_filter.set_params(trk_parameters.fll_bw_hz, trk_parameters.pll_bw_hz, trk_parameters.pll_filter_order); + d_code_loop_filter = Tracking_loop_filter(d_code_period, d_trk_parameters.dll_bw_hz, d_trk_parameters.dll_filter_order, false); + d_carrier_loop_filter.set_params(d_trk_parameters.fll_bw_hz, d_trk_parameters.pll_bw_hz, d_trk_parameters.pll_filter_order); // correlator outputs (scalar) if (d_veml) @@ -336,11 +336,11 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_Prompt = &d_correlator_outs[2]; d_Late = &d_correlator_outs[3]; d_Very_Late = &d_correlator_outs[4]; - d_local_code_shift_chips[0] = -trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[1] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[1] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); d_local_code_shift_chips[2] = 0.0; - d_local_code_shift_chips[3] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[4] = trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[3] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[4] = d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); d_prompt_data_shift = &d_local_code_shift_chips[2]; } else @@ -350,20 +350,20 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_Prompt = &d_correlator_outs[1]; d_Late = &d_correlator_outs[2]; d_Very_Late = nullptr; - d_local_code_shift_chips[0] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); d_local_code_shift_chips[1] = 0.0; - d_local_code_shift_chips[2] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[2] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); d_prompt_data_shift = &d_local_code_shift_chips[1]; } - if (trk_parameters.extend_correlation_symbols > 1) + if (d_trk_parameters.extend_correlation_symbols > 1) { d_enable_extended_integration = true; } else { d_enable_extended_integration = false; - trk_parameters.extend_correlation_symbols = 1; + d_trk_parameters.extend_correlation_symbols = 1; } // --- Initializations --- @@ -380,31 +380,31 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_sample_counter = 0ULL; d_acq_sample_stamp = 0ULL; - d_current_integration_length_samples = static_cast(trk_parameters.vector_length); + d_current_integration_length_samples = static_cast(d_trk_parameters.vector_length); d_next_integration_length_samples = d_current_integration_length_samples; d_current_correlation_time_s = 0.0; // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer.reserve(trk_parameters.cn0_samples); + d_Prompt_buffer.reserve(d_trk_parameters.cn0_samples); 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_carrier_lock_threshold = d_trk_parameters.carrier_lock_th; d_Prompt_Data.reserve(1); d_cn0_smoother = Exponential_Smoother(); - d_cn0_smoother.set_alpha(trk_parameters.cn0_smoother_alpha); + d_cn0_smoother.set_alpha(d_trk_parameters.cn0_smoother_alpha); if (d_code_period > 0.0) { - d_cn0_smoother.set_samples_for_initialization(trk_parameters.cn0_smoother_samples / static_cast(d_code_period * 1000.0)); + d_cn0_smoother.set_samples_for_initialization(d_trk_parameters.cn0_smoother_samples / static_cast(d_code_period * 1000.0)); } d_carrier_lock_test_smoother = Exponential_Smoother(); - d_carrier_lock_test_smoother.set_alpha(trk_parameters.carrier_lock_test_smoother_alpha); + d_carrier_lock_test_smoother.set_alpha(d_trk_parameters.carrier_lock_test_smoother_alpha); 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(trk_parameters.carrier_lock_test_smoother_samples); + d_carrier_lock_test_smoother.set_samples_for_initialization(d_trk_parameters.carrier_lock_test_smoother_samples); d_acquisition_gnss_synchro = nullptr; d_channel = 0; @@ -421,10 +421,10 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_rem_code_phase_chips = 0.0; d_state = 1; // initial state: standby clear_tracking_vars(); - if (trk_parameters.smoother_length > 0) + if (d_trk_parameters.smoother_length > 0) { - d_carr_ph_history.set_capacity(trk_parameters.smoother_length * 2); - d_code_ph_history.set_capacity(trk_parameters.smoother_length * 2); + d_carr_ph_history.set_capacity(d_trk_parameters.smoother_length * 2); + d_code_ph_history.set_capacity(d_trk_parameters.smoother_length * 2); } else { @@ -432,11 +432,11 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_code_ph_history.set_capacity(1); } - d_dump = trk_parameters.dump; - d_dump_mat = trk_parameters.dump_mat and d_dump; + d_dump = d_trk_parameters.dump; + d_dump_mat = d_trk_parameters.dump_mat and d_dump; if (d_dump) { - d_dump_filename = trk_parameters.dump_filename; + d_dump_filename = d_trk_parameters.dump_filename; std::string dump_path; // Get path if (d_dump_filename.find_last_of('/') != std::string::npos) @@ -468,13 +468,13 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & } } // create multicorrelator class - std::string device_name = trk_parameters.device_name; - uint32_t dev_file_num = trk_parameters.dev_file_num; - uint32_t num_prev_assigned_ch = trk_parameters.num_prev_assigned_ch; - int32_t *ca_codes = trk_parameters.ca_codes; - int32_t *data_codes = trk_parameters.data_codes; - multicorrelator_fpga = std::make_shared(d_n_correlator_taps, device_name, dev_file_num, num_prev_assigned_ch, ca_codes, data_codes, d_code_length_chips, trk_parameters.track_pilot, d_code_samples_per_chip); - multicorrelator_fpga->set_output_vectors(d_correlator_outs.data(), d_Prompt_Data.data()); + std::string device_name = d_trk_parameters.device_name; + uint32_t dev_file_num = d_trk_parameters.dev_file_num; + uint32_t num_prev_assigned_ch = d_trk_parameters.num_prev_assigned_ch; + int32_t *ca_codes = d_trk_parameters.ca_codes; + int32_t *data_codes = d_trk_parameters.data_codes; + d_multicorrelator_fpga = std::make_shared(d_n_correlator_taps, device_name, dev_file_num, num_prev_assigned_ch, ca_codes, data_codes, d_code_length_chips, d_trk_parameters.track_pilot, d_code_samples_per_chip); + d_multicorrelator_fpga->set_output_vectors(d_correlator_outs.data(), d_Prompt_Data.data()); d_sample_counter_next = 0ULL; d_corrected_doppler = false; @@ -524,7 +524,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; d_carrier_doppler_hz = d_acq_carrier_doppler_hz; - d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / trk_parameters.fs_in; + d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / d_trk_parameters.fs_in; // filter initialization d_carrier_loop_filter.initialize(static_cast(d_acq_carrier_doppler_hz)); // initialize the carrier filter @@ -534,7 +534,7 @@ void dll_pll_veml_tracking_fpga::start_tracking() boost::mutex::scoped_lock lock(d_mutex); d_worker_is_done = true; - m_condition.notify_one(); + d_m_condition.notify_one(); } @@ -564,7 +564,7 @@ dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga() } try { - multicorrelator_fpga->free(); + d_multicorrelator_fpga->free(); } catch (const std::exception &ex) { @@ -615,17 +615,17 @@ bool dll_pll_veml_tracking_fpga::acquire_secondary() bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integration_time_s) { // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < trk_parameters.cn0_samples) + if (d_cn0_estimation_counter < d_trk_parameters.cn0_samples) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_P_accu; d_cn0_estimation_counter++; return true; } - d_Prompt_buffer[d_cn0_estimation_counter % trk_parameters.cn0_samples] = d_P_accu; + d_Prompt_buffer[d_cn0_estimation_counter % d_trk_parameters.cn0_samples] = d_P_accu; d_cn0_estimation_counter++; // Code lock indicator - float d_CN0_SNV_dB_Hz_raw = cn0_m2m4_estimator(d_Prompt_buffer.data(), trk_parameters.cn0_samples, static_cast(coh_integration_time_s)); + float d_CN0_SNV_dB_Hz_raw = cn0_m2m4_estimator(d_Prompt_buffer.data(), d_trk_parameters.cn0_samples, static_cast(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 = d_carrier_lock_test_smoother.smooth(carrier_lock_detector(d_Prompt_buffer.data(), 1)); @@ -644,7 +644,7 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra } } - if (d_CN0_SNV_dB_Hz < trk_parameters.cn0_min) + if (d_CN0_SNV_dB_Hz < d_trk_parameters.cn0_min) { d_code_lock_fail_counter++; } @@ -656,7 +656,7 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra } } } - if (d_carrier_lock_fail_counter > trk_parameters.max_carrier_lock_fail or d_code_lock_fail_counter > trk_parameters.max_code_lock_fail) + if (d_carrier_lock_fail_counter > d_trk_parameters.max_carrier_lock_fail or d_code_lock_fail_counter > d_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 @@ -665,7 +665,7 @@ bool dll_pll_veml_tracking_fpga::cn0_and_tracking_lock_status(double coh_integra 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; - multicorrelator_fpga->unlock_channel(); + d_multicorrelator_fpga->unlock_channel(); return false; } return true; @@ -682,7 +682,7 @@ void dll_pll_veml_tracking_fpga::do_correlation_step() // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation - multicorrelator_fpga->Carrier_wipeoff_multicorrelator_resampler( + d_multicorrelator_fpga->Carrier_wipeoff_multicorrelator_resampler( d_rem_carr_phase_rad, d_carrier_phase_step_rad, d_carrier_phase_rate_step_rad, static_cast(d_rem_code_phase_chips) * static_cast(d_code_samples_per_chip), @@ -707,7 +707,7 @@ void dll_pll_veml_tracking_fpga::run_dll_pll() d_carr_phase_error_hz = pll_four_quadrant_atan(d_P_accu) / PI_2; } - if ((d_pull_in_transitory == true and trk_parameters.enable_fll_pull_in == true) or trk_parameters.enable_fll_steady_state) + if ((d_pull_in_transitory == true and d_trk_parameters.enable_fll_pull_in == true) or d_trk_parameters.enable_fll_steady_state) { // FLL discriminator // d_carr_freq_error_hz = fll_four_quadrant_atan(d_P_accu_old, d_P_accu, 0, d_current_correlation_time_s) / GPS_TWO_PI; @@ -716,7 +716,7 @@ void dll_pll_veml_tracking_fpga::run_dll_pll() d_P_accu_old = d_P_accu; // std::cout << "d_carr_freq_error_hz: " << d_carr_freq_error_hz << std::endl; // Carrier discriminator filter - if ((d_pull_in_transitory == true and trk_parameters.enable_fll_pull_in == true)) + if ((d_pull_in_transitory == true and d_trk_parameters.enable_fll_pull_in == true)) { // pure FLL, disable PLL d_carr_error_filt_hz = d_carrier_loop_filter.get_carrier_error(d_carr_freq_error_hz, 0, d_current_correlation_time_s); @@ -747,19 +747,19 @@ void dll_pll_veml_tracking_fpga::run_dll_pll() } else { - d_code_error_chips = dll_nc_e_minus_l_normalized(d_E_accu, d_L_accu, trk_parameters.spc, trk_parameters.slope, trk_parameters.y_intercept); // [chips/Ti] + d_code_error_chips = dll_nc_e_minus_l_normalized(d_E_accu, d_L_accu, d_trk_parameters.spc, d_trk_parameters.slope, d_trk_parameters.y_intercept); // [chips/Ti] } // Code discriminator filter d_code_error_filt_chips = d_code_loop_filter.apply(d_code_error_chips); // [chips/second] // New code Doppler frequency estimation d_code_freq_chips = d_code_chip_rate - d_code_error_filt_chips; - if (trk_parameters.carrier_aiding) + if (d_trk_parameters.carrier_aiding) { d_code_freq_chips += d_carrier_doppler_hz * d_code_chip_rate / d_signal_carrier_freq; } // Experimental: detect Carrier Doppler vs. Code Doppler incoherence and correct the Carrier Doppler - if (trk_parameters.enable_doppler_correction == true) + if (d_trk_parameters.enable_doppler_correction == true) { if (d_pull_in_transitory == false and d_corrected_doppler == false) { @@ -771,7 +771,7 @@ void dll_pll_veml_tracking_fpga::run_dll_pll() if (fabs(avg_code_error_chips_s) > 1.0) { float carrier_doppler_error_hz = static_cast(d_signal_carrier_freq) * avg_code_error_chips_s / static_cast(d_code_chip_rate); - LOG(INFO) << "Detected and corrected carrier doppler error: " << carrier_doppler_error_hz << " [Hz] on sat " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN); + LOG(INFO) << "Detected and corrected carrier doppler error: " << carrier_doppler_error_hz << " [Hz] on sat " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); d_carrier_loop_filter.initialize(d_carrier_doppler_hz - carrier_doppler_error_hz); d_corrected_doppler = true; } @@ -795,7 +795,7 @@ void dll_pll_veml_tracking_fpga::check_carrier_phase_coherent_initialization() void dll_pll_veml_tracking_fpga::clear_tracking_vars() { std::fill_n(d_correlator_outs.begin(), d_n_correlator_taps, gr_complex(0.0, 0.0)); - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_Prompt_Data[0] = gr_complex(0.0, 0.0); d_P_data_accu = gr_complex(0.0, 0.0); @@ -818,22 +818,22 @@ void dll_pll_veml_tracking_fpga::clear_tracking_vars() void dll_pll_veml_tracking_fpga::update_tracking_vars() { - T_chip_seconds = 1.0 / d_code_freq_chips; - T_prn_seconds = T_chip_seconds * static_cast(d_code_length_chips); + d_T_chip_seconds = 1.0 / d_code_freq_chips; + d_T_prn_seconds = d_T_chip_seconds * static_cast(d_code_length_chips); // ################## CARRIER AND CODE NCO BUFFER ALIGNMENT ####################### // keep alignment parameters for the next input buffer // Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation - T_prn_samples = T_prn_seconds * trk_parameters.fs_in; - K_blk_samples = T_prn_samples * d_current_fpga_integration_period + d_rem_code_phase_samples; // initially d_rem_code_phase_samples is zero. It is updated at the end of this function - auto actual_blk_length = static_cast(std::floor(K_blk_samples)); + d_T_prn_samples = d_T_prn_seconds * d_trk_parameters.fs_in; + d_K_blk_samples = d_T_prn_samples * d_current_fpga_integration_period + d_rem_code_phase_samples; // initially d_rem_code_phase_samples is zero. It is updated at the end of this function + auto actual_blk_length = static_cast(std::floor(d_K_blk_samples)); d_next_integration_length_samples = actual_blk_length; // ################## PLL COMMANDS ################################################# // carrier phase step (NCO phase increment per sample) [rads/sample] - d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / trk_parameters.fs_in; + d_carrier_phase_step_rad = PI_2 * d_carrier_doppler_hz / d_trk_parameters.fs_in; // carrier phase rate step (NCO phase increment rate per sample) [rads/sample^2] - if (trk_parameters.high_dyn) + if (d_trk_parameters.high_dyn) { d_carr_ph_history.push_back(std::pair(d_carrier_phase_step_rad, static_cast(d_current_integration_length_samples))); if (d_carr_ph_history.full()) @@ -841,18 +841,18 @@ void dll_pll_veml_tracking_fpga::update_tracking_vars() double tmp_cp1 = 0.0; double tmp_cp2 = 0.0; double tmp_samples = 0.0; - for (unsigned int k = 0; k < trk_parameters.smoother_length; k++) + for (unsigned int k = 0; k < d_trk_parameters.smoother_length; k++) { tmp_cp1 += d_carr_ph_history[k].first; - tmp_cp2 += d_carr_ph_history[trk_parameters.smoother_length * 2 - k - 1].first; - tmp_samples += d_carr_ph_history[trk_parameters.smoother_length * 2 - k - 1].second; + tmp_cp2 += d_carr_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].first; + tmp_samples += d_carr_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].second; } - tmp_cp1 /= static_cast(trk_parameters.smoother_length); - tmp_cp2 /= static_cast(trk_parameters.smoother_length); + tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); + tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples; } } - // std::cout << d_carrier_phase_rate_step_rad * trk_parameters.fs_in * trk_parameters.fs_in / PI_2 << std::endl; + // std::cout << d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / PI_2 << std::endl; // remnant carrier phase to prevent overflow in the code NCO d_rem_carr_phase_rad += static_cast(d_carrier_phase_step_rad * static_cast(d_current_integration_length_samples) + 0.5 * d_carrier_phase_rate_step_rad * static_cast(d_current_integration_length_samples) * static_cast(d_current_integration_length_samples)); d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, PI_2); @@ -865,8 +865,8 @@ void dll_pll_veml_tracking_fpga::update_tracking_vars() // ################## DLL COMMANDS ################################################# // code phase step (Code resampler phase increment per sample) [chips/sample] - d_code_phase_step_chips = d_code_freq_chips / trk_parameters.fs_in; - if (trk_parameters.high_dyn) + d_code_phase_step_chips = d_code_freq_chips / d_trk_parameters.fs_in; + if (d_trk_parameters.high_dyn) { d_code_ph_history.push_back(std::pair(d_code_phase_step_chips, static_cast(d_current_integration_length_samples))); if (d_code_ph_history.full()) @@ -874,21 +874,21 @@ void dll_pll_veml_tracking_fpga::update_tracking_vars() double tmp_cp1 = 0.0; double tmp_cp2 = 0.0; double tmp_samples = 0.0; - for (unsigned int k = 0; k < trk_parameters.smoother_length; k++) + for (unsigned int k = 0; k < d_trk_parameters.smoother_length; k++) { tmp_cp1 += d_code_ph_history[k].first; - tmp_cp2 += d_code_ph_history[trk_parameters.smoother_length * 2 - k - 1].first; - tmp_samples += d_code_ph_history[trk_parameters.smoother_length * 2 - k - 1].second; + tmp_cp2 += d_code_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].first; + tmp_samples += d_code_ph_history[d_trk_parameters.smoother_length * 2 - k - 1].second; } - tmp_cp1 /= static_cast(trk_parameters.smoother_length); - tmp_cp2 /= static_cast(trk_parameters.smoother_length); + tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); + tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples; } } // remnant code phase [chips] d_rem_code_phase_samples_prev = d_rem_code_phase_samples; - d_rem_code_phase_samples = K_blk_samples - static_cast(d_current_integration_length_samples); // rounding error < 1 sample - d_rem_code_phase_chips = d_code_freq_chips * d_rem_code_phase_samples / trk_parameters.fs_in; + d_rem_code_phase_samples = d_K_blk_samples - static_cast(d_current_integration_length_samples); // rounding error < 1 sample + d_rem_code_phase_chips = d_code_freq_chips * d_rem_code_phase_samples / d_trk_parameters.fs_in; } @@ -939,7 +939,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results() { if (d_data_secondary_code_length > 0) { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { if (!d_current_extended_correlation_in_fpga) // the FPGA removes the secondary code { @@ -981,7 +981,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results() } else { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_P_data_accu += d_Prompt_Data[0]; } @@ -996,7 +996,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results() } else { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_P_data_accu = d_Prompt_Data[0]; } @@ -1006,7 +1006,7 @@ void dll_pll_veml_tracking_fpga::save_correlation_results() } } - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { // If tracking pilot, disable Costas loop d_cloop = false; @@ -1033,7 +1033,7 @@ void dll_pll_veml_tracking_fpga::log_data() float tmp_float; double tmp_double; uint64_t tmp_long_int; - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { prompt_I = d_Prompt_Data.data()->real(); prompt_Q = d_Prompt_Data.data()->imag(); @@ -1078,12 +1078,12 @@ void dll_pll_veml_tracking_fpga::log_data() tmp_float = d_carrier_doppler_hz; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier phase rate [Hz/s] - tmp_float = d_carrier_phase_rate_step_rad * trk_parameters.fs_in * trk_parameters.fs_in / PI_2; + tmp_float = d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / PI_2; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); tmp_float = d_code_freq_chips; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // code phase rate [chips/s^2] - tmp_float = d_code_phase_rate_step_chips * trk_parameters.fs_in * trk_parameters.fs_in; + tmp_float = d_code_phase_rate_step_chips * d_trk_parameters.fs_in * d_trk_parameters.fs_in; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands tmp_float = d_carr_phase_error_hz; @@ -1322,7 +1322,7 @@ void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel) gr::thread::scoped_lock l(d_setlock); d_channel = channel; - multicorrelator_fpga->set_channel(d_channel); + d_multicorrelator_fpga->set_channel(d_channel); LOG(INFO) << "Tracking Channel set to " << d_channel; // ############# ENABLE DATA FILE LOG ################# if (d_dump) @@ -1352,32 +1352,32 @@ void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel) if (d_extended_correlation_in_fpga == true) { // Now we can write the secondary codes that do not depend on the PRN number - if (trk_parameters.system == 'G') + if (d_trk_parameters.system == 'G') { - if (signal_type == "L5") + if (d_signal_type == "L5") { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { - multicorrelator_fpga->set_secondary_code_lengths(d_secondary_code_length, d_data_secondary_code_length); - multicorrelator_fpga->initialize_secondary_code(0, d_secondary_code_string); - multicorrelator_fpga->initialize_secondary_code(1, d_data_secondary_code_string); + d_multicorrelator_fpga->set_secondary_code_lengths(d_secondary_code_length, d_data_secondary_code_length); + d_multicorrelator_fpga->initialize_secondary_code(0, d_secondary_code_string); + d_multicorrelator_fpga->initialize_secondary_code(1, d_data_secondary_code_string); } else { - multicorrelator_fpga->set_secondary_code_lengths(d_secondary_code_length, 0); - multicorrelator_fpga->initialize_secondary_code(0, d_secondary_code_string); + d_multicorrelator_fpga->set_secondary_code_lengths(d_secondary_code_length, 0); + d_multicorrelator_fpga->initialize_secondary_code(0, d_secondary_code_string); } } } - else if (trk_parameters.system == 'E') + else if (d_trk_parameters.system == 'E') { - if (signal_type == "5X") + if (d_signal_type == "5X") { // coherent integration in the FPGA is only enabled when tracking the pilot. - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { - multicorrelator_fpga->set_secondary_code_lengths(d_secondary_code_length, d_data_secondary_code_length); - multicorrelator_fpga->initialize_secondary_code(1, d_data_secondary_code_string); + d_multicorrelator_fpga->set_secondary_code_lengths(d_secondary_code_length, d_data_secondary_code_length); + d_multicorrelator_fpga->initialize_secondary_code(1, d_data_secondary_code_string); } } } @@ -1402,23 +1402,23 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) d_code_ph_history.clear(); d_carr_ph_history.clear(); - if (systemName == "GPS" and signal_type == "L5") + if (d_systemName == "GPS" and d_signal_type == "L5") { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_Prompt_Data[0] = gr_complex(0.0, 0.0); } } - else if (systemName == "Galileo" and signal_type == "1B") + else if (d_systemName == "Galileo" and d_signal_type == "1B") { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_Prompt_Data[0] = gr_complex(0.0, 0.0); } } - else if (systemName == "Galileo" and signal_type == "5X") + else if (d_systemName == "Galileo" and d_signal_type == "5X") { - if (trk_parameters.track_pilot) + if (d_trk_parameters.track_pilot) { d_secondary_code_string = const_cast(&GALILEO_E5A_Q_SECONDARY_CODE[d_acquisition_gnss_synchro->PRN - 1]); @@ -1428,7 +1428,7 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) { if (d_extended_correlation_in_fpga == true) { - multicorrelator_fpga->initialize_secondary_code(0, d_secondary_code_string); + d_multicorrelator_fpga->initialize_secondary_code(0, d_secondary_code_string); } } } @@ -1450,26 +1450,26 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) if (d_veml) { - d_local_code_shift_chips[0] = -trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[1] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[3] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[4] = trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[1] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[3] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[4] = d_trk_parameters.very_early_late_space_chips * static_cast(d_code_samples_per_chip); } else { - d_local_code_shift_chips[0] = -trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[2] = trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[0] = -d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[2] = d_trk_parameters.early_late_space_chips * static_cast(d_code_samples_per_chip); } d_current_correlation_time_s = d_code_period; // DLL/PLL filter initialization - d_carrier_loop_filter.set_params(trk_parameters.fll_bw_hz, trk_parameters.pll_bw_hz, trk_parameters.pll_filter_order); - d_code_loop_filter.set_noise_bandwidth(trk_parameters.dll_bw_hz); + d_carrier_loop_filter.set_params(d_trk_parameters.fll_bw_hz, d_trk_parameters.pll_bw_hz, d_trk_parameters.pll_filter_order); + d_code_loop_filter.set_noise_bandwidth(d_trk_parameters.dll_bw_hz); d_code_loop_filter.set_update_interval(d_code_period); d_code_loop_filter.initialize(); // initialize the code filter - multicorrelator_fpga->set_local_code_and_taps(d_local_code_shift_chips.data(), d_prompt_data_shift, d_acquisition_gnss_synchro->PRN); + d_multicorrelator_fpga->set_local_code_and_taps(d_local_code_shift_chips.data(), d_prompt_data_shift, d_acquisition_gnss_synchro->PRN); d_pull_in_transitory = true; @@ -1477,14 +1477,14 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) d_Prompt_circular_buffer.clear(); - T_chip_seconds = 1.0 / d_code_freq_chips; - T_prn_seconds = T_chip_seconds * static_cast(d_code_length_chips); + d_T_chip_seconds = 1.0 / d_code_freq_chips; + d_T_prn_seconds = d_T_chip_seconds * static_cast(d_code_length_chips); // re-establish nominal integration length (not extended integration by default) - d_current_integration_length_samples = static_cast(trk_parameters.vector_length); + d_current_integration_length_samples = static_cast(d_trk_parameters.vector_length); d_next_integration_length_samples = d_current_integration_length_samples; - multicorrelator_fpga->disable_secondary_codes(); // make sure the processing of the secondary codes is disabled by default + d_multicorrelator_fpga->disable_secondary_codes(); // make sure the processing of the secondary codes is disabled by default d_current_fpga_integration_period = 1; d_current_extended_correlation_in_fpga = false; @@ -1500,14 +1500,14 @@ void dll_pll_veml_tracking_fpga::stop_tracking() // interrupt the tracking loops d_stop_tracking = true; // let the samples pass through - multicorrelator_fpga->unlock_channel(); + d_multicorrelator_fpga->unlock_channel(); } void dll_pll_veml_tracking_fpga::reset() { gr::thread::scoped_lock l(d_setlock); - multicorrelator_fpga->unlock_channel(); + d_multicorrelator_fpga->unlock_channel(); } @@ -1529,7 +1529,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un { if (d_sample_counter > 0) // do not execute this condition until the sample counter has ben read for the first time after start_tracking { - if (trk_parameters.pull_in_time_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(trk_parameters.fs_in)) + if (d_trk_parameters.pull_in_time_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(d_trk_parameters.fs_in)) { d_pull_in_transitory = false; d_carrier_lock_fail_counter = 0; @@ -1545,7 +1545,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un boost::mutex::scoped_lock lock(d_mutex); while (!d_worker_is_done) { - m_condition.wait(lock); + d_m_condition.wait(lock); } // Signal alignment (skip samples until the incoming signal is aligned with local replica) @@ -1554,13 +1554,13 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un double delta_trk_to_acq_prn_start_samples; uint64_t absolute_samples_offset; - multicorrelator_fpga->lock_channel(); - uint64_t counter_value = multicorrelator_fpga->read_sample_counter(); + d_multicorrelator_fpga->lock_channel(); + uint64_t counter_value = d_multicorrelator_fpga->read_sample_counter(); if (counter_value > (d_acq_sample_stamp + d_acq_code_phase_samples)) { // Signal alignment (skip samples until the incoming signal is aligned with local replica) acq_trk_diff_samples = static_cast(counter_value) - static_cast(d_acq_sample_stamp); - acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / trk_parameters.fs_in; + acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / d_trk_parameters.fs_in; delta_trk_to_acq_prn_start_samples = static_cast(acq_trk_diff_samples) - d_acq_code_phase_samples; uint32_t num_frames = ceil((delta_trk_to_acq_prn_start_samples) / d_current_integration_length_samples); @@ -1570,13 +1570,13 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un { // test mode acq_trk_diff_samples = -static_cast(counter_value) + static_cast(d_acq_sample_stamp); - acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / trk_parameters.fs_in; + acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / d_trk_parameters.fs_in; delta_trk_to_acq_prn_start_samples = static_cast(acq_trk_diff_samples) + d_acq_code_phase_samples; absolute_samples_offset = static_cast(delta_trk_to_acq_prn_start_samples); } - multicorrelator_fpga->set_initial_sample(absolute_samples_offset); + d_multicorrelator_fpga->set_initial_sample(absolute_samples_offset); d_sample_counter = absolute_samples_offset; d_sample_counter_next = d_sample_counter; @@ -1584,7 +1584,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un double radial_velocity = (d_signal_carrier_freq + d_acq_carrier_doppler_hz) / d_signal_carrier_freq; // new chip and PRN sequence periods based on acq Doppler d_code_freq_chips = radial_velocity * d_code_chip_rate; - d_code_phase_step_chips = d_code_freq_chips / trk_parameters.fs_in; + d_code_phase_step_chips = d_code_freq_chips / d_trk_parameters.fs_in; d_acq_code_phase_samples = absolute_samples_offset; @@ -1598,8 +1598,8 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un << ". PULL-IN Code Phase [samples] = " << d_acq_code_phase_samples; // DEBUG OUTPUT - std::cout << "Tracking of " << systemName << " " << signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; - DLOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; + std::cout << "Tracking of " << d_systemName << " " << d_signal_pretty_name << " signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + DLOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; // DLOG(INFO) << "Number of samples between Acquisition and Tracking = " << acq_trk_diff_samples << " ( " << acq_trk_diff_seconds << " s)"; // std::cout << "Number of samples between Acquisition and Tracking = " << acq_trk_diff_samples << " ( " << acq_trk_diff_seconds << " s)" << std::endl; @@ -1624,19 +1624,19 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un d_E_accu = *d_Early; d_P_accu = *d_Prompt; d_L_accu = *d_Late; - trk_parameters.spc = trk_parameters.early_late_space_chips; - // if (std::string(trk_parameters.signal) == "E1") + d_trk_parameters.spc = d_trk_parameters.early_late_space_chips; + // if (std::string(d_trk_parameters.signal) == "E1") // { - // trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - // trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); + // d_trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + // d_trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); // } // fail-safe: check if the secondary code or bit synchronization has not succeeded in a limited time period - if (trk_parameters.bit_synchronization_time_limit_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(trk_parameters.fs_in)) + if (d_trk_parameters.bit_synchronization_time_limit_s < (d_sample_counter - d_acq_sample_stamp) / static_cast(d_trk_parameters.fs_in)) { d_carrier_lock_fail_counter = 300000; // force loss-of-lock condition - LOG(INFO) << systemName << " " << signal_pretty_name << " tracking synchronization time limit reached in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " tracking synchronization time limit reached in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } // Check lock status @@ -1673,10 +1673,10 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un if (next_state) { - LOG(INFO) << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; - std::cout << systemName << " " << signal_pretty_name << " secondary code locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " secondary code locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + std::cout << d_systemName << " " << d_signal_pretty_name << " secondary code locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } } } @@ -1689,10 +1689,10 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un next_state = acquire_secondary(); if (next_state) { - LOG(INFO) << systemName << " " << signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; - std::cout << systemName << " " << signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + std::cout << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; } } } @@ -1722,7 +1722,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un { // update integration time d_extend_correlation_symbols_count = 0; - d_current_correlation_time_s = static_cast(trk_parameters.extend_correlation_symbols) * static_cast(d_code_period); + d_current_correlation_time_s = static_cast(d_trk_parameters.extend_correlation_symbols) * static_cast(d_code_period); if (d_extended_correlation_in_fpga) { @@ -1731,23 +1731,21 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un if (d_sc_demodulate_enabled) { - multicorrelator_fpga->enable_secondary_codes(); + d_multicorrelator_fpga->enable_secondary_codes(); } if (d_extend_fpga_integration_periods > 1) { // correction on already computed parameters - K_blk_samples = T_prn_samples * (d_fpga_integration_period) + d_rem_code_phase_samples_prev; - d_next_integration_length_samples = static_cast(std::floor(K_blk_samples)); - + d_K_blk_samples = d_T_prn_samples * (d_fpga_integration_period) + d_rem_code_phase_samples_prev; + d_next_integration_length_samples = static_cast(std::floor(d_K_blk_samples)); d_state = 5; } else { // correction on already computed parameters - K_blk_samples = T_prn_samples * trk_parameters.extend_correlation_symbols + d_rem_code_phase_samples_prev; - d_next_integration_length_samples = static_cast(std::floor(K_blk_samples)); - + d_K_blk_samples = d_T_prn_samples * d_trk_parameters.extend_correlation_symbols + d_rem_code_phase_samples_prev; + d_next_integration_length_samples = static_cast(std::floor(d_K_blk_samples)); d_state = 6; } } @@ -1756,31 +1754,31 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un d_state = 3; // next state is the extended correlator integrator } - LOG(INFO) << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " + LOG(INFO) << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN); - std::cout << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); + std::cout << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " << d_channel - << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << std::endl; // Set narrow taps delay values [chips] d_code_loop_filter.set_update_interval(d_current_correlation_time_s); - d_code_loop_filter.set_noise_bandwidth(trk_parameters.dll_bw_narrow_hz); - d_carrier_loop_filter.set_params(trk_parameters.fll_bw_hz, trk_parameters.pll_bw_narrow_hz, trk_parameters.pll_filter_order); + d_code_loop_filter.set_noise_bandwidth(d_trk_parameters.dll_bw_narrow_hz); + d_carrier_loop_filter.set_params(d_trk_parameters.fll_bw_hz, d_trk_parameters.pll_bw_narrow_hz, d_trk_parameters.pll_filter_order); if (d_veml) { - d_local_code_shift_chips[0] = -trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[1] = -trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[3] = trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[4] = trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - trk_parameters.spc = trk_parameters.early_late_space_narrow_chips; - // trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); - // trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, trk_parameters.spc); + d_local_code_shift_chips[0] = -d_trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[1] = -d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[3] = d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[4] = d_trk_parameters.very_early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_trk_parameters.spc = d_trk_parameters.early_late_space_narrow_chips; + // d_trk_parameters.slope = -CalculateSlopeAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); + // d_trk_parameters.y_intercept = GetYInterceptAbs(&SinBocCorrelationFunction<1, 1>, d_trk_parameters.spc); } else { - d_local_code_shift_chips[0] = -trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - d_local_code_shift_chips[2] = trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); - trk_parameters.spc = trk_parameters.early_late_space_narrow_chips; + d_local_code_shift_chips[0] = -d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_local_code_shift_chips[2] = d_trk_parameters.early_late_space_narrow_chips * static_cast(d_code_samples_per_chip); + d_trk_parameters.spc = d_trk_parameters.early_late_space_narrow_chips; } } else @@ -1807,7 +1805,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - if (interchange_iq) + if (d_interchange_iq) { current_synchro_data.Prompt_I = static_cast(d_P_data_accu.imag()); current_synchro_data.Prompt_Q = static_cast(d_P_data_accu.real()); @@ -1827,7 +1825,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un } d_extend_correlation_symbols_count++; - if (d_extend_correlation_symbols_count == (trk_parameters.extend_correlation_symbols - 1)) + if (d_extend_correlation_symbols_count == (d_trk_parameters.extend_correlation_symbols - 1)) { d_extend_correlation_symbols_count = 0; d_state = 4; @@ -1844,7 +1842,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un save_correlation_results(); // check lock status - if (!cn0_and_tracking_lock_status(d_code_period * static_cast(trk_parameters.extend_correlation_symbols))) + if (!cn0_and_tracking_lock_status(d_code_period * static_cast(d_trk_parameters.extend_correlation_symbols))) { clear_tracking_vars(); d_state = 1; // loss-of-lock detected @@ -1864,7 +1862,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - if (interchange_iq) + if (d_interchange_iq) { current_synchro_data.Prompt_I = static_cast(d_P_data_accu.imag()); current_synchro_data.Prompt_Q = static_cast(d_P_data_accu.real()); @@ -1907,7 +1905,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un uint32_t next_prn_length = d_current_integration_length_samples / d_fpga_integration_period; uint32_t first_prn_length = d_current_integration_length_samples - next_prn_length * (d_fpga_integration_period - 1); - multicorrelator_fpga->update_prn_code_length(first_prn_length, next_prn_length); + d_multicorrelator_fpga->update_prn_code_length(first_prn_length, next_prn_length); } // perform a correlation step @@ -1921,7 +1919,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - if (interchange_iq) + if (d_interchange_iq) { current_synchro_data.Prompt_I = static_cast(d_P_data_accu.imag()); current_synchro_data.Prompt_Q = static_cast(d_P_data_accu.real()); @@ -1960,14 +1958,14 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un uint32_t next_prn_length = d_current_integration_length_samples / d_fpga_integration_period; uint32_t first_prn_length = d_current_integration_length_samples - next_prn_length * (d_fpga_integration_period - 1); - multicorrelator_fpga->update_prn_code_length(first_prn_length, next_prn_length); + d_multicorrelator_fpga->update_prn_code_length(first_prn_length, next_prn_length); } // perform a correlation step do_correlation_step(); save_correlation_results(); // check lock status - if (!cn0_and_tracking_lock_status(d_code_period * static_cast(trk_parameters.extend_correlation_symbols))) + if (!cn0_and_tracking_lock_status(d_code_period * static_cast(d_trk_parameters.extend_correlation_symbols))) { clear_tracking_vars(); d_state = 1; // loss-of-lock detected @@ -1987,7 +1985,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un // ########### Output the tracking results to Telemetry block ########## // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - if (interchange_iq) + if (d_interchange_iq) { current_synchro_data.Prompt_I = static_cast(d_P_data_accu.imag()); current_synchro_data.Prompt_Q = static_cast(d_P_data_accu.real()); @@ -2029,7 +2027,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un if (current_synchro_data.Flag_valid_symbol_output) { - current_synchro_data.fs = static_cast(trk_parameters.fs_in); + current_synchro_data.fs = static_cast(d_trk_parameters.fs_in); current_synchro_data.Tracking_sample_counter = d_sample_counter_next; // d_sample_counter; *out[0] = current_synchro_data; return 1; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h index caebfa514..5d7ae8e95 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.h @@ -103,101 +103,64 @@ public: private: friend dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_); - void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg); explicit dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_); - bool cn0_and_tracking_lock_status(double coh_integration_time_s); - bool acquire_secondary(); - void do_correlation_step(); - void run_dll_pll(); - void check_carrier_phase_coherent_initialization(); - void update_tracking_vars(); - void clear_tracking_vars(); - void save_correlation_results(); - void log_data(); - int32_t save_matfile(); - - // tracking configuration vars - Dll_Pll_Conf_Fpga trk_parameters; bool d_veml; bool d_cloop; - uint32_t d_channel; - Gnss_Synchro *d_acquisition_gnss_synchro; - - // Signal parameters bool d_secondary; - double d_signal_carrier_freq; - double d_code_period; - double d_code_chip_rate; + bool d_enable_extended_integration; + bool d_dump; + bool d_dump_mat; + bool d_pull_in_transitory; + bool d_corrected_doppler; + bool d_interchange_iq; + bool d_acc_carrier_phase_initialized; + bool d_worker_is_done; + bool d_extended_correlation_in_fpga; + bool d_current_extended_correlation_in_fpga; + bool d_stop_tracking; + bool d_sc_demodulate_enabled; + + int32_t d_symbols_per_bit; + int32_t d_state; + int32_t d_extend_correlation_symbols_count; + int32_t d_current_symbol; + int32_t d_current_data_symbol; + int32_t d_current_integration_length_samples; + int32_t d_cn0_estimation_counter; + int32_t d_carrier_lock_fail_counter; + int32_t d_code_lock_fail_counter; + int32_t d_correlation_length_ms; + int32_t d_n_correlator_taps; + int32_t d_next_integration_length_samples; + int32_t d_extend_fpga_integration_periods; + + uint32_t d_channel; uint32_t d_secondary_code_length; uint32_t d_data_secondary_code_length; uint32_t d_code_length_chips; uint32_t d_code_samples_per_chip; // All signals have 1 sample per chip code except Gal. E1 which has 2 (CBOC disabled) or 12 (CBOC enabled) - int32_t d_symbols_per_bit; - std::string systemName; - std::string signal_type; - std::string *d_secondary_code_string; - std::string *d_data_secondary_code_string; - std::string signal_pretty_name; + uint32_t d_fpga_integration_period; + uint32_t d_current_fpga_integration_period; - // dll filter buffer - boost::circular_buffer d_dll_filt_history; - // tracking state machine - int32_t d_state; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; + uint64_t d_sample_counter_next; - // Integration period in samples - int32_t d_correlation_length_ms; - int32_t d_n_correlator_taps; - - volk_gnsssdr::vector d_local_code_shift_chips; float *d_prompt_data_shift; - std::shared_ptr multicorrelator_fpga; - volk_gnsssdr::vector d_correlator_outs; - gr_complex *d_Very_Early; - gr_complex *d_Early; - gr_complex *d_Prompt; - gr_complex *d_Late; - gr_complex *d_Very_Late; - - bool d_enable_extended_integration; - int32_t d_extend_correlation_symbols_count; - int32_t d_current_symbol; - int32_t d_current_data_symbol; - - gr_complex d_VE_accu; - gr_complex d_E_accu; - gr_complex d_P_accu; - gr_complex d_P_accu_old; - gr_complex d_L_accu; - gr_complex d_VL_accu; - - gr_complex d_P_data_accu; - volk_gnsssdr::vector d_Prompt_Data; - - double d_code_phase_step_chips; - double d_code_phase_rate_step_chips; - boost::circular_buffer> d_code_ph_history; - double d_carrier_phase_step_rad; - double d_carrier_phase_rate_step_rad; - boost::circular_buffer> d_carr_ph_history; - - // remaining code phase and carrier phase between tracking loops - double d_rem_code_phase_samples; - double d_rem_code_phase_samples_prev; float d_rem_carr_phase_rad; - Tracking_loop_filter d_code_loop_filter; - Tracking_FLL_PLL_filter d_carrier_loop_filter; - - // acquisition + double d_signal_carrier_freq; + double d_code_period; + double d_code_chip_rate; + double d_code_phase_step_chips; + double d_code_phase_rate_step_chips; + double d_carrier_phase_step_rad; + double d_carrier_phase_rate_step_rad; double d_acq_code_phase_samples; double d_acq_carrier_doppler_hz; - - // tracking vars - bool d_pull_in_transitory; - bool d_corrected_doppler; - bool interchange_iq; - bool d_acc_carrier_phase_initialized; + double d_rem_code_phase_samples; + double d_rem_code_phase_samples_prev; double d_current_correlation_time_s; double d_carr_phase_error_hz; double d_carr_freq_error_hz; @@ -208,46 +171,75 @@ private: double d_carrier_doppler_hz; double d_acc_carrier_phase_rad; double d_rem_code_phase_chips; - double T_chip_seconds; - double T_prn_seconds; - double T_prn_samples; - double K_blk_samples; - // integration period in samples - int32_t d_current_integration_length_samples; - // processing samples counters - uint64_t d_sample_counter; - uint64_t d_acq_sample_stamp; - - // 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_T_chip_seconds; + double d_T_prn_seconds; + double d_T_prn_samples; + double d_K_blk_samples; double d_carrier_lock_test; double d_CN0_SNV_dB_Hz; double d_carrier_lock_threshold; - boost::circular_buffer d_Prompt_circular_buffer; - volk_gnsssdr::vector 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; - bool d_dump; - bool d_dump_mat; - bool d_extended_correlation_in_fpga; - bool d_current_extended_correlation_in_fpga; - int32_t d_next_integration_length_samples; - uint64_t d_sample_counter_next; - bool d_sc_demodulate_enabled; - int32_t d_extend_fpga_integration_periods; - uint32_t d_fpga_integration_period; - uint32_t d_current_fpga_integration_period; - bool d_worker_is_done; - boost::condition_variable m_condition; + gr_complex *d_Very_Early; + gr_complex *d_Early; + gr_complex *d_Prompt; + gr_complex *d_Late; + gr_complex *d_Very_Late; + + gr_complex d_VE_accu; + gr_complex d_E_accu; + gr_complex d_P_accu; + gr_complex d_P_accu_old; + gr_complex d_L_accu; + gr_complex d_VL_accu; + gr_complex d_P_data_accu; + + std::string d_systemName; + std::string d_signal_type; + std::string *d_secondary_code_string; + std::string *d_data_secondary_code_string; + std::string d_signal_pretty_name; + std::string d_dump_filename; + + std::ofstream d_dump_file; + + std::shared_ptr d_multicorrelator_fpga; + + volk_gnsssdr::vector d_local_code_shift_chips; + volk_gnsssdr::vector d_correlator_outs; + volk_gnsssdr::vector d_Prompt_Data; + volk_gnsssdr::vector d_Prompt_buffer; + + boost::circular_buffer d_dll_filt_history; + boost::circular_buffer> d_code_ph_history; + boost::circular_buffer> d_carr_ph_history; + boost::circular_buffer d_Prompt_circular_buffer; + + boost::condition_variable d_m_condition; + boost::mutex d_mutex; - bool d_stop_tracking; + Dll_Pll_Conf_Fpga d_trk_parameters; + + Exponential_Smoother d_cn0_smoother; + Exponential_Smoother d_carrier_lock_test_smoother; + + Gnss_Synchro *d_acquisition_gnss_synchro; + + Tracking_loop_filter d_code_loop_filter; + + Tracking_FLL_PLL_filter d_carrier_loop_filter; + + void msg_handler_telemetry_to_trk(const pmt::pmt_t &msg); + bool cn0_and_tracking_lock_status(double coh_integration_time_s); + bool acquire_secondary(); + void do_correlation_step(); + void run_dll_pll(); + void check_carrier_phase_coherent_initialization(); + void update_tracking_vars(); + void clear_tracking_vars(); + void save_correlation_results(); + void log_data(); + int32_t save_matfile(); }; #endif // GNSS_SDR_DLL_PLL_VEML_TRACKING_FPGA_H