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