[758] | 1 | #ifndef BNSEPH_H
|
---|
| 2 | #define BNSEPH_H
|
---|
| 3 |
|
---|
[918] | 4 | #include <math.h>
|
---|
[884] | 5 | #include <newmat.h>
|
---|
| 6 |
|
---|
| 7 | #include <QtCore>
|
---|
[758] | 8 | #include <QThread>
|
---|
[759] | 9 | #include <QtNetwork>
|
---|
[758] | 10 |
|
---|
[2618] | 11 | #include "bnsutils.h"
|
---|
[884] | 12 |
|
---|
| 13 | class t_eph {
|
---|
[778] | 14 | public:
|
---|
[884] | 15 | virtual ~t_eph() {};
|
---|
[886] | 16 |
|
---|
| 17 | bool isNewerThan(const t_eph* eph) const;
|
---|
| 18 | QString prn() const {return _prn;}
|
---|
[2768] | 19 | void setRecepDateTime(const QDateTime& dateTime) {
|
---|
| 20 | _receptDateTime = dateTime;
|
---|
| 21 | }
|
---|
| 22 | const QDateTime& receptDateTime() const {return _receptDateTime;}
|
---|
[886] | 23 |
|
---|
[884] | 24 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
| 25 | ColumnVector& vv) const = 0;
|
---|
[3045] | 26 | virtual BNS::t_irc read(const QStringList& lines) = 0;
|
---|
[884] | 27 | virtual int IOD() const = 0;
|
---|
[1867] | 28 | virtual int RTCM3(unsigned char *) = 0;
|
---|
[2618] | 29 |
|
---|
[884] | 30 | protected:
|
---|
[2768] | 31 | QString _prn;
|
---|
| 32 | int _GPSweek;
|
---|
| 33 | double _GPSweeks;
|
---|
| 34 | QDateTime _receptDateTime;
|
---|
[884] | 35 | };
|
---|
[778] | 36 |
|
---|
[884] | 37 | class t_ephGlo : public t_eph {
|
---|
| 38 | public:
|
---|
| 39 | t_ephGlo() {
|
---|
[911] | 40 | _gps_utc = 0.0;
|
---|
[884] | 41 | _xv.ReSize(6);
|
---|
| 42 | };
|
---|
| 43 | virtual ~t_ephGlo() {};
|
---|
[3045] | 44 | virtual BNS::t_irc read(const QStringList& lines);
|
---|
[884] | 45 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
| 46 | ColumnVector& vv) const;
|
---|
[926] | 47 | virtual int IOD() const;
|
---|
[1867] | 48 | virtual int RTCM3(unsigned char *);
|
---|
[884] | 49 | private:
|
---|
[2558] | 50 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv,
|
---|
| 51 | double* acc);
|
---|
[891] | 52 | mutable double _tt; // time in seconds of GPSweek
|
---|
| 53 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
[911] | 54 | double _gps_utc; // GPS - UTC in seconds
|
---|
[778] | 55 |
|
---|
[889] | 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
|
---|
[1866] | 70 | double _tki; // message frame time
|
---|
[884] | 71 | };
|
---|
[778] | 72 |
|
---|
[884] | 73 |
|
---|
| 74 | class t_ephGPS : public t_eph {
|
---|
| 75 | public:
|
---|
| 76 | t_ephGPS() {};
|
---|
| 77 | virtual ~t_ephGPS() {};
|
---|
[3045] | 78 | virtual BNS::t_irc read(const QStringList& lines);
|
---|
[884] | 79 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
| 80 | ColumnVector& vv) const;
|
---|
| 81 | virtual int IOD() const {return int(_IODE);}
|
---|
[1867] | 82 | virtual int RTCM3(unsigned char *);
|
---|
[884] | 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]
|
---|
[1866] | 111 | double _health; // SV health
|
---|
| 112 | double _ura; // SV accuracy
|
---|
| 113 | double _L2PFlag; // L2 P data flag
|
---|
| 114 | double _L2Codes; // Codes on L2 channel
|
---|
[771] | 115 | };
|
---|
| 116 |
|
---|
[3145] | 117 | class 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]
|
---|
[3146] | 150 | double _BGD_1_5B; // group delay [s]
|
---|
[3145] | 151 | int _SISA; // Signal In Space Accuracy
|
---|
| 152 | int _E5aHS; // E5a Health Status
|
---|
| 153 |
|
---|
| 154 | };
|
---|
| 155 |
|
---|
[758] | 156 | class 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:
|
---|
[1058] | 164 | void newEph(t_eph* eph, int nBytes);
|
---|
[758] | 165 | void newMessage(const QByteArray msg);
|
---|
[760] | 166 | void error(const QByteArray msg);
|
---|
[758] | 167 |
|
---|
| 168 | private:
|
---|
[838] | 169 | void reconnect();
|
---|
[771] | 170 | void readEph();
|
---|
[759] | 171 | QTcpSocket* _socket;
|
---|
[1089] | 172 | QFile* _echoFile;
|
---|
| 173 | QTextStream* _echoStream;
|
---|
[758] | 174 | };
|
---|
| 175 | #endif
|
---|