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

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

different BDS ephemeris sources ( RTCM stream / RINEX file ) are considered now for RINEX file writing

File size: 9.0 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 //
191 double _TOEweek;
192 // spare
193
194 double _SISA; // Signal In Space Accuracy
195 double _E5aHS; // E5a Health Status
196 double _E5bHS; // E5a Health Status
197 double _BGD_1_5A; // group delay [s]
198 double _BGD_1_5B; // group delay [s]
199
200 double _TOT; // [s]
201
202 int _flags;
203};
204
205class t_ephSBAS : public t_eph {
206 friend class t_ephEncoder;
207 public:
208 t_ephSBAS() {}
209 t_ephSBAS(float rnxVersion, const QStringList& lines);
210 virtual ~t_ephSBAS() {}
211
212 void set(const sbasephemeris* ee);
213 virtual e_type type() const {return t_eph::SBAS;}
214 virtual int IOD() const {return _IODN;}
215 virtual QString toString(double version) const;
216
217 private:
218 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
219
220 int _IODN;
221 double _TOW; // not used (set to 0.9999e9)
222 double _agf0; // [s] clock correction
223 double _agf1; // [s/s] clock correction drift
224
225 double _x_pos; // [m]
226 double _x_velocity; // [m/s]
227 double _x_acceleration; // [m/s^2]
228
229 double _y_pos; // [m]
230 double _y_velocity; // [m/s]
231 double _y_acceleration; // [m/s^2]
232
233 double _z_pos; // [m]
234 double _z_velocity; // [m/s]
235 double _z_acceleration; // [m/s^2]
236
237 double _ura;
238 double _health;
239};
240
241class t_ephBDS : public t_eph {
242 friend class t_ephEncoder;
243 public:
244 t_ephBDS() {}
245 t_ephBDS(float rnxVersion, const QStringList& lines);
246 virtual ~t_ephBDS() {}
247
248 void set(const bdsephemeris* ee);
249 virtual e_type type() const {return t_eph::BDS;}
250 virtual int IOD() const {return _AODC;}
251 virtual QString toString(double version) const;
252
253 private:
254 virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
255
256 bncTime _TOT;
257 bncTime _TOE;
258 bncTime _TOC_bdt;
259 bncTime _TOE_bdt;
260 int _AODE;
261 int _AODC;
262 int _URAI; // [0..15] from RTCM stream
263 double _URA; // [m] from RINEX file
264 double _clock_bias; // [s]
265 double _clock_drift; // [s/s]
266 double _clock_driftrate; // [s/s^2]
267 double _Crs; // [m]
268 double _Delta_n; // [rad/s]
269 double _M0; // [rad]
270 double _Cuc; // [rad]
271 double _e; //
272 double _Cus; // [rad]
273 double _sqrt_A; // [m^0.5]
274 double _Cic; // [rad]
275 double _OMEGA0; // [rad]
276 double _Cis; // [rad]
277 double _i0; // [rad]
278 double _Crc; // [m]
279 double _omega; // [rad]
280 double _OMEGADOT; // [rad/s]
281 double _IDOT; // [rad/s]
282 double _TGD1; // [s]
283 double _TGD2; // [s]
284 int _SatH1; //
285 double _TOTs; // [s] of BDT week; RINEX file entry
286 double _TOEs; // [s] of BDT week; RINEX file entry
287 double _TOEw; // [-] BDT week; RINEX file entry
288};
289
290#endif
Note: See TracBrowser for help on using the repository browser.