source: ntrip/trunk/BNC/RTCM3/ephemeris.h@ 4015

Last change on this file since 4015 was 4013, checked in by mervart, 13 years ago
File size: 6.4 KB
RevLine 
[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>
[1807]8extern "C" {
[2492]9#include "rtcm3torinex.h"
[1807]10}
[1025]11
12class t_eph {
13 public:
[4002]14
[4005]15 enum e_type {unknown, GPS, GLONASS, Galileo};
16
[4002]17 static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {
18 if (eph1->_GPSweek < eph2->_GPSweek) {
19 return true;
20 }
21 else if (eph1->_GPSweek == eph2->_GPSweek) {
22 return eph1->_GPSweeks < eph2->_GPSweeks;
23 }
24 else {
25 return false;
26 }
27 }
28
[3659]29 t_eph() {_ok = false;}
[1025]30 virtual ~t_eph() {};
31
[4005]32 virtual e_type type() const = 0;
33
[4013]34 virtual QString toString(double version) const = 0;
35
[3659]36 bool ok() const {return _ok;}
[3255]37 bool isNewerThan(const t_eph* eph) const;
38 QString prn() const {return _prn;}
[3174]39 void setReceptDateTime(const QDateTime& dateTime) {
40 _receptDateTime = dateTime;
41 }
42 const QDateTime& receptDateTime() const {return _receptDateTime;}
[1025]43
44 int GPSweek() const { return _GPSweek; }
45 double GPSweeks() const { return _GPSweeks; }
46
47 virtual void position(int GPSweek, double GPSweeks,
[2222]48 double* xc, double* vv) const = 0;
[1025]49
50 void position(int GPSweek, double GPSweeks,
[2221]51 double& xx, double& yy, double& zz, double& cc) const {
[1025]52 double tmp_xx[4];
53 double tmp_vv[4];
54
55 position(GPSweek, GPSweeks, tmp_xx, tmp_vv);
56
57 xx = tmp_xx[0];
58 yy = tmp_xx[1];
59 zz = tmp_xx[2];
60 cc = tmp_xx[3];
61 }
62
63 virtual int IOD() const = 0;
[3255]64
65 virtual int RTCM3(unsigned char *) = 0;
[1025]66
67 protected:
[3255]68 QString _prn;
69 int _GPSweek;
70 double _GPSweeks;
71 QDateTime _receptDateTime;
[3659]72 bool _ok;
[1025]73};
74
75
76class t_ephGPS : public t_eph {
77 public:
78 t_ephGPS() { }
[3659]79 t_ephGPS(float rnxVersion, const QStringList& lines);
[2221]80 virtual ~t_ephGPS() {}
[4005]81
82 virtual e_type type() const {return t_eph::GPS;}
83
[4013]84 virtual QString toString(double version) const;
85
[2040]86 double TOC() const {return _TOC;}
[1025]87
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
[1025]98 private:
99 double _TOW; // [s]
100 double _TOC; // [s]
101 double _TOE; // [s]
102 double _IODE;
103 double _IODC;
104
105 double _clock_bias; // [s]
106 double _clock_drift; // [s/s]
107 double _clock_driftrate; // [s/s^2]
108
109 double _Crs; // [m]
110 double _Delta_n; // [rad/s]
111 double _M0; // [rad]
112 double _Cuc; // [rad]
113 double _e; //
114 double _Cus; // [rad]
115 double _sqrt_A; // [m^0.5]
116 double _Cic; // [rad]
117 double _OMEGA0; // [rad]
118 double _Cis; // [rad]
119 double _i0; // [rad]
120 double _Crc; // [m]
121 double _omega; // [rad]
122 double _OMEGADOT; // [rad/s]
123 double _IDOT; // [rad/s]
124
125 double _TGD; // [s]
[3255]126 double _health; // SV health
127 double _ura; // SV accuracy
128 double _L2PFlag; // L2 P data flag
129 double _L2Codes; // Codes on L2 channel
[1025]130};
131
[2221]132class t_ephGlo : public t_eph {
133 public:
[2257]134 t_ephGlo() { _xv.ReSize(6); }
[3659]135 t_ephGlo(float rnxVersion, const QStringList& lines);
[2221]136
137 virtual ~t_ephGlo() {}
138
[4005]139 virtual e_type type() const {return t_eph::GLONASS;}
140
[4013]141 virtual QString toString(double version) const;
142
[2221]143 virtual void position(int GPSweek, double GPSweeks,
144 double* xc,
145 double* vv) const;
146
147 virtual int IOD() const;
148
[3255]149 virtual int RTCM3(unsigned char *);
150
[2221]151 void set(const glonassephemeris* ee);
152
[3761]153 int slotNum() const {return int(_frequency_number);}
154
[2221]155 private:
[2556]156 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
157 double* acc);
[2221]158
159 mutable double _tt; // time in seconds of GPSweek
160 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
161
[3255]162 double _gps_utc;
[2221]163 double _E; // [days]
164 double _tau; // [s]
165 double _gamma; //
166 double _x_pos; // [km]
167 double _x_velocity; // [km/s]
168 double _x_acceleration; // [km/s^2]
169 double _y_pos; // [km]
170 double _y_velocity; // [km/s]
171 double _y_acceleration; // [km/s^2]
172 double _z_pos; // [km]
173 double _z_velocity; // [km/s]
174 double _z_acceleration; // [km/s^2]
175 double _health; // 0 = O.K.
176 double _frequency_number; // ICD-GLONASS data position
177 double _tki; // message frame time
178};
179
[2770]180class t_ephGal : public t_eph {
181 public:
182 t_ephGal() { }
[3659]183 t_ephGal(float rnxVersion, const QStringList& lines);
[2770]184 virtual ~t_ephGal() {}
[4005]185
[4013]186 virtual QString toString(double version) const;
187
[4005]188 virtual e_type type() const {return t_eph::Galileo;}
189
[2770]190 double TOC() const {return _TOC;}
191
192 void set(const galileoephemeris* ee);
193
194 virtual void position(int GPSweek, double GPSweeks,
195 double* xc,
196 double* vv) const;
197
198 virtual int IOD() const { return static_cast<int>(_IODnav); }
199
[3255]200 virtual int RTCM3(unsigned char *);
201
[2770]202 private:
203 double _IODnav;
204 double _TOC; // [s]
205 double _TOE; // [s]
206 double _clock_bias; // [s]
207 double _clock_drift; // [s/s]
208 double _clock_driftrate; // [s/s^2]
209 double _Crs; // [m]
210 double _Delta_n; // [rad/s]
211 double _M0; // [rad]
212 double _Cuc; // [rad]
213 double _e; //
214 double _Cus; // [rad]
215 double _sqrt_A; // [m^0.5]
216 double _Cic; // [rad]
217 double _OMEGA0; // [rad]
218 double _Cis; // [rad]
219 double _i0; // [rad]
220 double _Crc; // [m]
221 double _omega; // [rad]
222 double _OMEGADOT; // [rad/s]
223 double _IDOT; // [rad/s]
224 double _BGD_1_5A; // group delay [s]
[3255]225 double _BGD_1_5B; // group delay [s]
[2770]226 int _SISA; // Signal In Space Accuracy
227 int _E5aHS; // E5a Health Status
228
229};
230
[1025]231#endif
Note: See TracBrowser for help on using the repository browser.