[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 |
|
---|
[884] | 11 |
|
---|
| 12 | class t_eph {
|
---|
[778] | 13 | public:
|
---|
[884] | 14 | virtual ~t_eph() {};
|
---|
[886] | 15 |
|
---|
| 16 | bool isNewerThan(const t_eph* eph) const;
|
---|
| 17 | QString prn() const {return _prn;}
|
---|
| 18 |
|
---|
[884] | 19 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
| 20 | ColumnVector& vv) const = 0;
|
---|
| 21 | virtual void read(const QStringList& lines) = 0;
|
---|
| 22 | virtual int IOD() const = 0;
|
---|
| 23 | protected:
|
---|
| 24 | QString _prn;
|
---|
[886] | 25 | int _GPSweek;
|
---|
| 26 | double _GPSweeks;
|
---|
[884] | 27 | };
|
---|
[778] | 28 |
|
---|
[884] | 29 | class t_ephGlo : public t_eph {
|
---|
| 30 | public:
|
---|
| 31 | t_ephGlo() {
|
---|
[911] | 32 | _gps_utc = 0.0;
|
---|
[884] | 33 | _xv.ReSize(6);
|
---|
| 34 | };
|
---|
| 35 | virtual ~t_ephGlo() {};
|
---|
| 36 | virtual void read(const QStringList& lines);
|
---|
| 37 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
| 38 | ColumnVector& vv) const;
|
---|
[926] | 39 | virtual int IOD() const;
|
---|
[884] | 40 | private:
|
---|
| 41 | static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv);
|
---|
[891] | 42 | mutable double _tt; // time in seconds of GPSweek
|
---|
| 43 | mutable ColumnVector _xv; // status vector (position, velocity) at time _tt
|
---|
[911] | 44 | double _gps_utc; // GPS - UTC in seconds
|
---|
[778] | 45 |
|
---|
[889] | 46 | double _E; // [days]
|
---|
| 47 | double _tau; // [s]
|
---|
| 48 | double _gamma; //
|
---|
| 49 | double _x_pos; // [km]
|
---|
| 50 | double _x_velocity; // [km/s]
|
---|
| 51 | double _x_acceleration; // [km/s^2]
|
---|
| 52 | double _y_pos; // [km]
|
---|
| 53 | double _y_velocity; // [km/s]
|
---|
| 54 | double _y_acceleration; // [km/s^2]
|
---|
| 55 | double _z_pos; // [km]
|
---|
| 56 | double _z_velocity; // [km/s]
|
---|
| 57 | double _z_acceleration; // [km/s^2]
|
---|
| 58 | double _health; // 0 = O.K.
|
---|
| 59 | double _frequency_number; // ICD-GLONASS data position
|
---|
[884] | 60 | };
|
---|
[778] | 61 |
|
---|
[884] | 62 |
|
---|
| 63 | class t_ephGPS : public t_eph {
|
---|
| 64 | public:
|
---|
| 65 | t_ephGPS() {};
|
---|
| 66 | virtual ~t_ephGPS() {};
|
---|
| 67 | virtual void read(const QStringList& lines);
|
---|
| 68 | virtual void position(int GPSweek, double GPSweeks, ColumnVector& xc,
|
---|
| 69 | ColumnVector& vv) const;
|
---|
| 70 | virtual int IOD() const {return int(_IODE);}
|
---|
| 71 |
|
---|
| 72 | private:
|
---|
| 73 | double _TOW; // [s]
|
---|
| 74 | double _TOC; // [s]
|
---|
| 75 | double _TOE; // [s]
|
---|
| 76 | double _IODE;
|
---|
| 77 | double _IODC;
|
---|
| 78 |
|
---|
| 79 | double _clock_bias; // [s]
|
---|
| 80 | double _clock_drift; // [s/s]
|
---|
| 81 | double _clock_driftrate; // [s/s^2]
|
---|
| 82 |
|
---|
| 83 | double _Crs; // [m]
|
---|
| 84 | double _Delta_n; // [rad/s]
|
---|
| 85 | double _M0; // [rad]
|
---|
| 86 | double _Cuc; // [rad]
|
---|
| 87 | double _e; //
|
---|
| 88 | double _Cus; // [rad]
|
---|
| 89 | double _sqrt_A; // [m^0.5]
|
---|
| 90 | double _Cic; // [rad]
|
---|
| 91 | double _OMEGA0; // [rad]
|
---|
| 92 | double _Cis; // [rad]
|
---|
| 93 | double _i0; // [rad]
|
---|
| 94 | double _Crc; // [m]
|
---|
| 95 | double _omega; // [rad]
|
---|
| 96 | double _OMEGADOT; // [rad/s]
|
---|
| 97 | double _IDOT; // [rad/s]
|
---|
| 98 |
|
---|
| 99 | double _TGD; // [s]
|
---|
[771] | 100 | };
|
---|
| 101 |
|
---|
[758] | 102 | class t_bnseph : public QThread {
|
---|
| 103 | Q_OBJECT
|
---|
| 104 | public:
|
---|
| 105 | t_bnseph(QObject* parent = 0);
|
---|
| 106 | virtual ~t_bnseph();
|
---|
| 107 | virtual void run();
|
---|
| 108 |
|
---|
| 109 | signals:
|
---|
[884] | 110 | void newEph(t_eph* eph);
|
---|
[758] | 111 | void newMessage(const QByteArray msg);
|
---|
[760] | 112 | void error(const QByteArray msg);
|
---|
[758] | 113 |
|
---|
| 114 | private:
|
---|
[838] | 115 | void reconnect();
|
---|
[771] | 116 | void readEph();
|
---|
[759] | 117 | QTcpSocket* _socket;
|
---|
[758] | 118 | };
|
---|
| 119 | #endif
|
---|