1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2026-04-28 17:51:25 +00:00

Add QZSS L5 decoding

This commit is contained in:
Carles Fernandez
2026-03-01 19:27:31 +01:00
parent 32648a8e9f
commit 9e14b75908
8 changed files with 106 additions and 63 deletions

View File

@@ -17,7 +17,7 @@
#include "qzss_l5_telemetry_decoder.h"
// #include "qzss_l5_telemetry_decoder_gs.h"
#include "gps_l5_telemetry_decoder_gs.h"
QzssL5TelemetryDecoder::QzssL5TelemetryDecoder(
@@ -30,5 +30,5 @@ QzssL5TelemetryDecoder::QzssL5TelemetryDecoder(
in_streams,
out_streams)
{
// TODO: InitializeDecoder(qzss_l5_make_telemetry_decoder_gs(satellite(), tlm_parameters_));
InitializeDecoder(gps_l5_make_telemetry_decoder_gs(satellite(), tlm_parameters_, CnavSystem::QZSS));
}

View File

@@ -3,10 +3,11 @@
* \brief Implementation of a NAV message demodulator block based on
* Kay Borre book MATLAB-based GPS receiver
* \author Javier Arribas, 2011. jarribas(at)cttc.es
* \author Carles Fernandez Prades, 2011-2026. cfernandez(at)cttc.es
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver

View File

@@ -3,12 +3,14 @@
* \brief Interface of a NAV message demodulator block based on
* Kay Borre book MATLAB-based GPS receiver
* \author Javier Arribas, 2011. jarribas(at)cttc.es
* \author Carles Fernandez Prades, 2011-2026. 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)
* Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@@ -35,7 +37,7 @@
* GNU Radio blocks for the demodulation of GNSS navigation messages.
* \{ */
enum class L1LnavSystem
enum class L1LnavSystem
{
GPS,
QZSS
@@ -81,7 +83,7 @@ private:
bool gps_word_parityCheck(uint32_t gpsword);
bool decode_subframe(double cn0, bool flag_invert);
L1LnavSystem d_system;
L1LnavSystem d_system;
std::unique_ptr<Gps_Navigation_Message> d_nav;
Gnss_Satellite d_satellite;
Nav_Message_Packet d_nav_msg_packet;

View File

@@ -2,13 +2,14 @@
* \file gps_l5_telemetry_decoder_gs.cc
* \brief Implementation of a CNAV message demodulator block
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
* \author Carles Fernandez Prades, 2017-2026. 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)
* Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@@ -42,32 +43,34 @@
#endif
gps_l5_telemetry_decoder_gs_sptr
gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf)
gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, CnavSystem system)
{
return gps_l5_telemetry_decoder_gs_sptr(new gps_l5_telemetry_decoder_gs(satellite, conf));
return gps_l5_telemetry_decoder_gs_sptr(new gps_l5_telemetry_decoder_gs(satellite, conf, system));
}
gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf) : telemetry_impl_interface("gps_l5_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_dump_filename(conf.dump_filename),
d_sample_counter(0),
d_last_valid_preamble(0),
d_channel(0),
d_TOW_at_current_symbol_ms(0U),
d_TOW_at_Preamble_ms(0U),
d_flag_PLL_180_deg_phase_locked(false),
d_flag_valid_word(false),
d_sent_tlm_failed_msg(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
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)
const Tlm_Conf &conf,
CnavSystem system) : telemetry_impl_interface("gps_l5_telemetry_decoder_gs",
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))),
d_system(system),
d_dump_filename(conf.dump_filename),
d_sample_counter(0),
d_last_valid_preamble(0),
d_channel(0),
d_TOW_at_current_symbol_ms(0U),
d_TOW_at_Preamble_ms(0U),
d_flag_PLL_180_deg_phase_locked(false),
d_flag_valid_word(false),
d_sent_tlm_failed_msg(false),
d_dump(conf.dump),
d_dump_mat(conf.dump_mat),
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)
{
configure_basic_outputs();
@@ -75,14 +78,23 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
{
// register nav message monitor out
this->message_port_register_out(pmt::mp("Nav_msg_from_TLM"));
d_nav_msg_packet.system = std::string("G");
d_nav_msg_packet.signal = std::string("L5");
if (d_system == CnavSystem::GPS)
{
d_nav_msg_packet.system = std::string("G");
d_nav_msg_packet.signal = std::string("L5");
}
else
{
d_nav_msg_packet.system = std::string("J");
d_nav_msg_packet.signal = std::string("J5");
}
}
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<Gps_CNAV_Navigation_Message>(d_system);
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "GPS L5 TELEMETRY PROCESSING: satellite " << d_satellite;
DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS") << " L5 TELEMETRY PROCESSING: satellite " << d_satellite;
// initialize the CNAV frame decoder (libswiftcnav)
cnav_msg_decoder_init(&d_cnav_decoder);
@@ -102,7 +114,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs(
gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs()
{
DLOG(INFO) << "GPS L5 Telemetry decoder block (channel " << d_channel << ") destructor called.";
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)
{
@@ -140,16 +152,19 @@ gps_l5_telemetry_decoder_gs::~gps_l5_telemetry_decoder_gs()
void gps_l5_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
DLOG(INFO) << "GPS L5 CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
d_CNAV_Message = Gps_CNAV_Navigation_Message();
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<Gps_CNAV_Navigation_Message>(d_system);
}
void gps_l5_telemetry_decoder_gs::set_channel(int32_t channel)
{
d_channel = channel;
d_CNAV_Message = Gps_CNAV_Navigation_Message();
DLOG(INFO) << "GPS L5 CNAV channel set to " << channel;
d_CNAV_Message = std::make_unique<Gps_CNAV_Navigation_Message>(d_system);
DLOG(INFO) << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS")
<< " L5 CNAV channel set to " << 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);
@@ -166,8 +181,10 @@ void gps_l5_telemetry_decoder_gs::reset()
}
int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)),
gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
// get pointers on in- and output gnss-synchro objects
auto *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
@@ -227,49 +244,52 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
d_nav_msg_packet.nav_message = raw_bits.to_string();
}
d_CNAV_Message.decode_page(raw_bits);
d_CNAV_Message->decode_page(raw_bits);
// Push the new navigation data to the queues
if (d_CNAV_Message.have_new_ephemeris() == true)
if (d_CNAV_Message->have_new_ephemeris() == true)
{
// get ephemeris object for this SV
const std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(d_CNAV_Message.get_ephemeris());
const std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(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
std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel
std::cout << TEXT_MAGENTA << "New " << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS")
<< " L5 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) << " dB-Hz" << TEXT_RESET << std::endl;
}
if (d_CNAV_Message.have_new_iono() == true)
if (d_CNAV_Message->have_new_iono() == true)
{
const std::shared_ptr<Gps_CNAV_Iono> tmp_obj = std::make_shared<Gps_CNAV_Iono>(d_CNAV_Message.get_iono());
const std::shared_ptr<Gps_CNAV_Iono> tmp_obj = std::make_shared<Gps_CNAV_Iono>(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
std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel
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
<< " with CN0=" << std::setprecision(2) << current_synchro_data.CN0_dB_hz << std::setprecision(default_precision)
<< " dB-Hz" << TEXT_RESET << std::endl;
}
if (d_CNAV_Message.have_new_utc_model() == true)
if (d_CNAV_Message->have_new_utc_model() == true)
{
const std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(d_CNAV_Message.get_utc_model());
const std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(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
std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel
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
<< " with CN0=" << std::setprecision(2) << current_synchro_data.CN0_dB_hz
<< std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl;
@@ -288,7 +308,8 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5I_SYMBOL_PERIOD_MS;
if (last_d_TOW_at_current_symbol_ms != 0 && std::llabs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - static_cast<int64_t>(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(GPS_L5I_SYMBOL_PERIOD_MS))
{
DLOG(INFO) << "Warning: GPS L5 TOW update in ch " << d_channel
DLOG(INFO) << "Warning: " << ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS")
<< " L5 TOW update in ch " << d_channel
<< " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - static_cast<int64_t>(last_d_TOW_at_current_symbol_ms) << " ms "
<< " with delay: " << delay << " msg tow: " << msg.tow * 6000 << " ms \n";
@@ -360,7 +381,9 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
}
catch (const std::ofstream::failure &e)
{
LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what();
LOG(WARNING) << "Exception writing Telemetry "
<< ((d_system == CnavSystem::GPS) ? "GPS" : "QZSS")
<< " L5 dump file " << e.what();
}
}
@@ -368,11 +391,11 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
if (d_tow_to_trk)
{
const std::shared_ptr<TOW_to_trk> tmp_tow_obj = std::make_shared<TOW_to_trk>(TOW_to_trk(
std::string("L5"),
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));
}

View File

@@ -2,12 +2,13 @@
* \file gps_l5_telemetry_decoder_gs.h
* \brief Interface of a CNAV message demodulator block
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
* \author Carles Fernandez Prades, 2017-2026. 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)
* Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@@ -42,7 +43,8 @@ using gps_l5_telemetry_decoder_gs_sptr = gnss_shared_ptr<gps_l5_telemetry_decode
gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf);
const Tlm_Conf &conf,
CnavSystem system = CnavSystem::GPS);
/*!
* \brief This class implements a GPS L5 Telemetry decoder
@@ -61,15 +63,17 @@ public:
private:
friend gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs(
const Gnss_Satellite &satellite,
const Tlm_Conf &conf);
const Tlm_Conf &conf,
CnavSystem system);
gps_l5_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
gps_l5_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, CnavSystem system);
cnav_msg_decoder_t d_cnav_decoder{};
Gnss_Satellite d_satellite;
CnavSystem d_system;
Gps_CNAV_Navigation_Message d_CNAV_Message;
std::unique_ptr<Gps_CNAV_Navigation_Message> d_CNAV_Message;
Nav_Message_Packet d_nav_msg_packet;
std::unique_ptr<Tlm_CRC_Stats> d_Tlm_CRC_Stats;

View File

@@ -22,12 +22,18 @@
#include <limits> // for std::numeric_limits
Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message(CnavSystem system)
: d_system(system)
{
Gnss_Satellite gnss_satellite_ = Gnss_Satellite();
for (uint32_t prn_ = 1; prn_ < 33; prn_++)
auto gnss_satellite = Gnss_Satellite();
const std::string sys_str = (d_system == CnavSystem::GPS) ? "GPS" : "QZSS";
const uint32_t prn_min = (d_system == CnavSystem::GPS) ? 1 : 193;
const uint32_t prn_max = (d_system == CnavSystem::GPS) ? 32 : 202;
for (uint32_t prn_ = prn_min; prn_ <= prn_max; ++prn_)
{
satelliteBlock[prn_] = gnss_satellite_.what_block("GPS", prn_);
satelliteBlock[prn_] = gnss_satellite.what_block(sys_str, prn_);
}
b_flag_iono_valid = false;
b_flag_utc_valid = false;

View File

@@ -2,13 +2,14 @@
* \file gps_cnav_navigation_message.h
* \brief Interface of a GPS CNAV Data message decoder
* \author Javier Arribas, 2015. jarribas(at)cttc.es
* \author Carles Fernandez Prades, 2015-2026. 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)
* Copyright (C) 2010-2026 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@@ -35,6 +36,11 @@
/** \addtogroup System_Parameters
* \{ */
enum class CnavSystem
{
GPS,
QZSS
};
/*!
* \brief This class decodes a GPS CNAV Data message as described in IS-GPS-200M
@@ -47,7 +53,7 @@ public:
/*!
* Default constructor
*/
Gps_CNAV_Navigation_Message();
explicit Gps_CNAV_Navigation_Message(CnavSystem system = CnavSystem::GPS);
void decode_page(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& data_bits);
@@ -92,6 +98,7 @@ private:
std::map<int32_t, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs https://www.navcen.uscg.gov/?Do=constellationStatus
CnavSystem d_system;
int32_t d_TOW{};
bool b_flag_ephemeris_1{};

View File

@@ -157,7 +157,7 @@ private:
std::map<int32_t, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs https://www.navcen.uscg.gov/?Do=constellationStatus
LnavSystem d_system;
// broadcast orbit 1
int32_t d_TOW{}; // Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
int32_t d_TOW_SF1{}; // Time of GPS Week from HOW word of Subframe 1 [s]