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