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

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