source: ntrip/branches/BNC_2.12/src/ephemeris.h@ 9216

Last change on this file since 9216 was 9216, checked in by stuerze, 3 years ago

ephemeris checks + debugging output added

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