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