INSTINCT Code Coverage Report


Directory: src/
File: Navigation/GNSS/Satellite/Ephemeris/GLONASSEphemeris.hpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

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 GLONASSEphemeris.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
18 #include "Navigation/GNSS/Satellite/internal/SatNavData.hpp"
19
20 namespace NAV
21 {
22
23 /// @brief Broadcasted ephemeris message data
24 /// @note See \cite GLO-ICD-5.1 GLO-ICD-5.1, ch. 4., p. 25ff
25 class GLONASSEphemeris final : public SatNavData
26 {
27 public:
28 // #######################################################################################################
29 // Members
30 // #######################################################################################################
31
32 /// Coefficient of linear polynomial of time system difference [s]
33 const double tau_c;
34
35 /// Toe Time of clock [s] (Reference time, ephemeris parameters)
36 const InsTime toc;
37 /// SV clock bias [s]
38 const double tau_n;
39 /// SV relative frequency bias
40 const double gamma_n;
41 /// Health
42 const bool health;
43 /// Position at reference time in PZ90 frame [m]
44 const Eigen::Vector3d PZ90_pos;
45 /// Velocity at reference time in PZ90 frame [m/s]
46 const Eigen::Vector3d PZ90_vel;
47 /// Accelerations due to lunar-solar gravitational perturbation in PZ90 frame [m/s^2]
48 const Eigen::Vector3d PZ90_accelLuniSolar;
49 /// Frequency number (-7 ... +13) (-7 ...+6 (ICD 5.1))
50 const int8_t frequencyNumber;
51
52 // #######################################################################################################
53 // Functions
54 // #######################################################################################################
55
56 /// @brief Constructor
57 /// @param[in] toc Time the Clock information is calculated (Time of Clock)
58 /// @param[in] tau_c Coefficient of linear polynomial of time system difference [s]
59 /// @param[in] tau_n SV clock bias [s]
60 /// @param[in] gamma_n SV relative frequency bias
61 /// @param[in] health Health flag
62 /// @param[in] pos Position at reference time in PZ90 frame [m]
63 /// @param[in] vel Velocity at reference time in PZ90 frame [m/s]
64 /// @param[in] accelLuniSolar Accelerations due to lunar-solar gravitational perturbation in PZ90 frame [m/s^2]
65 /// @param[in] frequencyNumber Frequency number (-7 ... +13) (-7 ...+6 (ICD 5.1))
66 GLONASSEphemeris(const InsTime& toc, double tau_c,
67 double tau_n, double gamma_n, bool health,
68 Eigen::Vector3d pos, Eigen::Vector3d vel, Eigen::Vector3d accelLuniSolar,
69 int8_t frequencyNumber);
70
71 #ifdef TESTING
72 /// @brief Constructor for pasting raw data from Nav files
73 /// @param[in] year Time of Clock year
74 /// @param[in] month Time of Clock month
75 /// @param[in] day Time of Clock day
76 /// @param[in] hour Time of Clock hour
77 /// @param[in] minute Time of Clock minute
78 /// @param[in] second Time of Clock second
79 /// @param[in] m_tau_n -τ_n = SV clock bias [s]
80 /// @param[in] gamma_n SV relative frequency bias
81 /// @param[in] messageFrameTime Message frame time (tk+(nd*86400)) in seconds of the UTC week
82 /// @param[in] satPos_x Satellite position X (km)
83 /// @param[in] satVel_x velocity X dot (km/sec)
84 /// @param[in] satAccel_x X acceleration (km/sec2)
85 /// @param[in] health Health
86 /// @param[in] satPos_y Satellite position Y (km)
87 /// @param[in] satVel_y velocity Y dot (km/sec)
88 /// @param[in] satAccel_y Y acceleration (km/sec2)
89 /// @param[in] frequencyNumber Frequency number (-7 ... +13) (-7 ...+6 (ICD 5.1))
90 /// @param[in] satPos_z Satellite position Z (km)
91 /// @param[in] satVel_z velocity Z dot (km/sec)
92 /// @param[in] satAccel_z Z acceleration (km/sec2)
93 /// @param[in] ageOfOperationInfo Age of oper. information (days) (E)
94 /// @param[in] statusFlags Status Flags
95 /// @param[in] L1L2groupDelayDifference L1/L2 group delay difference Δτ (seconds)
96 /// @param[in] URAI URAI; GLO-M/K only – raw accuracy index F_T.
97 /// @param[in] healthFlags Health Flags
98 /// @param[in] tau_c Coefficient of linear polynomial of time system difference [s]
99 GLONASSEphemeris(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, double second,
100 double m_tau_n, double gamma_n, double messageFrameTime,
101 double satPos_x, double satVel_x, double satAccel_x, double health,
102 double satPos_y, double satVel_y, double satAccel_y, double frequencyNumber,
103 double satPos_z, double satVel_z, double satAccel_z, double ageOfOperationInfo,
104 double statusFlags = 0.0, double L1L2groupDelayDifference = 0.0, double URAI = 0.0, double healthFlags = 0.0,
105 double tau_c = 0.0);
106 #endif
107
108 /// @brief Destructor
109 29322 ~GLONASSEphemeris() final = default;
110 /// @brief Copy constructor
111 GLONASSEphemeris(const GLONASSEphemeris&) = default;
112 /// @brief Move constructor
113 GLONASSEphemeris(GLONASSEphemeris&&) = default;
114 /// @brief Copy assignment operator
115 GLONASSEphemeris& operator=(const GLONASSEphemeris&) = delete;
116 /// @brief Move assignment operator
117 GLONASSEphemeris& operator=(GLONASSEphemeris&&) = delete;
118
119 /// @brief Calculates the Variance of the satellite position in [m^2]
120 [[nodiscard]] double calcSatellitePositionVariance() const final;
121
122 /// @brief Calculates clock bias and drift of the satellite
123 /// @param[in] recvTime Receive time of the signal
124 /// @param[in] dist Distance between receiver and satellite (normally the pseudorange) [m]
125 /// @param[in] freq Signal Frequency
126 /// @note See https://gssc.esa.int/navipedia/index.php/Clock_Modelling
127 [[nodiscard]] Corrections calcClockCorrections(const InsTime& recvTime, double dist, const Frequency& freq) const final;
128
129 /// @brief Checks whether the signal is healthy
130 [[nodiscard]] bool isHealthy() const final;
131
132 private:
133 /// Integration step size in [s]
134 static constexpr double _h = 60.0;
135
136 /// @brief Calculates position, velocity and acceleration of the satellite at transmission time
137 /// @param[in] transTime Transmit time of the signal
138 /// @param[in] calc Flags which determine what should be calculated and returned
139 /// @note See \cite GLO-ICD-CDMA-1.0 GLO-ICD-CDMA-1.0, J2, p. 53ff
140 [[nodiscard]] PosVelAccel calcSatelliteData(const InsTime& transTime, Orbit::Calc calc) const final;
141 };
142
143 } // namespace NAV
144