From fd42d414cb2fd2f5ab87b041507d22304bc9f887 Mon Sep 17 00:00:00 2001 From: Mathieu Favreau Date: Tue, 21 Apr 2026 19:57:26 +0000 Subject: [PATCH 1/6] Remove tracking adapters --- .../PVT/libs/signal_enabled_flags.h | 18 +- .../tracking/adapters/CMakeLists.txt | 30 +-- .../adapters/base_dll_pll_tracking.cc | 98 ------- .../adapters/beidou_b1i_dll_pll_tracking.cc | 92 ------- .../adapters/beidou_b1i_dll_pll_tracking.h | 64 ----- .../adapters/beidou_b3i_dll_pll_tracking.cc | 83 ------ .../adapters/beidou_b3i_dll_pll_tracking.h | 64 ----- .../adapters/dll_pll_tracking_adapter.cc | 247 ++++++++++++++++++ ..._tracking.h => dll_pll_tracking_adapter.h} | 61 ++--- .../galileo_e1_dll_pll_veml_tracking.cc | 87 ------ .../galileo_e1_dll_pll_veml_tracking.h | 64 ----- .../adapters/galileo_e5a_dll_pll_tracking.cc | 87 ------ .../adapters/galileo_e5a_dll_pll_tracking.h | 64 ----- .../adapters/galileo_e5b_dll_pll_tracking.cc | 87 ------ .../adapters/galileo_e5b_dll_pll_tracking.h | 65 ----- .../adapters/galileo_e6_dll_pll_tracking.cc | 83 ------ .../adapters/galileo_e6_dll_pll_tracking.h | 158 ----------- .../glonass_l1_ca_dll_pll_tracking.cc | 120 --------- .../adapters/glonass_l1_ca_dll_pll_tracking.h | 66 ----- .../glonass_l2_ca_dll_pll_tracking.cc | 120 --------- .../adapters/glonass_l2_ca_dll_pll_tracking.h | 65 ----- .../adapters/gps_l1_ca_dll_pll_tracking.cc | 116 -------- .../adapters/gps_l1_ca_dll_pll_tracking.h | 63 ----- .../adapters/gps_l2_m_dll_pll_tracking.cc | 84 ------ .../adapters/gps_l2_m_dll_pll_tracking.h | 63 ----- .../adapters/gps_l5_dll_pll_tracking.cc | 87 ------ .../adapters/gps_l5_dll_pll_tracking.h | 62 ----- .../adapters/qzss_l1_dll_pll_tracking.cc | 115 -------- .../adapters/qzss_l1_dll_pll_tracking.h | 62 ----- .../adapters/qzss_l5_dll_pll_tracking.cc | 87 ------ .../adapters/qzss_l5_dll_pll_tracking.h | 62 ----- src/core/receiver/gnss_block_factory.cc | 44 ++-- src/core/system_parameters/CMakeLists.txt | 1 + src/core/system_parameters/signal_flag.h | 41 +++ .../galileo_e1_dll_pll_veml_tracking_test.cc | 4 +- .../tracking/galileo_e5a_tracking_test.cc | 2 +- .../galileo_e5b_dll_pll_tracking_test.cc | 2 +- .../glonass_l1_ca_dll_pll_tracking_test.cc | 7 +- 38 files changed, 349 insertions(+), 2376 deletions(-) delete mode 100644 src/algorithms/tracking/adapters/base_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h create mode 100644 src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc rename src/algorithms/tracking/adapters/{base_dll_pll_tracking.h => dll_pll_tracking_adapter.h} (61%) delete mode 100644 src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h delete mode 100644 src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.h delete mode 100644 src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.cc delete mode 100644 src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.h create mode 100644 src/core/system_parameters/signal_flag.h diff --git a/src/algorithms/PVT/libs/signal_enabled_flags.h b/src/algorithms/PVT/libs/signal_enabled_flags.h index 5092eb620..43e1c6d01 100644 --- a/src/algorithms/PVT/libs/signal_enabled_flags.h +++ b/src/algorithms/PVT/libs/signal_enabled_flags.h @@ -17,27 +17,11 @@ #ifndef GNSS_SDR_SIGNAL_ENABLED_FLAGS_H #define GNSS_SDR_SIGNAL_ENABLED_FLAGS_H +#include "signal_flag.h" #include class ConfigurationInterface; -enum signal_flag : uint32_t -{ - GPS_1C = 0x1 << 0, - GPS_2S = 0x1 << 1, - GPS_L5 = 0x1 << 2, - GAL_1B = 0x1 << 3, - GAL_E5a = 0x1 << 4, - GAL_E5b = 0x1 << 5, - GAL_E6 = 0x1 << 6, - GLO_1G = 0x1 << 7, - GLO_2G = 0x1 << 8, - BDS_B1 = 0x1 << 9, - BDS_B3 = 0x1 << 10, - QZS_J1 = 0x1 << 11, - QZS_J5 = 0x1 << 12 -}; - class Signal_Enabled_Flags { public: diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index 4806fdbd1..5a4f493d2 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -37,46 +37,20 @@ if(ENABLE_FPGA) endif() set(TRACKING_ADAPTER_SOURCES - base_dll_pll_tracking.cc - beidou_b1i_dll_pll_tracking.cc - beidou_b3i_dll_pll_tracking.cc - galileo_e1_dll_pll_veml_tracking.cc - galileo_e5a_dll_pll_tracking.cc - galileo_e5b_dll_pll_tracking.cc - galileo_e6_dll_pll_tracking.cc - glonass_l1_ca_dll_pll_tracking.cc - glonass_l2_ca_dll_pll_tracking.cc - gps_l1_ca_dll_pll_tracking.cc - gps_l2_m_dll_pll_tracking.cc - gps_l5_dll_pll_tracking.cc + dll_pll_tracking_adapter.cc galileo_e1_tcp_connector_tracking.cc gps_l1_ca_tcp_connector_tracking.cc gps_l1_ca_gaussian_tracking.cc gps_l1_ca_kf_tracking.cc - qzss_l1_dll_pll_tracking.cc - qzss_l5_dll_pll_tracking.cc ${OPT_TRACKING_ADAPTERS_SOURCES} ) set(TRACKING_ADAPTER_HEADERS - base_dll_pll_tracking.h - beidou_b1i_dll_pll_tracking.h - beidou_b3i_dll_pll_tracking.h - galileo_e1_dll_pll_veml_tracking.h - galileo_e5a_dll_pll_tracking.h - galileo_e5b_dll_pll_tracking.h - galileo_e6_dll_pll_tracking.h - glonass_l1_ca_dll_pll_tracking.h - glonass_l2_ca_dll_pll_tracking.h - gps_l1_ca_dll_pll_tracking.h - gps_l2_m_dll_pll_tracking.h - gps_l5_dll_pll_tracking.h + dll_pll_tracking_adapter.h galileo_e1_tcp_connector_tracking.h gps_l1_ca_tcp_connector_tracking.h gps_l1_ca_gaussian_tracking.h gps_l1_ca_kf_tracking.h - qzss_l1_dll_pll_tracking.h - qzss_l5_dll_pll_tracking.h ${OPT_TRACKING_ADAPTERS_HEADERS} ) diff --git a/src/algorithms/tracking/adapters/base_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/base_dll_pll_tracking.cc deleted file mode 100644 index 957d3b968..000000000 --- a/src/algorithms/tracking/adapters/base_dll_pll_tracking.cc +++ /dev/null @@ -1,98 +0,0 @@ -/*! - * \file base_dll_pll_tracking.cc - * \brief Base class providing shared logic for DLL+PLL VEML tracking adapters. - * \authors Carles Fernandez, 2025. carles.fernandez(at)cttc.cat - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "base_dll_pll_tracking.h" -#include "configuration_interface.h" - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -BaseDllPllTracking::BaseDllPllTracking( - const ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams) - : role_(std::move(role)), - item_size_(sizeof(gr_complex)) -{ - trk_params_.SetFromConfiguration(configuration, role_); - - if (in_streams > 1) - { - LOG(ERROR) << "Only one input stream is supported."; - } - if (out_streams > 1) - { - LOG(ERROR) << "Only one output stream is supported."; - } - - DLOG(INFO) << "role " << role_; -} - - -void BaseDllPllTracking::connect(gr::top_block_sptr top_block) -{ - if (top_block) - { /* no connection needed */ - } -} - - -void BaseDllPllTracking::disconnect(gr::top_block_sptr top_block) -{ - if (top_block) - { /* no disconnection needed */ - } -} - - -gr::basic_block_sptr BaseDllPllTracking::get_left_block() -{ - return tracking_sptr_; -} - - -gr::basic_block_sptr BaseDllPllTracking::get_right_block() -{ - return tracking_sptr_; -} - - -void BaseDllPllTracking::set_channel(unsigned int channel) -{ - tracking_sptr_->set_channel(channel); -} - - -void BaseDllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) -{ - tracking_sptr_->set_gnss_synchro(p_gnss_synchro); -} - - -void BaseDllPllTracking::start_tracking() -{ - tracking_sptr_->start_tracking(); -} - - -void BaseDllPllTracking::stop_tracking() -{ - tracking_sptr_->stop_tracking(); -} diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc deleted file mode 100644 index 5516f6228..000000000 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * \file beidou_b1i_dll_pll_tracking.cc - * \brief Implementation of an adapter of a DLL+PLL tracking loop block - * for Beidou B1I to a TrackingInterface - * \author Sergi Segura, 2018. sergi.segura.munoz@gmail.com - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "beidou_b1i_dll_pll_tracking.h" -#include "Beidou_B1I.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void BeidouB1iDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration) -{ - const auto vector_length = static_cast(std::round(config_params().fs_in / (BEIDOU_B1I_CODE_RATE_CPS / BEIDOU_B1I_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - config_params().system = 'C'; - const std::array sig{'B', '1', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: BEIDOU B1I. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (config_params().extend_correlation_symbols > 20) - { - config_params().extend_correlation_symbols = 20; - std::cout << TEXT_RED << "WARNING: BEIDOU B1I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; - } - config_params().track_pilot = configuration->property(role() + ".track_pilot", false); - if (config_params().track_pilot) - { - std::cout << TEXT_RED << "WARNING: BEIDOU B1I does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << '\n'; - config_params().track_pilot = false; - } - if ((config_params().extend_correlation_symbols > 1) && (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: BEIDOU B1I. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } -} - - -void BeidouB1iDllPllTracking::create_tracking_block() -{ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h deleted file mode 100644 index fb94898a6..000000000 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.h +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * \file beidou_b1i_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for Beidou B1I to a TrackingInterface - * \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_BEIDOU_B1I_DLL_PLL_TRACKING_H -#define GNSS_SDR_BEIDOU_B1I_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -class ConfigurationInterface; - -/*! - * \brief This class Adapts a DLL+PLL VEML (Very Early Minus Late) tracking - * loop block to a TrackingInterface for BeiDou B1I signals - */ -class BeidouB1iDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - BeidouB1iDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "BEIDOU_B1I_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "BEIDOU_B1I_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_BEIDOU_B1I_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc deleted file mode 100644 index 4d75667d4..000000000 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ /dev/null @@ -1,83 +0,0 @@ -/*! - * \file beidou_b3i_dll_pll_tracking.cc - * \brief Implementation of an adapter of a DLL+PLL tracking loop block - * for Beidou B3I to a TrackingInterface - * \author Damian Miralles, 2019. dmiralles2009(at)gmail.com - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "beidou_b3i_dll_pll_tracking.h" -#include "Beidou_B3I.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void BeidouB3iDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration) -{ - const auto vector_length = static_cast(std::round(static_cast(config_params().fs_in) / (BEIDOU_B3I_CODE_RATE_CPS / BEIDOU_B3I_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - config_params().system = 'C'; - const std::array sig{'B', '3', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - config_params().track_pilot = configuration->property(role() + ".track_pilot", false); - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (config_params().extend_correlation_symbols > 20) - { - config_params().extend_correlation_symbols = 20; - std::cout << TEXT_RED << "WARNING: BEIDOU B3I. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; - } -} - - -void BeidouB3iDllPllTracking::create_tracking_block() -{ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h deleted file mode 100644 index 0e087e2f5..000000000 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.h +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * \file beidou_b3i_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for Beidou B3I to a TrackingInterface - * \author Damian Miralles, 2019. dmiralles2009(at)gmail.com - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_BEIDOU_B3I_DLL_PLL_TRACKING_H -#define GNSS_SDR_BEIDOU_B3I_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -class ConfigurationInterface; - -/*! - * \brief This class Adapts a DLL+PLL VEML (Very Early Minus Late) tracking - * loop block to a TrackingInterface for BeiDou B3I signals - */ -class BeidouB3iDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - BeidouB3iDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "BEIDOU_B3I_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "BEIDOU_B3I_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_BEIDOU_B3I_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc b/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc new file mode 100644 index 000000000..1f897ce4c --- /dev/null +++ b/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc @@ -0,0 +1,247 @@ +/*! + * \file dll_pll_tracking_adapter.cc + * \brief Base class providing shared logic for DLL+PLL VEML tracking adapters. + * \authors Carles Fernandez, 2025. carles.fernandez(at)cttc.cat + * Mathieu Favreau, 2026. favreau.mathieu(at)hotmail.com + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "dll_pll_tracking_adapter.h" +#include "Beidou_B1I.h" +#include "Beidou_B3I.h" +#include "GLONASS_L1_L2_CA.h" +#include "GPS_L1_CA.h" +#include "GPS_L2C.h" +#include "GPS_L5.h" +#include "Galileo_E1.h" +#include "Galileo_E5a.h" +#include "Galileo_E5b.h" +#include "Galileo_E6.h" +#include "configuration_interface.h" +#include "display.h" +#include "qzss.h" + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +namespace +{ + +struct signal_info +{ + char system; + std::array sig; + std::string sig_name; + double code_chip_rate; + double code_length_chips; + int32_t max_extend_correlation_symbols; + bool has_pilot; + bool disable_track_pilot; +}; + +signal_info get_signal_info(signal_flag sig_flag) +{ + switch (sig_flag) + { + case GPS_1C: + return {'G', {'1', 'C', '\0'}, "GPS L1 C/A", GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_CODE_LENGTH_CHIPS, 20, false, true}; + case GPS_2S: + return {'G', {'2', 'S', '\0'}, "GPS L2", GPS_L2_M_CODE_RATE_CPS, GPS_L2_M_CODE_LENGTH_CHIPS, 1, false, true}; + case GPS_L5: + return {'G', {'L', '5', '\0'}, "GPS L5", GPS_L5I_CODE_RATE_CPS, GPS_L5I_CODE_LENGTH_CHIPS, GPS_L5I_NH_CODE_LENGTH, true, false}; + case GAL_1B: + return {'E', {'1', 'B', '\0'}, "Galileo E1", GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS, 1, true, false}; + case GAL_E5a: + return {'E', {'5', 'X', '\0'}, "Galileo E5a", GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS, GALILEO_E5A_I_SECONDARY_CODE_LENGTH, true, false}; + case GAL_E5b: + return {'E', {'7', 'X', '\0'}, "Galileo E5b", GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS, GALILEO_E5B_I_SECONDARY_CODE_LENGTH, true, false}; + case GAL_E6: + return {'E', {'E', '6', '\0'}, "Galileo E6", GALILEO_E6_B_CODE_CHIP_RATE_CPS, GALILEO_E6_B_CODE_LENGTH_CHIPS, 1, true, false}; + case GLO_1G: + return {'R', {'1', 'G', '\0'}, "Glonass L1", GLONASS_L1_CA_CODE_RATE_CPS, GLONASS_L1_CA_CODE_LENGTH_CHIPS, 10, false, true}; + case GLO_2G: + return {'R', {'2', 'G', '\0'}, "Glonass L2", GLONASS_L2_CA_CODE_RATE_CPS, GLONASS_L2_CA_CODE_LENGTH_CHIPS, 10, false, true}; + case BDS_B1: + return {'C', {'B', '1', '\0'}, "BEIDOU B1I", BEIDOU_B1I_CODE_RATE_CPS, BEIDOU_B1I_CODE_LENGTH_CHIPS, 20, false, true}; + case BDS_B3: + return {'C', {'B', '3', '\0'}, "BEIDOU B3I", BEIDOU_B3I_CODE_RATE_CPS, BEIDOU_B3I_CODE_LENGTH_CHIPS, 20, false, false}; // Does false, false make sense? + case QZS_J1: + return {'J', {'J', '1', '\0'}, "QZSS L1 C/A", QZSS_L1_CHIP_RATE, QZSS_L1_CODE_LENGTH, 20, false, true}; + case QZS_J5: + return {'J', {'J', '5', '\0'}, "QZSS L5", QZSS_L5_CHIP_RATE, QZSS_L5_CODE_LENGTH, QZSS_L5I_NH_CODE_LENGTH, true, false}; + default: + LOG(ERROR) << "Invalid signal in DLL PLL Tracking Adapter."; + } + + return {}; +} + +void check_and_configure_trk_params(const ConfigurationInterface* configuration, const std::string& role, const signal_info& sig_info, Dll_Pll_Conf& trk_params) +{ + trk_params.SetFromConfiguration(configuration, role); + trk_params.vector_length = static_cast(std::round(trk_params.fs_in / (sig_info.code_chip_rate / sig_info.code_length_chips))); + trk_params.system = sig_info.system; + std::copy_n(sig_info.sig.data(), 3, trk_params.signal); + trk_params.track_pilot = configuration->property(role + ".track_pilot", sig_info.has_pilot); + + const bool track_data = !sig_info.has_pilot || !trk_params.track_pilot; + + if (trk_params.extend_correlation_symbols < 1) + { + trk_params.extend_correlation_symbols = 1; + std::cout << TEXT_RED << "WARNING: " << sig_info.sig_name << ": extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol"; + } + else if (track_data && trk_params.extend_correlation_symbols > sig_info.max_extend_correlation_symbols) + { + trk_params.extend_correlation_symbols = sig_info.max_extend_correlation_symbols; + std::cout << TEXT_RED << "WARNING: " << sig_info.sig_name; + + if (sig_info.max_extend_correlation_symbols == 1) + { + if (sig_info.has_pilot) + { + std::cout << ": extended coherent integration is not allowed when tracking the data component. Coherent integration has been set to 1 symbol"; + } + else + { + std::cout << ": extended coherent integration is not allowed. Coherent integration has been set to 1 symbol"; + } + } + else + { + if (sig_info.has_pilot) + { + std::cout << ": extend_correlation_symbols limited to " << sig_info.max_extend_correlation_symbols + << " symbols when tracking the data component. Coherent integration has been set to " << sig_info.max_extend_correlation_symbols << " symbols"; + } + else + { + std::cout << ": extend_correlation_symbols limited to " << sig_info.max_extend_correlation_symbols + << " symbols. Coherent integration has been set to " << sig_info.max_extend_correlation_symbols << " symbols"; + } + } + + std::cout << TEXT_RESET << '\n'; + } + + if (sig_info.disable_track_pilot && trk_params.track_pilot) + { + std::cout << TEXT_RED << "WARNING: " << sig_info.sig_name << " does not have pilot signal. Data tracking has been enabled instead" << TEXT_RESET << '\n'; + trk_params.track_pilot = false; + } + + if ((trk_params.extend_correlation_symbols > 1) && (trk_params.pll_bw_narrow_hz > trk_params.pll_bw_hz || trk_params.dll_bw_narrow_hz > trk_params.dll_bw_hz)) + { + std::cout << TEXT_RED << "WARNING: " << sig_info.sig_name << ". PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; + } +} + +} // namespace + +DllPllTrackingAdapter::DllPllTrackingAdapter( + const ConfigurationInterface* configuration, + std::string role, + std::string implementation, + unsigned int in_streams, + unsigned int out_streams, + signal_flag sig_flag) + : role_(std::move(role)), + implementation_(std::move(implementation)), + item_size_(sizeof(gr_complex)) +{ + DLOG(INFO) << "role " << role_; + + const auto sig_info = get_signal_info(sig_flag); + + if (!sig_info.sig_name.empty()) + { + check_and_configure_trk_params(configuration, role_, sig_info, trk_params_); + } + else + { + item_size_ = 0; + } + + if (trk_params_.item_type == "gr_complex") + { + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params_); + DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; + } + else + { + item_size_ = 0; + LOG(WARNING) << trk_params_.item_type << " unknown tracking item type."; + } + + if (in_streams > 1) + { + LOG(ERROR) << "Only one input stream is supported."; + } + if (out_streams > 1) + { + LOG(ERROR) << "Only one output stream is supported."; + } +} + + +void DllPllTrackingAdapter::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* no connection needed */ + } +} + + +void DllPllTrackingAdapter::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* no disconnection needed */ + } +} + + +gr::basic_block_sptr DllPllTrackingAdapter::get_left_block() +{ + return tracking_sptr_; +} + + +gr::basic_block_sptr DllPllTrackingAdapter::get_right_block() +{ + return tracking_sptr_; +} + + +void DllPllTrackingAdapter::set_channel(unsigned int channel) +{ + tracking_sptr_->set_channel(channel); +} + + +void DllPllTrackingAdapter::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) +{ + tracking_sptr_->set_gnss_synchro(p_gnss_synchro); +} + + +void DllPllTrackingAdapter::start_tracking() +{ + tracking_sptr_->start_tracking(); +} + + +void DllPllTrackingAdapter::stop_tracking() +{ + tracking_sptr_->stop_tracking(); +} diff --git a/src/algorithms/tracking/adapters/base_dll_pll_tracking.h b/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.h similarity index 61% rename from src/algorithms/tracking/adapters/base_dll_pll_tracking.h rename to src/algorithms/tracking/adapters/dll_pll_tracking_adapter.h index a3c277a18..0a3018fd4 100644 --- a/src/algorithms/tracking/adapters/base_dll_pll_tracking.h +++ b/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.h @@ -1,5 +1,5 @@ /*! - * \file base_dll_pll_tracking.h + * \file dll_pll_tracking_adapter.h * \brief Base class providing shared logic for DLL+PLL VEML tracking adapters. * \authors Carles Fernandez, 2025. carles.fernandez(at)cttc.cat * @@ -14,11 +14,12 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_BASE_DLL_PLL_TRACKING_H -#define GNSS_SDR_BASE_DLL_PLL_TRACKING_H +#ifndef GNSS_SDR_DLL_PLL_TRACKING_ADAPTER_H +#define GNSS_SDR_DLL_PLL_TRACKING_ADAPTER_H #include "dll_pll_conf.h" #include "dll_pll_veml_tracking.h" +#include "signal_flag.h" #include "tracking_interface.h" #include #include @@ -36,91 +37,91 @@ class ConfigurationInterface; * \brief Base class providing shared logic for DLL+PLL tracking loop adapters * for GNSS signals. */ -class BaseDllPllTracking : public TrackingInterface +class DllPllTrackingAdapter : public TrackingInterface { public: /*! * \brief Base constructor of a Tracking block adapter */ - explicit BaseDllPllTracking(const ConfigurationInterface* configuration, + explicit DllPllTrackingAdapter(const ConfigurationInterface* configuration, std::string role, + std::string implementation, unsigned int in_streams, - unsigned int out_streams); + unsigned int out_streams, + signal_flag sig_flag); /*! * \brief Default destructor of the Tracking block adapter */ - ~BaseDllPllTracking() override = default; + ~DllPllTrackingAdapter() override = default; /*! * \brief Get role from the Tracking block adapter */ - inline std::string role() override final { return role_; } + inline std::string role() override { return role_; } + + /*! + * \brief Get implementation from the Tracking block adapter + */ + inline std::string implementation() override { return implementation_; } /*! * \brief Get item_size from the Tracking block adapter */ - inline size_t item_size() override final { return item_size_; } + inline size_t item_size() override + { + return item_size_; + } /*! * \brief Connect the Tracking block adapter */ - void connect(gr::top_block_sptr top_block) override final; + void connect(gr::top_block_sptr top_block) override; /*! * \brief Disconnect the sTracking block adapter */ - void disconnect(gr::top_block_sptr top_block) override final; + void disconnect(gr::top_block_sptr top_block) override; /*! * \brief Get left block from the Tracking block adapter */ - gr::basic_block_sptr get_left_block() override final; + gr::basic_block_sptr get_left_block() override; /*! * \brief Get right block from the Tracking block adapter */ - gr::basic_block_sptr get_right_block() override final; + gr::basic_block_sptr get_right_block() override; /*! * \brief Set tracking channel unique ID */ - void set_channel(unsigned int channel) override final; + void set_channel(unsigned int channel) override; /*! * \brief Set acquisition Gnss_Synchro object pointer * to exchange synchronization data between acquisition and tracking blocks */ - void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override final; + void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override; /*! * \brief Start the Tracking block */ - void start_tracking() override final; + void start_tracking() override; /*! * \brief Stop the Tracking block */ - void stop_tracking() override final; - -protected: - // Can be used by each derived class - inline Dll_Pll_Conf& config_params() { return trk_params_; } - inline const Dll_Pll_Conf& config_params() const { return trk_params_; } - inline void set_item_size(size_t item_size) { item_size_ = item_size; } - - // Must be implemented / filled by each derived class - virtual void configure_tracking_parameters(const ConfigurationInterface* configuration) = 0; - virtual void create_tracking_block() = 0; - dll_pll_veml_tracking_sptr tracking_sptr_; + void stop_tracking() override; private: - // Managed by the base class + dll_pll_veml_tracking_sptr tracking_sptr_; Dll_Pll_Conf trk_params_; const std::string role_; + const std::string implementation_; size_t item_size_; }; /** \} */ /** \} */ -#endif // GNSS_SDR_BASE_DLL_PLL_TRACKING_H +#endif // GNSS_SDR_DLL_PLL_TRACKING_ADAPTER_H diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc deleted file mode 100644 index 6c417b4bb..000000000 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * \file galileo_e1_dll_pll_veml_tracking.cc - * \brief Adapts a DLL+PLL VEML (Very Early Minus Late) tracking loop block - * to a TrackingInterface for Galileo E1 signals - * \author Luis Esteve, 2012. luis(at)epsilon-formacion.com - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "galileo_e1_dll_pll_veml_tracking.h" -#include "Galileo_E1.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GalileoE1DllPllVemlTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration [[maybe_unused]]) -{ - const auto vector_length = static_cast(std::round(config_params().fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - config_params().system = 'E'; - const std::array sig{'1', 'B', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Galileo E1. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (4 ms)" << TEXT_RESET << '\n'; - } - else if (!config_params().track_pilot && config_params().extend_correlation_symbols > 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Galileo E1. Extended coherent integration is not allowed when tracking the data component. Coherent integration has been set to 4 ms (1 symbol)" << TEXT_RESET << '\n'; - } - if ((config_params().extend_correlation_symbols > 1) and (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: Galileo E1. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } -} - - -void GalileoE1DllPllVemlTracking::create_tracking_block() -{ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h deleted file mode 100644 index 54cea7742..000000000 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * \file galileo_e1_dll_pll_veml_tracking.h - * \brief Adapts a DLL+PLL VEML (Very Early Minus Late) tracking loop block - * to a TrackingInterface for Galileo E1 signals - * \author Luis Esteve, 2012. luis(at)epsilon-formacion.com - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_H -#define GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -class ConfigurationInterface; - -/*! - * \brief This class Adapts a DLL+PLL VEML (Very Early Minus Late) tracking - * loop block to a TrackingInterface for Galileo E1 signals - */ -class GalileoE1DllPllVemlTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GalileoE1DllPllVemlTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "Galileo_E1_DLL_PLL_VEML_Tracking" - inline std::string implementation() override - { - return "Galileo_E1_DLL_PLL_VEML_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GALILEO_E1_DLL_PLL_VEML_TRACKING_H diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc deleted file mode 100644 index 8dd56cafb..000000000 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * \file galileo_e5a_dll_pll_tracking.cc - * \brief Adapts a code DLL + carrier PLL - * tracking block to a TrackingInterface for Galileo E5a signals - * \author Marc Sales, 2014. marcsales92(at)gmail.com - * \based on work from: - *
    - *
  • Javier Arribas, 2011. jarribas(at)cttc.es - *
  • Luis Esteve, 2012. luis(at)epsilon-formacion.com - *
- * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "galileo_e5a_dll_pll_tracking.h" -#include "Galileo_E5a.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - - -GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GalileoE5aDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration [[maybe_unused]]) -{ - const auto vector_length = static_cast(std::round(config_params().fs_in / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - config_params().system = 'E'; - const std::array sig{'5', 'X', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Galileo E5a. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (!config_params().track_pilot and config_params().extend_correlation_symbols > GALILEO_E5A_I_SECONDARY_CODE_LENGTH) - { - config_params().extend_correlation_symbols = GALILEO_E5A_I_SECONDARY_CODE_LENGTH; - std::cout << TEXT_RED << "WARNING: Galileo E5a. extend_correlation_symbols must be lower than 21 when tracking the data component. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << '\n'; - } - if ((config_params().extend_correlation_symbols > 1) and (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: Galileo E5a. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } -} - - -void GalileoE5aDllPllTracking::create_tracking_block() -{ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h deleted file mode 100644 index 6443a72e1..000000000 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * \file galileo_e5a_dll_pll_tracking.h - * \brief Adapts a code DLL + carrier PLL - * tracking block to a TrackingInterface for Galileo E5a signals - * \author Marc Sales, 2014. marcsales92(at)gmail.com - * \based on work from: - *
    - *
  • Javier Arribas, 2011. jarribas(at)cttc.es - *
  • Luis Esteve, 2012. luis(at)epsilon-formacion.com - *
- * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GALILEO_E5A_DLL_PLL_TRACKING_H -#define GNSS_SDR_GALILEO_E5A_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -class ConfigurationInterface; - -/*! - * \brief This class Adapts a DLL+PLL VEML (Very Early Minus Late) tracking - * loop block to a TrackingInterface for Galileo E5a signals - */ -class GalileoE5aDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GalileoE5aDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "Galileo_E5a_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "Galileo_E5a_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GALILEO_E5A_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc deleted file mode 100644 index 015064e4e..000000000 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * \file galileo_e5b_dll_pll_tracking.cc - * \brief Adapts a code DLL + carrier PLL - * tracking block to a TrackingInterface for Galileo E5b signals - * \author Piyush Gupta, 2020. piyush04111999@gmail.com - * \based on work from: - *
    - *
  • Javier Arribas, 2011. jarribas@cttc.es - *
  • Luis Esteve, 2012. luis@epsilon-formacion.com - *
  • Marc Sales, 2014. marcsales92@gmail.com - *
- * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "galileo_e5b_dll_pll_tracking.h" -#include "Galileo_E5b.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GalileoE5bDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration [[maybe_unused]]) -{ - const auto vector_length = static_cast(std::round(config_params().fs_in / (GALILEO_E5B_CODE_CHIP_RATE_CPS / GALILEO_E5B_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Galileo E5b. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (!config_params().track_pilot and config_params().extend_correlation_symbols > GALILEO_E5B_I_SECONDARY_CODE_LENGTH) - { - config_params().extend_correlation_symbols = GALILEO_E5B_I_SECONDARY_CODE_LENGTH; - std::cout << TEXT_RED << "WARNING: Galileo E5b. extend_correlation_symbols must be lower than 5 when tracking the data component. Coherent integration has been set to 4 symbols (4 ms)" << TEXT_RESET << '\n'; - } - if ((config_params().extend_correlation_symbols > 1) and (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: Galileo E5b. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } - config_params().system = 'E'; - const std::array sig{'7', 'X', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); -} - - -void GalileoE5bDllPllTracking::create_tracking_block() -{ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h deleted file mode 100644 index 2433e2294..000000000 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.h +++ /dev/null @@ -1,65 +0,0 @@ -/*! - * \file galileo_e5b_dll_pll_tracking.h - * \brief Adapts a code DLL + carrier PLL - * tracking block to a TrackingInterface for Galileo E5b signals - * \author Piyush Gupta, 2020. piyush04111999@gmail.com - * \based on work from: - *
    - *
  • Javier Arribas, 2011. jarribas@cttc.es - *
  • Luis Esteve, 2012. luis@epsilon-formacion.com - *
  • Marc Sales, 2014. marcsales92@gmail.com - *
- * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GALILEO_E5B_DLL_PLL_TRACKING_H -#define GNSS_SDR_GALILEO_E5B_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -class ConfigurationInterface; - -/*! - * \brief This class Adapts a DLL+PLL VEML (Very Early Minus Late) tracking - * loop block to a TrackingInterface for Galileo E5b signals - */ -class GalileoE5bDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GalileoE5bDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "Galileo_E5b_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "Galileo_E5b_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GALILEO_E5B_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc deleted file mode 100644 index 6324e36b9..000000000 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc +++ /dev/null @@ -1,83 +0,0 @@ -/*! - * \file galileo_e6_dll_pll_tracking.cc - * \brief Adapts a code DLL + carrier PLL - * tracking block to a TrackingInterface for Galileo E6 signals - * \author Carles Fernandez-Prades, 2020. cfernandez(at)cttc.es - * - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "galileo_e6_dll_pll_tracking.h" -#include "Galileo_E6.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - - -GalileoE6DllPllTracking::GalileoE6DllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GalileoE6DllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration [[maybe_unused]]) -{ - const auto vector_length = static_cast(std::round(config_params().fs_in / (GALILEO_E6_B_CODE_CHIP_RATE_CPS / GALILEO_E6_B_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - config_params().system = 'E'; - const std::array sig{'5', 'X', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Galileo E6. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (!config_params().track_pilot and config_params().extend_correlation_symbols > 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Galileo E6. Extended coherent integration is not allowed when tracking the data component. Coherent integration has been set to 1 ms (1 symbol)" << TEXT_RESET << '\n'; - } - if ((config_params().extend_correlation_symbols > 1) and (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: Galileo E5b. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } -} - - -void GalileoE6DllPllTracking::create_tracking_block() -{ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h deleted file mode 100644 index ed51a2cd6..000000000 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.h +++ /dev/null @@ -1,158 +0,0 @@ -/*! - * \file galileo_e6_dll_pll_tracking.h - * \brief Adapts a code DLL + carrier PLL - * tracking block to a TrackingInterface for Galileo E6 signals - * \author Carles Fernandez-Prades, 2020. cfernandez(at)cttc.es - * - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GALILEO_E6_DLL_PLL_TRACKING_H -#define GNSS_SDR_GALILEO_E6_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -class ConfigurationInterface; - -/*! - * \brief This class Adapts a DLL+PLL VEML (Very Early Minus Late) tracking - * loop block to a TrackingInterface for Galileo E5a signals - */ -class GalileoE6DllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GalileoE6DllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "Galileo_E6_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "Galileo_E6_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GALILEO_E6_DLL_PLL_TRACKING_H - -// // -// src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h - -// src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.h -// #include "dll_pll_veml_tracking.h" -// #include "tracking_interface.h" -// #include - -// /** \addtogroup Tracking -// * \{ */ -// /** \addtogroup Tracking_adapters -// * \{ */ - - -// class ConfigurationInterface; - -// /*! -// * \brief This class implements a code DLL + carrier PLL tracking loop -// */ -// class GalileoE6DllPllTracking : public TrackingInterface -// { -// public: -// GalileoE6DllPllTracking( -// const ConfigurationInterface* configuration, -// const std::string& role, -// unsigned int in_streams, -// unsigned int out_streams); - -// ~GalileoE6DllPllTracking() = default; - -// inline std::string role() override -// { -// return role_; -// } - -// //! Returns "Galileo_E6_DLL_PLL_Tracking" -// inline std::string implementation() override -// { -// return "Galileo_E6_DLL_PLL_Tracking"; -// } - -// inline size_t item_size() override -// { -// return item_size_; -// } - -// /*! -// * \brief Connect -// */ -// void connect(gr::top_block_sptr top_block) override; - -// /*! -// * \brief Disconnect -// */ -// void disconnect(gr::top_block_sptr top_block) override; - -// /*! -// * \brief Get left block -// */ -// gr::basic_block_sptr get_left_block() override; - -// /*! -// * \brief Get right block -// */ -// gr::basic_block_sptr get_right_block() override; - -// /*! -// * \brief Set tracking channel unique ID -// */ -// void set_channel(unsigned int channel) override; - -// /*! -// * \brief Set acquisition/tracking common Gnss_Synchro object pointer -// * to efficiently exchange synchronization data between acquisition and tracking blocks -// */ -// void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override; - -// void start_tracking() override; - -// /*! -// * \brief Stop running tracking -// */ -// void stop_tracking() override; - -// private: -// dll_pll_veml_tracking_sptr tracking_sptr_; -// std::string role_; -// size_t item_size_; -// unsigned int channel_; -// unsigned int in_streams_; -// unsigned int out_streams_; -// }; - - -// /** \} */ -// /** \} */ -// #endif // GNSS_SDR_GALILEO_E6_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc deleted file mode 100644 index 0e7e634c0..000000000 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ /dev/null @@ -1,120 +0,0 @@ -/*! - * \file glonass_l1_ca_dll_pll_tracking.cc - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for Glonass L1 C/A to a TrackingInterface - * \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com - * \author Luis Esteve, 2017. luis(at)epsilon-formacion.com - * \author Javier Arribas, 2025 javier.arribas(at)cttc.es - * \author Carles Fernandez-Prades, 2025 carles.fernandez(at)cttc.es - * - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - - -#include "glonass_l1_ca_dll_pll_tracking.h" -#include "GLONASS_L1_L2_CA.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GlonassL1CaDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration __attribute__((unused))) -{ - // Set basic signal identifiers - config_params().system = 'R'; - const std::array sig{'1', 'G', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - - const auto vector_length = static_cast(std::round(config_params().fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - - // Sanity checks and warnings - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED - << "WARNING: Glonass L1: extend_correlation_symbols must be > 0. " - << "Coherent integration set to 1 ms." - << TEXT_RESET << std::endl; - } - else if (config_params().extend_correlation_symbols > 10) - { - config_params().extend_correlation_symbols = 10; - std::cout << TEXT_RED - << "WARNING: Glonass L1: extend_correlation_symbols limited to 10 (10 ms)." - << TEXT_RESET << std::endl; - } - - // GPS L1 C/A does not have a pilot component - config_params().track_pilot = configuration->property(this->role() + ".track_pilot", false); - if (config_params().track_pilot) - { - config_params().track_pilot = false; - std::cout << TEXT_RED - << "WARNING: Glonass L1 does not have pilot signal. " - << "Data tracking enabled instead." - << TEXT_RESET << std::endl; - } - - // Ensure bandwidth sanity when narrow-band is enabled - if ((config_params().extend_correlation_symbols > 1) && - (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz || - config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED - << "WARNING: Glonass L1: Narrow tracking bandwidth is higher than wide bandwidth." - << TEXT_RESET << std::endl; - } -} - - -void GlonassL1CaDllPllTracking::create_tracking_block() -{ - // Create GNU Radio block - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h deleted file mode 100644 index 8241de478..000000000 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.h +++ /dev/null @@ -1,66 +0,0 @@ -/*! - * \file glonass_l1_ca_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for Glonass L1 C/A to a TrackingInterface - * \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com - * \author Luis Esteve, 2017. luis(at)epsilon-formacion.com - * \author Javier Arribas, 2025 javier.arribas(at)cttc.es - * \author Carles Fernandez-Prades, 2025 carles.fernandez(at)cttc.es - * - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_H -#define GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for GLONASS L1 signals - */ -class GlonassL1CaDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GlonassL1CaDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "GLONASS_L1_CA_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "GLONASS_L1_CA_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GLONASS_L1_DLL_PLL_TRACKING_H \ No newline at end of file diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc deleted file mode 100644 index 17ba9df6d..000000000 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ /dev/null @@ -1,120 +0,0 @@ -/*! - * \file glonass_l2_ca_dll_pll_tracking.cc - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for Glonass L2 C/A to a TrackingInterface - * \author Gabriel Araujo, 2017. gabriel.araujo.5000(at)gmail.com - * \author Luis Esteve, 2017. luis(at)epsilon-formacion.com - * \author Javier Arribas, 2025 javier.arribas(at)cttc.es - * \author Carles Fernandez-Prades, 2025 carles.fernandez(at)cttc.es - * - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - - -#include "glonass_l2_ca_dll_pll_tracking.h" -#include "GLONASS_L1_L2_CA.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GlonassL2CaDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration __attribute__((unused))) -{ - // Set basic signal identifiers - config_params().system = 'R'; - const std::array sig{'2', 'G', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - - const auto vector_length = static_cast(std::round(config_params().fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - - // Sanity checks and warnings - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED - << "WARNING: Glonass L2: extend_correlation_symbols must be > 0. " - << "Coherent integration set to 1 ms." - << TEXT_RESET << std::endl; - } - else if (config_params().extend_correlation_symbols > 10) - { - config_params().extend_correlation_symbols = 10; - std::cout << TEXT_RED - << "WARNING: Glonass L2: extend_correlation_symbols limited to 10 (10 ms)." - << TEXT_RESET << std::endl; - } - - // Glonass L2 C/A does not have a pilot component - config_params().track_pilot = configuration->property(this->role() + ".track_pilot", false); - if (config_params().track_pilot) - { - config_params().track_pilot = false; - std::cout << TEXT_RED - << "WARNING: Glonass L2 does not have pilot signal. " - << "Data tracking enabled instead." - << TEXT_RESET << std::endl; - } - - // Ensure bandwidth sanity when narrow-band is enabled - if ((config_params().extend_correlation_symbols > 1) && - (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz || - config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED - << "WARNING: Glonass L2: Narrow tracking bandwidth is higher than wide bandwidth." - << TEXT_RESET << std::endl; - } -} - - -void GlonassL2CaDllPllTracking::create_tracking_block() -{ - // Create GNU Radio block - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} \ No newline at end of file diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h deleted file mode 100644 index 9087a6e29..000000000 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.h +++ /dev/null @@ -1,65 +0,0 @@ -/*! - * \file glonass_l2_ca_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for Glonass L2 C/A to a TrackingInterface - * \author Damian Miralles, 2018, dmiralles2009(at)gmail.com - * \author Javier Arribas, 2025 javier.arribas(at)cttc.es - * \author Carles Fernandez-Prades, 2025 carles.fernandez(at)cttc.es - * - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_H -#define GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for GLONASS L2 signals - */ -class GlonassL2CaDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GlonassL2CaDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "GLONASS_L2_CA_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "GLONASS_L2_CA_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc deleted file mode 100644 index 578d9dc3f..000000000 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ /dev/null @@ -1,116 +0,0 @@ -/*! - * \file gps_l1_ca_dll_pll_tracking.cc - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for GPS L1 C/A to a TrackingInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * Javier Arribas, 2011. jarribas(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "gps_l1_ca_dll_pll_tracking.h" -#include "GPS_L1_CA.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GpsL1CaDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration __attribute__((unused))) -{ - // Set basic signal identifiers - config_params().system = 'G'; - const std::array sig{'1', 'C', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - - const auto vector_length = static_cast(std::round(config_params().fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); - config_params().vector_length = vector_length; - - // Sanity checks and warnings - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED - << "WARNING: GPS L1 C/A: extend_correlation_symbols must be > 0. " - << "Coherent integration set to 1 ms." - << TEXT_RESET << std::endl; - } - else if (config_params().extend_correlation_symbols > 20) - { - config_params().extend_correlation_symbols = 20; - std::cout << TEXT_RED - << "WARNING: GPS L1 C/A: extend_correlation_symbols limited to 20 (20 ms)." - << TEXT_RESET << std::endl; - } - - // GPS L1 C/A does not have a pilot component - config_params().track_pilot = configuration->property(this->role() + ".track_pilot", false); - if (config_params().track_pilot) - { - config_params().track_pilot = false; - std::cout << TEXT_RED - << "WARNING: GPS L1 C/A does not have pilot signal. " - << "Data tracking enabled instead." - << TEXT_RESET << std::endl; - } - - // Ensure bandwidth sanity when narrow-band is enabled - if ((config_params().extend_correlation_symbols > 1) && - (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz || - config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED - << "WARNING: GPS L1 C/A: Narrow tracking bandwidth is higher than wide bandwidth." - << TEXT_RESET << std::endl; - } -} - - -void GpsL1CaDllPllTracking::create_tracking_block() -{ - // Create GNU Radio block - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h deleted file mode 100644 index 482f697e0..000000000 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h +++ /dev/null @@ -1,63 +0,0 @@ -/*! - * \file gps_l1_ca_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for GPS L1 C/A to a TrackingInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * Javier Arribas, 2011. jarribas(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_H -#define GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for GPS L1 C/A signals - */ -class GpsL1CaDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GpsL1CaDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "GPS_L1_CA_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "GPS_L1_CA_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc deleted file mode 100644 index 38e706427..000000000 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ /dev/null @@ -1,84 +0,0 @@ -/*! - * \file gps_l2_m_dll_pll_tracking.cc - * \brief Implementation of an adapter of a DLL+PLL tracking loop block - * for GPS L2C(M) to a TrackingInterface - * \author Javier Arribas, 2015. jarribas(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "gps_l2_m_dll_pll_tracking.h" -#include "GPS_L2C.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GpsL2MDllPllTracking::GpsL2MDllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GpsL2MDllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration) -{ - const auto vector_length = static_cast(std::round(static_cast(config_params().fs_in) / (static_cast(GPS_L2_M_CODE_RATE_CPS) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS)))); - config_params().vector_length = vector_length; - if (config_params().extend_correlation_symbols != 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: Extended coherent integration is not allowed in GPS L2. Coherent integration has been set to 20 ms (1 symbol)" << TEXT_RESET << '\n'; - } - config_params().track_pilot = configuration->property(role() + ".track_pilot", false); - if (config_params().track_pilot) - { - config_params().track_pilot = false; - std::cout << TEXT_RED << "WARNING: GPS L2 does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << '\n'; - } - config_params().system = 'G'; - const std::array sig{'2', 'S', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); -} - - -void GpsL2MDllPllTracking::create_tracking_block() -{ - // ################# Make a GNU Radio Tracking block object ################ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h deleted file mode 100644 index 0b2eda166..000000000 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.h +++ /dev/null @@ -1,63 +0,0 @@ -/*! - * \file gps_l2_m_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for GPS L2C(M) to a TrackingInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * Javier Arribas, 2011. jarribas(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_H -#define GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for GPS L2C(M) signals - */ -class GpsL2MDllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GpsL2MDllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "GPS_L2_M_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "GPS_L2_M_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GPS_L2_M_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc deleted file mode 100644 index e9e98783c..000000000 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * \file gps_l5_dll_pll_tracking.cc - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for GPS L5 to a TrackingInterface - * \author Javier Arribas, 2017. jarribas(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "gps_l5_dll_pll_tracking.h" -#include "GPS_L5.h" -#include "configuration_interface.h" -#include "display.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GpsL5DllPllTracking::GpsL5DllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void GpsL5DllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration __attribute__((unused))) -{ - const auto vector_length = static_cast(std::round(static_cast(config_params().fs_in) / (static_cast(GPS_L5I_CODE_RATE_CPS) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS)))); - config_params().vector_length = vector_length; - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: GPS L5. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (!config_params().track_pilot and config_params().extend_correlation_symbols > GPS_L5I_NH_CODE_LENGTH) - { - config_params().extend_correlation_symbols = GPS_L5I_NH_CODE_LENGTH; - std::cout << TEXT_RED << "WARNING: GPS L5. extend_correlation_symbols must be lower than 11 when tracking the data component. Coherent integration has been set to 10 symbols (10 ms)" << TEXT_RESET << '\n'; - } - if ((config_params().extend_correlation_symbols > 1) and (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: GPS L5. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } - config_params().system = 'G'; - const std::array sig{'L', '5', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); -} - - -void GpsL5DllPllTracking::create_tracking_block() -{ - // ################# Make a GNU Radio Tracking block object ################ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h deleted file mode 100644 index 110fe4c1f..000000000 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.h +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * \file gps_l5_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for GPS L5 to a TrackingInterface - * \author Javier Arribas, 2017. jarribas(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GPS_L5_DLL_PLL_TRACKING_H -#define GNSS_SDR_GPS_L5_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for GPS L5 signals - */ -class GpsL5DllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - GpsL5DllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "GPS_L5_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "GPS_L5_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - -/** \} */ -/** \} */ -#endif // GNSS_SDR_GPS_L5_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.cc deleted file mode 100644 index a27fe9d4b..000000000 --- a/src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.cc +++ /dev/null @@ -1,115 +0,0 @@ -/*! - * \file qzss_l1_dll_pll_tracking.cc - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for QZSS L1 signals to a TrackingInterface - * \author Carles Fernandez, 2026. cfernandez(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "qzss_l1_dll_pll_tracking.h" -#include "configuration_interface.h" -#include "display.h" -#include "qzss.h" -#include -#include -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -QzssL1DllPllTracking::QzssL1DllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void QzssL1DllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration __attribute__((unused))) -{ - // Set basic signal identifiers - config_params().system = 'J'; - const std::array sig{'J', '1', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); - - const auto vector_length = static_cast(std::round(config_params().fs_in / (QZSS_L1_CHIP_RATE / QZSS_L1_CODE_LENGTH))); - config_params().vector_length = vector_length; - - // Sanity checks and warnings - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED - << "WARNING: QZSS L1 C/A: extend_correlation_symbols must be > 0. " - << "Coherent integration set to 1 ms." - << TEXT_RESET << std::endl; - } - else if (config_params().extend_correlation_symbols > 20) - { - config_params().extend_correlation_symbols = 20; - std::cout << TEXT_RED - << "WARNING: QZSS L1 C/A: extend_correlation_symbols limited to 20 (20 ms)." - << TEXT_RESET << std::endl; - } - - // QZSS L1 C/A does not have a pilot component - config_params().track_pilot = configuration->property(this->role() + ".track_pilot", false); - if (config_params().track_pilot) - { - config_params().track_pilot = false; - std::cout << TEXT_RED - << "WARNING: QZSS L1 C/A does not have pilot signal. " - << "Data tracking enabled instead." - << TEXT_RESET << std::endl; - } - - // Ensure bandwidth sanity when narrow-band is enabled - if ((config_params().extend_correlation_symbols > 1) && - (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz || - config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED - << "WARNING: QZSS L1 C/A: Narrow tracking bandwidth is higher than wide bandwidth." - << TEXT_RESET << std::endl; - } -} - - -void QzssL1DllPllTracking::create_tracking_block() -{ - // Create GNU Radio block - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.h b/src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.h deleted file mode 100644 index 6f3106f43..000000000 --- a/src/algorithms/tracking/adapters/qzss_l1_dll_pll_tracking.h +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * \file qzss_l1_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for QZSS L1 signals to a TrackingInterface - * \author Carles Fernandez, 2026. cfernandez(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_QZSS_L1_DLL_PLL_TRACKING_H -#define GNSS_SDR_QZSS_L1_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for QZSS L1 signals - */ -class QzssL1DllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - QzssL1DllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "QZSS_L1_CA_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "QZSS_L1_CA_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - -/** \} */ -/** \} */ -#endif // GNSS_SDR_QZSS_L1_CA_DLL_PLL_TRACKING_H diff --git a/src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.cc deleted file mode 100644 index 868268b61..000000000 --- a/src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * \file qzss_l5_dll_pll_tracking.cc - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for QZSS L5 signals to a TrackingInterface - * \author Carles Fernandez, 2026. cfernandez(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "qzss_l5_dll_pll_tracking.h" -#include "configuration_interface.h" -#include "display.h" -#include "qzss.h" -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -QzssL5DllPllTracking::QzssL5DllPllTracking( - const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams) - : BaseDllPllTracking(configuration, role, in_streams, out_streams) -{ - configure_tracking_parameters(configuration); - create_tracking_block(); -} - - -void QzssL5DllPllTracking::configure_tracking_parameters( - const ConfigurationInterface* configuration __attribute__((unused))) -{ - const auto vector_length = static_cast(std::round(static_cast(config_params().fs_in) / (static_cast(QZSS_L5_CHIP_RATE) / static_cast(QZSS_L5_CODE_LENGTH)))); - config_params().vector_length = vector_length; - if (config_params().extend_correlation_symbols < 1) - { - config_params().extend_correlation_symbols = 1; - std::cout << TEXT_RED << "WARNING: QZSS L5. extend_correlation_symbols must be bigger than 0. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << '\n'; - } - else if (!config_params().track_pilot and config_params().extend_correlation_symbols > QZSS_L5I_NH_CODE_LENGTH) - { - config_params().extend_correlation_symbols = QZSS_L5I_NH_CODE_LENGTH; - std::cout << TEXT_RED << "WARNING: QZSS L5. extend_correlation_symbols must be lower than 11 when tracking the data component. Coherent integration has been set to 10 symbols (10 ms)" << TEXT_RESET << '\n'; - } - if ((config_params().extend_correlation_symbols > 1) and (config_params().pll_bw_narrow_hz > config_params().pll_bw_hz or config_params().dll_bw_narrow_hz > config_params().dll_bw_hz)) - { - std::cout << TEXT_RED << "WARNING: QZSS L5. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << '\n'; - } - config_params().system = 'J'; - const std::array sig{'J', '5', '\0'}; - std::copy_n(sig.data(), 3, config_params().signal); -} - - -void QzssL5DllPllTracking::create_tracking_block() -{ - // ################# Make a GNU Radio Tracking block object ################ - if (config_params().item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(config_params()); - DLOG(INFO) << "tracking(" << tracking_sptr_->unique_id() << ")"; - } - else - { - set_item_size(0); - tracking_sptr_ = nullptr; - LOG(WARNING) << config_params().item_type << " unknown tracking item type."; - } -} diff --git a/src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.h b/src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.h deleted file mode 100644 index 4e56791e4..000000000 --- a/src/algorithms/tracking/adapters/qzss_l5_dll_pll_tracking.h +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * \file qzss_l5_dll_pll_tracking.h - * \brief Interface of an adapter of a DLL+PLL tracking loop block - * for QZSS L5 signals to a TrackingInterface - * \author Carles Fernandez, 2026. cfernandez(at)cttc.es - * - * Code DLL + carrier PLL according to the algorithms described in: - * K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen, - * A Software-Defined GPS and Galileo Receiver. A Single-Frequency - * Approach, Birkhauser, 2007 - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_QZSS_L5_DLL_PLL_TRACKING_H -#define GNSS_SDR_QZSS_L5_DLL_PLL_TRACKING_H - -#include "base_dll_pll_tracking.h" - -/** \addtogroup Tracking - * Classes for GNSS signal tracking. - * \{ */ -/** \addtogroup Tracking_adapters tracking_adapters - * Wrap GNU Radio blocks for GNSS signal tracking with a TrackingInterface - * \{ */ - - -/*! - * \brief This class implements a code DLL + carrier PLL tracking loop - * block adapter for QZSS L5 signals - */ -class QzssL5DllPllTracking : public BaseDllPllTracking -{ -public: - //! Constructor - QzssL5DllPllTracking(const ConfigurationInterface* configuration, - const std::string& role, - unsigned int in_streams, - unsigned int out_streams); - - //! Returns "QZSS_L5_DLL_PLL_Tracking" - inline std::string implementation() override - { - return "QZSS_L5_DLL_PLL_Tracking"; - } - -private: - void configure_tracking_parameters(const ConfigurationInterface* configuration) override; - void create_tracking_block() override; -}; - -/** \} */ -/** \} */ -#endif // GNSS_SDR_QZSS_L5_DLL_PLL_TRACKING_H diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 666c1953b..0b88166a5 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -6,6 +6,7 @@ * Javier Arribas, 2011. jarribas(at)cttc.es * Marc Majoral, 2018. mmajoral(at)cttc.es * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es + * Mathieu Favreau, 2025-2026. favreau.mathieu(at)hotmail.com * * This class encapsulates the complexity behind the instantiation * of GNSS blocks. @@ -16,7 +17,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -27,10 +28,8 @@ #include "acquisition_interface.h" #include "array_signal_conditioner.h" #include "beamformer_filter.h" -#include "beidou_b1i_dll_pll_tracking.h" #include "beidou_b1i_pcps_acquisition.h" #include "beidou_b1i_telemetry_decoder.h" -#include "beidou_b3i_dll_pll_tracking.h" #include "beidou_b3i_pcps_acquisition.h" #include "beidou_b3i_telemetry_decoder.h" #include "byte_to_short.h" @@ -38,13 +37,13 @@ #include "configuration_interface.h" #include "cshort_to_grcomplex.h" #include "direct_resampler_conditioner.h" +#include "dll_pll_tracking_adapter.h" #include "fifo_signal_source.h" #include "file_signal_source.h" #include "file_timestamp_signal_source.h" #include "fir_filter.h" #include "four_bit_cpx_file_signal_source.h" #include "freq_xlating_fir_filter.h" -#include "galileo_e1_dll_pll_veml_tracking.h" #include "galileo_e1_pcps_8ms_ambiguous_acquisition.h" #include "galileo_e1_pcps_ambiguous_acquisition.h" #include "galileo_e1_pcps_cccwsr_ambiguous_acquisition.h" @@ -52,26 +51,20 @@ #include "galileo_e1_pcps_tong_ambiguous_acquisition.h" #include "galileo_e1_tcp_connector_tracking.h" #include "galileo_e1b_telemetry_decoder.h" -#include "galileo_e5a_dll_pll_tracking.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" #include "galileo_e5a_pcps_acquisition.h" #include "galileo_e5a_telemetry_decoder.h" -#include "galileo_e5b_dll_pll_tracking.h" #include "galileo_e5b_pcps_acquisition.h" #include "galileo_e5b_telemetry_decoder.h" -#include "galileo_e6_dll_pll_tracking.h" #include "galileo_e6_pcps_acquisition.h" #include "galileo_e6_telemetry_decoder.h" -#include "glonass_l1_ca_dll_pll_tracking.h" #include "glonass_l1_ca_pcps_acquisition.h" #include "glonass_l1_ca_telemetry_decoder.h" -#include "glonass_l2_ca_dll_pll_tracking.h" #include "glonass_l2_ca_pcps_acquisition.h" #include "glonass_l2_ca_telemetry_decoder.h" #include "gnss_block_interface.h" #include "gnss_sdr_make_unique.h" #include "gnss_sdr_string_literals.h" -#include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_gaussian_tracking.h" #include "gps_l1_ca_kf_tracking.h" #include "gps_l1_ca_pcps_acquisition.h" @@ -81,10 +74,8 @@ #include "gps_l1_ca_pcps_tong_acquisition.h" #include "gps_l1_ca_tcp_connector_tracking.h" #include "gps_l1_ca_telemetry_decoder.h" -#include "gps_l2_m_dll_pll_tracking.h" #include "gps_l2_m_pcps_acquisition.h" #include "gps_l2c_telemetry_decoder.h" -#include "gps_l5_dll_pll_tracking.h" #include "gps_l5_telemetry_decoder.h" #include "gps_l5i_pcps_acquisition.h" #include "hybrid_observables.h" @@ -103,16 +94,15 @@ #include "ntlab_file_signal_source.h" #include "pass_through.h" #include "pulse_blanking_filter.h" -#include "qzss_l1_dll_pll_tracking.h" #include "qzss_l1_pcps_acquisition.h" #include "qzss_l1_telemetry_decoder.h" -#include "qzss_l5_dll_pll_tracking.h" #include "qzss_l5_telemetry_decoder.h" #include "qzss_l5i_pcps_acquisition.h" #include "rtklib_pvt.h" #include "rtl_tcp_signal_source.h" #include "sbas_l1_telemetry_decoder.h" #include "signal_conditioner.h" +#include "signal_flag.h" #include "spir_file_signal_source.h" #include "spir_gss6450_file_signal_source.h" #include "telemetry_decoder_interface.h" @@ -588,7 +578,7 @@ std::unique_ptr get_trk_block( { if (implementation == "GPS_L1_CA_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GPS_1C); } else if (implementation == "GPS_L1_CA_Gaussian_Tracking") { @@ -604,7 +594,7 @@ std::unique_ptr get_trk_block( } else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GAL_1B); } else if (implementation == "Galileo_E1_TCP_CONNECTOR_Tracking") { @@ -612,47 +602,47 @@ std::unique_ptr get_trk_block( } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GAL_E5a); } else if (implementation == "Galileo_E5b_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GAL_E5b); } else if (implementation == "Galileo_E6_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GAL_E6); } else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GPS_2S); } else if ((implementation == "GPS_L5i_DLL_PLL_Tracking") or (implementation == "GPS_L5_DLL_PLL_Tracking")) { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GPS_L5); } else if (implementation == "GLONASS_L1_CA_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GLO_1G); } else if (implementation == "GLONASS_L2_CA_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, GLO_2G); } else if (implementation == "BEIDOU_B1I_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, BDS_B1); } else if (implementation == "BEIDOU_B3I_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, BDS_B3); } else if (implementation == "QZSS_L1_CA_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, QZS_J1); } else if (implementation == "QZSS_L5_DLL_PLL_Tracking") { - return std::make_unique(configuration, role, in_streams, out_streams); + return std::make_unique(configuration, role, implementation, in_streams, out_streams, QZS_J5); } #if CUDA_GPU_ACCEL else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_GPU") diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index cc757901b..a8e038353 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -98,6 +98,7 @@ set(SYSTEM_PARAMETERS_HEADERS osnma_dsm_reader.h tow_to_trk.h qzss.h + signal_flag.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) diff --git a/src/core/system_parameters/signal_flag.h b/src/core/system_parameters/signal_flag.h new file mode 100644 index 000000000..6f6e8fba5 --- /dev/null +++ b/src/core/system_parameters/signal_flag.h @@ -0,0 +1,41 @@ +/*! + * \file signal_flag.h + * \brief Enum for signals + * \author Mathieu Favreau, 2026. favreau.mathieu(at)hotmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_SIGNAL_FLAG_H +#define GNSS_SDR_SIGNAL_FLAG_H + +#include + +class ConfigurationInterface; + +enum signal_flag : uint32_t +{ + GPS_1C = 0x1 << 0, + GPS_2S = 0x1 << 1, + GPS_L5 = 0x1 << 2, + GAL_1B = 0x1 << 3, + GAL_E5a = 0x1 << 4, + GAL_E5b = 0x1 << 5, + GAL_E6 = 0x1 << 6, + GLO_1G = 0x1 << 7, + GLO_2G = 0x1 << 8, + BDS_B1 = 0x1 << 9, + BDS_B3 = 0x1 << 10, + QZS_J1 = 0x1 << 11, + QZS_J5 = 0x1 << 12 +}; + +#endif // GNSS_SDR_SIGNAL_FLAG_H diff --git a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index bd4e74d7e..d963f929f 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -18,12 +18,12 @@ #include "concurrent_queue.h" -#include "galileo_e1_dll_pll_veml_tracking.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" #include "in_memory_configuration.h" +#include "tracking_interface.h" #include #include #include @@ -101,7 +101,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) // Example using smart pointers and the block factory std::shared_ptr trk_ = factory->GetBlock(config.get(), "Tracking_1B", 1, 1); - std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); + std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); ASSERT_NO_THROW({ tracking->set_channel(gnss_synchro.Channel_ID); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc index f13a498bd..dd947f509 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc @@ -18,12 +18,12 @@ #include "concurrent_queue.h" -#include "galileo_e5a_dll_pll_tracking.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" #include "in_memory_configuration.h" +#include "tracking_interface.h" #include #include #include diff --git a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc index 8536ece4f..7dc3a0b75 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc @@ -19,12 +19,12 @@ #include "concurrent_queue.h" -#include "galileo_e5b_dll_pll_tracking.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" #include "in_memory_configuration.h" +#include "tracking_interface.h" #include #include #include diff --git a/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc index c442d6f02..336d25a57 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc @@ -18,7 +18,7 @@ #include "concurrent_queue.h" -#include "glonass_l1_ca_dll_pll_tracking.h" +#include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" @@ -157,9 +157,12 @@ TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults) int nsamples = fs_in * 4e-3 * 2; init(); + + GNSSBlockFactory factory; queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); - std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1G", 1, 1); + std::shared_ptr trk = factory.GetBlock(config.get(), "Tracking_1G", 1, 1); + std::shared_ptr tracking = std::dynamic_pointer_cast(trk); auto msg_rx = GlonassL1CaDllPllTrackingTest_msg_rx_make(); gnss_synchro.Acq_delay_samples = 1343; From a9e0d488d3fe1feb89dda4b4fc551d25ade10d7c Mon Sep 17 00:00:00 2001 From: Mathieu Favreau Date: Tue, 21 Apr 2026 20:10:29 +0000 Subject: [PATCH 2/6] Make sure no weird behavior --- .../adapters/dll_pll_tracking_adapter.cc | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc b/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc index 1f897ce4c..12e40bf69 100644 --- a/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc +++ b/src/algorithms/tracking/adapters/dll_pll_tracking_adapter.cc @@ -81,7 +81,7 @@ signal_info get_signal_info(signal_flag sig_flag) case QZS_J5: return {'J', {'J', '5', '\0'}, "QZSS L5", QZSS_L5_CHIP_RATE, QZSS_L5_CODE_LENGTH, QZSS_L5I_NH_CODE_LENGTH, true, false}; default: - LOG(ERROR) << "Invalid signal in DLL PLL Tracking Adapter."; + break; } return {}; @@ -167,22 +167,24 @@ DllPllTrackingAdapter::DllPllTrackingAdapter( if (!sig_info.sig_name.empty()) { check_and_configure_trk_params(configuration, role_, sig_info, trk_params_); + + if (trk_params_.item_type == "gr_complex") + { + tracking_sptr_ = dll_pll_veml_make_tracking(trk_params_); + DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; + } + else + { + item_size_ = 0; + LOG(WARNING) << trk_params_.item_type << " unknown tracking item type."; + } } else { item_size_ = 0; + LOG(ERROR) << "Invalid signal in DLL PLL Tracking Adapter."; } - if (trk_params_.item_type == "gr_complex") - { - tracking_sptr_ = dll_pll_veml_make_tracking(trk_params_); - DLOG(INFO) << "Tracking block (" << tracking_sptr_->unique_id() << ")"; - } - else - { - item_size_ = 0; - LOG(WARNING) << trk_params_.item_type << " unknown tracking item type."; - } if (in_streams > 1) { From 71a6eb19303099562227e35aa2be3d8b3cc91e23 Mon Sep 17 00:00:00 2001 From: Mathieu Favreau Date: Mon, 20 Apr 2026 19:19:08 +0000 Subject: [PATCH 3/6] Cleanup telemetry decoders --- src/algorithms/libs/dump_logger_helper.h | 30 +++ .../beidou_b1i_telemetry_decoder_gs.cc | 87 ++------ .../beidou_b1i_telemetry_decoder_gs.h | 13 +- .../beidou_b3i_telemetry_decoder_gs.cc | 83 ++------ .../beidou_b3i_telemetry_decoder_gs.h | 13 +- .../galileo_telemetry_decoder_gs.cc | 188 +++++------------- .../galileo_telemetry_decoder_gs.h | 33 ++- .../glonass_l1_ca_telemetry_decoder_gs.cc | 76 ++----- .../glonass_l1_ca_telemetry_decoder_gs.h | 14 +- .../glonass_l2_ca_telemetry_decoder_gs.cc | 76 ++----- .../glonass_l2_ca_telemetry_decoder_gs.h | 13 +- .../gps_l1_ca_telemetry_decoder_gs.cc | 77 ++----- .../gps_l1_ca_telemetry_decoder_gs.h | 29 ++- .../gps_l2c_telemetry_decoder_gs.cc | 82 ++------ .../gps_l2c_telemetry_decoder_gs.h | 14 +- .../gps_l5_telemetry_decoder_gs.cc | 84 ++------ .../gps_l5_telemetry_decoder_gs.h | 17 +- .../telemetry_impl_interface.h | 1 + .../telemetry_decoder/libs/tlm_utils.cc | 42 ++++ .../telemetry_decoder/libs/tlm_utils.h | 2 + 20 files changed, 290 insertions(+), 684 deletions(-) create mode 100644 src/algorithms/libs/dump_logger_helper.h diff --git a/src/algorithms/libs/dump_logger_helper.h b/src/algorithms/libs/dump_logger_helper.h new file mode 100644 index 000000000..9dbffba26 --- /dev/null +++ b/src/algorithms/libs/dump_logger_helper.h @@ -0,0 +1,30 @@ +/*! + * \file dump_logger_helper.h + * \brief Utility functions for logging to a file + * \authors
    + *
  • Mathieu Favreau, 2026. favreau.mathieu(at)hotmail.com + *
+ * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_DUMP_LOGGER_HELPER_H +#define GNSS_SDR_DUMP_LOGGER_HELPER_H + +#include + +template +void write_value(std::ofstream& file, T value) +{ + file.write(reinterpret_cast(&value), sizeof(T)); +} + +#endif // GNSS_SDR_DUMP_LOGGER_HELPER_H diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index a004f367c..8cb285d21 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -19,21 +19,19 @@ #include "beidou_b1i_telemetry_decoder_gs.h" #include "Beidou_B1I.h" #include "Beidou_DNAV.h" -#include "beidou_dnav_almanac.h" #include "beidou_dnav_ephemeris.h" #include "beidou_dnav_iono.h" #include "beidou_dnav_utc_model.h" -#include "display.h" +#include "dump_logger_helper.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" #include // for make_any #include // for mp -#include // for size_t #include // for abs -#include // for exception #include // for setprecision #include // for cout @@ -58,6 +56,7 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( const Tlm_Conf &conf) : telemetry_impl_interface("beidou_b1i_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))), + d_satellite(satellite.get_system(), satellite.get_PRN()), d_dump_filename(conf.dump_filename), d_sample_counter(0), d_preamble_index(0), @@ -83,6 +82,7 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( d_enable_navdata_monitor(conf.enable_navdata_monitor), d_dump_crc_stats(conf.dump_crc_stats), d_tow_to_trk(conf.tow_to_trk) + { configure_basic_outputs(); @@ -94,7 +94,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( d_nav_msg_packet.signal = std::string("B1"); } - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "Initializing BeiDou B1I Telemetry Decoding for satellite " << this->d_satellite; // Setting samples of preamble code @@ -128,37 +127,7 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs() { DLOG(INFO) << "BeiDou B1I Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -300,11 +269,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New BEIDOU B1I DNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << std::endl; @@ -315,11 +280,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_utc_model()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV UTC Model data have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New BEIDOU B1I DNAV utc model message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite @@ -332,11 +293,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_iono()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV Iono data have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New BEIDOU B1I DNAV Iono message received in channel " << d_channel << ": Iono model parameters from satellite " << d_satellite << " with CN0=" << cn0 << std::setprecision(default_precision) @@ -348,11 +305,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub // std::shared_ptr tmp_obj = std::make_shared(d_nav.get_almanac(slot_nbr)); // this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV Almanac data have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New BEIDOU B1I DNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -663,19 +616,11 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_symbol.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, static_cast(d_TOW_at_current_symbol_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Tracking_sample_counter); + write_value(d_dump_file, static_cast(d_TOW_at_Preamble_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, static_cast(current_symbol.PRN)); } catch (const std::ofstream::failure &e) { @@ -686,12 +631,12 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ // SEND TOW TO THE TRACKING BLOCK if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string(current_symbol.Signal), d_channel, d_TOW_at_current_symbol_ms, current_symbol.Tracking_sample_counter, - d_nav.get_ephemeris().WN, d_satellite.get_PRN())); + d_nav.get_ephemeris().WN, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h index a36e6e55a..d266499eb 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h @@ -23,10 +23,7 @@ #include "beidou_dnav_navigation_message.h" #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" #include -#include // for gr_vector_const_void_star -#include /** \addtogroup Telemetry_Decoder @@ -115,12 +112,12 @@ private: bool d_flag_valid_word; bool d_sent_tlm_failed_msg; - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index ce6607862..7c19c530a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -17,21 +17,20 @@ #include "beidou_b3i_telemetry_decoder_gs.h" #include "Beidou_B3I.h" #include "Beidou_DNAV.h" -#include "beidou_dnav_almanac.h" #include "beidou_dnav_ephemeris.h" #include "beidou_dnav_iono.h" #include "beidou_dnav_utc_model.h" #include "display.h" +#include "dump_logger_helper.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" #include // for make_any #include // for mp -#include // for size_t #include // for abs -#include // for exception #include // for setprecision #include // for cout @@ -126,37 +125,7 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs() { DLOG(INFO) << "BeiDou B3I Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -301,11 +270,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_YELLOW << "New BEIDOU B3I DNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -319,11 +284,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV UTC Model data have been received in channel" << d_channel << " from satellite " << d_satellite; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_YELLOW << "New BEIDOU B3I DNAV utc model message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite @@ -338,11 +299,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV Iono data have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_YELLOW << "New BEIDOU B3I DNAV Iono message received in channel " << d_channel << ": Iono model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -357,11 +314,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols, doub // pmt::make_any(tmp_obj)); LOG(INFO) << "BEIDOU DNAV Almanac data have been received in channel" << d_channel << " from satellite " << d_satellite << " with CN0=" << cn0 << " dB-Hz"; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_YELLOW << "New BEIDOU B3I DNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -681,19 +634,11 @@ int beidou_b3i_telemetry_decoder_gs::general_work( // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_symbol.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, static_cast(d_TOW_at_current_symbol_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Tracking_sample_counter); + write_value(d_dump_file, static_cast(d_TOW_at_Preamble_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, static_cast(current_symbol.PRN)); } catch (const std::ofstream::failure &e) { @@ -704,12 +649,12 @@ int beidou_b3i_telemetry_decoder_gs::general_work( // SEND TOW TO THE TRACKING BLOCK if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string(current_symbol.Signal), d_channel, d_TOW_at_current_symbol_ms, current_symbol.Tracking_sample_counter, - d_nav.get_ephemeris().WN, d_satellite.get_PRN())); + d_nav.get_ephemeris().WN, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h index e96558800..c97bd98fe 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h @@ -20,10 +20,7 @@ #include "beidou_dnav_navigation_message.h" #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" #include -#include // for gr_vector_const_void_star -#include /** \addtogroup Telemetry_Decoder @@ -110,12 +107,12 @@ private: bool d_flag_preamble; // Flag indicating when preamble was found bool d_flag_valid_word; bool d_sent_tlm_failed_msg; - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index cf68b1b48..bca1f7f36 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -19,11 +19,11 @@ #include "galileo_telemetry_decoder_gs.h" -#include "Galileo_E1.h" // for GALILEO_E1_CODE_PERIOD_MS -#include "Galileo_E5a.h" // for GALILEO_E5A_CODE_PERIOD_MS -#include "Galileo_E5b.h" // for GALILEO_E5B_CODE_PERIOD_MS -#include "Galileo_E6.h" // for GALILEO_E6_CODE_PERIOD_MS -#include "display.h" // for colours in terminal: TEXT_BLUE, TEXT_RESET, ... +#include "Galileo_E1.h" // for GALILEO_E1_CODE_PERIOD_MS +#include "Galileo_E5a.h" // for GALILEO_E5A_CODE_PERIOD_MS +#include "Galileo_E6.h" // for GALILEO_E6_CODE_PERIOD_MS +#include "display.h" // for colours in terminal: TEXT_BLUE, TEXT_RESET, ... +#include "dump_logger_helper.h" #include "galileo_almanac_helper.h" // for Galileo_Almanac_Helper #include "galileo_ephemeris.h" // for Galileo_Ephemeris #include "galileo_has_page.h" // For Galileo_HAS_page @@ -31,22 +31,22 @@ #include "galileo_utc_model.h" // for Galileo_Utc_Model #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" // for Gnss_Synchro -#include "tlm_crc_stats.h" // for Tlm_CRC_Stats -#include "tlm_utils.h" // for save_tlm_matfile, tlm_remove_file -#include "tow_to_trk.h" // for TOW_to_trk -#include "viterbi_decoder.h" // for Viterbi_Decoder -#include // for pmt::mp -#include // for std::array -#include // for std::fmod, std::abs -#include // for size_t -#include // for std::exception -#include // for std::setprecision -#include // for std::cout -#include // for std::numeric_limits -#include // for std::map -#include // for std::out_of_range -#include // for std::tuple -#include // for typeid +#include "tlm_conf.h" +#include "tlm_crc_stats.h" // for Tlm_CRC_Stats +#include "tlm_utils.h" // for save_tlm_matfile, tlm_remove_file +#include "tow_to_trk.h" // for TOW_to_trk +#include "viterbi_decoder.h" // for Viterbi_Decoder +#include // for pmt::mp +#include // for std::array +#include // for std::fmod, std::abs +#include // for size_t +#include // for std::setprecision +#include // for std::cout +#include // for std::numeric_limits +#include // for std::map +#include // for std::out_of_range +#include // for std::tuple +#include // for typeid #if USE_GLOG_AND_GFLAGS #include @@ -285,37 +285,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs() { DLOG(INFO) << "Galileo Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -463,11 +433,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_ephemeris()); if (d_band == '1') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -475,11 +441,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } else if (d_band == '7') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" @@ -496,11 +458,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_reduced_ced()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New Galileo E1 I/NAV reduced CED message received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -515,11 +473,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); if (d_band == '1') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -527,11 +481,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } else if (d_band == '7') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -547,11 +497,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); if (d_band == '1') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -559,11 +505,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } else if (d_band == '7') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite @@ -582,22 +524,14 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // debug if (d_band == '1') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << std::endl; } else if (d_band == '7') { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "Galileo E5b I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -672,11 +606,7 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t { const std::shared_ptr tmp_obj = std::make_shared(d_fnav_nav.get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -687,11 +617,7 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t { const std::shared_ptr tmp_obj = std::make_shared(d_fnav_nav.get_iono()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -703,11 +629,7 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t const std::shared_ptr tmp_obj = std::make_shared(d_fnav_nav.get_utc_model()); LOG(INFO) << "Galileo leap second Delta_tLS=" << tmp_obj->Delta_tLS; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -768,11 +690,7 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(uint64_t time_stamp, float * if (is_page_dummy != d_cnav_dummy_page) { d_cnav_dummy_page = is_page_dummy; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "Receiving Galileo E6 CNAV dummy pages in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" @@ -791,11 +709,7 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(uint64_t time_stamp, float * if (d_print_cnav_page == true) { d_print_cnav_page = false; // only print the first page -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "Receiving Galileo E6 HAS pages" << (d_cnav_nav.is_HAS_in_test_mode() == true ? " (test mode) " : " ") << "in channel " << d_channel << " from satellite " << d_satellite @@ -1390,33 +1304,27 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); + write_value(d_dump_file, static_cast(d_TOW_at_current_symbol_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Tracking_sample_counter); + write_value(d_dump_file, static_cast(d_TOW_at_Preamble_ms) / 1000.0); + switch (d_frame_type) { case 1: - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); break; case 2: - tmp_int = (current_symbol.Prompt_Q > 0.0 ? 1 : -1); + write_value(d_dump_file, current_symbol.Prompt_Q > 0.0 ? 1 : -1); break; case 3: - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); break; default: - tmp_int = 0; + write_value(d_dump_file, 0); break; } - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_symbol.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + + write_value(d_dump_file, static_cast(current_symbol.PRN)); } catch (const std::ofstream::failure &e) { @@ -1440,12 +1348,12 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( gal_week = 0; break; } - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string(current_symbol.Signal), d_channel, d_TOW_at_current_symbol_ms, current_symbol.Tracking_sample_counter, - gal_week, d_satellite.get_PRN())); + gal_week, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h index 687cbf7a7..452b70107 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h @@ -21,17 +21,14 @@ #ifndef GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H #define GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H -#include "galileo_cnav_message.h" // for Galileo_Cnav_Message -#include "galileo_fnav_message.h" // for Galileo_Fnav_Message -#include "galileo_inav_message.h" // for Galileo_Inav_Message -#include "gnss_time.h" // for GnssTime -#include "nav_message_packet.h" // for Nav_Message_Packet +#include "galileo_cnav_message.h" // for Galileo_Cnav_Message +#include "galileo_fnav_message.h" // for Galileo_Fnav_Message +#include "galileo_inav_message.h" // for Galileo_Inav_Message +#include "gnss_time.h" +#include "nav_message_packet.h" #include "telemetry_impl_interface.h" // for telemetry_impl_interface -#include "tlm_conf.h" // for Tlm_Conf #include // for boost::circular_buffer -#include // for gr_vector_const_void_star -#include // for pmt::pmt_t -#include // for std::vector + /** \addtogroup Telemetry_Decoder * \{ */ @@ -111,7 +108,7 @@ private: int32_t d_mm; int32_t d_codelength; int32_t d_datalength; - int32_t d_frame_type; + const int32_t d_frame_type; int32_t d_bits_per_preamble; int32_t d_samples_per_preamble; int32_t d_preamble_period_symbols; @@ -134,21 +131,21 @@ private: bool d_flag_frame_sync; bool d_flag_PLL_180_deg_phase_locked; bool d_flag_preamble; - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; bool d_first_eph_sent; bool d_cnav_dummy_page; bool d_print_cnav_page; - bool d_enable_navdata_monitor; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; bool d_enable_reed_solomon_inav; bool d_valid_timetag; bool d_E6_TOW_set; - bool d_there_are_e1_channels; - bool d_there_are_e6_channels; - bool d_use_ced; - bool d_tow_to_trk; + const bool d_there_are_e1_channels; + const bool d_there_are_e6_channels; + const bool d_use_ced; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc index ecf17b463..fb514b9e2 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc @@ -17,10 +17,12 @@ #include "glonass_l1_ca_telemetry_decoder_gs.h" +#include "dump_logger_helper.h" #include "glonass_gnav_almanac.h" #include "glonass_gnav_ephemeris.h" #include "glonass_gnav_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" @@ -28,9 +30,7 @@ #include // for make_any #include // for mp #include // for floor, round -#include // for size_t #include // for abs -#include // for exception #include // for std::setprecision #include // for cout @@ -105,37 +105,7 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs( glonass_l1_ca_telemetry_decoder_gs::~glonass_l1_ca_telemetry_decoder_gs() { DLOG(INFO) << "Glonass L1 Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -197,11 +167,7 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New GLONASS L1 GNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -213,11 +179,7 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_utc_model()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV UTC Model data have been received in channel" << d_channel << " from satellite " << d_satellite; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New GLONASS L1 GNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -230,11 +192,7 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo tmp_obj = std::make_shared(d_nav.get_almanac(slot_nbr)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV Almanac data have been received in channel" << d_channel << " in slot number " << slot_nbr; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New GLONASS L1 GNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << std::endl; @@ -435,12 +393,12 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu // SEND TOW TO THE TRACKING BLOCK if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string(current_symbol.Signal), d_channel, current_symbol.TOW_at_current_symbol_ms, current_symbol.Tracking_sample_counter, - d_nav.get_ephemeris().d_WN, d_satellite.get_PRN())); + d_nav.get_ephemeris().d_WN, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } } @@ -457,19 +415,11 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = d_TOW_at_current_symbol; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = 0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_symbol.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, d_TOW_at_current_symbol); + write_value(d_dump_file, current_symbol.Tracking_sample_counter); + write_value(d_dump_file, 0); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, static_cast(current_symbol.PRN)); } catch (const std::ofstream::failure &e) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h index 6693fa1fc..31f6ff920 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h @@ -24,17 +24,13 @@ #include "gnss_synchro.h" #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" #include -#include // for gr_vector_const_void_star -#include /** \addtogroup Telemetry_Decoder * \{ */ /** \addtogroup Telemetry_Decoder_gnuradio_blocks * \{ */ - class glonass_l1_ca_telemetry_decoder_gs; using glonass_l1_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr; @@ -101,12 +97,12 @@ private: bool d_flag_frame_sync; // Indicate when a frame sync is achieved bool d_flag_preamble; // Flag indicating when preamble was found - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc index 4e6027962..792fa38e1 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc @@ -17,10 +17,12 @@ #include "glonass_l2_ca_telemetry_decoder_gs.h" #include "display.h" +#include "dump_logger_helper.h" #include "glonass_gnav_almanac.h" #include "glonass_gnav_ephemeris.h" #include "glonass_gnav_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" @@ -28,9 +30,7 @@ #include // for make_any #include // for mp #include // for floor, round -#include // for size_t #include // for abs -#include // for exception #include // for std::setprecision #include // for cout @@ -105,37 +105,7 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs( glonass_l2_ca_telemetry_decoder_gs::~glonass_l2_ca_telemetry_decoder_gs() { DLOG(INFO) << "Glonass L2 Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -197,11 +167,7 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_CYAN << "New GLONASS L2 GNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -213,11 +179,7 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_utc_model()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV UTC Model data have been received in channel" << d_channel << " from satellite " << d_satellite; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_CYAN << "New GLONASS L2 GNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -230,11 +192,7 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo tmp_obj = std::make_shared(d_nav.get_almanac(slot_nbr)); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); LOG(INFO) << "GLONASS GNAV Almanac data have been received in channel" << d_channel << " in slot number " << slot_nbr; -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_CYAN << "New GLONASS L2 GNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) @@ -433,12 +391,12 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu // SEND TOW TO THE TRACKING BLOCK if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string(current_symbol.Signal), d_channel, current_symbol.TOW_at_current_symbol_ms, current_symbol.Tracking_sample_counter, - d_nav.get_ephemeris().d_WN, d_satellite.get_PRN())); + d_nav.get_ephemeris().d_WN, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } } @@ -455,19 +413,11 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = d_TOW_at_current_symbol; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = 0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_symbol.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, d_TOW_at_current_symbol); + write_value(d_dump_file, current_symbol.Tracking_sample_counter); + write_value(d_dump_file, 0); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, static_cast(current_symbol.PRN)); } catch (const std::ofstream::failure &e) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h index 1c3928d48..002a602cc 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h @@ -23,10 +23,7 @@ #include "gnss_synchro.h" #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" #include -#include // for gr_vector_const_void_star -#include /** \addtogroup Telemetry_Decoder * \{ */ @@ -96,12 +93,12 @@ private: bool d_flag_frame_sync; // Indicate when a frame sync is achieved bool d_flag_preamble; // Flag indicating when preamble was found - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index 699bd0f98..77a467fda 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -20,10 +20,14 @@ */ #include "gps_l1_ca_telemetry_decoder_gs.h" +#include "dump_logger_helper.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 -#include "gps_ephemeris.h" // for Gps_Ephemeris -#include "gps_iono.h" // for Gps_Iono -#include "gps_utc_model.h" // for Gps_Utc_Model +#include "gnss_synchro.h" +#include "gnss_time.h" // for timetags produced by Tracking +#include "gps_ephemeris.h" // for Gps_Ephemeris +#include "gps_iono.h" // for Gps_Iono +#include "gps_utc_model.h" // for Gps_Utc_Model +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" @@ -32,9 +36,7 @@ #include // for min #include // for bitset #include // for round -#include // for size_t #include // for memcpy -#include // for exception #include // for setprecision #include // for cout #include @@ -93,6 +95,7 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( d_channel(0), d_required_symbols(GPS_SUBFRAME_BITS), d_prev_GPS_frame_4bytes(0), + d_max_symbols_without_valid_frame(d_required_symbols * 20), d_stat(0), d_TOW_at_Preamble_ms(0), d_TOW_at_current_symbol_ms(0), @@ -109,7 +112,8 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( d_enable_navdata_monitor(conf.enable_navdata_monitor), d_dump_crc_stats(conf.dump_crc_stats), d_tow_to_trk(conf.tow_to_trk), - d_have_last_decoded_tow(false) + d_have_last_decoded_tow(false) // rise alarm 120 segs without valid tlm + { configure_basic_outputs(); @@ -142,7 +146,6 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( // set the preamble // preamble bits to sampled symbols - d_max_symbols_without_valid_frame = d_required_symbols * 20; // rise alarm 120 segs without valid tlm int32_t n = 0; for (int32_t i = 0; i < d_bits_per_preamble; i++) { @@ -179,37 +182,7 @@ gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs() DLOG(INFO) << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS") << " L1 C/A Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -436,11 +409,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe(double cn0, bool flag_inver } if (received_subframe_ok) { -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << "New " << ((d_system == L1LnavSystem::GPS) ? "GPS" : "QZSS") << " NAV message received in channel " << this->d_channel << ": " << "subframe " << subframe_ID << " from satellite " @@ -742,19 +711,11 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__ // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_symbol.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_symbol.Prompt_I > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_symbol.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, static_cast(d_TOW_at_current_symbol_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Tracking_sample_counter); + write_value(d_dump_file, static_cast(d_TOW_at_Preamble_ms) / 1000.0); + write_value(d_dump_file, current_symbol.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, static_cast(current_symbol.PRN)); } catch (const std::ofstream::failure &e) { @@ -765,12 +726,12 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__ // SEND TOW TO THE TRACKING BLOCK if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( ((d_system == L1LnavSystem::GPS) ? std::string("1C") : std::string("J1")), d_channel, d_TOW_at_current_symbol_ms, current_symbol.Tracking_sample_counter, - d_nav->get_GPS_week(), d_nav->get_satellite_PRN())); + d_nav->get_GPS_week(), d_nav->get_satellite_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h index e56e05e5c..e43e7d355 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h @@ -19,16 +19,10 @@ #ifndef GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H #define GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H -#include "GPS_L1_CA.h" -#include "gnss_synchro.h" -#include "gnss_time.h" // for timetags produced by Tracking #include "gps_navigation_message.h" #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" #include -#include // for gr_vector_const_void_star -#include // for array /** \addtogroup Telemetry_Decoder @@ -43,6 +37,7 @@ enum class L1LnavSystem QZSS }; +class Gnss_Synchro; class gps_l1_ca_telemetry_decoder_gs; using gps_l1_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr; @@ -84,7 +79,7 @@ private: bool decode_subframe(double cn0, bool flag_invert); bool is_tow_consistent(uint32_t decoded_tow_s); - L1LnavSystem d_system; + const L1LnavSystem d_system; std::unique_ptr d_nav; Gnss_Satellite d_satellite; Nav_Message_Packet d_nav_msg_packet; @@ -101,15 +96,15 @@ private: uint64_t d_preamble_index; uint64_t d_last_valid_preamble; - int32_t d_bits_per_preamble; - int32_t d_samples_per_preamble; - int32_t d_preamble_period_symbols; + const int32_t d_bits_per_preamble; + const int32_t d_samples_per_preamble; + const int32_t d_preamble_period_symbols; int32_t d_CRC_error_counter; int32_t d_channel; - uint32_t d_required_symbols; + const uint32_t d_required_symbols; uint32_t d_prev_GPS_frame_4bytes; - uint32_t d_max_symbols_without_valid_frame; + const uint32_t d_max_symbols_without_valid_frame; uint32_t d_stat; uint32_t d_TOW_at_Preamble_ms; uint32_t d_TOW_at_current_symbol_ms; @@ -121,12 +116,12 @@ private: bool d_sent_tlm_failed_msg; bool d_flag_PLL_180_deg_phase_locked; bool d_flag_TOW_set; - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; bool d_have_last_decoded_tow; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc index 04a6d34b2..f6416505f 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc @@ -18,11 +18,13 @@ #include "gps_l2c_telemetry_decoder_gs.h" #include "GPS_L2C.h" // for GPS_L2_CNAV_DATA_PAGE_BITS, GPS_L... #include "display.h" +#include "dump_logger_helper.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" #include "gps_cnav_ephemeris.h" // for Gps_CNAV_Ephemeris #include "gps_cnav_iono.h" // for Gps_CNAV_Iono #include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" @@ -31,8 +33,6 @@ #include // for mp #include // for bitset #include // for round -#include // for size_t -#include // for exception #include // for setprecision #include // for cout @@ -60,6 +60,7 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs( d_sample_counter(0), d_last_valid_preamble(0), d_channel(0), + d_max_symbols_without_valid_frame(GPS_L2_CNAV_DATA_PAGE_BITS * GPS_L2_SYMBOLS_PER_BIT * 5), d_dump(conf.dump), d_sent_tlm_failed_msg(false), d_flag_PLL_180_deg_phase_locked(false), @@ -68,7 +69,8 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs( d_remove_dat(conf.remove_dat), d_enable_navdata_monitor(conf.enable_navdata_monitor), d_dump_crc_stats(conf.dump_crc_stats), - d_tow_to_trk(conf.tow_to_trk) + d_tow_to_trk(conf.tow_to_trk) // rise alarm if 5 consecutive subframes have no valid CRC + { configure_basic_outputs(); @@ -80,8 +82,6 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs( d_nav_msg_packet.signal = std::string("2S"); } - d_max_symbols_without_valid_frame = GPS_L2_CNAV_DATA_PAGE_BITS * GPS_L2_SYMBOLS_PER_BIT * 5; // rise alarm if 5 consecutive subframes have no valid CRC - d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); DLOG(INFO) << "GPS L2C M TELEMETRY PROCESSING: satellite " << d_satellite; @@ -104,37 +104,7 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs( gps_l2c_telemetry_decoder_gs::~gps_l2c_telemetry_decoder_gs() { DLOG(INFO) << "GPS L2C Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -237,11 +207,7 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // get ephemeris object for this SV const std::shared_ptr tmp_obj = std::make_shared(d_CNAV_Message.get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "New GPS CNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << current_synchro_data.CN0_dB_hz << std::setprecision(default_precision) @@ -251,11 +217,7 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { const std::shared_ptr tmp_obj = std::make_shared(d_CNAV_Message.get_iono()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "New GPS CNAV message received in channel " << d_channel << ": iono model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << current_synchro_data.CN0_dB_hz << std::setprecision(default_precision) @@ -266,11 +228,7 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { const std::shared_ptr tmp_obj = std::make_shared(d_CNAV_Message.get_utc_model()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_BLUE << "New GPS CNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << current_synchro_data.CN0_dB_hz << std::setprecision(default_precision) @@ -327,19 +285,11 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = d_TOW_at_current_symbol; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_synchro_data.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = d_TOW_at_Preamble; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_synchro_data.Prompt_I > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_synchro_data.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, static_cast(d_TOW_at_current_symbol)); + write_value(d_dump_file, current_synchro_data.Tracking_sample_counter); + write_value(d_dump_file, d_TOW_at_Preamble); + write_value(d_dump_file, current_synchro_data.Prompt_I > 0.0 ? 1 : -1); + write_value(d_dump_file, static_cast(current_synchro_data.PRN)); } catch (const std::ofstream::failure &e) { @@ -349,12 +299,12 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string("L2"), d_channel, current_synchro_data.TOW_at_current_symbol_ms, current_synchro_data.Tracking_sample_counter, - d_CNAV_Message.get_ephemeris().WN, d_satellite.get_PRN())); + d_CNAV_Message.get_ephemeris().WN, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h index 855d02f3b..7fb9ad3c7 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h @@ -21,8 +21,6 @@ #include "gps_cnav_navigation_message.h" #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" -#include // for gr_vector_const_void_star extern "C" { @@ -87,17 +85,17 @@ private: int32_t d_channel; - uint32_t d_max_symbols_without_valid_frame; + const uint32_t d_max_symbols_without_valid_frame; - bool d_dump; + const bool d_dump; bool d_sent_tlm_failed_msg; bool d_flag_PLL_180_deg_phase_locked; bool d_flag_valid_word; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc index 78fa1bc4f..883bbf564 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc @@ -17,12 +17,15 @@ #include "gps_l5_telemetry_decoder_gs.h" +#include "GPS_L5.h" #include "display.h" +#include "dump_logger_helper.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" #include "gps_cnav_ephemeris.h" #include "gps_cnav_iono.h" #include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model +#include "tlm_conf.h" #include "tlm_crc_stats.h" #include "tlm_utils.h" #include "tow_to_trk.h" @@ -30,9 +33,7 @@ #include // for make_any #include // for mp #include // for std::bitset -#include // for size_t #include // for std::llabs -#include // for std::exception #include // for std::setprecision #include // for std::cout @@ -62,6 +63,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( d_channel(0), d_TOW_at_current_symbol_ms(0U), d_TOW_at_Preamble_ms(0U), + d_max_symbols_without_valid_frame(GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10), d_flag_PLL_180_deg_phase_locked(false), d_flag_valid_word(false), d_sent_tlm_failed_msg(false), @@ -70,7 +72,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( d_remove_dat(conf.remove_dat), d_enable_navdata_monitor(conf.enable_navdata_monitor), d_dump_crc_stats(conf.dump_crc_stats), - d_tow_to_trk(conf.tow_to_trk) + d_tow_to_trk(conf.tow_to_trk) // rise alarm if 20 consecutive subframes have no valid CRC { configure_basic_outputs(); @@ -90,8 +92,6 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( } } - d_max_symbols_without_valid_frame = GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10; // rise alarm if 20 consecutive subframes have no valid CRC - d_CNAV_Message = std::make_unique(d_system); d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 TELEMETRY PROCESSING: satellite " << d_satellite; @@ -115,37 +115,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs() { DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 Telemetry decoder block (channel " << d_channel << ") destructor called."; - size_t pos = 0; - if (d_dump_file.is_open() == true) - { - pos = d_dump_file.tellp(); - try - { - d_dump_file.close(); - } - catch (const std::exception &ex) - { - LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what(); - } - if (pos == 0) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } - if (d_dump && (pos != 0) && d_dump_mat) - { - save_tlm_matfile(d_dump_filename); - if (d_remove_dat) - { - if (!tlm_remove_file(d_dump_filename)) - { - LOG(WARNING) << "Error deleting temporary file"; - } - } - } + tlm_cleanup_and_save_files(d_dump_file, d_dump_filename, d_dump, d_dump_mat, d_remove_dat); } @@ -155,14 +125,12 @@ void gps_l5_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satellite) DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite; - d_CNAV_Message = std::make_unique(d_system); } void gps_l5_telemetry_decoder_gs::set_channel(int32_t channel) { d_channel = channel; - d_CNAV_Message = std::make_unique(d_system); DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 CNAV channel set to " << channel; @@ -252,11 +220,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u // get ephemeris object for this SV const std::shared_ptr tmp_obj = std::make_shared(d_CNAV_Message->get_ephemeris()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "New " << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 CNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite @@ -267,11 +231,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u { const std::shared_ptr tmp_obj = std::make_shared(d_CNAV_Message->get_iono()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "New " << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 CNAV message received in channel " << d_channel << ": iono model parameters from satellite " << d_satellite @@ -283,11 +243,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u { const std::shared_ptr tmp_obj = std::make_shared(d_CNAV_Message->get_utc_model()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); -#if __cplusplus == 201103L - const int default_precision = std::cout.precision(); -#else - const auto default_precision{std::cout.precision()}; -#endif + const auto default_precision = std::cout.precision(); std::cout << TEXT_MAGENTA << "New " << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 CNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite @@ -365,19 +321,11 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u // MULTIPLEXED FILE RECORDING - Record results to file try { - double tmp_double; - uint64_t tmp_ulong_int; - int32_t tmp_int; - tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_ulong_int = current_synchro_data.Tracking_sample_counter; - d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(uint64_t)); - tmp_double = static_cast(d_TOW_at_Preamble_ms) / 1000.0; - d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_int = (current_synchro_data.Prompt_Q > 0.0 ? 1 : -1); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); - tmp_int = static_cast(current_synchro_data.PRN); - d_dump_file.write(reinterpret_cast(&tmp_int), sizeof(int32_t)); + write_value(d_dump_file, static_cast(d_TOW_at_current_symbol_ms) / 1000.0); + write_value(d_dump_file, current_synchro_data.Tracking_sample_counter); + write_value(d_dump_file, static_cast(d_TOW_at_Preamble_ms) / 1000.0); + write_value(d_dump_file, (current_synchro_data.Prompt_Q > 0.0 ? 1 : -1)); + write_value(d_dump_file, static_cast(current_synchro_data.PRN)); } catch (const std::ofstream::failure &e) { @@ -390,12 +338,12 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u // SEND TOW TO THE TRACKING BLOCK if (d_tow_to_trk) { - const std::shared_ptr tmp_tow_obj = std::make_shared(TOW_to_trk( + const std::shared_ptr tmp_tow_obj = std::make_shared( std::string(((d_system == CnavSystem::GPS) ? "L5" : "J5")), d_channel, d_TOW_at_current_symbol_ms, current_synchro_data.Tracking_sample_counter, - d_CNAV_Message->get_ephemeris().WN, d_satellite.get_PRN())); + d_CNAV_Message->get_ephemeris().WN, d_satellite.get_PRN()); this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj)); } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h index a734ec425..8f5237e42 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h @@ -18,13 +18,10 @@ #define GNSS_SDR_GPS_L5_TELEMETRY_DECODER_GS_H -#include "GPS_L5.h" // for GPS_L5I_NH_CODE_LENGTH #include "gps_cnav_navigation_message.h" // for Gps_CNAV_Navigation_Message #include "nav_message_packet.h" #include "telemetry_impl_interface.h" -#include "tlm_conf.h" #include -#include // for gr_vector_const_void_star extern "C" { @@ -71,7 +68,7 @@ private: cnav_msg_decoder_t d_cnav_decoder{}; Gnss_Satellite d_satellite; - CnavSystem d_system; + const CnavSystem d_system; std::unique_ptr d_CNAV_Message; @@ -88,17 +85,17 @@ private: uint32_t d_TOW_at_current_symbol_ms; uint32_t d_TOW_at_Preamble_ms; - uint32_t d_max_symbols_without_valid_frame; + const uint32_t d_max_symbols_without_valid_frame; bool d_flag_PLL_180_deg_phase_locked; bool d_flag_valid_word; bool d_sent_tlm_failed_msg; - bool d_dump; - bool d_dump_mat; - bool d_remove_dat; - bool d_enable_navdata_monitor; + const bool d_dump; + const bool d_dump_mat; + const bool d_remove_dat; + const bool d_enable_navdata_monitor; bool d_dump_crc_stats; - bool d_tow_to_trk; + const bool d_tow_to_trk; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/telemetry_impl_interface.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/telemetry_impl_interface.h index 3f01e885f..bc9bb5d8c 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/telemetry_impl_interface.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/telemetry_impl_interface.h @@ -27,6 +27,7 @@ #include #include +class Tlm_Conf; class Tlm_CRC_Stats; /** \addtogroup Telemetry_Decoder diff --git a/src/algorithms/telemetry_decoder/libs/tlm_utils.cc b/src/algorithms/telemetry_decoder/libs/tlm_utils.cc index 7d0297ba2..1b96a9703 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_utils.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_utils.cc @@ -23,6 +23,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + int save_tlm_matfile(const std::string &dumpfile) { @@ -121,3 +127,39 @@ bool tlm_remove_file(const std::string &file_to_remove) errorlib::error_code ec; return fs::remove(fs::path(file_to_remove), ec); } + + +void tlm_cleanup_and_save_files(std::ofstream &dump_file, const std::string &dump_filename, bool dump, bool dump_mat, bool remove_dat) +{ + size_t pos = 0; + if (dump_file.is_open() == true) + { + pos = dump_file.tellp(); + try + { + dump_file.close(); + } + catch (const std::exception &ex) + { + LOG(WARNING) << "Exception closing dump file " << ex.what(); + } + if (pos == 0) + { + if (!tlm_remove_file(dump_filename)) + { + LOG(WARNING) << "Error deleting temporary file"; + } + } + } + if (dump && (pos != 0) && dump_mat) + { + save_tlm_matfile(dump_filename); + if (remove_dat) + { + if (!tlm_remove_file(dump_filename)) + { + LOG(WARNING) << "Error deleting temporary file"; + } + } + } +} diff --git a/src/algorithms/telemetry_decoder/libs/tlm_utils.h b/src/algorithms/telemetry_decoder/libs/tlm_utils.h index dc00cd94e..7a18b8ff2 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_utils.h +++ b/src/algorithms/telemetry_decoder/libs/tlm_utils.h @@ -28,6 +28,8 @@ int save_tlm_matfile(const std::string &dumpfile); bool tlm_remove_file(const std::string &file_to_remove); +void tlm_cleanup_and_save_files(std::ofstream &dump_file, const std::string &dump_filename, bool dump, bool dump_mat, bool remove_dat); + /** \} */ /** \} */ #endif // GNSS_SDR_TLM_UTILS_H From de07ba1f1e72470e09be2a159a6afd989e1a6092 Mon Sep 17 00:00:00 2001 From: Mathieu Favreau Date: Mon, 20 Apr 2026 19:23:20 +0000 Subject: [PATCH 4/6] Remove new line --- .../gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index 8cb285d21..4a31912eb 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -82,7 +82,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( d_enable_navdata_monitor(conf.enable_navdata_monitor), d_dump_crc_stats(conf.dump_crc_stats), d_tow_to_trk(conf.tow_to_trk) - { configure_basic_outputs(); From f510fb3a6fbba08e06e30742c7533cc44888c288 Mon Sep 17 00:00:00 2001 From: Mathieu Favreau Date: Mon, 20 Apr 2026 20:05:08 +0000 Subject: [PATCH 5/6] Revert changes --- .../gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc index 883bbf564..a8201817a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc @@ -63,7 +63,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( d_channel(0), d_TOW_at_current_symbol_ms(0U), d_TOW_at_Preamble_ms(0U), - d_max_symbols_without_valid_frame(GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10), + d_max_symbols_without_valid_frame(GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10), // rise alarm if 20 consecutive subframes have no valid CRC d_flag_PLL_180_deg_phase_locked(false), d_flag_valid_word(false), d_sent_tlm_failed_msg(false), @@ -72,7 +72,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( d_remove_dat(conf.remove_dat), d_enable_navdata_monitor(conf.enable_navdata_monitor), d_dump_crc_stats(conf.dump_crc_stats), - d_tow_to_trk(conf.tow_to_trk) // rise alarm if 20 consecutive subframes have no valid CRC + d_tow_to_trk(conf.tow_to_trk) { configure_basic_outputs(); @@ -125,6 +125,7 @@ void gps_l5_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satellite) DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite; + d_CNAV_Message = std::make_unique(d_system); } @@ -136,6 +137,7 @@ void gps_l5_telemetry_decoder_gs::set_channel(int32_t channel) configure_dump_file(d_channel, d_dump, d_dump_filename, d_dump_file); configure_crc_stats_channel(d_channel, d_dump_crc_stats, d_Tlm_CRC_Stats); + d_CNAV_Message = std::make_unique(d_system); } From 19dd599ba555e5a0a549d7e5a786454f14d8c59a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 22 Apr 2026 18:39:13 +0200 Subject: [PATCH 6/6] Remove leftovers of old Tracking adapters --- README.md | 20 +++++++++---------- .../observables/hybrid_observables_test.cc | 2 +- .../gps_l1_ca_telemetry_decoder_test.cc | 4 ++-- .../gps_l2_m_dll_pll_tracking_test.cc | 4 ++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e61573be7..d42921bb8 100644 --- a/README.md +++ b/README.md @@ -1661,14 +1661,14 @@ receiver channel, as well as their parameters, in the configuration file. For a GPS L1 C/A receiver: ``` -;######### ACQUISITION GLOBAL CONFIG ############ +;######### ACQUISITION GPS L1 CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition ; Acquisition algorithm selection for this channel Acquisition_1C.item_type=gr_complex Acquisition_1C.coherent_integration_time_ms=1 ; Signal block duration for the acquisition signal detection [ms] Acquisition_1C.threshold=2.5 ; Acquisition threshold -Acquisition_1C.pfa=0.01 ; Acquisition false alarm probability. This option overrides the threshold option. -Acquisition_1C.doppler_max=10000 ; Maximum expected Doppler shift [Hz] -Acquisition_1C.doppler_step=500 ; Doppler step in the grid search [Hz] +Acquisition_1C.pfa=0.001 ; Acquisition false alarm probability. This option overrides the threshold option. +Acquisition_1C.doppler_max=5000 ; Maximum expected Doppler shift [Hz] +Acquisition_1C.doppler_step=250 ; Doppler step in the grid search [Hz] Acquisition_1C.dump=false ; Enables internal data file logging [true] or [false] Acquisition_1C.dump_filename=./acq_dump.dat ; Log path and filename ``` @@ -1676,12 +1676,12 @@ Acquisition_1C.dump_filename=./acq_dump.dat ; Log path and filename and, for Galileo E1B channels: ``` -;######### GALILEO ACQUISITION CONFIG ############ +;######### ACQUISITION GALILEO E1 CONFIG ############ Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition Acquisition_1B.item_type=gr_complex Acquisition_1B.coherent_integration_time_ms=4 Acquisition_1B.pfa=0.008 -Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_max=5000 Acquisition_1B.doppler_step=125 Acquisition_1B.dump=false Acquisition_1B.dump_filename=./acq_dump.dat @@ -1702,11 +1702,9 @@ Again, a class hierarchy consisting of a [TrackingInterface](./src/core/interfaces/tracking_interface.h) class and subclasses implementing algorithms provides a way of testing different approaches, with full access to their parameters. Check -[GpsL1CaDllPllTracking](./src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.h) -or -[GalileoE1DllPllVemlTracking](./src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.h) -for examples of adapters, and -[Gps_L1_Ca_Dll_Pll_Tracking_cc](./src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h) +[DllPllTrackingAdapter](./src/algorithms/tracking/adapters/dll_pll_tracking_adapter.h) +for an example of adapter, and +[dll_pll_veml_tracking](./src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h) for an example of a signal processing block implementation. There are also available some useful classes and functions for signal tracking; take a look at [cpu_multicorrelator.h](./src/algorithms/tracking/libs/cpu_multicorrelator.h), diff --git a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 69893257b..eadaba025 100644 --- a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -33,7 +33,6 @@ #include "gnss_sdr_sample_counter.h" #include "gnss_synchro.h" #include "gnuplot_i.h" -#include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_pcps_acquisition.h" #include "gps_l2_m_pcps_acquisition.h" #include "gps_l5i_pcps_acquisition.h" @@ -45,6 +44,7 @@ #include "telemetry_decoder_interface.h" #include "test_flags.h" #include "tlm_dump_reader.h" +#include "dll_pll_tracking_adapter.h" #include "tracking_dump_reader.h" #include "tracking_interface.h" #include "tracking_tests_flags.h" diff --git a/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index 370ef351d..63afcf770 100644 --- a/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -32,9 +32,9 @@ #include #endif #include "GPS_L1_CA.h" +#include "dll_pll_tracking_adapter.h" #include "gnss_block_interface.h" #include "gnss_synchro.h" -#include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_telemetry_decoder.h" #include "in_memory_configuration.h" #include "signal_generator_flags.h" @@ -400,7 +400,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) }) << "Failure opening true observables file"; top_block = gr::make_top_block("Telemetry_Decoder test"); - std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1C", 1, 1); + std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1C", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, GPS_1C); // std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1C", 1, 1); auto msg_rx = GpsL1CADllPllTelemetryDecoderTest_msg_rx_make(); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index 48fd5756e..318c1c53e 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -18,10 +18,10 @@ #include "concurrent_queue.h" +#include "dll_pll_tracking_adapter.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" -#include "gps_l2_m_dll_pll_tracking.h" #include "in_memory_configuration.h" #include "tracking_interface.h" #include @@ -163,7 +163,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) init(); queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); - std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_2S", 1, 1); + std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_2S", "GPS_L2_M_DLL_PLL_Tracking", 1, 1, GPS_2S); auto msg_rx = GpsL2MDllPllTrackingTest_msg_rx_make(); gnss_synchro.Acq_delay_samples = 1;