source: ntrip/trunk/BNC/src/PPP/pppParlist.cpp@ 9521

Last change on this file since 9521 was 9521, checked in by stuerze, 3 years ago

minor changes

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 25.1 KB
Line 
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
31using namespace BNC_PPP;
32using namespace std;
33
34// Constructor
35////////////////////////////////////////////////////////////////////////////
36t_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////////////////////////////////////////////////////////////////////////////
136t_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////////////////////////////////////////////////////////////////////////////
159t_pppParam::~t_pppParam() {
160 if (_ambInfo) {
161 delete _ambInfo;
162 }
163}
164//
165////////////////////////////////////////////////////////////////////////////
166double 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////////////////////////////////////////////////////////////////////////////
318string 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////////////////////////////////////////////////////////////////////////////
373t_pppParlist::t_pppParlist() {
374}
375
376// Destructor
377////////////////////////////////////////////////////////////////////////////
378t_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////////////////////////////////////////////////////////////////////////////
391t_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////////////////////////////////////////////////////////////////////////////
404const 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////////////////////////////////////////////////////////////////////////////
426t_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() &&
455 ((epoTime - par->lastObsTime() > 1.0) || (par->prn() == refPrn))) {
456 remove = true;
457 }
458 }
459 else {
460 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
461 remove = true;
462 }
463 }
464 }
465
466 else if (par->type() == t_pppParam::ion) {
467 if (OPT->_obsModelType == OPT->DCMcodeBias ||
468 OPT->_obsModelType == OPT->DCMphaseBias) {
469 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 1.0)) {
470 remove = true;
471 }
472 }
473 else {
474 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
475 remove = true;
476 }
477 }
478 }
479 if (remove) {
480#ifdef BNC_DEBUG_PPP
481 LOG << "remove " << par->toString() << std::endl;
482#endif
483 delete par;
484 it = _params.erase(it);
485 }
486 else {
487 ++it;
488 }
489 }
490
491 // Check whether parameters have observations
492 // ------------------------------------------
493 for (unsigned ii = 0; ii < _params.size(); ii++) {
494 t_pppParam* par = _params[ii];
495 if (par->prn() == 0) {
496 par->setLastObsTime(epoTime);
497 if (par->firstObsTime().undef()) {
498 par->setFirstObsTime(epoTime);
499 }
500 }
501 else {
502 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
503 const t_pppSatObs* satObs = obsVector[jj];
504 if (satObs->prn() == par->prn()) {
505 par->setLastObsTime(epoTime);
506 if (par->firstObsTime().undef()) {
507 par->setFirstObsTime(epoTime);
508 }
509 break;
510 }
511 }
512 }
513 }
514
515 // Check if ambiguity parameters have observations
516 // -----------------------------------------------
517 if (OPT->_obsModelType == OPT->DCMcodeBias ||
518 OPT->_obsModelType == OPT->DCMphaseBias) {
519 vector<t_pppParam*>::iterator it = _params.begin();
520 while (it != _params.end()) {
521 t_pppParam* par = *it;
522 bool remove = false;
523 if (par->type() == t_pppParam::amb && !par->lastObsTime().valid()) {
524 remove = true;
525 }
526 if (remove) {
527#ifdef BNC_DEBUG_PPP
528 LOG << "remove " << par->toString() << std::endl;
529#endif
530 delete par;
531 it = _params.erase(it);
532 }
533 else {
534 ++it;
535 }
536 }
537 }
538
539 // check which systems have observations
540 // -------------------------------------
541 _usedSystems.clear();
542 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
543 const t_pppSatObs* satObs = obsVector[jj];
544 char sys = satObs->prn().system();
545 if (!_usedSystems.contains(sys)) {
546 _usedSystems.append(sys);
547 }
548 }
549
550 if (_usedSystems.size() > 1 &&
551 !_usedSystems.contains('G')) { // required to setup ISB w. r. t. GPS
552 return failure;
553 }
554
555 // Required Set of Parameters
556 // --------------------------
557 vector<t_pppParam*> required;
558
559 // Coordinates
560 // -----------
561 required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
562 required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
563 required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
564
565 // Receiver Code Biases
566 // --------------------
567 if (OPT->_obsModelType == OPT->DCMcodeBias) {
568 std::vector<t_lc::type> lc;
569 if (_usedSystems.contains('G')) {
570 lc = OPT->LCs('G');
571 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
572 required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
573 }
574 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
575 required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
576 }
577 }
578 if (_usedSystems.contains('R')) {
579 lc = OPT->LCs('R');
580 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
581 required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
582 }
583 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
584 required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
585 }
586 }
587 if (_usedSystems.contains('E')) {
588 lc = OPT->LCs('E');
589 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
590 required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
591 }
592 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
593 required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
594 }
595 }
596 if (_usedSystems.contains('C')) {
597 lc = OPT->LCs('C');
598 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
599 required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
600 }
601 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
602 required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
603 }
604 }
605 }
606
607 // Receiver Phase Biases
608 // ---------------------
609 if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
610 (OPT->_obsModelType == OPT->PPPRTK) ) {
611 std::vector<t_lc::type> lc;
612 if (_usedSystems.contains('G')) {
613 lc = OPT->LCs('G');
614 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
615 required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
616 }
617 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
618 required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
619 }
620 }
621 if (_usedSystems.contains('R')) {
622 lc = OPT->LCs('R');
623 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
624 required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
625 }
626 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
627 required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
628 }
629
630 }
631 if (_usedSystems.contains('E')) {
632 lc = OPT->LCs('E');
633 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
634 required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
635 }
636 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
637 required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
638 }
639 }
640 if (_usedSystems.contains('C')) {
641 lc = OPT->LCs('C');
642 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
643 required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
644 }
645 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
646 required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
647 }
648 }
649 }
650
651 // Receiver Clock
652 // --------------
653 required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
654
655 // GPS-GLONASS Clock Offset
656 // ------------------------
657 if (_usedSystems.contains('G') && _usedSystems.contains('R')) {
658 required.push_back(new t_pppParam(t_pppParam::offGR, t_prn(), t_lc::dummy));
659 }
660
661 //GPS-Galileo Clock Offset
662 // ------------------------
663 if (_usedSystems.contains('G') && _usedSystems.contains('E')) {
664 required.push_back(new t_pppParam(t_pppParam::offGE, t_prn(), t_lc::dummy));
665 }
666
667 // GPS-BDS Clock Offset
668 // ------------------------
669 if (_usedSystems.contains('G') && _usedSystems.contains('C')) {
670 required.push_back(new t_pppParam(t_pppParam::offGC, t_prn(), t_lc::dummy));
671 }
672
673 // Troposphere
674 // -----------
675 if (OPT->estTrp()) {
676 required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
677 }
678
679 // Ionosphere
680 // ----------
681 if (OPT->_obsModelType == OPT->UncombPPP ||
682 OPT->_obsModelType == OPT->DCMcodeBias ||
683 OPT->_obsModelType == OPT->DCMphaseBias ) {
684 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
685 const t_pppSatObs* satObs = obsVector[jj];
686 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
687 }
688 }
689 // Ambiguities
690 // -----------
691 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
692 const t_pppSatObs* satObs = obsVector[jj];
693 if ((OPT->_obsModelType == OPT->IF) ||
694 (OPT->_obsModelType == OPT->PPPRTK) ||
695 (OPT->_obsModelType == OPT->UncombPPP) ||
696 (OPT->_obsModelType == OPT->DCMcodeBias && !satObs->isReference()) ||
697 (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference()) ) {
698 const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
699 for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
700 required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
701 }
702 }
703 }
704
705 // Check if all required parameters are present
706 // --------------------------------------------
707 for (unsigned ii = 0; ii < required.size(); ii++) {
708 t_pppParam* parReq = required[ii];
709
710 bool found = false;
711 for (unsigned jj = 0; jj < _params.size(); jj++) {
712 t_pppParam* parOld = _params[jj];
713 if (parOld->isEqual(parReq)) {
714 found = true;
715 break;
716 }
717 }
718 if (found) {
719 delete parReq;
720 }
721 else {
722#ifdef BNC_DEBUG_PPP
723 LOG << "push_back parReq " << parReq->toString() << std::endl;
724#endif
725 _params.push_back(parReq);
726 }
727 }
728
729 // Set Parameter Indices
730 // ---------------------
731 sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
732
733 for (unsigned ii = 0; ii < _params.size(); ii++) {
734 t_pppParam* par = _params[ii];
735 par->setIndex(ii);
736 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
737 const t_pppSatObs* satObs = obsVector[jj];
738 if (satObs->prn() == par->prn()) {
739 par->setAmbEleSat(satObs->eleSat());
740 par->stepAmbNumEpo();
741 }
742 }
743 }
744
745 return success;
746}
747
748//
749////////////////////////////////////////////////////////////////////////////
750void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
751 const ColumnVector& xx) const {
752
753 string epoTimeStr = string(epoTime);
754 const t_pppStation* sta = PPP_CLIENT->staRover();
755
756 LOG << endl;
757
758 t_pppParam* parX = 0;
759 t_pppParam* parY = 0;
760 t_pppParam* parZ = 0;
761 vector<t_pppParam*>::const_iterator it = _params.begin();
762 while (it != _params.end()) {
763 t_pppParam* par = *it;
764 if (par->type() == t_pppParam::crdX) {
765 parX = par;
766 }
767 else if (par->type() == t_pppParam::crdY) {
768 parY = par;
769 }
770 else if (par->type() == t_pppParam::crdZ) {
771 parZ = par;
772 }
773 else {
774 int ind = par->indexNew();
775 double apr = (par->type() == t_pppParam::trp) ?
776 t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
777 LOG << epoTimeStr << ' ' << par->toString() << ' '
778 << setw(10) << setprecision(4) << apr << ' '
779 << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
780 << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
781 if (par->type() == t_pppParam::amb) {
782 LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
783 << " epo = " << setw(4) << par->ambNumEpo();
784 }
785 LOG << endl;
786 }
787 ++it;
788 }
789
790 if (parX && parY && parZ) {
791
792 ColumnVector xyz(3);
793 xyz[0] = xx[parX->indexNew()];
794 xyz[1] = xx[parY->indexNew()];
795 xyz[2] = xx[parZ->indexNew()];
796
797 ColumnVector neu(3);
798 xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
799
800 SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
801
802 SymmetricMatrix QQneu(3);
803 covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
804
805 LOG << epoTimeStr << ' ' << sta->name()
806 << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
807 << setprecision(4) << sqrt(QQxyz[0][0])
808
809 << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
810 << setprecision(4) << sqrt(QQxyz[1][1])
811
812 << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
813 << setprecision(4) << sqrt(QQxyz[2][2])
814
815 << " dN = " << setprecision(4) << neu[0] << " +- "
816 << setprecision(4) << sqrt(QQneu[0][0])
817
818 << " dE = " << setprecision(4) << neu[1] << " +- "
819 << setprecision(4) << sqrt(QQneu[1][1])
820
821 << " dU = " << setprecision(4) << neu[2] << " +- "
822 << setprecision(4) << sqrt(QQneu[2][2])
823
824 << endl;
825 }
826}
827
Note: See TracBrowser for help on using the repository browser.