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

Last change on this file since 5852 was 5852, 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"
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 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 void set(const glonassephemeris* ee);
157
158 virtual int slotNum() const {return int(_frequency_number);}
159
160 private:
161 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
162 double* acc);
163
164 mutable bncTime _tt; // time
165 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
166
167 double _gps_utc;
168 double _tau; // [s]
169 double _gamma; //
170 double _tki; // message frame time
171
172 double _x_pos; // [km]
173 double _x_velocity; // [km/s]
174 double _x_acceleration; // [km/s^2]
175 double _health; // 0 = O.K.
176
177 double _y_pos; // [km]
178 double _y_velocity; // [km/s]
179 double _y_acceleration; // [km/s^2]
180 double _frequency_number; // ICD-GLONASS data position
181
182 double _z_pos; // [km]
183 double _z_velocity; // [km/s]
184 double _z_acceleration; // [km/s^2]
185 double _E; // Age of Information [days]
186};
187
188class t_ephGal : public t_eph {
189 public:
190 t_ephGal() { }
191 t_ephGal(float rnxVersion, const QStringList& lines);
192 virtual ~t_ephGal() {}
193
194 virtual QString toString(double version) const;
195
196 virtual e_type type() const {return t_eph::Galileo;}
197
198 void set(const galileoephemeris* ee);
199
200 virtual void position(int GPSweek, double GPSweeks,
201 double* xc,
202 double* vv) const;
203
204 virtual int IOD() const { return static_cast<int>(_IODnav); }
205
206 private:
207 double _clock_bias; // [s]
208 double _clock_drift; // [s/s]
209 double _clock_driftrate; // [s/s^2]
210
211 double _IODnav;
212 double _Crs; // [m]
213 double _Delta_n; // [rad/s]
214 double _M0; // [rad]
215
216 double _Cuc; // [rad]
217 double _e; //
218 double _Cus; // [rad]
219 double _sqrt_A; // [m^0.5]
220
221 double _TOEsec; // [s]
222 double _Cic; // [rad]
223 double _OMEGA0; // [rad]
224 double _Cis; // [rad]
225
226 double _i0; // [rad]
227 double _Crc; // [m]
228 double _omega; // [rad]
229 double _OMEGADOT; // [rad/s]
230
231 double _IDOT; // [rad/s]
232 //
233 double _TOEweek;
234 // spare
235
236 double _SISA; // Signal In Space Accuracy
237 double _E5aHS; // E5a Health Status
238 double _E5bHS; // E5a Health Status
239 double _BGD_1_5A; // group delay [s]
240 double _BGD_1_5B; // group delay [s]
241
242 double _TOT; // [s]
243
244 int _flags;
245};
246
247#endif
Note: See TracBrowser for help on using the repository browser.