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

Last change on this file since 10577 was 10577, checked in by stuerze, 3 months ago

updates regarding RINEX version 4.02 navigation information

File size: 19.1 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
13class t_orbCorr;
14class t_clkCorr;
15// enum e_navType {EPH, STO, EOP, ION};
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, unhealthy};
21 enum e_ephType {undefined, LNAV, FDMA, FNAV, INAF, D1, D2, SBASL1, CNAV, CNV1, CNV2, CNV3, L1NV, L1OC, L3OC};
22
23 t_eph();
24 virtual ~t_eph();
25
26 virtual e_type type() const = 0;
27 virtual QString toString(double version) const = 0;
28 virtual unsigned int IOD() const = 0;
29 virtual unsigned int isUnhealthy() 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 void setCheckState(e_checkState checkState) {_checkState = checkState;}
34 e_checkState checkState() const {return _checkState;}
35 QString checkStateToString() {
36 switch (_checkState) {
37 case unchecked: return "unchecked";
38 case ok: return "ok";
39 case bad: return "bad";
40 case outdated: return "outdated";
41 case unhealthy: return "unhealthy";
42 default: return "unknown";
43 }
44 }
45 e_ephType ephType() const {return _ephType;}
46 t_irc setEphType(QString ephTypeStr);
47
48 t_prn prn() const {return _prn;}
49 t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
50 void setOrbCorr(const t_orbCorr* orbCorr);
51 void setClkCorr(const t_clkCorr* clkCorr);
52 const QDateTime& receptDateTime() const {return _receptDateTime;}
53 const QString receptStaID() const {return _receptStaID;}
54 static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version);
55 static QString rinexDateStr(const bncTime& tt, const QString& prnStr, double version);
56 static QString ephTypeStr(e_ephType ephType, const t_prn& prn, double version);
57 static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {return eph1->_TOC < eph2->_TOC;}
58 static bool prnSort(const t_eph* eph1, const t_eph* eph2) {return eph1->prn() < eph2->prn();}
59
60 protected:
61 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
62 t_prn _prn;
63 bncTime _TOC;
64 QDateTime _receptDateTime;
65 QString _receptStaID;
66 e_checkState _checkState;
67 e_ephType _ephType; // defined in RINEX 4
68 t_orbCorr* _orbCorr;
69 t_clkCorr* _clkCorr;
70};
71
72class t_ephGPS : public t_eph {
73 friend class t_ephEncoder;
74 friend class RTCM3Decoder;
75 public:
76 t_ephGPS() {
77 _clock_bias = 0.0;
78 _clock_drift = 0.0;
79 _clock_driftrate = 0.0;
80 _IODE = 0.0;
81 _Crs = 0.0;
82 _Delta_n = 0.0;
83 _M0 = 0.0;
84 _Cuc = 0.0;
85 _e = 0.0;
86 _Cus = 0.0;
87 _sqrt_A = 0.0;
88 _TOEsec = 0.0;
89 _Cic = 0.0;
90 _OMEGA0 = 0.0;
91 _Cis = 0.0;
92 _i0 = 0.0;
93 _Crc = 0.0;
94 _omega = 0.0;
95 _OMEGADOT = 0.0;
96 _IDOT = 0.0;
97 _L2Codes = 0.0;
98 _TOEweek = 0.0;
99 _L2PFlag = 0.0;
100 _ura = 0.0;
101 _health = 0.0;
102 _TGD = 0.0;
103 _IODC = 0.0;
104 _TOT = 0.0;
105 _fitInterval = 0.0;
106 _ADOT = 0.0;
107 _top = 0.0;
108 _Delta_n_dot = 0.0;
109 _URAI = 0.0;
110 _URAI_NED0 = 0.0;
111 _URAI_NED1 = 0.0;
112 _URAI_NED2 = 0.0;
113 _URAI_ED = 0.0;
114 _ISC_L1CA = 0.0;
115 _ISC_L2C = 0.0;
116 _ISC_L5I5 = 0.0;
117 _ISC_L5Q5 = 0.0;
118 _ISC_L1Cd = 0.0;
119 _ISC_L1Cp = 0.0;
120 _RSF = 0.0;
121 _ISC_S = 0.0;
122 _ISC_L1D = 0.0;
123 _ISC_L1P = 0.0;
124 _wnop = 0.0;
125 _intSF = -1;
126 _ephSF = -1;
127 _L2Cphasing = -1;
128 _alert = -1;
129 _receptStaID = "";
130 }
131 t_ephGPS(double rnxVersion, const QStringList& lines);
132 virtual ~t_ephGPS() {}
133
134 virtual e_type type() const {
135 switch (_prn.system()) {
136 case 'J':
137 return t_eph::QZSS;
138 case 'I':
139 return t_eph::IRNSS;
140 };
141 return t_eph::GPS;
142 }
143 virtual QString toString(double version) const;
144 virtual unsigned int IOD() const { return static_cast<unsigned int>(_IODE); }
145 virtual unsigned int isUnhealthy() const { return static_cast<unsigned int>(_health); }
146 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
147
148 private:
149 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
150
151 double _clock_bias; // [s]
152 double _clock_drift; // [s/s]
153 double _clock_driftrate; // [s/s^2]
154
155 double _IODE; // IODEC in case of IRNSS
156 double _Crs; // [m]
157 double _Delta_n; // [rad/s]
158 double _M0; // [rad]
159
160 double _Cuc; // [rad]
161 double _e; // []
162 double _Cus; // [rad]
163 double _sqrt_A; // [m^0.5]
164
165 double _TOEsec; // [s of GPS week]
166 double _Cic; // [rad]
167 double _OMEGA0; // [rad]
168 double _Cis; // [rad]
169
170 double _i0; // [rad]
171 double _Crc; // [m]
172 double _omega; // [rad]
173 double _OMEGADOT; // [rad/s]
174
175 double _IDOT; // [rad/s]
176 double _L2Codes; // Codes on L2 channel (not valid for IRNSS)
177 double _TOEweek; // GPS week # to go with TOE, cont. number, not mode 1024
178 double _L2PFlag; // L2 P data flag (not valid for IRNSS and QZSS)
179
180 mutable double _ura; // SV accuracy [m]
181 double _health; // SV health
182 double _TGD; // [s]
183 double _IODC; // (not valid for IRNSS)
184
185 double _TOT; // Transmission time
186 double _fitInterval; // Fit interval in hours (not valid for IRNSS)
187
188 double _ADOT; // [m/s]
189 double _top; // [s]
190 double _Delta_n_dot; // [rad/s^2]
191
192 double _URAI; // [] user range accuracy index
193 double _URAI_NED0; // []
194 double _URAI_NED1; // []
195 double _URAI_NED2; // []
196 double _URAI_ED; // []
197
198 double _ISC_L1CA; // [s] inter signal correction
199 double _ISC_L2C; // [s]
200 double _ISC_L5I5; // [s]
201 double _ISC_L5Q5; // [s]
202 double _ISC_L1Cd; // [s]
203 double _ISC_L1Cp; // [s]
204
205 double _RSF; // [-] Reference Signal Flag for IRNSS
206 double _ISC_S; // [s]
207 double _ISC_L1D; // [s]
208 double _ISC_L1P; // [s]
209
210 bool _intSF; // [-] integrity status flag
211 bool _ephSF; // [-] ephemeris status flag (QZSS)
212 bool _L2Cphasing; // [-] L2C phasing flag
213 bool _alert; // [-] alert flag
214
215 double _wnop; // GPS continuous week number with the ambiguity resolved (same as _TOEweek?)
216};
217
218class t_ephGlo : public t_eph {
219 friend class t_ephEncoder;
220 friend class RTCM3Decoder;
221 public:
222 t_ephGlo() {
223 _xv.ReSize(6); _xv = 0.0;
224 _gps_utc = 0.0;
225 _tau = 0.0;
226 _gamma = 0.0;
227 _tki = 0.0;
228 _x_pos = 0.0;
229 _x_velocity = 0.0;
230 _x_acceleration = 0.0;
231 _health = 0.0;
232 _y_pos = 0.0;
233 _y_velocity = 0.0;
234 _y_acceleration = 0.0;
235 _frequency_number = 0.0;
236 _z_pos = 0.0;
237 _z_velocity = 0.0;
238 _z_acceleration = 0.0;
239 _E = 0.0;
240 _almanac_health = 0.0;
241 _almanac_health_availablility_indicator = 0.0;
242 _additional_data_availability = 0.0;
243 _tauC = 0.0;
244 _P1 = 0.0;
245 _P2 = 0.0;
246 _P3 = 0.0;
247 _NA = 0.0;
248 _M_P = 0.0;
249 _M_l3 = 0.0;
250 _M_delta_tau = 0.0;
251 _M_P4 = 0.0;
252 _M_FT = 0.0;
253 _M_NT = 0.0;
254 _M_M = 0.0;
255 _M_N4 = 0.0;
256 _M_tau_GPS = 0.0;
257 _M_l5 = 0.0;
258 _receptStaID = "";
259 _flags_unknown = true;
260 }
261 t_ephGlo(double rnxVersion, const QStringList& lines);
262 virtual ~t_ephGlo() {}
263
264 virtual e_type type() const {return t_eph::GLONASS;}
265 virtual QString toString(double version) const;
266 virtual unsigned int IOD() const;
267 virtual unsigned int isUnhealthy() const;
268 virtual int slotNum() const {return int(_frequency_number);}
269
270 private:
271 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
272 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
273
274 mutable bncTime _tt; // time
275 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
276
277 double _gps_utc;
278 double _tau; // [s]
279 double _gamma; // [-]
280 mutable double _tki; // message frame time
281
282 double _x_pos; // [km]
283 double _x_velocity; // [km/s]
284 double _x_acceleration; // [km/s^2]
285 double _health; // 0 = O.K. MSB of Bn word
286
287 double _y_pos; // [km]
288 double _y_velocity; // [km/s]
289 double _y_acceleration; // [km/s^2]
290 double _frequency_number; // ICD-GLONASS data position
291
292 double _z_pos; // [km]
293 double _z_velocity; // [km/s]
294 double _z_acceleration; // [km/s^2]
295 double _E; // Age of Information [days]
296
297 double _almanac_health; // Cn word
298 double _almanac_health_availablility_indicator;
299
300 double _additional_data_availability; //
301 double _tauC; // GLONASS time scale correction to UTC(SU) time [sec]
302 double _P1; // flag of the immediate data updating [-]
303 double _P2; // flag of oddness or evenness of the value of tb for intervals 30 or 60 minutes [-]
304 double _P3; // flag indicating a number of satellites for which almanac is transmitted within given frame [-]
305 double _NA; // calendar day number within the 4-year period [days]
306
307 double _M_P; // control segment parameter that indicates the satellite operation mode with respect of time parameters
308 double _M_l3; // health flag
309 double _M_delta_tau; // [sec]
310 double _M_P4; // flag to show that ephemeris parameters are present [-]
311 double _M_FT; // Indicator for predicted satellite User Range Accuracy (URAI) [-]
312 double _M_NT; // current date, calendar number of day within 4-year interval [days]
313 double _M_M; // type of satellite transmitting navigation signal: 0 = GLONASS, 1 = GLONASS-M satellite [-]
314 double _M_N4; // 4-year interval number starting from 1996
315 double _M_tau_GPS; // correction to GPS time relative to GLONASS time [days]
316 double _M_l5; // health flag
317 bool _flags_unknown; // status and health flags are unknown (rnx version < 3.05) or known (rnx version >= 3.05)
318};
319
320class t_ephGal : public t_eph {
321 friend class t_ephEncoder;
322 friend class RTCM3Decoder;
323 public:
324 t_ephGal() {
325 _clock_bias = 0.0;
326 _clock_drift = 0.0;
327 _clock_driftrate = 0.0;
328 _IODnav = 0.0;
329 _Crs = 0.0;
330 _Delta_n = 0.0;
331 _M0 = 0.0;
332 _Cuc = 0.0;
333 _e = 0.0;
334 _Cus = 0.0;
335 _sqrt_A = 0.0;
336 _TOEsec = 0.0;
337 _Cic = 0.0;
338 _OMEGA0 = 0.0;
339 _Cis = 0.0;
340 _i0 = 0.0;
341 _Crc = 0.0;
342 _omega = 0.0;
343 _OMEGADOT = 0.0;
344 _IDOT = 0.0;
345 _TOEweek = 0.0;
346 _SISA = 0.0;
347 _E5aHS = 0.0;
348 _E5bHS = 0.0;
349 _E1_bHS = 0.0;
350 _BGD_1_5A = 0.0;
351 _BGD_1_5B = 0.0;
352 _TOT = 0.0;
353 bool _inav;
354 /** Data comes from F/NAV when <code>true</code> */
355 bool _fnav;
356 bool _e1DataInValid;
357 bool _e5aDataInValid;
358 bool _e5bDataInValid;
359 _receptStaID = "";
360 };
361 t_ephGal(double rnxVersion, const QStringList& lines);
362 virtual ~t_ephGal() {}
363
364 virtual QString toString(double version) const;
365 virtual e_type type() const {return t_eph::Galileo;}
366 virtual unsigned int IOD() const { return static_cast<unsigned long>(_IODnav); }
367 virtual unsigned int isUnhealthy() const;
368
369 private:
370 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
371
372 double _clock_bias; // [s]
373 double _clock_drift; // [s/s]
374 double _clock_driftrate; // [s/s^2]
375
376 double _IODnav;
377 double _Crs; // [m]
378 double _Delta_n; // [rad/s]
379 double _M0; // [rad]
380
381 double _Cuc; // [rad]
382 double _e; //
383 double _Cus; // [rad]
384 double _sqrt_A; // [m^0.5]
385
386 double _TOEsec; // [s]
387 double _Cic; // [rad]
388 double _OMEGA0; // [rad]
389 double _Cis; // [rad]
390
391 double _i0; // [rad]
392 double _Crc; // [m]
393 double _omega; // [rad]
394 double _OMEGADOT; // [rad/s]
395
396 double _IDOT; // [rad/s]
397 double _TOEweek;
398 // spare
399
400 mutable double _SISA; // Signal In Space Accuracy
401 double _E5aHS; // [0..3] E5a Health Status
402 double _E5bHS; // [0..3] E5b Health Status
403 double _E1_bHS; // [0..3] E1-b Health Status
404 double _BGD_1_5A; // group delay [s]
405 double _BGD_1_5B; // group delay [s]
406
407 double _TOT; // [s]
408 /** Data comes from I/NAV when <code>true</code> */
409 bool _inav;
410 /** Data comes from F/NAV when <code>true</code> */
411 bool _fnav;
412 /** E1 Data is not valid */
413 bool _e1DataInValid;
414 /** E5A Data is not valid */
415 bool _e5aDataInValid;
416 /** E5B Data is not valid */
417 bool _e5bDataInValid;
418};
419
420class t_ephSBAS : public t_eph {
421 friend class t_ephEncoder;
422 friend class RTCM3Decoder;
423 public:
424 t_ephSBAS() {
425 _IODN = 0;
426 _TOT = 0.0;
427 _agf0 = 0.0;
428 _agf1 = 0.0;
429 _x_pos = 0.0;
430 _x_velocity = 0.0;
431 _x_acceleration = 0.0;
432 _y_pos = 0.0;
433 _y_velocity = 0.0;
434 _y_acceleration = 0.0;
435 _z_pos = 0.0;
436 _z_velocity = 0.0;
437 _z_acceleration = 0.0;
438 _ura = 0.0;
439 _health = 0.0;
440 _receptStaID = "";
441 }
442 t_ephSBAS(double rnxVersion, const QStringList& lines);
443 virtual ~t_ephSBAS() {}
444
445 virtual e_type type() const {return t_eph::SBAS;}
446 virtual unsigned int IOD() const;
447 virtual unsigned int isUnhealthy() const;
448 virtual QString toString(double version) const;
449
450 private:
451 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
452
453 int _IODN;
454 double _TOT; // not used (set to 0.9999e9)
455 double _agf0; // [s] clock correction
456 double _agf1; // [s/s] clock correction drift
457
458 double _x_pos; // [m]
459 double _x_velocity; // [m/s]
460 double _x_acceleration; // [m/s^2]
461
462 double _y_pos; // [m]
463 double _y_velocity; // [m/s]
464 double _y_acceleration; // [m/s^2]
465
466 double _z_pos; // [m]
467 double _z_velocity; // [m/s]
468 double _z_acceleration; // [m/s^2]
469
470 mutable double _ura;
471 double _health;
472};
473
474class t_ephBDS : public t_eph {
475 friend class t_ephEncoder;
476 friend class RTCM3Decoder;
477 public:
478 t_ephBDS() {
479 _TOT = 0.0;
480 _AODE = 0;
481 _AODC = 0;
482 _URAI = 0;
483 _URA = 0.0;
484 _clock_bias = 0.0;
485 _clock_drift = 0.0;
486 _clock_driftrate = 0.0;
487 _Crs = 0.0;
488 _Delta_n = 0.0;
489 _M0 = 0.0;
490 _Cuc = 0.0;
491 _e = 0.0;
492 _Cus = 0.0;
493 _sqrt_A = 0.0;
494 _Cic = 0.0;
495 _OMEGA0 = 0.0;
496 _Cis = 0.0;
497 _i0 = 0.0;
498 _Crc = 0.0;
499 _omega = 0.0;
500 _OMEGADOT = 0.0;
501 _IDOT = 0.0;
502 _TOEsec = 0.0;
503 _BDTweek = 0.0;
504 _Delta_n_dot = 0.0;
505 _satType = 0.0;
506 _top = 0.0;
507 _SISAI_oe = 0.0;
508 _SISAI_ocb = 0.0;
509 _SISAI_oc1 = 0.0;
510 _SISAI_oc2 = 0.0;
511 _ISC_B1Cd = 0.0;
512 _ISC_B2ad = 0.0;
513 _TGD1 = 0.0;
514 _TGD2 = 0.0;
515 _TGD_B1Cp = 0.0;
516 _TGD_B2ap = 0.0;
517 _TGD_B2bI = 0.0;
518 _SISMAI = 0.0;
519 _SatH1 = 0;
520 _health = 0;
521 _INTEGRITYF_B1C = 0.0;
522 _INTEGRITYF_B2aB1C = 0.0;
523 _INTEGRITYF_B2b = 0.0;
524 _IODC = 0.0;
525 _IODE = 0.0;
526 _receptStaID = "";
527 }
528 t_ephBDS(double rnxVersion, const QStringList& lines);
529 virtual ~t_ephBDS() {}
530
531 virtual e_type type() const {return t_eph::BDS;}
532 virtual unsigned int IOD() const;
533 virtual unsigned int isUnhealthy() const;
534 virtual QString toString(double version) const;
535
536 private:
537 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
538
539 double _TOT; // [s] of BDT week
540 bncTime _TOE;
541 int _AODE;
542 int _AODC;
543 int _URAI; // [0..15] index from RTCM stream
544 mutable double _URA; // user range accuracy [m]
545 double _clock_bias; // [s]
546 double _clock_drift; // [s/s]
547 double _clock_driftrate; // [s/s^2]
548 double _Crs; // [m]
549 double _Delta_n; // [rad/s]
550 double _M0; // [rad]
551 double _Cuc; // [rad]
552 double _e; //
553 double _Cus; // [rad]
554 double _sqrt_A; // [m^0.5]
555 double _Cic; // [rad]
556 double _OMEGA0; // [rad]
557 double _Cis; // [rad]
558 double _i0; // [rad]
559 double _Crc; // [m]
560 double _omega; // [rad]
561 double _OMEGADOT; // [rad/s]
562 double _IDOT; // [rad/s]
563 double _TOEsec; // [s] of BDT week
564 double _BDTweek; // BDT week
565
566 double _Delta_n_dot; // [rad/s^2]
567 double _satType; // 0..reserved, 1..GEO, 2..IGSO, 3..MEO
568 double _top; // [s]
569
570 double _SISAI_oe; // []
571 double _SISAI_ocb; // []
572 double _SISAI_oc1; // []
573 double _SISAI_oc2; // []
574
575 double _ISC_B1Cd; // [s]
576 double _ISC_B2ad; // [s]
577
578 double _TGD1; // [s]
579 double _TGD2; // [s]
580 double _TGD_B1Cp; // [s]
581 double _TGD_B2ap; // [s]
582 double _TGD_B2bI; // [s]
583
584 double _SISMAI; // []
585
586 int _SatH1; //
587 int _health; //
588
589 double _INTEGRITYF_B1C; // 3 bits word from sf 3
590 double _INTEGRITYF_B2aB1C;// 6 bits word with integrity bits in msg 10-11, 30.34 or 40
591 double _INTEGRITYF_B2b; // 3 bits word from msg 10
592
593 double _IODC; // []
594 double _IODE; // [] IODE are the same as the 8 LSBs of IODC
595
596};
597
598#endif
Note: See TracBrowser for help on using the repository browser.