1 | /* -------------------------------------------------------------------------
|
---|
2 | * BKG NTRIP Client
|
---|
3 | * -------------------------------------------------------------------------
|
---|
4 | *
|
---|
5 | * Class: t_pppParlist
|
---|
6 | *
|
---|
7 | * Purpose: List of estimated parameters
|
---|
8 | *
|
---|
9 | * Author: L. Mervart
|
---|
10 | *
|
---|
11 | * Created: 29-Jul-2014
|
---|
12 | *
|
---|
13 | * Changes:
|
---|
14 | *
|
---|
15 | * -----------------------------------------------------------------------*/
|
---|
16 |
|
---|
17 | #include <cmath>
|
---|
18 | #include <iostream>
|
---|
19 | #include <sstream>
|
---|
20 | #include <iomanip>
|
---|
21 | #include <algorithm>
|
---|
22 | #include <newmatio.h>
|
---|
23 |
|
---|
24 | #include "pppParlist.h"
|
---|
25 | #include "pppSatObs.h"
|
---|
26 | #include "pppStation.h"
|
---|
27 | #include "bncutils.h"
|
---|
28 | #include "bncconst.h"
|
---|
29 | #include "pppClient.h"
|
---|
30 |
|
---|
31 | using namespace BNC_PPP;
|
---|
32 | using namespace std;
|
---|
33 |
|
---|
34 | // Constructor
|
---|
35 | ////////////////////////////////////////////////////////////////////////////
|
---|
36 | t_pppParam::t_pppParam(e_type type, const t_prn& prn, t_lc::type tLC,
|
---|
37 | const vector<t_pppSatObs*>* obsVector) {
|
---|
38 |
|
---|
39 | _type = type;
|
---|
40 | _prn = prn;
|
---|
41 | _tLC = tLC;
|
---|
42 | _x0 = 0.0;
|
---|
43 | _indexOld = -1;
|
---|
44 | _indexNew = -1;
|
---|
45 | _noise = 0.0;
|
---|
46 | _ambInfo = 0;
|
---|
47 |
|
---|
48 | switch (_type) {
|
---|
49 | case crdX:
|
---|
50 | _epoSpec = false;
|
---|
51 | _sigma0 = OPT->_aprSigCrd[0];
|
---|
52 | _noise = OPT->_noiseCrd[0];
|
---|
53 | break;
|
---|
54 | case crdY:
|
---|
55 | _epoSpec = false;
|
---|
56 | _sigma0 = OPT->_aprSigCrd[1];
|
---|
57 | _noise = OPT->_noiseCrd[1];
|
---|
58 | break;
|
---|
59 | case crdZ:
|
---|
60 | _epoSpec = false;
|
---|
61 | _sigma0 = OPT->_aprSigCrd[2];
|
---|
62 | _noise = OPT->_noiseCrd[2];
|
---|
63 | break;
|
---|
64 | case clkR:
|
---|
65 | _epoSpec = true;
|
---|
66 | _sigma0 = OPT->_aprSigClk;
|
---|
67 | break;
|
---|
68 | case amb:
|
---|
69 | _epoSpec = false;
|
---|
70 | _sigma0 = OPT->_aprSigAmb;
|
---|
71 | _ambInfo = new t_ambInfo();
|
---|
72 | if (obsVector) {
|
---|
73 | for (unsigned ii = 0; ii < obsVector->size(); ii++) {
|
---|
74 | const t_pppSatObs* obs = obsVector->at(ii);
|
---|
75 | if (obs->prn() == _prn) {
|
---|
76 | double offGR = 0;
|
---|
77 | if (_prn.system() == 'R' && tLC != t_lc::MW) {
|
---|
78 | offGR = PPP_CLIENT->offGR();
|
---|
79 | }
|
---|
80 | double offGE = 0;
|
---|
81 | if (_prn.system() == 'E' && tLC != t_lc::MW) {
|
---|
82 | offGE = PPP_CLIENT->offGE();
|
---|
83 | }
|
---|
84 | double offGC = 0;
|
---|
85 | if (_prn.system() == 'C' && tLC != t_lc::MW) {
|
---|
86 | offGC = PPP_CLIENT->offGC();
|
---|
87 | }
|
---|
88 | _x0 = floor((obs->obsValue(tLC) - offGR -offGE - offGC - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
|
---|
89 | break;
|
---|
90 | }
|
---|
91 | }
|
---|
92 | }
|
---|
93 | break;
|
---|
94 | case offGR:
|
---|
95 | _epoSpec = true;
|
---|
96 | _sigma0 = OPT->_aprSigOGR;
|
---|
97 | _x0 = PPP_CLIENT->offGR();
|
---|
98 | break;
|
---|
99 | case offGE:
|
---|
100 | _epoSpec = true;
|
---|
101 | _sigma0 = OPT->_aprSigOGE;
|
---|
102 | _x0 = PPP_CLIENT->offGE();
|
---|
103 | break;
|
---|
104 | case offGC:
|
---|
105 | _epoSpec = true;
|
---|
106 | _sigma0 = OPT->_aprSigOGC;
|
---|
107 | _x0 = PPP_CLIENT->offGC();
|
---|
108 | break;
|
---|
109 | case trp:
|
---|
110 | _epoSpec = false;
|
---|
111 | _sigma0 = OPT->_aprSigTrp;
|
---|
112 | _noise = OPT->_noiseTrp;
|
---|
113 | break;
|
---|
114 | case ion:
|
---|
115 | _epoSpec = false;
|
---|
116 | _sigma0 = OPT->_aprSigIon;
|
---|
117 | _noise = OPT->_noiseIon;
|
---|
118 | break;
|
---|
119 | case cBiasG1: case cBiasR1: case cBiasE1: case cBiasC1:
|
---|
120 | case cBiasG2: case cBiasR2: case cBiasE2: case cBiasC2:
|
---|
121 | _epoSpec = false;
|
---|
122 | _sigma0 = OPT->_aprSigCodeBias;
|
---|
123 | _noise = OPT->_noiseCodeBias;
|
---|
124 | break;
|
---|
125 | case pBiasG1: case pBiasE1: case pBiasR1: case pBiasC1:
|
---|
126 | case pBiasG2: case pBiasE2: case pBiasR2: case pBiasC2:
|
---|
127 | _epoSpec = false;
|
---|
128 | _sigma0 = OPT->_aprSigPhaseBias;
|
---|
129 | _noise = OPT->_noisePhaseBias;
|
---|
130 | break;
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | //
|
---|
135 | ////////////////////////////////////////////////////////////////////////////
|
---|
136 | t_pppParam::t_pppParam(const t_pppParam* old) {
|
---|
137 | _type = old->type();
|
---|
138 | _prn = old->prn();
|
---|
139 | _tLC = old->tLC();
|
---|
140 | _indexOld = old->indexOld();
|
---|
141 | _indexNew = old->indexNew();
|
---|
142 | _noise = old->noise();
|
---|
143 | _sigma0 = old->sigma0();
|
---|
144 | _epoSpec = old->epoSpec();
|
---|
145 | _x0 = old->x0();
|
---|
146 | setFirstObsTime(old->firstObsTime());
|
---|
147 | setLastObsTime(old->lastObsTime());
|
---|
148 | _ambInfo = 0;
|
---|
149 | if (_type == t_pppParam::amb) {
|
---|
150 | _ambInfo = new t_ambInfo();
|
---|
151 | _ambInfo->_resetCandidate = old->_ambInfo->_resetCandidate;
|
---|
152 | _ambInfo->_eleSat = old->_ambInfo->_eleSat;
|
---|
153 | _ambInfo->_numEpo = old->_ambInfo->_numEpo;
|
---|
154 | }
|
---|
155 | }
|
---|
156 |
|
---|
157 | // Destructor
|
---|
158 | ////////////////////////////////////////////////////////////////////////////
|
---|
159 | t_pppParam::~t_pppParam() {
|
---|
160 | if (_ambInfo) {
|
---|
161 | delete _ambInfo;
|
---|
162 | }
|
---|
163 | }
|
---|
164 | //
|
---|
165 | ////////////////////////////////////////////////////////////////////////////
|
---|
166 | double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
|
---|
167 | const t_lc::type& tLC, const t_prn refPrn) const {
|
---|
168 |
|
---|
169 | // Special Case - Melbourne-Wuebbena
|
---|
170 | // ---------------------------------
|
---|
171 | if (tLC == t_lc::MW && _type != amb) {
|
---|
172 | return 0.0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
176 | ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
|
---|
177 |
|
---|
178 | map<t_frequency::type, double> codeCoeff;
|
---|
179 | map<t_frequency::type, double> phaseCoeff;
|
---|
180 | map<t_frequency::type, double> ionoCoeff;
|
---|
181 | obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
|
---|
182 |
|
---|
183 | switch (_type) {
|
---|
184 | case crdX:
|
---|
185 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
186 | return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
|
---|
187 | case crdY:
|
---|
188 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
189 | return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
|
---|
190 | case crdZ:
|
---|
191 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
192 | return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
|
---|
193 | case clkR:
|
---|
194 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
195 | return 1.0;
|
---|
196 | case offGR:
|
---|
197 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
198 | return (obs->prn().system() == 'R') ? 1.0 : 0.0;
|
---|
199 | case offGE:
|
---|
200 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
201 | return (obs->prn().system() == 'E') ? 1.0 : 0.0;
|
---|
202 | case offGC:
|
---|
203 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
204 | return (obs->prn().system() == 'C') ? 1.0 : 0.0;
|
---|
205 | case amb:
|
---|
206 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
207 | else if ((OPT->_obsModelType == OPT->IF) ||
|
---|
208 | (OPT->_obsModelType == OPT->PPPRTK) ||
|
---|
209 | (OPT->_obsModelType == OPT->UncombPPP) ||
|
---|
210 | (OPT->_obsModelType == OPT->DCMcodeBias && !obs->isReference()) ||
|
---|
211 | (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference()) ) {
|
---|
212 |
|
---|
213 | if (obs->prn() == _prn) {
|
---|
214 | if (tLC == _tLC) {
|
---|
215 | return (obs->lambda(tLC));
|
---|
216 | }
|
---|
217 | else if (tLC == t_lc::lIF && _tLC == t_lc::MW) {
|
---|
218 | return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2);
|
---|
219 | }
|
---|
220 | else {
|
---|
221 | if (_tLC == t_lc::l1) {
|
---|
222 | return obs->lambda(t_lc::l1) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
223 | }
|
---|
224 | else if (_tLC == t_lc::l2) {
|
---|
225 | return obs->lambda(t_lc::l2) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
226 | }
|
---|
227 | }
|
---|
228 | }
|
---|
229 | }
|
---|
230 | break;
|
---|
231 | case trp:
|
---|
232 | if (tLC == t_lc::GIM) {
|
---|
233 | return 0.0;
|
---|
234 | }
|
---|
235 | else if (tLC == t_lc::Tz0) {
|
---|
236 | return 1.0;
|
---|
237 | }
|
---|
238 | else {
|
---|
239 | return 1.0 / sin(obs->eleSat());
|
---|
240 | }
|
---|
241 | case ion:
|
---|
242 | if (obs->prn() == _prn) {
|
---|
243 | if (tLC == t_lc::c1) {
|
---|
244 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)];
|
---|
245 | }
|
---|
246 | else if (tLC == t_lc::c2) {
|
---|
247 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)];
|
---|
248 | }
|
---|
249 | else if (tLC == t_lc::l1) {
|
---|
250 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
251 | }
|
---|
252 | else if (tLC == t_lc::l2) {
|
---|
253 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
254 | }
|
---|
255 | else if (tLC == t_lc::GIM) {
|
---|
256 | return -1.0;
|
---|
257 | }
|
---|
258 | }
|
---|
259 | if (tLC == t_lc::GIM && _prn == refPrn) {
|
---|
260 | return 1.0;
|
---|
261 | }
|
---|
262 | break;
|
---|
263 | case cBiasG1:
|
---|
264 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
265 | break;
|
---|
266 | case cBiasR1:
|
---|
267 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
268 | break;
|
---|
269 | case cBiasE1:
|
---|
270 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
271 | break;
|
---|
272 | case cBiasC1:
|
---|
273 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
274 | break;
|
---|
275 | case cBiasG2:
|
---|
276 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
277 | break;
|
---|
278 | case cBiasR2:
|
---|
279 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
280 | break;
|
---|
281 | case cBiasE2:
|
---|
282 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
283 | break;
|
---|
284 | case cBiasC2:
|
---|
285 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
286 | break;
|
---|
287 | case pBiasG1:
|
---|
288 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
289 | break;
|
---|
290 | case pBiasR1:
|
---|
291 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
292 | break;
|
---|
293 | case pBiasE1:
|
---|
294 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
295 | break;
|
---|
296 | case pBiasC1:
|
---|
297 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
298 | break;
|
---|
299 | case pBiasG2:
|
---|
300 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
301 | break;
|
---|
302 | case pBiasR2:
|
---|
303 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
304 | break;
|
---|
305 | case pBiasE2:
|
---|
306 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
307 | break;
|
---|
308 | case pBiasC2:
|
---|
309 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
310 | break;
|
---|
311 |
|
---|
312 | }
|
---|
313 | return 0.0;
|
---|
314 | }
|
---|
315 |
|
---|
316 | //
|
---|
317 | ////////////////////////////////////////////////////////////////////////////
|
---|
318 | string t_pppParam::toString() const {
|
---|
319 | stringstream ss;
|
---|
320 | switch (_type) {
|
---|
321 | case crdX:
|
---|
322 | ss << "CRD_X";
|
---|
323 | break;
|
---|
324 | case crdY:
|
---|
325 | ss << "CRD_Y";
|
---|
326 | break;
|
---|
327 | case crdZ:
|
---|
328 | ss << "CRD_Z";
|
---|
329 | break;
|
---|
330 | case clkR:
|
---|
331 | ss << "REC_CLK ";
|
---|
332 | break;
|
---|
333 | case offGR:
|
---|
334 | ss << "OGR ";
|
---|
335 | break;
|
---|
336 | case offGE:
|
---|
337 | ss << "OGE ";
|
---|
338 | break;
|
---|
339 | case offGC:
|
---|
340 | ss << "OGC ";
|
---|
341 | break;
|
---|
342 | case trp:
|
---|
343 | ss << "TRP ";
|
---|
344 | break;
|
---|
345 | case amb:
|
---|
346 | ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
347 | break;
|
---|
348 | case ion:
|
---|
349 | ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
350 | break;
|
---|
351 | case cBiasG1: case pBiasG1:
|
---|
352 | case cBiasG2: case pBiasG2:
|
---|
353 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
|
---|
354 | break;
|
---|
355 | case cBiasR1: case pBiasR1:
|
---|
356 | case cBiasR2: case pBiasR2:
|
---|
357 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
|
---|
358 | break;
|
---|
359 | case cBiasE1: case pBiasE1:
|
---|
360 | case cBiasE2: case pBiasE2:
|
---|
361 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
|
---|
362 | break;
|
---|
363 | case cBiasC1: case pBiasC1:
|
---|
364 | case cBiasC2: case pBiasC2:
|
---|
365 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
|
---|
366 | break;
|
---|
367 | }
|
---|
368 | return ss.str();
|
---|
369 | }
|
---|
370 |
|
---|
371 | // Constructor
|
---|
372 | ////////////////////////////////////////////////////////////////////////////
|
---|
373 | t_pppParlist::t_pppParlist() {
|
---|
374 | }
|
---|
375 |
|
---|
376 | // Destructor
|
---|
377 | ////////////////////////////////////////////////////////////////////////////
|
---|
378 | t_pppParlist::~t_pppParlist() {
|
---|
379 | _usedSystems.clear();
|
---|
380 |
|
---|
381 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
382 | while (it != _params.end()) {
|
---|
383 | t_pppParam* par = *it;
|
---|
384 | delete par;
|
---|
385 | it = _params.erase(it);
|
---|
386 | }
|
---|
387 | }
|
---|
388 |
|
---|
389 | //
|
---|
390 | ////////////////////////////////////////////////////////////////////////////
|
---|
391 | t_pppParlist::t_pppParlist(const t_pppParlist& old) {
|
---|
392 |
|
---|
393 | _usedSystems = old._usedSystems;
|
---|
394 |
|
---|
395 | vector<t_pppParam*>::const_iterator it = old.params().begin();
|
---|
396 | while (it != old.params().end()) {
|
---|
397 | const t_pppParam* oldParam = *it;
|
---|
398 | _params.push_back(new t_pppParam(oldParam));
|
---|
399 | }
|
---|
400 | }
|
---|
401 |
|
---|
402 | //
|
---|
403 | ////////////////////////////////////////////////////////////////////////////
|
---|
404 | const t_pppParlist& t_pppParlist::operator= (const t_pppParlist& p) {
|
---|
405 |
|
---|
406 | _usedSystems.clear();
|
---|
407 |
|
---|
408 | _usedSystems = p._usedSystems;
|
---|
409 |
|
---|
410 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
411 | while (it != _params.end()) {
|
---|
412 | t_pppParam* par = *it;
|
---|
413 | delete par;
|
---|
414 | it = _params.erase(it);
|
---|
415 | }
|
---|
416 |
|
---|
417 | for (unsigned jj = 0; jj < p.params().size(); jj++) {
|
---|
418 | t_pppParam* parFrom = p.params()[jj];
|
---|
419 | _params.push_back(new t_pppParam(parFrom));
|
---|
420 | }
|
---|
421 | return *this;
|
---|
422 | }
|
---|
423 |
|
---|
424 | //
|
---|
425 | ////////////////////////////////////////////////////////////////////////////
|
---|
426 | t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
|
---|
427 | const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
428 |
|
---|
429 | // Remove some Parameters
|
---|
430 | // ----------------------
|
---|
431 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
432 | while (it != _params.end()) {
|
---|
433 | t_pppParam* par = *it;
|
---|
434 |
|
---|
435 | bool remove = false;
|
---|
436 |
|
---|
437 | if (par->epoSpec()) {
|
---|
438 | remove = true;
|
---|
439 | }
|
---|
440 |
|
---|
441 | else if (par->type() == t_pppParam::crdX ||
|
---|
442 | par->type() == t_pppParam::crdY ||
|
---|
443 | par->type() == t_pppParam::crdZ) {
|
---|
444 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
445 | remove = true;
|
---|
446 | }
|
---|
447 | }
|
---|
448 |
|
---|
449 | else if (par->type() == t_pppParam::amb) {
|
---|
450 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
451 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
452 | char sys = par->prn().system();
|
---|
453 | t_prn refPrn = (refSatMap[sys])->prn();
|
---|
454 | if (par->lastObsTime().valid() && par->prn() == refPrn) {
|
---|
455 | remove = true;
|
---|
456 | }
|
---|
457 | }
|
---|
458 | else {
|
---|
459 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
460 | remove = true;
|
---|
461 | }
|
---|
462 | }
|
---|
463 | }
|
---|
464 |
|
---|
465 | else if (par->type() == t_pppParam::ion) {
|
---|
466 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
467 | remove = true;
|
---|
468 | }
|
---|
469 | }
|
---|
470 | if (remove) {
|
---|
471 | #ifdef BNC_DEBUG_PPP
|
---|
472 | LOG << "remove0 " << par->toString() << std::endl;
|
---|
473 | #endif
|
---|
474 | delete par;
|
---|
475 | it = _params.erase(it);
|
---|
476 | }
|
---|
477 | else {
|
---|
478 | ++it;
|
---|
479 | }
|
---|
480 | }
|
---|
481 |
|
---|
482 | // check which systems have observations
|
---|
483 | // -------------------------------------
|
---|
484 | _usedSystems.clear();
|
---|
485 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
486 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
487 | char sys = satObs->prn().system();LOG << satObs->prn().toString() << endl;
|
---|
488 | if (!_usedSystems.contains(sys)) {
|
---|
489 | _usedSystems.append(sys);
|
---|
490 | }
|
---|
491 | }
|
---|
492 |
|
---|
493 | if (_usedSystems.size() > 1 &&
|
---|
494 | !_usedSystems.contains('G')) { // required to setup ISB w. r. t. GPS
|
---|
495 | return failure;
|
---|
496 | }
|
---|
497 |
|
---|
498 |
|
---|
499 |
|
---|
500 | // Check whether parameters have observations
|
---|
501 | // ------------------------------------------
|
---|
502 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
503 | t_pppParam* par = _params[ii];
|
---|
504 | if (par->prn() == 0) {
|
---|
505 | par->setLastObsTime(epoTime);
|
---|
506 | if (par->firstObsTime().undef()) {
|
---|
507 | par->setFirstObsTime(epoTime);
|
---|
508 | }
|
---|
509 | }
|
---|
510 | else {
|
---|
511 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
512 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
513 | if (satObs->prn() == par->prn()) {
|
---|
514 | par->setLastObsTime(epoTime);
|
---|
515 | if (par->firstObsTime().undef()) {
|
---|
516 | par->setFirstObsTime(epoTime);
|
---|
517 | }
|
---|
518 | break;
|
---|
519 | }
|
---|
520 | }
|
---|
521 | }
|
---|
522 | }
|
---|
523 |
|
---|
524 |
|
---|
525 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
526 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
527 | // Check if ambiguity parameters have observations
|
---|
528 | // -----------------------------------------------
|
---|
529 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
530 | QList<t_prn> lostSats;
|
---|
531 | while (it != _params.end()) {
|
---|
532 | t_pppParam* par = *it;
|
---|
533 | if ((par->type() == t_pppParam::amb) &&
|
---|
534 | (!par->lastObsTime().valid() || (epoTime - par->lastObsTime() > 0.0))) {
|
---|
535 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
536 | lostSats.append(par->prn());
|
---|
537 | delete par;
|
---|
538 | it = _params.erase(it);
|
---|
539 | }
|
---|
540 | // Check if systems have to be presented per biases
|
---|
541 | else if ((par->type() == t_pppParam::cBiasG1 ||
|
---|
542 | par->type() == t_pppParam::cBiasG2 ||
|
---|
543 | par->type() == t_pppParam::pBiasG1 ||
|
---|
544 | par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('G')) {
|
---|
545 | delete par; LOG << "remove1 " << par->toString() << std::endl;
|
---|
546 | it = _params.erase(it);
|
---|
547 | }
|
---|
548 | else if ((par->type() == t_pppParam::cBiasR1 ||
|
---|
549 | par->type() == t_pppParam::cBiasR2 ||
|
---|
550 | par->type() == t_pppParam::pBiasR1 ||
|
---|
551 | par->type() == t_pppParam::pBiasR2) && !usedSystems().contains('R')) {
|
---|
552 | delete par; LOG << "remove1 " << par->toString() << std::endl;
|
---|
553 | it = _params.erase(it);
|
---|
554 | }
|
---|
555 | else if ((par->type() == t_pppParam::cBiasE1 ||
|
---|
556 | par->type() == t_pppParam::cBiasE2 ||
|
---|
557 | par->type() == t_pppParam::pBiasE1 ||
|
---|
558 | par->type() == t_pppParam::pBiasE2) && !usedSystems().contains('E')) {
|
---|
559 | delete par; LOG << "remove1 " << par->toString() << std::endl;
|
---|
560 | it = _params.erase(it);
|
---|
561 | }
|
---|
562 | else if ((par->type() == t_pppParam::cBiasC1 ||
|
---|
563 | par->type() == t_pppParam::cBiasC2 ||
|
---|
564 | par->type() == t_pppParam::pBiasC1 ||
|
---|
565 | par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('C')) {
|
---|
566 | delete par; LOG << "remove1 " << par->toString() << std::endl;
|
---|
567 | it = _params.erase(it);
|
---|
568 | }
|
---|
569 | else {
|
---|
570 | ++it;
|
---|
571 | }
|
---|
572 | }
|
---|
573 | // remove respective iono parameters
|
---|
574 | // ---------------------------------
|
---|
575 | it = _params.begin();
|
---|
576 | while (it != _params.end()) {
|
---|
577 | t_pppParam* par = *it;
|
---|
578 | if ((par->type() == t_pppParam::ion) &&
|
---|
579 | (lostSats.contains(par->prn()) || (epoTime - par->lastObsTime() > 0.0))) {
|
---|
580 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
581 | delete par;
|
---|
582 | it = _params.erase(it);
|
---|
583 | }
|
---|
584 | else {
|
---|
585 | ++it;
|
---|
586 | }
|
---|
587 | }
|
---|
588 | }
|
---|
589 |
|
---|
590 |
|
---|
591 | // Required Set of Parameters
|
---|
592 | // --------------------------
|
---|
593 | vector<t_pppParam*> required;
|
---|
594 |
|
---|
595 | // Coordinates
|
---|
596 | // -----------
|
---|
597 | required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
|
---|
598 | required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
|
---|
599 | required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
|
---|
600 |
|
---|
601 | // Receiver Code Biases
|
---|
602 | // --------------------
|
---|
603 | if (OPT->_obsModelType == OPT->DCMcodeBias) {
|
---|
604 | std::vector<t_lc::type> lc;
|
---|
605 | if (_usedSystems.contains('G')) {
|
---|
606 | lc = OPT->LCs('G');
|
---|
607 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
608 | required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
|
---|
609 | }
|
---|
610 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
611 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
612 | }
|
---|
613 | }
|
---|
614 | if (_usedSystems.contains('R')) {
|
---|
615 | lc = OPT->LCs('R');
|
---|
616 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
617 | required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
|
---|
618 | }
|
---|
619 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
620 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
621 | }
|
---|
622 | }
|
---|
623 | if (_usedSystems.contains('E')) {
|
---|
624 | lc = OPT->LCs('E');
|
---|
625 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
626 | required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
|
---|
627 | }
|
---|
628 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
629 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
630 | }
|
---|
631 | }
|
---|
632 | if (_usedSystems.contains('C')) {
|
---|
633 | lc = OPT->LCs('C');
|
---|
634 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
635 | required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
|
---|
636 | }
|
---|
637 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
638 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
639 | }
|
---|
640 | }
|
---|
641 | }
|
---|
642 |
|
---|
643 | // Receiver Phase Biases
|
---|
644 | // ---------------------
|
---|
645 | if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
|
---|
646 | (OPT->_obsModelType == OPT->PPPRTK) ) {
|
---|
647 | std::vector<t_lc::type> lc;
|
---|
648 | if (_usedSystems.contains('G')) {
|
---|
649 | lc = OPT->LCs('G');
|
---|
650 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
651 | required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
|
---|
652 | }
|
---|
653 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
654 | required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
|
---|
655 | }
|
---|
656 | }
|
---|
657 | if (_usedSystems.contains('R')) {
|
---|
658 | lc = OPT->LCs('R');
|
---|
659 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
660 | required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
|
---|
661 | }
|
---|
662 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
663 | required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
|
---|
664 | }
|
---|
665 |
|
---|
666 | }
|
---|
667 | if (_usedSystems.contains('E')) {
|
---|
668 | lc = OPT->LCs('E');
|
---|
669 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
670 | required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
|
---|
671 | }
|
---|
672 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
673 | required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
|
---|
674 | }
|
---|
675 | }
|
---|
676 | if (_usedSystems.contains('C')) {
|
---|
677 | lc = OPT->LCs('C');
|
---|
678 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
679 | required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
|
---|
680 | }
|
---|
681 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
682 | required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
|
---|
683 | }
|
---|
684 | }
|
---|
685 | }
|
---|
686 |
|
---|
687 | // Receiver Clock
|
---|
688 | // --------------
|
---|
689 | required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
|
---|
690 |
|
---|
691 | // GPS-GLONASS Clock Offset
|
---|
692 | // ------------------------
|
---|
693 | if (_usedSystems.contains('G') && _usedSystems.contains('R')) {
|
---|
694 | required.push_back(new t_pppParam(t_pppParam::offGR, t_prn(), t_lc::dummy));
|
---|
695 | }
|
---|
696 |
|
---|
697 | //GPS-Galileo Clock Offset
|
---|
698 | // ------------------------
|
---|
699 | if (_usedSystems.contains('G') && _usedSystems.contains('E')) {
|
---|
700 | required.push_back(new t_pppParam(t_pppParam::offGE, t_prn(), t_lc::dummy));
|
---|
701 | }
|
---|
702 |
|
---|
703 | // GPS-BDS Clock Offset
|
---|
704 | // ------------------------
|
---|
705 | if (_usedSystems.contains('G') && _usedSystems.contains('C')) {
|
---|
706 | required.push_back(new t_pppParam(t_pppParam::offGC, t_prn(), t_lc::dummy));
|
---|
707 | }
|
---|
708 |
|
---|
709 | // Troposphere
|
---|
710 | // -----------
|
---|
711 | if (OPT->estTrp()) {
|
---|
712 | required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
|
---|
713 | }
|
---|
714 |
|
---|
715 | // Ionosphere
|
---|
716 | // ----------
|
---|
717 | if (OPT->_obsModelType == OPT->UncombPPP ||
|
---|
718 | OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
719 | OPT->_obsModelType == OPT->DCMphaseBias ) {
|
---|
720 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
721 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
722 | required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
|
---|
723 | }
|
---|
724 | }
|
---|
725 | // Ambiguities
|
---|
726 | // -----------
|
---|
727 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
728 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
729 | if ((OPT->_obsModelType == OPT->IF) ||
|
---|
730 | (OPT->_obsModelType == OPT->PPPRTK) ||
|
---|
731 | (OPT->_obsModelType == OPT->UncombPPP) ||
|
---|
732 | (OPT->_obsModelType == OPT->DCMcodeBias && !satObs->isReference()) ||
|
---|
733 | (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference()) ) {
|
---|
734 | const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
|
---|
735 | for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
|
---|
736 | required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
|
---|
737 | }
|
---|
738 | }
|
---|
739 | }
|
---|
740 |
|
---|
741 | // Check if all required parameters are present
|
---|
742 | // --------------------------------------------
|
---|
743 | for (unsigned ii = 0; ii < required.size(); ii++) {
|
---|
744 | t_pppParam* parReq = required[ii];
|
---|
745 |
|
---|
746 | bool found = false;
|
---|
747 | for (unsigned jj = 0; jj < _params.size(); jj++) {
|
---|
748 | t_pppParam* parOld = _params[jj];
|
---|
749 | if (parOld->isEqual(parReq)) {
|
---|
750 | found = true;
|
---|
751 | break;
|
---|
752 | }
|
---|
753 | }
|
---|
754 | if (found) {
|
---|
755 | delete parReq;
|
---|
756 | }
|
---|
757 | else {
|
---|
758 | #ifdef BNC_DEBUG_PPP
|
---|
759 | LOG << "push_back parReq " << parReq->toString() << std::endl;
|
---|
760 | #endif
|
---|
761 | _params.push_back(parReq);
|
---|
762 | }
|
---|
763 | }
|
---|
764 |
|
---|
765 | // Set Parameter Indices
|
---|
766 | // ---------------------
|
---|
767 | sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
|
---|
768 |
|
---|
769 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
770 | t_pppParam* par = _params[ii];
|
---|
771 | par->setIndex(ii);
|
---|
772 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
773 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
774 | if (satObs->prn() == par->prn()) {
|
---|
775 | par->setAmbEleSat(satObs->eleSat());
|
---|
776 | par->stepAmbNumEpo();
|
---|
777 | }
|
---|
778 | }
|
---|
779 | }
|
---|
780 |
|
---|
781 | return success;
|
---|
782 | }
|
---|
783 |
|
---|
784 | //
|
---|
785 | ////////////////////////////////////////////////////////////////////////////
|
---|
786 | void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
|
---|
787 | const ColumnVector& xx) const {
|
---|
788 |
|
---|
789 | string epoTimeStr = string(epoTime);
|
---|
790 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
791 |
|
---|
792 | LOG << endl;
|
---|
793 |
|
---|
794 | t_pppParam* parX = 0;
|
---|
795 | t_pppParam* parY = 0;
|
---|
796 | t_pppParam* parZ = 0;
|
---|
797 | vector<t_pppParam*>::const_iterator it = _params.begin();
|
---|
798 | while (it != _params.end()) {
|
---|
799 | t_pppParam* par = *it;
|
---|
800 | if (par->type() == t_pppParam::crdX) {
|
---|
801 | parX = par;
|
---|
802 | }
|
---|
803 | else if (par->type() == t_pppParam::crdY) {
|
---|
804 | parY = par;
|
---|
805 | }
|
---|
806 | else if (par->type() == t_pppParam::crdZ) {
|
---|
807 | parZ = par;
|
---|
808 | }
|
---|
809 | else {
|
---|
810 | int ind = par->indexNew();
|
---|
811 | double apr = (par->type() == t_pppParam::trp) ?
|
---|
812 | t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
|
---|
813 | LOG << epoTimeStr << ' ' << par->toString() << ' '
|
---|
814 | << setw(10) << setprecision(4) << apr << ' '
|
---|
815 | << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
|
---|
816 | << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
|
---|
817 | if (par->type() == t_pppParam::amb) {
|
---|
818 | LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
|
---|
819 | << " epo = " << setw(4) << par->ambNumEpo();
|
---|
820 | }
|
---|
821 | LOG << endl;
|
---|
822 | }
|
---|
823 | ++it;
|
---|
824 | }
|
---|
825 |
|
---|
826 | if (parX && parY && parZ) {
|
---|
827 |
|
---|
828 | ColumnVector xyz(3);
|
---|
829 | xyz[0] = xx[parX->indexNew()];
|
---|
830 | xyz[1] = xx[parY->indexNew()];
|
---|
831 | xyz[2] = xx[parZ->indexNew()];
|
---|
832 |
|
---|
833 | ColumnVector neu(3);
|
---|
834 | xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
|
---|
835 |
|
---|
836 | SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
|
---|
837 |
|
---|
838 | SymmetricMatrix QQneu(3);
|
---|
839 | covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
|
---|
840 |
|
---|
841 | LOG << epoTimeStr << ' ' << sta->name()
|
---|
842 | << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
|
---|
843 | << setprecision(4) << sqrt(QQxyz[0][0])
|
---|
844 |
|
---|
845 | << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
|
---|
846 | << setprecision(4) << sqrt(QQxyz[1][1])
|
---|
847 |
|
---|
848 | << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
|
---|
849 | << setprecision(4) << sqrt(QQxyz[2][2])
|
---|
850 |
|
---|
851 | << " dN = " << setprecision(4) << neu[0] << " +- "
|
---|
852 | << setprecision(4) << sqrt(QQneu[0][0])
|
---|
853 |
|
---|
854 | << " dE = " << setprecision(4) << neu[1] << " +- "
|
---|
855 | << setprecision(4) << sqrt(QQneu[1][1])
|
---|
856 |
|
---|
857 | << " dU = " << setprecision(4) << neu[2] << " +- "
|
---|
858 | << setprecision(4) << sqrt(QQneu[2][2])
|
---|
859 |
|
---|
860 | << endl;
|
---|
861 | }
|
---|
862 | }
|
---|
863 |
|
---|
864 | //
|
---|
865 | ////////////////////////////////////////////////////////////////////////////
|
---|
866 | void t_pppParlist::printParams(const bncTime& epoTime) {
|
---|
867 |
|
---|
868 | for (unsigned iPar = 0; iPar < _params.size(); iPar++) {
|
---|
869 | LOG << _params[iPar]->toString()
|
---|
870 | << "\t lastObsTime().valid() \t" << _params[iPar]->lastObsTime().valid()
|
---|
871 | << "\t epoTime - par->lastObsTime() \t" << (epoTime - _params[iPar]->lastObsTime())
|
---|
872 | << endl;
|
---|
873 | }
|
---|
874 | }
|
---|
875 |
|
---|