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

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