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

Last change on this file since 5752 was 5749, checked in by mervart, 10 years ago
File size: 6.7 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"
10extern "C" {
11#include "rtcm3torinex.h"
12}
13
14namespace BNC {
15 class t_orbCorr;
16 class t_clkCorr;
17}
18
19class t_eph {
20 public:
21
22 enum e_type {unknown, GPS, GLONASS, Galileo};
23
24 t_eph();
25 virtual ~t_eph() {};
26
27 static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {
28 return eph1->_TOC < eph2->_TOC;
29 }
30
31 virtual e_type type() const = 0;
32 virtual QString toString(double version) const = 0;
33 virtual void position(int GPSweek, double GPSweeks,
34 double* xc, double* vv) const = 0;
35 virtual int IOD() const = 0;
36 virtual int RTCM3(unsigned char *) = 0;
37
38 bool ok() const {return _ok;}
39 bncTime TOC() const {return _TOC;}
40 bool isNewerThan(const t_eph* eph) const {
41 return earlierTime(eph, this);
42 }
43 QString prn() const {return _prn;}
44 char system() const {return _prn[0].toAscii();}
45 const QDateTime& receptDateTime() const {return _receptDateTime;}
46
47 void position(int GPSweek, double GPSweeks,
48 double& xx, double& yy, double& zz, double& cc) const {
49 double tmp_xx[4];
50 double tmp_vv[4];
51 position(GPSweek, GPSweeks, tmp_xx, tmp_vv);
52
53 xx = tmp_xx[0];
54 yy = tmp_xx[1];
55 zz = tmp_xx[2];
56 cc = tmp_xx[3];
57 }
58
59 t_irc getCrd(const bncTime& tt, ColumnVector& xc,
60 ColumnVector& vv, bool noCorr = false) const;
61 void setOrbCorr(const BNC::t_orbCorr* orbCorr);
62 void setClkCorr(const BNC::t_clkCorr* clkCorr);
63 virtual int slotNum() const {return 0;}
64
65 static QString rinexDateStr(const bncTime& tt, const QString& prn,
66 double version);
67
68 protected:
69 QString _prn;
70 bncTime _TOC;
71 QDateTime _receptDateTime;
72 bool _ok;
73 BNC::t_orbCorr* _orbCorr;
74 BNC::t_clkCorr* _clkCorr;
75};
76
77
78class t_ephGPS : public t_eph {
79 public:
80 t_ephGPS() { }
81 t_ephGPS(float rnxVersion, const QStringList& lines);
82 virtual ~t_ephGPS() {}
83
84 virtual e_type type() const {return t_eph::GPS;}
85
86 virtual QString toString(double version) const;
87
88 void set(const gpsephemeris* ee);
89
90 virtual void position(int GPSweek, double GPSweeks,
91 double* xc,
92 double* vv) const;
93
94 virtual int IOD() const { return static_cast<int>(_IODC); }
95
96 virtual int RTCM3(unsigned char *);
97
98 double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
99
100 private:
101 double _clock_bias; // [s]
102 double _clock_drift; // [s/s]
103 double _clock_driftrate; // [s/s^2]
104
105 double _IODE;
106 double _Crs; // [m]
107 double _Delta_n; // [rad/s]
108 double _M0; // [rad]
109
110 double _Cuc; // [rad]
111 double _e; //
112 double _Cus; // [rad]
113 double _sqrt_A; // [m^0.5]
114
115 double _TOEsec; // [s]
116 double _Cic; // [rad]
117 double _OMEGA0; // [rad]
118 double _Cis; // [rad]
119
120 double _i0; // [rad]
121 double _Crc; // [m]
122 double _omega; // [rad]
123 double _OMEGADOT; // [rad/s]
124
125 double _IDOT; // [rad/s]
126 double _L2Codes; // Codes on L2 channel
127 double _TOEweek;
128 double _L2PFlag; // L2 P data flag
129
130 double _ura; // SV accuracy
131 double _health; // SV health
132 double _TGD; // [s]
133 double _IODC;
134
135 double _TOT; // Transmisstion time
136 double _fitInterval; // Fit interval
137};
138
139class t_ephGlo : public t_eph {
140 public:
141 t_ephGlo() { _xv.ReSize(6); }
142 t_ephGlo(float rnxVersion, const QStringList& lines);
143
144 virtual ~t_ephGlo() {}
145
146 virtual e_type type() const {return t_eph::GLONASS;}
147
148 virtual QString toString(double version) const;
149
150 virtual void position(int GPSweek, double GPSweeks,
151 double* xc,
152 double* vv) const;
153
154 virtual int IOD() const;
155
156 virtual int RTCM3(unsigned char *);
157
158 void set(const glonassephemeris* ee);
159
160 virtual int slotNum() const {return int(_frequency_number);}
161
162 private:
163 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
164 double* acc);
165
166 mutable bncTime _tt; // time
167 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
168
169 double _gps_utc;
170 double _tau; // [s]
171 double _gamma; //
172 double _tki; // message frame time
173
174 double _x_pos; // [km]
175 double _x_velocity; // [km/s]
176 double _x_acceleration; // [km/s^2]
177 double _health; // 0 = O.K.
178
179 double _y_pos; // [km]
180 double _y_velocity; // [km/s]
181 double _y_acceleration; // [km/s^2]
182 double _frequency_number; // ICD-GLONASS data position
183
184 double _z_pos; // [km]
185 double _z_velocity; // [km/s]
186 double _z_acceleration; // [km/s^2]
187 double _E; // Age of Information [days]
188};
189
190class t_ephGal : public t_eph {
191 public:
192 t_ephGal() { }
193 t_ephGal(float rnxVersion, const QStringList& lines);
194 virtual ~t_ephGal() {}
195
196 virtual QString toString(double version) const;
197
198 virtual e_type type() const {return t_eph::Galileo;}
199
200 void set(const galileoephemeris* ee);
201
202 virtual void position(int GPSweek, double GPSweeks,
203 double* xc,
204 double* vv) const;
205
206 virtual int IOD() const { return static_cast<int>(_IODnav); }
207
208 virtual int RTCM3(unsigned char *);
209
210 private:
211 double _clock_bias; // [s]
212 double _clock_drift; // [s/s]
213 double _clock_driftrate; // [s/s^2]
214
215 double _IODnav;
216 double _Crs; // [m]
217 double _Delta_n; // [rad/s]
218 double _M0; // [rad]
219
220 double _Cuc; // [rad]
221 double _e; //
222 double _Cus; // [rad]
223 double _sqrt_A; // [m^0.5]
224
225 double _TOEsec; // [s]
226 double _Cic; // [rad]
227 double _OMEGA0; // [rad]
228 double _Cis; // [rad]
229
230 double _i0; // [rad]
231 double _Crc; // [m]
232 double _omega; // [rad]
233 double _OMEGADOT; // [rad/s]
234
235 double _IDOT; // [rad/s]
236 //
237 double _TOEweek;
238 // spare
239
240 double _SISA; // Signal In Space Accuracy
241 double _E5aHS; // E5a Health Status
242 double _E5bHS; // E5a Health Status
243 double _BGD_1_5A; // group delay [s]
244 double _BGD_1_5B; // group delay [s]
245
246 double _TOT; // [s]
247
248 int _flags;
249};
250
251#endif
Note: See TracBrowser for help on using the repository browser.