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

Last change on this file since 8139 was 8139, checked in by stuerze, 7 years ago

bug fixed: SSR ID for GPS has to be GPS IODE, not IODC

File size: 12.3 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:
[6602]19 enum e_type {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS};
[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
[6373]91 virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
[4013]92 virtual QString toString(double version) const;
[8139]93 virtual unsigned int IOD() const { return static_cast<unsigned int>(_IODE); }
[4366]94 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
95
[1025]96 private:
[6213]97 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[6109]98
[7278]99 double _clock_bias; // [s]
100 double _clock_drift; // [s/s]
[4018]101 double _clock_driftrate; // [s/s^2]
[1025]102
[7278]103 double _IODE;
104 double _Crs; // [m]
[4018]105 double _Delta_n; // [rad/s]
[7278]106 double _M0; // [rad]
[1025]107
[7278]108 double _Cuc; // [rad]
109 double _e; //
110 double _Cus; // [rad]
[4018]111 double _sqrt_A; // [m^0.5]
[1025]112
[7278]113 double _TOEsec; // [s]
114 double _Cic; // [rad]
115 double _OMEGA0; // [rad]
116 double _Cis; // [rad]
[4018]117
[7278]118 double _i0; // [rad]
119 double _Crc; // [m]
120 double _omega; // [rad]
[4018]121 double _OMEGADOT; // [rad/s]
122
123 double _IDOT; // [rad/s]
[7278]124 double _L2Codes; // Codes on L2 channel
[4018]125 double _TOEweek;
126 double _L2PFlag; // L2 P data flag
127
[6798]128 mutable double _ura; // SV accuracy
[4018]129 double _health; // SV health
[7278]130 double _TGD; // [s]
131 double _IODC;
[4018]132
[7278]133 double _TOT; // Transmisstion time
[4018]134 double _fitInterval; // Fit interval
[1025]135};
136
[2221]137class t_ephGlo : public t_eph {
[5853]138 friend class t_ephEncoder;
[6812]139 friend class RTCM3Decoder;
[2221]140 public:
[7625]141 t_ephGlo() {
142 _xv.ReSize(6);
143 _gps_utc = 0.0;
144 _tau = 0.0;
145 _gamma = 0.0;
146 _tki = 0.0;
147 _x_pos = 0.0;
148 _x_velocity = 0.0;
149 _x_acceleration = 0.0;
150 _health = 0.0;
151 _y_pos = 0.0;
152 _y_velocity = 0.0;
153 _y_acceleration = 0.0;
154 _frequency_number = 0.0;
155 _z_pos = 0.0;
156 _z_velocity = 0.0;
157 _z_acceleration = 0.0;
158 _E = 0.0;
159 }
[3659]160 t_ephGlo(float rnxVersion, const QStringList& lines);
[2221]161 virtual ~t_ephGlo() {}
162
[4005]163 virtual e_type type() const {return t_eph::GLONASS;}
[4013]164 virtual QString toString(double version) const;
[7169]165 virtual unsigned int IOD() const;
[6109]166 virtual int slotNum() const {return int(_frequency_number);}
[2221]167
168 private:
[6213]169 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[6109]170 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
[2221]171
[7278]172 mutable bncTime _tt; // time
[2221]173 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
174
[3255]175 double _gps_utc;
[7278]176 double _tau; // [s]
177 double _gamma; //
[5853]178 mutable double _tki; // message frame time
[4018]179
[7278]180 double _x_pos; // [km]
181 double _x_velocity; // [km/s]
182 double _x_acceleration; // [km/s^2]
183 double _health; // 0 = O.K.
[4018]184
[7278]185 double _y_pos; // [km]
186 double _y_velocity; // [km/s]
187 double _y_acceleration; // [km/s^2]
188 double _frequency_number; // ICD-GLONASS data position
[4018]189
[7278]190 double _z_pos; // [km]
191 double _z_velocity; // [km/s]
192 double _z_acceleration; // [km/s^2]
193 double _E; // Age of Information [days]
[2221]194};
195
[2770]196class t_ephGal : public t_eph {
[5853]197 friend class t_ephEncoder;
[6812]198 friend class RTCM3Decoder;
[2770]199 public:
[7625]200 t_ephGal() {
201 _clock_bias = 0.0;
202 _clock_drift = 0.0;
203 _clock_driftrate = 0.0;
204 _IODnav = 0.0;
205 _Crs = 0.0;
206 _Delta_n = 0.0;
207 _M0 = 0.0;
208 _Cuc = 0.0;
209 _e = 0.0;
210 _Cus = 0.0;
211 _sqrt_A = 0.0;
212 _TOEsec = 0.0;
213 _Cic = 0.0;
214 _OMEGA0 = 0.0;
215 _Cis = 0.0;
216 _i0 = 0.0;
217 _Crc = 0.0;
218 _omega = 0.0;
219 _OMEGADOT = 0.0;
220 _IDOT = 0.0;
221 _TOEweek = 0.0;
222 _SISA = 0.0;
223 _E5aHS = 0.0;
224 _E5bHS = 0.0;
225 _E1_bHS = 0.0;
226 _BGD_1_5A = 0.0;
227 _BGD_1_5B = 0.0;
228 _TOT = 0.0;
229 };
[3659]230 t_ephGal(float rnxVersion, const QStringList& lines);
[2770]231 virtual ~t_ephGal() {}
[4005]232
[4013]233 virtual QString toString(double version) const;
[4005]234 virtual e_type type() const {return t_eph::Galileo;}
[7169]235 virtual unsigned int IOD() const { return static_cast<unsigned long>(_IODnav); }
[2770]236
[6109]237 private:
[6213]238 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[2770]239
[7278]240 double _clock_bias; // [s]
241 double _clock_drift; // [s/s]
[2770]242 double _clock_driftrate; // [s/s^2]
[4018]243
[6812]244 double _IODnav;
[7278]245 double _Crs; // [m]
[2770]246 double _Delta_n; // [rad/s]
[7278]247 double _M0; // [rad]
[4018]248
[7278]249 double _Cuc; // [rad]
250 double _e; //
251 double _Cus; // [rad]
[2770]252 double _sqrt_A; // [m^0.5]
[4018]253
[7278]254 double _TOEsec; // [s]
255 double _Cic; // [rad]
256 double _OMEGA0; // [rad]
257 double _Cis; // [rad]
[4018]258
[7278]259 double _i0; // [rad]
260 double _Crc; // [m]
261 double _omega; // [rad]
[2770]262 double _OMEGADOT; // [rad/s]
[4018]263
[2770]264 double _IDOT; // [rad/s]
[6809]265 double _TOEweek;
[4018]266 // spare
267
[6798]268 mutable double _SISA; // Signal In Space Accuracy
[6794]269 double _E5aHS; // [0..3] E5a Health Status
270 double _E5bHS; // [0..3] E5b Health Status
271 double _E1_bHS; // [0..3] E1-b Health Status
[7278]272 double _BGD_1_5A; // group delay [s]
273 double _BGD_1_5B; // group delay [s]
[2770]274
[6809]275 double _TOT; // [s]
[6812]276 /** Data comes from I/NAV when <code>true</code> */
277 bool _inav;
278 /** Data comes from F/NAV when <code>true</code> */
279 bool _fnav;
280 /** EE Data is not valid */
281 bool _e1DataInValid;
282 /** E5A Data is not valid */
283 bool _e5aDataInValid;
284 /** E5B Data is not valid */
285 bool _e5bDataInValid;
[2770]286};
287
[6380]288class t_ephSBAS : public t_eph {
289 friend class t_ephEncoder;
[6812]290 friend class RTCM3Decoder;
[6380]291 public:
[7625]292 t_ephSBAS() {
293 _IODN = 0;
294 _TOW = 0.0;
295 _agf0 = 0.0;
296 _agf1 = 0.0;
297 _x_pos = 0.0;
298 _x_velocity = 0.0;
299 _x_acceleration = 0.0;
300 _y_pos = 0.0;
301 _y_velocity = 0.0;
302 _y_acceleration = 0.0;
303 _z_pos = 0.0;
304 _z_velocity = 0.0;
305 _z_acceleration = 0.0;
306 _ura = 0.0;
307 _health = 0.0;
308 }
[6380]309 t_ephSBAS(float rnxVersion, const QStringList& lines);
310 virtual ~t_ephSBAS() {}
311
312 virtual e_type type() const {return t_eph::SBAS;}
[7169]313 virtual unsigned int IOD() const;
[6380]314 virtual QString toString(double version) const;
315
316 private:
[6381]317 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
[6380]318
[6536]319 int _IODN;
[6390]320 double _TOW; // not used (set to 0.9999e9)
[6380]321 double _agf0; // [s] clock correction
322 double _agf1; // [s/s] clock correction drift
323
[7278]324 double _x_pos; // [m]
325 double _x_velocity; // [m/s]
326 double _x_acceleration; // [m/s^2]
[6380]327
[7278]328 double _y_pos; // [m]
329 double _y_velocity; // [m/s]
330 double _y_acceleration; // [m/s^2]
[6380]331
[7278]332 double _z_pos; // [m]
333 double _z_velocity; // [m/s]
334 double _z_acceleration; // [m/s^2]
[6380]335
[6798]336 mutable double _ura;
[6390]337 double _health;
[6380]338};
339
[6600]340class t_ephBDS : public t_eph {
[6400]341 friend class t_ephEncoder;
[6812]342 friend class RTCM3Decoder;
[6400]343 public:
[7625]344 t_ephBDS() : _TOEweek(-1.0) {
345 _TOT = 0.0;
346 _AODE = 0;
347 _AODC = 0;
348 _URAI = 0;
349 _URA = 0.0;
350 _clock_bias = 0.0;
351 _clock_drift = 0.0;
352 _clock_driftrate = 0.0;
353 _Crs = 0.0;
354 _Delta_n = 0.0;
355 _M0 = 0.0;
356 _Cuc = 0.0;
357 _e = 0.0;
358 _Cus = 0.0;
359 _sqrt_A = 0.0;
360 _Cic = 0.0;
361 _OMEGA0 = 0.0;
362 _Cis = 0.0;
363 _i0 = 0.0;
364 _Crc = 0.0;
365 _omega = 0.0;
366 _OMEGADOT = 0.0;
367 _IDOT = 0.0;
368 _TGD1 = 0.0;
369 _TGD2 = 0.0;
370 _SatH1 = 0.0;
371 _TOW = 0.0;
372 _TOEsec = 0.0;
373 _TOEweek = 0.0;
374 }
[6600]375 t_ephBDS(float rnxVersion, const QStringList& lines);
376 virtual ~t_ephBDS() {}
[6400]377
[6602]378 virtual e_type type() const {return t_eph::BDS;}
[7169]379 virtual unsigned int IOD() const;
[6400]380 virtual QString toString(double version) const;
381
382 private:
383 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
384
[6812]385 double _TOT;
[6400]386 bncTime _TOE;
387 int _AODE;
388 int _AODC;
[6812]389 int _URAI; // [0..15] index from RTCM stream
[6798]390 mutable double _URA; // user range accuracy
[7278]391 double _clock_bias; // [s]
392 double _clock_drift; // [s/s]
[6400]393 double _clock_driftrate; // [s/s^2]
[7278]394 double _Crs; // [m]
[6400]395 double _Delta_n; // [rad/s]
[7278]396 double _M0; // [rad]
397 double _Cuc; // [rad]
398 double _e; //
399 double _Cus; // [rad]
[6400]400 double _sqrt_A; // [m^0.5]
[7278]401 double _Cic; // [rad]
402 double _OMEGA0; // [rad]
403 double _Cis; // [rad]
404 double _i0; // [rad]
405 double _Crc; // [m]
406 double _omega; // [rad]
[6400]407 double _OMEGADOT; // [rad/s]
408 double _IDOT; // [rad/s]
[7278]409 double _TGD1; // [s]
410 double _TGD2; // [s]
411 int _SatH1; //
[6843]412 double _TOW; // [s] of BDT week
413 double _TOEsec; // [s] of BDT week
414 double _TOEweek; // BDT week will be set only in case of RINEX file input
[6400]415};
416
[1025]417#endif
Note: See TracBrowser for help on using the repository browser.