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

Last change on this file since 9673 was 9673, checked in by stuerze, 2 years ago

minor changes

File size: 15.7 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};
[4005]21
[5749]22 t_eph();
[7278]23 virtual ~t_eph();
[4018]24
[6109]25 virtual e_type type() const = 0;
[4013]26 virtual QString toString(double version) const = 0;
[7169]27 virtual unsigned int IOD() const = 0;
[8187]28 virtual unsigned int isUnhealthy() const = 0;
[6109]29 virtual int slotNum() const {return 0;}
[4018]30 bncTime TOC() const {return _TOC;}
[6109]31 bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
[6518]32 e_checkState checkState() const {return _checkState;}
[9673]33 QString checkStateToString() {
34 switch (_checkState) {
35 case unchecked:
36 return "unchecked";
37 case ok:
38 return "ok";
39 case bad:
40 return "bad";
41 case outdated:
42 return "outdated";
43 case unhealthy:
44 return "unhealthy";
45 default:
46 return "unknown";
47 }
48 }
[6519]49 void setCheckState(e_checkState checkState) {_checkState = checkState;}
[6109]50 t_prn prn() const {return _prn;}
51 t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
[6141]52 void setOrbCorr(const t_orbCorr* orbCorr);
53 void setClkCorr(const t_clkCorr* clkCorr);
[3174]54 const QDateTime& receptDateTime() const {return _receptDateTime;}
[9212]55 const QString receptStaID() const {return _receptStaID;}
[6109]56 static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version);
57 static QString rinexDateStr(const bncTime& tt, const QString& prnStr, double version);
58 static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {return eph1->_TOC < eph2->_TOC;}
[8799]59 static bool prnSort(const t_eph* eph1, const t_eph* eph2) {return eph1->prn() < eph2->prn();}
[1025]60
[7278]61 protected:
[6213]62 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
[6518]63 t_prn _prn;
64 bncTime _TOC;
65 QDateTime _receptDateTime;
[9212]66 QString _receptStaID;
[6518]67 e_checkState _checkState;
68 t_orbCorr* _orbCorr;
69 t_clkCorr* _clkCorr;
[1025]70};
71
72
73class t_ephGPS : public t_eph {
[5852]74 friend class t_ephEncoder;
[6812]75 friend class RTCM3Decoder;
[1025]76 public:
[7625]77 t_ephGPS() {
78 _clock_bias = 0.0;
79 _clock_drift = 0.0;
80 _clock_driftrate = 0.0;
81 _IODE = 0.0;
82 _Crs = 0.0;
83 _Delta_n = 0.0;
84 _M0 = 0.0;
85 _Cuc = 0.0;
86 _e = 0.0;
87 _Cus = 0.0;
88 _sqrt_A = 0.0;
89 _TOEsec = 0.0;
90 _Cic = 0.0;
91 _OMEGA0 = 0.0;
92 _Cis = 0.0;
93 _i0 = 0.0;
94 _Crc = 0.0;
95 _omega = 0.0;
96 _OMEGADOT = 0.0;
97 _IDOT = 0.0;
98 _L2Codes = 0.0;
99 _TOEweek = 0.0;
100 _L2PFlag = 0.0;
101 _ura = 0.0;
102 _health = 0.0;
103 _TGD = 0.0;
104 _IODC = 0.0;
105 _TOT = 0.0;
106 _fitInterval = 0.0;
[9212]107 _receptStaID = "";
[7625]108 }
[9367]109 t_ephGPS(double rnxVersion, const QStringList& lines);
[2221]110 virtual ~t_ephGPS() {}
[4005]111
[8168]112 virtual e_type type() const {
113 switch (_prn.system()) {
114 case 'J':
115 return t_eph::QZSS;
116 case 'I':
117 return t_eph::IRNSS;
118 };
119 return t_eph::GPS;
120 }
[4013]121 virtual QString toString(double version) const;
[8139]122 virtual unsigned int IOD() const { return static_cast<unsigned int>(_IODE); }
[8187]123 virtual unsigned int isUnhealthy() const { return static_cast<unsigned int>(_health); }
[4366]124 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
125
[1025]126 private:
[6213]127 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[6109]128
[7278]129 double _clock_bias; // [s]
130 double _clock_drift; // [s/s]
[4018]131 double _clock_driftrate; // [s/s^2]
[1025]132
[8168]133 double _IODE; // IODEC in case of IRNSS
[7278]134 double _Crs; // [m]
[4018]135 double _Delta_n; // [rad/s]
[7278]136 double _M0; // [rad]
[1025]137
[7278]138 double _Cuc; // [rad]
139 double _e; //
140 double _Cus; // [rad]
[4018]141 double _sqrt_A; // [m^0.5]
[1025]142
[7278]143 double _TOEsec; // [s]
144 double _Cic; // [rad]
145 double _OMEGA0; // [rad]
146 double _Cis; // [rad]
[4018]147
[7278]148 double _i0; // [rad]
149 double _Crc; // [m]
150 double _omega; // [rad]
[4018]151 double _OMEGADOT; // [rad/s]
152
153 double _IDOT; // [rad/s]
[8168]154 double _L2Codes; // Codes on L2 channel (not valid for IRNSS)
[4018]155 double _TOEweek;
[8790]156 double _L2PFlag; // L2 P data flag (not valid for IRNSS and QZSS)
[4018]157
[9316]158 mutable double _ura; // SV accuracy [m]
[4018]159 double _health; // SV health
[7278]160 double _TGD; // [s]
[8168]161 double _IODC; // (not valid for IRNSS)
[4018]162
[8790]163 double _TOT; // Transmission time
[8925]164 double _fitInterval; // Fit interval in hours (not valid for IRNSS)
[1025]165};
166
[2221]167class t_ephGlo : public t_eph {
[5853]168 friend class t_ephEncoder;
[6812]169 friend class RTCM3Decoder;
[2221]170 public:
[7625]171 t_ephGlo() {
[8495]172 _xv.ReSize(6); _xv = 0.0;
[7625]173 _gps_utc = 0.0;
174 _tau = 0.0;
175 _gamma = 0.0;
176 _tki = 0.0;
177 _x_pos = 0.0;
178 _x_velocity = 0.0;
179 _x_acceleration = 0.0;
180 _health = 0.0;
181 _y_pos = 0.0;
182 _y_velocity = 0.0;
183 _y_acceleration = 0.0;
184 _frequency_number = 0.0;
185 _z_pos = 0.0;
186 _z_velocity = 0.0;
187 _z_acceleration = 0.0;
188 _E = 0.0;
[8182]189 _almanac_health = 0.0;
190 _almanac_health_availablility_indicator = 0.0;
191 _additional_data_availability = 0.0;
192 _tauC = 0.0;
193 _P1 = 0.0;
194 _P2 = 0.0;
195 _P3 = 0.0;
196 _NA = 0.0;
197 _M_P = 0.0;
198 _M_l3 = 0.0;
199 _M_delta_tau = 0.0;
200 _M_P4 = 0.0;
201 _M_FT = 0.0;
202 _M_NT = 0.0;
203 _M_M = 0.0;
204 _M_N4 = 0.0;
205 _M_tau_GPS = 0.0;
206 _M_l5 = 0.0;
[9212]207 _receptStaID = "";
[9367]208 _flags_unknown = true;
[7625]209 }
[9367]210 t_ephGlo(double rnxVersion, const QStringList& lines);
[2221]211 virtual ~t_ephGlo() {}
212
[4005]213 virtual e_type type() const {return t_eph::GLONASS;}
[4013]214 virtual QString toString(double version) const;
[7169]215 virtual unsigned int IOD() const;
[8187]216 virtual unsigned int isUnhealthy() const;
[6109]217 virtual int slotNum() const {return int(_frequency_number);}
[2221]218
219 private:
[6213]220 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[6109]221 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
[2221]222
[7278]223 mutable bncTime _tt; // time
[2221]224 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
225
[3255]226 double _gps_utc;
[7278]227 double _tau; // [s]
[8182]228 double _gamma; // [-]
[5853]229 mutable double _tki; // message frame time
[4018]230
[7278]231 double _x_pos; // [km]
232 double _x_velocity; // [km/s]
233 double _x_acceleration; // [km/s^2]
[8182]234 double _health; // 0 = O.K. MSB of Bn word
[4018]235
[7278]236 double _y_pos; // [km]
237 double _y_velocity; // [km/s]
238 double _y_acceleration; // [km/s^2]
239 double _frequency_number; // ICD-GLONASS data position
[4018]240
[7278]241 double _z_pos; // [km]
242 double _z_velocity; // [km/s]
243 double _z_acceleration; // [km/s^2]
244 double _E; // Age of Information [days]
[8182]245
246 double _almanac_health; // Cn word
247 double _almanac_health_availablility_indicator;
248
249 double _additional_data_availability; //
250 double _tauC; // GLONASS time scale correction to UTC(SU) time [sec]
251 double _P1; // flag of the immediate data updating [-]
252 double _P2; // flag of oddness or evenness of the value of tb for intervals 30 or 60 minutes [-]
253 double _P3; // flag indicating a number of satellites for which almanac is transmitted within given frame [-]
254 double _NA; // calendar day number within the 4-year period [days]
255
256 double _M_P; // control segment parameter that indicates the satellite operation mode with respect of time parameters
257 double _M_l3; // health flag
258 double _M_delta_tau; // [sec]
259 double _M_P4; // flag to show that ephemeris parameters are present [-]
[9367]260 double _M_FT; // Indicator for predicted satellite User Range Accuracy (URAI) [-]
[8182]261 double _M_NT; // current date, calendar number of day within 4-year interval [days]
262 double _M_M; // type of satellite transmitting navigation signal: 0 = GLONASS, 1 = GLONASS-M satellite [-]
263 double _M_N4; // 4-year interval number starting from 1996
264 double _M_tau_GPS; // correction to GPS time relative to GLONASS time [days]
265 double _M_l5; // health flag
[9367]266 bool _flags_unknown; // status and health flags are unknown (rnx version < 3.05) or known (rnx version >= 3.05)
[2221]267};
268
[2770]269class t_ephGal : public t_eph {
[5853]270 friend class t_ephEncoder;
[6812]271 friend class RTCM3Decoder;
[2770]272 public:
[7625]273 t_ephGal() {
274 _clock_bias = 0.0;
275 _clock_drift = 0.0;
276 _clock_driftrate = 0.0;
277 _IODnav = 0.0;
278 _Crs = 0.0;
279 _Delta_n = 0.0;
280 _M0 = 0.0;
281 _Cuc = 0.0;
282 _e = 0.0;
283 _Cus = 0.0;
284 _sqrt_A = 0.0;
285 _TOEsec = 0.0;
286 _Cic = 0.0;
287 _OMEGA0 = 0.0;
288 _Cis = 0.0;
289 _i0 = 0.0;
290 _Crc = 0.0;
291 _omega = 0.0;
292 _OMEGADOT = 0.0;
293 _IDOT = 0.0;
294 _TOEweek = 0.0;
295 _SISA = 0.0;
296 _E5aHS = 0.0;
297 _E5bHS = 0.0;
298 _E1_bHS = 0.0;
299 _BGD_1_5A = 0.0;
300 _BGD_1_5B = 0.0;
301 _TOT = 0.0;
[9212]302 _receptStaID = "";
[7625]303 };
[9367]304 t_ephGal(double rnxVersion, const QStringList& lines);
[2770]305 virtual ~t_ephGal() {}
[4005]306
[4013]307 virtual QString toString(double version) const;
[4005]308 virtual e_type type() const {return t_eph::Galileo;}
[7169]309 virtual unsigned int IOD() const { return static_cast<unsigned long>(_IODnav); }
[8187]310 virtual unsigned int isUnhealthy() const;
[2770]311
[6109]312 private:
[6213]313 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[2770]314
[7278]315 double _clock_bias; // [s]
316 double _clock_drift; // [s/s]
[2770]317 double _clock_driftrate; // [s/s^2]
[4018]318
[6812]319 double _IODnav;
[7278]320 double _Crs; // [m]
[2770]321 double _Delta_n; // [rad/s]
[7278]322 double _M0; // [rad]
[4018]323
[7278]324 double _Cuc; // [rad]
325 double _e; //
326 double _Cus; // [rad]
[2770]327 double _sqrt_A; // [m^0.5]
[4018]328
[7278]329 double _TOEsec; // [s]
330 double _Cic; // [rad]
331 double _OMEGA0; // [rad]
332 double _Cis; // [rad]
[4018]333
[7278]334 double _i0; // [rad]
335 double _Crc; // [m]
336 double _omega; // [rad]
[2770]337 double _OMEGADOT; // [rad/s]
[4018]338
[2770]339 double _IDOT; // [rad/s]
[6809]340 double _TOEweek;
[4018]341 // spare
342
[6798]343 mutable double _SISA; // Signal In Space Accuracy
[6794]344 double _E5aHS; // [0..3] E5a Health Status
345 double _E5bHS; // [0..3] E5b Health Status
346 double _E1_bHS; // [0..3] E1-b Health Status
[7278]347 double _BGD_1_5A; // group delay [s]
348 double _BGD_1_5B; // group delay [s]
[2770]349
[6809]350 double _TOT; // [s]
[6812]351 /** Data comes from I/NAV when <code>true</code> */
352 bool _inav;
353 /** Data comes from F/NAV when <code>true</code> */
354 bool _fnav;
355 /** EE Data is not valid */
356 bool _e1DataInValid;
357 /** E5A Data is not valid */
358 bool _e5aDataInValid;
359 /** E5B Data is not valid */
360 bool _e5bDataInValid;
[2770]361};
362
[6380]363class t_ephSBAS : public t_eph {
364 friend class t_ephEncoder;
[6812]365 friend class RTCM3Decoder;
[6380]366 public:
[7625]367 t_ephSBAS() {
368 _IODN = 0;
[8456]369 _TOT = 0.0;
[7625]370 _agf0 = 0.0;
371 _agf1 = 0.0;
372 _x_pos = 0.0;
373 _x_velocity = 0.0;
374 _x_acceleration = 0.0;
375 _y_pos = 0.0;
376 _y_velocity = 0.0;
377 _y_acceleration = 0.0;
378 _z_pos = 0.0;
379 _z_velocity = 0.0;
380 _z_acceleration = 0.0;
381 _ura = 0.0;
382 _health = 0.0;
[9212]383 _receptStaID = "";
[7625]384 }
[9367]385 t_ephSBAS(double rnxVersion, const QStringList& lines);
[6380]386 virtual ~t_ephSBAS() {}
387
388 virtual e_type type() const {return t_eph::SBAS;}
[7169]389 virtual unsigned int IOD() const;
[8187]390 virtual unsigned int isUnhealthy() const { return static_cast<unsigned int>(_health); }
[6380]391 virtual QString toString(double version) const;
392
393 private:
[6381]394 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[6380]395
[6536]396 int _IODN;
[8456]397 double _TOT; // not used (set to 0.9999e9)
[6380]398 double _agf0; // [s] clock correction
399 double _agf1; // [s/s] clock correction drift
400
[7278]401 double _x_pos; // [m]
402 double _x_velocity; // [m/s]
403 double _x_acceleration; // [m/s^2]
[6380]404
[7278]405 double _y_pos; // [m]
406 double _y_velocity; // [m/s]
407 double _y_acceleration; // [m/s^2]
[6380]408
[7278]409 double _z_pos; // [m]
410 double _z_velocity; // [m/s]
411 double _z_acceleration; // [m/s^2]
[6380]412
[6798]413 mutable double _ura;
[6390]414 double _health;
[6380]415};
416
[6600]417class t_ephBDS : public t_eph {
[6400]418 friend class t_ephEncoder;
[6812]419 friend class RTCM3Decoder;
[6400]420 public:
[8482]421 t_ephBDS() {
[7625]422 _TOT = 0.0;
423 _AODE = 0;
424 _AODC = 0;
425 _URAI = 0;
426 _URA = 0.0;
427 _clock_bias = 0.0;
428 _clock_drift = 0.0;
429 _clock_driftrate = 0.0;
430 _Crs = 0.0;
431 _Delta_n = 0.0;
432 _M0 = 0.0;
433 _Cuc = 0.0;
434 _e = 0.0;
435 _Cus = 0.0;
436 _sqrt_A = 0.0;
437 _Cic = 0.0;
438 _OMEGA0 = 0.0;
439 _Cis = 0.0;
440 _i0 = 0.0;
441 _Crc = 0.0;
442 _omega = 0.0;
443 _OMEGADOT = 0.0;
444 _IDOT = 0.0;
445 _TGD1 = 0.0;
446 _TGD2 = 0.0;
447 _SatH1 = 0.0;
448 _TOW = 0.0;
449 _TOEsec = 0.0;
[8482]450 _TOEweek =-1.0;
[9212]451 _receptStaID = "";
[7625]452 }
[9367]453 t_ephBDS(double rnxVersion, const QStringList& lines);
[6600]454 virtual ~t_ephBDS() {}
[6400]455
[6602]456 virtual e_type type() const {return t_eph::BDS;}
[7169]457 virtual unsigned int IOD() const;
[9673]458 virtual unsigned int isUnhealthy() const {return static_cast<unsigned int>(_SatH1);}
[6400]459 virtual QString toString(double version) const;
460
461 private:
462 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
463
[6812]464 double _TOT;
[6400]465 bncTime _TOE;
466 int _AODE;
467 int _AODC;
[6812]468 int _URAI; // [0..15] index from RTCM stream
[9316]469 mutable double _URA; // user range accuracy [m]
[7278]470 double _clock_bias; // [s]
471 double _clock_drift; // [s/s]
[6400]472 double _clock_driftrate; // [s/s^2]
[7278]473 double _Crs; // [m]
[6400]474 double _Delta_n; // [rad/s]
[7278]475 double _M0; // [rad]
476 double _Cuc; // [rad]
477 double _e; //
478 double _Cus; // [rad]
[6400]479 double _sqrt_A; // [m^0.5]
[7278]480 double _Cic; // [rad]
481 double _OMEGA0; // [rad]
482 double _Cis; // [rad]
483 double _i0; // [rad]
484 double _Crc; // [m]
485 double _omega; // [rad]
[6400]486 double _OMEGADOT; // [rad/s]
487 double _IDOT; // [rad/s]
[7278]488 double _TGD1; // [s]
489 double _TGD2; // [s]
490 int _SatH1; //
[6843]491 double _TOW; // [s] of BDT week
492 double _TOEsec; // [s] of BDT week
493 double _TOEweek; // BDT week will be set only in case of RINEX file input
[6400]494};
[1025]495#endif
Note: See TracBrowser for help on using the repository browser.