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