From 821e4f81a9a5a259330d918481431454ad4b8f5c Mon Sep 17 00:00:00 2001 From: Antonio Ramos Date: Fri, 9 Feb 2018 12:55:02 +0100 Subject: [PATCH] Minor changes --- .../galileo_e1_dll_pll_veml_tracking_cc.cc | 26 +++-------- .../galileo_e5a_dll_pll_tracking_cc.cc | 35 ++++++--------- .../gps_l1_ca_dll_pll_c_aid_tracking_cc.cc | 23 +++------- .../gps_l1_ca_dll_pll_tracking_cc.cc | 34 +++++--------- .../gps_l2_m_dll_pll_tracking_cc.cc | 10 ----- .../gps_l5i_dll_pll_tracking_cc.cc | 45 ++++++------------- src/core/system_parameters/GPS_L1_CA.h | 5 +++ src/core/system_parameters/GPS_L2C.h | 15 +++++-- src/core/system_parameters/GPS_L5.h | 9 +++- src/core/system_parameters/Galileo_E1.h | 5 +++ src/core/system_parameters/Galileo_E5a.h | 5 +++ 11 files changed, 84 insertions(+), 128 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc index ecc7df1be..9ed1259dc 100755 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc @@ -50,17 +50,6 @@ #include "Galileo_E1.h" #include "control_message_factory.h" - - -/*! - * \todo Include in definition header file - */ -#define CN0_ESTIMATION_SAMPLES 20 -#define MINIMUM_VALID_CN0 25 -#define MAXIMUM_LOCK_FAIL_COUNTER 50 -#define CARRIER_LOCK_THRESHOLD 0.85 - - using google::LogMessage; galileo_e1_dll_pll_veml_tracking_cc_sptr @@ -234,11 +223,11 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[CN0_ESTIMATION_SAMPLES]; + d_Prompt_buffer = new gr_complex[GALILEO_E1_CN0_ESTIMATION_SAMPLES]; d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD; + d_carrier_lock_threshold = GALILEO_E1_CARRIER_LOCK_THRESHOLD; systemName["E"] = std::string("Galileo"); @@ -463,7 +452,7 @@ bool galileo_e1_dll_pll_veml_tracking_cc::acquire_secondary() bool galileo_e1_dll_pll_veml_tracking_cc::cn0_and_tracking_lock_status() { // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) + if (d_cn0_estimation_counter < GALILEO_E1_CN0_ESTIMATION_SAMPLES) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_P_accu; @@ -474,11 +463,11 @@ bool galileo_e1_dll_pll_veml_tracking_cc::cn0_and_tracking_lock_status() { d_cn0_estimation_counter = 0; // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS); + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, GALILEO_E1_CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E1_B_CODE_LENGTH_CHIPS); // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, GALILEO_E1_CN0_ESTIMATION_SAMPLES); // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < GALILEO_E1_MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } @@ -486,7 +475,7 @@ bool galileo_e1_dll_pll_veml_tracking_cc::cn0_and_tracking_lock_status() { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > GALILEO_E1_MAXIMUM_LOCK_FAIL_COUNTER) { std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; @@ -682,7 +671,6 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items __attri samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); current_synchro_data.Tracking_sample_counter = d_sample_counter; current_synchro_data.fs = d_fs_in; - *out[0] = current_synchro_data; d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples consume_each(samples_offset); // shift input to perform alignment with local replica d_state = 2; // next state is the symbol synchronization diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc index dbb12e2ef..139097148 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc @@ -51,15 +51,6 @@ #include "control_message_factory.h" -/*! - * \todo Include in definition header file - */ -#define CN0_ESTIMATION_SAMPLES 20 -#define MINIMUM_VALID_CN0 25 -#define MAXIMUM_LOCK_FAIL_COUNTER 50 -#define CARRIER_LOCK_THRESHOLD 0.85 - - using google::LogMessage; galileo_e5a_dll_pll_tracking_cc_sptr @@ -185,11 +176,11 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[CN0_ESTIMATION_SAMPLES]; + d_Prompt_buffer = new gr_complex[GALILEO_E5A_CN0_ESTIMATION_SAMPLES]; d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD; + d_carrier_lock_threshold = GALILEO_E5A_CARRIER_LOCK_THRESHOLD; d_acquisition_gnss_synchro = 0; d_channel = 0; @@ -356,8 +347,8 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::acquire_secondary() } } // 2. Transform buffer to 1 and -1 - int in_corr[CN0_ESTIMATION_SAMPLES]; - for (unsigned int i = 0; i < CN0_ESTIMATION_SAMPLES; i++) + int in_corr[GALILEO_E5A_CN0_ESTIMATION_SAMPLES]; + for (unsigned int i = 0; i < GALILEO_E5A_CN0_ESTIMATION_SAMPLES; i++) { if (d_Prompt_buffer[i].real() >0) { @@ -374,7 +365,7 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::acquire_secondary() for (unsigned int i = 0; i < Galileo_E5a_Q_SECONDARY_CODE_LENGTH; i++) { out_corr = 0; - for (unsigned int j = 0; j < CN0_ESTIMATION_SAMPLES; j++) + for (unsigned int j = 0; j < GALILEO_E5A_CN0_ESTIMATION_SAMPLES; j++) { //reverse replica sign since i*i=-1 (conjugated complex) out_corr += in_corr[j] * -sec_code_signed[(j + i) % Galileo_E5a_Q_SECONDARY_CODE_LENGTH]; @@ -385,10 +376,10 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::acquire_secondary() d_secondary_delay = i; } } - if (current_best_ == CN0_ESTIMATION_SAMPLES) // all bits correlate + if (current_best_ == GALILEO_E5A_CN0_ESTIMATION_SAMPLES) // all bits correlate { d_secondary_lock = true; - d_secondary_delay = (d_secondary_delay + CN0_ESTIMATION_SAMPLES - 1) % Galileo_E5a_Q_SECONDARY_CODE_LENGTH; + d_secondary_delay = (d_secondary_delay + GALILEO_E5A_CN0_ESTIMATION_SAMPLES - 1) % Galileo_E5a_Q_SECONDARY_CODE_LENGTH; } } @@ -569,7 +560,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES-1) + if (d_cn0_estimation_counter < GALILEO_E5A_CN0_ESTIMATION_SAMPLES-1) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_Prompt; @@ -596,7 +587,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute { //std::cout << "Secondary code delay couldn't be resolved." << std::endl; d_carrier_lock_fail_counter++; - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > GALILEO_E5A_MAXIMUM_LOCK_FAIL_COUNTER) { std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; @@ -609,11 +600,11 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute else // Secondary lock achieved, monitor carrier lock. { // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in,d_current_ti_ms * Galileo_E5a_CODE_LENGTH_CHIPS); + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, GALILEO_E5A_CN0_ESTIMATION_SAMPLES, d_fs_in,d_current_ti_ms * Galileo_E5a_CODE_LENGTH_CHIPS); // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, GALILEO_E5A_CN0_ESTIMATION_SAMPLES); // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < GALILEO_E5A_MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } @@ -621,7 +612,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > GALILEO_E5A_MAXIMUM_LOCK_FAIL_COUNTER) { std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc index 5264b141a..72bdc2639 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -47,15 +47,6 @@ #include "control_message_factory.h" -/*! - * \todo Include in definition header file - */ -#define CN0_ESTIMATION_SAMPLES 20 -#define MINIMUM_VALID_CN0 25 -#define MAXIMUM_LOCK_FAIL_COUNTER 50 -#define CARRIER_LOCK_THRESHOLD 0.85 - - using google::LogMessage; gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr @@ -177,11 +168,11 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[CN0_ESTIMATION_SAMPLES]; + d_Prompt_buffer = new gr_complex[GPS_L1_CA_CN0_ESTIMATION_SAMPLES]; d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD; + d_carrier_lock_threshold = GPS_L1_CA_CARRIER_LOCK_THRESHOLD; systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); @@ -740,7 +731,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ####################################### - if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) + if (d_cn0_estimation_counter < GPS_L1_CA_CN0_ESTIMATION_SAMPLES) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt @@ -750,11 +741,11 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri { d_cn0_estimation_counter = 0; // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, GPS_L1_CA_CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, GPS_L1_CA_CN0_ESTIMATION_SAMPLES); // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < GPS_L1_CA_MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } @@ -762,7 +753,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > GPS_L1_CA_MAXIMUM_LOCK_FAIL_COUNTER) { std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index d3cbb6310..3bc3d0f9f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -51,15 +51,6 @@ #include "control_message_factory.h" -/*! - * \todo Include in definition header file - */ -#define CN0_ESTIMATION_SAMPLES 20 -#define MINIMUM_VALID_CN0 25 -#define MAXIMUM_LOCK_FAIL_COUNTER 50 -#define CARRIER_LOCK_THRESHOLD 0.85 - - using google::LogMessage; gps_l1_ca_dll_pll_tracking_cc_sptr @@ -159,11 +150,11 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[CN0_ESTIMATION_SAMPLES]; + d_Prompt_buffer = new gr_complex[GPS_L1_CA_CN0_ESTIMATION_SAMPLES]; d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD; + d_carrier_lock_threshold = GPS_L1_CA_CARRIER_LOCK_THRESHOLD; systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); @@ -558,9 +549,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__ current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.fs = d_fs_in; current_synchro_data.correlation_length_ms = 1; - *out[0] = current_synchro_data; consume_each(samples_offset); // shift input to perform alignment with local replica - return 1; + return 0; } // ################# CARRIER WIPEOFF AND CORRELATORS ############################## @@ -619,7 +609,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__ d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) + if (d_cn0_estimation_counter < GPS_L1_CA_CN0_ESTIMATION_SAMPLES) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt @@ -629,11 +619,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__ { d_cn0_estimation_counter = 0; // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, GPS_L1_CA_CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, GPS_L1_CA_CN0_ESTIMATION_SAMPLES); // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < GPS_L1_CA_MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } @@ -641,7 +631,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__ { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > GPS_L1_CA_MAXIMUM_LOCK_FAIL_COUNTER) { std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; @@ -739,12 +729,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__ consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; // count for the processed samples - if (d_enable_tracking) - { - return 1; - }else{ - return 0; - } + if(current_synchro_data.Flag_valid_symbol_output) { return 1; } + else { return 0; } } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc index 0d9467eae..2a28283f4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc @@ -50,16 +50,6 @@ #include "GPS_L2C.h" #include "control_message_factory.h" - -/*! - * \todo Include in definition header file - */ -#define GPS_L2M_CN0_ESTIMATION_SAMPLES 10 -#define GPS_L2M_MINIMUM_VALID_CN0 25 -#define GPS_L2M_MAXIMUM_LOCK_FAIL_COUNTER 50 -#define GPS_L2M_CARRIER_LOCK_THRESHOLD 0.75 - - using google::LogMessage; gps_l2_m_dll_pll_tracking_cc_sptr diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l5i_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l5i_dll_pll_tracking_cc.cc index ba174dbea..c7205f6bf 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l5i_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l5i_dll_pll_tracking_cc.cc @@ -50,16 +50,6 @@ #include "GPS_L5.h" #include "control_message_factory.h" - -/*! - * \todo Include in definition header file - */ -#define GPS_L2M_CN0_ESTIMATION_SAMPLES 10 -#define GPS_L2M_MINIMUM_VALID_CN0 25 -#define GPS_L2M_MAXIMUM_LOCK_FAIL_COUNTER 50 -#define GPS_L2M_CARRIER_LOCK_THRESHOLD 0.75 - - using google::LogMessage; gps_l5i_dll_pll_tracking_cc_sptr @@ -160,11 +150,11 @@ gps_l5i_dll_pll_tracking_cc::gps_l5i_dll_pll_tracking_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[GPS_L2M_CN0_ESTIMATION_SAMPLES]; + d_Prompt_buffer = new gr_complex[GPS_L5_CN0_ESTIMATION_SAMPLES]; d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = GPS_L2M_CARRIER_LOCK_THRESHOLD; + d_carrier_lock_threshold = GPS_L5_CARRIER_LOCK_THRESHOLD; systemName["G"] = std::string("GPS"); @@ -554,10 +544,9 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.fs = d_fs_in; - current_synchro_data.correlation_length_ms = 20; - *out[0] = current_synchro_data; + current_synchro_data.correlation_length_ms = 1; consume_each(samples_offset); // shift input to perform alignment with local replica - return 1; + return 0; } // ################# CARRIER WIPEOFF AND CORRELATORS ############################## @@ -587,7 +576,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( code_error_filt_chips = d_code_loop_filter.get_code_nco(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_L5i_CODE_LENGTH_CHIPS; - double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips*T_chip_seconds); //[seconds] + double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips * T_chip_seconds); //[seconds] //double code_error_filt_secs = (GPS_L5i_PERIOD * code_error_filt_chips) / GPS_L5i_CODE_RATE_HZ; //[seconds] // ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT ####################### @@ -614,7 +603,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < GPS_L2M_CN0_ESTIMATION_SAMPLES) + if (d_cn0_estimation_counter < GPS_L5_CN0_ESTIMATION_SAMPLES) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; @@ -624,11 +613,11 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( { d_cn0_estimation_counter = 0; // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, GPS_L2M_CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L5i_CODE_LENGTH_CHIPS); + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, GPS_L5_CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L5i_CODE_LENGTH_CHIPS); // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, GPS_L2M_CN0_ESTIMATION_SAMPLES); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, GPS_L5_CN0_ESTIMATION_SAMPLES); // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < GPS_L2M_MINIMUM_VALID_CN0) + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < GPS_L5_MINIMUM_VALID_CN0) { d_carrier_lock_fail_counter++; } @@ -636,7 +625,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } - if (d_carrier_lock_fail_counter > GPS_L2M_MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > GPS_L5_MAXIMUM_LOCK_FAIL_COUNTER) { std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; @@ -654,7 +643,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; current_synchro_data.Flag_valid_symbol_output = true; - current_synchro_data.correlation_length_ms = 20; + current_synchro_data.correlation_length_ms = 1; } else { @@ -663,7 +652,7 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( d_correlator_outs[n] = gr_complex(0,0); } current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; - current_synchro_data.correlation_length_ms = 20; + current_synchro_data.correlation_length_ms = 1; } //assign the GNURadio block output data current_synchro_data.fs = d_fs_in; @@ -729,14 +718,8 @@ int gps_l5i_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(( } consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; // count for the processed samples - if (d_enable_tracking) - { - return 1; - } - else - { - return 0; - } + if(current_synchro_data.Flag_valid_symbol_output) { return 1; } + else { return 0; } } diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 319d918e1..a2976fe46 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -37,6 +37,11 @@ #include "MATH_CONSTANTS.h" #include "gnss_frequencies.h" +#define GPS_L1_CA_CN0_ESTIMATION_SAMPLES 20 +#define GPS_L1_CA_MINIMUM_VALID_CN0 25 +#define GPS_L1_CA_MAXIMUM_LOCK_FAIL_COUNTER 50 +#define GPS_L1_CA_CARRIER_LOCK_THRESHOLD 0.85 + // Physical constants const double GPS_C_m_s = SPEED_OF_LIGHT; //!< The speed of light, [m/s] const double GPS_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] diff --git a/src/core/system_parameters/GPS_L2C.h b/src/core/system_parameters/GPS_L2C.h index 70a8e5ff3..584d1761d 100644 --- a/src/core/system_parameters/GPS_L2C.h +++ b/src/core/system_parameters/GPS_L2C.h @@ -39,11 +39,18 @@ #include "gnss_frequencies.h" #include "GPS_CNAV.h" + +#define GPS_L2M_CN0_ESTIMATION_SAMPLES 10 +#define GPS_L2M_MINIMUM_VALID_CN0 25 +#define GPS_L2M_MAXIMUM_LOCK_FAIL_COUNTER 50 +#define GPS_L2M_CARRIER_LOCK_THRESHOLD 0.75 + + // Physical constants -const double GPS_L2_C_m_s = 299792458.0; //!< The speed of light, [m/s] -const double GPS_L2_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] -const double GPS_L2_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E -const double GPS_L2_TWO_PI = 6.283185307179586;//!< 2Pi as defined in IS-GPS-200E +const double GPS_L2_C_m_s = 299792458.0; //!< The speed of light, [m/s] +const double GPS_L2_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] +const double GPS_L2_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E +const double GPS_L2_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200E const double GPS_L2_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s] const double GPS_L2_GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] const double GPS_L2_F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] diff --git a/src/core/system_parameters/GPS_L5.h b/src/core/system_parameters/GPS_L5.h index 1c6ceb8ff..31e5f5f98 100644 --- a/src/core/system_parameters/GPS_L5.h +++ b/src/core/system_parameters/GPS_L5.h @@ -37,6 +37,11 @@ #include "gnss_frequencies.h" #include "GPS_CNAV.h" +#define GPS_L5_CN0_ESTIMATION_SAMPLES 10 +#define GPS_L5_MINIMUM_VALID_CN0 25 +#define GPS_L5_MAXIMUM_LOCK_FAIL_COUNTER 50 +#define GPS_L5_CARRIER_LOCK_THRESHOLD 0.75 + // Physical constants const double GPS_L5_C_m_s = 299792458.0; //!< The speed of light, [m/s] const double GPS_L5_C_m_ms = 299792.4580; //!< The speed of light, [m/ms] @@ -56,8 +61,8 @@ const double GPS_L5i_PERIOD = 0.001; //!< GPS L5 code period [seconds] const double GPS_L5i_SYMBOL_PERIOD = 0.01; //!< GPS L5 symbol period [seconds] const double GPS_L5q_CODE_RATE_HZ = 10.23e6; //!< GPS L5i code rate [chips/s] -const int GPS_L5q_CODE_LENGTH_CHIPS = 10230; //!< GPS L5i code length [chips] -const double GPS_L5q_PERIOD = 0.001; //!< GPS L5 code period [seconds] +const int GPS_L5q_CODE_LENGTH_CHIPS = 10230; //!< GPS L5i code length [chips] +const double GPS_L5q_PERIOD = 0.001; //!< GPS L5 code period [seconds] const int GPS_L5_HISTORY_DEEP = 5; diff --git a/src/core/system_parameters/Galileo_E1.h b/src/core/system_parameters/Galileo_E1.h index be5704a6e..a2b3215dd 100644 --- a/src/core/system_parameters/Galileo_E1.h +++ b/src/core/system_parameters/Galileo_E1.h @@ -39,6 +39,11 @@ #include "MATH_CONSTANTS.h" #include "gnss_frequencies.h" +#define GALILEO_E1_CN0_ESTIMATION_SAMPLES 20 +#define GALILEO_E1_MINIMUM_VALID_CN0 25 +#define GALILEO_E1_MAXIMUM_LOCK_FAIL_COUNTER 50 +#define GALILEO_E1_CARRIER_LOCK_THRESHOLD 0.85 + // Physical constants const double GALILEO_PI = 3.1415926535898; //!< Pi as defined in GALILEO ICD const double GALILEO_TWO_PI = 6.283185307179600 ; //!< 2*Pi as defined in GALILEO ICD diff --git a/src/core/system_parameters/Galileo_E5a.h b/src/core/system_parameters/Galileo_E5a.h index 2a2f5a816..bf96cc62f 100644 --- a/src/core/system_parameters/Galileo_E5a.h +++ b/src/core/system_parameters/Galileo_E5a.h @@ -37,6 +37,11 @@ #include "MATH_CONSTANTS.h" #include "gnss_frequencies.h" +#define GALILEO_E5A_CN0_ESTIMATION_SAMPLES 20 +#define GALILEO_E5A_MINIMUM_VALID_CN0 25 +#define GALILEO_E5A_MAXIMUM_LOCK_FAIL_COUNTER 50 +#define GALILEO_E5A_CARRIER_LOCK_THRESHOLD 0.85 + // Carrier and code frequencies const double Galileo_E5a_FREQ_HZ = FREQ5; //!< Galileo E5a carrier frequency [Hz]