| 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 GalileoEphemeris.hpp | ||
| 10 | /// @brief Galileo Ephemeris information | ||
| 11 | /// @author T. Topp (topp@ins.uni-stuttgart.de) | ||
| 12 | /// @date 2022-12-12 | ||
| 13 | |||
| 14 | #pragma once | ||
| 15 | |||
| 16 | #include <bitset> | ||
| 17 | #include <cstdint> | ||
| 18 | |||
| 19 | #include "Navigation/GNSS/Satellite/internal/SatNavData.hpp" | ||
| 20 | |||
| 21 | namespace NAV | ||
| 22 | { | ||
| 23 | |||
| 24 | /// @brief Broadcasted ephemeris message data | ||
| 25 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5., p. 43ff | ||
| 26 | /// | ||
| 27 | /// \image html GPS-satellite-orbits.png "Description of the GPS satellite orbits" | ||
| 28 | class GalileoEphemeris final : public SatNavData | ||
| 29 | { | ||
| 30 | public: | ||
| 31 | /// @brief Navigation Data Validity and Signal Health Status | ||
| 32 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.9.3, p. 52 | ||
| 33 | struct SvHealth | ||
| 34 | { | ||
| 35 | /// @brief Navigation Data Validity | ||
| 36 | enum DataValidityStatus : uint8_t | ||
| 37 | { | ||
| 38 | NavigationDataValid = 0, ///< Navigation data valid | ||
| 39 | WorkingWithoutGuarantee = 1, ///< Working without guarantee | ||
| 40 | }; | ||
| 41 | /// @brief Signal Health Status | ||
| 42 | enum SignalHealthStatus : uint8_t | ||
| 43 | { | ||
| 44 | SignalOK = 0, ///< Signal OK | ||
| 45 | SignalOutOfService = 1, ///< Signal out of service | ||
| 46 | SignalWillBeOutOfService = 2, ///< Signal will be out of service | ||
| 47 | SignalComponentCurrentlyInTest = 3, ///< Signal Component currently in Test | ||
| 48 | }; | ||
| 49 | |||
| 50 | DataValidityStatus E5a_DataValidityStatus = NavigationDataValid; ///< E5a Data Validity Status | ||
| 51 | DataValidityStatus E5b_DataValidityStatus = NavigationDataValid; ///< E5b Data Validity Status | ||
| 52 | DataValidityStatus E1B_DataValidityStatus = NavigationDataValid; ///< E1-B Data Validity Status | ||
| 53 | |||
| 54 | SignalHealthStatus E5a_SignalHealthStatus = SignalOK; ///< E5a Signal Health Status | ||
| 55 | SignalHealthStatus E5b_SignalHealthStatus = SignalOK; ///< E5b Signal Health Status | ||
| 56 | SignalHealthStatus E1B_SignalHealthStatus = SignalOK; ///< E1-B/C Signal Health Status | ||
| 57 | }; | ||
| 58 | |||
| 59 | // ####################################################################################################### | ||
| 60 | // Members | ||
| 61 | // ####################################################################################################### | ||
| 62 | |||
| 63 | // ------------------------------------------ Time Parameters -------------------------------------------- | ||
| 64 | |||
| 65 | /// @brief Time of Clock | ||
| 66 | InsTime toc; | ||
| 67 | |||
| 68 | /// @brief Time of Ephemeris | ||
| 69 | InsTime toe; | ||
| 70 | |||
| 71 | /// @brief Issue of Data of the nav batch | ||
| 72 | /// | ||
| 73 | /// The navigation data is disseminated in data batches each one identified by an Issue of | ||
| 74 | /// Data. In nominal operation the navigation data (ephemeris, satellite clock correction and | ||
| 75 | /// SISA) have limited validity duration depending on the data type. The identification of each | ||
| 76 | /// batch by an Issue of Data (IOD) value enables: | ||
| 77 | /// - the users to distinguish the data in different batches received from each satellite | ||
| 78 | /// - to indicate to the user receiver the validity of the data (which have to be updated | ||
| 79 | /// using new issue of navigation data) | ||
| 80 | /// - the user receiver to compute the full batch of data even if it misses some pages | ||
| 81 | /// or start receiving the data somewhere during the transmission | ||
| 82 | /// | ||
| 83 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.9.2, p. 51 | ||
| 84 | size_t IODnav{}; | ||
| 85 | |||
| 86 | /// Polynomial coefficients for clock correction | ||
| 87 | /// - a(0) bias [s] | ||
| 88 | /// - a(1) drift [s/s] | ||
| 89 | /// - a(2) drift rate (aging) [s/s^2] | ||
| 90 | /// | ||
| 91 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.3, p. 46 | ||
| 92 | std::array<double, 3> a{}; | ||
| 93 | |||
| 94 | // --------------------------------------- Keplerian Parameters ------------------------------------------ | ||
| 95 | |||
| 96 | double sqrt_A{}; ///< Square root of the semi-major axis [m^1/2] | ||
| 97 | double e{}; ///< Eccentricity [-] | ||
| 98 | double i_0{}; ///< Inclination angle at reference time [rad] | ||
| 99 | double Omega_0{}; ///< Longitude of the ascending node at reference time [rad] | ||
| 100 | double omega{}; ///< Argument of perigee [rad] | ||
| 101 | double M_0{}; ///< Mean anomaly at reference time [rad] | ||
| 102 | |||
| 103 | // -------------------------------------- Pertubation Parameters ----------------------------------------- | ||
| 104 | |||
| 105 | double delta_n{}; ///< Mean motion difference from computed value [rad/s] | ||
| 106 | double Omega_dot{}; ///< Rate of change of right ascension [rad/s] | ||
| 107 | double i_dot{}; ///< Rate of change of inclination [rad/s] | ||
| 108 | double Cus{}; ///< Amplitude of the sine harmonic correction term to the argument of latitude [rad] | ||
| 109 | double Cuc{}; ///< Amplitude of the cosine harmonic correction term to the argument of latitude [rad] | ||
| 110 | double Cis{}; ///< Amplitude of the sine harmonic correction term to the angle of inclination [rad] | ||
| 111 | double Cic{}; ///< Amplitude of the cosine harmonic correction term to the angle of inclination [rad] | ||
| 112 | double Crs{}; ///< Amplitude of the sine harmonic correction term to the orbit radius [m] | ||
| 113 | double Crc{}; ///< Amplitude of the cosine harmonic correction term to the orbit radius [m] | ||
| 114 | |||
| 115 | // ----------------------------------------------- Other ------------------------------------------------- | ||
| 116 | |||
| 117 | /// @brief Data sources | ||
| 118 | /// | ||
| 119 | /// Bit 0 set: I/NAV E1-B | ||
| 120 | /// Bit 1 set: F/NAV E5a-I | ||
| 121 | /// Bit 2 set: I/NAV E5b-I | ||
| 122 | /// Bits 0 and 2: Both can be set if the navigation messages were merged, however, bits 0-2 cannot all be set, | ||
| 123 | /// as the I/NAV and F/NAV messages contain different information | ||
| 124 | /// Bit 3 reserved for Galileo internal use | ||
| 125 | /// Bit 4 reserved for Galileo internal use | ||
| 126 | /// Bit 8 set: af0-af2, Toc, SISA are for E5a,E1 | ||
| 127 | /// Bit 9 set: af0-af2, Toc, SISA are for E5b,E1 | ||
| 128 | /// Bits 8-9 : exclusive (only one bit can be set) | ||
| 129 | /// | ||
| 130 | /// @note See \cite RINEX-3.04 RINEX-3.04, ch. A8, p. A25 | ||
| 131 | std::bitset<10> dataSource; | ||
| 132 | |||
| 133 | /// SISA (Signal in space accuracy) [m] | ||
| 134 | /// | ||
| 135 | /// Signal - In - Space Accuracy (SISA) is a prediction of the minimum standard deviation | ||
| 136 | /// (1-sigma) of the unbiased Gaussian distribution which overbounds the Signal - In - Space | ||
| 137 | /// Error (SISE) predictable distribution for all possible user locations within the satellite | ||
| 138 | /// coverage area. When no accurate prediction is available (SISA = NAPA), this is an indicator | ||
| 139 | /// of a potential anomalous SIS. | ||
| 140 | /// | ||
| 141 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.12, p.58 | ||
| 142 | double signalAccuracy{}; | ||
| 143 | |||
| 144 | /// @brief Signal Health | ||
| 145 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.9.3, p. 52 | ||
| 146 | SvHealth svHealth{}; | ||
| 147 | |||
| 148 | /// @brief E1-E5a Broadcast Group Delay [s] | ||
| 149 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.5, p. 47f | ||
| 150 | double BGD_E1_E5a{}; | ||
| 151 | /// @brief E1-E5b Broadcast Group Delay [s] | ||
| 152 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.5, p. 47f | ||
| 153 | double BGD_E1_E5b{}; | ||
| 154 | |||
| 155 | // ####################################################################################################### | ||
| 156 | // Functions | ||
| 157 | // ####################################################################################################### | ||
| 158 | |||
| 159 | /// @brief Default Constructor | ||
| 160 | /// @param[in] toc Time the Clock information is calculated (Time of Clock) | ||
| 161 | explicit GalileoEphemeris(const InsTime& toc); | ||
| 162 | |||
| 163 | /// @brief Constructor | ||
| 164 | /// @param[in] toc Time the Clock information is calculated (Time of Clock) | ||
| 165 | /// @param[in] toe Time the Orbit information is calculated (Time of Ephemeris) | ||
| 166 | /// @param[in] IODnav Issue of Data of the nav batch | ||
| 167 | /// @param[in] a Polynomial coefficients for clock correction (a0 bias [s], a1 drift [s/s], a2 drift rate (aging) [s/s^2]) | ||
| 168 | /// @param[in] sqrt_A Square root of the semi-major axis [m^1/2] | ||
| 169 | /// @param[in] e Eccentricity [-] | ||
| 170 | /// @param[in] i_0 Inclination angle at reference time [rad] | ||
| 171 | /// @param[in] Omega_0 Longitude of the ascending node at reference time [rad] | ||
| 172 | /// @param[in] omega Argument of perigee [rad] | ||
| 173 | /// @param[in] M_0 Mean anomaly at reference time [rad] | ||
| 174 | /// @param[in] delta_n Mean motion difference from computed value [rad/s] | ||
| 175 | /// @param[in] Omega_dot Rate of change of right ascension [rad/s] | ||
| 176 | /// @param[in] i_dot Rate of change of inclination [rad/s] | ||
| 177 | /// @param[in] Cus Amplitude of the sine harmonic correction term to the argument of latitude [rad] | ||
| 178 | /// @param[in] Cuc Amplitude of the cosine harmonic correction term to the argument of latitude [rad] | ||
| 179 | /// @param[in] Cis Amplitude of the sine harmonic correction term to the angle of inclination [rad] | ||
| 180 | /// @param[in] Cic Amplitude of the cosine harmonic correction term to the angle of inclination [rad] | ||
| 181 | /// @param[in] Crs Amplitude of the sine harmonic correction term to the orbit radius [m] | ||
| 182 | /// @param[in] Crc Amplitude of the cosine harmonic correction term to the orbit radius [m] | ||
| 183 | /// @param[in] dataSource Data sources | ||
| 184 | /// @param[in] signalAccuracy SISA (Signal in space accuracy) [m] | ||
| 185 | /// @param[in] svHealth Signal Health | ||
| 186 | /// @param[in] BGD_E1_E5a E1-E5a Broadcast Group Delay [s] | ||
| 187 | /// @param[in] BGD_E1_E5b E1-E5b Broadcast Group Delay [s] | ||
| 188 | GalileoEphemeris(const InsTime& toc, const InsTime& toe, | ||
| 189 | const size_t& IODnav, | ||
| 190 | const std::array<double, 3>& a, | ||
| 191 | const double& sqrt_A, const double& e, const double& i_0, const double& Omega_0, const double& omega, const double& M_0, | ||
| 192 | const double& delta_n, const double& Omega_dot, const double& i_dot, const double& Cus, const double& Cuc, | ||
| 193 | const double& Cis, const double& Cic, const double& Crs, const double& Crc, | ||
| 194 | const std::bitset<10>& dataSource, const double& signalAccuracy, const SvHealth& svHealth, | ||
| 195 | const double& BGD_E1_E5a, const double& BGD_E1_E5b); | ||
| 196 | |||
| 197 | #ifdef TESTING | ||
| 198 | /// @brief Constructor for pasting raw data from Nav files | ||
| 199 | /// @param[in] year Time of Clock year | ||
| 200 | /// @param[in] month Time of Clock month | ||
| 201 | /// @param[in] day Time of Clock day | ||
| 202 | /// @param[in] hour Time of Clock hour | ||
| 203 | /// @param[in] minute Time of Clock minute | ||
| 204 | /// @param[in] second Time of Clock second | ||
| 205 | /// @param[in] svClockBias Clock correction a(0) bias [s] | ||
| 206 | /// @param[in] svClockDrift Clock correction a(1) drift [s/s] | ||
| 207 | /// @param[in] svClockDriftRate Clock correction a(2) drift rate (aging) [s/s^2] | ||
| 208 | /// @param[in] IODnav Issue of Data of the nav batch | ||
| 209 | /// @param[in] Crs Amplitude of the sine harmonic correction term to the orbit radius [m] | ||
| 210 | /// @param[in] delta_n Mean motion difference from computed value [rad/s] | ||
| 211 | /// @param[in] M_0 Mean anomaly at reference time [rad] | ||
| 212 | /// @param[in] Cuc Amplitude of the cosine harmonic correction term to the argument of latitude [rad] | ||
| 213 | /// @param[in] e Eccentricity [-] | ||
| 214 | /// @param[in] Cus Amplitude of the sine harmonic correction term to the argument of latitude [rad] | ||
| 215 | /// @param[in] sqrt_A Square root of the semi-major axis [m^1/2] | ||
| 216 | /// @param[in] Toe Time of Ephemeris | ||
| 217 | /// @param[in] Cic Amplitude of the cosine harmonic correction term to the angle of inclination [rad] | ||
| 218 | /// @param[in] Omega_0 Longitude of the ascending node at reference time [rad] | ||
| 219 | /// @param[in] Cis Amplitude of the sine harmonic correction term to the angle of inclination [rad] | ||
| 220 | /// @param[in] i_0 Inclination angle at reference time [rad] | ||
| 221 | /// @param[in] Crc Amplitude of the cosine harmonic correction term to the orbit radius [m] | ||
| 222 | /// @param[in] omega Argument of perigee [rad] | ||
| 223 | /// @param[in] Omega_dot Rate of change of right ascension [rad/s] | ||
| 224 | /// @param[in] i_dot Rate of change of inclination [rad/s] | ||
| 225 | /// @param[in] dataSource Data sources | ||
| 226 | /// @param[in] GALWeek GAL Week to go with Toe | ||
| 227 | /// @param[in] spare1 Spare data | ||
| 228 | /// @param[in] signalAccuracy SISA Signal in space accuracy [m] | ||
| 229 | /// @param[in] svHealth SV health | ||
| 230 | /// @param[in] BGD_E1_E5a E1-E5a Broadcast Group Delay [s] | ||
| 231 | /// @param[in] BGD_E1_E5b E1-E5b Broadcast Group Delay [s] | ||
| 232 | /// @param[in] TransmissionTimeOfMessage Transmission time of message | ||
| 233 | /// @param[in] spare2 Spare data | ||
| 234 | /// @param[in] spare3 Spare data | ||
| 235 | /// @param[in] spare4 Spare data | ||
| 236 | GalileoEphemeris(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, double second, double svClockBias, double svClockDrift, double svClockDriftRate, | ||
| 237 | double IODnav, double Crs, double delta_n, double M_0, | ||
| 238 | double Cuc, double e, double Cus, double sqrt_A, | ||
| 239 | double Toe, double Cic, double Omega_0, double Cis, | ||
| 240 | double i_0, double Crc, double omega, double Omega_dot, | ||
| 241 | double i_dot, double dataSource, double GALWeek, double spare1, | ||
| 242 | double signalAccuracy, double svHealth, double BGD_E1_E5a, double BGD_E1_E5b, | ||
| 243 | double TransmissionTimeOfMessage, double spare2 = 0.0, double spare3 = 0.0, double spare4 = 0.0); | ||
| 244 | #endif | ||
| 245 | |||
| 246 | /// @brief Destructor | ||
| 247 | 20434 | ~GalileoEphemeris() final = default; | |
| 248 | /// @brief Copy constructor | ||
| 249 | GalileoEphemeris(const GalileoEphemeris&) = default; | ||
| 250 | /// @brief Move constructor | ||
| 251 | GalileoEphemeris(GalileoEphemeris&&) = default; | ||
| 252 | /// @brief Copy assignment operator | ||
| 253 | GalileoEphemeris& operator=(const GalileoEphemeris&) = delete; | ||
| 254 | /// @brief Move assignment operator | ||
| 255 | GalileoEphemeris& operator=(GalileoEphemeris&&) = delete; | ||
| 256 | |||
| 257 | /// @brief Calculates the Variance of the satellite position in [m^2] | ||
| 258 | [[nodiscard]] double calcSatellitePositionVariance() const final; | ||
| 259 | |||
| 260 | /// @brief Calculates clock bias and drift of the satellite | ||
| 261 | /// @param[in] recvTime Receive time of the signal | ||
| 262 | /// @param[in] dist Distance between receiver and satellite (normally the pseudorange) [m] | ||
| 263 | /// @param[in] freq Signal Frequency | ||
| 264 | [[nodiscard]] Corrections calcClockCorrections(const InsTime& recvTime, double dist, const Frequency& freq) const final; | ||
| 265 | |||
| 266 | /// @brief Checks whether the signal is healthy | ||
| 267 | [[nodiscard]] bool isHealthy() const final; | ||
| 268 | |||
| 269 | private: | ||
| 270 | /// @brief Calculates position, velocity and acceleration of the satellite at transmission time | ||
| 271 | /// @param[in] transTime Transmit time of the signal | ||
| 272 | /// @param[in] calc Flags which determine what should be calculated and returned | ||
| 273 | /// @note See \cite GAL-ICD-2.0 GAL-ICD-2.0, ch. 5.1.1, p. 44f | ||
| 274 | /// @note See \cite IS-GPS-200M IS-GPS-200 ch. 20.3.3.4.3.1 Table 20-IV p.106-109 | ||
| 275 | [[nodiscard]] PosVelAccel calcSatelliteData(const InsTime& transTime, Orbit::Calc calc) const final; | ||
| 276 | }; | ||
| 277 | |||
| 278 | } // namespace NAV | ||
| 279 |