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
RevLine 
[7237]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,
[9504]37 const vector<t_pppSatObs*>* obsVector) {
[7237]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;
[9303]66 _sigma0 = OPT->_aprSigClk;
[7237]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) {
[9288]76 double offGR = 0;
[7237]77 if (_prn.system() == 'R' && tLC != t_lc::MW) {
[9288]78 offGR = PPP_CLIENT->offGR();
[7237]79 }
[9288]80 double offGE = 0;
81 if (_prn.system() == 'E' && tLC != t_lc::MW) {
82 offGE = PPP_CLIENT->offGE();
83 }
84 double offGC = 0;
[8993]85 if (_prn.system() == 'C' && tLC != t_lc::MW) {
[9288]86 offGC = PPP_CLIENT->offGC();
[8993]87 }
[9288]88 _x0 = floor((obs->obsValue(tLC) - offGR -offGE - offGC - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
[7237]89 break;
90 }
91 }
92 }
93 break;
[9288]94 case offGR:
[7237]95 _epoSpec = true;
[9386]96 _sigma0 = OPT->_aprSigOGR;
[9288]97 _x0 = PPP_CLIENT->offGR();
[7237]98 break;
[9288]99 case offGE:
[8993]100 _epoSpec = true;
[9386]101 _sigma0 = OPT->_aprSigOGE;
[9288]102 _x0 = PPP_CLIENT->offGE();
[8993]103 break;
[9288]104 case offGC:
105 _epoSpec = true;
[9386]106 _sigma0 = OPT->_aprSigOGC;
[9288]107 _x0 = PPP_CLIENT->offGC();
108 break;
[7237]109 case trp:
110 _epoSpec = false;
111 _sigma0 = OPT->_aprSigTrp;
112 _noise = OPT->_noiseTrp;
113 break;
[8905]114 case ion:
[9439]115 _epoSpec = false;
[9386]116 _sigma0 = OPT->_aprSigIon;
[9439]117 _noise = OPT->_noiseIon;
[8905]118 break;
[9386]119 case cBiasG1: case cBiasR1: case cBiasE1: case cBiasC1:
120 case cBiasG2: case cBiasR2: case cBiasE2: case cBiasC2:
[9486]121 _epoSpec = false;
[8905]122 _sigma0 = OPT->_aprSigCodeBias;
[9486]123 _noise = OPT->_noiseCodeBias;
[8905]124 break;
[9419]125 case pBiasG1: case pBiasE1: case pBiasR1: case pBiasC1:
126 case pBiasG2: case pBiasE2: case pBiasR2: case pBiasC2:
[9486]127 _epoSpec = false;
[8905]128 _sigma0 = OPT->_aprSigPhaseBias;
[9486]129 _noise = OPT->_noisePhaseBias;
[8905]130 break;
[7237]131 }
132}
133
[9504]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();
[9508]145 _x0 = old->x0();
146 setFirstObsTime(old->firstObsTime());
147 setLastObsTime(old->lastObsTime());
[9504]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
[7237]157// Destructor
158////////////////////////////////////////////////////////////////////////////
159t_pppParam::~t_pppParam() {
[9504]160 if (_ambInfo) {
161 delete _ambInfo;
162 }
[7237]163}
164//
165////////////////////////////////////////////////////////////////////////////
166double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
[8956]167 const t_lc::type& tLC, const t_prn refPrn) const {
[7237]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();
[8905]176 ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
[7237]177
[8905]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
[7237]183 switch (_type) {
184 case crdX:
[8961]185 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]186 return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
[7237]187 case crdY:
[8961]188 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]189 return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
[7237]190 case crdZ:
[8961]191 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]192 return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
[7237]193 case clkR:
[8961]194 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[7237]195 return 1.0;
[9288]196 case offGR:
[8961]197 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[7237]198 return (obs->prn().system() == 'R') ? 1.0 : 0.0;
[9288]199 case offGE:
[8993]200 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[9288]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;}
[8993]204 return (obs->prn().system() == 'C') ? 1.0 : 0.0;
[7237]205 case amb:
[8961]206 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]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()) ) {
[9386]212
[8905]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:
[8961]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 }
[8905]241 case ion:
[7237]242 if (obs->prn() == _prn) {
[8905]243 if (tLC == t_lc::c1) {
244 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)];
[7237]245 }
[8905]246 else if (tLC == t_lc::c2) {
247 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)];
[7237]248 }
[8905]249 else if (tLC == t_lc::l1) {
250 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
[7237]251 }
[8905]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 }
[7237]258 }
[8956]259 if (tLC == t_lc::GIM && _prn == refPrn) {
[8961]260 return 1.0;
[8905]261 }
262 break;
[9386]263 case cBiasG1:
264 if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
[8905]265 break;
[9386]266 case cBiasR1:
267 if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
[8905]268 break;
[9386]269 case cBiasE1:
270 if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
[8905]271 break;
[9386]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;
[9419]290 case pBiasR1:
291 if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
292 break;
[9386]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;
[9419]302 case pBiasR2:
303 if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
304 break;
[9386]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
[7237]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:
[9386]331 ss << "REC_CLK ";
[7237]332 break;
[9288]333 case offGR:
[9386]334 ss << "OGR ";
[7237]335 break;
[9288]336 case offGE:
[9386]337 ss << "OGE ";
[9288]338 break;
339 case offGC:
[9386]340 ss << "OGC ";
[8993]341 break;
[7237]342 case trp:
[9386]343 ss << "TRP ";
[7237]344 break;
[8905]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;
[9386]351 case cBiasG1: case pBiasG1:
352 case cBiasG2: case pBiasG2:
353 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
[8905]354 break;
[9419]355 case cBiasR1: case pBiasR1:
356 case cBiasR2: case pBiasR2:
[9386]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;
[7237]367 }
368 return ss.str();
369}
370
371// Constructor
372////////////////////////////////////////////////////////////////////////////
373t_pppParlist::t_pppParlist() {
374}
375
376// Destructor
377////////////////////////////////////////////////////////////////////////////
378t_pppParlist::~t_pppParlist() {
[9504]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);
[7237]386 }
387}
388
389//
390////////////////////////////////////////////////////////////////////////////
[9504]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////////////////////////////////////////////////////////////////////////////
[9419]426t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
[8956]427 const QMap<char, t_pppRefSat*>& refSatMap) {
[7237]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
[8956]441 else if (par->type() == t_pppParam::crdX ||
[7988]442 par->type() == t_pppParam::crdY ||
443 par->type() == t_pppParam::crdZ) {
[7973]444 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
[7237]445 remove = true;
446 }
447 }
[9419]448
[8956]449 else if (par->type() == t_pppParam::amb) {
[9494]450 if (OPT->_obsModelType == OPT->DCMcodeBias ||
451 OPT->_obsModelType == OPT->DCMphaseBias) {
[9508]452 char sys = par->prn().system();
453 t_prn refPrn = (refSatMap[sys])->prn();
[9419]454 if (par->lastObsTime().valid() &&
455 ((epoTime - par->lastObsTime() > 1.0) || (par->prn() == refPrn))) {
456 remove = true;
457 }
[8956]458 }
[9419]459 else {
460 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
461 remove = true;
462 }
[8956]463 }
464 }
[7237]465
[9447]466 else if (par->type() == t_pppParam::ion) {
[9494]467 if (OPT->_obsModelType == OPT->DCMcodeBias ||
468 OPT->_obsModelType == OPT->DCMphaseBias) {
[9447]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 }
[7237]479 if (remove) {
[9508]480#ifdef BNC_DEBUG_PPP
481 LOG << "remove " << par->toString() << std::endl;
482#endif
[7237]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
[9419]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) {
[9508]527#ifdef BNC_DEBUG_PPP
528 LOG << "remove " << par->toString() << std::endl;
529#endif
[9419]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
[9498]550 if (_usedSystems.size() > 1 &&
551 !_usedSystems.contains('G')) { // required to setup ISB w. r. t. GPS
552 return failure;
553 }
554
[7237]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
[9386]565 // Receiver Code Biases
566 // --------------------
567 if (OPT->_obsModelType == OPT->DCMcodeBias) {
[9494]568 std::vector<t_lc::type> lc;
[9419]569 if (_usedSystems.contains('G')) {
[9494]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 }
[9386]577 }
[9419]578 if (_usedSystems.contains('R')) {
[9494]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 }
[9386]586 }
[9419]587 if (_usedSystems.contains('E')) {
[9494]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 }
[9386]595 }
[9419]596 if (_usedSystems.contains('C')) {
[9494]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 }
[9386]604 }
605 }
606
607 // Receiver Phase Biases
608 // ---------------------
609 if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
610 (OPT->_obsModelType == OPT->PPPRTK) ) {
[9494]611 std::vector<t_lc::type> lc;
[9419]612 if (_usedSystems.contains('G')) {
[9494]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 }
[9386]620 }
[9419]621 if (_usedSystems.contains('R')) {
[9494]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
[9419]630 }
631 if (_usedSystems.contains('E')) {
[9494]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 }
[9386]639 }
[9419]640 if (_usedSystems.contains('C')) {
[9494]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 }
[9386]648 }
649 }
[9419]650
[7237]651 // Receiver Clock
652 // --------------
653 required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
654
[8905]655 // GPS-GLONASS Clock Offset
[7237]656 // ------------------------
[9498]657 if (_usedSystems.contains('G') && _usedSystems.contains('R')) {
658 required.push_back(new t_pppParam(t_pppParam::offGR, t_prn(), t_lc::dummy));
659 }
[7237]660
[9419]661 //GPS-Galileo Clock Offset
[9288]662 // ------------------------
[9498]663 if (_usedSystems.contains('G') && _usedSystems.contains('E')) {
664 required.push_back(new t_pppParam(t_pppParam::offGE, t_prn(), t_lc::dummy));
665 }
[9288]666
[8993]667 // GPS-BDS Clock Offset
668 // ------------------------
[9498]669 if (_usedSystems.contains('G') && _usedSystems.contains('C')) {
670 required.push_back(new t_pppParam(t_pppParam::offGC, t_prn(), t_lc::dummy));
671 }
[8993]672
[7237]673 // Troposphere
674 // -----------
675 if (OPT->estTrp()) {
676 required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
677 }
678
[8905]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++) {
[9386]685 const t_pppSatObs* satObs = obsVector[jj];
[8905]686 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
687 }
688 }
[7237]689 // Ambiguities
690 // -----------
691 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
[9419]692 const t_pppSatObs* satObs = obsVector[jj];
[8905]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 }
[7237]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 {
[9508]722#ifdef BNC_DEBUG_PPP
723 LOG << "push_back parReq " << parReq->toString() << std::endl;
724#endif
[7237]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;
[9504]761 vector<t_pppParam*>::const_iterator it = _params.begin();
762 while (it != _params.end()) {
763 t_pppParam* par = *it;
[7237]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 }
[9504]787 ++it;
[7237]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.