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

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

update 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: 21.0 KB
RevLine 
[7237]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 *
[7271]13 * Changes:
[7237]14 *
15 * -----------------------------------------------------------------------*/
16
17#include <QThreadStorage>
18
19#include <iostream>
20#include <iomanip>
[8451]21#include <cmath>
[7237]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();
[8905]57 _filter = new t_pppFilter(_obsPool);
[7237]58 _tides = new t_tides();
[8905]59 _antex = 0;
[7237]60 if (!_opt->_antexFileName.empty()) {
61 _antex = new bncAntex(_opt->_antexFileName.c_str());
62 }
[8905]63 if (!_opt->_blqFileName.empty()) {
64 if (_tides->readBlqFile(_opt->_blqFileName.c_str()) == success) {
65 //_tides->printAllBlqSets();
66 }
[7237]67 }
[7996]68
[8910]69 if (_opt->_refSatRequired) {
[8912]70 for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
71 char system = _opt->systems()[iSys];
[8905]72 _obsPool->initRefSatMapElement(system);
73 }
[7972]74 }
[8905]75 _offGG = 0.0;
[7237]76 CLIENTS.setLocalData(this); // CLIENTS takes ownership over "this"
77}
78
79// Destructor
80//////////////////////////////////////////////////////////////////////////////
81t_pppClient::~t_pppClient() {
82 delete _log;
83 delete _opt;
[8905]84 delete _filter;
[7237]85 delete _ephPool;
86 delete _obsPool;
87 delete _staRover;
[7866]88 if (_antex) {
89 delete _antex;
90 }
[7237]91 delete _tides;
92 clearObs();
93}
94
[7271]95//
[7237]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);
[7271]101 const t_ephBDS* ephBDS = dynamic_cast<const t_ephBDS*>(eph);
[7237]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 }
[7271]111 else if (ephBDS) {
112 _ephPool->putEphemeris(new t_ephBDS(*ephBDS));
113 }
[7237]114}
115
116//
117//////////////////////////////////////////////////////////////////////////////
118void t_pppClient::putTec(const t_vTec* vTec) {
[7248]119 _obsPool->putTec(new t_vTec(*vTec));
[7237]120}
121
[7271]122//
[7237]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
[7271]130//
[7237]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
[7271]138//
[7237]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//////////////////////////////////////////////////////////////////////////////
[7288]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//////////////////////////////////////////////////////////////////////////////
[7237]156t_irc t_pppClient::prepareObs(const vector<t_satObs*>& satObs,
157 vector<t_pppSatObs*>& obsVector, bncTime& epoTime) {
[8905]158
[7271]159 // Default
[7237]160 // -------
161 epoTime.reset();
[8956]162 clearObs();
[7237]163
164 // Create vector of valid observations
165 // -----------------------------------
166 for (unsigned ii = 0; ii < satObs.size(); ii++) {
167 char system = satObs[ii]->_prn.system();
[8912]168 if (_opt->useSystem(system)) {
[7237]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
[8905]205//
206//////////////////////////////////////////////////////////////////////////////
207bool t_pppClient::preparePseudoObs(std::vector<t_pppSatObs*>& obsVector) {
208
209 bool pseudoObsIono = false;
210
[8912]211 if (_opt->_pseudoObsIono) {
[8905]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 satObs->printObsMinusComputed();
223 it++;
224 }
225 }
226
227 return pseudoObsIono;
228}
229
[7237]230// Compute the Bancroft position, check for blunders
231//////////////////////////////////////////////////////////////////////////////
[7271]232t_irc t_pppClient::cmpBancroft(const bncTime& epoTime,
[7237]233 vector<t_pppSatObs*>& obsVector,
234 ColumnVector& xyzc, bool print) {
235
236 t_lc::type tLC = t_lc::dummy;
237
238 while (true) {
239 Matrix BB(obsVector.size(), 4);
240 int iObs = -1;
241 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
242 const t_pppSatObs* satObs = obsVector.at(ii);
[8034]243 if (tLC == t_lc::dummy) {
244 if (satObs->isValid(t_lc::cIF)) {
245 tLC = t_lc::cIF;
[7237]246 }
[8034]247 else if (satObs->isValid(t_lc::c1)) {
248 tLC = t_lc::c1;
[7237]249 }
[8445]250 else if (satObs->isValid(t_lc::c2)) {
[8034]251 tLC = t_lc::c2;
252 }
[7237]253 }
[8912]254 if ( satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
[8034]255 ++iObs;
256 BB[iObs][0] = satObs->xc()[0];
257 BB[iObs][1] = satObs->xc()[1];
258 BB[iObs][2] = satObs->xc()[2];
259 BB[iObs][3] = satObs->obsValue(tLC) - satObs->cmpValueForBanc(tLC);
260 }
[7237]261 }
[8912]262 if (iObs + 1 < _opt->_minObs) {
[7237]263 LOG << "t_pppClient::cmpBancroft not enough observations" << endl;
264 return failure;
265 }
266 BB = BB.Rows(1,iObs+1);
267 bancroft(BB, xyzc);
268
269 xyzc[3] /= t_CST::c;
270
271 // Check Blunders
272 // --------------
273 const double BLUNDER = 100.0;
274 double maxRes = 0.0;
275 unsigned maxResIndex = 0;
276 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
277 const t_pppSatObs* satObs = obsVector.at(ii);
[8905]278 if (satObs->isValid() &&
279 satObs->prn().system() == 'G' &&
[8912]280 (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
[7237]281 ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3);
[8905]282 double res = rr.NormFrobenius() - satObs->obsValue(tLC)
[8453]283 - (satObs->xc()[3] - xyzc[3]) * t_CST::c;
284 if (std::isnan(res) || fabs(res) > maxRes) {
285 std::isnan(res) ?
286 maxRes = res :
[7237]287 maxRes = fabs(res);
288 maxResIndex = ii;
289 }
290 }
291 }
[8453]292 if (!std::isnan(maxRes) && maxRes < BLUNDER) {
[7237]293 if (print) {
294 LOG.setf(ios::fixed);
295 LOG << string(epoTime) << " BANCROFT:" << ' '
296 << setw(14) << setprecision(3) << xyzc[0] << ' '
297 << setw(14) << setprecision(3) << xyzc[1] << ' '
298 << setw(14) << setprecision(3) << xyzc[2] << ' '
299 << setw(14) << setprecision(3) << xyzc[3] * t_CST::c << endl << endl;
300 }
301 break;
302 }
303 else {
304 t_pppSatObs* satObs = obsVector.at(maxResIndex);
305 LOG << "t_pppClient::cmpBancroft outlier " << satObs->prn().toString()
306 << " " << maxRes << endl;
307 delete satObs;
308 obsVector.erase(obsVector.begin() + maxResIndex);
309 }
310 }
311
312 return success;
313}
314
315// Compute A Priori GPS-Glonass Offset
316//////////////////////////////////////////////////////////////////////////////
317double t_pppClient::cmpOffGG(vector<t_pppSatObs*>& obsVector) {
318
319 t_lc::type tLC = t_lc::dummy;
320 double offGG = 0.0;
321
[8912]322 if (_opt->useSystem('R')) {
[7237]323 while (obsVector.size() > 0) {
324 offGG = 0.0;
325 double maxRes = 0.0;
326 int maxResIndex = -1;
327 t_prn maxResPrn;
328 unsigned nObs = 0;
329 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
[7888]330 const t_pppSatObs* satObs = obsVector.at(ii);
[7237]331 if (satObs->prn().system() == 'R') {
332 if (tLC == t_lc::dummy) {
333 tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
334 }
[8912]335 if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
[7237]336 double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
337 ++nObs;
338 offGG += ll;
339 if (fabs(ll) > fabs(maxRes)) {
340 maxRes = ll;
341 maxResIndex = ii;
342 maxResPrn = satObs->prn();
343 }
344 }
345 }
346 }
347
348 if (nObs > 0) {
349 offGG = offGG / nObs;
350 }
351 else {
352 offGG = 0.0;
353 }
354
355 if (fabs(maxRes) > 1000.0) {
356 LOG << "t_pppClient::cmpOffGG outlier " << maxResPrn.toString() << " " << maxRes << endl;
[7904]357 delete obsVector.at(maxResIndex);
[7237]358 obsVector.erase(obsVector.begin() + maxResIndex);
359 }
360 else {
361 break;
362 }
363 }
364 }
365 return offGG;
366}
367
[7271]368//
[7237]369//////////////////////////////////////////////////////////////////////////////
370void t_pppClient::initOutput(t_output* output) {
371 _output = output;
372 _output->_numSat = 0;
[7927]373 _output->_hDop = 0.0;
[7237]374 _output->_error = false;
375}
376
[7271]377//
[7237]378//////////////////////////////////////////////////////////////////////////////
379void t_pppClient::clearObs() {
380 for (unsigned ii = 0; ii < _obsRover.size(); ii++) {
381 delete _obsRover.at(ii);
382 }
383 _obsRover.clear();
384}
385
[7271]386//
[7237]387//////////////////////////////////////////////////////////////////////////////
388void t_pppClient::finish(t_irc irc) {
389
390 clearObs();
391
392 _output->_epoTime = _epoTimeRover;
393
394 if (irc == success) {
395 _output->_xyzRover[0] = _staRover->xyzApr()[0] + _filter->x()[0];
396 _output->_xyzRover[1] = _staRover->xyzApr()[1] + _filter->x()[1];
397 _output->_xyzRover[2] = _staRover->xyzApr()[2] + _filter->x()[2];
398
399 xyz2neu(_staRover->ellApr().data(), _filter->x().data(), _output->_neu);
400
401 copy(&_filter->Q().data()[0], &_filter->Q().data()[6], _output->_covMatrix);
402
403 _output->_trp0 = t_tropo::delay_saast(_staRover->xyzApr(), M_PI/2.0);
404 _output->_trp = _filter->trp();
405 _output->_trpStdev = _filter->trpStdev();
406
407 _output->_numSat = _filter->numSat();
[7927]408 _output->_hDop = _filter->HDOP();
[7237]409 _output->_error = false;
410 }
411 else {
412 _output->_error = true;
413 }
414 _output->_log = _log->str();
415 delete _log; _log = new ostringstream();
416}
417
[7271]418//
[7237]419//////////////////////////////////////////////////////////////////////////////
420t_irc t_pppClient::cmpModel(t_pppStation* station, const ColumnVector& xyzc,
421 vector<t_pppSatObs*>& obsVector) {
422 bncTime time;
423 time = _epoTimeRover;
[8912]424 station->setName(_opt->_roverName);
425 station->setAntName(_opt->_antNameRover);
[8905]426 station->setEpochTime(time);
[8912]427 if (_opt->xyzAprRoverSet()) {
428 station->setXyzApr(_opt->_xyzAprRover);
[7237]429 }
430 else {
431 station->setXyzApr(xyzc.Rows(1,3));
432 }
[8912]433 station->setNeuEcc(_opt->_neuEccRover);
[7237]434
435 // Receiver Clock
436 // --------------
437 station->setDClk(xyzc[3]);
438
439 // Tides
440 // -----
[8905]441 station->setTideDsplEarth(_tides->earth(time, station->xyzApr()));
442 station->setTideDsplOcean(_tides->ocean(time, station->xyzApr(), station->name()));
[7271]443
[7237]444 // Observation model
445 // -----------------
446 vector<t_pppSatObs*>::iterator it = obsVector.begin();
447 while (it != obsVector.end()) {
448 t_pppSatObs* satObs = *it;
[7254]449 t_irc modelSetup;
[7237]450 if (satObs->isValid()) {
[7254]451 modelSetup = satObs->cmpModel(station);
[7237]452 }
[7254]453 if (satObs->isValid() &&
[8912]454 satObs->eleSat() >= _opt->_minEle &&
[7254]455 modelSetup == success) {
[7237]456 ++it;
457 }
458 else {
459 delete satObs;
460 it = obsVector.erase(it);
461 }
462 }
463
464 return success;
465}
466
[7271]467//
[7237]468//////////////////////////////////////////////////////////////////////////////
469void t_pppClient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) {
470
[8956]471 _historicalRefSats.clear();
[7237]472 try {
473 initOutput(output);
[8912]474 int num = 0;
475 bool epochReProcessing = false;
[7237]476
[8905]477 do {
[8912]478 num++;
[8956]479 if (num == 1) {
480 LOG << "\nPPP of Epoch ";
481 if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
482 LOG << "\n---------------------------------------------------------------\n";
483 }
[7237]484
[8905]485 // Prepare Observations of the Rover
486 // ---------------------------------
487 if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
[7237]488 return finish(failure);
489 }
[8905]490
491 for (int iter = 1; iter <= 2; iter++) {
492 ColumnVector xyzc(4); xyzc = 0.0;
493 bool print = (iter == 2);
494 if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
495 return finish(failure);
496 }
497 if (cmpModel(_staRover, xyzc, _obsRover) != success) {
498 return finish(failure);
499 }
500 }
501
502 _offGG = cmpOffGG(_obsRover);
503
[8912]504 if (_opt->_refSatRequired) {
[8956]505 setRefSatellites(_obsRover);
[8905]506 LOG.setf(ios::fixed);
507 QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
508 while (it.hasNext()) {
509 it.next();
510 char sys = it.key();
511 string prn = it.value()->prn().toString();
[8956]512 if (num == 1) {
513 LOG << "set ";
514 }
515 else {
516 LOG << "reset ";
517 }
[8905]518 LOG << string(_epoTimeRover) << " REFSAT " << sys << ": " << prn << endl;
519 }
520 }
[7237]521
[8956]522
523 // Prepare Pseudo Observations of the Rover
524 // ----------------------------------------
525 _pseudoObsIono = preparePseudoObs(_obsRover);
526
527 if (int(_obsRover.size()) < _opt->_minObs) {
528 LOG << "t_pppClient::processEpoch not enough observations" << endl;
529 return finish(failure);
530 }
531
532
[8905]533 // Store last epoch of data
534 // ------------------------
535 _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono);
[8956]536 _obsPool->setHistoricalRefSatList(_historicalRefSats);
[7904]537
[8905]538 // Process Epoch in Filter
539 // -----------------------
[8912]540 if (_filter->processEpoch(num) != success) {
[8905]541 return finish(failure);
542 }
[8912]543
544 // Epoch re-processing required?
545 // -----------------------------
546 if (_obsPool->refSatChangeRequired()) {
547 epochReProcessing = true;
[8956]548 _obsPool->deleteLastEpoch();
549 QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
550 while (it.hasNext()) {
551 it.next();
552 _historicalRefSats.append(it.value()->prn());
553 }
[8912]554 }
555 else {
556 epochReProcessing = false;
[8956]557
[8912]558 }
559 } while (epochReProcessing);
[7237]560 }
561 catch (Exception& exc) {
562 LOG << exc.what() << endl;
563 return finish(failure);
564 }
565 catch (t_except msg) {
566 LOG << msg.what() << endl;
567 return finish(failure);
568 }
569 catch (const char* msg) {
570 LOG << msg << endl;
571 return finish(failure);
572 }
573 catch (...) {
574 LOG << "unknown exception" << endl;
575 return finish(failure);
576 }
577
578 return finish(success);
579}
580
[7271]581//
[7237]582////////////////////////////////////////////////////////////////////////////
583double lorentz(const ColumnVector& aa, const ColumnVector& bb) {
584 return aa[0]*bb[0] + aa[1]*bb[1] + aa[2]*bb[2] - aa[3]*bb[3];
585}
586
[7271]587//
[7237]588////////////////////////////////////////////////////////////////////////////
589void t_pppClient::bancroft(const Matrix& BBpass, ColumnVector& pos) {
590
591 if (pos.Nrows() != 4) {
592 pos.ReSize(4);
593 }
594 pos = 0.0;
595
596 for (int iter = 1; iter <= 2; iter++) {
597 Matrix BB = BBpass;
598 int mm = BB.Nrows();
599 for (int ii = 1; ii <= mm; ii++) {
600 double xx = BB(ii,1);
601 double yy = BB(ii,2);
602 double traveltime = 0.072;
603 if (iter > 1) {
604 double zz = BB(ii,3);
[7271]605 double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) +
606 (yy-pos(2)) * (yy-pos(2)) +
[7237]607 (zz-pos(3)) * (zz-pos(3)) );
608 traveltime = rho / t_CST::c;
609 }
610 double angle = traveltime * t_CST::omega;
611 double cosa = cos(angle);
612 double sina = sin(angle);
613 BB(ii,1) = cosa * xx + sina * yy;
614 BB(ii,2) = -sina * xx + cosa * yy;
615 }
[7271]616
[7237]617 Matrix BBB;
618 if (mm > 4) {
619 SymmetricMatrix hlp; hlp << BB.t() * BB;
620 BBB = hlp.i() * BB.t();
621 }
622 else {
623 BBB = BB.i();
624 }
625 ColumnVector ee(mm); ee = 1.0;
626 ColumnVector alpha(mm); alpha = 0.0;
627 for (int ii = 1; ii <= mm; ii++) {
[7271]628 alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0;
[7237]629 }
630 ColumnVector BBBe = BBB * ee;
631 ColumnVector BBBalpha = BBB * alpha;
632 double aa = lorentz(BBBe, BBBe);
633 double bb = lorentz(BBBe, BBBalpha)-1;
634 double cc = lorentz(BBBalpha, BBBalpha);
635 double root = sqrt(bb*bb-aa*cc);
636
[7271]637 Matrix hlpPos(4,2);
[7237]638 hlpPos.Column(1) = (-bb-root)/aa * BBBe + BBBalpha;
639 hlpPos.Column(2) = (-bb+root)/aa * BBBe + BBBalpha;
640
641 ColumnVector omc(2);
642 for (int pp = 1; pp <= 2; pp++) {
643 hlpPos(4,pp) = -hlpPos(4,pp);
[7271]644 omc(pp) = BB(1,4) -
[7237]645 sqrt( (BB(1,1)-hlpPos(1,pp)) * (BB(1,1)-hlpPos(1,pp)) +
646 (BB(1,2)-hlpPos(2,pp)) * (BB(1,2)-hlpPos(2,pp)) +
[7271]647 (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) -
[7237]648 hlpPos(4,pp);
649 }
650 if ( fabs(omc(1)) > fabs(omc(2)) ) {
651 pos = hlpPos.Column(2);
652 }
653 else {
654 pos = hlpPos.Column(1);
655 }
656 }
657}
658
[7972]659//
660//////////////////////////////////////////////////////////////////////////////
[8956]661void t_pppClient::setRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
662
663 // reference satellite definition per system
664 for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
665 char system = _opt->systems()[iSys];
666 bool refSatDefined = false;
667 t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system);
668 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
669 t_pppSatObs* satObs = obsVector.at(ii);
670 if (satObs->eleSat() < _opt->_minEle) {continue;}
671 // reference satellite is unchanged
672 if (!_obsPool->refSatChangeRequired() && refSat->prn() == satObs->prn()) {
673 refSatDefined = true;
674 obsVector[ii]->setAsReference();
675 }
676 // reference satellite has changed
677 else if ( _obsPool->refSatChangeRequired() && refSat->prn() != satObs->prn() && !_historicalRefSats.contains(satObs->prn())) {
678 if (satObs->prn().system() == system) {
679 refSatDefined = true;
680 obsVector[ii]->setAsReference();
681 refSat->setPrn(satObs->prn());
682 }
683 }
684 if (refSatDefined) {
685 if (OPT->_pseudoObsIono) {
686 refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
687 }
688 break;
689 }
690 }
691 // reference satellite has to be initialized
692 if (!refSatDefined) {
693 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
694 t_pppSatObs* satObs = obsVector.at(ii);
695 if (satObs->eleSat() < _opt->_minEle) {
696 continue;
697 }
698 if (satObs->prn().system() == system) {
699 obsVector[ii]->setAsReference();
700 refSat->setPrn(satObs->prn());
701 if (OPT->_pseudoObsIono) {
702 refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
703 }
704 refSatDefined = true;
705 break;
706 }
707 }
708 }
709 }
710 _obsPool->setRefSatChangeRequired(false);
711
712}
713
714//
715//////////////////////////////////////////////////////////////////////////////
[7972]716void t_pppClient::reset() {
717
718 // to delete old orbit and clock corrections
719 delete _ephPool;
720 _ephPool = new t_pppEphPool();
721
722 // to delete old code biases
723 delete _obsPool;
724 _obsPool = new t_pppObsPool();
[8905]725
726 // to delete all parameters
727 delete _filter;
728 _filter = new t_pppFilter(_obsPool);
729
[7996]730}
Note: See TracBrowser for help on using the repository browser.