source: ntrip/trunk/BNS/bnseph.h@ 5443

Last change on this file since 5443 was 3146, checked in by mervart, 11 years ago
File size: 5.4 KB
Line 
1#ifndef BNSEPH_H
2#define BNSEPH_H
3
4#include <math.h>
5#include <newmat.h>
6
7#include <QtCore>
8#include <QThread>
9#include <QtNetwork>
10
11#include "bnsutils.h"
12
13class t_eph {
14 public:
15 virtual ~t_eph() {};
16
17 bool isNewerThan(const t_eph* eph) const;
18 QString prn() const {return _prn;}
19 void setRecepDateTime(const QDateTime& dateTime) {
20 _receptDateTime = dateTime;
21 }
22 const QDateTime& receptDateTime() const {return _receptDateTime;}
23
24 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
25 ColumnVector& vv) const = 0;
26 virtual BNS::t_irc read(const QStringList& lines) = 0;
27 virtual int IOD() const = 0;
28 virtual int RTCM3(unsigned char *) = 0;
29
30 protected:
31 QString _prn;
32 int _GPSweek;
33 double _GPSweeks;
34 QDateTime _receptDateTime;
35};
36
37class t_ephGlo : public t_eph {
38 public:
39 t_ephGlo() {
40 _gps_utc = 0.0;
41 _xv.ReSize(6);
42 };
43 virtual ~t_ephGlo() {};
44 virtual BNS::t_irc read(const QStringList& lines);
45 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
46 ColumnVector& vv) const;
47 virtual int IOD() const;
48 virtual int RTCM3(unsigned char *);
49 private:
50 static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
51 double* acc);
52 mutable double _tt; // time in seconds of GPSweek
53 mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
54 double _gps_utc; // GPS - UTC in seconds
55
56 double _E; // [days]
57 double _tau; // [s]
58 double _gamma; //
59 double _x_pos; // [km]
60 double _x_velocity; // [km/s]
61 double _x_acceleration; // [km/s^2]
62 double _y_pos; // [km]
63 double _y_velocity; // [km/s]
64 double _y_acceleration; // [km/s^2]
65 double _z_pos; // [km]
66 double _z_velocity; // [km/s]
67 double _z_acceleration; // [km/s^2]
68 double _health; // 0 = O.K.
69 double _frequency_number; // ICD-GLONASS data position
70 double _tki; // message frame time
71};
72
73
74class t_ephGPS : public t_eph {
75 public:
76 t_ephGPS() {};
77 virtual ~t_ephGPS() {};
78 virtual BNS::t_irc read(const QStringList& lines);
79 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
80 ColumnVector& vv) const;
81 virtual int IOD() const {return int(_IODE);}
82 virtual int RTCM3(unsigned char *);
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 double _health; // SV health
112 double _ura; // SV accuracy
113 double _L2PFlag; // L2 P data flag
114 double _L2Codes; // Codes on L2 channel
115};
116
117class t_ephGal : public t_eph {
118 public:
119 t_ephGal() { }
120 virtual ~t_ephGal() {}
121 virtual BNS::t_irc read(const QStringList& lines);
122 virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
123 ColumnVector& vv) const;
124 virtual int IOD() const { return static_cast<int>(_IODnav); }
125 virtual int RTCM3(unsigned char *);
126
127 private:
128 double _IODnav;
129 double _TOC; // [s]
130 double _TOE; // [s]
131 double _clock_bias; // [s]
132 double _clock_drift; // [s/s]
133 double _clock_driftrate; // [s/s^2]
134 double _Crs; // [m]
135 double _Delta_n; // [rad/s]
136 double _M0; // [rad]
137 double _Cuc; // [rad]
138 double _e; //
139 double _Cus; // [rad]
140 double _sqrt_A; // [m^0.5]
141 double _Cic; // [rad]
142 double _OMEGA0; // [rad]
143 double _Cis; // [rad]
144 double _i0; // [rad]
145 double _Crc; // [m]
146 double _omega; // [rad]
147 double _OMEGADOT; // [rad/s]
148 double _IDOT; // [rad/s]
149 double _BGD_1_5A; // group delay [s]
150 double _BGD_1_5B; // group delay [s]
151 int _SISA; // Signal In Space Accuracy
152 int _E5aHS; // E5a Health Status
153
154};
155
156class t_bnseph : public QThread {
157 Q_OBJECT
158 public:
159 t_bnseph(QObject* parent = 0);
160 virtual ~t_bnseph();
161 virtual void run();
162
163 signals:
164 void newEph(t_eph* eph, int nBytes);
165 void newMessage(const QByteArray msg);
166 void error(const QByteArray msg);
167
168 private:
169 void reconnect();
170 void readEph();
171 QTcpSocket* _socket;
172 QFile* _echoFile;
173 QTextStream* _echoStream;
174};
175#endif
Note: See TracBrowser for help on using the repository browser.