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

Last change on this file since 9448 was 9447, checked in by stuerze, 4 years ago

update regarding PPP

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 21.5 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,
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;
[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:
121 _epoSpec = true;
[8905]122 _sigma0 = OPT->_aprSigCodeBias;
123 break;
[9419]124 case pBiasG1: case pBiasE1: case pBiasR1: case pBiasC1:
125 case pBiasG2: case pBiasE2: case pBiasR2: case pBiasC2:
[9386]126 _epoSpec = true;
[8905]127 _sigma0 = OPT->_aprSigPhaseBias;
128 break;
[7237]129 }
130}
131
132// Destructor
133////////////////////////////////////////////////////////////////////////////
134t_pppParam::~t_pppParam() {
135 delete _ambInfo;
136}
137
138//
139////////////////////////////////////////////////////////////////////////////
140double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
[8956]141 const t_lc::type& tLC, const t_prn refPrn) const {
[7237]142
143 // Special Case - Melbourne-Wuebbena
144 // ---------------------------------
145 if (tLC == t_lc::MW && _type != amb) {
146 return 0.0;
147 }
148
149 const t_pppStation* sta = PPP_CLIENT->staRover();
[8905]150 ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
[7237]151
[8905]152 map<t_frequency::type, double> codeCoeff;
153 map<t_frequency::type, double> phaseCoeff;
154 map<t_frequency::type, double> ionoCoeff;
155 obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
156
[7237]157 switch (_type) {
158 case crdX:
[8961]159 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]160 return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
[7237]161 case crdY:
[8961]162 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]163 return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
[7237]164 case crdZ:
[8961]165 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]166 return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
[7237]167 case clkR:
[8961]168 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[7237]169 return 1.0;
[9288]170 case offGR:
[8961]171 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[7237]172 return (obs->prn().system() == 'R') ? 1.0 : 0.0;
[9288]173 case offGE:
[8993]174 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[9288]175 return (obs->prn().system() == 'E') ? 1.0 : 0.0;
176 case offGC:
177 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8993]178 return (obs->prn().system() == 'C') ? 1.0 : 0.0;
[7237]179 case amb:
[8961]180 if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
[8905]181 else if ((OPT->_obsModelType == OPT->IF) ||
182 (OPT->_obsModelType == OPT->PPPRTK) ||
183 (OPT->_obsModelType == OPT->UncombPPP) ||
184 (OPT->_obsModelType == OPT->DCMcodeBias && !obs->isReference()) ||
185 (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference()) ) {
[9386]186
[8905]187 if (obs->prn() == _prn) {
188 if (tLC == _tLC) {
189 return (obs->lambda(tLC));
190 }
191 else if (tLC == t_lc::lIF && _tLC == t_lc::MW) {
192 return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2);
193 }
194 else {
195 if (_tLC == t_lc::l1) {
196 return obs->lambda(t_lc::l1) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
197 }
198 else if (_tLC == t_lc::l2) {
199 return obs->lambda(t_lc::l2) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
200 }
201 }
202 }
203 }
204 break;
205 case trp:
[8961]206 if (tLC == t_lc::GIM) {
207 return 0.0;
208 }
209 else if (tLC == t_lc::Tz0) {
210 return 1.0;
211 }
212 else {
213 return 1.0 / sin(obs->eleSat());
214 }
[8905]215 case ion:
[7237]216 if (obs->prn() == _prn) {
[8905]217 if (tLC == t_lc::c1) {
218 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)];
[7237]219 }
[8905]220 else if (tLC == t_lc::c2) {
221 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)];
[7237]222 }
[8905]223 else if (tLC == t_lc::l1) {
224 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
[7237]225 }
[8905]226 else if (tLC == t_lc::l2) {
227 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
228 }
229 else if (tLC == t_lc::GIM) {
230 return -1.0;
231 }
[7237]232 }
[8956]233 if (tLC == t_lc::GIM && _prn == refPrn) {
[8961]234 return 1.0;
[8905]235 }
236 break;
[9386]237 case cBiasG1:
238 if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
[8905]239 break;
[9386]240 case cBiasR1:
241 if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
[8905]242 break;
[9386]243 case cBiasE1:
244 if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
[8905]245 break;
[9386]246 case cBiasC1:
247 if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
248 break;
249 case cBiasG2:
250 if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
251 break;
252 case cBiasR2:
253 if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
254 break;
255 case cBiasE2:
256 if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
257 break;
258 case cBiasC2:
259 if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
260 break;
261 case pBiasG1:
262 if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
263 break;
[9419]264 case pBiasR1:
265 if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
266 break;
[9386]267 case pBiasE1:
268 if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
269 break;
270 case pBiasC1:
271 if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
272 break;
273 case pBiasG2:
274 if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
275 break;
[9419]276 case pBiasR2:
277 if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
278 break;
[9386]279 case pBiasE2:
280 if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
281 break;
282 case pBiasC2:
283 if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
284 break;
285
[7237]286 }
287 return 0.0;
288}
289
290//
291////////////////////////////////////////////////////////////////////////////
292string t_pppParam::toString() const {
293 stringstream ss;
294 switch (_type) {
295 case crdX:
296 ss << "CRD_X";
297 break;
298 case crdY:
299 ss << "CRD_Y";
300 break;
301 case crdZ:
302 ss << "CRD_Z";
303 break;
304 case clkR:
[9386]305 ss << "REC_CLK ";
[7237]306 break;
[9288]307 case offGR:
[9386]308 ss << "OGR ";
[7237]309 break;
[9288]310 case offGE:
[9386]311 ss << "OGE ";
[9288]312 break;
313 case offGC:
[9386]314 ss << "OGC ";
[8993]315 break;
[7237]316 case trp:
[9386]317 ss << "TRP ";
[7237]318 break;
[8905]319 case amb:
320 ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
321 break;
322 case ion:
323 ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
324 break;
[9386]325 case cBiasG1: case pBiasG1:
326 case cBiasG2: case pBiasG2:
327 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
[8905]328 break;
[9419]329 case cBiasR1: case pBiasR1:
330 case cBiasR2: case pBiasR2:
[9386]331 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
332 break;
333 case cBiasE1: case pBiasE1:
334 case cBiasE2: case pBiasE2:
335 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
336 break;
337 case cBiasC1: case pBiasC1:
338 case cBiasC2: case pBiasC2:
339 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
340 break;
[7237]341 }
342 return ss.str();
343}
344
345// Constructor
346////////////////////////////////////////////////////////////////////////////
347t_pppParlist::t_pppParlist() {
348}
349
350// Destructor
351////////////////////////////////////////////////////////////////////////////
352t_pppParlist::~t_pppParlist() {
353 for (unsigned ii = 0; ii < _params.size(); ii++) {
354 delete _params[ii];
355 }
356}
357
358//
359////////////////////////////////////////////////////////////////////////////
[9419]360t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
[8956]361 const QMap<char, t_pppRefSat*>& refSatMap) {
[7237]362
363 // Remove some Parameters
364 // ----------------------
365 vector<t_pppParam*>::iterator it = _params.begin();
366 while (it != _params.end()) {
367 t_pppParam* par = *it;
368
369 bool remove = false;
370
371 if (par->epoSpec()) {
372 remove = true;
373 }
374
[8956]375 else if (par->type() == t_pppParam::crdX ||
[7988]376 par->type() == t_pppParam::crdY ||
377 par->type() == t_pppParam::crdZ) {
[7973]378 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
[7237]379 remove = true;
380 }
381 }
[9419]382
[8956]383 else if (par->type() == t_pppParam::amb) {
[9419]384 if (OPT->_obsModelType == OPT->DCMcodeBias || OPT->_obsModelType == OPT->DCMphaseBias) {
385 t_prn refPrn = (refSatMap[par->prn().system()])->prn();
386 if (par->lastObsTime().valid() &&
387 ((epoTime - par->lastObsTime() > 1.0) || (par->prn() == refPrn))) {
388 remove = true;
389 }
[8956]390 }
[9419]391 else {
392 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
393 remove = true;
394 }
[8956]395 }
396 }
[7237]397
[9447]398 else if (par->type() == t_pppParam::ion) {
399 if (OPT->_obsModelType == OPT->DCMcodeBias || OPT->_obsModelType == OPT->DCMphaseBias) {
400 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 1.0)) {
401 remove = true;
402 }
403 }
404 else {
405 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
406 remove = true;
407 }
408 }
409 }
[7237]410 if (remove) {
411 delete par;
412 it = _params.erase(it);
413 }
414 else {
415 ++it;
416 }
417 }
418
419 // Check whether parameters have observations
420 // ------------------------------------------
421 for (unsigned ii = 0; ii < _params.size(); ii++) {
422 t_pppParam* par = _params[ii];
423 if (par->prn() == 0) {
424 par->setLastObsTime(epoTime);
425 if (par->firstObsTime().undef()) {
426 par->setFirstObsTime(epoTime);
427 }
428 }
429 else {
430 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
431 const t_pppSatObs* satObs = obsVector[jj];
432 if (satObs->prn() == par->prn()) {
433 par->setLastObsTime(epoTime);
434 if (par->firstObsTime().undef()) {
435 par->setFirstObsTime(epoTime);
436 }
437 break;
438 }
439 }
440 }
441 }
442
[9419]443 // Check if ambiguity parameters have observations
444 // -----------------------------------------------
445 if (OPT->_obsModelType == OPT->DCMcodeBias ||
446 OPT->_obsModelType == OPT->DCMphaseBias) {
447 vector<t_pppParam*>::iterator it = _params.begin();
448 while (it != _params.end()) {
449 t_pppParam* par = *it;
450 bool remove = false;
451 if (par->type() == t_pppParam::amb && !par->lastObsTime().valid()) {
452 remove = true;
453 }
454 if (remove) {
455 delete par;
456 it = _params.erase(it);
457 }
458 else {
459 ++it;
460 }
461 }
462 }
463
464 // check which systems have observations
465 // -------------------------------------
466 _usedSystems.clear();
467 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
468 const t_pppSatObs* satObs = obsVector[jj];
469 char sys = satObs->prn().system();
470 if (!_usedSystems.contains(sys)) {
471 _usedSystems.append(sys);
472 }
473 }
474
475 if (_usedSystems.size() > 1 &&
476 !_usedSystems.contains('G')) { // required to setup ISB w. r. t. GPS
477 return failure;
478 }
479
[7237]480 // Required Set of Parameters
481 // --------------------------
482 vector<t_pppParam*> required;
483
484 // Coordinates
485 // -----------
486 required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
487 required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
488 required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
489
[9386]490 // Receiver Code Biases
491 // --------------------
492 if (OPT->_obsModelType == OPT->DCMcodeBias) {
[9419]493 if (_usedSystems.contains('G')) {
[9386]494 required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
495 required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
496 }
[9419]497 if (_usedSystems.contains('R')) {
[9386]498 required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
499 required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
500 }
[9419]501 if (_usedSystems.contains('E')) {
[9386]502 required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
503 required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
504 }
[9419]505 if (_usedSystems.contains('C')) {
[9386]506 required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
507 required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
508 }
509 }
510
511 // Receiver Phase Biases
512 // ---------------------
513 if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
514 (OPT->_obsModelType == OPT->PPPRTK) ) {
[9419]515 if (_usedSystems.contains('G')) {
[9386]516 required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
517 required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
518 }
[9419]519 if (_usedSystems.contains('R')) {
520 required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
521 required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
522 }
523 if (_usedSystems.contains('E')) {
[9386]524 required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
525 required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
526 }
[9419]527 if (_usedSystems.contains('C')) {
[9386]528 required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
529 required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
530 }
531 }
[9419]532
[7237]533 // Receiver Clock
534 // --------------
535 required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
536
[8905]537 // GPS-GLONASS Clock Offset
[7237]538 // ------------------------
[9419]539 if (_usedSystems.contains('G') && _usedSystems.contains('R')) {
[9288]540 required.push_back(new t_pppParam(t_pppParam::offGR, t_prn(), t_lc::dummy));
[7237]541 }
542
[9419]543 //GPS-Galileo Clock Offset
[9288]544 // ------------------------
[9419]545 if (_usedSystems.contains('G') && _usedSystems.contains('E')) {
[9288]546 required.push_back(new t_pppParam(t_pppParam::offGE, t_prn(), t_lc::dummy));
547 }
548
[8993]549 // GPS-BDS Clock Offset
550 // ------------------------
[9419]551 if (_usedSystems.contains('G') && _usedSystems.contains('C')) {
[9288]552 required.push_back(new t_pppParam(t_pppParam::offGC, t_prn(), t_lc::dummy));
[8993]553 }
554
[7237]555 // Troposphere
556 // -----------
557 if (OPT->estTrp()) {
558 required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
559 }
560
[8905]561 // Ionosphere
562 // ----------
563 if (OPT->_obsModelType == OPT->UncombPPP ||
564 OPT->_obsModelType == OPT->DCMcodeBias ||
565 OPT->_obsModelType == OPT->DCMphaseBias ) {
566 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
[9386]567 const t_pppSatObs* satObs = obsVector[jj];
[8905]568 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
569 }
570 }
[7237]571 // Ambiguities
572 // -----------
573 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
[9419]574 const t_pppSatObs* satObs = obsVector[jj];
[8905]575 if ((OPT->_obsModelType == OPT->IF) ||
576 (OPT->_obsModelType == OPT->PPPRTK) ||
577 (OPT->_obsModelType == OPT->UncombPPP) ||
578 (OPT->_obsModelType == OPT->DCMcodeBias && !satObs->isReference()) ||
579 (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference()) ) {
580 const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
581 for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
582 required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
583 }
[7237]584 }
585 }
586
587 // Check if all required parameters are present
588 // --------------------------------------------
589 for (unsigned ii = 0; ii < required.size(); ii++) {
590 t_pppParam* parReq = required[ii];
591
592 bool found = false;
593 for (unsigned jj = 0; jj < _params.size(); jj++) {
594 t_pppParam* parOld = _params[jj];
595 if (parOld->isEqual(parReq)) {
596 found = true;
597 break;
598 }
599 }
600 if (found) {
601 delete parReq;
602 }
603 else {
604 _params.push_back(parReq);
605 }
606 }
607
608 // Set Parameter Indices
609 // ---------------------
610 sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
611
612 for (unsigned ii = 0; ii < _params.size(); ii++) {
613 t_pppParam* par = _params[ii];
614 par->setIndex(ii);
615 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
616 const t_pppSatObs* satObs = obsVector[jj];
617 if (satObs->prn() == par->prn()) {
618 par->setAmbEleSat(satObs->eleSat());
619 par->stepAmbNumEpo();
620 }
621 }
622 }
623
624 return success;
625}
626
627//
628////////////////////////////////////////////////////////////////////////////
629void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
630 const ColumnVector& xx) const {
631
632 string epoTimeStr = string(epoTime);
633 const t_pppStation* sta = PPP_CLIENT->staRover();
634
635 LOG << endl;
636
637 t_pppParam* parX = 0;
638 t_pppParam* parY = 0;
639 t_pppParam* parZ = 0;
640 for (unsigned ii = 0; ii < _params.size(); ii++) {
641 t_pppParam* par = _params[ii];
642 if (par->type() == t_pppParam::crdX) {
643 parX = par;
644 }
645 else if (par->type() == t_pppParam::crdY) {
646 parY = par;
647 }
648 else if (par->type() == t_pppParam::crdZ) {
649 parZ = par;
650 }
651 else {
652 int ind = par->indexNew();
653 double apr = (par->type() == t_pppParam::trp) ?
654 t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
655 LOG << epoTimeStr << ' ' << par->toString() << ' '
656 << setw(10) << setprecision(4) << apr << ' '
657 << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
658 << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
659 if (par->type() == t_pppParam::amb) {
660 LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
661 << " epo = " << setw(4) << par->ambNumEpo();
662 }
663 LOG << endl;
664 }
665 }
666
667 if (parX && parY && parZ) {
668
669 ColumnVector xyz(3);
670 xyz[0] = xx[parX->indexNew()];
671 xyz[1] = xx[parY->indexNew()];
672 xyz[2] = xx[parZ->indexNew()];
673
674 ColumnVector neu(3);
675 xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
676
677 SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
678
679 SymmetricMatrix QQneu(3);
680 covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
681
682 LOG << epoTimeStr << ' ' << sta->name()
683 << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
684 << setprecision(4) << sqrt(QQxyz[0][0])
685
686 << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
687 << setprecision(4) << sqrt(QQxyz[1][1])
688
689 << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
690 << setprecision(4) << sqrt(QQxyz[2][2])
691
692 << " dN = " << setprecision(4) << neu[0] << " +- "
693 << setprecision(4) << sqrt(QQneu[0][0])
694
695 << " dE = " << setprecision(4) << neu[1] << " +- "
696 << setprecision(4) << sqrt(QQneu[1][1])
697
698 << " dU = " << setprecision(4) << neu[2] << " +- "
699 << setprecision(4) << sqrt(QQneu[2][2])
700
701 << endl;
702 }
703}
704
Note: See TracBrowser for help on using the repository browser.