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

Last change on this file since 7636 was 7625, checked in by stuerze, 9 years ago

some value initialization in constructor is added

File size: 12.3 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};
20 enum e_checkState {unchecked, ok, bad, outdated};
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 int slotNum() const {return 0;}
29 bncTime TOC() const {return _TOC;}
30 bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
31 e_checkState checkState() const {return _checkState;}
32 void setCheckState(e_checkState checkState) {_checkState = checkState;}
33 t_prn prn() const {return _prn;}
34 t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
35 void setOrbCorr(const t_orbCorr* orbCorr);
36 void setClkCorr(const t_clkCorr* clkCorr);
37 const QDateTime& receptDateTime() const {return _receptDateTime;}
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;}
41
42 protected:
43 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
44 t_prn _prn;
45 bncTime _TOC;
46 QDateTime _receptDateTime;
47 e_checkState _checkState;
48 t_orbCorr* _orbCorr;
49 t_clkCorr* _clkCorr;
50};
51
52
53class t_ephGPS : public t_eph {
54 friend class t_ephEncoder;
55 friend class RTCM3Decoder;
56 public:
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 }
88 t_ephGPS(float rnxVersion, const QStringList& lines);
89 virtual ~t_ephGPS() {}
90
91 virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
92 virtual QString toString(double version) const;
93 virtual unsigned int IOD() const { return static_cast<unsigned int>(_IODC); }
94 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
95
96 private:
97 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
98
99 double _clock_bias; // [s]
100 double _clock_drift; // [s/s]
101 double _clock_driftrate; // [s/s^2]
102
103 double _IODE;
104 double _Crs; // [m]
105 double _Delta_n; // [rad/s]
106 double _M0; // [rad]
107
108 double _Cuc; // [rad]
109 double _e; //
110 double _Cus; // [rad]
111 double _sqrt_A; // [m^0.5]
112
113 double _TOEsec; // [s]
114 double _Cic; // [rad]
115 double _OMEGA0; // [rad]
116 double _Cis; // [rad]
117
118 double _i0; // [rad]
119 double _Crc; // [m]
120 double _omega; // [rad]
121 double _OMEGADOT; // [rad/s]
122
123 double _IDOT; // [rad/s]
124 double _L2Codes; // Codes on L2 channel
125 double _TOEweek;
126 double _L2PFlag; // L2 P data flag
127
128 mutable double _ura; // SV accuracy
129 double _health; // SV health
130 double _TGD; // [s]
131 double _IODC;
132
133 double _TOT; // Transmisstion time
134 double _fitInterval; // Fit interval
135};
136
137class t_ephGlo : public t_eph {
138 friend class t_ephEncoder;
139 friend class RTCM3Decoder;
140 public:
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 }
160 t_ephGlo(float rnxVersion, const QStringList& lines);
161 virtual ~t_ephGlo() {}
162
163 virtual e_type type() const {return t_eph::GLONASS;}
164 virtual QString toString(double version) const;
165 virtual unsigned int IOD() const;
166 virtual int slotNum() const {return int(_frequency_number);}
167
168 private:
169 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
170 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
171
172 mutable bncTime _tt; // time
173 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
174
175 double _gps_utc;
176 double _tau; // [s]
177 double _gamma; //
178 mutable double _tki; // message frame time
179
180 double _x_pos; // [km]
181 double _x_velocity; // [km/s]
182 double _x_acceleration; // [km/s^2]
183 double _health; // 0 = O.K.
184
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
189
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]
194};
195
196class t_ephGal : public t_eph {
197 friend class t_ephEncoder;
198 friend class RTCM3Decoder;
199 public:
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 };
230 t_ephGal(float rnxVersion, const QStringList& lines);
231 virtual ~t_ephGal() {}
232
233 virtual QString toString(double version) const;
234 virtual e_type type() const {return t_eph::Galileo;}
235 virtual unsigned int IOD() const { return static_cast<unsigned long>(_IODnav); }
236
237 private:
238 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
239
240 double _clock_bias; // [s]
241 double _clock_drift; // [s/s]
242 double _clock_driftrate; // [s/s^2]
243
244 double _IODnav;
245 double _Crs; // [m]
246 double _Delta_n; // [rad/s]
247 double _M0; // [rad]
248
249 double _Cuc; // [rad]
250 double _e; //
251 double _Cus; // [rad]
252 double _sqrt_A; // [m^0.5]
253
254 double _TOEsec; // [s]
255 double _Cic; // [rad]
256 double _OMEGA0; // [rad]
257 double _Cis; // [rad]
258
259 double _i0; // [rad]
260 double _Crc; // [m]
261 double _omega; // [rad]
262 double _OMEGADOT; // [rad/s]
263
264 double _IDOT; // [rad/s]
265 double _TOEweek;
266 // spare
267
268 mutable double _SISA; // Signal In Space Accuracy
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
272 double _BGD_1_5A; // group delay [s]
273 double _BGD_1_5B; // group delay [s]
274
275 double _TOT; // [s]
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;
286};
287
288class t_ephSBAS : public t_eph {
289 friend class t_ephEncoder;
290 friend class RTCM3Decoder;
291 public:
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 }
309 t_ephSBAS(float rnxVersion, const QStringList& lines);
310 virtual ~t_ephSBAS() {}
311
312 virtual e_type type() const {return t_eph::SBAS;}
313 virtual unsigned int IOD() const;
314 virtual QString toString(double version) const;
315
316 private:
317 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
318
319 int _IODN;
320 double _TOW; // not used (set to 0.9999e9)
321 double _agf0; // [s] clock correction
322 double _agf1; // [s/s] clock correction drift
323
324 double _x_pos; // [m]
325 double _x_velocity; // [m/s]
326 double _x_acceleration; // [m/s^2]
327
328 double _y_pos; // [m]
329 double _y_velocity; // [m/s]
330 double _y_acceleration; // [m/s^2]
331
332 double _z_pos; // [m]
333 double _z_velocity; // [m/s]
334 double _z_acceleration; // [m/s^2]
335
336 mutable double _ura;
337 double _health;
338};
339
340class t_ephBDS : public t_eph {
341 friend class t_ephEncoder;
342 friend class RTCM3Decoder;
343 public:
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 }
375 t_ephBDS(float rnxVersion, const QStringList& lines);
376 virtual ~t_ephBDS() {}
377
378 virtual e_type type() const {return t_eph::BDS;}
379 virtual unsigned int IOD() const;
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
385 double _TOT;
386 bncTime _TOE;
387 int _AODE;
388 int _AODC;
389 int _URAI; // [0..15] index from RTCM stream
390 mutable double _URA; // user range accuracy
391 double _clock_bias; // [s]
392 double _clock_drift; // [s/s]
393 double _clock_driftrate; // [s/s^2]
394 double _Crs; // [m]
395 double _Delta_n; // [rad/s]
396 double _M0; // [rad]
397 double _Cuc; // [rad]
398 double _e; //
399 double _Cus; // [rad]
400 double _sqrt_A; // [m^0.5]
401 double _Cic; // [rad]
402 double _OMEGA0; // [rad]
403 double _Cis; // [rad]
404 double _i0; // [rad]
405 double _Crc; // [m]
406 double _omega; // [rad]
407 double _OMEGADOT; // [rad/s]
408 double _IDOT; // [rad/s]
409 double _TGD1; // [s]
410 double _TGD2; // [s]
411 int _SatH1; //
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
415};
416
417#endif
Note: See TracBrowser for help on using the repository browser.