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