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