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,
|
---|
24 | double* vv) const = 0;
|
---|
25 |
|
---|
26 | void position(int GPSweek, double GPSweeks,
|
---|
27 | double& xx, double& yy, double& zz, double& cc) const {
|
---|
28 | double tmp_xx[4];
|
---|
29 | double tmp_vv[4];
|
---|
30 |
|
---|
31 | position(GPSweek, GPSweeks, tmp_xx, tmp_vv);
|
---|
32 |
|
---|
33 | xx = tmp_xx[0];
|
---|
34 | yy = tmp_xx[1];
|
---|
35 | zz = tmp_xx[2];
|
---|
36 | cc = tmp_xx[3];
|
---|
37 | }
|
---|
38 |
|
---|
39 | virtual int IOD() const = 0;
|
---|
40 |
|
---|
41 | virtual void print(std::ostream& out) const = 0;
|
---|
42 |
|
---|
43 | protected:
|
---|
44 | std::string _prn;
|
---|
45 | int _GPSweek;
|
---|
46 | double _GPSweeks;
|
---|
47 | };
|
---|
48 |
|
---|
49 |
|
---|
50 | class t_ephGPS : public t_eph {
|
---|
51 | public:
|
---|
52 | t_ephGPS() { }
|
---|
53 | virtual ~t_ephGPS() {}
|
---|
54 | double TOC() const {return _TOC;}
|
---|
55 |
|
---|
56 | void set(const gpsephemeris* ee);
|
---|
57 |
|
---|
58 | void set(int prn,
|
---|
59 | int GPSWeek,
|
---|
60 | double toc, double toe, double tot,
|
---|
61 | double IODE, double IODC,
|
---|
62 | double clock_bias, double clock_drift, double clock_driftrate,
|
---|
63 | double OMEGA0, double OMEGADOT,
|
---|
64 | double i0, double IDOT,
|
---|
65 | double omega,
|
---|
66 | double M0, double Delta_n,
|
---|
67 | double sqrt_A,
|
---|
68 | double e,
|
---|
69 | double Crc, double Crs,
|
---|
70 | double Cic, double Cis,
|
---|
71 | double Cuc, double Cus,
|
---|
72 | double TGD,
|
---|
73 | int health);
|
---|
74 |
|
---|
75 | virtual void position(int GPSweek, double GPSweeks,
|
---|
76 | double* xc,
|
---|
77 | double* vv) const;
|
---|
78 |
|
---|
79 | virtual int IOD() const { return static_cast<int>(_IODC); }
|
---|
80 |
|
---|
81 | virtual void print(std::ostream& out) const;
|
---|
82 |
|
---|
83 | private:
|
---|
84 | double _TOW; // [s]
|
---|
85 | double _TOC; // [s]
|
---|
86 | double _TOE; // [s]
|
---|
87 | double _IODE;
|
---|
88 | double _IODC;
|
---|
89 |
|
---|
90 | double _clock_bias; // [s]
|
---|
91 | double _clock_drift; // [s/s]
|
---|
92 | double _clock_driftrate; // [s/s^2]
|
---|
93 |
|
---|
94 | double _Crs; // [m]
|
---|
95 | double _Delta_n; // [rad/s]
|
---|
96 | double _M0; // [rad]
|
---|
97 | double _Cuc; // [rad]
|
---|
98 | double _e; //
|
---|
99 | double _Cus; // [rad]
|
---|
100 | double _sqrt_A; // [m^0.5]
|
---|
101 | double _Cic; // [rad]
|
---|
102 | double _OMEGA0; // [rad]
|
---|
103 | double _Cis; // [rad]
|
---|
104 | double _i0; // [rad]
|
---|
105 | double _Crc; // [m]
|
---|
106 | double _omega; // [rad]
|
---|
107 | double _OMEGADOT; // [rad/s]
|
---|
108 | double _IDOT; // [rad/s]
|
---|
109 |
|
---|
110 | double _TGD; // [s]
|
---|
111 | };
|
---|
112 |
|
---|
113 | class t_ephGlo : public t_eph {
|
---|
114 | public:
|
---|
115 | t_ephGlo() { _gps_utc = 0.0; _xv.ReSize(6); }
|
---|
116 |
|
---|
117 | virtual ~t_ephGlo() {}
|
---|
118 |
|
---|
119 | virtual void position(int GPSweek, double GPSweeks,
|
---|
120 | double* xc,
|
---|
121 | double* vv) const;
|
---|
122 |
|
---|
123 | virtual int IOD() const;
|
---|
124 |
|
---|
125 | virtual void print(std::ostream& out) const;
|
---|
126 |
|
---|
127 | void set(const glonassephemeris* ee);
|
---|
128 |
|
---|
129 | private:
|
---|
130 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv);
|
---|
131 |
|
---|
132 | mutable double _tt; // time in seconds of GPSweek
|
---|
133 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
134 |
|
---|
135 | double _gps_utc; // GPS - UTC in seconds
|
---|
136 | double _E; // [days]
|
---|
137 | double _tau; // [s]
|
---|
138 | double _gamma; //
|
---|
139 | double _x_pos; // [km]
|
---|
140 | double _x_velocity; // [km/s]
|
---|
141 | double _x_acceleration; // [km/s^2]
|
---|
142 | double _y_pos; // [km]
|
---|
143 | double _y_velocity; // [km/s]
|
---|
144 | double _y_acceleration; // [km/s^2]
|
---|
145 | double _z_pos; // [km]
|
---|
146 | double _z_velocity; // [km/s]
|
---|
147 | double _z_acceleration; // [km/s^2]
|
---|
148 | double _health; // 0 = O.K.
|
---|
149 | double _frequency_number; // ICD-GLONASS data position
|
---|
150 | double _tki; // message frame time
|
---|
151 | };
|
---|
152 |
|
---|
153 | #endif
|
---|