[1025] | 1 | #ifndef EPHEMERIS_H
|
---|
| 2 | #define EPHEMERIS_H
|
---|
| 3 |
|
---|
[2221] | 4 | #include <newmat.h>
|
---|
[3174] | 5 | #include <QtCore>
|
---|
[1025] | 6 | #include <stdio.h>
|
---|
| 7 | #include <string>
|
---|
[4018] | 8 | #include "bnctime.h"
|
---|
[5749] | 9 | #include "bncconst.h"
|
---|
[5776] | 10 | #include "t_prn.h"
|
---|
[6139] | 11 |
|
---|
[1807] | 12 | extern "C" {
|
---|
[6139] | 13 | # include "rtcm3torinex.h"
|
---|
[1807] | 14 | }
|
---|
[1025] | 15 |
|
---|
[6141] | 16 | class t_orbCorr;
|
---|
| 17 | class t_clkCorr;
|
---|
[5749] | 18 |
|
---|
[1025] | 19 | class t_eph {
|
---|
| 20 | public:
|
---|
[6602] | 21 | enum e_type {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS};
|
---|
[6521] | 22 | enum e_checkState {unchecked, ok, bad};
|
---|
[4005] | 23 |
|
---|
[5749] | 24 | t_eph();
|
---|
[4018] | 25 | virtual ~t_eph() {};
|
---|
| 26 |
|
---|
[6109] | 27 | virtual e_type type() const = 0;
|
---|
[4013] | 28 | virtual QString toString(double version) const = 0;
|
---|
[6109] | 29 | virtual int IOD() const = 0;
|
---|
| 30 | virtual int slotNum() const {return 0;}
|
---|
[4018] | 31 | bncTime TOC() const {return _TOC;}
|
---|
[6109] | 32 | bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
|
---|
[6518] | 33 | e_checkState checkState() const {return _checkState;}
|
---|
[6519] | 34 | void setCheckState(e_checkState checkState) {_checkState = checkState;}
|
---|
[6109] | 35 | t_prn prn() const {return _prn;}
|
---|
| 36 | t_irc getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const;
|
---|
[6141] | 37 | void setOrbCorr(const t_orbCorr* orbCorr);
|
---|
| 38 | void setClkCorr(const t_clkCorr* clkCorr);
|
---|
[3174] | 39 | const QDateTime& receptDateTime() const {return _receptDateTime;}
|
---|
[6109] | 40 | static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version);
|
---|
| 41 | static QString rinexDateStr(const bncTime& tt, const QString& prnStr, double version);
|
---|
| 42 | static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {return eph1->_TOC < eph2->_TOC;}
|
---|
[1025] | 43 |
|
---|
[4022] | 44 | protected:
|
---|
[6213] | 45 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
|
---|
[6518] | 46 | t_prn _prn;
|
---|
| 47 | bncTime _TOC;
|
---|
| 48 | QDateTime _receptDateTime;
|
---|
| 49 | e_checkState _checkState;
|
---|
| 50 | t_orbCorr* _orbCorr;
|
---|
| 51 | t_clkCorr* _clkCorr;
|
---|
[1025] | 52 | };
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | class t_ephGPS : public t_eph {
|
---|
[5852] | 56 | friend class t_ephEncoder;
|
---|
[1025] | 57 | public:
|
---|
| 58 | t_ephGPS() { }
|
---|
[3659] | 59 | t_ephGPS(float rnxVersion, const QStringList& lines);
|
---|
[2221] | 60 | virtual ~t_ephGPS() {}
|
---|
[4005] | 61 |
|
---|
[6373] | 62 | virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
|
---|
[4013] | 63 | virtual QString toString(double version) const;
|
---|
[6109] | 64 | virtual int IOD() const { return static_cast<int>(_IODC); }
|
---|
[1025] | 65 | void set(const gpsephemeris* ee);
|
---|
[4366] | 66 | double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
|
---|
| 67 |
|
---|
[1025] | 68 | private:
|
---|
[6213] | 69 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
[6109] | 70 |
|
---|
[4018] | 71 | double _clock_bias; // [s]
|
---|
| 72 | double _clock_drift; // [s/s]
|
---|
| 73 | double _clock_driftrate; // [s/s^2]
|
---|
[1025] | 74 |
|
---|
[4018] | 75 | double _IODE;
|
---|
| 76 | double _Crs; // [m]
|
---|
| 77 | double _Delta_n; // [rad/s]
|
---|
| 78 | double _M0; // [rad]
|
---|
[1025] | 79 |
|
---|
[4018] | 80 | double _Cuc; // [rad]
|
---|
| 81 | double _e; //
|
---|
| 82 | double _Cus; // [rad]
|
---|
| 83 | double _sqrt_A; // [m^0.5]
|
---|
[1025] | 84 |
|
---|
[4018] | 85 | double _TOEsec; // [s]
|
---|
| 86 | double _Cic; // [rad]
|
---|
| 87 | double _OMEGA0; // [rad]
|
---|
| 88 | double _Cis; // [rad]
|
---|
| 89 |
|
---|
| 90 | double _i0; // [rad]
|
---|
| 91 | double _Crc; // [m]
|
---|
| 92 | double _omega; // [rad]
|
---|
| 93 | double _OMEGADOT; // [rad/s]
|
---|
| 94 |
|
---|
| 95 | double _IDOT; // [rad/s]
|
---|
| 96 | double _L2Codes; // Codes on L2 channel
|
---|
| 97 | double _TOEweek;
|
---|
| 98 | double _L2PFlag; // L2 P data flag
|
---|
| 99 |
|
---|
[5852] | 100 | mutable double _ura; // SV accuracy
|
---|
[4018] | 101 | double _health; // SV health
|
---|
| 102 | double _TGD; // [s]
|
---|
| 103 | double _IODC;
|
---|
| 104 |
|
---|
| 105 | double _TOT; // Transmisstion time
|
---|
| 106 | double _fitInterval; // Fit interval
|
---|
[1025] | 107 | };
|
---|
| 108 |
|
---|
[2221] | 109 | class t_ephGlo : public t_eph {
|
---|
[5853] | 110 | friend class t_ephEncoder;
|
---|
[2221] | 111 | public:
|
---|
[2257] | 112 | t_ephGlo() { _xv.ReSize(6); }
|
---|
[3659] | 113 | t_ephGlo(float rnxVersion, const QStringList& lines);
|
---|
[2221] | 114 | virtual ~t_ephGlo() {}
|
---|
| 115 |
|
---|
[4005] | 116 | virtual e_type type() const {return t_eph::GLONASS;}
|
---|
[4013] | 117 | virtual QString toString(double version) const;
|
---|
[2221] | 118 | virtual int IOD() const;
|
---|
[6109] | 119 | virtual int slotNum() const {return int(_frequency_number);}
|
---|
[5133] | 120 | void set(const glonassephemeris* ee);
|
---|
[2221] | 121 |
|
---|
| 122 | private:
|
---|
[6213] | 123 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
[6109] | 124 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
|
---|
[2221] | 125 |
|
---|
[4018] | 126 | mutable bncTime _tt; // time
|
---|
[2221] | 127 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
| 128 |
|
---|
[3255] | 129 | double _gps_utc;
|
---|
[2221] | 130 | double _tau; // [s]
|
---|
| 131 | double _gamma; //
|
---|
[5853] | 132 | mutable double _tki; // message frame time
|
---|
[4018] | 133 |
|
---|
[2221] | 134 | double _x_pos; // [km]
|
---|
| 135 | double _x_velocity; // [km/s]
|
---|
| 136 | double _x_acceleration; // [km/s^2]
|
---|
[4018] | 137 | double _health; // 0 = O.K.
|
---|
| 138 |
|
---|
[2221] | 139 | double _y_pos; // [km]
|
---|
| 140 | double _y_velocity; // [km/s]
|
---|
| 141 | double _y_acceleration; // [km/s^2]
|
---|
[4018] | 142 | double _frequency_number; // ICD-GLONASS data position
|
---|
| 143 |
|
---|
[2221] | 144 | double _z_pos; // [km]
|
---|
| 145 | double _z_velocity; // [km/s]
|
---|
| 146 | double _z_acceleration; // [km/s^2]
|
---|
[4018] | 147 | double _E; // Age of Information [days]
|
---|
[2221] | 148 | };
|
---|
| 149 |
|
---|
[2770] | 150 | class t_ephGal : public t_eph {
|
---|
[5853] | 151 | friend class t_ephEncoder;
|
---|
[2770] | 152 | public:
|
---|
| 153 | t_ephGal() { }
|
---|
[3659] | 154 | t_ephGal(float rnxVersion, const QStringList& lines);
|
---|
[2770] | 155 | virtual ~t_ephGal() {}
|
---|
[4005] | 156 |
|
---|
[4013] | 157 | virtual QString toString(double version) const;
|
---|
[4005] | 158 | virtual e_type type() const {return t_eph::Galileo;}
|
---|
[6109] | 159 | virtual int IOD() const { return static_cast<int>(_IODnav); }
|
---|
[2770] | 160 | void set(const galileoephemeris* ee);
|
---|
| 161 |
|
---|
[6109] | 162 | private:
|
---|
[6213] | 163 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
[2770] | 164 |
|
---|
| 165 | double _clock_bias; // [s]
|
---|
| 166 | double _clock_drift; // [s/s]
|
---|
| 167 | double _clock_driftrate; // [s/s^2]
|
---|
[4018] | 168 |
|
---|
| 169 | double _IODnav;
|
---|
[2770] | 170 | double _Crs; // [m]
|
---|
| 171 | double _Delta_n; // [rad/s]
|
---|
| 172 | double _M0; // [rad]
|
---|
[4018] | 173 |
|
---|
[2770] | 174 | double _Cuc; // [rad]
|
---|
| 175 | double _e; //
|
---|
| 176 | double _Cus; // [rad]
|
---|
| 177 | double _sqrt_A; // [m^0.5]
|
---|
[4018] | 178 |
|
---|
| 179 | double _TOEsec; // [s]
|
---|
[2770] | 180 | double _Cic; // [rad]
|
---|
| 181 | double _OMEGA0; // [rad]
|
---|
| 182 | double _Cis; // [rad]
|
---|
[4018] | 183 |
|
---|
[2770] | 184 | double _i0; // [rad]
|
---|
| 185 | double _Crc; // [m]
|
---|
| 186 | double _omega; // [rad]
|
---|
| 187 | double _OMEGADOT; // [rad/s]
|
---|
[4018] | 188 |
|
---|
[2770] | 189 | double _IDOT; // [rad/s]
|
---|
[4018] | 190 | //
|
---|
| 191 | double _TOEweek;
|
---|
| 192 | // spare
|
---|
| 193 |
|
---|
[4023] | 194 | double _SISA; // Signal In Space Accuracy
|
---|
| 195 | double _E5aHS; // E5a Health Status
|
---|
[5541] | 196 | double _E5bHS; // E5a Health Status
|
---|
[2770] | 197 | double _BGD_1_5A; // group delay [s]
|
---|
[3255] | 198 | double _BGD_1_5B; // group delay [s]
|
---|
[2770] | 199 |
|
---|
[4018] | 200 | double _TOT; // [s]
|
---|
[5539] | 201 |
|
---|
| 202 | int _flags;
|
---|
[2770] | 203 | };
|
---|
| 204 |
|
---|
[6380] | 205 | class t_ephSBAS : public t_eph {
|
---|
| 206 | friend class t_ephEncoder;
|
---|
| 207 | public:
|
---|
[6382] | 208 | t_ephSBAS() {}
|
---|
[6380] | 209 | t_ephSBAS(float rnxVersion, const QStringList& lines);
|
---|
| 210 | virtual ~t_ephSBAS() {}
|
---|
| 211 |
|
---|
| 212 | void set(const sbasephemeris* ee);
|
---|
| 213 | virtual e_type type() const {return t_eph::SBAS;}
|
---|
| 214 | virtual int IOD() const {return _IODN;}
|
---|
| 215 | virtual QString toString(double version) const;
|
---|
| 216 |
|
---|
| 217 | private:
|
---|
[6381] | 218 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
[6380] | 219 |
|
---|
[6536] | 220 | int _IODN;
|
---|
[6390] | 221 | double _TOW; // not used (set to 0.9999e9)
|
---|
[6380] | 222 | double _agf0; // [s] clock correction
|
---|
| 223 | double _agf1; // [s/s] clock correction drift
|
---|
| 224 |
|
---|
[6387] | 225 | double _x_pos; // [m]
|
---|
| 226 | double _x_velocity; // [m/s]
|
---|
| 227 | double _x_acceleration; // [m/s^2]
|
---|
[6380] | 228 |
|
---|
[6387] | 229 | double _y_pos; // [m]
|
---|
| 230 | double _y_velocity; // [m/s]
|
---|
| 231 | double _y_acceleration; // [m/s^2]
|
---|
[6380] | 232 |
|
---|
[6387] | 233 | double _z_pos; // [m]
|
---|
| 234 | double _z_velocity; // [m/s]
|
---|
| 235 | double _z_acceleration; // [m/s^2]
|
---|
[6380] | 236 |
|
---|
[6390] | 237 | double _ura;
|
---|
| 238 | double _health;
|
---|
[6380] | 239 | };
|
---|
| 240 |
|
---|
[6600] | 241 | class t_ephBDS : public t_eph {
|
---|
[6400] | 242 | friend class t_ephEncoder;
|
---|
| 243 | public:
|
---|
[6600] | 244 | t_ephBDS() {}
|
---|
| 245 | t_ephBDS(float rnxVersion, const QStringList& lines);
|
---|
| 246 | virtual ~t_ephBDS() {}
|
---|
[6400] | 247 |
|
---|
[6600] | 248 | void set(const bdsephemeris* ee);
|
---|
[6602] | 249 | virtual e_type type() const {return t_eph::BDS;}
|
---|
[6400] | 250 | virtual int IOD() const {return _AODC;}
|
---|
| 251 | virtual QString toString(double version) const;
|
---|
| 252 |
|
---|
| 253 | private:
|
---|
| 254 | virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
|
---|
| 255 |
|
---|
| 256 | bncTime _TOT;
|
---|
| 257 | bncTime _TOE;
|
---|
| 258 | bncTime _TOC_bdt;
|
---|
| 259 | bncTime _TOE_bdt;
|
---|
| 260 | int _AODE;
|
---|
| 261 | int _AODC;
|
---|
[6620] | 262 | int _URAI; // [0..15]
|
---|
[6400] | 263 | double _clock_bias; // [s]
|
---|
| 264 | double _clock_drift; // [s/s]
|
---|
| 265 | double _clock_driftrate; // [s/s^2]
|
---|
| 266 | double _Crs; // [m]
|
---|
| 267 | double _Delta_n; // [rad/s]
|
---|
| 268 | double _M0; // [rad]
|
---|
| 269 | double _Cuc; // [rad]
|
---|
| 270 | double _e; //
|
---|
| 271 | double _Cus; // [rad]
|
---|
| 272 | double _sqrt_A; // [m^0.5]
|
---|
| 273 | double _Cic; // [rad]
|
---|
| 274 | double _OMEGA0; // [rad]
|
---|
| 275 | double _Cis; // [rad]
|
---|
| 276 | double _i0; // [rad]
|
---|
| 277 | double _Crc; // [m]
|
---|
| 278 | double _omega; // [rad]
|
---|
| 279 | double _OMEGADOT; // [rad/s]
|
---|
| 280 | double _IDOT; // [rad/s]
|
---|
| 281 | double _TGD1; // [s]
|
---|
| 282 | double _TGD2; // [s]
|
---|
| 283 | int _SatH1; //
|
---|
| 284 | };
|
---|
| 285 |
|
---|
[1025] | 286 | #endif
|
---|