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

Last change on this file since 9321 was 9321, checked in by stuerze, 10 months ago

minor changes

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