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