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

Last change on this file since 10518 was 10315, checked in by stuerze, 10 months ago

health status of the Galileo satellites is now defined by the combination of HS, DVS and SISA

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