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

Last change on this file since 7237 was 7208, checked in by stuerze, 9 years ago

minor changes to decide between erroneous and outdated ephemerides during the ephemeris check

File size: 9.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 t_ephGPS(float rnxVersion, const QStringList& lines);
59 virtual ~t_ephGPS() {}
60
61 virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
62 virtual QString toString(double version) const;
63 virtual unsigned int IOD() const { return static_cast<unsigned int>(_IODC); }
64 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
65
66 private:
67 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
68
69 double _clock_bias; // [s]
70 double _clock_drift; // [s/s]
71 double _clock_driftrate; // [s/s^2]
72
73 double _IODE;
74 double _Crs; // [m]
75 double _Delta_n; // [rad/s]
76 double _M0; // [rad]
77
78 double _Cuc; // [rad]
79 double _e; //
80 double _Cus; // [rad]
81 double _sqrt_A; // [m^0.5]
82
83 double _TOEsec; // [s]
84 double _Cic; // [rad]
85 double _OMEGA0; // [rad]
86 double _Cis; // [rad]
87
88 double _i0; // [rad]
89 double _Crc; // [m]
90 double _omega; // [rad]
91 double _OMEGADOT; // [rad/s]
92
93 double _IDOT; // [rad/s]
94 double _L2Codes; // Codes on L2 channel
95 double _TOEweek;
96 double _L2PFlag; // L2 P data flag
97
98 mutable double _ura; // SV accuracy
99 double _health; // SV health
100 double _TGD; // [s]
101 double _IODC;
102
103 double _TOT; // Transmisstion time
104 double _fitInterval; // Fit interval
105};
106
107class t_ephGlo : public t_eph {
108 friend class t_ephEncoder;
109 friend class RTCM3Decoder;
110 public:
111 t_ephGlo() { _xv.ReSize(6); }
112 t_ephGlo(float rnxVersion, const QStringList& lines);
113 virtual ~t_ephGlo() {}
114
115 virtual e_type type() const {return t_eph::GLONASS;}
116 virtual QString toString(double version) const;
117 virtual unsigned int IOD() const;
118 virtual int slotNum() const {return int(_frequency_number);}
119
120 private:
121 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
122 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
123
124 mutable bncTime _tt; // time
125 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
126
127 double _gps_utc;
128 double _tau; // [s]
129 double _gamma; //
130 mutable double _tki; // message frame time
131
132 double _x_pos; // [km]
133 double _x_velocity; // [km/s]
134 double _x_acceleration; // [km/s^2]
135 double _health; // 0 = O.K.
136
137 double _y_pos; // [km]
138 double _y_velocity; // [km/s]
139 double _y_acceleration; // [km/s^2]
140 double _frequency_number; // ICD-GLONASS data position
141
142 double _z_pos; // [km]
143 double _z_velocity; // [km/s]
144 double _z_acceleration; // [km/s^2]
145 double _E; // Age of Information [days]
146};
147
148class t_ephGal : public t_eph {
149 friend class t_ephEncoder;
150 friend class RTCM3Decoder;
151 public:
152 t_ephGal() { };
153 t_ephGal(float rnxVersion, const QStringList& lines);
154 virtual ~t_ephGal() {}
155
156 virtual QString toString(double version) const;
157 virtual e_type type() const {return t_eph::Galileo;}
158 virtual unsigned int IOD() const { return static_cast<unsigned long>(_IODnav); }
159
160 private:
161 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
162
163 double _clock_bias; // [s]
164 double _clock_drift; // [s/s]
165 double _clock_driftrate; // [s/s^2]
166
167 double _IODnav;
168 double _Crs; // [m]
169 double _Delta_n; // [rad/s]
170 double _M0; // [rad]
171
172 double _Cuc; // [rad]
173 double _e; //
174 double _Cus; // [rad]
175 double _sqrt_A; // [m^0.5]
176
177 double _TOEsec; // [s]
178 double _Cic; // [rad]
179 double _OMEGA0; // [rad]
180 double _Cis; // [rad]
181
182 double _i0; // [rad]
183 double _Crc; // [m]
184 double _omega; // [rad]
185 double _OMEGADOT; // [rad/s]
186
187 double _IDOT; // [rad/s]
188 double _TOEweek;
189 // spare
190
191 mutable double _SISA; // Signal In Space Accuracy
192 double _E5aHS; // [0..3] E5a Health Status
193 double _E5bHS; // [0..3] E5b Health Status
194 double _E1_bHS; // [0..3] E1-b Health Status
195 double _BGD_1_5A; // group delay [s]
196 double _BGD_1_5B; // group delay [s]
197
198 double _TOT; // [s]
199 /** Data comes from I/NAV when <code>true</code> */
200 bool _inav;
201 /** Data comes from F/NAV when <code>true</code> */
202 bool _fnav;
203 /** EE Data is not valid */
204 bool _e1DataInValid;
205 /** E5A Data is not valid */
206 bool _e5aDataInValid;
207 /** E5B Data is not valid */
208 bool _e5bDataInValid;
209};
210
211class t_ephSBAS : public t_eph {
212 friend class t_ephEncoder;
213 friend class RTCM3Decoder;
214 public:
215 t_ephSBAS() {}
216 t_ephSBAS(float rnxVersion, const QStringList& lines);
217 virtual ~t_ephSBAS() {}
218
219 virtual e_type type() const {return t_eph::SBAS;}
220 virtual unsigned int IOD() const;
221 virtual QString toString(double version) const;
222
223 private:
224 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
225
226 int _IODN;
227 double _TOW; // not used (set to 0.9999e9)
228 double _agf0; // [s] clock correction
229 double _agf1; // [s/s] clock correction drift
230
231 double _x_pos; // [m]
232 double _x_velocity; // [m/s]
233 double _x_acceleration; // [m/s^2]
234
235 double _y_pos; // [m]
236 double _y_velocity; // [m/s]
237 double _y_acceleration; // [m/s^2]
238
239 double _z_pos; // [m]
240 double _z_velocity; // [m/s]
241 double _z_acceleration; // [m/s^2]
242
243 mutable double _ura;
244 double _health;
245};
246
247class t_ephBDS : public t_eph {
248 friend class t_ephEncoder;
249 friend class RTCM3Decoder;
250 public:
251 t_ephBDS() : _TOEweek(-1.0) {}
252 t_ephBDS(float rnxVersion, const QStringList& lines);
253 virtual ~t_ephBDS() {}
254
255 virtual e_type type() const {return t_eph::BDS;}
256 virtual unsigned int IOD() const;
257 virtual QString toString(double version) const;
258
259 private:
260 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
261
262 double _TOT;
263 bncTime _TOE;
264 int _AODE;
265 int _AODC;
266 int _URAI; // [0..15] index from RTCM stream
267 mutable double _URA; // user range accuracy
268 double _clock_bias; // [s]
269 double _clock_drift; // [s/s]
270 double _clock_driftrate; // [s/s^2]
271 double _Crs; // [m]
272 double _Delta_n; // [rad/s]
273 double _M0; // [rad]
274 double _Cuc; // [rad]
275 double _e; //
276 double _Cus; // [rad]
277 double _sqrt_A; // [m^0.5]
278 double _Cic; // [rad]
279 double _OMEGA0; // [rad]
280 double _Cis; // [rad]
281 double _i0; // [rad]
282 double _Crc; // [m]
283 double _omega; // [rad]
284 double _OMEGADOT; // [rad/s]
285 double _IDOT; // [rad/s]
286 double _TGD1; // [s]
287 double _TGD2; // [s]
288 int _SatH1; //
289 double _TOW; // [s] of BDT week
290 double _TOEsec; // [s] of BDT week
291 double _TOEweek; // BDT week will be set only in case of RINEX file input
292};
293
294#endif
Note: See TracBrowser for help on using the repository browser.