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