[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"
|
---|
[1807] | 9 | extern "C" {
|
---|
[2492] | 10 | #include "rtcm3torinex.h"
|
---|
[1807] | 11 | }
|
---|
[1025] | 12 |
|
---|
| 13 | class t_eph {
|
---|
| 14 | public:
|
---|
[4002] | 15 |
|
---|
[4005] | 16 | enum e_type {unknown, GPS, GLONASS, Galileo};
|
---|
| 17 |
|
---|
[4018] | 18 | t_eph() {_ok = false;}
|
---|
| 19 | virtual ~t_eph() {};
|
---|
| 20 |
|
---|
[4002] | 21 | static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {
|
---|
[4018] | 22 | return eph1->_TOC < eph2->_TOC;
|
---|
[4002] | 23 | }
|
---|
| 24 |
|
---|
[4005] | 25 | virtual e_type type() const = 0;
|
---|
[4013] | 26 | virtual QString toString(double version) const = 0;
|
---|
[4018] | 27 | virtual void position(int GPSweek, double GPSweeks,
|
---|
| 28 | double* xc, double* vv) const = 0;
|
---|
| 29 | virtual int IOD() const = 0;
|
---|
| 30 | virtual int RTCM3(unsigned char *) = 0;
|
---|
[4013] | 31 |
|
---|
[4018] | 32 | bool ok() const {return _ok;}
|
---|
| 33 | bncTime TOC() const {return _TOC;}
|
---|
| 34 | bool isNewerThan(const t_eph* eph) const {
|
---|
[4019] | 35 | return earlierTime(eph, this);
|
---|
[4018] | 36 | }
|
---|
| 37 | QString prn() const {return _prn;}
|
---|
[3174] | 38 | const QDateTime& receptDateTime() const {return _receptDateTime;}
|
---|
[1025] | 39 |
|
---|
| 40 | void position(int GPSweek, double GPSweeks,
|
---|
[2221] | 41 | double& xx, double& yy, double& zz, double& cc) const {
|
---|
[1025] | 42 | double tmp_xx[4];
|
---|
| 43 | double tmp_vv[4];
|
---|
| 44 | position(GPSweek, GPSweeks, tmp_xx, tmp_vv);
|
---|
| 45 |
|
---|
| 46 | xx = tmp_xx[0];
|
---|
| 47 | yy = tmp_xx[1];
|
---|
| 48 | zz = tmp_xx[2];
|
---|
| 49 | cc = tmp_xx[3];
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[4029] | 52 | static QString rinexDateStr(const bncTime& tt, const QString& prn,
|
---|
| 53 | double version);
|
---|
| 54 |
|
---|
[4022] | 55 | protected:
|
---|
[3255] | 56 | QString _prn;
|
---|
[4018] | 57 | bncTime _TOC;
|
---|
[3255] | 58 | QDateTime _receptDateTime;
|
---|
[3659] | 59 | bool _ok;
|
---|
[1025] | 60 | };
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | class t_ephGPS : public t_eph {
|
---|
| 64 | public:
|
---|
| 65 | t_ephGPS() { }
|
---|
[3659] | 66 | t_ephGPS(float rnxVersion, const QStringList& lines);
|
---|
[2221] | 67 | virtual ~t_ephGPS() {}
|
---|
[4005] | 68 |
|
---|
| 69 | virtual e_type type() const {return t_eph::GPS;}
|
---|
| 70 |
|
---|
[4013] | 71 | virtual QString toString(double version) const;
|
---|
| 72 |
|
---|
[1025] | 73 | void set(const gpsephemeris* ee);
|
---|
| 74 |
|
---|
[2221] | 75 | virtual void position(int GPSweek, double GPSweeks,
|
---|
| 76 | double* xc,
|
---|
| 77 | double* vv) const;
|
---|
[1025] | 78 |
|
---|
[2221] | 79 | virtual int IOD() const { return static_cast<int>(_IODC); }
|
---|
[1025] | 80 |
|
---|
[3255] | 81 | virtual int RTCM3(unsigned char *);
|
---|
| 82 |
|
---|
[4366] | 83 | double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
|
---|
| 84 |
|
---|
[1025] | 85 | private:
|
---|
[4018] | 86 | double _clock_bias; // [s]
|
---|
| 87 | double _clock_drift; // [s/s]
|
---|
| 88 | double _clock_driftrate; // [s/s^2]
|
---|
[1025] | 89 |
|
---|
[4018] | 90 | double _IODE;
|
---|
| 91 | double _Crs; // [m]
|
---|
| 92 | double _Delta_n; // [rad/s]
|
---|
| 93 | double _M0; // [rad]
|
---|
[1025] | 94 |
|
---|
[4018] | 95 | double _Cuc; // [rad]
|
---|
| 96 | double _e; //
|
---|
| 97 | double _Cus; // [rad]
|
---|
| 98 | double _sqrt_A; // [m^0.5]
|
---|
[1025] | 99 |
|
---|
[4018] | 100 | double _TOEsec; // [s]
|
---|
| 101 | double _Cic; // [rad]
|
---|
| 102 | double _OMEGA0; // [rad]
|
---|
| 103 | double _Cis; // [rad]
|
---|
| 104 |
|
---|
| 105 | double _i0; // [rad]
|
---|
| 106 | double _Crc; // [m]
|
---|
| 107 | double _omega; // [rad]
|
---|
| 108 | double _OMEGADOT; // [rad/s]
|
---|
| 109 |
|
---|
| 110 | double _IDOT; // [rad/s]
|
---|
| 111 | double _L2Codes; // Codes on L2 channel
|
---|
| 112 | double _TOEweek;
|
---|
| 113 | double _L2PFlag; // L2 P data flag
|
---|
| 114 |
|
---|
| 115 | double _ura; // SV accuracy
|
---|
| 116 | double _health; // SV health
|
---|
| 117 | double _TGD; // [s]
|
---|
| 118 | double _IODC;
|
---|
| 119 |
|
---|
| 120 | double _TOT; // Transmisstion time
|
---|
| 121 | double _fitInterval; // Fit interval
|
---|
[1025] | 122 | };
|
---|
| 123 |
|
---|
[2221] | 124 | class t_ephGlo : public t_eph {
|
---|
| 125 | public:
|
---|
[2257] | 126 | t_ephGlo() { _xv.ReSize(6); }
|
---|
[3659] | 127 | t_ephGlo(float rnxVersion, const QStringList& lines);
|
---|
[2221] | 128 |
|
---|
| 129 | virtual ~t_ephGlo() {}
|
---|
| 130 |
|
---|
[4005] | 131 | virtual e_type type() const {return t_eph::GLONASS;}
|
---|
| 132 |
|
---|
[4013] | 133 | virtual QString toString(double version) const;
|
---|
| 134 |
|
---|
[2221] | 135 | virtual void position(int GPSweek, double GPSweeks,
|
---|
| 136 | double* xc,
|
---|
| 137 | double* vv) const;
|
---|
| 138 |
|
---|
| 139 | virtual int IOD() const;
|
---|
| 140 |
|
---|
[3255] | 141 | virtual int RTCM3(unsigned char *);
|
---|
| 142 |
|
---|
[5133] | 143 | void set(const glonassephemeris* ee);
|
---|
[2221] | 144 |
|
---|
[3761] | 145 | int slotNum() const {return int(_frequency_number);}
|
---|
| 146 |
|
---|
[2221] | 147 | private:
|
---|
[2556] | 148 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
|
---|
| 149 | double* acc);
|
---|
[2221] | 150 |
|
---|
[4018] | 151 | mutable bncTime _tt; // time
|
---|
[2221] | 152 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
| 153 |
|
---|
[3255] | 154 | double _gps_utc;
|
---|
[2221] | 155 | double _tau; // [s]
|
---|
| 156 | double _gamma; //
|
---|
[4018] | 157 | double _tki; // message frame time
|
---|
| 158 |
|
---|
[2221] | 159 | double _x_pos; // [km]
|
---|
| 160 | double _x_velocity; // [km/s]
|
---|
| 161 | double _x_acceleration; // [km/s^2]
|
---|
[4018] | 162 | double _health; // 0 = O.K.
|
---|
| 163 |
|
---|
[2221] | 164 | double _y_pos; // [km]
|
---|
| 165 | double _y_velocity; // [km/s]
|
---|
| 166 | double _y_acceleration; // [km/s^2]
|
---|
[4018] | 167 | double _frequency_number; // ICD-GLONASS data position
|
---|
| 168 |
|
---|
[2221] | 169 | double _z_pos; // [km]
|
---|
| 170 | double _z_velocity; // [km/s]
|
---|
| 171 | double _z_acceleration; // [km/s^2]
|
---|
[4018] | 172 | double _E; // Age of Information [days]
|
---|
[2221] | 173 | };
|
---|
| 174 |
|
---|
[2770] | 175 | class t_ephGal : public t_eph {
|
---|
| 176 | public:
|
---|
| 177 | t_ephGal() { }
|
---|
[3659] | 178 | t_ephGal(float rnxVersion, const QStringList& lines);
|
---|
[2770] | 179 | virtual ~t_ephGal() {}
|
---|
[4005] | 180 |
|
---|
[4013] | 181 | virtual QString toString(double version) const;
|
---|
| 182 |
|
---|
[4005] | 183 | virtual e_type type() const {return t_eph::Galileo;}
|
---|
| 184 |
|
---|
[2770] | 185 | void set(const galileoephemeris* ee);
|
---|
| 186 |
|
---|
| 187 | virtual void position(int GPSweek, double GPSweeks,
|
---|
| 188 | double* xc,
|
---|
| 189 | double* vv) const;
|
---|
| 190 |
|
---|
| 191 | virtual int IOD() const { return static_cast<int>(_IODnav); }
|
---|
| 192 |
|
---|
[3255] | 193 | virtual int RTCM3(unsigned char *);
|
---|
| 194 |
|
---|
[2770] | 195 | private:
|
---|
| 196 | double _clock_bias; // [s]
|
---|
| 197 | double _clock_drift; // [s/s]
|
---|
| 198 | double _clock_driftrate; // [s/s^2]
|
---|
[4018] | 199 |
|
---|
| 200 | double _IODnav;
|
---|
[2770] | 201 | double _Crs; // [m]
|
---|
| 202 | double _Delta_n; // [rad/s]
|
---|
| 203 | double _M0; // [rad]
|
---|
[4018] | 204 |
|
---|
[2770] | 205 | double _Cuc; // [rad]
|
---|
| 206 | double _e; //
|
---|
| 207 | double _Cus; // [rad]
|
---|
| 208 | double _sqrt_A; // [m^0.5]
|
---|
[4018] | 209 |
|
---|
| 210 | double _TOEsec; // [s]
|
---|
[2770] | 211 | double _Cic; // [rad]
|
---|
| 212 | double _OMEGA0; // [rad]
|
---|
| 213 | double _Cis; // [rad]
|
---|
[4018] | 214 |
|
---|
[2770] | 215 | double _i0; // [rad]
|
---|
| 216 | double _Crc; // [m]
|
---|
| 217 | double _omega; // [rad]
|
---|
| 218 | double _OMEGADOT; // [rad/s]
|
---|
[4018] | 219 |
|
---|
[2770] | 220 | double _IDOT; // [rad/s]
|
---|
[4018] | 221 | //
|
---|
| 222 | double _TOEweek;
|
---|
| 223 | // spare
|
---|
| 224 |
|
---|
[4023] | 225 | double _SISA; // Signal In Space Accuracy
|
---|
| 226 | double _E5aHS; // E5a Health Status
|
---|
[2770] | 227 | double _BGD_1_5A; // group delay [s]
|
---|
[3255] | 228 | double _BGD_1_5B; // group delay [s]
|
---|
[2770] | 229 |
|
---|
[4018] | 230 | double _TOT; // [s]
|
---|
[2770] | 231 | };
|
---|
| 232 |
|
---|
[1025] | 233 | #endif
|
---|