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

Last change on this file since 11011 was 11011, checked in by stuerze, 9 days ago

updates regarding RTCM-SSR

  • 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.4 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 _running = true;
52 _output = 0;
53 _opt = new t_pppOptions(*opt);
54 _log = new ostringstream();
55 _ephPool = new t_pppEphPool();
56 _obsPool = new t_pppObsPool();
57 _staRover = new t_pppStation();
58 _filter = new t_pppFilter();
59 _tides = new t_tides();
60 _antex = 0;
61 if (!_opt->_antexFileName.empty()) {
62 _antex = new bncAntex(_opt->_antexFileName.c_str());
63 }
64 if (!_opt->_blqFileName.empty()) {
65 if (_tides->readBlqFile(_opt->_blqFileName.c_str()) == success) {
66 //_tides->printAllBlqSets();
67 }
68 }
69 CLIENTS.setLocalData(this); // CLIENTS takes ownership over "this"
70}
71
72// Destructor
73//////////////////////////////////////////////////////////////////////////////
74t_pppClient::~t_pppClient() {
75 _running = false;
76 delete _log;
77 delete _opt;
78 delete _ephPool;
79 delete _obsPool;
80 delete _staRover;
81 if (_antex) {
82 delete _antex;
83 }
84 delete _filter;
85 delete _tides;
86 clearObs();
87}
88
89//
90//////////////////////////////////////////////////////////////////////////////
91void t_pppClient::putEphemeris(const t_eph* eph) {
92 const t_ephGPS* ephGPS = dynamic_cast<const t_ephGPS*>(eph);
93 const t_ephGlo* ephGlo = dynamic_cast<const t_ephGlo*>(eph);
94 const t_ephGal* ephGal = dynamic_cast<const t_ephGal*>(eph);
95 const t_ephBDS* ephBDS = dynamic_cast<const t_ephBDS*>(eph);
96 if (ephGPS) {
97 _ephPool->putEphemeris(new t_ephGPS(*ephGPS));
98 }
99 else if (ephGlo) {
100 _ephPool->putEphemeris(new t_ephGlo(*ephGlo));
101 }
102 else if (ephGal) {
103 _ephPool->putEphemeris(new t_ephGal(*ephGal));
104 }
105 else if (ephBDS) {
106 _ephPool->putEphemeris(new t_ephBDS(*ephBDS));
107 }
108}
109
110//
111//////////////////////////////////////////////////////////////////////////////
112void t_pppClient::putTec(const t_vTec* vTec) {
113 _obsPool->putTec(new t_vTec(*vTec));
114}
115
116//
117//////////////////////////////////////////////////////////////////////////////
118void t_pppClient::putMetaData(const t_metaData* metaData) {
119 _obsPool->putMetaData(new t_metaData(*metaData));
120}
121
122//
123//////////////////////////////////////////////////////////////////////////////
124void t_pppClient::putOrbCorrections(const vector<t_orbCorr*>& corr) {
125 if (OPT->_logMode == t_pppOptions::normal && corr.size() > 0) {
126 LOG << "orbCorrections " << string(corr[0]->_time) << ' ' << corr.size() << endl;
127 }
128 for (unsigned ii = 0; ii < corr.size(); ii++) {
129 _ephPool->putOrbCorrection(new t_orbCorr(*corr[ii]));
130 }
131}
132
133//
134//////////////////////////////////////////////////////////////////////////////
135void t_pppClient::putClkCorrections(const vector<t_clkCorr*>& corr) {
136 if (OPT->_logMode == t_pppOptions::normal && corr.size() > 0) {
137 LOG << "clkCorrections " << string(corr[0]->_time) << ' ' << corr.size() << endl;
138 }
139 for (unsigned ii = 0; ii < corr.size(); ii++) {
140 _ephPool->putClkCorrection(new t_clkCorr(*corr[ii]));
141 }
142}
143
144//
145//////////////////////////////////////////////////////////////////////////////
146void t_pppClient::putCodeBiases(const vector<t_satCodeBias*>& biases) {
147 if (OPT->_logMode == t_pppOptions::normal && biases.size() > 0) {
148 LOG << "codeBiases " << string(biases[0]->_time) << ' ' << biases.size() << endl;
149 }
150 set<char> systems;
151 for (unsigned ii = 0; ii < biases.size(); ii++) {
152 t_satCodeBias* newBias = new t_satCodeBias(*biases[ii]);
153 char sys = newBias->_prn.system();
154 if (systems.find(sys) == systems.end()) {
155 _obsPool->clearCodeBiases(sys);
156 systems.insert(sys);
157 }
158 _obsPool->putCodeBias(newBias);
159 }
160}
161
162//
163//////////////////////////////////////////////////////////////////////////////
164void t_pppClient::putPhaseBiases(const vector<t_satPhaseBias*>& biases) {
165 if (OPT->_logMode == t_pppOptions::normal && biases.size() > 0) {
166 LOG << "phaseBiases " << string(biases[0]->_time) << ' ' << biases.size() << endl;
167 }
168 set<char> systems;
169 for (unsigned ii = 0; ii < biases.size(); ii++) {
170 t_satPhaseBias* newBias = new t_satPhaseBias(*biases[ii]);
171 char sys = newBias->_prn.system();
172 if (systems.find(sys) == systems.end()) {
173 _obsPool->clearPhaseBiases(sys);
174 systems.insert(sys);
175 }
176 _obsPool->putPhaseBias(newBias);
177 }
178}
179
180//
181//////////////////////////////////////////////////////////////////////////////
182t_irc t_pppClient::prepareObs(const vector<t_satObs*>& satObs,
183 vector<t_pppSatObs*>& obsVector, bncTime& epoTime) {
184
185 // Default
186 // -------
187 epoTime.reset();
188 clearObs();
189
190 // Create vector of valid observations
191 // -----------------------------------
192 for (unsigned ii = 0; ii < satObs.size(); ii++) {
193 char sys = satObs[ii]->_prn.system();
194 if (_opt->useSystem(sys)) {
195 t_pppSatObs* pppSatObs = new t_pppSatObs(*satObs[ii]);
196 if (pppSatObs->isValid()) {
197 obsVector.push_back(pppSatObs);
198 }
199 else {
200 delete pppSatObs;
201 }
202 }
203 }
204
205 // Check whether data are synchronized, compute epoTime
206 // ----------------------------------------------------
207 const double MAXSYNC = 0.05; // synchronization limit
208 double meanDt = 0.0;
209 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
210 const t_pppSatObs* satObs = obsVector.at(ii);
211 if (epoTime.undef()) {
212 epoTime = satObs->time();
213 }
214 else {
215 double dt = satObs->time() - epoTime;
216 if (fabs(dt) > MAXSYNC) {
217 LOG << "t_pppClient::prepareObs asynchronous observations" << endl;
218 return failure;
219 }
220 meanDt += dt;
221 }
222 }
223
224 if (obsVector.size() > 0) {
225 epoTime += meanDt / obsVector.size();
226 }
227
228 return success;
229}
230
231//
232//////////////////////////////////////////////////////////////////////////////
233bool t_pppClient::preparePseudoObs(std::vector<t_pppSatObs*>& obsVector) {
234
235 bool pseudoObsIono = false;
236
237 if (_opt->_pseudoObsIono) {
238
239 // Select reference satellite per system: keep the current one if still
240 // visible; only switch to highest elevation when the current one disappears
241 // -------------------------------------------------------------------------
242 map<char, t_pppSatObs*> refSatMap;
243 map<char, t_pppSatObs*> bestEleMap;
244 for (t_pppSatObs* satObs : obsVector) {
245 satObs->resetReference();
246 double stec = satObs->getIonoCodeDelay(t_frequency::G1);
247 if (stec == 0.0) continue;
248 char sys = satObs->prn().system();
249 if (!bestEleMap.count(sys) || satObs->eleSat() > bestEleMap[sys]->eleSat()) {
250 bestEleMap[sys] = satObs;
251 }
252 if (_refPrnMap.count(sys) && satObs->prn() == _refPrnMap[sys]) {
253 refSatMap[sys] = satObs;
254 }
255 }
256 for (auto& kv : bestEleMap) {
257 if (!refSatMap.count(kv.first)) {
258 refSatMap[kv.first] = kv.second;
259 }
260 }
261 for (auto& kv : refSatMap) {
262 _refPrnMap[kv.first] = kv.second->prn();
263 kv.second->setAsReference();
264 }
265
266 if (bestEleMap.empty()) {
267 LOG << "GIM pseudo-obs unavailable: no valid STEC (vTec data missing?)" << endl;
268 }
269
270 // Set STEC pseudo-observations (single-differenced vs reference satellite)
271 // -------------------------------------------------------------------------
272 int nGIM = 0;
273 for (t_pppSatObs* satObs : obsVector) {
274 char sys = satObs->prn().system();
275 double stecRefSat = refSatMap.count(sys)
276 ? refSatMap[sys]->getIonoCodeDelay(t_frequency::G1)
277 : 0.0;
278 if (satObs->setPseudoObsIono(t_frequency::G1, stecRefSat)) {
279 pseudoObsIono = true;
280 nGIM++;
281 }
282 }
283 if (nGIM > 0) {
284 LOG << "GIM pseudo-obs: " << nGIM << " satellites, ref:";
285 for (auto& kv : refSatMap) {
286 LOG << ' ' << kv.second->prn().toString();
287 }
288 LOG << endl;
289 }
290 }
291
292 if (OPT->_logMode == t_pppOptions::all) {
293 vector<t_pppSatObs*>::iterator it = obsVector.begin();
294 while (it != obsVector.end()) {
295 t_pppSatObs* satObs = *it;
296 satObs->printObsMinusComputed();
297 it++;
298 }
299 }
300 return pseudoObsIono;
301}
302
303// Compute the Bancroft position, check for blunders
304//////////////////////////////////////////////////////////////////////////////
305t_irc t_pppClient::cmpBancroft(const bncTime& epoTime,
306 vector<t_pppSatObs*>& obsVector,
307 ColumnVector& xyzc, bool print) {
308
309 int numBancroft = obsVector.size();
310
311 while (_running) {
312 Matrix BB(numBancroft, 4);
313 int iObs = -1;
314 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
315 const t_pppSatObs* satObs = obsVector.at(ii);
316 t_lc LC = satObs->rangeLC();
317 if ( satObs->isValid(LC) &&
318 (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
319 ++iObs;
320 BB[iObs][0] = satObs->xc()[0];
321 BB[iObs][1] = satObs->xc()[1];
322 BB[iObs][2] = satObs->xc()[2];
323 BB[iObs][3] = satObs->obsValue(LC) - satObs->cmpValueForBanc(LC);
324 }
325 }
326 if (iObs + 1 < _opt->_minObs) {
327 LOG << "t_pppClient::cmpBancroft not enough observations: " << iObs + 1 << endl;
328 return failure;
329 }
330 BB = BB.Rows(1,iObs+1);
331 if (bancroft(BB, xyzc) != success) {
332 return failure;
333 }
334
335 xyzc[3] /= t_CST::c;
336
337 // Check Blunders
338 // --------------
339 const double BLUNDER = 1500.0;
340 double maxRes = 0.0;
341 unsigned maxResIndex = 0;
342 for (unsigned ii = 0; ii < obsVector.size(); ii++) {
343 const t_pppSatObs* satObs = obsVector.at(ii);
344 t_lc LC = satObs->rangeLC();
345 if (satObs->isValid(LC) &&
346 (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
347 ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3);
348 double res = rr.NormFrobenius() - satObs->obsValue(LC)
349 - (satObs->xc()[3] - xyzc[3]) * t_CST::c;
350 if (fabs(res) > maxRes) {
351 maxRes = fabs(res);
352 maxResIndex = ii;
353 }
354 }
355 }
356 if (maxRes < BLUNDER) {
357 if (print) {
358 LOG.setf(ios::fixed);
359 LOG << "\nPPP of Epoch ";
360 if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
361 LOG << " using " << _opt->_corrMount;
362 LOG << "\n---------------------------------------------------------------\n";
363 LOG << string(epoTime) << " BANCROFT: "
364 << setw(14) << setprecision(3) << xyzc[0] << ' '
365 << setw(14) << setprecision(3) << xyzc[1] << ' '
366 << setw(14) << setprecision(3) << xyzc[2] << ' '
367 << setw(14) << setprecision(3) << xyzc[3] * t_CST::c << endl << endl;
368 }
369 break;
370 }
371 else {
372 t_pppSatObs* satObs = obsVector.at(maxResIndex);
373 LOG << "t_pppClient::cmpBancroft Outlier " << satObs->prn().toString()
374 << " " << maxRes << endl;
375 delete satObs;
376 obsVector.erase(obsVector.begin() + maxResIndex);
377 }
378 }
379
380 return success;
381}
382
383//
384//////////////////////////////////////////////////////////////////////////////
385void t_pppClient::initOutput(t_output* output) {
386 _output = output;
387 _output->_numSat = 0;
388 _output->_hDop = 0.0;
389 _output->_error = false;
390}
391
392//
393//////////////////////////////////////////////////////////////////////////////
394void t_pppClient::clearObs() {
395 for (unsigned ii = 0; ii < _obsRover.size(); ii++) {
396 delete _obsRover.at(ii);
397 }
398 _obsRover.clear();
399}
400
401//
402//////////////////////////////////////////////////////////////////////////////
403void t_pppClient::finish(t_irc irc, int ind) {
404#ifdef BNC_DEBUG_PPP
405 LOG << "t_pppClient::finish(" << ind << "): " << irc << endl;
406#endif
407
408 clearObs();
409
410 _output->_epoTime = _epoTimeRover;
411
412 if (irc == success) {
413 _output->_xyzRover[0] = _staRover->xyzApr()[0] + _filter->x()[0];
414 _output->_xyzRover[1] = _staRover->xyzApr()[1] + _filter->x()[1];
415 _output->_xyzRover[2] = _staRover->xyzApr()[2] + _filter->x()[2];
416
417 xyz2neu(_staRover->ellApr().data(), _filter->x().data(), _output->_neu);
418
419 copy(&_filter->Q().data()[0], &_filter->Q().data()[6], _output->_covMatrix);
420
421 _output->_trp0 = t_tropo::delay_saast(_staRover->xyzApr(), M_PI/2.0);
422 _output->_trp = _filter->trp();
423 _output->_trpStdev = _filter->trpStdev();
424
425 _output->_fixRatio = _filter->fixRatio();
426
427 _output->_numSat = _filter->numSat();
428 _output->_hDop = _filter->HDOP();
429 _output->_error = false;
430 }
431 else {
432 _output->_error = true;
433 }
434
435 _output->_log = _log->str();
436 delete _log; _log = new ostringstream();
437
438 return;
439}
440
441//
442//////////////////////////////////////////////////////////////////////////////
443t_irc t_pppClient::cmpModel(t_pppStation* station, const ColumnVector& xyzc,
444 vector<t_pppSatObs*>& obsVector) {
445 bncTime time;
446 time = _epoTimeRover;
447 station->setName(_opt->_roverName);
448 station->setAntName(_opt->_antNameRover);
449 station->setEpochTime(time);
450
451 if (_opt->xyzAprRoverSet()) {
452 station->setXyzApr(_opt->_xyzAprRover);
453 }
454 else {
455 station->setXyzApr(xyzc.Rows(1,3));
456 }
457 station->setNeuEcc(_opt->_neuEccRover);
458
459 // Receiver Clock
460 // --------------
461 station->setDClk(xyzc[3]);
462
463 // Tides
464 // -----
465 // RTCM-SSR Metadata (model correction type 3 = solid earth tides) tells us
466 // whether - and with which model - the correction stream's generation
467 // system already accounted for solid earth tides. To stay consistent with
468 // the orbit/clock corrections, mirror that choice here: skip our own
469 // correction if the provider applied none, apply our default model if the
470 // provider used its own default, and fall back to our default (with a
471 // warning) if the provider used some other, unsupported model - we have no
472 // way to reproduce an unknown model exactly. Absent any Metadata message
473 // (e.g. RTNET or older streams), keep today's unconditional behavior.
474 bool applyEarthTide = true;
475 const t_metaData* metaData = _obsPool->metaData();
476 if (metaData) {
477 for (unsigned ii = 0; ii < metaData->_entries.size(); ii++) {
478 const t_metaDataEntry& entry = metaData->_entries[ii];
479 if (entry._typeIndicator == 3) { // solid earth tides
480 if (!entry._applicationIndicator) {
481 applyEarthTide = false;
482 }
483 else if (entry._nonDefaultIndicator) {
484 LOG << "WARNING: SSR Metadata signals a non-default solid earth "
485 << "tide model (identifier " << entry._nonDefaultIdentifier
486 << "); applying BNC's default model anyway, results may be "
487 << "inconsistent" << endl;
488 }
489 break;
490 }
491 }
492 }
493 if (applyEarthTide) {
494 station->setTideDsplEarth(_tides->earth(time, station->xyzApr()));
495 }
496 else {
497 ColumnVector tideDsplEarth(3); tideDsplEarth = 0.0;
498 station->setTideDsplEarth(tideDsplEarth);
499 }
500 station->setTideDsplOcean(_tides->ocean(time, station->xyzApr(), station->name()));
501
502 // Observation model
503 // -----------------
504 vector<t_pppSatObs*>::iterator it = obsVector.begin();
505 while (it != obsVector.end()) {
506 t_pppSatObs* satObs = *it;
507 t_irc modelSetup;
508 if (satObs->isValid()) {
509 modelSetup = satObs->cmpModel(station);
510 }
511 if (satObs->isValid() &&
512 satObs->eleSat() >= _opt->_minEle &&
513 modelSetup == success) {
514 ++it;
515 }
516 else {
517 delete satObs;
518 it = obsVector.erase(it);
519 }
520 }
521
522 return success;
523}
524
525//
526//////////////////////////////////////////////////////////////////////////////
527void t_pppClient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) {
528
529 try {
530 initOutput(output);
531
532 // Prepare Observations of the Rover
533 // ---------------------------------
534 if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
535 return finish(failure, 1);
536 }
537
538 for (int iter = 1; iter <= 2; iter++) {
539 ColumnVector xyzc(4); xyzc = 0.0;
540 bool print = (iter == 2);
541 if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
542 return finish(failure, 2);
543 }
544 if (cmpModel(_staRover, xyzc, _obsRover) != success) {
545 return finish(failure, 3);
546 }
547 }
548
549 // Use observations only if satellite code biases are available
550 // ------------------------------------------------------------
551 if (_opt->ambRes()) {
552 useObsWithBiasesOnly(_obsRover);
553 }
554
555 if (int(_obsRover.size()) < _opt->_minObs) {
556 LOG << "t_pppClient::processEpoch not enough observations" << endl;
557 return finish(failure, 4);
558 }
559
560 // Prepare Pseudo Observations of the Rover
561 // ----------------------------------------
562 _pseudoObsIono = preparePseudoObs(_obsRover);
563
564 // Store last epoch of data
565 // ------------------------
566 _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono);
567
568 // Process Epoch in Filter
569 // -----------------------
570 if (_filter->processEpoch(_obsPool) != success) {
571 LOG << "t_pppFilter::processEpoch() != success" << endl;
572 return finish(failure, 5);
573 }
574 }
575 catch (Exception& exc) {
576 LOG << exc.what() << endl;
577 return finish(failure, 6);
578 }
579 catch (t_except msg) {
580 LOG << msg.what() << endl;
581 return finish(failure, 7);
582 }
583 catch (const char* msg) {
584 LOG << msg << endl;
585 return finish(failure, 8);
586 }
587 catch (...) {
588 LOG << "unknown exception" << endl;
589 return finish(failure, 9);
590 }
591 return finish(success, 0);
592}
593
594//
595////////////////////////////////////////////////////////////////////////////
596double lorentz(const ColumnVector& aa, const ColumnVector& bb) {
597 return aa[0]*bb[0] + aa[1]*bb[1] + aa[2]*bb[2] - aa[3]*bb[3];
598}
599
600//
601////////////////////////////////////////////////////////////////////////////
602t_irc t_pppClient::bancroft(const Matrix& BBpass, ColumnVector& pos) {
603
604 if (pos.Nrows() != 4) {
605 pos.ReSize(4);
606 }
607 pos = 0.0;
608
609 for (int iter = 1; iter <= 2; iter++) {
610 Matrix BB = BBpass;
611 int mm = BB.Nrows();
612 for (int ii = 1; ii <= mm; ii++) {
613 double xx = BB(ii,1);
614 double yy = BB(ii,2);
615 double traveltime = 0.072;
616 if (iter > 1) {
617 double zz = BB(ii,3);
618 double rho = sqrt( (xx-pos(1)) * (xx-pos(1)) +
619 (yy-pos(2)) * (yy-pos(2)) +
620 (zz-pos(3)) * (zz-pos(3)) );
621 traveltime = rho / t_CST::c;
622 }
623 double angle = traveltime * t_CST::omega;
624 double cosa = cos(angle);
625 double sina = sin(angle);
626 BB(ii,1) = cosa * xx + sina * yy;
627 BB(ii,2) = -sina * xx + cosa * yy;
628 }
629
630 Matrix BBB;
631 if (mm > 4) {
632 SymmetricMatrix hlp; hlp << BB.t() * BB;
633 BBB = hlp.i() * BB.t();
634 }
635 else {
636 BBB = BB.i();
637 }
638 ColumnVector ee(mm); ee = 1.0;
639 ColumnVector alpha(mm); alpha = 0.0;
640 for (int ii = 1; ii <= mm; ii++) {
641 alpha(ii) = lorentz(BB.Row(ii).t(),BB.Row(ii).t())/2.0;
642 }
643 ColumnVector BBBe = BBB * ee;
644 ColumnVector BBBalpha = BBB * alpha;
645 double aa = lorentz(BBBe, BBBe);
646 double bb = lorentz(BBBe, BBBalpha)-1;
647 double cc = lorentz(BBBalpha, BBBalpha);
648 double root = sqrt(bb*bb-aa*cc);
649
650 Matrix hlpPos(4,2);
651 hlpPos.Column(1) = (-bb-root)/aa * BBBe + BBBalpha;
652 hlpPos.Column(2) = (-bb+root)/aa * BBBe + BBBalpha;
653
654 ColumnVector omc(2);
655 for (int pp = 1; pp <= 2; pp++) {
656 hlpPos(4,pp) = -hlpPos(4,pp);
657 omc(pp) = BB(1,4) -
658 sqrt( (BB(1,1)-hlpPos(1,pp)) * (BB(1,1)-hlpPos(1,pp)) +
659 (BB(1,2)-hlpPos(2,pp)) * (BB(1,2)-hlpPos(2,pp)) +
660 (BB(1,3)-hlpPos(3,pp)) * (BB(1,3)-hlpPos(3,pp)) ) -
661 hlpPos(4,pp);
662 }
663 if ( fabs(omc(1)) > fabs(omc(2)) ) {
664 pos = hlpPos.Column(2);
665 }
666 else {
667 pos = hlpPos.Column(1);
668 }
669 }
670 if (pos.size() != 4 ||
671 std::isnan(pos(1)) ||
672 std::isnan(pos(2)) ||
673 std::isnan(pos(3)) ||
674 std::isnan(pos(4))) {
675 return failure;
676 }
677
678 return success;
679}
680
681//
682//////////////////////////////////////////////////////////////////////////////
683void t_pppClient::reset() {
684
685 LOG << "pppClient: reset" << endl;
686 _refPrnMap.clear();
687 // to delete old orbit and clock corrections
688 delete _ephPool;
689 _ephPool = new t_pppEphPool();
690
691 // to delete old biases
692 delete _obsPool;
693 _obsPool = new t_pppObsPool();
694
695 // to delete all parameters
696 delete _filter;
697 _filter = new t_pppFilter();
698
699}
700
701//
702//////////////////////////////////////////////////////////////////////////////
703void t_pppClient::useObsWithBiasesOnly(vector<t_pppSatObs*>& obsVector) const {
704 vector<t_pppSatObs*>::iterator it = obsVector.begin();
705 while (it != obsVector.end()) {
706 t_pppSatObs* pppSatObs = *it;
707 if (pppSatObs->hasBiases()) {
708 ++it;
709 }
710 else {
711 it = obsVector.erase(it);
712 delete pppSatObs;
713 }
714 }
715}
Note: See TracBrowser for help on using the repository browser.