source: ntrip/trunk/BNC/RTCM3/ephemeris.h@ 4013

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