Line |
Branch |
Exec |
Source |
1 |
|
|
// This file is part of INSTINCT, the INS Toolkit for Integrated |
2 |
|
|
// Navigation Concepts and Training by the Institute of Navigation of |
3 |
|
|
// the University of Stuttgart, Germany. |
4 |
|
|
// |
5 |
|
|
// This Source Code Form is subject to the terms of the Mozilla Public |
6 |
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this |
7 |
|
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/. |
8 |
|
|
|
9 |
|
|
/// @file IRNSSEphemeris.hpp |
10 |
|
|
/// @brief IRNSS Ephemeris information |
11 |
|
|
/// @author P. Peitschat (Hiwi) |
12 |
|
|
/// @author T. Topp (topp@ins.uni-stuttgart.de) |
13 |
|
|
/// @date 2023-10-24 |
14 |
|
|
|
15 |
|
|
#pragma once |
16 |
|
|
|
17 |
|
|
#include <bitset> |
18 |
|
|
|
19 |
|
|
#include "Navigation/GNSS/Satellite/internal/SatNavData.hpp" |
20 |
|
|
|
21 |
|
|
#include "Navigation/Time/InsTime.hpp" |
22 |
|
|
|
23 |
|
|
namespace NAV |
24 |
|
|
{ |
25 |
|
|
|
26 |
|
|
/// @brief Broadcasted ephemeris message data |
27 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, Table 11, p.19 and Table 12, p.20 |
28 |
|
|
class IRNSSEphemeris final : public SatNavData |
29 |
|
|
{ |
30 |
|
|
public: |
31 |
|
|
// ####################################################################################################### |
32 |
|
|
// Members |
33 |
|
|
// ####################################################################################################### |
34 |
|
|
|
35 |
|
|
// ------------------------------------------ Time Parameters -------------------------------------------- |
36 |
|
|
|
37 |
|
|
/// @brief Time of Clock |
38 |
|
|
const InsTime toc; |
39 |
|
|
|
40 |
|
|
/// @brief Time of Ephemeris |
41 |
|
|
const InsTime toe; |
42 |
|
|
|
43 |
|
|
/// @brief Issue of Data for Ephemeris and Clock |
44 |
|
|
/// |
45 |
|
|
/// 8-bit number which indicates the issue number of the data set. |
46 |
|
|
/// Provides the user with a convenient means of detecting any change in the ephemeris and clock parameters. |
47 |
|
|
/// |
48 |
|
|
/// The IODEC values can be found according to the following table: |
49 |
|
|
/// ----------------------------------------------------------------------------------------------------------------------------- |
50 |
|
|
/// IODEC range | Update | Description |
51 |
|
|
/// ----------------------------------------------------------------------------------------------------------------------------- |
52 |
|
|
/// 0 to 11(12 sets) | 2 hours | Nominal set for current day, uplinked in advance with broadcast ephemeris and clock parameters |
53 |
|
|
/// 12 to 23 | 2 hours | For update to nominal sets |
54 |
|
|
/// 24 to 29 | 4 hours | For the ephemeris and clock parameters with update rate greater than 2 hours |
55 |
|
|
/// 30 to 75 | ----- reserved for future ----- |
56 |
|
|
/// 76 to 159 | 2 hours | During AutoNav mode of operation, IODEC values are in the range . |
57 |
|
|
/// 160 to 255 | < 30 min | For the ephemeris and clock parameters with update rate lesser than 30 minutes |
58 |
|
|
/// ----------------------------------------------------------------------------------------------------------------------------- |
59 |
|
|
|
60 |
|
|
/// |
61 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, ch. 6.2.1.3, p.29 f. |
62 |
|
|
const size_t IODEC; |
63 |
|
|
|
64 |
|
|
/// Polynomial coefficients for clock correction |
65 |
|
|
/// - a(0) bias [s] |
66 |
|
|
/// - a(1) drift [s/s] |
67 |
|
|
/// - a(2) drift rate (aging) [s/s^2] |
68 |
|
|
/// |
69 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, ch. 6.2.1.2, p.29 |
70 |
|
|
const std::array<double, 3> a; |
71 |
|
|
|
72 |
|
|
// --------------------------------------- Keplerian Parameters ------------------------------------------ |
73 |
|
|
|
74 |
|
|
const double sqrt_A; ///< Square root of the semi-major axis [m^1/2] |
75 |
|
|
const double e; ///< Eccentricity [-] |
76 |
|
|
const double i_0; ///< Inclination angle at reference time [rad] |
77 |
|
|
const double Omega_0; ///< Longitude of Ascending Node of Orbit Plane at Weekly Epoch [rad] |
78 |
|
|
const double omega; ///< Argument of perigee [rad] |
79 |
|
|
const double M_0; ///< Mean anomaly at reference time [rad] |
80 |
|
|
|
81 |
|
|
// -------------------------------------- Pertubation Parameters ----------------------------------------- |
82 |
|
|
|
83 |
|
|
const double delta_n; ///< Mean motion difference from computed value [rad/s] |
84 |
|
|
const double Omega_dot; ///< Rate of right ascension [rad/s] |
85 |
|
|
const double i_dot; ///< Rate of inclination angle [rad/s] |
86 |
|
|
const double Cus; ///< Amplitude of the sine harmonic correction term to the argument of latitude [rad] |
87 |
|
|
const double Cuc; ///< Amplitude of the cosine harmonic correction term to the argument of latitude [rad] |
88 |
|
|
const double Cis; ///< Amplitude of the sine harmonic correction term to the angle of inclination [rad] |
89 |
|
|
const double Cic; ///< Amplitude of the cosine harmonic correction term to the angle of inclination [rad] |
90 |
|
|
const double Crs; ///< Amplitude of the sine harmonic correction term to the orbit radius [m] |
91 |
|
|
const double Crc; ///< Amplitude of the cosine harmonic correction term to the orbit radius [m] |
92 |
|
|
|
93 |
|
|
// ----------------------------------------------- Other ------------------------------------------------- |
94 |
|
|
|
95 |
|
|
/// @brief SV accuracy [m] |
96 |
|
|
/// |
97 |
|
|
/// Derived from an URA index of the SV for the standard positioning service user. |
98 |
|
|
/// |
99 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, ch. 6.2.1.4, p.30 |
100 |
|
|
/// @note See \cite IS-GPS-200M GPS ICD, ch. 20.3.3.3.1.3, p.92ff |
101 |
|
|
const double svAccuracy; |
102 |
|
|
|
103 |
|
|
/// @brief SV health |
104 |
|
|
/// |
105 |
|
|
/// There are two one-bit health flags. Each one-bit health flag indicates the health |
106 |
|
|
/// of NAV data on L5 and S signals as follows: |
107 |
|
|
/// ----------------------------------------------------------------------- |
108 |
|
|
/// Flag | Value | Description |
109 |
|
|
/// ----------------------------------------------------------------------- |
110 |
|
|
/// L5 flag | 0 | All navigation data on L5 SPS signal are OK |
111 |
|
|
/// | 1 | Some or all navigation data on L5 SPS signal are bad |
112 |
|
|
/// ----------------------------------------------------------------------- |
113 |
|
|
/// S flag | 0 | All navigation data on S SPS signal are OK |
114 |
|
|
/// | 1 | Some or all navigation data on S SPS signal are bad |
115 |
|
|
/// ----------------------------------------------------------------------- |
116 |
|
|
/// |
117 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, ch. 6.2.1.6, p.31 |
118 |
|
|
const std::bitset<2> svHealth; |
119 |
|
|
|
120 |
|
|
/// @brief Total Group Delay |
121 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, ch. 6.2.1.5, p.31 |
122 |
|
|
const double T_GD; |
123 |
|
|
|
124 |
|
|
// ####################################################################################################### |
125 |
|
|
// Functions |
126 |
|
|
// ####################################################################################################### |
127 |
|
|
|
128 |
|
|
/// @brief Constructor |
129 |
|
|
/// @param[in] toc Time the Clock information is calculated (Time of Clock) |
130 |
|
|
/// @param[in] toe Time the Orbit information is calculated (Time of Ephemeris) |
131 |
|
|
/// @param[in] IODEC Issue of Data for Ephemeris and Clock |
132 |
|
|
/// @param[in] a Polynomial coefficients for clock correction (a0 bias [s], a1 drift [s/s], a2 drift rate (aging) [s/s^2]) |
133 |
|
|
/// @param[in] sqrt_A Square root of the semi-major axis [m^1/2] |
134 |
|
|
/// @param[in] e Eccentricity [-] |
135 |
|
|
/// @param[in] i_0 Inclination angle at reference time [rad] |
136 |
|
|
/// @param[in] Omega_0 Longitude of Ascending Node of Orbit Plane at Weekly Epoch [rad] |
137 |
|
|
/// @param[in] omega Argument of perigee [rad] |
138 |
|
|
/// @param[in] M_0 Mean anomaly at reference time [rad] |
139 |
|
|
/// @param[in] delta_n Mean motion difference from computed value [rad/s] |
140 |
|
|
/// @param[in] Omega_dot Rate of right ascension [rad/s] |
141 |
|
|
/// @param[in] i_dot Rate of inclination angle [rad/s] |
142 |
|
|
/// @param[in] Cus Amplitude of the sine harmonic correction term to the argument of latitude [rad] |
143 |
|
|
/// @param[in] Cuc Amplitude of the cosine harmonic correction term to the argument of latitude [rad] |
144 |
|
|
/// @param[in] Cis Amplitude of the sine harmonic correction term to the angle of inclination [rad] |
145 |
|
|
/// @param[in] Cic Amplitude of the cosine harmonic correction term to the angle of inclination [rad] |
146 |
|
|
/// @param[in] Crs Amplitude of the sine harmonic correction term to the orbit radius [m] |
147 |
|
|
/// @param[in] Crc Amplitude of the cosine harmonic correction term to the orbit radius [m] |
148 |
|
|
/// @param[in] svAccuracy SV accuracy [m] |
149 |
|
|
/// @param[in] svHealth Signal Health |
150 |
|
|
/// @param[in] T_GD Total Group Delay [s] |
151 |
|
|
IRNSSEphemeris(const InsTime& toc, const InsTime& toe, |
152 |
|
|
const size_t& IODEC, |
153 |
|
|
const std::array<double, 3>& a, |
154 |
|
|
const double& sqrt_A, const double& e, const double& i_0, const double& Omega_0, const double& omega, const double& M_0, |
155 |
|
|
const double& delta_n, const double& Omega_dot, const double& i_dot, const double& Cus, const double& Cuc, |
156 |
|
|
const double& Cis, const double& Cic, const double& Crs, const double& Crc, |
157 |
|
|
const double& svAccuracy, uint8_t svHealth, |
158 |
|
|
const double& T_GD); |
159 |
|
|
|
160 |
|
|
#ifdef TESTING |
161 |
|
|
/// @brief Constructor for pasting raw data from Nav files |
162 |
|
|
/// @param[in] year Time of Clock year |
163 |
|
|
/// @param[in] month Time of Clock month |
164 |
|
|
/// @param[in] day Time of Clock day |
165 |
|
|
/// @param[in] hour Time of Clock hour |
166 |
|
|
/// @param[in] minute Time of Clock minute |
167 |
|
|
/// @param[in] second Time of Clock second |
168 |
|
|
/// @param[in] svClockBias Clock correction a(0) bias [s] |
169 |
|
|
/// @param[in] svClockDrift Clock correction a(1) drift [s/s] |
170 |
|
|
/// @param[in] svClockDriftRate Clock correction a(2) drift rate (aging) [s/s^2] |
171 |
|
|
/// @param[in] IODEC Issue of Data for Ephemeris and Clock |
172 |
|
|
/// @param[in] Crs Amplitude of the sine harmonic correction term to the orbit radius [m] |
173 |
|
|
/// @param[in] delta_n Mean motion difference from computed value [rad/s] |
174 |
|
|
/// @param[in] M_0 Mean anomaly at reference time [rad] |
175 |
|
|
/// @param[in] Cuc Amplitude of the cosine harmonic correction term to the argument of latitude [rad] |
176 |
|
|
/// @param[in] e Eccentricity [-] |
177 |
|
|
/// @param[in] Cus Amplitude of the sine harmonic correction term to the argument of latitude [rad] |
178 |
|
|
/// @param[in] sqrt_A Square root of the semi-major axis [m^1/2] |
179 |
|
|
/// @param[in] Toe Time of Ephemeris |
180 |
|
|
/// @param[in] Cic Amplitude of the cosine harmonic correction term to the angle of inclination [rad] |
181 |
|
|
/// @param[in] Omega_0 Longitude of Ascending Node of Orbit Plane at Weekly Epoch [rad] |
182 |
|
|
/// @param[in] Cis Amplitude of the sine harmonic correction term to the angle of inclination [rad] |
183 |
|
|
/// @param[in] i_0 Inclination angle at reference time [rad] |
184 |
|
|
/// @param[in] Crc Amplitude of the cosine harmonic correction term to the orbit radius [m] |
185 |
|
|
/// @param[in] omega Argument of perigee [rad] |
186 |
|
|
/// @param[in] Omega_dot Rate of right ascension [rad/s] |
187 |
|
|
/// @param[in] i_dot Rate of inclination angle [rad/s] |
188 |
|
|
/// @param[in] spare1 Spare data |
189 |
|
|
/// @param[in] IRNWeek IRN Week to go with Toe |
190 |
|
|
/// @param[in] spare2 Spare data |
191 |
|
|
/// @param[in] svAccuracy SV accuracy [m] |
192 |
|
|
/// @param[in] svHealth SV health |
193 |
|
|
/// @param[in] T_GD Total Group Delay [s] |
194 |
|
|
/// @param[in] spare3 Spare data |
195 |
|
|
/// @param[in] TransmissionTimeOfMessage Transmission time of message [s of IRNSS week] |
196 |
|
|
/// @param[in] spare4 Spare data |
197 |
|
|
/// @param[in] spare5 Spare data |
198 |
|
|
/// @param[in] spare6 Spare data |
199 |
|
|
IRNSSEphemeris(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, double second, double svClockBias, double svClockDrift, double svClockDriftRate, |
200 |
|
|
double IODEC, double Crs, double delta_n, double M_0, |
201 |
|
|
double Cuc, double e, double Cus, double sqrt_A, |
202 |
|
|
double Toe, double Cic, double Omega_0, double Cis, |
203 |
|
|
double i_0, double Crc, double omega, double Omega_dot, |
204 |
|
|
double i_dot, double spare1, double IRNWeek, double spare2, |
205 |
|
|
double svAccuracy, double svHealth, double T_GD, double spare3, |
206 |
|
|
double TransmissionTimeOfMessage, double spare4 = 0.0, double spare5 = 0.0, double spare6 = 0.0); |
207 |
|
|
#endif |
208 |
|
|
|
209 |
|
|
/// @brief Destructor |
210 |
|
4 |
~IRNSSEphemeris() final = default; |
211 |
|
|
/// @brief Copy constructor |
212 |
|
|
IRNSSEphemeris(const IRNSSEphemeris&) = default; |
213 |
|
|
/// @brief Move constructor |
214 |
|
|
IRNSSEphemeris(IRNSSEphemeris&&) = default; |
215 |
|
|
/// @brief Copy assignment operator |
216 |
|
|
IRNSSEphemeris& operator=(const IRNSSEphemeris&) = delete; |
217 |
|
|
/// @brief Move assignment operator |
218 |
|
|
IRNSSEphemeris& operator=(IRNSSEphemeris&&) = delete; |
219 |
|
|
|
220 |
|
|
/// @brief Calculates the Variance of the satellite position in [m^2] |
221 |
|
|
[[nodiscard]] double calcSatellitePositionVariance() const final; |
222 |
|
|
|
223 |
|
|
/// @brief Calculates clock bias and drift of the satellite |
224 |
|
|
/// @param[in] recvTime Receive time of the signal |
225 |
|
|
/// @param[in] dist Distance between receiver and satellite (normally the pseudorange) [m] |
226 |
|
|
/// @param[in] freq Signal Frequency |
227 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, Appendix A, p.43 |
228 |
|
|
[[nodiscard]] Corrections calcClockCorrections(const InsTime& recvTime, double dist, const Frequency& freq) const final; |
229 |
|
|
|
230 |
|
|
/// @brief Checks whether the signal is healthy |
231 |
|
|
[[nodiscard]] bool isHealthy() const final; |
232 |
|
|
|
233 |
|
|
private: |
234 |
|
|
/// @brief Calculates position, velocity and acceleration of the satellite at transmission time |
235 |
|
|
/// @param[in] transTime Transmit time of the signal |
236 |
|
|
/// @param[in] calc Flags which determine what should be calculated and returned |
237 |
|
|
/// @note See \cite IRNSS-SIS-ICD-1.1 IRNSS ICD, Appendix B, p.45 ff. |
238 |
|
|
/// @note See \cite IS-GPS-200M IS-GPS-200, ch. 20.3.3.4.3.1 Table 20-IV p.106-109 |
239 |
|
|
[[nodiscard]] PosVelAccel calcSatelliteData(const InsTime& transTime, Orbit::Calc calc) const final; |
240 |
|
|
}; |
241 |
|
|
|
242 |
|
|
} // namespace NAV |
243 |
|
|
|