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