From b3764f6ed1f595d71531a227d86b3f0103186bb5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 28 Mar 2018 19:54:24 +0200 Subject: [PATCH] Make use of flags with default values instead of defines --- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 37 +++++++++---------- .../gnuradio_blocks/dll_pll_veml_tracking.h | 12 ++---- 2 files changed, 20 insertions(+), 29 deletions(-) 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 b7db0f811..c5ec7036a 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -1,8 +1,7 @@ /*! * \file dll_pll_veml_tracking.cc - * \brief Implementation of a code DLL + carrier PLL VEML (Very Early - * Minus Late) tracking block for Galileo E1 signals - * \author Luis Esteve, 2012. luis(at)epsilon-formacion.com + * \brief Implementation of a code DLL + carrier PLL tracking block. + * \author Antonio Ramos, 2018 antonioramosdet(at)gmail.com * * Code DLL + carrier PLL according to the algorithms described in: * [1] K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, @@ -11,7 +10,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -39,7 +38,6 @@ #include "lock_detectors.h" #include "control_message_factory.h" #include "MATH_CONSTANTS.h" - #include "Galileo_E1.h" #include "galileo_e1_signal_processing.h" #include "Galileo_E5a.h" @@ -50,17 +48,16 @@ #include "gps_l2c_signal.h" #include "GPS_L5.h" #include "gps_l5_signal.h" - +#include "gnss_sdr_flags.h" +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include - using google::LogMessage; @@ -378,11 +375,11 @@ dll_pll_veml_tracking::dll_pll_veml_tracking( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[DLL_PLL_CN0_ESTIMATION_SAMPLES]; + d_Prompt_buffer = new gr_complex[FLAGS_cn0_samples]; d_carrier_lock_test = 1.0; d_CN0_SNV_dB_Hz = 0.0; d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = DLL_PLL_CARRIER_LOCK_THRESHOLD; + d_carrier_lock_threshold = FLAGS_carrier_lock_th; clear_tracking_vars(); @@ -649,7 +646,7 @@ bool dll_pll_veml_tracking::acquire_secondary() bool dll_pll_veml_tracking::cn0_and_tracking_lock_status() { // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < DLL_PLL_CN0_ESTIMATION_SAMPLES) + if (d_cn0_estimation_counter < FLAGS_cn0_samples) { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_P_accu; @@ -660,11 +657,11 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status() { d_cn0_estimation_counter = 0; // Code lock indicator - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, DLL_PLL_CN0_ESTIMATION_SAMPLES, static_cast(d_fs_in), static_cast(d_code_length_chips)); + d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, FLAGS_cn0_samples, static_cast(d_fs_in), static_cast(d_code_length_chips)); // Carrier lock indicator - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, DLL_PLL_CN0_ESTIMATION_SAMPLES); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, FLAGS_cn0_samples); // Loss of lock detection - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < DLL_PLL_MINIMUM_VALID_CN0) + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) { d_carrier_lock_fail_counter++; } @@ -672,7 +669,7 @@ bool dll_pll_veml_tracking::cn0_and_tracking_lock_status() { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } - if (d_carrier_lock_fail_counter > DLL_PLL_MAXIMUM_LOCK_FAIL_COUNTER) + if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) { 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/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index 6d3ddef62..76d4c5fda 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -1,8 +1,7 @@ /*! * \file dll_pll_veml_tracking.h - * \brief Implementation of a code DLL + carrier PLL VEML (Very Early - * Minus Late) tracking block for Galileo E1 signals - * \author Luis Esteve, 2012. luis(at)epsilon-formacion.com + * \brief Implementation of a code DLL + carrier PLL tracking block. + * \author Antonio Ramos, 2018 antonioramosdet(at)gmail.com * * ------------------------------------------------------------------------- * @@ -32,18 +31,13 @@ #ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H #define GNSS_SDR_DLL_PLL_VEML_TRACKING_H -#define DLL_PLL_CN0_ESTIMATION_SAMPLES 20 -#define DLL_PLL_MINIMUM_VALID_CN0 25 -#define DLL_PLL_MAXIMUM_LOCK_FAIL_COUNTER 50 -#define DLL_PLL_CARRIER_LOCK_THRESHOLD 0.85 - #include "gnss_synchro.h" #include "tracking_2nd_DLL_filter.h" #include "tracking_2nd_PLL_filter.h" #include "cpu_multicorrelator_real_codes.h" +#include #include #include -#include class dll_pll_veml_tracking;