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

Last change on this file since 5876 was 5853, checked in by mervart, 10 years ago
File size: 6.8 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"
11extern "C" {
12#include "rtcm3torinex.h"
13}
14
15namespace BNC_PPP {
16 class t_orbCorr;
17 class t_clkCorr;
18}
19
20class t_eph {
21 public:
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
37 bool ok() const {return _ok;}
38 bncTime TOC() const {return _TOC;}
39 bool isNewerThan(const t_eph* eph) const {
40 return earlierTime(eph, this);
41 }
42 t_prn prn() const {return _prn;}
43 const QDateTime& receptDateTime() const {return _receptDateTime;}
44
45 void position(int GPSweek, double GPSweeks,
46 double& xx, double& yy, double& zz, double& cc) const {
47 double tmp_xx[4];
48 double tmp_vv[4];
49 position(GPSweek, GPSweeks, tmp_xx, tmp_vv);
50
51 xx = tmp_xx[0];
52 yy = tmp_xx[1];
53 zz = tmp_xx[2];
54 cc = tmp_xx[3];
55 }
56
57 t_irc getCrd(const bncTime& tt, ColumnVector& xc,
58 ColumnVector& vv, bool useCorr) const;
59 void setOrbCorr(const BNC_PPP::t_orbCorr* orbCorr);
60 void setClkCorr(const BNC_PPP::t_clkCorr* clkCorr);
61 virtual int slotNum() const {return 0;}
62
63 static QString rinexDateStr(const bncTime& tt, const t_prn& prn,
64 double version);
65
66 static QString rinexDateStr(const bncTime& tt, const QString& prnStr,
67 double version);
68
69 protected:
70 t_prn _prn;
71 bncTime _TOC;
72 QDateTime _receptDateTime;
73 bool _ok;
74 BNC_PPP::t_orbCorr* _orbCorr;
75 BNC_PPP::t_clkCorr* _clkCorr;
76};
77
78
79class t_ephGPS : public t_eph {
80 friend class t_ephEncoder;
81 public:
82 t_ephGPS() { }
83 t_ephGPS(float rnxVersion, const QStringList& lines);
84 virtual ~t_ephGPS() {}
85
86 virtual e_type type() const {return t_eph::GPS;}
87
88 virtual QString toString(double version) const;
89
90 void set(const gpsephemeris* ee);
91
92 virtual void position(int GPSweek, double GPSweeks,
93 double* xc,
94 double* vv) const;
95
96 virtual int IOD() const { return static_cast<int>(_IODC); }
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 mutable 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 friend class t_ephEncoder;
141 public:
142 t_ephGlo() { _xv.ReSize(6); }
143 t_ephGlo(float rnxVersion, const QStringList& lines);
144
145 virtual ~t_ephGlo() {}
146
147 virtual e_type type() const {return t_eph::GLONASS;}
148
149 virtual QString toString(double version) const;
150
151 virtual void position(int GPSweek, double GPSweeks,
152 double* xc,
153 double* vv) const;
154
155 virtual int IOD() const;
156
157 void set(const glonassephemeris* ee);
158
159 virtual int slotNum() const {return int(_frequency_number);}
160
161 private:
162 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
163 double* acc);
164
165 mutable bncTime _tt; // time
166 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
167
168 double _gps_utc;
169 double _tau; // [s]
170 double _gamma; //
171 mutable double _tki; // message frame time
172
173 double _x_pos; // [km]
174 double _x_velocity; // [km/s]
175 double _x_acceleration; // [km/s^2]
176 double _health; // 0 = O.K.
177
178 double _y_pos; // [km]
179 double _y_velocity; // [km/s]
180 double _y_acceleration; // [km/s^2]
181 double _frequency_number; // ICD-GLONASS data position
182
183 double _z_pos; // [km]
184 double _z_velocity; // [km/s]
185 double _z_acceleration; // [km/s^2]
186 double _E; // Age of Information [days]
187};
188
189class t_ephGal : public t_eph {
190 friend class t_ephEncoder;
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 private:
209 double _clock_bias; // [s]
210 double _clock_drift; // [s/s]
211 double _clock_driftrate; // [s/s^2]
212
213 double _IODnav;
214 double _Crs; // [m]
215 double _Delta_n; // [rad/s]
216 double _M0; // [rad]
217
218 double _Cuc; // [rad]
219 double _e; //
220 double _Cus; // [rad]
221 double _sqrt_A; // [m^0.5]
222
223 double _TOEsec; // [s]
224 double _Cic; // [rad]
225 double _OMEGA0; // [rad]
226 double _Cis; // [rad]
227
228 double _i0; // [rad]
229 double _Crc; // [m]
230 double _omega; // [rad]
231 double _OMEGADOT; // [rad/s]
232
233 double _IDOT; // [rad/s]
234 //
235 double _TOEweek;
236 // spare
237
238 double _SISA; // Signal In Space Accuracy
239 double _E5aHS; // E5a Health Status
240 double _E5bHS; // E5a Health Status
241 double _BGD_1_5A; // group delay [s]
242 double _BGD_1_5B; // group delay [s]
243
244 double _TOT; // [s]
245
246 int _flags;
247};
248
249#endif
Note: See TracBrowser for help on using the repository browser.