1 | #ifndef EPHEMERIS_H
|
---|
2 | #define EPHEMERIS_H
|
---|
3 |
|
---|
4 | #include <newmat.h>
|
---|
5 |
|
---|
6 | #include <stdio.h>
|
---|
7 | #include <string>
|
---|
8 | extern "C" {
|
---|
9 | #include "RTCM3/rtcm3torinex.h"
|
---|
10 | }
|
---|
11 |
|
---|
12 | class t_eph {
|
---|
13 | public:
|
---|
14 | virtual ~t_eph() {};
|
---|
15 |
|
---|
16 | bool isNewerThan(const t_eph* eph) const;
|
---|
17 | std::string prn() const {return _prn;}
|
---|
18 |
|
---|
19 | int GPSweek() const { return _GPSweek; }
|
---|
20 | double GPSweeks() const { return _GPSweeks; }
|
---|
21 |
|
---|
22 | virtual void position(int GPSweek, double GPSweeks,
|
---|
23 | double* xc, double* vv) const = 0;
|
---|
24 |
|
---|
25 | void position(int GPSweek, double GPSweeks,
|
---|
26 | double& xx, double& yy, double& zz, double& cc) const {
|
---|
27 | double tmp_xx[4];
|
---|
28 | double tmp_vv[4];
|
---|
29 |
|
---|
30 | position(GPSweek, GPSweeks, tmp_xx, tmp_vv);
|
---|
31 |
|
---|
32 | xx = tmp_xx[0];
|
---|
33 | yy = tmp_xx[1];
|
---|
34 | zz = tmp_xx[2];
|
---|
35 | cc = tmp_xx[3];
|
---|
36 | }
|
---|
37 |
|
---|
38 | virtual int IOD() const = 0;
|
---|
39 |
|
---|
40 | protected:
|
---|
41 | std::string _prn;
|
---|
42 | int _GPSweek;
|
---|
43 | double _GPSweeks;
|
---|
44 | };
|
---|
45 |
|
---|
46 |
|
---|
47 | class t_ephGPS : public t_eph {
|
---|
48 | public:
|
---|
49 | t_ephGPS() { }
|
---|
50 | virtual ~t_ephGPS() {}
|
---|
51 | double TOC() const {return _TOC;}
|
---|
52 |
|
---|
53 | void set(const gpsephemeris* ee);
|
---|
54 |
|
---|
55 | virtual void position(int GPSweek, double GPSweeks,
|
---|
56 | double* xc,
|
---|
57 | double* vv) const;
|
---|
58 |
|
---|
59 | virtual int IOD() const { return static_cast<int>(_IODC); }
|
---|
60 |
|
---|
61 | private:
|
---|
62 | double _TOW; // [s]
|
---|
63 | double _TOC; // [s]
|
---|
64 | double _TOE; // [s]
|
---|
65 | double _IODE;
|
---|
66 | double _IODC;
|
---|
67 |
|
---|
68 | double _clock_bias; // [s]
|
---|
69 | double _clock_drift; // [s/s]
|
---|
70 | double _clock_driftrate; // [s/s^2]
|
---|
71 |
|
---|
72 | double _Crs; // [m]
|
---|
73 | double _Delta_n; // [rad/s]
|
---|
74 | double _M0; // [rad]
|
---|
75 | double _Cuc; // [rad]
|
---|
76 | double _e; //
|
---|
77 | double _Cus; // [rad]
|
---|
78 | double _sqrt_A; // [m^0.5]
|
---|
79 | double _Cic; // [rad]
|
---|
80 | double _OMEGA0; // [rad]
|
---|
81 | double _Cis; // [rad]
|
---|
82 | double _i0; // [rad]
|
---|
83 | double _Crc; // [m]
|
---|
84 | double _omega; // [rad]
|
---|
85 | double _OMEGADOT; // [rad/s]
|
---|
86 | double _IDOT; // [rad/s]
|
---|
87 |
|
---|
88 | double _TGD; // [s]
|
---|
89 | };
|
---|
90 |
|
---|
91 | class t_ephGlo : public t_eph {
|
---|
92 | public:
|
---|
93 | t_ephGlo() { _xv.ReSize(6); }
|
---|
94 |
|
---|
95 | virtual ~t_ephGlo() {}
|
---|
96 |
|
---|
97 | virtual void position(int GPSweek, double GPSweeks,
|
---|
98 | double* xc,
|
---|
99 | double* vv) const;
|
---|
100 |
|
---|
101 | virtual int IOD() const;
|
---|
102 |
|
---|
103 | void set(const glonassephemeris* ee);
|
---|
104 |
|
---|
105 | private:
|
---|
106 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv);
|
---|
107 |
|
---|
108 | mutable double _tt; // time in seconds of GPSweek
|
---|
109 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
110 |
|
---|
111 | double _E; // [days]
|
---|
112 | double _tau; // [s]
|
---|
113 | double _gamma; //
|
---|
114 | double _x_pos; // [km]
|
---|
115 | double _x_velocity; // [km/s]
|
---|
116 | double _x_acceleration; // [km/s^2]
|
---|
117 | double _y_pos; // [km]
|
---|
118 | double _y_velocity; // [km/s]
|
---|
119 | double _y_acceleration; // [km/s^2]
|
---|
120 | double _z_pos; // [km]
|
---|
121 | double _z_velocity; // [km/s]
|
---|
122 | double _z_acceleration; // [km/s^2]
|
---|
123 | double _health; // 0 = O.K.
|
---|
124 | double _frequency_number; // ICD-GLONASS data position
|
---|
125 | double _tki; // message frame time
|
---|
126 | };
|
---|
127 |
|
---|
128 | #endif
|
---|