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

Last change on this file since 10541 was 10389, checked in by stuerze, 9 months ago

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