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

Last change on this file since 10589 was 10584, checked in by stuerze, 4 days ago

changed in PPP mode from common receiver clock + ISBs to system specific receiver clocks

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