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

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

some comments added

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
12extern "C" {
13# include "rtcm3torinex.h"
14}
15
16class t_orbCorr;
17class t_clkCorr;
18
19class t_eph {
20 public:
21 enum e_type {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS};
22 enum e_checkState {unchecked, ok, bad};
23
24 t_eph();
25 virtual ~t_eph() {};
26
27 virtual e_type type() const = 0;
28 virtual QString toString(double version) const = 0;
29 virtual int IOD() const = 0;
30 virtual int slotNum() const {return 0;}
31 bncTime TOC() const {return _TOC;}
32 bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
33 e_checkState checkState() const {return _checkState;}
34 void setCheckState(e_checkState checkState) {_checkState = checkState;}
35 t_prn prn() const {return _prn;}
36 t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
37 void setOrbCorr(const t_orbCorr* orbCorr);
38 void setClkCorr(const t_clkCorr* clkCorr);
39 const QDateTime& receptDateTime() const {return _receptDateTime;}
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
44 protected:
45 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
46 t_prn _prn;
47 bncTime _TOC;
48 QDateTime _receptDateTime;
49 e_checkState _checkState;
50 t_orbCorr* _orbCorr;
51 t_clkCorr* _clkCorr;
52};
53
54
55class t_ephGPS : public t_eph {
56 friend class t_ephEncoder;
57 public:
58 t_ephGPS() { }
59 t_ephGPS(float rnxVersion, const QStringList& lines);
60 virtual ~t_ephGPS() {}
61
62 virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
63 virtual QString toString(double version) const;
64 virtual int IOD() const { return static_cast<int>(_IODC); }
65 void set(const gpsephemeris* ee);
66 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
67
68 private:
69 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
70
71 double _clock_bias; // [s]
72 double _clock_drift; // [s/s]
73 double _clock_driftrate; // [s/s^2]
74
75 double _IODE;
76 double _Crs; // [m]
77 double _Delta_n; // [rad/s]
78 double _M0; // [rad]
79
80 double _Cuc; // [rad]
81 double _e; //
82 double _Cus; // [rad]
83 double _sqrt_A; // [m^0.5]
84
85 double _TOEsec; // [s]
86 double _Cic; // [rad]
87 double _OMEGA0; // [rad]
88 double _Cis; // [rad]
89
90 double _i0; // [rad]
91 double _Crc; // [m]
92 double _omega; // [rad]
93 double _OMEGADOT; // [rad/s]
94
95 double _IDOT; // [rad/s]
96 double _L2Codes; // Codes on L2 channel
97 double _TOEweek;
98 double _L2PFlag; // L2 P data flag
99
100 mutable double _ura; // SV accuracy
101 double _health; // SV health
102 double _TGD; // [s]
103 double _IODC;
104
105 double _TOT; // Transmisstion time
106 double _fitInterval; // Fit interval
107};
108
109class t_ephGlo : public t_eph {
110 friend class t_ephEncoder;
111 public:
112 t_ephGlo() { _xv.ReSize(6); }
113 t_ephGlo(float rnxVersion, const QStringList& lines);
114 virtual ~t_ephGlo() {}
115
116 virtual e_type type() const {return t_eph::GLONASS;}
117 virtual QString toString(double version) const;
118 virtual int IOD() const;
119 virtual int slotNum() const {return int(_frequency_number);}
120 void set(const glonassephemeris* ee);
121
122 private:
123 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
124 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
125
126 mutable bncTime _tt; // time
127 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
128
129 double _gps_utc;
130 double _tau; // [s]
131 double _gamma; //
132 mutable double _tki; // message frame time
133
134 double _x_pos; // [km]
135 double _x_velocity; // [km/s]
136 double _x_acceleration; // [km/s^2]
137 double _health; // 0 = O.K.
138
139 double _y_pos; // [km]
140 double _y_velocity; // [km/s]
141 double _y_acceleration; // [km/s^2]
142 double _frequency_number; // ICD-GLONASS data position
143
144 double _z_pos; // [km]
145 double _z_velocity; // [km/s]
146 double _z_acceleration; // [km/s^2]
147 double _E; // Age of Information [days]
148};
149
150class t_ephGal : public t_eph {
151 friend class t_ephEncoder;
152 public:
153 t_ephGal() { }
154 t_ephGal(float rnxVersion, const QStringList& lines);
155 virtual ~t_ephGal() {}
156
157 virtual QString toString(double version) const;
158 virtual e_type type() const {return t_eph::Galileo;}
159 virtual int IOD() const { return static_cast<int>(_IODnav); }
160 void set(const galileoephemeris* ee);
161
162 private:
163 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
164
165 double _clock_bias; // [s]
166 double _clock_drift; // [s/s]
167 double _clock_driftrate; // [s/s^2]
168
169 double _IODnav;
170 double _Crs; // [m]
171 double _Delta_n; // [rad/s]
172 double _M0; // [rad]
173
174 double _Cuc; // [rad]
175 double _e; //
176 double _Cus; // [rad]
177 double _sqrt_A; // [m^0.5]
178
179 double _TOEsec; // [s]
180 double _Cic; // [rad]
181 double _OMEGA0; // [rad]
182 double _Cis; // [rad]
183
184 double _i0; // [rad]
185 double _Crc; // [m]
186 double _omega; // [rad]
187 double _OMEGADOT; // [rad/s]
188
189 double _IDOT; // [rad/s]
190 double _TOEweek;
191 // spare
192
193 int _SISAI; // [0..255] Signal In Space Accuracy Index from RTCM stream
194 double _SISA; // [m] Signal In Space Accuracy from RINEX file
195 // Health Status
196 // 0: signal OK, 1: signal out of service, 2: signal will be out of service
197 // 3: signal component currently in test
198 double _E5aHS; // [0..3] E5a Health Status
199 double _E5bHS; // [0..3] E5b Health Status
200 double _E1_bHS; // [0..3] E1-b Health Status
201 double _BGD_1_5A; // group delay [s]
202 double _BGD_1_5B; // group delay [s]
203
204 double _TOT; // [s]
205 int _flags;
206};
207
208class t_ephSBAS : public t_eph {
209 friend class t_ephEncoder;
210 public:
211 t_ephSBAS() {}
212 t_ephSBAS(float rnxVersion, const QStringList& lines);
213 virtual ~t_ephSBAS() {}
214
215 void set(const sbasephemeris* ee);
216 virtual e_type type() const {return t_eph::SBAS;}
217 virtual int IOD() const {return _IODN;}
218 virtual QString toString(double version) const;
219
220 private:
221 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
222
223 int _IODN;
224 double _TOW; // not used (set to 0.9999e9)
225 double _agf0; // [s] clock correction
226 double _agf1; // [s/s] clock correction drift
227
228 double _x_pos; // [m]
229 double _x_velocity; // [m/s]
230 double _x_acceleration; // [m/s^2]
231
232 double _y_pos; // [m]
233 double _y_velocity; // [m/s]
234 double _y_acceleration; // [m/s^2]
235
236 double _z_pos; // [m]
237 double _z_velocity; // [m/s]
238 double _z_acceleration; // [m/s^2]
239
240 double _ura;
241 double _health;
242};
243
244class t_ephBDS : public t_eph {
245 friend class t_ephEncoder;
246 public:
247 t_ephBDS() {}
248 t_ephBDS(float rnxVersion, const QStringList& lines);
249 virtual ~t_ephBDS() {}
250
251 void set(const bdsephemeris* ee);
252 virtual e_type type() const {return t_eph::BDS;}
253 virtual int IOD() const {return _AODC;}
254 virtual QString toString(double version) const;
255
256 private:
257 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
258
259 bncTime _TOT;
260 bncTime _TOE;
261 bncTime _TOC_bdt;
262 bncTime _TOE_bdt;
263 int _AODE;
264 int _AODC;
265 int _URAI; // [0..15] index from RTCM stream
266 double _URA; // [m] from RINEX file
267 double _clock_bias; // [s]
268 double _clock_drift; // [s/s]
269 double _clock_driftrate; // [s/s^2]
270 double _Crs; // [m]
271 double _Delta_n; // [rad/s]
272 double _M0; // [rad]
273 double _Cuc; // [rad]
274 double _e; //
275 double _Cus; // [rad]
276 double _sqrt_A; // [m^0.5]
277 double _Cic; // [rad]
278 double _OMEGA0; // [rad]
279 double _Cis; // [rad]
280 double _i0; // [rad]
281 double _Crc; // [m]
282 double _omega; // [rad]
283 double _OMEGADOT; // [rad/s]
284 double _IDOT; // [rad/s]
285 double _TGD1; // [s]
286 double _TGD2; // [s]
287 int _SatH1; //
288 double _TOTs; // [s] of BDT week; RINEX file entry
289 double _TOEs; // [s] of BDT week; RINEX file entry
290};
291
292#endif
Note: See TracBrowser for help on using the repository browser.