source: ntrip/branches/BNC_2.11.0/src/RTCM3/ephemeris.h@ 10514

Last change on this file since 10514 was 6214, checked in by stuerze, 10 years ago

prevent usage of very old GLONASS navigation messages

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