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