[6054] | 1 | // Part of BNC, a utility for retrieving decoding and
|
---|
| 2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
| 3 | //
|
---|
| 4 | // Copyright (C) 2007
|
---|
| 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
| 6 | // http://www.bkg.bund.de
|
---|
| 7 | // Czech Technical University Prague, Department of Geodesy
|
---|
| 8 | // http://www.fsv.cvut.cz
|
---|
| 9 | //
|
---|
| 10 | // Email: euref-ip@bkg.bund.de
|
---|
| 11 | //
|
---|
| 12 | // This program is free software; you can redistribute it and/or
|
---|
| 13 | // modify it under the terms of the GNU General Public License
|
---|
| 14 | // as published by the Free Software Foundation, version 2.
|
---|
| 15 | //
|
---|
| 16 | // This program is distributed in the hope that it will be useful,
|
---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | // GNU General Public License for more details.
|
---|
| 20 | //
|
---|
| 21 | // You should have received a copy of the GNU General Public License
|
---|
| 22 | // along with this program; if not, write to the Free Software
|
---|
| 23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
| 24 |
|
---|
| 25 | #ifndef BNCMODEL_H
|
---|
| 26 | #define BNCMODEL_H
|
---|
| 27 |
|
---|
| 28 | #include <QtCore>
|
---|
| 29 | #include <QtNetwork>
|
---|
| 30 | #include <newmat.h>
|
---|
| 31 |
|
---|
| 32 | #include "bncconst.h"
|
---|
| 33 | #include "bnctime.h"
|
---|
| 34 |
|
---|
| 35 | class bncAntex;
|
---|
[6055] | 36 |
|
---|
| 37 | namespace BNC_PPP {
|
---|
| 38 |
|
---|
[6086] | 39 | class t_pppClient;
|
---|
[6055] | 40 | class t_pppOptions;
|
---|
[6059] | 41 | class t_epoData;
|
---|
| 42 | class t_satData;
|
---|
[6060] | 43 | class t_tides;
|
---|
[6054] | 44 |
|
---|
| 45 | class bncParam {
|
---|
| 46 | public:
|
---|
| 47 | enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3,
|
---|
| 48 | GLONASS_OFFSET, GALILEO_OFFSET};
|
---|
| 49 | bncParam(parType typeIn, int indexIn, const QString& prn);
|
---|
| 50 | ~bncParam();
|
---|
| 51 | double partial(t_satData* satData, bool phase);
|
---|
| 52 | bool isCrd() const {
|
---|
| 53 | return (type == CRD_X || type == CRD_Y || type == CRD_Z);
|
---|
| 54 | }
|
---|
| 55 | parType type;
|
---|
| 56 | double xx;
|
---|
| 57 | int index;
|
---|
| 58 | int index_old;
|
---|
| 59 | int numEpo;
|
---|
| 60 | QString prn;
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | class bncModel {
|
---|
| 64 | public:
|
---|
[6086] | 65 | bncModel(t_pppClient* pppClient);
|
---|
[6054] | 66 | ~bncModel();
|
---|
| 67 | t_irc update(t_epoData* epoData);
|
---|
| 68 | bncTime time() const {return _time;}
|
---|
| 69 | double x() const {return _params[0]->xx;}
|
---|
| 70 | double y() const {return _params[1]->xx;}
|
---|
| 71 | double z() const {return _params[2]->xx;}
|
---|
| 72 | double clk() const {return _params[3]->xx;}
|
---|
| 73 | double trp() const {
|
---|
| 74 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 75 | bncParam* pp = _params[ii];
|
---|
| 76 | if (pp->type == bncParam::TROPO) {
|
---|
| 77 | return pp->xx;
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 | return 0.0;
|
---|
| 81 | }
|
---|
| 82 | double Glonass_offset() const {
|
---|
| 83 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 84 | bncParam* pp = _params[ii];
|
---|
| 85 | if (pp->type == bncParam::GLONASS_OFFSET) {
|
---|
| 86 | return pp->xx;
|
---|
| 87 | }
|
---|
| 88 | }
|
---|
| 89 | return 0.0;
|
---|
| 90 | }
|
---|
| 91 | double Galileo_offset() const {
|
---|
| 92 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 93 | bncParam* pp = _params[ii];
|
---|
| 94 | if (pp->type == bncParam::GALILEO_OFFSET) {
|
---|
| 95 | return pp->xx;
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 | return 0.0;
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | static void kalman(const Matrix& AA, const ColumnVector& ll,
|
---|
| 102 | const DiagonalMatrix& PP,
|
---|
| 103 | SymmetricMatrix& QQ, ColumnVector& dx);
|
---|
| 104 |
|
---|
| 105 | private:
|
---|
| 106 | void reset();
|
---|
| 107 | t_irc cmpBancroft(t_epoData* epoData);
|
---|
| 108 | void cmpEle(t_satData* satData);
|
---|
| 109 | void addAmb(t_satData* satData);
|
---|
| 110 | void addObs(int iPhase, unsigned& iObs, t_satData* satData,
|
---|
| 111 | Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
|
---|
| 112 | QByteArray printRes(int iPhase, const ColumnVector& vv,
|
---|
| 113 | const QMap<QString, t_satData*>& satDataMap);
|
---|
| 114 | void findMaxRes(const ColumnVector& vv,
|
---|
| 115 | const QMap<QString, t_satData*>& satData,
|
---|
| 116 | QString& prnGPS, QString& prnGlo,
|
---|
| 117 | double& maxResGPS, double& maxResGlo);
|
---|
| 118 | double cmpValue(t_satData* satData, bool phase);
|
---|
| 119 | double delay_saast(double Ele);
|
---|
| 120 | void predict(int iPhase, t_epoData* epoData);
|
---|
| 121 | t_irc update_p(t_epoData* epoData);
|
---|
| 122 | QString outlierDetection(int iPhase, const ColumnVector& vv,
|
---|
| 123 | QMap<QString, t_satData*>& satData);
|
---|
| 124 |
|
---|
| 125 | double windUp(const QString& prn, const ColumnVector& rSat,
|
---|
| 126 | const ColumnVector& rRec);
|
---|
| 127 |
|
---|
| 128 | bncTime _startTime;
|
---|
| 129 |
|
---|
| 130 | void rememberState(t_epoData* epoData);
|
---|
| 131 | void restoreState(t_epoData* epoData);
|
---|
| 132 |
|
---|
| 133 | t_irc selectSatellites(const QString& lastOutlierPrn,
|
---|
| 134 | QMap<QString, t_satData*>& satData);
|
---|
| 135 |
|
---|
[6089] | 136 | void bancroft(const Matrix& BBpass, ColumnVector& pos);
|
---|
| 137 |
|
---|
[6054] | 138 | class pppPos {
|
---|
| 139 | public:
|
---|
| 140 | pppPos() {
|
---|
| 141 | for (int ii = 0; ii < 7; ++ii) {
|
---|
| 142 | xnt[ii] = 0.0;
|
---|
| 143 | }
|
---|
| 144 | }
|
---|
| 145 | bncTime time;
|
---|
| 146 | double xnt[7];
|
---|
| 147 | };
|
---|
| 148 |
|
---|
[6086] | 149 | t_pppClient* _pppClient;
|
---|
[6055] | 150 | const t_pppOptions* _opt;
|
---|
[6054] | 151 | bncTime _time;
|
---|
| 152 | bncTime _lastTimeOK;
|
---|
| 153 | QByteArray _staID;
|
---|
| 154 | QVector<bncParam*> _params;
|
---|
| 155 | SymmetricMatrix _QQ;
|
---|
| 156 | QVector<bncParam*> _params_sav;
|
---|
| 157 | SymmetricMatrix _QQ_sav;
|
---|
| 158 | t_epoData* _epoData_sav;
|
---|
| 159 | ColumnVector _xcBanc;
|
---|
| 160 | ColumnVector _ellBanc;
|
---|
| 161 | QByteArray _log;
|
---|
| 162 | QMap<QString, double> _windUpTime;
|
---|
| 163 | QMap<QString, double> _windUpSum;
|
---|
| 164 | QVector<pppPos*> _posAverage;
|
---|
| 165 | QStringList _outlierGPS;
|
---|
| 166 | QStringList _outlierGlo;
|
---|
| 167 | bncAntex* _antex;
|
---|
[6060] | 168 | t_tides* _tides;
|
---|
[6054] | 169 | };
|
---|
| 170 |
|
---|
[6055] | 171 | }
|
---|
| 172 |
|
---|
[6054] | 173 | #endif
|
---|