From 05c139b8bebaa35c0deb9647e812b2adbdcc5469 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 10 Jul 2020 19:52:28 +0200 Subject: [PATCH] Reduce number of warnings raised by bugprone-* clang-tidy checks in tracking blocks --- .../gnuradio_blocks/unpack_2bit_samples.cc | 4 +- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 24 ++-- .../dll_pll_veml_tracking_fpga.cc | 24 ++-- .../galileo_e1_tcp_connector_tracking_cc.cc | 32 +++--- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 42 +++---- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 38 +++---- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 34 +++--- .../glonass_l1_ca_dll_pll_tracking_cc.h | 2 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 42 +++---- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 38 +++---- .../glonass_l2_ca_dll_pll_tracking_cc.cc | 34 +++--- .../glonass_l2_ca_dll_pll_tracking_cc.h | 2 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 10 +- .../gps_l1_ca_kf_tracking_cc.cc | 30 ++--- .../gps_l1_ca_kf_tracking_cc.h | 2 +- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 31 +++-- .../gps_l1_ca_tcp_connector_tracking_cc.h | 107 ++++++++---------- .../tracking/libs/bayesian_estimation.cc | 4 +- 18 files changed, 244 insertions(+), 256 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc index cc48d3341..a88ccfab2 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc @@ -72,8 +72,8 @@ void swapEndianness(int8_t const *in, std::vector &out, size_t item_size for (i = 0; i < ninput_items; ++i) { - k = j + skip; - l = j; + k = static_cast(j + skip); + l = static_cast(j); while (k >= l) { out[j++] = in[k--]; 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 52095973b..3194ca2cb 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -1311,36 +1311,36 @@ void dll_pll_veml_tracking::log_data() tmp_long_int = d_sample_counter + static_cast(d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_long_int), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(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 * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI; + tmp_float = static_cast(d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(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 * d_trk_parameters.fs_in * d_trk_parameters.fs_in; + tmp_float = static_cast(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; + tmp_float = static_cast(d_carr_phase_error_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carr_error_filt_hz; + tmp_float = static_cast(d_carr_error_filt_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = d_code_error_chips; + tmp_float = static_cast(d_code_error_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_error_filt_chips; + tmp_float = static_cast(d_code_error_filt_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_rem_code_phase_samples; + tmp_float = static_cast(d_rem_code_phase_samples); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); 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 ea10404ac..ec61088b6 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 @@ -1070,36 +1070,36 @@ void dll_pll_veml_tracking_fpga::log_data() tmp_long_int = d_sample_counter_next; d_dump_file.write(reinterpret_cast(&tmp_long_int), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(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 * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI; + tmp_float = static_cast(d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(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 * d_trk_parameters.fs_in * d_trk_parameters.fs_in; + tmp_float = static_cast(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; + tmp_float = static_cast(d_carr_phase_error_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carr_error_filt_hz; + tmp_float = static_cast(d_carr_error_filt_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = d_code_error_chips; + tmp_float = static_cast(d_code_error_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_error_filt_chips; + tmp_float = static_cast(d_code_error_filt_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_rem_code_phase_samples; + tmp_float = static_cast(d_rem_code_phase_samples); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); tmp_double = static_cast(d_sample_counter_next); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 79c169706..abb520c46 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -154,7 +154,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = FLAGS_carrier_lock_th; + d_carrier_lock_threshold = static_cast(FLAGS_carrier_lock_th); systemName["E"] = std::string("Galileo"); d_acquisition_gnss_synchro = nullptr; @@ -172,8 +172,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() { - d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; - d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; + d_acq_code_phase_samples = static_cast(d_acquisition_gnss_synchro->Acq_delay_samples); + d_acq_carrier_doppler_hz = static_cast(d_acquisition_gnss_synchro->Acq_doppler_hz); d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; std::array Signal_{}; std::memcpy(Signal_.data(), d_acquisition_gnss_synchro->Signal, 3); @@ -323,9 +323,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri double rem_code_phase_half_chips = d_rem_code_phase_samples * (2.0 * d_code_freq_chips / d_fs_in); multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler( d_rem_carr_phase_rad, - carr_phase_step_rad, - rem_code_phase_half_chips, - code_phase_step_half_chips, + static_cast(carr_phase_step_rad), + static_cast(rem_code_phase_half_chips), + static_cast(code_phase_step_half_chips), d_correlation_length_samples); // ################## TCP CONNECTOR ########################################################## @@ -356,9 +356,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri // New code Doppler frequency estimation d_code_freq_chips = GALILEO_E1_CODE_CHIP_RATE_CPS + ((d_carrier_doppler_hz * GALILEO_E1_CODE_CHIP_RATE_CPS) / GALILEO_E1_FREQ_HZ); // carrier phase accumulator for (K) doppler estimation - d_acc_carrier_phase_rad -= TWO_PI * d_carrier_doppler_hz * GALILEO_E1_CODE_PERIOD_S; + d_acc_carrier_phase_rad -= static_cast(TWO_PI * d_carrier_doppler_hz * GALILEO_E1_CODE_PERIOD_S); // remnant carrier phase to prevent overflow in the code NCO - d_rem_carr_phase_rad = d_rem_carr_phase_rad + TWO_PI * d_carrier_doppler_hz * GALILEO_E1_CODE_PERIOD_S; + d_rem_carr_phase_rad = d_rem_carr_phase_rad + static_cast(TWO_PI * d_carrier_doppler_hz * GALILEO_E1_CODE_PERIOD_S); d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, TWO_PI); // ################## DLL ########################################################## @@ -366,7 +366,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri code_error_filt_chips = tcp_data.proc_pack_code_error; // Code phase accumulator float code_error_filt_secs; - code_error_filt_secs = (GALILEO_E1_CODE_PERIOD_S * code_error_filt_chips) / GALILEO_E1_CODE_CHIP_RATE_CPS; // [seconds] + code_error_filt_secs = static_cast((GALILEO_E1_CODE_PERIOD_S * code_error_filt_chips) / GALILEO_E1_CODE_CHIP_RATE_CPS); // [seconds] d_acc_code_phase_secs = d_acc_code_phase_secs + code_error_filt_secs; // ################## CARRIER AND CODE NCO BUFFER ALIGNMENT ####################### @@ -485,27 +485,27 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands tmp_float = 0.0; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = carr_error_filt_hz; + tmp_float = static_cast(carr_error_filt_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands tmp_float = 0.0; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = code_error_filt_chips; + tmp_float = static_cast(code_error_filt_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) tmp_float = 0.0; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 04a41de20..cf1f5e8e2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -269,8 +269,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() // DLL/PLL filter initialization - d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator - d_code_loop_filter.initialize(); // initialize the code filter + d_carrier_loop_filter.initialize(static_cast(d_carrier_frequency_hz)); // The carrier loop filter implements the Doppler accumulator + d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) glonass_l1_ca_code_gen_complex(own::span(d_ca_code.data(), GLONASS_L1_CA_CODE_LENGTH_CHIPS), 0); @@ -595,10 +595,10 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // ################# 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(), in); - multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(static_cast(d_rem_carrier_phase_rad), + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_correlation_length_samples); // ####### coherent integration extension @@ -644,7 +644,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at } // UPDATE INTEGRATION TIME CURRENT_INTEGRATION_TIME_S = static_cast(d_extend_correlation_ms) * GLONASS_L1_CA_CODE_PERIOD_S; - d_code_loop_filter.set_pdi(CURRENT_INTEGRATION_TIME_S); + d_code_loop_filter.set_pdi(static_cast(CURRENT_INTEGRATION_TIME_S)); enable_dll_pll = true; } else @@ -680,7 +680,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // perform basic (1ms) correlation // UPDATE INTEGRATION TIME CURRENT_INTEGRATION_TIME_S = static_cast(d_correlation_length_samples) / static_cast(d_fs_in); - d_code_loop_filter.set_pdi(CURRENT_INTEGRATION_TIME_S); + d_code_loop_filter.set_pdi(static_cast(CURRENT_INTEGRATION_TIME_S)); enable_dll_pll = true; } } @@ -701,7 +701,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // Carrier discriminator filter // NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan // Input [s/Ti] -> output [Hz] - d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, d_carr_phase_error_secs_Ti, CURRENT_INTEGRATION_TIME_S); + d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, static_cast(d_carr_phase_error_secs_Ti), static_cast(CURRENT_INTEGRATION_TIME_S)); // PLL to DLL assistance [Secs/Ti] d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz * CURRENT_INTEGRATION_TIME_S) / d_glonass_freq_ch; // code Doppler frequency update @@ -709,9 +709,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // ################## DLL ########################################################## // DLL discriminator - d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], d_early_late_spc_chips, 1.0); // [chips/Ti] //early and late + d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] //early and late // Code discriminator filter - d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second] + d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(static_cast(d_code_error_chips_Ti)); // input [chips/Ti] -> output [chips/second] d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S; code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti] @@ -851,30 +851,30 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_cycles * TWO_PI; + tmp_float = static_cast(d_acc_carrier_phase_cycles * TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = 1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = 1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_error_filt_chips_Ti; + tmp_float = static_cast(d_code_error_filt_chips_Ti); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 5119473e3..d91195704 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -264,8 +264,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_carrier_phase_step_rad = TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); // DLL/PLL filter initialization - d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator - d_code_loop_filter.initialize(); // initialize the code filter + d_carrier_loop_filter.initialize(static_cast(d_carrier_frequency_hz)); // The carrier loop filter implements the Doppler accumulator + d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) glonass_l1_ca_code_gen_complex(d_ca_code, 0); @@ -596,10 +596,10 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation multicorrelator_cpu_16sc.set_input_output_vectors(d_correlator_outs_16sc.data(), in); - multicorrelator_cpu_16sc.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, + multicorrelator_cpu_16sc.Carrier_wipeoff_multicorrelator_resampler(static_cast(d_rem_carrier_phase_rad), + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_correlation_length_samples); // ####### coherent integration extension @@ -700,7 +700,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // Carrier discriminator filter // NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan // Input [s/Ti] -> output [Hz] - d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, d_carr_phase_error_secs_Ti, CURRENT_INTEGRATION_TIME_S); + d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, static_cast(d_carr_phase_error_secs_Ti), static_cast(CURRENT_INTEGRATION_TIME_S)); // PLL to DLL assistance [Secs/Ti] d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz * CURRENT_INTEGRATION_TIME_S) / d_glonass_freq_ch; // code Doppler frequency update @@ -708,9 +708,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // ################## DLL ########################################################## // DLL discriminator - d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()), std::complex(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag()), d_early_late_spc_chips, 1.0); // [chips/Ti] //early and late + d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()), std::complex(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag()), static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] //early and late // Code discriminator filter - d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second] + d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(static_cast(d_code_error_chips_Ti)); // input [chips/Ti] -> output [chips/second] d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S; code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti] @@ -850,30 +850,30 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_cycles * TWO_PI; + tmp_float = static_cast(d_acc_carrier_phase_cycles * TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = 1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = 1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_error_filt_chips_Ti; + tmp_float = static_cast(d_code_error_filt_chips_Ti); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 3aba31df0..c6e1dad38 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -539,9 +539,9 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // perform carrier wipe-off and compute Early, Prompt and Late correlation multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in); multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_current_prn_length_samples); // ################## PLL ########################################################## @@ -549,7 +549,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // Update PLL discriminator [rads/Ti -> Secs/Ti] carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / TWO_PI; // prompt output // Carrier discriminator filter - carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz); + carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(static_cast(carr_error_hz)); // New carrier Doppler frequency estimation d_carrier_frequency_hz += carr_error_filt_hz; d_carrier_doppler_hz += carr_error_filt_hz; @@ -557,9 +557,9 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // ################## DLL ########################################################## // DLL discriminator - code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], d_early_late_spc_chips, 1.0); // [chips/Ti] //early and late + code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] //early and late // Code discriminator filter - code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second] + code_error_filt_chips = d_code_loop_filter.get_code_nco(static_cast(code_error_chips)); // [chips/second] double T_chip_seconds = 1.0 / static_cast(d_code_freq_chips); double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS; double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); // [seconds] @@ -579,7 +579,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_carrier_doppler_phase_step_rad = TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); d_carrier_phase_step_rad = TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); // remnant carrier phase to prevent overflow in the code NCO - d_rem_carr_phase_rad = d_rem_carr_phase_rad + d_carrier_phase_step_rad * d_current_prn_length_samples; + d_rem_carr_phase_rad = d_rem_carr_phase_rad + static_cast(d_carrier_phase_step_rad * d_current_prn_length_samples); d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, TWO_PI); // carrier phase accumulator d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * d_current_prn_length_samples; @@ -678,30 +678,30 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = carr_error_hz; + tmp_float = static_cast(carr_error_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = carr_error_filt_hz; + tmp_float = static_cast(carr_error_filt_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = code_error_chips; + tmp_float = static_cast(code_error_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = code_error_filt_chips; + tmp_float = static_cast(code_error_filt_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_rem_code_phase_samples; + tmp_float = static_cast(d_rem_code_phase_samples); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); auto tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h index d5ebddea4..c358f117e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h @@ -128,7 +128,7 @@ private: // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; double d_rem_code_phase_chips; - double d_rem_carr_phase_rad; + float d_rem_carr_phase_rad; // acquisition double d_acq_code_phase_samples; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 22301ad00..5daa5aac6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -265,8 +265,8 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_carrier_phase_step_rad = TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); // DLL/PLL filter initialization - d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator - d_code_loop_filter.initialize(); // initialize the code filter + d_carrier_loop_filter.initialize(static_cast(d_carrier_frequency_hz)); // The carrier loop filter implements the Doppler accumulator + d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) glonass_l2_ca_code_gen_complex(d_ca_code, 0); @@ -592,10 +592,10 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // ################# 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(), in); - multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(static_cast(d_rem_carrier_phase_rad), + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_correlation_length_samples); // ####### coherent integration extension @@ -641,7 +641,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at } // UPDATE INTEGRATION TIME CURRENT_INTEGRATION_TIME_S = static_cast(d_extend_correlation_ms) * GLONASS_L2_CA_CODE_PERIOD_S; - d_code_loop_filter.set_pdi(CURRENT_INTEGRATION_TIME_S); + d_code_loop_filter.set_pdi(static_cast(CURRENT_INTEGRATION_TIME_S)); enable_dll_pll = true; } else @@ -677,7 +677,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // perform basic (1ms) correlation // UPDATE INTEGRATION TIME CURRENT_INTEGRATION_TIME_S = static_cast(d_correlation_length_samples) / static_cast(d_fs_in); - d_code_loop_filter.set_pdi(CURRENT_INTEGRATION_TIME_S); + d_code_loop_filter.set_pdi(static_cast(CURRENT_INTEGRATION_TIME_S)); enable_dll_pll = true; } } @@ -698,7 +698,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // Carrier discriminator filter // NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan // Input [s/Ti] -> output [Hz] - d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, d_carr_phase_error_secs_Ti, CURRENT_INTEGRATION_TIME_S); + d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, static_cast(d_carr_phase_error_secs_Ti), static_cast(CURRENT_INTEGRATION_TIME_S)); // PLL to DLL assistance [Secs/Ti] d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz * CURRENT_INTEGRATION_TIME_S) / d_glonass_freq_ch; // code Doppler frequency update @@ -706,9 +706,9 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // ################## DLL ########################################################## // DLL discriminator - d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], d_early_late_spc_chips, 1.0); // [chips/Ti] //early and late + d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] //early and late // Code discriminator filter - d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second] + d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(static_cast(d_code_error_chips_Ti)); // input [chips/Ti] -> output [chips/second] d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S; code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti] @@ -844,30 +844,30 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_cycles * TWO_PI; + tmp_float = static_cast(d_acc_carrier_phase_cycles * TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = 1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = 1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_error_filt_chips_Ti; + tmp_float = static_cast(d_code_error_filt_chips_Ti); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index c583506a5..607ec182c 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -262,8 +262,8 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_carrier_phase_step_rad = TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); // DLL/PLL filter initialization - d_carrier_loop_filter.initialize(d_carrier_frequency_hz); // The carrier loop filter implements the Doppler accumulator - d_code_loop_filter.initialize(); // initialize the code filter + d_carrier_loop_filter.initialize(static_cast(d_carrier_frequency_hz)); // The carrier loop filter implements the Doppler accumulator + d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) glonass_l2_ca_code_gen_complex(d_ca_code, 0); @@ -594,10 +594,10 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation multicorrelator_cpu_16sc.set_input_output_vectors(d_correlator_outs_16sc.data(), in); - multicorrelator_cpu_16sc.Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, + multicorrelator_cpu_16sc.Carrier_wipeoff_multicorrelator_resampler(static_cast(d_rem_carrier_phase_rad), + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_correlation_length_samples); // ####### coherent integration extension @@ -698,7 +698,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // Carrier discriminator filter // NOTICE: The carrier loop filter includes the Carrier Doppler accumulator, as described in Kaplan // Input [s/Ti] -> output [Hz] - d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, d_carr_phase_error_secs_Ti, CURRENT_INTEGRATION_TIME_S); + d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, static_cast(d_carr_phase_error_secs_Ti), static_cast(CURRENT_INTEGRATION_TIME_S)); // PLL to DLL assistance [Secs/Ti] d_pll_to_dll_assist_secs_Ti = (d_carrier_doppler_hz * CURRENT_INTEGRATION_TIME_S) / d_glonass_freq_ch; // code Doppler frequency update @@ -706,9 +706,9 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // ################## DLL ########################################################## // DLL discriminator - d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()), std::complex(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag()), d_early_late_spc_chips, 1.0); // [chips/Ti] //early and late + d_code_error_chips_Ti = dll_nc_e_minus_l_normalized(std::complex(d_correlator_outs_16sc[0].real(), d_correlator_outs_16sc[0].imag()), std::complex(d_correlator_outs_16sc[2].real(), d_correlator_outs_16sc[2].imag()), static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] //early and late // Code discriminator filter - d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(d_code_error_chips_Ti); // input [chips/Ti] -> output [chips/second] + d_code_error_filt_chips_s = d_code_loop_filter.get_code_nco(static_cast(d_code_error_chips_Ti)); // input [chips/Ti] -> output [chips/second] d_code_error_filt_chips_Ti = d_code_error_filt_chips_s * CURRENT_INTEGRATION_TIME_S; code_error_filt_secs_Ti = d_code_error_filt_chips_Ti / d_code_freq_chips; // [s/Ti] @@ -848,30 +848,30 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_cycles * TWO_PI; + tmp_float = static_cast(d_acc_carrier_phase_cycles * TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = 1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = 1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_error_filt_chips_Ti; + tmp_float = static_cast(d_code_error_filt_chips_Ti); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; + tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); auto tmp_double = static_cast(d_sample_counter + d_correlation_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index c144d45d6..977bc2065 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -540,9 +540,9 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // perform carrier wipe-off and compute Early, Prompt and Late correlation multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in); multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_current_prn_length_samples); // ################## PLL ########################################################## @@ -550,7 +550,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // Update PLL discriminator [rads/Ti -> Secs/Ti] carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / TWO_PI; // prompt output // Carrier discriminator filter - carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz); + carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(static_cast(carr_error_hz)); // New carrier Doppler frequency estimation d_carrier_frequency_hz += carr_error_filt_hz; d_carrier_doppler_hz += carr_error_filt_hz; @@ -558,9 +558,9 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // ################## DLL ########################################################## // DLL discriminator - code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], d_early_late_spc_chips, 1.0); // [chips/Ti] //early and late + code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] //early and late // Code discriminator filter - code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second] + code_error_filt_chips = d_code_loop_filter.get_code_nco(static_cast(code_error_chips)); // [chips/second] double T_chip_seconds = 1.0 / static_cast(d_code_freq_chips); double T_prn_seconds = T_chip_seconds * GLONASS_L2_CA_CODE_LENGTH_CHIPS; double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); // [seconds] @@ -580,7 +580,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_carrier_doppler_phase_step_rad = TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); d_carrier_phase_step_rad = TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); // remnant carrier phase to prevent overflow in the code NCO - d_rem_carr_phase_rad = d_rem_carr_phase_rad + d_carrier_phase_step_rad * d_current_prn_length_samples; + d_rem_carr_phase_rad = d_rem_carr_phase_rad + static_cast(d_carrier_phase_step_rad * d_current_prn_length_samples); d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, TWO_PI); // carrier phase accumulator d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * d_current_prn_length_samples; @@ -679,30 +679,30 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = carr_error_hz; + tmp_float = static_cast(carr_error_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = carr_error_filt_hz; + tmp_float = static_cast(carr_error_filt_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = code_error_chips; + tmp_float = static_cast(code_error_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = code_error_filt_chips; + tmp_float = static_cast(code_error_filt_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_rem_code_phase_samples; + tmp_float = static_cast(d_rem_code_phase_samples); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); auto tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h index b632eb321..a19edcceb 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h @@ -126,7 +126,7 @@ private: // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; double d_rem_code_phase_chips; - double d_rem_carr_phase_rad; + float d_rem_carr_phase_rad; // acquisition double d_acq_code_phase_samples; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index c926a0422..a899d96fa 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -503,12 +503,12 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_cycles * TWO_PI; + tmp_float = static_cast(d_acc_carrier_phase_cycles * TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands tmp_float = 1.0 / (carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); @@ -521,9 +521,9 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut tmp_float = code_error_filt_secs_Ti; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) tmp_float = code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc index 8ac3ad3ba..0b969b7b2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.cc @@ -676,10 +676,10 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus // Perform carrier wipe-off and compute Early, Prompt and Late correlation multicorrelator_cpu.set_input_output_vectors(d_correlator_outs.data(), in); multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, - d_carrier_phase_step_rad, - d_rem_code_phase_chips, - d_code_phase_step_chips, - d_code_phase_rate_step_chips, + static_cast(d_carrier_phase_step_rad), + static_cast(d_rem_code_phase_chips), + static_cast(d_code_phase_step_chips), + static_cast(d_code_phase_rate_step_chips), d_current_prn_length_samples); // ################## Kalman Carrier Tracking ###################################### @@ -737,9 +737,9 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus // New code Doppler frequency estimation based on carrier frequency estimation d_code_freq_chips = GPS_L1_CA_CODE_RATE_CPS + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_CPS) / GPS_L1_FREQ_HZ); // DLL discriminator - code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], d_early_late_spc_chips, 1.0); // [chips/Ti] early and late + code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2], static_cast(d_early_late_spc_chips), 1.0); // [chips/Ti] early and late // Code discriminator filter - code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second] + code_error_filt_chips = d_code_loop_filter.get_code_nco(static_cast(code_error_chips)); // [chips/second] double T_chip_seconds = 1.0 / static_cast(d_code_freq_chips); double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); // [seconds] @@ -862,14 +862,14 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_dopplerrate_hz2; + tmp_float = static_cast(d_carrier_dopplerrate_hz2); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_chips; + tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // Kalman commands tmp_float = static_cast(d_carr_phase_error_rad * TWO_PI); @@ -879,17 +879,17 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus tmp_float = static_cast(d_rem_carr_phase_rad * TWO_PI); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands - tmp_float = code_error_chips; + tmp_float = static_cast(code_error_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = code_error_filt_chips; + tmp_float = static_cast(code_error_filt_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) - tmp_float = d_rem_code_phase_samples; + tmp_float = static_cast(d_rem_code_phase_samples); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); tmp_double = static_cast(d_sample_counter + static_cast(d_current_prn_length_samples)); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h index e8968e439..e83c03f46 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h @@ -134,7 +134,7 @@ private: // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; double d_rem_code_phase_chips; - double d_rem_carr_phase_rad; + float d_rem_carr_phase_rad; // Kalman filter variables arma::mat kf_P_x_ini; // initial state error covariance matrix diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index f59b04fcf..5d11f79c2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -140,7 +140,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = FLAGS_carrier_lock_th; + d_carrier_lock_threshold = static_cast(FLAGS_carrier_lock_th); systemName["G"] = std::string("GPS"); systemName["R"] = std::string("GLONASS"); @@ -167,8 +167,8 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() * correct the code phase according to the delay between acq and trk */ - d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; - d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; + d_acq_code_phase_samples = static_cast(d_acquisition_gnss_synchro->Acq_delay_samples); + d_acq_carrier_doppler_hz = static_cast(d_acquisition_gnss_synchro->Acq_doppler_hz); d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; int64_t acq_trk_diff_samples; @@ -178,16 +178,15 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); // doppler effect // Fd=(C/(C+Vr))*F - float radial_velocity; - radial_velocity = (GPS_L1_FREQ_HZ + d_acq_carrier_doppler_hz) / GPS_L1_FREQ_HZ; + float radial_velocity = static_cast((GPS_L1_FREQ_HZ + d_acq_carrier_doppler_hz) / GPS_L1_FREQ_HZ); // new chip and prn sequence periods based on acq Doppler float T_chip_mod_seconds; float T_prn_mod_seconds; float T_prn_mod_samples; d_code_freq_hz = radial_velocity * GPS_L1_CA_CODE_RATE_CPS; d_code_phase_step_chips = static_cast(d_code_freq_hz) / static_cast(d_fs_in); - T_chip_mod_seconds = 1 / d_code_freq_hz; - T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; + T_chip_mod_seconds = static_cast(1.0 / d_code_freq_hz); + T_prn_mod_seconds = static_cast(T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS); T_prn_mod_samples = T_prn_mod_seconds * static_cast(d_fs_in); d_next_prn_length_samples = std::round(T_prn_mod_samples); @@ -362,9 +361,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib double rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in); multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, - carr_phase_step_rad, - rem_code_phase_chips, - d_code_phase_step_chips, + static_cast(carr_phase_step_rad), + static_cast(rem_code_phase_chips), + static_cast(d_code_phase_step_chips), d_current_prn_length_samples); // Variable used for control @@ -388,7 +387,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib // Modify carrier freq based on NCO command d_carrier_doppler_hz = tcp_data.proc_pack_carrier_doppler_hz; // Modify code freq based on NCO command - code_nco = 1 / (1 / GPS_L1_CA_CODE_RATE_CPS - code_error / GPS_L1_CA_CODE_LENGTH_CHIPS); + code_nco = static_cast(1.0 / (1.0 / GPS_L1_CA_CODE_RATE_CPS - code_error / GPS_L1_CA_CODE_LENGTH_CHIPS)); d_code_freq_hz = code_nco; // Update the phasestep based on code freq (variable) and @@ -521,12 +520,12 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib // PRN start sample stamp d_dump_file.write(reinterpret_cast(&d_sample_counter), sizeof(uint64_t)); // accumulated carrier phase - tmp_float = d_acc_carrier_phase_rad; + tmp_float = static_cast(d_acc_carrier_phase_rad); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // carrier and code frequency - tmp_float = d_carrier_doppler_hz; + tmp_float = static_cast(d_carrier_doppler_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_code_freq_hz; + tmp_float = static_cast(d_code_freq_hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands tmp_float = 0.0; @@ -539,9 +538,9 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib tmp_float = code_error; d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // CN0 and carrier lock test - tmp_float = d_CN0_SNV_dB_Hz; + tmp_float = static_cast(d_CN0_SNV_dB_Hz); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = d_carrier_lock_test; + tmp_float = static_cast(d_carrier_lock_test); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // AUX vars (for debug purposes) tmp_float = 0.0; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h index c04b279df..dbcd28b4a 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h @@ -96,77 +96,66 @@ private: float early_late_space_chips, size_t port_ch0); - // tracking configuration vars - uint32_t d_vector_length; - bool d_dump; - - Gnss_Synchro *d_acquisition_gnss_synchro; - uint32_t d_channel; - - int64_t d_fs_in; - int32_t d_correlation_length_samples; - int32_t d_n_correlator_taps; - double d_early_late_spc_chips; - - double d_code_phase_step_chips; - volk_gnsssdr::vector d_ca_code; + // correlator + volk_gnsssdr::vector d_local_code_shift_chips; + volk_gnsssdr::vector d_correlator_outs; + volk_gnsssdr::vector d_Prompt_buffer; + Cpu_Multicorrelator multicorrelator_cpu; + Tcp_Communication d_tcp_com; + Gnss_Synchro *d_acquisition_gnss_synchro; + // tracking configuration vars gr_complex *d_Early; gr_complex *d_Prompt; gr_complex *d_Late; - // remaining code phase and carrier phase between tracking loops - double d_rem_code_phase_samples; - double d_next_rem_code_phase_samples; - float d_rem_carr_phase_rad; - - // acquisition - float d_acq_code_phase_samples; - float d_acq_carrier_doppler_hz; - // correlator - volk_gnsssdr::vector d_local_code_shift_chips; - volk_gnsssdr::vector d_correlator_outs; - Cpu_Multicorrelator multicorrelator_cpu; - - // tracking vars - double d_code_freq_hz; - double d_carrier_doppler_hz; - double d_acc_carrier_phase_rad; - double d_code_phase_samples; - size_t d_port_ch0; - size_t d_port; - int32_t d_listen_connection; - float d_control_id; - Tcp_Communication d_tcp_com; - - // PRN period in samples - int32_t d_current_prn_length_samples; - int32_t d_next_prn_length_samples; - double d_sample_counter_seconds; - - // 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; - volk_gnsssdr::vector d_Prompt_buffer; - float d_carrier_lock_test; - float d_CN0_SNV_dB_Hz; - float d_carrier_lock_threshold; - int32_t d_carrier_lock_fail_counter; - - // control vars - bool d_enable_tracking; - bool d_pull_in; - // file dump std::string d_dump_filename; std::ofstream d_dump_file; std::map systemName; std::string sys; + + double d_early_late_spc_chips; + double d_code_phase_step_chips; + double d_rem_code_phase_samples; + double d_next_rem_code_phase_samples; + double d_code_freq_hz; + double d_carrier_doppler_hz; + double d_acc_carrier_phase_rad; + double d_code_phase_samples; + double d_sample_counter_seconds; + + int64_t d_fs_in; + uint64_t d_sample_counter; + uint64_t d_acq_sample_stamp; + + size_t d_port_ch0; + size_t d_port; + + uint32_t d_vector_length; + uint32_t d_channel; + + int32_t d_correlation_length_samples; + int32_t d_n_correlator_taps; + int32_t d_listen_connection; + int32_t d_current_prn_length_samples; + int32_t d_next_prn_length_samples; + int32_t d_cn0_estimation_counter; + int32_t d_carrier_lock_fail_counter; + + float d_rem_carr_phase_rad; + float d_acq_code_phase_samples; + float d_acq_carrier_doppler_hz; + float d_carrier_lock_test; + float d_CN0_SNV_dB_Hz; + float d_carrier_lock_threshold; + float d_control_id; + + bool d_enable_tracking; + bool d_pull_in; + bool d_dump; }; #endif // GNSS_SDR_GPS_L1_CA_TCP_CONNECTOR_TRACKING_CC_H diff --git a/src/algorithms/tracking/libs/bayesian_estimation.cc b/src/algorithms/tracking/libs/bayesian_estimation.cc index 784066f9f..151c86acf 100644 --- a/src/algorithms/tracking/libs/bayesian_estimation.cc +++ b/src/algorithms/tracking/libs/bayesian_estimation.cc @@ -113,7 +113,7 @@ void Bayesian_estimator::update_sequential(const arma::vec& data) arma::vec mu_posterior = (kappa_prior * mu_prior + K * y_mean) / (kappa_prior + K); int kappa_posterior = kappa_prior + K; int nu_posterior = nu_prior + K; - arma::mat Psi_posterior = Psi_prior + Psi_N + (kappa_prior * static_cast(K)) / (kappa_prior + static_cast(K)) * (y_mean - mu_prior) * ((y_mean - mu_prior).t()); + arma::mat Psi_posterior = Psi_prior + Psi_N + (static_cast(kappa_prior) * static_cast(K)) / (static_cast(kappa_prior) + static_cast(K)) * (y_mean - mu_prior) * ((y_mean - mu_prior).t()); mu_est = mu_posterior; if ((nu_posterior - ny - 1) > 0) @@ -152,7 +152,7 @@ void Bayesian_estimator::update_sequential(const arma::vec& data, const arma::ve arma::vec mu_posterior = (kappa_prior_0 * mu_prior_0 + K * y_mean) / (kappa_prior_0 + K); int kappa_posterior = kappa_prior_0 + K; int nu_posterior = nu_prior_0 + K; - arma::mat Psi_posterior = Psi_prior_0 + Psi_N + (kappa_prior_0 * static_cast(K)) / (kappa_prior_0 + static_cast(K)) * (y_mean - mu_prior_0) * ((y_mean - mu_prior_0).t()); + arma::mat Psi_posterior = Psi_prior_0 + Psi_N + (Psi_prior_0 * static_cast(K)) / (static_cast(kappa_prior_0) + static_cast(K)) * (y_mean - mu_prior_0) * ((y_mean - mu_prior_0).t()); mu_est = mu_posterior; if ((nu_posterior - ny - 1) > 0)