source: ntrip/trunk/BNC/src/PPP/pppClient.cpp@ 8961

Last change on this file since 8961 was 8961, checked in by stuerze, 4 years ago

PPP update: pseudo obs tropo added

  • 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.5 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: t_pppClient
6 *
7 * Purpose: PPP Client processing starts here
8 *
9 * Author: L. Mervart
10 *
11 * Created: 29-Jul-2014
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include <QThreadStorage>
18
19#include <iostream>
20#include <iomanip>
21#include <cmath>
22#include <stdlib.h>
23#include <string.h>
24#include <stdexcept>
25
26#include "pppClient.h"
27#include "pppEphPool.h"
28#include "pppObsPool.h"
29#include "bncconst.h"
30#include "bncutils.h"
31#include "pppStation.h"
32#include "bncantex.h"
33#include "pppFilter.h"
34
35using namespace BNC_PPP;
36using namespace std;
37
38// Global variable holding thread-specific pointers
39//////////////////////////////////////////////////////////////////////////////
40QThreadStorage<t_pppClient*> CLIENTS;
41
42// Static function returning thread-specific pointer
43//////////////////////////////////////////////////////////////////////////////
44t_pppClient* t_pppClient::instance() {
45 return CLIENTS.localData();
46}
47
48// Constructor
49//////////////////////////////////////////////////////////////////////////////
50t_pppClient::t_pppClient(const t_pppOptions* opt) {
51 _output = 0;
52 _opt = new t_pppOptions(*opt);
53 _log = new ostringstream();
54 _ephPool = new t_pppEphPool();
55 _obsPool = new t_pppObsPool();
56 _staRover = new t_pppStation();
57 _filter = new t_pppFilter(_obsPool);
58 _tides = new t_tides();
59 _antex = 0;
60 if (!_opt->_antexFileName.empty()) {
61 _antex = new bncAntex(_opt->_antexFileName.c_str());
62 }
63 if (!_opt->_blqFileName.empty()) {
64 if (_tides->readBlqFile(_opt->_blqFileName.c_str()) == success) {
65 //_tides->printAllBlqSets();
66 }
67 }
68
69 if (_opt->_refSatRequired) {
70 for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
71 char system = _opt->systems()[iSys];
72 _obsPool->initRefSatMapElement(system);
73 }
74 }
75 _offGG = 0.0;
76 CLIENTS.setLocalData(this); // CLIENTS takes ownership over "this"
77}
78
79// Destructor
80//////////////////////////////////////////////////////////////////////////////
81t_pppClient::~t_pppClient() {
82 delete _log;
83 delete _opt;
84 delete _filter;
85 delete _ephPool;
86 delete _obsPool;
87 delete _staRover;
88 if (_antex) {
89 delete _antex;
90 }
91 delete _tides;
92 clearObs();
93}
94
95//
96//////////////////////////////////////////////////////////////////////////////
97void t_pppClient::putEphemeris(const t_eph* eph) {
98 const t_ephGPS* ephGPS = dynamic_cast<const t_ephGPS*>(eph);
99 const t_ephGlo* ephGlo = dynamic_cast<const t_ephGlo*>(eph);
100 const t_ephGal* ephGal = dynamic_cast<const t_ephGal*>(eph);
101 const t_ephBDS* ephBDS = dynamic_cast<const t_ephBDS*>(eph);
102 if (ephGPS) {
103 _ephPool->putEphemeris(new t_ephGPS(*ephGPS));
104 }
105 else if (ephGlo) {
106 _ephPool->putEphemeris(new t_ephGlo(*ephGlo));
107 }
108 else if (ephGal) {
109 _ephPool->putEphemeris(new t_ephGal(*ephGal));
110 }
111 else if (ephBDS) {
112 _ephPool->putEphemeris(new t_ephBDS(*ephBDS));
113 }
114}
115
116//
117//////////////////////////////////////////////////////////////////////////////
118void t_pppClient::putTec(const t_vTec* vTec) {
119 _obsPool->putTec(new t_vTec(*vTec));
120}
121
122//
123//////////////////////////////////////////////////////////////////////////////
124void t_pppClient::putOrbCorrections(const vector<t_orbCorr*>& corr) {
125 for (unsigned ii = 0; ii < corr.size(); ii++) {
126 _ephPool->putOrbCorrection(new t_orbCorr(*corr[ii]));
127 }
128}
129
130//
131//////////////////////////////////////////////////////////////////////////////
132void t_pppClient::putClkCorrections(const vector<t_clkCorr*>& corr) {
133 for (unsigned ii = 0; ii < corr.size(); ii++) {
134 _ephPool->putClkCorrection(new t_clkCorr(*corr[ii]));
135 }
136}
137
138//
139//////////////////////////////////////////////////////////////////////////////
140void t_pppClient::putCodeBiases(const vector<t_satCodeBias*>& biases) {
141 for (unsigned ii = 0; ii < biases.size(); ii++) {
142 _obsPool->putCodeBias(new t_satCodeBias(*biases[ii]));
143 }
144}
145
146//
147//////////////////////////////////////////////////////////////////////////////
148void t_pppClient::putPhaseBiases(const vector<t_satPhaseBias*>& biases) {
149 for (unsigned ii = 0; ii < biases.size(); ii++) {
150 _obsPool->putPhaseBias(new t_satPhaseBias(*biases[ii]));
151 }
152}
153
154//
155//////////////////////////////////////////////////////////////////////////////
156t_irc t_pppClient::prepareObs(const vector<t_satObs*>& satObs,
157 vector<t_pppSatObs*>& obsVector, bncTime& epoTime) {
158
159 // Default
160 // -------
161 epoTime.reset();
162 clearObs();
163
164 // Create vector of valid observations
165 // -----------------------------------
166 for (unsigned ii = 0; ii < satObs.size(); ii++) {
167 char system = satObs[ii]->_prn.system();
168 if (_opt->useSystem(system)) {
169 t_pppSatObs* pppSatObs = new t_pppSatObs(*satObs[ii]);
170 if (pppSatObs->isValid()) {
171 obsVector.push_back(pppSatObs);
172 }
173 else {
174 delete pppSatObs;
175 }
176 }
177 }
178
179 // Check whether data are synchronized, compute epoTime
180 // ----------------------------------------------------
181 const double MAXSYNC = 0.05; // synchronization limit
182 double meanDt = 0.0;
183 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
184 const t_pppSatObs* satObs = obsVector.at(ii);
185 if (epoTime.undef()) {
186 epoTime = satObs->time();
187 }
188 else {
189 double dt = satObs->time() - epoTime;
190 if (fabs(dt) > MAXSYNC) {
191 LOG << "t_pppClient::prepareObs asynchronous observations" << endl;
192 return failure;
193 }
194 meanDt += dt;
195 }
196 }
197
198 if (obsVector.size() > 0) {
199 epoTime += meanDt / obsVector.size();
200 }
201
202 return success;
203}
204
205//
206//////////////////////////////////////////////////////////////////////////////
207bool t_pppClient::preparePseudoObs(std::vector<t_pppSatObs*>& obsVector) {
208
209 bool pseudoObsIono = false;
210
211 if (_opt->_pseudoObsIono) {
212 vector<t_pppSatObs*>::iterator it = obsVector.begin();
213 while (it != obsVector.end()) {
214 t_pppSatObs* satObs = *it;
215 char system = satObs->prn().system();
216 t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system);
217 double stecRef = refSat->stecValue();
218 if (stecRef && !satObs->isReference()) {
219 pseudoObsIono = true;
220 satObs->setPseudoObsIono(t_frequency::G1, stecRef);
221 }
222 it++;
223 }
224 }
225 if (_opt->_pseudoObsTropo) {
226 vector<t_pppSatObs*>::iterator it = obsVector.begin();
227 while (it != obsVector.end()) {
228 t_pppSatObs* satObs = *it;
229 if (satObs->isReference()) {
230 satObs->setPseudoObsTropo();
231 }
232 it++;
233 }
234 }
235/*
236 vector<t_pppSatObs*>::iterator it = obsVector.begin();
237 while (it != obsVector.end()) {
238 t_pppSatObs* satObs = *it;
239 satObs->printObsMinusComputed();
240 it++;
241 }
242*/
243 return pseudoObsIono;
244}
245
246// Compute the Bancroft position, check for blunders
247//////////////////////////////////////////////////////////////////////////////
248t_irc t_pppClient::cmpBancroft(const bncTime& epoTime,
249 vector<t_pppSatObs*>& obsVector,
250 ColumnVector& xyzc, bool print) {
251
252 t_lc::type tLC = t_lc::dummy;
253
254 while (true) {
255 Matrix BB(obsVector.size(), 4);
256 int iObs = -1;
257 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
258 const t_pppSatObs* satObs = obsVector.at(ii);
259 if (tLC == t_lc::dummy) {
260 if (satObs->isValid(t_lc::cIF)) {
261 tLC = t_lc::cIF;
262 }
263 else if (satObs->isValid(t_lc::c1)) {
264 tLC = t_lc::c1;
265 }
266 else if (satObs->isValid(t_lc::c2)) {
267 tLC = t_lc::c2;
268 }
269 }
270 if ( satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
271 ++iObs;
272 BB[iObs][0] = satObs->xc()[0];
273 BB[iObs][1] = satObs->xc()[1];
274 BB[iObs][2] = satObs->xc()[2];
275 BB[iObs][3] = satObs->obsValue(tLC) - satObs->cmpValueForBanc(tLC);
276 }
277 }
278 if (iObs + 1 < _opt->_minObs) {
279 LOG << "t_pppClient::cmpBancroft not enough observations" << endl;
280 return failure;
281 }
282 BB = BB.Rows(1,iObs+1);
283 bancroft(BB, xyzc);
284
285 xyzc[3] /= t_CST::c;
286
287 // Check Blunders
288 // --------------
289 const double BLUNDER = 100.0;
290 double maxRes = 0.0;
291 unsigned maxResIndex = 0;
292 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
293 const t_pppSatObs* satObs = obsVector.at(ii);
294 if (satObs->isValid() &&
295 satObs->prn().system() == 'G' &&
296 (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
297 ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3);
298 double res = rr.NormFrobenius() - satObs->obsValue(tLC)
299 - (satObs->xc()[3] - xyzc[3]) * t_CST::c;
300 if (std::isnan(res) || fabs(res) > maxRes) {
301 std::isnan(res) ?
302 maxRes = res :
303 maxRes = fabs(res);
304 maxResIndex = ii;
305 }
306 }
307 }
308 if (!std::isnan(maxRes) && maxRes < BLUNDER) {
309 if (print) {
310 LOG.setf(ios::fixed);
311 LOG << string(epoTime) << " BANCROFT:" << ' '
312 << setw(14) << setprecision(3) << xyzc[0] << ' '
313 << setw(14) << setprecision(3) << xyzc[1] << ' '
314 << setw(14) << setprecision(3) << xyzc[2] << ' '
315 << setw(14) << setprecision(3) << xyzc[3] * t_CST::c << endl << endl;
316 }
317 break;
318 }
319 else {
320 t_pppSatObs* satObs = obsVector.at(maxResIndex);
321 LOG << "t_pppClient::cmpBancroft outlier " << satObs->prn().toString()
322 << " " << maxRes << endl;
323 delete satObs;
324 obsVector.erase(obsVector.begin() + maxResIndex);
325 }
326 }
327
328 return success;
329}
330
331// Compute A Priori GPS-Glonass Offset
332//////////////////////////////////////////////////////////////////////////////
333double t_pppClient::cmpOffGG(vector<t_pppSatObs*>& obsVector) {
334
335 t_lc::type tLC = t_lc::dummy;
336 double offGG = 0.0;
337
338 if (_opt->useSystem('R')) {
339 while (obsVector.size() > 0) {
340 offGG = 0.0;
341 double maxRes = 0.0;
342 int maxResIndex = -1;
343 t_prn maxResPrn;
344 unsigned nObs = 0;
345 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
346 const t_pppSatObs* satObs = obsVector.at(ii);
347 if (satObs->prn().system() == 'R') {
348 if (tLC == t_lc::dummy) {
349 tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
350 }
351 if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
352 double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
353 ++nObs;
354 offGG += ll;
355 if (fabs(ll) > fabs(maxRes)) {
356 maxRes = ll;
357 maxResIndex = ii;
358 maxResPrn = satObs->prn();
359 }
360 }
361 }
362 }
363
364 if (nObs > 0) {
365 offGG = offGG / nObs;
366 }
367 else {
368 offGG = 0.0;
369 }
370
371 if (fabs(maxRes) > 1000.0) {
372 LOG << "t_pppClient::cmpOffGG outlier " << maxResPrn.toString() << " " << maxRes << endl;
373 delete obsVector.at(maxResIndex);
374 obsVector.erase(obsVector.begin() + maxResIndex);
375 }
376 else {
377 break;
378 }
379 }
380 }
381 return offGG;
382}
383
384//
385//////////////////////////////////////////////////////////////////////////////
386void t_pppClient::initOutput(t_output* output) {
387 _output = output;
388 _output->_numSat = 0;
389 _output->_hDop = 0.0;
390 _output->_error = false;
391}
392
393//
394//////////////////////////////////////////////////////////////////////////////
395void t_pppClient::clearObs() {
396 for (unsigned ii = 0; ii < _obsRover.size(); ii++) {
397 delete _obsRover.at(ii);
398 }
399 _obsRover.clear();
400}
401
402//
403//////////////////////////////////////////////////////////////////////////////
404void t_pppClient::finish(t_irc irc) {
405
406 clearObs();
407
408 _output->_epoTime = _epoTimeRover;
409
410 if (irc == success) {
411 _output->_xyzRover[0] = _staRover->xyzApr()[0] + _filter->x()[0];
412 _output->_xyzRover[1] = _staRover->xyzApr()[1] + _filter->x()[1];
413 _output->_xyzRover[2] = _staRover->xyzApr()[2] + _filter->x()[2];
414
415 xyz2neu(_staRover->ellApr().data(), _filter->x().data(), _output->_neu);
416
417 copy(&_filter->Q().data()[0], &_filter->Q().data()[6], _output->_covMatrix);
418
419 _output->_trp0 = t_tropo::delay_saast(_staRover->xyzApr(), M_PI/2.0);
420 _output->_trp = _filter->trp();
421 _output->_trpStdev = _filter->trpStdev();
422
423 _output->_numSat = _filter->numSat();
424 _output->_hDop = _filter->HDOP();
425 _output->_error = false;
426 }
427 else {
428 _output->_error = true;
429 }
430 _output->_log = _log->str();
431 delete _log; _log = new ostringstream();
432}
433
434//
435//////////////////////////////////////////////////////////////////////////////
436t_irc t_pppClient::cmpModel(t_pppStation* station, const ColumnVector& xyzc,
437 vector<t_pppSatObs*>& obsVector) {
438 bncTime time;
439 time = _epoTimeRover;
440 station->setName(_opt->_roverName);
441 station->setAntName(_opt->_antNameRover);
442 station->setEpochTime(time);
443 if (_opt->xyzAprRoverSet()) {
444 station->setXyzApr(_opt->_xyzAprRover);
445 }
446 else {
447 station->setXyzApr(xyzc.Rows(1,3));
448 }
449 station->setNeuEcc(_opt->_neuEccRover);
450
451 // Receiver Clock
452 // --------------
453 station->setDClk(xyzc[3]);
454
455 // Tides
456 // -----
457 station->setTideDsplEarth(_tides->earth(time, station->xyzApr()));
458 station->setTideDsplOcean(_tides->ocean(time, station->xyzApr(), station->name()));
459
460 // Observation model
461 // -----------------
462 vector<t_pppSatObs*>::iterator it = obsVector.begin();
463 while (it != obsVector.end()) {
464 t_pppSatObs* satObs = *it;
465 t_irc modelSetup;
466 if (satObs->isValid()) {
467 modelSetup = satObs->cmpModel(station);
468 }
469 if (satObs->isValid() &&
470 satObs->eleSat() >= _opt->_minEle &&
471 modelSetup == success) {
472 ++it;
473 }
474 else {
475 delete satObs;
476 it = obsVector.erase(it);
477 }
478 }
479
480 return success;
481}
482
483//
484//////////////////////////////////////////////////////////////////////////////
485void t_pppClient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) {
486
487 _historicalRefSats.clear();
488 try {
489 initOutput(output);
490 int num = 0;
491 bool epochReProcessing = false;
492
493 do {
494 num++;
495 if (num == 1) {
496 LOG << "\nPPP of Epoch ";
497 if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
498 LOG << "\n---------------------------------------------------------------\n";
499 }
500
501 // Prepare Observations of the Rover
502 // ---------------------------------
503 if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
504 return finish(failure);
505 }
506
507 for (int iter = 1; iter <= 2; iter++) {
508 ColumnVector xyzc(4); xyzc = 0.0;
509 bool print = (iter == 2);
510 if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
511 return finish(failure);
512 }
513 if (cmpModel(_staRover, xyzc, _obsRover) != success) {
514 return finish(failure);
515 }
516 }
517
518 _offGG = cmpOffGG(_obsRover);
519
520 if (_opt->_refSatRequired) {
521 setRefSatellites(_obsRover);
522 LOG.setf(ios::fixed);
523 QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
524 while (it.hasNext()) {
525 it.next();
526 char sys = it.key();
527 string prn = it.value()->prn().toString();
528 if (num == 1) {
529 LOG << "set ";
530 }
531 else {
532 LOG << "reset ";
533 }
534 LOG << string(_epoTimeRover) << " REFSAT " << sys << ": " << prn << endl;
535 }
536 }
537
538
539 // Prepare Pseudo Observations of the Rover
540 // ----------------------------------------
541 _pseudoObsIono = preparePseudoObs(_obsRover);
542
543 if (int(_obsRover.size()) < _opt->_minObs) {
544 LOG << "t_pppClient::processEpoch not enough observations" << endl;
545 return finish(failure);
546 }
547
548
549 // Store last epoch of data
550 // ------------------------
551 _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono);
552 _obsPool->setHistoricalRefSatList(_historicalRefSats);
553
554 // Process Epoch in Filter
555 // -----------------------
556 if (_filter->processEpoch(num) != success) {
557 return finish(failure);
558 }
559
560 // Epoch re-processing required?
561 // -----------------------------
562 if (_obsPool->refSatChangeRequired()) {
563 epochReProcessing = true;
564 _obsPool->deleteLastEpoch();
565 QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
566 while (it.hasNext()) {
567 it.next();
568 _historicalRefSats.append(it.value()->prn());
569 }
570 }
571 else {
572 epochReProcessing = false;
573
574 }
575 } while (epochReProcessing);
576 }
577 catch (Exception& exc) {
578 LOG << exc.what() << endl;
579 return finish(failure);
580 }
581 catch (t_except msg) {
582 LOG << msg.what() << endl;
583 return finish(failure);
584 }
585 catch (const char* msg) {
586 LOG << msg << endl;
587 return finish(failure);
588 }
589 catch (...) {
590 LOG << "unknown exception" << endl;
591 return finish(failure);
592 }
593
594 return finish(success);
595}
596
597//
598////////////////////////////////////////////////////////////////////////////
599double lorentz(const ColumnVector& aa, const ColumnVector& bb) {
600 return aa[0]*bb[0] + aa[1]*bb[1] + aa[2]*bb[2] - aa[3]*bb[3];
601}
602
603//
604////////////////////////////////////////////////////////////////////////////
605void t_pppClient::bancroft(const Matrix& BBpass, ColumnVector& pos) {
606
607 if (pos.Nrows() != 4) {
608 pos.ReSize(4);
609 }
610 pos = 0.0;
611
612 for (int iter = 1; iter <= 2; iter++) {
613 Matrix BB = BBpass;
614 int mm = BB.Nrows();
615 for (int ii = 1; ii <= mm; ii++) {
616 double xx = BB(ii,1);
617 double yy = BB(ii,2);
618 double traveltime = 0.072;
619 if (iter > 1) {
620 double zz = BB(ii,3);
621 double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) +
622 (yy-pos(2)) * (yy-pos(2)) +
623 (zz-pos(3)) * (zz-pos(3)) );
624 traveltime = rho / t_CST::c;
625 }
626 double angle = traveltime * t_CST::omega;
627 double cosa = cos(angle);
628 double sina = sin(angle);
629 BB(ii,1) = cosa * xx + sina * yy;
630 BB(ii,2) = -sina * xx + cosa * yy;
631 }
632
633 Matrix BBB;
634 if (mm > 4) {
635 SymmetricMatrix hlp; hlp << BB.t() * BB;
636 BBB = hlp.i() * BB.t();
637 }
638 else {
639 BBB = BB.i();
640 }
641 ColumnVector ee(mm); ee = 1.0;
642 ColumnVector alpha(mm); alpha = 0.0;
643 for (int ii = 1; ii <= mm; ii++) {
644 alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0;
645 }
646 ColumnVector BBBe = BBB * ee;
647 ColumnVector BBBalpha = BBB * alpha;
648 double aa = lorentz(BBBe, BBBe);
649 double bb = lorentz(BBBe, BBBalpha)-1;
650 double cc = lorentz(BBBalpha, BBBalpha);
651 double root = sqrt(bb*bb-aa*cc);
652
653 Matrix hlpPos(4,2);
654 hlpPos.Column(1) = (-bb-root)/aa * BBBe + BBBalpha;
655 hlpPos.Column(2) = (-bb+root)/aa * BBBe + BBBalpha;
656
657 ColumnVector omc(2);
658 for (int pp = 1; pp <= 2; pp++) {
659 hlpPos(4,pp) = -hlpPos(4,pp);
660 omc(pp) = BB(1,4) -
661 sqrt( (BB(1,1)-hlpPos(1,pp)) * (BB(1,1)-hlpPos(1,pp)) +
662 (BB(1,2)-hlpPos(2,pp)) * (BB(1,2)-hlpPos(2,pp)) +
663 (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) -
664 hlpPos(4,pp);
665 }
666 if ( fabs(omc(1)) > fabs(omc(2)) ) {
667 pos = hlpPos.Column(2);
668 }
669 else {
670 pos = hlpPos.Column(1);
671 }
672 }
673}
674
675//
676//////////////////////////////////////////////////////////////////////////////
677void t_pppClient::setRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
678
679 // reference satellite definition per system
680 for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
681 char system = _opt->systems()[iSys];
682 bool refSatDefined = false;
683 t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system);
684 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
685 t_pppSatObs* satObs = obsVector.at(ii);
686 if (satObs->eleSat() < _opt->_minEle) {continue;}
687 // reference satellite is unchanged
688 if (!_obsPool->refSatChangeRequired() && refSat->prn() == satObs->prn()) {
689 refSatDefined = true;
690 obsVector[ii]->setAsReference();
691 }
692 // reference satellite has changed
693 else if ( _obsPool->refSatChangeRequired() && refSat->prn() != satObs->prn() && !_historicalRefSats.contains(satObs->prn())) {
694 if (satObs->prn().system() == system) {
695 refSatDefined = true;
696 obsVector[ii]->setAsReference();
697 refSat->setPrn(satObs->prn());
698 }
699 }
700 if (refSatDefined) {
701 if (OPT->_pseudoObsIono) {
702 refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
703 }
704 break;
705 }
706 }
707 // reference satellite has to be initialized
708 if (!refSatDefined) {
709 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
710 t_pppSatObs* satObs = obsVector.at(ii);
711 if (satObs->eleSat() < _opt->_minEle) {
712 continue;
713 }
714 if (satObs->prn().system() == system) {
715 obsVector[ii]->setAsReference();
716 refSat->setPrn(satObs->prn());
717 if (OPT->_pseudoObsIono) {
718 refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
719 }
720 refSatDefined = true;
721 break;
722 }
723 }
724 }
725 }
726 _obsPool->setRefSatChangeRequired(false);
727
728}
729
730//
731//////////////////////////////////////////////////////////////////////////////
732void t_pppClient::reset() {
733
734 // to delete old orbit and clock corrections
735 delete _ephPool;
736 _ephPool = new t_pppEphPool();
737
738 // to delete old code biases
739 delete _obsPool;
740 _obsPool = new t_pppObsPool();
741
742 // to delete all parameters
743 delete _filter;
744 _filter = new t_pppFilter(_obsPool);
745
746}
Note: See TracBrowser for help on using the repository browser.