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 PPPFILTER_H
|
---|
26 | #define PPPFILTER_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 t_pppClient;
|
---|
40 | class t_pppOptions;
|
---|
41 | class t_epoData;
|
---|
42 | class t_satData;
|
---|
43 | class t_tides;
|
---|
44 |
|
---|
45 | class t_satData {
|
---|
46 | public:
|
---|
47 | t_satData() {
|
---|
48 | obsIndex = 0;
|
---|
49 | P1 = 0.0;
|
---|
50 | P2 = 0.0;
|
---|
51 | P5 = 0.0;
|
---|
52 | P6 = 0.0;
|
---|
53 | P7 = 0.0;
|
---|
54 | P3 = 0.0;
|
---|
55 | P3sig = 0.0;
|
---|
56 | L1 = 0.0;
|
---|
57 | L2 = 0.0;
|
---|
58 | L5 = 0.0;
|
---|
59 | L6 = 0.0;
|
---|
60 | L7 = 0.0;
|
---|
61 | L3 = 0.0;
|
---|
62 | L3sig = 0.0;
|
---|
63 | lkA = 0.0;
|
---|
64 | lkB = 0.0;
|
---|
65 | clk = 0.0;
|
---|
66 | eleSat = 0.0;
|
---|
67 | azSat = 0.0;
|
---|
68 | rho = 0.0;
|
---|
69 | slipFlag = false;
|
---|
70 | lambda3 = 0.0;
|
---|
71 | }
|
---|
72 | ~t_satData() {}
|
---|
73 | bncTime tt;
|
---|
74 | QString prn;
|
---|
75 | double P1;
|
---|
76 | double P2;
|
---|
77 | double P5;
|
---|
78 | double P6;
|
---|
79 | double P7;
|
---|
80 | double P3;
|
---|
81 | double P3sig;
|
---|
82 | double L1;
|
---|
83 | double L2;
|
---|
84 | double L5;
|
---|
85 | double L6;
|
---|
86 | double L7;
|
---|
87 | double L3;
|
---|
88 | double L3sig;
|
---|
89 | ColumnVector xx;
|
---|
90 | ColumnVector vv;
|
---|
91 | double clk;
|
---|
92 | double eleSat;
|
---|
93 | double azSat;
|
---|
94 | double rho;
|
---|
95 | bool slipFlag;
|
---|
96 | double lambda3;
|
---|
97 | double lkA;
|
---|
98 | double lkB;
|
---|
99 | unsigned obsIndex;
|
---|
100 | char system() const {return prn.toAscii()[0];}
|
---|
101 | };
|
---|
102 |
|
---|
103 | class t_epoData {
|
---|
104 | public:
|
---|
105 | t_epoData() {}
|
---|
106 |
|
---|
107 | ~t_epoData() {
|
---|
108 | clear();
|
---|
109 | }
|
---|
110 |
|
---|
111 | void clear() {
|
---|
112 | QMapIterator<QString, t_satData*> it(satData);
|
---|
113 | while (it.hasNext()) {
|
---|
114 | it.next();
|
---|
115 | delete it.value();
|
---|
116 | }
|
---|
117 | satData.clear();
|
---|
118 | tt.reset();
|
---|
119 | }
|
---|
120 |
|
---|
121 | void deepCopy(const t_epoData* from) {
|
---|
122 | clear();
|
---|
123 | tt = from->tt;
|
---|
124 | QMapIterator<QString, t_satData*> it(from->satData);
|
---|
125 | while (it.hasNext()) {
|
---|
126 | it.next();
|
---|
127 | satData[it.key()] = new t_satData(*it.value());
|
---|
128 | }
|
---|
129 | }
|
---|
130 |
|
---|
131 | unsigned sizeSys(char system) const {
|
---|
132 | unsigned ans = 0;
|
---|
133 | QMapIterator<QString, t_satData*> it(satData);
|
---|
134 | while (it.hasNext()) {
|
---|
135 | it.next();
|
---|
136 | if (it.value()->system() == system) {
|
---|
137 | ++ans;
|
---|
138 | }
|
---|
139 | }
|
---|
140 | return ans;
|
---|
141 | }
|
---|
142 | unsigned sizeAll() const {return satData.size();}
|
---|
143 |
|
---|
144 | bncTime tt;
|
---|
145 | QMap<QString, t_satData*> satData;
|
---|
146 | };
|
---|
147 |
|
---|
148 | class t_pppParam {
|
---|
149 | public:
|
---|
150 | enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3,
|
---|
151 | GLONASS_OFFSET, GALILEO_OFFSET, BDS_OFFSET};
|
---|
152 | t_pppParam(parType typeIn, int indexIn, const QString& prn);
|
---|
153 | ~t_pppParam();
|
---|
154 | double partial(t_satData* satData, bool phase);
|
---|
155 | bool isCrd() const {
|
---|
156 | return (type == CRD_X || type == CRD_Y || type == CRD_Z);
|
---|
157 | }
|
---|
158 | parType type;
|
---|
159 | double xx;
|
---|
160 | int index;
|
---|
161 | int index_old;
|
---|
162 | int numEpo;
|
---|
163 | QString prn;
|
---|
164 | };
|
---|
165 |
|
---|
166 | class t_pppFilter {
|
---|
167 | public:
|
---|
168 | t_pppFilter(t_pppClient* pppClient);
|
---|
169 | ~t_pppFilter();
|
---|
170 | t_irc update(t_epoData* epoData);
|
---|
171 | bncTime time() const {return _time;}
|
---|
172 | const SymmetricMatrix& Q() const {return _QQ;}
|
---|
173 | const ColumnVector& neu() const {return _neu;}
|
---|
174 | int numSat() const {return _numSat;}
|
---|
175 | double HDOP() const {return _hDop;}
|
---|
176 | double x() const {return _params[0]->xx;}
|
---|
177 | double y() const {return _params[1]->xx;}
|
---|
178 | double z() const {return _params[2]->xx;}
|
---|
179 | double clk() const {return _params[3]->xx;}
|
---|
180 | double trp0() {return delay_saast(M_PI/2.0);}
|
---|
181 | double trp() const {
|
---|
182 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
183 | t_pppParam* pp = _params[ii];
|
---|
184 | if (pp->type == t_pppParam::TROPO) {
|
---|
185 | return pp->xx;
|
---|
186 | }
|
---|
187 | }
|
---|
188 | return 0.0;
|
---|
189 | }
|
---|
190 | double trpStdev() const {
|
---|
191 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
192 | t_pppParam* pp = _params[ii];
|
---|
193 | if (pp->type == t_pppParam::TROPO) {
|
---|
194 | return sqrt(Q()[ii][ii]);
|
---|
195 | }
|
---|
196 | }
|
---|
197 | return 0.0;
|
---|
198 | }
|
---|
199 | double Glonass_offset() const {
|
---|
200 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
201 | t_pppParam* pp = _params[ii];
|
---|
202 | if (pp->type == t_pppParam::GLONASS_OFFSET) {
|
---|
203 | return pp->xx;
|
---|
204 | }
|
---|
205 | }
|
---|
206 | return 0.0;
|
---|
207 | }
|
---|
208 | double Galileo_offset() const {
|
---|
209 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
210 | t_pppParam* pp = _params[ii];
|
---|
211 | if (pp->type == t_pppParam::GALILEO_OFFSET) {
|
---|
212 | return pp->xx;
|
---|
213 | }
|
---|
214 | }
|
---|
215 | return 0.0;
|
---|
216 | }
|
---|
217 | double Bds_offset() const {
|
---|
218 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
219 | t_pppParam* pp = _params[ii];
|
---|
220 | if (pp->type == t_pppParam::BDS_OFFSET) {
|
---|
221 | return pp->xx;
|
---|
222 | }
|
---|
223 | }
|
---|
224 | return 0.0;
|
---|
225 | }
|
---|
226 | private:
|
---|
227 | void reset();
|
---|
228 | t_irc cmpBancroft(t_epoData* epoData);
|
---|
229 | void cmpEle(t_satData* satData);
|
---|
230 | void addAmb(t_satData* satData);
|
---|
231 | void addObs(int iPhase, unsigned& iObs, t_satData* satData,
|
---|
232 | Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
|
---|
233 | QByteArray printRes(int iPhase, const ColumnVector& vv,
|
---|
234 | const QMap<QString, t_satData*>& satDataMap);
|
---|
235 | void findMaxRes(const ColumnVector& vv,
|
---|
236 | const QMap<QString, t_satData*>& satData,
|
---|
237 | QString& prnGPS, QString& prnGlo,
|
---|
238 | double& maxResGPS, double& maxResGlo);
|
---|
239 | double cmpValue(t_satData* satData, bool phase);
|
---|
240 | double delay_saast(double Ele);
|
---|
241 | void predict(int iPhase, t_epoData* epoData);
|
---|
242 | t_irc update_p(t_epoData* epoData);
|
---|
243 | QString outlierDetection(int iPhase, const ColumnVector& vv,
|
---|
244 | QMap<QString, t_satData*>& satData);
|
---|
245 |
|
---|
246 | double windUp(const QString& prn, const ColumnVector& rSat,
|
---|
247 | const ColumnVector& rRec);
|
---|
248 |
|
---|
249 | bncTime _startTime;
|
---|
250 |
|
---|
251 | void rememberState(t_epoData* epoData);
|
---|
252 | void restoreState(t_epoData* epoData);
|
---|
253 |
|
---|
254 | t_irc selectSatellites(const QString& lastOutlierPrn,
|
---|
255 | QMap<QString, t_satData*>& satData);
|
---|
256 |
|
---|
257 | void bancroft(const Matrix& BBpass, ColumnVector& pos);
|
---|
258 |
|
---|
259 | void cmpDOP(t_epoData* epoData);
|
---|
260 |
|
---|
261 | t_pppClient* _pppClient;
|
---|
262 | bncTime _time;
|
---|
263 | bncTime _lastTimeOK;
|
---|
264 | QVector<t_pppParam*> _params;
|
---|
265 | SymmetricMatrix _QQ;
|
---|
266 | QVector<t_pppParam*> _params_sav;
|
---|
267 | SymmetricMatrix _QQ_sav;
|
---|
268 | t_epoData* _epoData_sav;
|
---|
269 | ColumnVector _xcBanc;
|
---|
270 | ColumnVector _ellBanc;
|
---|
271 | QMap<QString, double> _windUpTime;
|
---|
272 | QMap<QString, double> _windUpSum;
|
---|
273 | QStringList _outlierGPS;
|
---|
274 | QStringList _outlierGlo;
|
---|
275 | bncAntex* _antex;
|
---|
276 | t_tides* _tides;
|
---|
277 | ColumnVector _neu;
|
---|
278 | int _numSat;
|
---|
279 | double _hDop;
|
---|
280 | };
|
---|
281 |
|
---|
282 | }
|
---|
283 |
|
---|
284 | #endif
|
---|