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

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