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

Last change on this file since 8182 was 8182, checked in by stuerze, 6 years ago

RTCM MT 1020 ephemeris parameter are now completed

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