| 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 | extern "C" {
|
|---|
| 12 | #include "rtcm3torinex.h"
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | namespace BNC_PPP {
|
|---|
| 16 | class t_orbCorr;
|
|---|
| 17 | class t_clkCorr;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | class t_eph {
|
|---|
| 21 | public:
|
|---|
| 22 | enum e_type {unknown, GPS, GLONASS, Galileo};
|
|---|
| 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 | bool ok() const {return _ok;}
|
|---|
| 32 | bncTime TOC() const {return _TOC;}
|
|---|
| 33 | bool isNewerThan(const t_eph* eph) const {return earlierTime(eph, this);}
|
|---|
| 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 BNC_PPP::t_orbCorr* orbCorr);
|
|---|
| 37 | void setClkCorr(const BNC_PPP::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 void position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
|
|---|
| 45 | t_prn _prn;
|
|---|
| 46 | bncTime _TOC;
|
|---|
| 47 | QDateTime _receptDateTime;
|
|---|
| 48 | bool _ok;
|
|---|
| 49 | BNC_PPP::t_orbCorr* _orbCorr;
|
|---|
| 50 | BNC_PPP::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 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 void 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 void 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 void 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 | #endif
|
|---|