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