source: ntrip/trunk/BNC/src/ephemeris.h@ 8168

Last change on this file since 8168 was 8168, checked in by stuerze, 4 years ago

IRNSS support is added in RINEX QC

File size: 12.5 KB
Line 
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
14class t_orbCorr;
15class t_clkCorr;
16
17class t_eph {
18 public:
19 enum e_type {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS, IRNSS};
20 enum e_checkState {unchecked, ok, bad, outdated};
21
22 t_eph();
23 virtual ~t_eph();
24
25 virtual e_type type() const = 0;
26 virtual QString toString(double version) const = 0;
27 virtual unsigned int IOD() const = 0;
28 virtual int slotNum() const {return 0;}
29 bncTime TOC() const {return _TOC;}
30 bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
31 e_checkState checkState() const {return _checkState;}
32 void setCheckState(e_checkState checkState) {_checkState = checkState;}
33 t_prn prn() const {return _prn;}
34 t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
35 void setOrbCorr(const t_orbCorr* orbCorr);
36 void setClkCorr(const t_clkCorr* clkCorr);
37 const QDateTime& receptDateTime() const {return _receptDateTime;}
38 static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version);
39 static QString rinexDateStr(const bncTime& tt, const QString& prnStr, double version);
40 static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {return eph1->_TOC < eph2->_TOC;}
41
42 protected:
43 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
44 t_prn _prn;
45 bncTime _TOC;
46 QDateTime _receptDateTime;
47 e_checkState _checkState;
48 t_orbCorr* _orbCorr;
49 t_clkCorr* _clkCorr;
50};
51
52
53class t_ephGPS : public t_eph {
54 friend class t_ephEncoder;
55 friend class RTCM3Decoder;
56 public:
57 t_ephGPS() {
58 _clock_bias = 0.0;
59 _clock_drift = 0.0;
60 _clock_driftrate = 0.0;
61 _IODE = 0.0;
62 _Crs = 0.0;
63 _Delta_n = 0.0;
64 _M0 = 0.0;
65 _Cuc = 0.0;
66 _e = 0.0;
67 _Cus = 0.0;
68 _sqrt_A = 0.0;
69 _TOEsec = 0.0;
70 _Cic = 0.0;
71 _OMEGA0 = 0.0;
72 _Cis = 0.0;
73 _i0 = 0.0;
74 _Crc = 0.0;
75 _omega = 0.0;
76 _OMEGADOT = 0.0;
77 _IDOT = 0.0;
78 _L2Codes = 0.0;
79 _TOEweek = 0.0;
80 _L2PFlag = 0.0;
81 _ura = 0.0;
82 _health = 0.0;
83 _TGD = 0.0;
84 _IODC = 0.0;
85 _TOT = 0.0;
86 _fitInterval = 0.0;
87 }
88 t_ephGPS(float rnxVersion, const QStringList& lines);
89 virtual ~t_ephGPS() {}
90
91 virtual e_type type() const {
92 switch (_prn.system()) {
93 case 'J':
94 return t_eph::QZSS;
95 case 'I':
96 return t_eph::IRNSS;
97 };
98 return t_eph::GPS;
99 }
100 virtual QString toString(double version) const;
101 virtual unsigned int IOD() const { return static_cast<unsigned int>(_IODE); }
102 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
103
104 private:
105 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
106
107 double _clock_bias; // [s]
108 double _clock_drift; // [s/s]
109 double _clock_driftrate; // [s/s^2]
110
111 double _IODE; // IODEC in case of IRNSS
112 double _Crs; // [m]
113 double _Delta_n; // [rad/s]
114 double _M0; // [rad]
115
116 double _Cuc; // [rad]
117 double _e; //
118 double _Cus; // [rad]
119 double _sqrt_A; // [m^0.5]
120
121 double _TOEsec; // [s]
122 double _Cic; // [rad]
123 double _OMEGA0; // [rad]
124 double _Cis; // [rad]
125
126 double _i0; // [rad]
127 double _Crc; // [m]
128 double _omega; // [rad]
129 double _OMEGADOT; // [rad/s]
130
131 double _IDOT; // [rad/s]
132 double _L2Codes; // Codes on L2 channel (not valid for IRNSS)
133 double _TOEweek;
134 double _L2PFlag; // L2 P data flag (not valid for IRNSS)
135
136 mutable double _ura; // SV accuracy
137 double _health; // SV health
138 double _TGD; // [s]
139 double _IODC; // (not valid for IRNSS)
140
141 double _TOT; // Transmisstion time
142 double _fitInterval; // Fit interval (not valid for IRNSS)
143};
144
145class t_ephGlo : public t_eph {
146 friend class t_ephEncoder;
147 friend class RTCM3Decoder;
148 public:
149 t_ephGlo() {
150 _xv.ReSize(6);
151 _gps_utc = 0.0;
152 _tau = 0.0;
153 _gamma = 0.0;
154 _tki = 0.0;
155 _x_pos = 0.0;
156 _x_velocity = 0.0;
157 _x_acceleration = 0.0;
158 _health = 0.0;
159 _y_pos = 0.0;
160 _y_velocity = 0.0;
161 _y_acceleration = 0.0;
162 _frequency_number = 0.0;
163 _z_pos = 0.0;
164 _z_velocity = 0.0;
165 _z_acceleration = 0.0;
166 _E = 0.0;
167 }
168 t_ephGlo(float rnxVersion, const QStringList& lines);
169 virtual ~t_ephGlo() {}
170
171 virtual e_type type() const {return t_eph::GLONASS;}
172 virtual QString toString(double version) const;
173 virtual unsigned int IOD() const;
174 virtual int slotNum() const {return int(_frequency_number);}
175
176 private:
177 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
178 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
179
180 mutable bncTime _tt; // time
181 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
182
183 double _gps_utc;
184 double _tau; // [s]
185 double _gamma; //
186 mutable double _tki; // message frame time
187
188 double _x_pos; // [km]
189 double _x_velocity; // [km/s]
190 double _x_acceleration; // [km/s^2]
191 double _health; // 0 = O.K.
192
193 double _y_pos; // [km]
194 double _y_velocity; // [km/s]
195 double _y_acceleration; // [km/s^2]
196 double _frequency_number; // ICD-GLONASS data position
197
198 double _z_pos; // [km]
199 double _z_velocity; // [km/s]
200 double _z_acceleration; // [km/s^2]
201 double _E; // Age of Information [days]
202};
203
204class t_ephGal : public t_eph {
205 friend class t_ephEncoder;
206 friend class RTCM3Decoder;
207 public:
208 t_ephGal() {
209 _clock_bias = 0.0;
210 _clock_drift = 0.0;
211 _clock_driftrate = 0.0;
212 _IODnav = 0.0;
213 _Crs = 0.0;
214 _Delta_n = 0.0;
215 _M0 = 0.0;
216 _Cuc = 0.0;
217 _e = 0.0;
218 _Cus = 0.0;
219 _sqrt_A = 0.0;
220 _TOEsec = 0.0;
221 _Cic = 0.0;
222 _OMEGA0 = 0.0;
223 _Cis = 0.0;
224 _i0 = 0.0;
225 _Crc = 0.0;
226 _omega = 0.0;
227 _OMEGADOT = 0.0;
228 _IDOT = 0.0;
229 _TOEweek = 0.0;
230 _SISA = 0.0;
231 _E5aHS = 0.0;
232 _E5bHS = 0.0;
233 _E1_bHS = 0.0;
234 _BGD_1_5A = 0.0;
235 _BGD_1_5B = 0.0;
236 _TOT = 0.0;
237 };
238 t_ephGal(float rnxVersion, const QStringList& lines);
239 virtual ~t_ephGal() {}
240
241 virtual QString toString(double version) const;
242 virtual e_type type() const {return t_eph::Galileo;}
243 virtual unsigned int IOD() const { return static_cast<unsigned long>(_IODnav); }
244
245 private:
246 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
247
248 double _clock_bias; // [s]
249 double _clock_drift; // [s/s]
250 double _clock_driftrate; // [s/s^2]
251
252 double _IODnav;
253 double _Crs; // [m]
254 double _Delta_n; // [rad/s]
255 double _M0; // [rad]
256
257 double _Cuc; // [rad]
258 double _e; //
259 double _Cus; // [rad]
260 double _sqrt_A; // [m^0.5]
261
262 double _TOEsec; // [s]
263 double _Cic; // [rad]
264 double _OMEGA0; // [rad]
265 double _Cis; // [rad]
266
267 double _i0; // [rad]
268 double _Crc; // [m]
269 double _omega; // [rad]
270 double _OMEGADOT; // [rad/s]
271
272 double _IDOT; // [rad/s]
273 double _TOEweek;
274 // spare
275
276 mutable double _SISA; // Signal In Space Accuracy
277 double _E5aHS; // [0..3] E5a Health Status
278 double _E5bHS; // [0..3] E5b Health Status
279 double _E1_bHS; // [0..3] E1-b Health Status
280 double _BGD_1_5A; // group delay [s]
281 double _BGD_1_5B; // group delay [s]
282
283 double _TOT; // [s]
284 /** Data comes from I/NAV when <code>true</code> */
285 bool _inav;
286 /** Data comes from F/NAV when <code>true</code> */
287 bool _fnav;
288 /** EE Data is not valid */
289 bool _e1DataInValid;
290 /** E5A Data is not valid */
291 bool _e5aDataInValid;
292 /** E5B Data is not valid */
293 bool _e5bDataInValid;
294};
295
296class t_ephSBAS : public t_eph {
297 friend class t_ephEncoder;
298 friend class RTCM3Decoder;
299 public:
300 t_ephSBAS() {
301 _IODN = 0;
302 _TOW = 0.0;
303 _agf0 = 0.0;
304 _agf1 = 0.0;
305 _x_pos = 0.0;
306 _x_velocity = 0.0;
307 _x_acceleration = 0.0;
308 _y_pos = 0.0;
309 _y_velocity = 0.0;
310 _y_acceleration = 0.0;
311 _z_pos = 0.0;
312 _z_velocity = 0.0;
313 _z_acceleration = 0.0;
314 _ura = 0.0;
315 _health = 0.0;
316 }
317 t_ephSBAS(float rnxVersion, const QStringList& lines);
318 virtual ~t_ephSBAS() {}
319
320 virtual e_type type() const {return t_eph::SBAS;}
321 virtual unsigned int IOD() const;
322 virtual QString toString(double version) const;
323
324 private:
325 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
326
327 int _IODN;
328 double _TOW; // not used (set to 0.9999e9)
329 double _agf0; // [s] clock correction
330 double _agf1; // [s/s] clock correction drift
331
332 double _x_pos; // [m]
333 double _x_velocity; // [m/s]
334 double _x_acceleration; // [m/s^2]
335
336 double _y_pos; // [m]
337 double _y_velocity; // [m/s]
338 double _y_acceleration; // [m/s^2]
339
340 double _z_pos; // [m]
341 double _z_velocity; // [m/s]
342 double _z_acceleration; // [m/s^2]
343
344 mutable double _ura;
345 double _health;
346};
347
348class t_ephBDS : public t_eph {
349 friend class t_ephEncoder;
350 friend class RTCM3Decoder;
351 public:
352 t_ephBDS() : _TOEweek(-1.0) {
353 _TOT = 0.0;
354 _AODE = 0;
355 _AODC = 0;
356 _URAI = 0;
357 _URA = 0.0;
358 _clock_bias = 0.0;
359 _clock_drift = 0.0;
360 _clock_driftrate = 0.0;
361 _Crs = 0.0;
362 _Delta_n = 0.0;
363 _M0 = 0.0;
364 _Cuc = 0.0;
365 _e = 0.0;
366 _Cus = 0.0;
367 _sqrt_A = 0.0;
368 _Cic = 0.0;
369 _OMEGA0 = 0.0;
370 _Cis = 0.0;
371 _i0 = 0.0;
372 _Crc = 0.0;
373 _omega = 0.0;
374 _OMEGADOT = 0.0;
375 _IDOT = 0.0;
376 _TGD1 = 0.0;
377 _TGD2 = 0.0;
378 _SatH1 = 0.0;
379 _TOW = 0.0;
380 _TOEsec = 0.0;
381 _TOEweek = 0.0;
382 }
383 t_ephBDS(float rnxVersion, const QStringList& lines);
384 virtual ~t_ephBDS() {}
385
386 virtual e_type type() const {return t_eph::BDS;}
387 virtual unsigned int IOD() const;
388 virtual QString toString(double version) const;
389
390 private:
391 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
392
393 double _TOT;
394 bncTime _TOE;
395 int _AODE;
396 int _AODC;
397 int _URAI; // [0..15] index from RTCM stream
398 mutable double _URA; // user range accuracy
399 double _clock_bias; // [s]
400 double _clock_drift; // [s/s]
401 double _clock_driftrate; // [s/s^2]
402 double _Crs; // [m]
403 double _Delta_n; // [rad/s]
404 double _M0; // [rad]
405 double _Cuc; // [rad]
406 double _e; //
407 double _Cus; // [rad]
408 double _sqrt_A; // [m^0.5]
409 double _Cic; // [rad]
410 double _OMEGA0; // [rad]
411 double _Cis; // [rad]
412 double _i0; // [rad]
413 double _Crc; // [m]
414 double _omega; // [rad]
415 double _OMEGADOT; // [rad/s]
416 double _IDOT; // [rad/s]
417 double _TGD1; // [s]
418 double _TGD2; // [s]
419 int _SatH1; //
420 double _TOW; // [s] of BDT week
421 double _TOEsec; // [s] of BDT week
422 double _TOEweek; // BDT week will be set only in case of RINEX file input
423};
424#endif
Note: See TracBrowser for help on using the repository browser.