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

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