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

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