1 | #ifndef EPHEMERIS_H
|
---|
2 | #define EPHEMERIS_H
|
---|
3 |
|
---|
4 | #include <newmat.h>
|
---|
5 | #include <QtCore>
|
---|
6 | #include <stdio.h>
|
---|
7 | #include <string>
|
---|
8 | #include "bnctime.h"
|
---|
9 | #include "bncconst.h"
|
---|
10 | #include "t_prn.h"
|
---|
11 | #include "gnss.h"
|
---|
12 |
|
---|
13 | class t_orbCorr;
|
---|
14 | class t_clkCorr;
|
---|
15 |
|
---|
16 | class t_eph {
|
---|
17 | public:
|
---|
18 | enum e_type {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS};
|
---|
19 | enum e_checkState {unchecked, ok, bad};
|
---|
20 |
|
---|
21 | t_eph();
|
---|
22 | virtual ~t_eph() {};
|
---|
23 |
|
---|
24 | virtual e_type type() const = 0;
|
---|
25 | virtual QString toString(double version) const = 0;
|
---|
26 | virtual int IOD() const = 0;
|
---|
27 | virtual int slotNum() const {return 0;}
|
---|
28 | bncTime TOC() const {return _TOC;}
|
---|
29 | bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
|
---|
30 | e_checkState checkState() const {return _checkState;}
|
---|
31 | void setCheckState(e_checkState checkState) {_checkState = checkState;}
|
---|
32 | t_prn prn() const {return _prn;}
|
---|
33 | t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
|
---|
34 | void setOrbCorr(const t_orbCorr* orbCorr);
|
---|
35 | void setClkCorr(const t_clkCorr* clkCorr);
|
---|
36 | const QDateTime& receptDateTime() const {return _receptDateTime;}
|
---|
37 | static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version);
|
---|
38 | static QString rinexDateStr(const bncTime& tt, const QString& prnStr, double version);
|
---|
39 | static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {return eph1->_TOC < eph2->_TOC;}
|
---|
40 |
|
---|
41 | protected:
|
---|
42 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
|
---|
43 | t_prn _prn;
|
---|
44 | bncTime _TOC;
|
---|
45 | QDateTime _receptDateTime;
|
---|
46 | e_checkState _checkState;
|
---|
47 | t_orbCorr* _orbCorr;
|
---|
48 | t_clkCorr* _clkCorr;
|
---|
49 | };
|
---|
50 |
|
---|
51 |
|
---|
52 | class t_ephGPS : public t_eph {
|
---|
53 | friend class t_ephEncoder;
|
---|
54 | friend class RTCM3Decoder;
|
---|
55 | public:
|
---|
56 | t_ephGPS() { }
|
---|
57 | t_ephGPS(float rnxVersion, const QStringList& lines);
|
---|
58 | virtual ~t_ephGPS() {}
|
---|
59 |
|
---|
60 | virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
|
---|
61 | virtual QString toString(double version) const;
|
---|
62 | virtual int IOD() const { return static_cast<int>(_IODC); }
|
---|
63 | double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
|
---|
64 |
|
---|
65 | private:
|
---|
66 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
67 |
|
---|
68 | double _clock_bias; // [s]
|
---|
69 | double _clock_drift; // [s/s]
|
---|
70 | double _clock_driftrate; // [s/s^2]
|
---|
71 |
|
---|
72 | double _IODE;
|
---|
73 | double _Crs; // [m]
|
---|
74 | double _Delta_n; // [rad/s]
|
---|
75 | double _M0; // [rad]
|
---|
76 |
|
---|
77 | double _Cuc; // [rad]
|
---|
78 | double _e; //
|
---|
79 | double _Cus; // [rad]
|
---|
80 | double _sqrt_A; // [m^0.5]
|
---|
81 |
|
---|
82 | double _TOEsec; // [s]
|
---|
83 | double _Cic; // [rad]
|
---|
84 | double _OMEGA0; // [rad]
|
---|
85 | double _Cis; // [rad]
|
---|
86 |
|
---|
87 | double _i0; // [rad]
|
---|
88 | double _Crc; // [m]
|
---|
89 | double _omega; // [rad]
|
---|
90 | double _OMEGADOT; // [rad/s]
|
---|
91 |
|
---|
92 | double _IDOT; // [rad/s]
|
---|
93 | double _L2Codes; // Codes on L2 channel
|
---|
94 | double _TOEweek;
|
---|
95 | double _L2PFlag; // L2 P data flag
|
---|
96 |
|
---|
97 | mutable double _ura; // SV accuracy
|
---|
98 | double _health; // SV health
|
---|
99 | double _TGD; // [s]
|
---|
100 | double _IODC;
|
---|
101 |
|
---|
102 | double _TOT; // Transmisstion time
|
---|
103 | double _fitInterval; // Fit interval
|
---|
104 | };
|
---|
105 |
|
---|
106 | class t_ephGlo : public t_eph {
|
---|
107 | friend class t_ephEncoder;
|
---|
108 | friend class RTCM3Decoder;
|
---|
109 | public:
|
---|
110 | t_ephGlo() { _xv.ReSize(6); }
|
---|
111 | t_ephGlo(float rnxVersion, const QStringList& lines);
|
---|
112 | virtual ~t_ephGlo() {}
|
---|
113 |
|
---|
114 | virtual e_type type() const {return t_eph::GLONASS;}
|
---|
115 | virtual QString toString(double version) const;
|
---|
116 | virtual int IOD() const;
|
---|
117 | virtual int slotNum() const {return int(_frequency_number);}
|
---|
118 |
|
---|
119 | private:
|
---|
120 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
121 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
|
---|
122 |
|
---|
123 | mutable bncTime _tt; // time
|
---|
124 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
125 |
|
---|
126 | double _gps_utc;
|
---|
127 | double _tau; // [s]
|
---|
128 | double _gamma; //
|
---|
129 | mutable double _tki; // message frame time
|
---|
130 |
|
---|
131 | double _x_pos; // [km]
|
---|
132 | double _x_velocity; // [km/s]
|
---|
133 | double _x_acceleration; // [km/s^2]
|
---|
134 | double _health; // 0 = O.K.
|
---|
135 |
|
---|
136 | double _y_pos; // [km]
|
---|
137 | double _y_velocity; // [km/s]
|
---|
138 | double _y_acceleration; // [km/s^2]
|
---|
139 | double _frequency_number; // ICD-GLONASS data position
|
---|
140 |
|
---|
141 | double _z_pos; // [km]
|
---|
142 | double _z_velocity; // [km/s]
|
---|
143 | double _z_acceleration; // [km/s^2]
|
---|
144 | double _E; // Age of Information [days]
|
---|
145 | };
|
---|
146 |
|
---|
147 | class t_ephGal : public t_eph {
|
---|
148 | friend class t_ephEncoder;
|
---|
149 | friend class RTCM3Decoder;
|
---|
150 | public:
|
---|
151 | t_ephGal() { };
|
---|
152 | t_ephGal(float rnxVersion, const QStringList& lines);
|
---|
153 | virtual ~t_ephGal() {}
|
---|
154 |
|
---|
155 | virtual QString toString(double version) const;
|
---|
156 | virtual e_type type() const {return t_eph::Galileo;}
|
---|
157 | virtual int IOD() const { return static_cast<int>(_IODnav); }
|
---|
158 |
|
---|
159 | private:
|
---|
160 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
161 |
|
---|
162 | double _clock_bias; // [s]
|
---|
163 | double _clock_drift; // [s/s]
|
---|
164 | double _clock_driftrate; // [s/s^2]
|
---|
165 |
|
---|
166 | double _IODnav;
|
---|
167 | double _Crs; // [m]
|
---|
168 | double _Delta_n; // [rad/s]
|
---|
169 | double _M0; // [rad]
|
---|
170 |
|
---|
171 | double _Cuc; // [rad]
|
---|
172 | double _e; //
|
---|
173 | double _Cus; // [rad]
|
---|
174 | double _sqrt_A; // [m^0.5]
|
---|
175 |
|
---|
176 | double _TOEsec; // [s]
|
---|
177 | double _Cic; // [rad]
|
---|
178 | double _OMEGA0; // [rad]
|
---|
179 | double _Cis; // [rad]
|
---|
180 |
|
---|
181 | double _i0; // [rad]
|
---|
182 | double _Crc; // [m]
|
---|
183 | double _omega; // [rad]
|
---|
184 | double _OMEGADOT; // [rad/s]
|
---|
185 |
|
---|
186 | double _IDOT; // [rad/s]
|
---|
187 | double _TOEweek;
|
---|
188 | // spare
|
---|
189 |
|
---|
190 | mutable double _SISA; // Signal In Space Accuracy
|
---|
191 | double _E5aHS; // [0..3] E5a Health Status
|
---|
192 | double _E5bHS; // [0..3] E5b Health Status
|
---|
193 | double _E1_bHS; // [0..3] E1-b Health Status
|
---|
194 | double _BGD_1_5A; // group delay [s]
|
---|
195 | double _BGD_1_5B; // group delay [s]
|
---|
196 |
|
---|
197 | double _TOT; // [s]
|
---|
198 | /** Data comes from I/NAV when <code>true</code> */
|
---|
199 | bool _inav;
|
---|
200 | /** Data comes from F/NAV when <code>true</code> */
|
---|
201 | bool _fnav;
|
---|
202 | /** EE Data is not valid */
|
---|
203 | bool _e1DataInValid;
|
---|
204 | /** E5A Data is not valid */
|
---|
205 | bool _e5aDataInValid;
|
---|
206 | /** E5B Data is not valid */
|
---|
207 | bool _e5bDataInValid;
|
---|
208 | };
|
---|
209 |
|
---|
210 | class t_ephSBAS : public t_eph {
|
---|
211 | friend class t_ephEncoder;
|
---|
212 | friend class RTCM3Decoder;
|
---|
213 | public:
|
---|
214 | t_ephSBAS() {}
|
---|
215 | t_ephSBAS(float rnxVersion, const QStringList& lines);
|
---|
216 | virtual ~t_ephSBAS() {}
|
---|
217 |
|
---|
218 | virtual e_type type() const {return t_eph::SBAS;}
|
---|
219 | virtual int IOD() const {return _IODN;}
|
---|
220 | virtual QString toString(double version) const;
|
---|
221 |
|
---|
222 | private:
|
---|
223 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
224 |
|
---|
225 | int _IODN;
|
---|
226 | double _TOW; // not used (set to 0.9999e9)
|
---|
227 | double _agf0; // [s] clock correction
|
---|
228 | double _agf1; // [s/s] clock correction drift
|
---|
229 |
|
---|
230 | double _x_pos; // [m]
|
---|
231 | double _x_velocity; // [m/s]
|
---|
232 | double _x_acceleration; // [m/s^2]
|
---|
233 |
|
---|
234 | double _y_pos; // [m]
|
---|
235 | double _y_velocity; // [m/s]
|
---|
236 | double _y_acceleration; // [m/s^2]
|
---|
237 |
|
---|
238 | double _z_pos; // [m]
|
---|
239 | double _z_velocity; // [m/s]
|
---|
240 | double _z_acceleration; // [m/s^2]
|
---|
241 |
|
---|
242 | mutable double _ura;
|
---|
243 | double _health;
|
---|
244 | };
|
---|
245 |
|
---|
246 | class t_ephBDS : public t_eph {
|
---|
247 | friend class t_ephEncoder;
|
---|
248 | friend class RTCM3Decoder;
|
---|
249 | public:
|
---|
250 | t_ephBDS() : _TOEweek(-1.0) {}
|
---|
251 | t_ephBDS(float rnxVersion, const QStringList& lines);
|
---|
252 | virtual ~t_ephBDS() {}
|
---|
253 |
|
---|
254 | virtual e_type type() const {return t_eph::BDS;}
|
---|
255 | virtual int IOD() const {return _AODC;}
|
---|
256 | virtual QString toString(double version) const;
|
---|
257 |
|
---|
258 | private:
|
---|
259 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
260 |
|
---|
261 | double _TOT;
|
---|
262 | bncTime _TOE;
|
---|
263 | int _AODE;
|
---|
264 | int _AODC;
|
---|
265 | int _URAI; // [0..15] index from RTCM stream
|
---|
266 | mutable double _URA; // user range accuracy
|
---|
267 | double _clock_bias; // [s]
|
---|
268 | double _clock_drift; // [s/s]
|
---|
269 | double _clock_driftrate; // [s/s^2]
|
---|
270 | double _Crs; // [m]
|
---|
271 | double _Delta_n; // [rad/s]
|
---|
272 | double _M0; // [rad]
|
---|
273 | double _Cuc; // [rad]
|
---|
274 | double _e; //
|
---|
275 | double _Cus; // [rad]
|
---|
276 | double _sqrt_A; // [m^0.5]
|
---|
277 | double _Cic; // [rad]
|
---|
278 | double _OMEGA0; // [rad]
|
---|
279 | double _Cis; // [rad]
|
---|
280 | double _i0; // [rad]
|
---|
281 | double _Crc; // [m]
|
---|
282 | double _omega; // [rad]
|
---|
283 | double _OMEGADOT; // [rad/s]
|
---|
284 | double _IDOT; // [rad/s]
|
---|
285 | double _TGD1; // [s]
|
---|
286 | double _TGD2; // [s]
|
---|
287 | int _SatH1; //
|
---|
288 | double _TOW; // [s] of BDT week
|
---|
289 | double _TOEsec; // [s] of BDT week
|
---|
290 | double _TOEweek; // BDT week will be set only in case of RINEX file input
|
---|
291 | };
|
---|
292 |
|
---|
293 | #endif
|
---|