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 80a94aab0..991fb6895 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 @@ -465,6 +465,8 @@ 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)); d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set + + d_flag_osnma_ephemeris = true; } else { @@ -514,6 +516,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; } + + d_flag_osnma_iono_and_time = true; } if (d_inav_nav.have_new_utc_model() == true) @@ -549,6 +553,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_delta_t = tmp_obj->A_0G + tmp_obj->A_1G * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G), 64.0))); DLOG(INFO) << "delta_t=" << d_delta_t << "[s]"; + + d_flag_osnma_utc_model = true; } if (d_inav_nav.have_new_almanac() == true) @@ -584,7 +590,9 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); } - if (d_band == '1' && d_inav_nav.have_new_nma() == true) + // get osnma message if the needed nav data is available + auto adkd_4_12_nav_data_available = d_flag_osnma_iono_and_time && d_flag_osnma_ephemeris; + if (d_band == '1' && d_inav_nav.have_new_nma() == true && adkd_4_12_nav_data_available == true && d_flag_osnma_utc_model == true) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_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 a6391a2e0..bad8c8fc5 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 @@ -155,6 +155,9 @@ private: bool d_there_are_e1_channels; bool d_there_are_e6_channels; bool d_use_ced; + bool d_flag_osnma_ephemeris; // flag to indicate if the ephemeris is complete for OSNMA processing + bool d_flag_osnma_utc_model; // flag to indicate if the GST conversion parameters are complete for OSNMA processing + bool d_flag_osnma_iono_and_time; // flag to indicate if the iono correction and time is complete for OSNMA processing }; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 565009dc7..7a500d788 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1387,15 +1387,17 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 24; + int32_t TOW_sf0 = TOW_5 - 24; // TODO - why not TOW_0? if (TOW_sf0 < 0) { TOW_sf0 += 604800; } nma_msg.TOW_sf0 = static_cast(TOW_sf0); - // TODO - draft for retrieving NavData for use during Tag verification. - nma_msg.t0e_1 = static_cast(t0e_1); - nma_msg.IOD_nav = static_cast(IOD_nav_1); +// nma_msg.TOW_sf0 = static_cast(TOW_0); + // get ephemeris, clock and iono correction datn and GST-UTC and GST-GPS converstion parameters (may be incomplete) + nma_msg.EphemerisData = get_ephemeris(); + nma_msg.IonoData = get_iono(); + nma_msg.UtcModelData = get_utc_model(); return nma_msg; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index d6139c7e0..13db80706 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -39,7 +39,9 @@ class ReedSolomon; // Forward declaration of the ReedSolomon class * \{ */ /** \addtogroup System_Parameters * \{ */ - +/*! + * \brief This class fills the OSNMA_msg structure with the data received from the telemetry blocks. + */ class OSNMA_msg { public: @@ -47,13 +49,15 @@ public: std::array mack{}; std::array hkroot{}; uint32_t PRN{}; - uint32_t WN_sf0{}; + uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already uint32_t TOW_sf0{}; - // TODO - NavData to be retrieved correctly std::vector EphemerisClockAndStatusData {}; std::vector TimingData {}; - uint32_t t0e_1{}; - uint32_t IOD_nav{}; + Galileo_Ephemeris EphemerisData {}; + Galileo_Iono IonoData {}; + Galileo_Utc_Model UtcModelData {}; + + }; /*!