GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
glonass_gnav_ephemeris.h
Go to the documentation of this file.
1 /*!
2  * \file glonass_gnav_ephemeris.h
3  * \brief Interface of a GLONASS EPHEMERIS storage
4  * \note Code added as part of GSoC 2017 program
5  * \author Damian Miralles, 2017. dmiralles2009(at)gmail.com
6  * \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 
20 #ifndef GNSS_SDR_GLONASS_GNAV_EPHEMERIS_H
21 #define GNSS_SDR_GLONASS_GNAV_EPHEMERIS_H
22 
23 
24 #include "glonass_gnav_utc_model.h"
25 #include <boost/date_time/posix_time/ptime.hpp> // for ptime
26 #include <boost/serialization/nvp.hpp>
27 #include <cstdint>
28 
29 /** \addtogroup Core
30  * \{ */
31 /** \addtogroup System_Parameters
32  * \{ */
33 
34 
35 /*!
36  * \brief This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in GLONASS ICD (Edition 5.1)
37  * \note Code added as part of GSoC 2017 program
38  * \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
39  */
41 {
42 public:
43  /*!
44  * Default constructor
45  */
46  Glonass_Gnav_Ephemeris() = default;
47 
48  double d_m{}; //!< String number within frame [dimensionless]
49  double d_t_k{}; //!< GLONASS Time (UTC(SU) + 3 h) referenced to the beginning of the frame within the current day [s]
50  double d_t_b{}; //!< Reference ephemeris relative time in GLONASS Time (UTC(SU) + 3 h). Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. [s]
51  double d_M{}; //!< Type of satellite transmitting navigation signal [dimensionless]
52  double d_gamma_n{}; //!< Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the instant tb [dimensionless]
53  double d_tau_n{}; //!< Correction to the nth satellite time (tn) relative to GLONASS time (te),
54  double d_Xn{}; //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
55  double d_Yn{}; //!< Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km]
56  double d_Zn{}; //!< Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km]
57  double d_VXn{}; //!< Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s]
58  double d_VYn{}; //!< Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s]
59  double d_VZn{}; //!< Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s]
60  double d_AXn{}; //!< Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]
61  double d_AYn{}; //!< Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]
62  double d_AZn{}; //!< Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]
63  double d_B_n{}; //!< Health flag [dimensionless]
64  double d_P{}; //!< Technological parameter of control segment, indication the satellite operation mode in respect of time parameters [dimensionless]
65  double d_N_T{}; //!< Current date, calendar number of day within four-year interval starting from the 1-st of January in a leap year [days]
66  double d_F_T{}; //!< Parameter that provides the predicted satellite user range accuracy at time tb [dimensionless]
67  double d_n{}; //!< Index of the satellite transmitting given navigation signal. It corresponds to a slot number within GLONASS constellation
68  double d_Delta_tau_n{}; //!< Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal transmitted in L1 sub-band by nth satellite. [dimensionless]
69  double d_E_n{}; //!< Characterises "age" of a current information [days]
70  double d_P_1{}; //!< Flag of the immediate data updating [minutes]
71  bool d_P_2{}; //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless]
72  bool d_P_3{}; //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless]
73  bool d_P_4{}; //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless]
74  bool d_l3rd_n{}; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is healthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
75  bool d_l5th_n{}; //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is healthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
76 
77  // Immediate deliverables of ephemeris information
78  // Satellite Identification Information
79  int32_t i_satellite_freq_channel{}; //!< SV Frequency Channel Number
80  uint32_t PRN{}; //!< SV PRN Number, equivalent to slot number for compatibility with GPS
81  uint32_t i_satellite_slot_number{}; //!< SV Slot Number
82  double d_yr = 1972.0; //!< Current year
83  double d_satClkDrift{}; //!< GLONASS clock error
84  double d_dtr{}; //!< relativistic clock correction term
85  double d_iode{}; //!< Issue of data, ephemeris (Bit 0-6 of tb)
86  double d_tau_c{}; //!< GLONASST 2 UTC correction (todo) may be eliminated
87  double d_TOW{}; //!< GLONASST IN GPST seconds of week
88  int32_t d_WN{}; //!< GLONASST IN GPST week number of the start of frame
89  double d_tod{}; //!< Time of Day since ephemeris where decoded
90 
91  /*!
92  * \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
93  */
94  double sv_clock_drift(double transmitTime, double timeCorrUTC);
95 
96  /*!
97  * \brief Computes the GLONASS System Time and returns a boost::posix_time::ptime object
98  * \ param offset_time Is the start of day offset to compute the time
99  */
100  boost::posix_time::ptime compute_GLONASS_time(double offset_time) const;
101 
102  /*!
103  * \brief Converts from GLONASST to UTC
104  * \details The function simply adjust for the 6 hrs offset between GLONASST and UTC
105  * \param[in] offset_time Is the start of day offset
106  * \param[in] glot2utc_corr Correction from GLONASST to UTC
107  * \returns UTC time as a boost::posix_time::ptime object
108  */
109  boost::posix_time::ptime glot_to_utc(double offset_time, double glot2utc_corr) const;
110 
111  /*!
112  * \brief Converts from GLONASST to GPST
113  * \details Converts from GLONASST to GPST in time of week (TOW) and week number (WN) format
114  * \param[in] tod_offset Is the start of day offset
115  * \param[in] glot2utc_corr Correction from GLONASST to UTC
116  * \param[in] glot2gpst_corr Correction from GLONASST to GPST
117  * \param[out] WN Week Number, not in mod(1024) format
118  * \param[out] TOW Time of Week in seconds of week
119  */
120  void glot_to_gpst(double tod_offset, double glot2utc_corr, double glot2gpst_corr, int32_t* WN, double* TOW) const;
121 
122  template <class Archive>
123 
124  /*!
125  * \brief Serialize is a boost standard method to be called by the boost XML
126  * serialization. Here is used to save the ephemeris data on disk file.
127  */
128  void serialize(Archive& archive, const uint32_t version)
129  {
130  if (version)
131  {
132  };
133 
134  archive& BOOST_SERIALIZATION_NVP(i_satellite_freq_channel); //!< SV PRN frequency channel number
135  archive& BOOST_SERIALIZATION_NVP(PRN);
136  archive& BOOST_SERIALIZATION_NVP(i_satellite_slot_number);
137  archive& BOOST_SERIALIZATION_NVP(d_m); //!< String number within frame [dimensionless]
138  archive& BOOST_SERIALIZATION_NVP(d_t_k); //!< Time referenced to the beginning of the frame within the current day [hours, minutes, seconds]
139  archive& BOOST_SERIALIZATION_NVP(d_t_b); //!< Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. [minutes]
140  archive& BOOST_SERIALIZATION_NVP(d_M); //!< Type of satellite transmitting navigation signal [dimensionless]
141  archive& BOOST_SERIALIZATION_NVP(d_gamma_n); //!< Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the instant tb [dimensionless]
142  archive& BOOST_SERIALIZATION_NVP(d_tau_n); //!< Correction to the nth satellite time (tn) relative to GLONASS time (te)
143  archive& BOOST_SERIALIZATION_NVP(d_Xn); //!< Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
144  archive& BOOST_SERIALIZATION_NVP(d_Yn); //!< Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km]
145  archive& BOOST_SERIALIZATION_NVP(d_Zn); //!< Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km]
146  archive& BOOST_SERIALIZATION_NVP(d_VXn); //!< Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s]
147  archive& BOOST_SERIALIZATION_NVP(d_VYn); //!< Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s]
148  archive& BOOST_SERIALIZATION_NVP(d_VZn); //!< Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s]
149  archive& BOOST_SERIALIZATION_NVP(d_AXn); //!< Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]
150  archive& BOOST_SERIALIZATION_NVP(d_AYn); //!< Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]
151  archive& BOOST_SERIALIZATION_NVP(d_AZn); //!< Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]
152  archive& BOOST_SERIALIZATION_NVP(d_B_n); //!< Health flag [dimensionless]
153  archive& BOOST_SERIALIZATION_NVP(d_P); //!< Technological parameter of control segment, indication the satellite operation mode in respect of time parameters [dimensionless]
154  archive& BOOST_SERIALIZATION_NVP(d_N_T); //!< Current date, calendar number of day within four-year interval starting from the 1-st of January in a leap year [days]
155  archive& BOOST_SERIALIZATION_NVP(d_F_T); //!< Parameter that provides the predicted satellite user range accuracy at time tb [dimensionless]
156  archive& BOOST_SERIALIZATION_NVP(d_n); //!< Index of the satellite transmitting given navigation signal. It corresponds to a slot number within GLONASS constellation
157  archive& BOOST_SERIALIZATION_NVP(d_Delta_tau_n); //!< Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal transmitted in L1 sub-band by nth satellite. [dimensionless]
158  archive& BOOST_SERIALIZATION_NVP(d_E_n); //!< Characterises "age" of a current information [days]
159  archive& BOOST_SERIALIZATION_NVP(d_P_1); //!< Flag of the immediate data updating.
160  archive& BOOST_SERIALIZATION_NVP(d_P_2); //!< Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless]
161  archive& BOOST_SERIALIZATION_NVP(d_P_3); //!< Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corresponds to 5 satellites and "0" corresponds to 4 satellites [dimensionless]
162  archive& BOOST_SERIALIZATION_NVP(d_P_4); //!< Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency/time parameters have been uploaded by the control segment [dimensionless]
163  archive& BOOST_SERIALIZATION_NVP(d_l3rd_n); //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
164  archive& BOOST_SERIALIZATION_NVP(d_l5th_n); //!< Health flag for nth satellite; ln = 0 indicates the n-th satellite is helthy, ln = 1 indicates malfunction of this nth satellite [dimensionless]
165  }
166 
167 private:
168  /*
169  * Accounts for the beginning or end of week crossover
170  *
171  * \param[in] - time in seconds
172  * \param[out] - corrected time, in seconds
173  */
174  double check_t(double time);
175 };
176 
177 
178 /** \} */
179 /** \} */
180 #endif // GNSS_SDR_GLONASS_GNAV_EPHEMERIS_H
double d_AYn
Earth-fixed acceleration coordinate y of the satellite in PZ-90.02 coordinate system [km/s^2]...
bool d_l3rd_n
Health flag for nth satellite; ln = 0 indicates the n-th satellite is healthy, ln = 1 indicates malfu...
double d_VXn
Earth-fixed velocity coordinate x of the satellite in PZ-90.02 coordinate system [km/s].
double d_Delta_tau_n
Time difference between navigation RF signal transmitted in L2 sub- band and aviation RF signal trans...
double d_M
Type of satellite transmitting navigation signal [dimensionless].
double d_E_n
Characterises "age" of a current information [days].
double d_Yn
Earth-fixed coordinate y of the satellite in PZ-90.02 coordinate system [km].
int32_t i_satellite_freq_channel
SV Frequency Channel Number.
Interface of a GLONASS GNAV UTC MODEL storage.
double d_VYn
Earth-fixed velocity coordinate y of the satellite in PZ-90.02 coordinate system [km/s].
double d_tau_n
Correction to the nth satellite time (tn) relative to GLONASS time (te),.
bool d_l5th_n
Health flag for nth satellite; ln = 0 indicates the n-th satellite is healthy, ln = 1 indicates malfu...
double d_t_b
Reference ephemeris relative time in GLONASS Time (UTC(SU) + 3 h). Index of a time interval within cu...
double d_B_n
Health flag [dimensionless].
double d_t_k
GLONASS Time (UTC(SU) + 3 h) referenced to the beginning of the frame within the current day [s]...
void glot_to_gpst(double tod_offset, double glot2utc_corr, double glot2gpst_corr, int32_t *WN, double *TOW) const
Converts from GLONASST to GPST.
double d_yr
Current year.
double d_AZn
Earth-fixed acceleration coordinate z of the satellite in PZ-90.02 coordinate system [km/s^2]...
double d_tau_c
GLONASST 2 UTC correction (todo) may be eliminated.
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
double d_F_T
Parameter that provides the predicted satellite user range accuracy at time tb [dimensionless].
int32_t d_WN
GLONASST IN GPST week number of the start of frame.
double d_Xn
Earth-fixed coordinate x of the satellite in PZ-90.02 coordinate system [km].
double d_m
String number within frame [dimensionless].
double d_tod
Time of Day since ephemeris where decoded.
Glonass_Gnav_Ephemeris()=default
double d_TOW
GLONASST IN GPST seconds of week.
void serialize(Archive &archive, const uint32_t version)
Serialize is a boost standard method to be called by the boost XML serialization. Here is used to sav...
double d_VZn
Earth-fixed velocity coordinate z of the satellite in PZ-90.02 coordinate system [km/s].
bool d_P_4
Flag to show that ephemeris parameters are present. "1" indicates that updated ephemeris or frequency...
double d_gamma_n
Relative deviation of predicted carrier frequency value of n- satellite from nominal value at the ins...
double sv_clock_drift(double transmitTime, double timeCorrUTC)
Sets (d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clo...
boost::posix_time::ptime compute_GLONASS_time(double offset_time) const
Computes the GLONASS System Time and returns a boost::posix_time::ptime object \ param offset_time Is...
double d_AXn
Earth-fixed acceleration coordinate x of the satellite in PZ-90.02 coordinate system [km/s^2]...
uint32_t i_satellite_slot_number
SV Slot Number.
boost::posix_time::ptime glot_to_utc(double offset_time, double glot2utc_corr) const
Converts from GLONASST to UTC.
bool d_P_3
Flag indicating a number of satellites for which almanac is transmitted within given frame: "1" corre...
double d_P
Technological parameter of control segment, indication the satellite operation mode in respect of tim...
bool d_P_2
Flag of oddness ("1") or evenness ("0") of the value of (tb) [dimensionless].
double d_satClkDrift
GLONASS clock error.
double d_Zn
Earth-fixed coordinate z of the satellite in PZ-90.02 coordinate system [km].
double d_N_T
Current date, calendar number of day within four-year interval starting from the 1-st of January in a...
double d_dtr
relativistic clock correction term
double d_iode
Issue of data, ephemeris (Bit 0-6 of tb)
uint32_t PRN
SV PRN Number, equivalent to slot number for compatibility with GPS.
double d_P_1
Flag of the immediate data updating [minutes].
double d_n
Index of the satellite transmitting given navigation signal. It corresponds to a slot number within G...