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

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