1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-30 06:36:21 +00:00

[TAS-111] time synch check

This commit is contained in:
Cesare G. Martínez 2024-01-29 17:05:47 +01:00
parent 1263af9ec1
commit ba2e392a5d
5 changed files with 18 additions and 5 deletions

View File

@ -23,6 +23,7 @@
#include "gnss_satellite.h"
#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader
#include "pvt_interface.h"
#include "galileo_utc_model.h" // for Galileo_Utc_Model
#include <glog/logging.h> // for DLOG
#include <gnuradio/io_signature.h> // for gr::io_signature::make
#include <cmath>
@ -54,9 +55,11 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath,
osnma_msg_receiver::osnma_msg_receiver(
const std::string& pemFilePath,
const std::string& merkleFilePath) : gr::block("osnma_msg_receiver",
const std::string& merkleFilePath,
const Galileo_Utc_Model &utc_model) : gr::block("osnma_msg_receiver",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(0, 0, 0))
gr::io_signature::make(0, 0, 0)),
galileo_utc_model(utc_model)
{
d_dsm_reader = std::make_unique<OSNMA_DSM_Reader>();
d_crypto = std::make_unique<Gnss_Crypto>(pemFilePath, merkleFilePath);
@ -93,7 +96,9 @@ void osnma_msg_receiver::msg_handler_pvt_to_osnma(const pmt::pmt_t& msg)
{
try
{
d_receiver_time = wht::any_cast<std::time_t>(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block
// receive the UTC time
auto utc_time_from_pvt = wht::any_cast<std::time_t>(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block
}
catch (const pmt::exception& e)
{
@ -122,6 +127,7 @@ 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)
{

View File

@ -57,7 +57,7 @@ public:
private:
friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath);
osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath);
osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath, const Galileo_Utc_Model &galileo_utc_model);
void msg_handler_osnma(const pmt::pmt_t& msg);
void msg_handler_pvt_to_osnma(const pmt::pmt_t& msg);
@ -83,6 +83,7 @@ private:
std::array<uint8_t, 60> d_mack_message{}; // C: 480 b
OSNMA_data d_osnma_data{};
Galileo_Utc_Model galileo_utc_model;
bool d_new_data{false};
bool d_public_key_verified{false};
bool d_kroot_verified{false};

View File

@ -72,3 +72,8 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const
t_Utc = secondsOfWeekBeforeToday + t_Utc_daytime;
return t_Utc;
}
double Galileo_Utc_Model::UTC_time_to_GST(double t_Utc, int32_t WN) const
{
// TODO
}

View File

@ -43,6 +43,7 @@ public:
// double TOW;
double GST_to_UTC_time(double t_e, int32_t WN) const; //!< GST-UTC Conversion Algorithm and Parameters
double UTC_time_to_GST(double t_Utc, int32_t WN) const;
// Word type 6: GST-UTC conversion parameters
double A0{};

View File

@ -102,7 +102,7 @@ void NavData::generate_eph_iono_vector2()
for (auto& var : variables)
{
// extract the bits from the variable
uint64_t binary_representation;
uint64_t binary_representation; // FIXME types have more bits than the specification size, e.g. 32 bits vs 10 bits
memcpy(&binary_representation, var.first, var.second / 8);
// Append the bits to the buffer and update the bit count