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

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