mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-19 05:33:02 +00:00
Changing C-styled cast by C++ style
This commit is contained in:
parent
9c7795dd9a
commit
478d22f973
@ -84,7 +84,7 @@ gps_l1_ca_dll_fll_pll_tracking_cc_sptr gps_l1_ca_dll_fll_pll_make_tracking_cc(
|
|||||||
|
|
||||||
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
ninput_items_required[0] = d_vector_length*2; //set the required available samples in each call
|
ninput_items_required[0] = d_vector_length * 2; //set the required available samples in each call
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,10 +109,10 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(
|
|||||||
|
|
||||||
d_acquisition_gnss_synchro = NULL;
|
d_acquisition_gnss_synchro = NULL;
|
||||||
|
|
||||||
d_if_freq = (double)if_freq;
|
d_if_freq = static_cast<double>(if_freq);
|
||||||
d_fs_in = (double)fs_in;
|
d_fs_in = static_cast<double>(fs_in);
|
||||||
d_vector_length = vector_length;
|
d_vector_length = vector_length;
|
||||||
d_early_late_spc_chips = (double)early_late_space_chips; // Define early-late offset (in chips)
|
d_early_late_spc_chips = static_cast<double>(early_late_space_chips); // Define early-late offset (in chips)
|
||||||
d_dump_filename = dump_filename;
|
d_dump_filename = dump_filename;
|
||||||
|
|
||||||
// Initialize tracking variables ==========================================
|
// Initialize tracking variables ==========================================
|
||||||
@ -143,7 +143,7 @@ Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(
|
|||||||
d_last_seg = 0;// this is for debug output only
|
d_last_seg = 0;// this is for debug output only
|
||||||
d_code_phase_samples = 0;
|
d_code_phase_samples = 0;
|
||||||
d_enable_tracking = false;
|
d_enable_tracking = false;
|
||||||
d_current_prn_length_samples = (int)d_vector_length;
|
d_current_prn_length_samples = static_cast<int>(d_vector_length);
|
||||||
|
|
||||||
// CN0 estimation and lock detector buffers
|
// CN0 estimation and lock detector buffers
|
||||||
d_cn0_estimation_counter = 0;
|
d_cn0_estimation_counter = 0;
|
||||||
@ -174,8 +174,8 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking()
|
|||||||
|
|
||||||
long int acq_trk_diff_samples;
|
long int acq_trk_diff_samples;
|
||||||
float acq_trk_diff_seconds;
|
float acq_trk_diff_seconds;
|
||||||
acq_trk_diff_samples = (long int)d_sample_counter - (long int)d_acq_sample_stamp;
|
acq_trk_diff_samples = static_cast<long int>(d_sample_counter) - static_cast<long int>(d_acq_sample_stamp);
|
||||||
acq_trk_diff_seconds = (double)acq_trk_diff_samples / d_fs_in;
|
acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / d_fs_in;
|
||||||
//doppler effect
|
//doppler effect
|
||||||
// Fd=(C/(C+Vr))*F
|
// Fd=(C/(C+Vr))*F
|
||||||
double radial_velocity;
|
double radial_velocity;
|
||||||
@ -214,8 +214,8 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking()
|
|||||||
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
|
||||||
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0);
|
||||||
|
|
||||||
d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS];
|
d_ca_code[0] = d_ca_code[static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS)];
|
||||||
d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1];
|
d_ca_code[static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) + 1] = d_ca_code[1];
|
||||||
|
|
||||||
d_carrier_lock_fail_counter = 0;
|
d_carrier_lock_fail_counter = 0;
|
||||||
d_Prompt_prev = 0;
|
d_Prompt_prev = 0;
|
||||||
@ -254,7 +254,7 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_code()
|
|||||||
int epl_loop_length_samples;
|
int epl_loop_length_samples;
|
||||||
|
|
||||||
int associated_chip_index;
|
int associated_chip_index;
|
||||||
int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS;
|
int code_length_chips = static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||||
code_phase_step_chips = d_code_freq_hz / d_fs_in;
|
code_phase_step_chips = d_code_freq_hz / d_fs_in;
|
||||||
rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
|
rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in);
|
||||||
// unified loop for E, P, L code vectors
|
// unified loop for E, P, L code vectors
|
||||||
@ -352,7 +352,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
double acq_trk_shif_correction_samples;
|
double acq_trk_shif_correction_samples;
|
||||||
int acq_to_trk_delay_samples;
|
int acq_to_trk_delay_samples;
|
||||||
acq_to_trk_delay_samples = d_sample_counter-d_acq_sample_stamp;
|
acq_to_trk_delay_samples = d_sample_counter-d_acq_sample_stamp;
|
||||||
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod((double)acq_to_trk_delay_samples, (double)d_current_prn_length_samples);
|
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_current_prn_length_samples));
|
||||||
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
|
||||||
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
|
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
|
||||||
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
|
||||||
@ -362,7 +362,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
// make an output to not stop the rest of the processing blocks
|
// make an output to not stop the rest of the processing blocks
|
||||||
current_synchro_data.Prompt_I = 0.0;
|
current_synchro_data.Prompt_I = 0.0;
|
||||||
current_synchro_data.Prompt_Q = 0.0;
|
current_synchro_data.Prompt_Q = 0.0;
|
||||||
current_synchro_data.Tracking_timestamp_secs = (double)d_sample_counter/d_fs_in;
|
current_synchro_data.Tracking_timestamp_secs = static_cast<double>(d_sample_counter) / d_fs_in;
|
||||||
current_synchro_data.Carrier_phase_rads = 0.0;
|
current_synchro_data.Carrier_phase_rads = 0.0;
|
||||||
current_synchro_data.Code_phase_secs = 0.0;
|
current_synchro_data.Code_phase_secs = 0.0;
|
||||||
current_synchro_data.CN0_dB_hz = 0.0;
|
current_synchro_data.CN0_dB_hz = 0.0;
|
||||||
@ -397,7 +397,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
// make an output to not stop the rest of the processing blocks
|
// make an output to not stop the rest of the processing blocks
|
||||||
current_synchro_data.Prompt_I = 0.0;
|
current_synchro_data.Prompt_I = 0.0;
|
||||||
current_synchro_data.Prompt_Q = 0.0;
|
current_synchro_data.Prompt_Q = 0.0;
|
||||||
current_synchro_data.Tracking_timestamp_secs = (double)d_sample_counter/d_fs_in;
|
current_synchro_data.Tracking_timestamp_secs = static_cast<double>(d_sample_counter) / d_fs_in;
|
||||||
current_synchro_data.Carrier_phase_rads = 0.0;
|
current_synchro_data.Carrier_phase_rads = 0.0;
|
||||||
current_synchro_data.Code_phase_secs = 0.0;
|
current_synchro_data.Code_phase_secs = 0.0;
|
||||||
current_synchro_data.CN0_dB_hz = 0.0;
|
current_synchro_data.CN0_dB_hz = 0.0;
|
||||||
@ -417,7 +417,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips);
|
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips);
|
||||||
|
|
||||||
//compute FLL error
|
//compute FLL error
|
||||||
correlation_time_s = ((double)d_current_prn_length_samples) / d_fs_in;
|
correlation_time_s = (static_cast<double>(d_current_prn_length_samples)) / d_fs_in;
|
||||||
if (d_FLL_wait == 1)
|
if (d_FLL_wait == 1)
|
||||||
{
|
{
|
||||||
d_Prompt_prev = *d_Prompt;
|
d_Prompt_prev = *d_Prompt;
|
||||||
@ -509,12 +509,12 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
double T_prn_seconds;
|
double T_prn_seconds;
|
||||||
double T_prn_samples;
|
double T_prn_samples;
|
||||||
double K_blk_samples;
|
double K_blk_samples;
|
||||||
T_chip_seconds = 1 / (double)d_code_freq_hz;
|
T_chip_seconds = 1 / static_cast<double>(d_code_freq_hz);
|
||||||
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||||
T_prn_samples = T_prn_seconds * d_fs_in;
|
T_prn_samples = T_prn_seconds * d_fs_in;
|
||||||
|
|
||||||
float code_error_filt_samples;
|
float code_error_filt_samples;
|
||||||
code_error_filt_samples = T_prn_seconds * code_error_filt_chips * T_chip_seconds * (double)d_fs_in; //[seconds]
|
code_error_filt_samples = T_prn_seconds * code_error_filt_chips * T_chip_seconds * static_cast<double>(d_fs_in); //[seconds]
|
||||||
d_acc_code_phase_samples = d_acc_code_phase_samples + code_error_filt_samples;
|
d_acc_code_phase_samples = d_acc_code_phase_samples + code_error_filt_samples;
|
||||||
|
|
||||||
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_samples;
|
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_samples;
|
||||||
@ -522,11 +522,11 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
|||||||
//d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error
|
//d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error
|
||||||
|
|
||||||
// ########### Output the tracking data to navigation and PVT ##########
|
// ########### Output the tracking data to navigation and PVT ##########
|
||||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
|
||||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag();
|
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
|
||||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||||
//current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_current_prn_length_samples + (double)d_rem_code_phase_samples) / (double)d_fs_in;
|
//current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_current_prn_length_samples + (double)d_rem_code_phase_samples) / (double)d_fs_in;
|
||||||
current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_rem_code_phase_samples)/(double)d_fs_in;
|
current_synchro_data.Tracking_timestamp_secs = (static_cast<double>(d_sample_counter) + static_cast<double>(d_rem_code_phase_samples))/static_cast<double>(d_fs_in);
|
||||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
|
||||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, Code_phase_secs=0
|
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, Code_phase_secs=0
|
||||||
current_synchro_data.Code_phase_secs = 0;
|
current_synchro_data.Code_phase_secs = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user