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

Last change on this file since 4284 was 4097, checked in by mervart, 12 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 private:
84 double _clock_bias; // [s]
85 double _clock_drift; // [s/s]
86 double _clock_driftrate; // [s/s^2]
87
88 double _IODE;
89 double _Crs; // [m]
90 double _Delta_n; // [rad/s]
91 double _M0; // [rad]
92
93 double _Cuc; // [rad]
94 double _e; //
95 double _Cus; // [rad]
96 double _sqrt_A; // [m^0.5]
97
98 double _TOEsec; // [s]
99 double _Cic; // [rad]
100 double _OMEGA0; // [rad]
101 double _Cis; // [rad]
102
103 double _i0; // [rad]
104 double _Crc; // [m]
105 double _omega; // [rad]
106 double _OMEGADOT; // [rad/s]
107
108 double _IDOT; // [rad/s]
109 double _L2Codes; // Codes on L2 channel
110 double _TOEweek;
111 double _L2PFlag; // L2 P data flag
112
113 double _ura; // SV accuracy
114 double _health; // SV health
115 double _TGD; // [s]
116 double _IODC;
117
118 double _TOT; // Transmisstion time
119 double _fitInterval; // Fit interval
120};
121
122class t_ephGlo : public t_eph {
123 public:
124 t_ephGlo() { _xv.ReSize(6); }
125 t_ephGlo(float rnxVersion, const QStringList& lines);
126
127 virtual ~t_ephGlo() {}
128
129 virtual e_type type() const {return t_eph::GLONASS;}
130
131 virtual QString toString(double version) const;
132
133 virtual void position(int GPSweek, double GPSweeks,
134 double* xc,
135 double* vv) const;
136
137 virtual int IOD() const;
138
139 virtual int RTCM3(unsigned char *);
140
141 void set(const glonassephemeris* ee);
142
143 int slotNum() const {return int(_frequency_number);}
144
145 private:
146 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
147 double* acc);
148
149 mutable bncTime _tt; // time
150 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
151
152 double _gps_utc;
153 double _tau; // [s]
154 double _gamma; //
155 double _tki; // message frame time
156
157 double _x_pos; // [km]
158 double _x_velocity; // [km/s]
159 double _x_acceleration; // [km/s^2]
160 double _health; // 0 = O.K.
161
162 double _y_pos; // [km]
163 double _y_velocity; // [km/s]
164 double _y_acceleration; // [km/s^2]
165 double _frequency_number; // ICD-GLONASS data position
166
167 double _z_pos; // [km]
168 double _z_velocity; // [km/s]
169 double _z_acceleration; // [km/s^2]
170 double _E; // Age of Information [days]
171};
172
173class t_ephGal : public t_eph {
174 public:
175 t_ephGal() { }
176 t_ephGal(float rnxVersion, const QStringList& lines);
177 virtual ~t_ephGal() {}
178
179 virtual QString toString(double version) const;
180
181 virtual e_type type() const {return t_eph::Galileo;}
182
183 void set(const galileoephemeris* ee);
184
185 virtual void position(int GPSweek, double GPSweeks,
186 double* xc,
187 double* vv) const;
188
189 virtual int IOD() const { return static_cast<int>(_IODnav); }
190
191 virtual int RTCM3(unsigned char *);
192
193 private:
194 double _clock_bias; // [s]
195 double _clock_drift; // [s/s]
196 double _clock_driftrate; // [s/s^2]
197
198 double _IODnav;
199 double _Crs; // [m]
200 double _Delta_n; // [rad/s]
201 double _M0; // [rad]
202
203 double _Cuc; // [rad]
204 double _e; //
205 double _Cus; // [rad]
206 double _sqrt_A; // [m^0.5]
207
208 double _TOEsec; // [s]
209 double _Cic; // [rad]
210 double _OMEGA0; // [rad]
211 double _Cis; // [rad]
212
213 double _i0; // [rad]
214 double _Crc; // [m]
215 double _omega; // [rad]
216 double _OMEGADOT; // [rad/s]
217
218 double _IDOT; // [rad/s]
219 //
220 double _TOEweek;
221 // spare
222
223 double _SISA; // Signal In Space Accuracy
224 double _E5aHS; // E5a Health Status
225 double _BGD_1_5A; // group delay [s]
226 double _BGD_1_5B; // group delay [s]
227
228 double _TOT; // [s]
229};
230
231#endif
Note: See TracBrowser for help on using the repository browser.