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