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;
|
---|
36 |
|
---|
37 | namespace BNC_PPP {
|
---|
38 |
|
---|
39 | class bncPPPclient;
|
---|
40 | class t_pppOptions;
|
---|
41 | class t_epoData;
|
---|
42 | class t_satData;
|
---|
43 | class t_tides;
|
---|
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:
|
---|
65 | bncModel(bncPPPclient* pppClient);
|
---|
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 |
|
---|
136 | class pppPos {
|
---|
137 | public:
|
---|
138 | pppPos() {
|
---|
139 | for (int ii = 0; ii < 7; ++ii) {
|
---|
140 | xnt[ii] = 0.0;
|
---|
141 | }
|
---|
142 | }
|
---|
143 | bncTime time;
|
---|
144 | double xnt[7];
|
---|
145 | };
|
---|
146 |
|
---|
147 | bncPPPclient* _pppClient;
|
---|
148 | const t_pppOptions* _opt;
|
---|
149 | bncTime _time;
|
---|
150 | bncTime _lastTimeOK;
|
---|
151 | QByteArray _staID;
|
---|
152 | QVector<bncParam*> _params;
|
---|
153 | SymmetricMatrix _QQ;
|
---|
154 | QVector<bncParam*> _params_sav;
|
---|
155 | SymmetricMatrix _QQ_sav;
|
---|
156 | t_epoData* _epoData_sav;
|
---|
157 | ColumnVector _xcBanc;
|
---|
158 | ColumnVector _ellBanc;
|
---|
159 | QByteArray _log;
|
---|
160 | QMap<QString, double> _windUpTime;
|
---|
161 | QMap<QString, double> _windUpSum;
|
---|
162 | QVector<pppPos*> _posAverage;
|
---|
163 | QStringList _outlierGPS;
|
---|
164 | QStringList _outlierGlo;
|
---|
165 | bncAntex* _antex;
|
---|
166 | t_tides* _tides;
|
---|
167 | };
|
---|
168 |
|
---|
169 | }
|
---|
170 |
|
---|
171 | #endif
|
---|