source: ntrip/trunk/BNC/src/RTCM3/ephemeris.h@ 4544

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