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