GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
gps_cnav_ephemeris.h
Go to the documentation of this file.
1 /*!
2  * \file gps_cnav_ephemeris.h
3  * \brief Interface of a GPS CNAV EPHEMERIS storage
4  * \author Javier Arribas, 2015. jarribas(at)cttc.es
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 
18 #ifndef GNSS_SDR_GPS_CNAV_EPHEMERIS_H
19 #define GNSS_SDR_GPS_CNAV_EPHEMERIS_H
20 
21 #include <boost/serialization/nvp.hpp>
22 #include <cstdint>
23 
24 /** \addtogroup Core
25  * \{ */
26 /** \addtogroup System_Parameters
27  * \{ */
28 
29 
30 /*!
31  * \brief This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-GPS-200K
32  *
33  * See https://www.gps.gov/technical/icwg/IS-GPS-200K.pdf Appendix III
34  */
36 {
37 public:
38  /*!
39  * Default constructor
40  */
41  Gps_CNAV_Ephemeris() = default;
42 
43  /*!
44  * \brief Compute the ECEF SV coordinates and ECEF velocity
45  * Implementation of Table 20-IV (IS-GPS-200K)
46  */
47  double satellitePosition(double transmitTime);
48 
49  /*!
50  * \brief Sets (\a d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clock Correction
51  * (IS-GPS-200K, 20.3.3.3.3.1)
52  */
53  double sv_clock_drift(double transmitTime);
54 
55  /*!
56  * \brief Sets (\a d_dtr) and returns the clock relativistic correction term in seconds according to the User Algorithm for SV Clock Correction
57  * (IS-GPS-200K, 20.3.3.3.3.1)
58  */
59  double sv_clock_relativistic_term(double transmitTime);
60 
61  uint32_t i_satellite_PRN{}; // SV PRN NUMBER
62 
63  // Message Types 10 and 11 Parameters (1 of 2)
64  int32_t i_GPS_week{}; //!< GPS week number, aka WN [week]
65  int32_t i_URA{}; //!< ED Accuracy Index
66  int32_t i_signal_health{}; //!< Signal health (L1/L2/L5)
67  int32_t d_Top{}; //!< Data predict time of week
68  double d_DELTA_A{}; //!< Semi-major axis difference at reference time
69  double d_A_DOT{}; //!< Change rate in semi-major axis
70  double d_Delta_n{}; //!< Mean Motion Difference From Computed Value [semi-circles/s]
71  double d_DELTA_DOT_N{}; //!< Rate of mean motion difference from computed value
72  double d_M_0{}; //!< Mean Anomaly at Reference Time [semi-circles]
73  double d_e_eccentricity{}; //!< Eccentricity
74  double d_OMEGA{}; //!< Argument of Perigee [semi-cicles]
75  double d_OMEGA0{}; //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-cicles]
76  int32_t d_Toe1{}; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200K) [s]
77  int32_t d_Toe2{}; //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200K) [s]
78  double d_DELTA_OMEGA_DOT{}; //!< Rate of Right Ascension difference [semi-circles/s]
79  double d_i_0{}; //!< Inclination Angle at Reference Time [semi-circles]
80  double d_IDOT{}; //!< Rate of Inclination Angle [semi-circles/s]
81  double d_Cis{}; //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad]
82  double d_Cic{}; //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad]
83  double d_Crs{}; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
84  double d_Crc{}; //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m]
85  double d_Cus{}; //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad]
86  double d_Cuc{}; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
87 
88  // Clock Correction and Accuracy Parameters
89  int32_t d_Toc{}; //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200K) [s]
90  double d_A_f0{}; //!< Coefficient 0 of code phase offset model [s]
91  double d_A_f1{}; //!< Coefficient 1 of code phase offset model [s/s]
92  double d_A_f2{}; //!< Coefficient 2 of code phase offset model [s/s^2]
93 
94  double d_URA0{}; //!< NED Accuracy Index
95  double d_URA1{}; //!< NED Accuracy Change Index
96  double d_URA2{}; //!< NED Accuracy Change Rate Index
97 
98  // Group Delay Differential Parameters
99  double d_TGD{}; //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
100  double d_ISCL1{};
101  double d_ISCL2{};
102  double d_ISCL5I{};
103  double d_ISCL5Q{};
104 
105  int32_t d_TOW{}; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
106 
107  // clock terms derived from ephemeris data
108  double d_satClkDrift{}; //!< GPS clock error
109  double d_dtr{}; //!< relativistic clock correction term
110 
111  // satellite positions
112  double d_satpos_X{}; //!< Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and the plane passing through the origin and normal to the Z-axis.
113  double d_satpos_Y{}; //!< Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system.
114  double d_satpos_Z{}; //!< Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP).
115 
116  // Satellite velocity
117  double d_satvel_X{}; //!< Earth-fixed velocity coordinate x of the satellite [m]
118  double d_satvel_Y{}; //!< Earth-fixed velocity coordinate y of the satellite [m]
119  double d_satvel_Z{}; //!< Earth-fixed velocity coordinate z of the satellite [m]
120 
121  /*! \brief If true, enhanced level of integrity assurance.
122  *
123  * If false, indicates that the conveying signal is provided with the legacy level of integrity assurance.
124  * That is, the probability that the instantaneous URE of the conveying signal exceeds 4.42 times the upper bound
125  * value of the current broadcast URA index, for more than 5.2 seconds, without an accompanying alert, is less
126  * than 1E-5 per hour. If true, indicates that the conveying signal is provided with an enhanced level of
127  * integrity assurance. That is, the probability that the instantaneous URE of the conveying signal exceeds 5.73
128  * times the upper bound value of the current broadcast URA index, for more than 5.2 seconds, without an
129  * accompanying alert, is less than 1E-8 per hour.
130  */
132  bool b_l2c_phasing_flag{};
133  bool b_alert_flag{}; //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk.
134  bool b_antispoofing_flag{}; //!< If true, the AntiSpoofing mode is ON in that SV
135 
136  template <class Archive>
137 
138  /*!
139  * \brief Serialize is a boost standard method to be called by the boost XML serialization. Here is used to save the ephemeris data on disk file.
140  */
141  inline void serialize(Archive& archive, const uint32_t version)
142  {
143  using boost::serialization::make_nvp;
144  if (version)
145  {
146  };
147 
148  archive& make_nvp("i_satellite_PRN", i_satellite_PRN); // SV PRN NUMBER
149  archive& make_nvp("d_TOW", d_TOW); //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
150  archive& make_nvp("d_Crs", d_Crs); //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]
151  archive& make_nvp("d_M_0", d_M_0); //!< Mean Anomaly at Reference Time [semi-circles]
152  archive& make_nvp("d_Cuc", d_Cuc); //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
153  archive& make_nvp("d_e_eccentricity", d_e_eccentricity); //!< Eccentricity [dimensionless]
154  archive& make_nvp("d_Cus", d_Cus); //!< Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad]
155  archive& make_nvp("d_Toe1", d_Toe1); //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200K) [s]
156  archive& make_nvp("d_Toe2", d_Toe2); //!< Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200K) [s]
157  archive& make_nvp("d_Toc", d_Toc); //!< clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200K) [s]
158  archive& make_nvp("d_Cic", d_Cic); //!< Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad]
159  archive& make_nvp("d_OMEGA0", d_OMEGA0); //!< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles]
160  archive& make_nvp("d_Cis", d_Cis); //!< Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad]
161  archive& make_nvp("d_i_0", d_i_0); //!< Inclination Angle at Reference Time [semi-circles]
162  archive& make_nvp("d_Crc", d_Crc); //!< Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m]
163  archive& make_nvp("d_OMEGA", d_OMEGA); //!< Argument of Perigee [semi-cicles]
164  archive& make_nvp("d_IDOT", d_IDOT); //!< Rate of Inclination Angle [semi-circles/s]
165  archive& make_nvp("i_GPS_week", i_GPS_week); //!< GPS week number, aka WN [week]
166  archive& make_nvp("d_TGD", d_TGD); //!< Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
167  archive& make_nvp("d_ISCL1", d_ISCL1); //!< Estimated Group Delay Differential: L1P(Y)-L1C/A correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
168  archive& make_nvp("d_ISCL2", d_ISCL2); //!< Estimated Group Delay Differential: L1P(Y)-L2C correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
169  archive& make_nvp("d_ISCL5I", d_ISCL5I); //!< Estimated Group Delay Differential: L1P(Y)-L5i correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
170  archive& make_nvp("d_ISCL5Q", d_ISCL5Q); //!< Estimated Group Delay Differential: L1P(Y)-L5q correction term only for the benefit of "L1 P(Y)" or "L2 P(Y)" s users [s]
171 
172  archive& make_nvp("d_DELTA_A", d_DELTA_A); //!< Semi-major axis difference at reference time [m]
173  archive& make_nvp("d_A_DOT", d_A_DOT); //!< Change rate in semi-major axis [m/s]
174  archive& make_nvp("d_DELTA_OMEGA_DOT", d_DELTA_OMEGA_DOT); //!< Rate of Right Ascension difference [semi-circles/s]
175  archive& make_nvp("d_A_f0", d_A_f0); //!< Coefficient 0 of code phase offset model [s]
176  archive& make_nvp("d_A_f1", d_A_f1); //!< Coefficient 1 of code phase offset model [s/s]
177  archive& make_nvp("d_A_f2", d_A_f2); //!< Coefficient 2 of code phase offset model [s/s^2]
178 
179  archive& make_nvp("b_integrity_status_flag", b_integrity_status_flag);
180  archive& make_nvp("b_alert_flag", b_alert_flag); //!< If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our own risk.
181  archive& make_nvp("b_antispoofing_flag", b_antispoofing_flag); //!< If true, the AntiSpoofing mode is ON in that SV
182  }
183 
184 private:
185  double check_t(double time);
186 };
187 
188 
189 /** \} */
190 /** \} */
191 #endif // GNSS_SDR_GPS_CNAV_EPHEMERIS_H
double d_Cis
Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination [rad]. ...
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
double d_satpos_X
Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and ...
double d_satvel_Z
Earth-fixed velocity coordinate z of the satellite [m].
double d_OMEGA
Argument of Perigee [semi-cicles].
double d_Delta_n
Mean Motion Difference From Computed Value [semi-circles/s].
double d_satClkDrift
GPS clock error.
double d_satvel_Y
Earth-fixed velocity coordinate y of the satellite [m].
double d_DELTA_A
Semi-major axis difference at reference time.
double d_OMEGA0
Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-cicles].
double d_satpos_Y
Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system.
double d_A_f1
Coefficient 1 of code phase offset model [s/s].
int32_t i_signal_health
Signal health (L1/L2/L5)
double d_DELTA_OMEGA_DOT
Rate of Right Ascension difference [semi-circles/s].
bool b_antispoofing_flag
If true, the AntiSpoofing mode is ON in that SV.
double d_M_0
Mean Anomaly at Reference Time [semi-circles].
double sv_clock_relativistic_term(double transmitTime)
Sets (d_dtr) and returns the clock relativistic correction term in seconds according to the User Algo...
int32_t d_Toe2
Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200K) [s].
double d_A_f2
Coefficient 2 of code phase offset model [s/s^2].
double d_Cus
Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude [rad]. ...
double d_Crs
Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m].
double d_IDOT
Rate of Inclination Angle [semi-circles/s].
double d_TGD
Estimated Group Delay Differential: L1-L2 correction term only for the benefit of "L1 P(Y)" or "L2 P(...
int32_t i_GPS_week
GPS week number, aka WN [week].
bool b_alert_flag
If true, indicates that the SV URA may be worse than indicated in d_SV_accuracy, use that SV at our o...
bool b_integrity_status_flag
If true, enhanced level of integrity assurance.
double d_Cic
Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination [rad].
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_Crc
Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius [m].
double d_satvel_X
Earth-fixed velocity coordinate x of the satellite [m].
int32_t d_Toe1
Ephemeris data reference time of week (Ref. 20.3.3.4.3 IS-GPS-200K) [s].
int32_t i_URA
ED Accuracy Index.
double sv_clock_drift(double transmitTime)
Sets (d_satClkDrift)and returns the clock drift in seconds according to the User Algorithm for SV Clo...
double d_A_DOT
Change rate in semi-major axis.
int32_t d_TOW
Time of GPS Week of the ephemeris set (taken from subframes TOW) [s].
double satellitePosition(double transmitTime)
Compute the ECEF SV coordinates and ECEF velocity Implementation of Table 20-IV (IS-GPS-200K) ...
double d_Cuc
Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad].
double d_satpos_Z
Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotatio...
int32_t d_Top
Data predict time of week.
double d_URA0
NED Accuracy Index.
Gps_CNAV_Ephemeris()=default
double d_URA1
NED Accuracy Change Index.
int32_t d_Toc
clock data reference time (Ref. 20.3.3.3.3.1 IS-GPS-200K) [s]
double d_URA2
NED Accuracy Change Rate Index.
double d_A_f0
Coefficient 0 of code phase offset model [s].
double d_i_0
Inclination Angle at Reference Time [semi-circles].
double d_DELTA_DOT_N
Rate of mean motion difference from computed value.
double d_e_eccentricity
Eccentricity.
double d_dtr
relativistic clock correction term