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