diff --git a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt index b3361d57c..a471dbd5f 100644 --- a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt @@ -15,6 +15,7 @@ set(TELEMETRY_DECODER_ADAPTER_SOURCES galileo_e1b_telemetry_decoder.cc sbas_l1_telemetry_decoder.cc galileo_e5a_telemetry_decoder.cc + galileo_e5b_telemetry_decoder.cc glonass_l1_ca_telemetry_decoder.cc glonass_l2_ca_telemetry_decoder.cc beidou_b1i_telemetry_decoder.cc @@ -28,6 +29,7 @@ set(TELEMETRY_DECODER_ADAPTER_HEADERS galileo_e1b_telemetry_decoder.h sbas_l1_telemetry_decoder.h galileo_e5a_telemetry_decoder.h + galileo_e5b_telemetry_decoder.h glonass_l1_ca_telemetry_decoder.h glonass_l2_ca_telemetry_decoder.h beidou_b1i_telemetry_decoder.h diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc new file mode 100644 index 000000000..693bea08d --- /dev/null +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc @@ -0,0 +1,93 @@ +/*! + * \file galileo_e5b_telemetry_decoder.cc + * \brief Interface of an adapter of a GALILEO E5B NAV data decoder block + * to a TelemetryDecoderInterface + * \author Piyush Gupta 2020 piyush04111999@gmail.com. + * \note Code added as part of GSoC 2020 Program. + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ------------------------------------------------------------------------- + */ + + +#include "galileo_e5b_telemetry_decoder.h" +#include "configuration_interface.h" +#include + + +GalileoE5bTelemetryDecoder::GalileoE5bTelemetryDecoder( + const ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams) : role_(role), + in_streams_(in_streams), + out_streams_(out_streams) +{ + const std::string default_dump_filename("./navigation.dat"); + DLOG(INFO) << "role " << role; + dump_ = configuration->property(role + ".dump", false); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); + // make telemetry decoder object + telemetry_decoder_ = galileo_make_telemetry_decoder_gs(satellite_, 1, dump_); // unified galileo decoder set to INAV (frame_type=1) + DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; + channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +void GalileoE5bTelemetryDecoder::set_satellite(const Gnss_Satellite& satellite) +{ + satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); + telemetry_decoder_->set_satellite(satellite_); + DLOG(INFO) << "GALILEO TELEMETRY DECODER: satellite set to " << satellite_; +} + + +void GalileoE5bTelemetryDecoder::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { + /* top_block is not null */ + }; + // Nothing to connect internally + DLOG(INFO) << "nothing to connect internally"; +} + + +void GalileoE5bTelemetryDecoder::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { + /* top_block is not null */ + }; + // Nothing to disconnect +} + + +gr::basic_block_sptr GalileoE5bTelemetryDecoder::get_left_block() +{ + return telemetry_decoder_; +} + + +gr::basic_block_sptr GalileoE5bTelemetryDecoder::get_right_block() +{ + return telemetry_decoder_; +} \ No newline at end of file diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.h new file mode 100644 index 000000000..cb16fb976 --- /dev/null +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.h @@ -0,0 +1,109 @@ +/*! + * \file galileo_e5b_telemetry_decoder.h + * \brief Interface of an adapter of a GALILEO E5B NAV data decoder block + * to a TelemetryDecoderInterface + * \author Piyush Gupta 2020 piyush04111999@gmail.com. + * \note Code added as part of GSoC 2020 Program. + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_GALILEO_E5B_TELEMETRY_DECODER_H +#define GNSS_SDR_GALILEO_E5B_TELEMETRY_DECODER_H + +#include "galileo_telemetry_decoder_gs.h" +#include "gnss_satellite.h" +#include "gnss_synchro.h" +#include "telemetry_decoder_interface.h" +#include // for basic_block_sptr, top_block_sptr +#include // for size_t +#include + + +class ConfigurationInterface; + +/*! + * \brief This class implements a NAV data decoder for Galileo INAV frames in E5b radio link + */ +class GalileoE5bTelemetryDecoder : public TelemetryDecoderInterface +{ +public: + GalileoE5bTelemetryDecoder( + const ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams); + + ~GalileoE5bTelemetryDecoder() = default; + + /*! + * \brief Returns "Galileo_E5b_Telemetry_Decoder" + */ + inline std::string implementation() override + { + return "Galileo_E5b_Telemetry_Decoder"; + } + + /*! + * \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; + + void set_satellite(const Gnss_Satellite& satellite) override; + + inline std::string role() override + { + return role_; + } + + inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); } + + inline void reset() override + { + telemetry_decoder_->reset(); + } + + inline size_t item_size() override + { + return sizeof(Gnss_Synchro); + } + +private: + galileo_telemetry_decoder_gs_sptr telemetry_decoder_; + Gnss_Satellite satellite_; + std::string dump_filename_; + std::string role_; + int channel_; + unsigned int in_streams_; + unsigned int out_streams_; + bool dump_; +}; + +#endif // GNSS_SDR_GALELIO_E5B_TELEMETRY_DECODER_H \ No newline at end of file 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 2ead676df..8dd89649e 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 @@ -21,6 +21,7 @@ #include "galileo_telemetry_decoder_gs.h" #include "Galileo_E1.h" // for GALILEO_E1_CODE_PERIOD_MS #include "Galileo_E5a.h" // for GALILEO_E5A_CODE_PERIO... +#include "Galileo_E5b.h" // for GALILEO_E5B_CODE_PERIOD_MS #include "convolutional.h" #include "display.h" #include "galileo_almanac_helper.h" // for Galileo_Almanac_Helper @@ -73,7 +74,14 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( { case 1: // INAV { - d_PRN_code_period_ms = static_cast(GALILEO_E1_CODE_PERIOD_MS); + if (signal == '1') + { + d_PRN_code_period_ms = static_cast(GALILEO_E1_CODE_PERIOD_MS); + } + else if (signal == '7') + { + d_PRN_code_period_ms = static_cast(GALILEO_E5B_CODE_PERIOD_MS * GALILEO_E5B_I_SECONDARY_CODE_LENGTH); + } d_bits_per_preamble = GALILEO_INAV_PREAMBLE_LENGTH_BITS; // set the preamble d_samples_per_preamble = GALILEO_INAV_PREAMBLE_LENGTH_BITS; @@ -256,11 +264,25 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.split_page(page_String, flag_even_word_arrived); if (d_inav_nav.get_flag_CRC_test() == true) { - DLOG(INFO) << "Galileo E1 CRC correct in channel " << d_channel << " from satellite " << d_satellite; + if (signal == '1') + { + DLOG(INFO) << "Galileo E1 CRC correct in channel " << d_channel << " from satellite " << d_satellite; + } + else if (signal == '7') + { + DLOG(INFO) << "Galileo E5b CRC correct in channel " << d_channel << " from satellite " << d_satellite; + } } else { - DLOG(INFO) << "Galileo E1 CRC error in channel " << d_channel << " from satellite " << d_satellite; + if (signal == '1') + { + DLOG(INFO) << "Galileo E1 CRC error in channel " << d_channel << " from satellite " << d_satellite; + } + else if (signal == '7') + { + DLOG(INFO) << "Galileo E5b CRC error in channel " << d_channel << " from satellite " << d_satellite; + } } flag_even_word_arrived = 0; } @@ -276,21 +298,42 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_ephemeris()); - std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n'; + if (signal == '1') + { + std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n'; + } + else if (signal == '7') + { + std::cout << "New Galileo E5b I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n'; + } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } if (d_inav_nav.have_new_iono_and_GST() == true) { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_iono()); - std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n'; + if (signal == '1') + { + std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n'; + } + else if (signal == '7') + { + std::cout << "New Galileo E5b I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n'; + } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } if (d_inav_nav.have_new_utc_model() == true) { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_utc_model()); - std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n'; + if (signal == '1') + { + std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n'; + } + else if (signal == '7') + { + std::cout << "New Galileo E5b I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n'; + } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G_10), 64.0))); DLOG(INFO) << "delta_t=" << d_delta_t << "[s]"; @@ -300,7 +343,14 @@ 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_almanac()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); // debug - std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n'; + if (signal == '1') + { + std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n'; + } + else if (signal == '7') + { + std::cout << "Galileo E5b I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n'; + } DLOG(INFO) << "Current parameters:"; DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms; DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); @@ -433,6 +483,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // 1. Copy the current tracking output current_symbol = in[0][0]; // add new symbol to the symbol queue + signal = current_symbol.Signal[0]; switch (d_frame_type) { case 1: // INAV @@ -644,7 +695,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { // TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay d_TOW_at_Preamble_ms = static_cast(d_inav_nav.get_TOW5() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS); + d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); d_inav_nav.set_TOW5_flag(false); } @@ -652,13 +703,13 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { // TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay d_TOW_at_Preamble_ms = static_cast(d_inav_nav.get_TOW6() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS); + d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); d_inav_nav.set_TOW6_flag(false); } else { // this page has no timing information - d_TOW_at_current_symbol_ms += static_cast(GALILEO_E1_CODE_PERIOD_MS); // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD_S; + d_TOW_at_current_symbol_ms += static_cast(d_PRN_code_period_ms); // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD_S; } } break; 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 a3bce4eba..1c6b0dba9 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 @@ -70,6 +70,7 @@ public: int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); + private: friend galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs( const Gnss_Satellite &satellite, @@ -135,6 +136,8 @@ private: bool d_flag_parity; bool d_flag_preamble; bool d_dump; + + char signal; // This variable will store which signal we are dealing with (Galileo E1 or E5b) }; #endif // GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 02214b02e..91040fd78 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -57,6 +57,7 @@ #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 "glonass_l1_ca_dll_pll_c_aid_tracking.h" #include "glonass_l1_ca_dll_pll_tracking.h" #include "glonass_l1_ca_pcps_acquisition.h" @@ -1209,6 +1210,12 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams); block = std::move(block_); } + else if (implementation == "Galileo_E5b_Telemetry_Decoder") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); + block = std::move(block_); + } else if (implementation == "GLONASS_L1_CA_Telemetry_Decoder") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, @@ -1634,6 +1641,12 @@ std::unique_ptr GNSSBlockFactory::GetTlmBlock( out_streams); block = std::move(block_); } + else if (implementation == "Galileo_E5b_Telemetry_Decoder") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); + block = std::move(block_); + } else if (implementation == "GPS_L2C_Telemetry_Decoder") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, diff --git a/src/core/system_parameters/Galileo_E5b.h b/src/core/system_parameters/Galileo_E5b.h index 35759fc15..2ae446f8c 100644 --- a/src/core/system_parameters/Galileo_E5b.h +++ b/src/core/system_parameters/Galileo_E5b.h @@ -33,6 +33,7 @@ constexpr double GALILEO_E5B_CODE_CHIP_RATE_CPS = 1.023e7; //!< Galileo E5b c constexpr double GALILEO_E5B_I_TIERED_CODE_PERIOD_S = 0.004; //!< Galileo E5b-I tiered code period [s] constexpr double GALILEO_E5B_Q_TIERED_CODE_PERIOD_S = 0.100; //!< Galileo E5b-Q tiered code period [s] constexpr double GALILEO_E5B_CODE_PERIOD_S = 0.001; //!< Galileo E5b primary code period [s] +constexpr int32_t GALILEO_E5B_CODE_PERIOD_MS = 1; //!< Galileo E5b primary code period [ms] constexpr int32_t GALILEO_E5B_CODE_LENGTH_CHIPS = 10230; //!< Galileo E5b primary code length [chips] constexpr int32_t GALILEO_E5B_I_SECONDARY_CODE_LENGTH = 4; //!< Galileo E5b-I secondary code length [chips] constexpr int32_t GALILEO_E5B_Q_SECONDARY_CODE_LENGTH = 100; //!< Galileo E5b-Q secondary code length [chips] diff --git a/src/core/system_parameters/galileo_ephemeris.cc b/src/core/system_parameters/galileo_ephemeris.cc index 795219b69..f8d4e9af1 100644 --- a/src/core/system_parameters/galileo_ephemeris.cc +++ b/src/core/system_parameters/galileo_ephemeris.cc @@ -19,6 +19,7 @@ #include "galileo_ephemeris.h" #include "Galileo_E1.h" +#include "Galileo_E5b.h" #include diff --git a/src/core/system_parameters/galileo_navigation_message.h b/src/core/system_parameters/galileo_navigation_message.h index e222bc0eb..00ffacfaf 100644 --- a/src/core/system_parameters/galileo_navigation_message.h +++ b/src/core/system_parameters/galileo_navigation_message.h @@ -23,6 +23,7 @@ #define GNSS_SDR_GALILEO_NAVIGATION_MESSAGE_H #include "Galileo_E1.h" +#include "Galileo_E5b.h" #include "Galileo_INAV.h" #include "galileo_almanac_helper.h" #include "galileo_ephemeris.h"