1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-31 11:19:18 +00:00

[TAS-111] Refactor Galileo_Utc_Model and time synchronization in osnma_msg_receiver

In osnma_msg_receiver, the time synchronization between OSNMA subframes and local time has been updated. To facilitate this, the Galileo_Utc_Model has been refactored to be used statically, instead of being passed through the osnma_msg_receiver constructor. Additional changes include: adjusting variable declarations, adding an initialization method, altering the function GST_to_UTC_time to be static, and removing an unused instantiation of the model in osnma_msg_receiver.
This commit is contained in:
Cesare G. Martínez 2024-01-29 17:05:47 +01:00 committed by cesaaargm
parent ba2e392a5d
commit 51b4209535
4 changed files with 39 additions and 14 deletions

View File

@ -127,9 +127,11 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg)
// compare local time with OSNMA subframe time
d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,...
auto utc = galileo_utc_model.GST_to_UTC_time(d_GST_SIS, static_cast<int>(nma_msg->WN_sf0));
double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time
if(abs(d_GST_SIS - d_receiver_time) <= T_L)
// instantiate galileo_utc_model and call init function, then call GST_to_UTC_time
Galileo_Utc_Model::init(nma_msg->utc_data);
double_t utc = Galileo_Utc_Model::GST_to_UTC_time(static_cast<double>(d_GST_SIS), static_cast<int>(nma_msg->WN_sf0));
double_t T_L = 15.0; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time
if(abs(utc - d_receiver_time) <= T_L)
{
process_osnma_message(nma_msg);
}

View File

@ -72,6 +72,7 @@ private:
void read_mack_body();
void process_mack_message(const std::shared_ptr<OSNMA_msg>& osnma_msg);
// Galileo_Utc_Model galileo_utc_model;
boost::circular_buffer<MACK_message> d_old_mack_message;
boost::circular_buffer<NavData> d_old_navdata_buffer; // buffer that holds last 10 received navdata messages
std::unique_ptr<OSNMA_DSM_Reader> d_dsm_reader;
@ -91,7 +92,7 @@ private:
uint8_t d_Lt_min {}; // minimum equivalent tag length
uint32_t d_GST_0 {};
uint32_t d_GST_SIS {};
std::time_t d_receiver_time {};
std::time_t d_receiver_time {}; // PVT time computed by the local receiver
};

View File

@ -17,8 +17,19 @@
#include "galileo_utc_model.h"
#include <cmath>
void Galileo_Utc_Model::init(const Galileo_Utc_Model& data)
{
A0 = data.A0;
A1 = data.A1;
Delta_tLS = data.Delta_tLS;
Delta_tLSF = data.Delta_tLSF;
DN = data.DN;
tot = data.tot;
WNot = data.WNot;
WN_LSF = data.WN_LSF;
double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const
}
double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN)
{
double t_Utc;
double t_Utc_daytime;
@ -76,4 +87,5 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const
double Galileo_Utc_Model::UTC_time_to_GST(double t_Utc, int32_t WN) const
{
// TODO
return 0;
}

View File

@ -41,19 +41,29 @@ public:
*/
Galileo_Utc_Model() = default;
/**
* @brief Initialize the Galileo_UTC_Model with the provided data.
*
* This function initializes the Galileo_UTC_Model object with the given data.
*
* @param data The Galileo_UTC_Model object containing the data.
*/
static void init(const Galileo_Utc_Model& data);
// double TOW;
double GST_to_UTC_time(double t_e, int32_t WN) const; //!< GST-UTC Conversion Algorithm and Parameters
static double GST_to_UTC_time(double t_e, int32_t WN); //!< GST-UTC Conversion Algorithm and Parameters
double UTC_time_to_GST(double t_Utc, int32_t WN) const;
// TODO - make them private?
// Word type 6: GST-UTC conversion parameters
double A0{};
double A1{};
int32_t Delta_tLS{};
int32_t tot{}; //!< UTC data reference Time of Week [s]
int32_t WNot{}; //!< UTC data reference Week number [week]
int32_t WN_LSF{};
int32_t DN{};
int32_t Delta_tLSF{};
static double A0;
static double A1;
static int32_t Delta_tLS;
static int32_t tot; //!< UTC data reference Time of Week [s]
static int32_t WNot; //!< UTC data reference Week number [week]
static int32_t WN_LSF;
static int32_t DN;
static int32_t Delta_tLSF;
// GPS to Galileo GST conversion parameters
double A_0G{};