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

Last change on this file since 10251 was 10251, checked in by stuerze, 5 months ago

changes regarding PPP: allow single frequency PPP and allow to select the frequency bands that are used

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 23.4 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 rClkG:
65 _epoSpec = true;
66 _sigma0 = OPT->_aprSigClk;
67 break;
68 case rClkR:
69 _epoSpec = true;
70 _sigma0 = OPT->_aprSigClk;
71 break;
72 case rClkE:
73 _epoSpec = true;
74 _sigma0 = OPT->_aprSigClk;
75 break;
76 case rClkC:
77 _epoSpec = true;
78 _sigma0 = OPT->_aprSigClk;
79 break;
80 case amb:
81 _epoSpec = false;
82 _sigma0 = OPT->_aprSigAmb;
83 _ambInfo = new t_ambInfo();
84 if (obsVector) {
85 for (unsigned ii = 0; ii < obsVector->size(); ii++) {
86 const t_pppSatObs* obs = obsVector->at(ii);
87 if (obs->prn() == _prn) {
88 _x0 = floor((obs->obsValue(tLC) - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
89 break;
90 }
91 }
92 }
93 break;
94 case trp:
95 _epoSpec = false;
96 _sigma0 = OPT->_aprSigTrp;
97 _noise = OPT->_noiseTrp;
98 break;
99 case ion:
100 _epoSpec = false;
101 _sigma0 = OPT->_aprSigIon;
102 _noise = OPT->_noiseIon;
103 break;
104 case cBiasG1: case cBiasR1: case cBiasE1: case cBiasC1:
105 case cBiasG2: case cBiasR2: case cBiasE2: case cBiasC2:
106 _epoSpec = false;
107 _sigma0 = OPT->_aprSigCodeBias;
108 _noise = OPT->_noiseCodeBias;
109 break;
110 case pBiasG1: case pBiasR1: case pBiasE1: case pBiasC1:
111 case pBiasG2: case pBiasR2: case pBiasE2: case pBiasC2:
112 _epoSpec = false;
113 _sigma0 = OPT->_aprSigPhaseBias;
114 _noise = OPT->_noisePhaseBias;
115 break;
116 }
117}
118
119// Destructor
120////////////////////////////////////////////////////////////////////////////
121t_pppParam::~t_pppParam() {
122 if (_ambInfo) {
123 delete _ambInfo;
124 }
125}
126//
127////////////////////////////////////////////////////////////////////////////
128double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
129 const t_lc::type& tLC) const {
130
131 // Special Case - Melbourne-Wuebbena
132 // ---------------------------------
133 if (tLC == t_lc::MW && _type != amb) {
134 return 0.0;
135 }
136
137 const t_pppStation* sta = PPP_CLIENT->staRover();
138 ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
139
140 map<t_frequency::type, double> codeCoeff;
141 map<t_frequency::type, double> phaseCoeff;
142 map<t_frequency::type, double> ionoCoeff;
143 obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
144
145 switch (_type) {
146 case crdX:
147 if (tLC == t_lc::GIM) {return 0.0;}
148 return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
149 case crdY:
150 if (tLC == t_lc::GIM) {return 0.0;}
151 return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
152 case crdZ:
153 if (tLC == t_lc::GIM) {return 0.0;}
154 return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
155 case rClkG:
156 if (tLC == t_lc::GIM) {return 0.0;}
157 return (obs->prn().system() == 'G') ? 1.0 : 0.0;
158 case rClkR:
159 if (tLC == t_lc::GIM) {return 0.0;}
160 return (obs->prn().system() == 'R') ? 1.0 : 0.0;
161 case rClkE:
162 if (tLC == t_lc::GIM) {return 0.0;}
163 return (obs->prn().system() == 'E') ? 1.0 : 0.0;
164 case rClkC:
165 if (tLC == t_lc::GIM) {return 0.0;}
166 return (obs->prn().system() == 'C') ? 1.0 : 0.0;
167 case amb:
168 if (tLC == t_lc::GIM) {
169 return 0.0;
170 }
171 else {
172 if (obs->prn() == _prn) {
173 if (tLC == _tLC) {
174 return (obs->lambda(tLC));
175 }
176 else if (tLC == t_lc::lIF && _tLC == t_lc::MW) {
177 return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2);
178 }
179 else {
180 if (_tLC == t_lc::l1) {
181 return obs->lambda(t_lc::l1) * phaseCoeff[obs->fType1()];
182 }
183 else if (_tLC == t_lc::l2) {
184 return obs->lambda(t_lc::l2) * phaseCoeff[obs->fType2()];
185 }
186 }
187 }
188 }
189 break;
190 case trp:
191 if (tLC == t_lc::GIM) {
192 return 0.0;
193 }
194 else {
195 return 1.0 / sin(obs->eleSat());
196 }
197 case ion:
198 if (obs->prn() == _prn) {
199 if (tLC == t_lc::c1) {
200 return ionoCoeff[obs->fType1()];
201 }
202 else if (tLC == t_lc::c2) {
203 return ionoCoeff[obs->fType2()];
204 }
205 else if (tLC == t_lc::l1) {
206 return ionoCoeff[obs->fType1()];
207 }
208 else if (tLC == t_lc::l2) {
209 return ionoCoeff[obs->fType2()];
210 }
211 else if (tLC == t_lc::GIM) {
212 return 1.0;
213 }
214 }
215 break;
216 case cBiasG1:
217 if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
218 break;
219 case cBiasR1:
220 if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
221 break;
222 case cBiasE1:
223 if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
224 break;
225 case cBiasC1:
226 if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
227 break;
228 case cBiasG2:
229 if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
230 break;
231 case cBiasR2:
232 if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
233 break;
234 case cBiasE2:
235 if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
236 break;
237 case cBiasC2:
238 if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
239 break;
240 case pBiasG1:
241 if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
242 break;
243 case pBiasR1:
244 if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
245 break;
246 case pBiasE1:
247 if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
248 break;
249 case pBiasC1:
250 if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
251 break;
252 case pBiasG2:
253 if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
254 break;
255 case pBiasR2:
256 if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
257 break;
258 case pBiasE2:
259 if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
260 break;
261 case pBiasC2:
262 if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
263 break;
264
265 }
266 return 0.0;
267}
268
269//
270////////////////////////////////////////////////////////////////////////////
271string t_pppParam::toString() const {
272 stringstream ss;
273 switch (_type) {
274 case crdX:
275 ss << "CRD_X";
276 break;
277 case crdY:
278 ss << "CRD_Y";
279 break;
280 case crdZ:
281 ss << "CRD_Z";
282 break;
283 case rClkG:
284 ss << "REC_CLK G ";
285 break;
286 case rClkR:
287 ss << "REC_CLK R ";
288 break;
289 case rClkE:
290 ss << "REC_CLK E ";
291 break;
292 case rClkC:
293 ss << "REC_CLK C ";
294 break;
295 case trp:
296 ss << "TRP ";
297 break;
298 case amb:
299 ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
300 break;
301 case ion:
302 ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
303 break;
304 case cBiasG1: case pBiasG1:
305 case cBiasG2: case pBiasG2:
306 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
307 break;
308 case cBiasR1: case pBiasR1:
309 case cBiasR2: case pBiasR2:
310 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
311 break;
312 case cBiasE1: case pBiasE1:
313 case cBiasE2: case pBiasE2:
314 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
315 break;
316 case cBiasC1: case pBiasC1:
317 case cBiasC2: case pBiasC2:
318 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
319 break;
320 }
321 return ss.str();
322}
323
324// Constructor
325////////////////////////////////////////////////////////////////////////////
326t_pppParlist::t_pppParlist() {
327}
328
329// Destructor
330////////////////////////////////////////////////////////////////////////////
331t_pppParlist::~t_pppParlist() {
332 _usedSystems.clear();
333
334 for (unsigned ii = 0; ii < _params.size(); ii++) {
335 delete _params[ii];
336 }
337}
338
339//
340////////////////////////////////////////////////////////////////////////////
341t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector) {
342
343 // Remove some Parameters
344 // ----------------------
345 vector<t_pppParam*>::iterator it = _params.begin();
346 while (it != _params.end()) {
347 t_pppParam* par = *it;
348
349 bool remove = false;
350
351 if (par->epoSpec()) {
352 remove = true;
353 }
354
355 else if (par->type() == t_pppParam::amb ||
356 par->type() == t_pppParam::crdX ||
357 par->type() == t_pppParam::crdY ||
358 par->type() == t_pppParam::crdZ) {
359 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
360 remove = true;
361 }
362 }
363 else if (par->type() == t_pppParam::ion) {
364 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 5.0)) {
365 remove = true;
366 }
367}
368
369 if (remove) {
370#ifdef BNC_DEBUG_PPP
371// LOG << "remove0 " << par->toString() << std::endl;
372#endif
373 delete par;
374 it = _params.erase(it);
375 }
376 else {
377 ++it;
378 }
379 }
380
381 // check which systems have observations
382 // -------------------------------------
383 _usedSystems.clear();
384 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
385 const t_pppSatObs* satObs = obsVector[jj];
386 char sys = satObs->prn().system();
387 if (!_usedSystems.contains(sys)) {
388 _usedSystems.append(sys);
389 }
390 }
391
392 // Check whether parameters have observations
393 // ------------------------------------------
394 for (unsigned ii = 0; ii < _params.size(); ii++) {
395 t_pppParam* par = _params[ii];
396 if (par->prn() == 0) {
397 par->setLastObsTime(epoTime);
398 if (par->firstObsTime().undef()) {
399 par->setFirstObsTime(epoTime);
400 }
401 }
402 else {
403 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
404 const t_pppSatObs* satObs = obsVector[jj];
405 if (satObs->prn() == par->prn()) {
406 par->setLastObsTime(epoTime);
407 if (par->firstObsTime().undef()) {
408 par->setFirstObsTime(epoTime);
409 }
410 break;
411 }
412 }
413 }
414 }
415
416 if (OPT->_ionoModelType == OPT->PPP_RTK || OPT->_pseudoObsIono) {
417 vector<t_pppParam*>::iterator it = _params.begin();
418 while (it != _params.end()) {
419 t_pppParam* par = *it;
420 // Check if systems have to be presented per biases
421 // ----------------------------------------------
422 if (( par->type() == t_pppParam::cBiasG1 ||
423 par->type() == t_pppParam::cBiasG2 ||
424 par->type() == t_pppParam::pBiasG1 ||
425 par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('G')) {
426#ifdef BNC_DEBUG_PPP
427 //LOG << "remove1 " << par->toString() << std::endl;
428#endif
429 delete par;
430 it = _params.erase(it);
431 }
432 else if ((par->type() == t_pppParam::cBiasR1 ||
433 par->type() == t_pppParam::cBiasR2 ||
434 par->type() == t_pppParam::pBiasR1 ||
435 par->type() == t_pppParam::pBiasR2) && !usedSystems().contains('R')) {
436#ifdef BNC_DEBUG_PPP
437 //LOG << "remove1 " << par->toString() << std::endl;
438#endif
439 delete par;
440 it = _params.erase(it);
441 }
442 else if ((par->type() == t_pppParam::cBiasE1 ||
443 par->type() == t_pppParam::cBiasE2 ||
444 par->type() == t_pppParam::pBiasE1 ||
445 par->type() == t_pppParam::pBiasE2) && !usedSystems().contains('E')) {
446#ifdef BNC_DEBUG_PPP
447 //LOG << "remove1 " << par->toString() << std::endl;
448#endif
449 delete par;
450 it = _params.erase(it);
451 }
452 else if ((par->type() == t_pppParam::cBiasC1 ||
453 par->type() == t_pppParam::cBiasC2 ||
454 par->type() == t_pppParam::pBiasC1 ||
455 par->type() == t_pppParam::pBiasC2) && !usedSystems().contains('C')) {
456#ifdef BNC_DEBUG_PPP
457 //LOG << "remove1 " << par->toString() << std::endl;
458#endif
459 delete par;
460 it = _params.erase(it);
461 }
462 else {
463 ++it;
464 }
465 }
466 }
467
468 // Required Set of Parameters
469 // --------------------------
470 vector<t_pppParam*> required;
471
472 // Coordinates
473 // -----------
474 required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
475 required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
476 required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
477
478 // Receiver Clocks
479 // ---------------
480 if (_usedSystems.contains('G')) {
481 required.push_back(new t_pppParam(t_pppParam::rClkG, t_prn(), t_lc::dummy));
482 }
483
484 if (_usedSystems.contains('R')) {
485 required.push_back(new t_pppParam(t_pppParam::rClkR, t_prn(), t_lc::dummy));
486 }
487
488 if (_usedSystems.contains('E')) {
489 required.push_back(new t_pppParam(t_pppParam::rClkE, t_prn(), t_lc::dummy));
490 }
491
492 if (_usedSystems.contains('C')) {
493 required.push_back(new t_pppParam(t_pppParam::rClkC, t_prn(), t_lc::dummy));
494 }
495
496 // Troposphere
497 // -----------
498 if (OPT->estTrp()) {
499 required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
500 }
501
502 // Ionosphere
503 // ----------
504 if (OPT->_ionoModelType == OPT->est) {
505 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
506 const t_pppSatObs* satObs = obsVector[jj];
507 char sys = satObs->prn().system();
508 std::vector<t_lc::type> LCs = OPT->LCs(sys);
509 if (std::find(LCs.begin(), LCs.end(), t_lc::cIF) == LCs.end() &&
510 std::find(LCs.begin(), LCs.end(), t_lc::lIF) == LCs.end()) {
511 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
512 }
513 }
514 }
515 // Ambiguities
516 // -----------
517 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
518 const t_pppSatObs* satObs = obsVector[jj];
519 char sys = satObs->prn().system();
520 const vector<t_lc::type>& ambLCs = OPT->ambLCs(sys);
521 for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
522 required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
523 }
524 }
525
526 // Receiver Code Biases
527 // --------------------
528 if (OPT->_ionoModelType == OPT->PPP_RTK) {
529 std::vector<t_lc::type> lc;
530 if (_usedSystems.contains('G')) {
531 lc = OPT->LCs('G');
532 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
533 required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
534 }
535 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
536 required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
537 }
538 }
539 if (_usedSystems.contains('R')) {
540 lc = OPT->LCs('R');
541 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
542 required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
543 }
544 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
545 required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
546 }
547 }
548 if (_usedSystems.contains('E')) {
549 lc = OPT->LCs('E');
550 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
551 required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
552 }
553 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
554 required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
555 }
556 }
557 if (_usedSystems.contains('C')) {
558 lc = OPT->LCs('C');
559 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
560 required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
561 }
562 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
563 required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
564 }
565 }
566 }
567 if (OPT->_pseudoObsIono) {
568 std::vector<t_lc::type> lc;
569 if (_usedSystems.contains('G')) {
570 lc = OPT->LCs('G');
571 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
572 required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
573 }
574 }
575 if (_usedSystems.contains('R')) {
576 lc = OPT->LCs('R');
577 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
578 required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
579 }
580 }
581 if (_usedSystems.contains('E')) {
582 lc = OPT->LCs('E');
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::c2) != lc.end()) {
590 required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
591 }
592 }
593 }
594
595 // Receiver Phase Biases
596 // ---------------------
597 if (OPT->_ionoModelType == OPT->PPP_RTK) {
598 std::vector<t_lc::type> lc;
599 if (_usedSystems.contains('G')) {
600 lc = OPT->LCs('G');
601 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
602 required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
603 }
604 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
605 required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
606 }
607 }
608 if (_usedSystems.contains('R')) {
609 lc = OPT->LCs('R');
610 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
611 required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
612 }
613 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
614 required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
615 }
616 }
617 if (_usedSystems.contains('E')) {
618 lc = OPT->LCs('E');
619 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
620 required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
621 }
622 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
623 required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
624 }
625 }
626 if (_usedSystems.contains('C')) {
627 lc = OPT->LCs('C');
628 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
629 required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
630 }
631 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
632 required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
633 }
634 }
635 }
636
637 // Check if all required parameters are present
638 // --------------------------------------------
639 for (unsigned ii = 0; ii < required.size(); ii++) {
640 t_pppParam* parReq = required[ii];
641
642 bool found = false;
643 for (unsigned jj = 0; jj < _params.size(); jj++) {
644 t_pppParam* parOld = _params[jj];
645 if (parOld->isEqual(parReq)) {
646 found = true;
647 break;
648 }
649 }
650 if (found) {
651 delete parReq;
652 }
653 else {
654#ifdef BNC_DEBUG_PPP
655 //LOG << "push_back parReq " << parReq->toString() << std::endl;
656#endif
657 _params.push_back(parReq);
658 }
659 }
660
661 // Set Parameter Indices
662 // ---------------------
663 sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
664
665 for (unsigned ii = 0; ii < _params.size(); ii++) {
666 t_pppParam* par = _params[ii];
667 par->setIndex(ii);
668 for (unsigned jj = 0; jj < obsVector.size(); jj++) {
669 const t_pppSatObs* satObs = obsVector[jj];
670 if (satObs->prn() == par->prn()) {
671 par->setAmbEleSat(satObs->eleSat());
672 par->stepAmbNumEpo();
673 }
674 }
675 }
676
677 return success;
678}
679
680//
681////////////////////////////////////////////////////////////////////////////
682void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
683 const ColumnVector& xx) const {
684
685 string epoTimeStr = string(epoTime);
686 const t_pppStation* sta = PPP_CLIENT->staRover();
687
688 LOG << endl;
689
690 t_pppParam* parX = 0;
691 t_pppParam* parY = 0;
692 t_pppParam* parZ = 0;
693 for (unsigned ii = 0; ii < _params.size(); ii++) {
694 t_pppParam* par = _params[ii];
695 if (par->type() == t_pppParam::crdX) {
696 parX = par;
697 }
698 else if (par->type() == t_pppParam::crdY) {
699 parY = par;
700 }
701 else if (par->type() == t_pppParam::crdZ) {
702 parZ = par;
703 }
704 else {
705 int ind = par->indexNew();
706 double apr = (par->type() == t_pppParam::trp) ?
707 t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
708 LOG << epoTimeStr << ' ' << par->toString() << ' '
709 << setw(10) << setprecision(4) << apr << ' '
710 << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
711 << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
712 if (par->type() == t_pppParam::amb) {
713 LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
714 << " epo = " << setw(4) << par->ambNumEpo();
715 }
716 LOG << endl;
717 }
718 }
719
720 if (parX && parY && parZ) {
721
722 ColumnVector xyz(3);
723 xyz[0] = xx[parX->indexNew()];
724 xyz[1] = xx[parY->indexNew()];
725 xyz[2] = xx[parZ->indexNew()];
726
727 ColumnVector neu(3);
728 xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
729
730 SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
731
732 SymmetricMatrix QQneu(3);
733 covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
734
735 LOG << epoTimeStr << ' ' << sta->name()
736 << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
737 << setprecision(4) << sqrt(QQxyz[0][0])
738
739 << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
740 << setprecision(4) << sqrt(QQxyz[1][1])
741
742 << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
743 << setprecision(4) << sqrt(QQxyz[2][2])
744
745 << " dN = " << setprecision(4) << neu[0] << " +- "
746 << setprecision(4) << sqrt(QQneu[0][0])
747
748 << " dE = " << setprecision(4) << neu[1] << " +- "
749 << setprecision(4) << sqrt(QQneu[1][1])
750
751 << " dU = " << setprecision(4) << neu[2] << " +- "
752 << setprecision(4) << sqrt(QQneu[2][2])
753
754 << endl;
755 }
756 return;
757}
758
759//
760////////////////////////////////////////////////////////////////////////////
761void t_pppParlist::printParams(const bncTime& epoTime) {
762
763 for (unsigned iPar = 0; iPar < _params.size(); iPar++) {
764 LOG << _params[iPar]->toString()
765 << "\t lastObsTime().valid() \t" << _params[iPar]->lastObsTime().valid()
766 << "\t epoTime - par->lastObsTime() \t" << (epoTime - _params[iPar]->lastObsTime())
767 << endl;
768 }
769}
770
Note: See TracBrowser for help on using the repository browser.