Changeset 10256 in ntrip for trunk/BNC/src/PPP/pppClient.cpp


Ignore:
Timestamp:
Nov 25, 2023, 10:44:51 PM (11 months ago)
Author:
stuerze
Message:

changes regarding PPP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/pppClient.cpp

    r10254 r10256  
    6666    }
    6767  }
    68 
     68  _offGlo = 0.0;
     69  _offGal = 0.0;
     70  _offBds = 0.0;
    6971  CLIENTS.setLocalData(this);  // CLIENTS takes ownership over "this"
    7072}
     
    210212    }
    211213  }
    212   /*
     214/*
    213215  vector<t_pppSatObs*>::iterator it = obsVector.begin();
    214216  while (it != obsVector.end()) {
     
    250252                                  vector<t_pppSatObs*>& obsVector,
    251253                                  ColumnVector& xyzc, bool print) {
    252 
    253254  t_lc::type tLC = t_lc::dummy;
     255  char sysBancroft = 'G';
     256  int  numBancroft = obsVector.size();
     257
     258  _usedSystems['G'] = _usedSystems['R'] = _usedSystems['E'] = _usedSystems['C'] = 0;
     259  for (unsigned jj = 0; jj < obsVector.size(); jj++) {
     260    const t_pppSatObs* satObs = obsVector[jj];
     261    char sys = satObs->prn().system();
     262    _usedSystems[sys]++;
     263  }
     264
     265  if      ((numBancroft = _usedSystems.value('G'))) {
     266    sysBancroft = 'G';
     267  }
     268  else if ((numBancroft = _usedSystems.value('E'))) {
     269    sysBancroft = 'E';
     270  }
     271  else if ((numBancroft = _usedSystems.value('C'))) {
     272    sysBancroft = 'C';
     273  }
     274  else if ((numBancroft = _usedSystems.value('R'))) {
     275    sysBancroft = 'R';
     276  }
     277  else {
     278    return failure;
     279  }
    254280
    255281  while (true) {
    256     Matrix BB(obsVector.size(), 4);
     282    Matrix BB(numBancroft, 4);
    257283    int iObs = -1;
    258284    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    259285      const t_pppSatObs* satObs = obsVector.at(ii);
    260       if (tLC == t_lc::dummy) {
    261         if (satObs->isValid(t_lc::cIF)) {
    262           tLC = t_lc::cIF;
     286      if (satObs->prn().system() == sysBancroft) {
     287        if (tLC == t_lc::dummy) {
     288          if (satObs->isValid(t_lc::cIF)) {
     289            tLC = t_lc::cIF;
     290          }
     291          else if (satObs->isValid(t_lc::c1)) {
     292            tLC = t_lc::c1;
     293          }
     294          else if (satObs->isValid(t_lc::c2)) {
     295            tLC = t_lc::c2;
     296          }
    263297        }
    264         else if (satObs->isValid(t_lc::c1)) {
    265           tLC = t_lc::c1;
     298        if ( satObs->isValid(tLC) &&
     299            (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
     300          ++iObs;
     301          BB[iObs][0] = satObs->xc()[0];
     302          BB[iObs][1] = satObs->xc()[1];
     303          BB[iObs][2] = satObs->xc()[2];
     304          BB[iObs][3] = satObs->obsValue(tLC) - satObs->cmpValueForBanc(tLC);
    266305        }
    267         else if (satObs->isValid(t_lc::c2)) {
    268           tLC = t_lc::c2;
    269         }
    270       }
    271       if ( satObs->isValid(tLC) &&
    272           (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
    273         ++iObs;
    274         BB[iObs][0] = satObs->xc()[0];
    275         BB[iObs][1] = satObs->xc()[1];
    276         BB[iObs][2] = satObs->xc()[2];
    277         BB[iObs][3] = satObs->obsValue(tLC) - satObs->cmpValueForBanc(tLC);
    278306      }
    279307    }
     
    291319    // Check Blunders
    292320    // --------------
    293     const double BLUNDER = 500.0;
     321    const double BLUNDER = 200.0;
    294322    double   maxRes      = 0.0;
    295323    unsigned maxResIndex = 0;
    296324    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    297325      const t_pppSatObs* satObs = obsVector.at(ii);
    298       if (satObs->isValid() &&
     326      char sys = satObs->prn().system();
     327      if (satObs->isValid() && sys == sysBancroft &&
    299328          (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
    300329        ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3);
     
    313342        if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
    314343        LOG << "\n---------------------------------------------------------------\n";
    315         LOG << string(epoTime) << " BANCROFT:"        << ' '
     344        LOG << string(epoTime) << " BANCROFT " <<   sysBancroft << ": "
    316345            << setw(14) << setprecision(3) << xyzc[0] << ' '
    317346            << setw(14) << setprecision(3) << xyzc[1] << ' '
     
    331360
    332361  return success;
     362}
     363
     364// Compute A Priori Glonass Clock Offset
     365//////////////////////////////////////////////////////////////////////////////
     366double t_pppClient::cmpOffGlo(vector<t_pppSatObs*>& obsVector) {
     367
     368  t_lc::type tLC   = t_lc::dummy;
     369  double offGlo = 0.0;
     370
     371  if (_opt->useSystem('R')) {
     372    while (obsVector.size() > 0) {
     373      offGlo = 0.0;
     374      double   maxRes      = 0.0;
     375      int      maxResIndex = -1;
     376      t_prn    maxResPrn;
     377      unsigned nObs = 0;
     378      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     379        const t_pppSatObs* satObs = obsVector.at(ii);
     380        if (satObs->prn().system() == 'R') {
     381          if (tLC == t_lc::dummy) {
     382            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     383          }
     384          if (satObs->isValid(tLC) &&
     385              (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
     386            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     387            ++nObs;
     388            offGlo += ll;
     389            if (fabs(ll) > fabs(maxRes)) {
     390              maxRes      = ll;
     391              maxResIndex = ii;
     392              maxResPrn   = satObs->prn();
     393            }
     394          }
     395        }
     396      }
     397
     398      if (nObs > 0) {
     399        offGlo = offGlo / nObs;
     400      }
     401      else {
     402        offGlo = 0.0;
     403      }
     404      if (fabs(maxRes) > OPT->_aprSigClkOff) {
     405        LOG << "t_pppClient::cmpOffGR outlier " << maxResPrn.toString() << " " << maxRes << endl;
     406        delete obsVector.at(maxResIndex);
     407        obsVector.erase(obsVector.begin() + maxResIndex);
     408      }
     409      else {
     410        break;
     411      }
     412    }
     413  }
     414  return offGlo;
     415}
     416
     417// Compute A Priori Galileo Clock Offset
     418//////////////////////////////////////////////////////////////////////////////
     419double t_pppClient::cmpOffGal(vector<t_pppSatObs*>& obsVector) {
     420
     421  t_lc::type tLC   = t_lc::dummy;
     422  double     offGal = 0.0;
     423
     424  if (_opt->useSystem('E')) {
     425    while (obsVector.size() > 0) {
     426      offGal = 0.0;
     427      double   maxRes      = 0.0;
     428      int      maxResIndex = -1;
     429      t_prn    maxResPrn;
     430      unsigned nObs        = 0;
     431      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     432        const t_pppSatObs* satObs = obsVector.at(ii);
     433        if (satObs->prn().system() == 'E') {
     434          if (tLC == t_lc::dummy) {
     435            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     436          }
     437          if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
     438            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     439            ++nObs;
     440            offGal += ll;
     441            if (fabs(ll) > fabs(maxRes)) {
     442              maxRes      = ll;
     443              maxResIndex = ii;
     444              maxResPrn   = satObs->prn();
     445            }
     446          }
     447        }
     448      }
     449
     450      if (nObs > 0) {
     451        offGal = offGal / nObs;
     452      }
     453      else {
     454        offGal = 0.0;
     455      }
     456
     457      if (fabs(maxRes) > OPT->_aprSigClkOff) {
     458        LOG << "t_pppClient::cmpOffGE outlier " << maxResPrn.toString() << " " << maxRes << endl;
     459        delete obsVector.at(maxResIndex);
     460        obsVector.erase(obsVector.begin() + maxResIndex);
     461      }
     462      else {
     463        break;
     464      }
     465    }
     466  }
     467  return offGal;
     468}
     469
     470// Compute A Priori BDS Clock Offset
     471//////////////////////////////////////////////////////////////////////////////
     472double t_pppClient::cmpOffBds(vector<t_pppSatObs*>& obsVector) {
     473
     474  t_lc::type tLC   = t_lc::dummy;
     475  double offBds = 0.0;
     476
     477  if (_opt->useSystem('C')) {
     478    while (obsVector.size() > 0) {
     479      offBds = 0.0;
     480      double   maxRes      = 0.0;
     481      int      maxResIndex = -1;
     482      t_prn    maxResPrn;
     483      unsigned nObs        = 0;
     484      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     485        const t_pppSatObs* satObs = obsVector.at(ii);
     486        if (satObs->prn().system() == 'C') {
     487          if (tLC == t_lc::dummy) {
     488            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     489          }
     490          if (satObs->isValid(tLC) &&
     491              (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
     492            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     493            ++nObs;
     494            offBds += ll;
     495            if (fabs(ll) > fabs(maxRes)) {
     496              maxRes      = ll;
     497              maxResIndex = ii;
     498              maxResPrn   = satObs->prn();
     499            }
     500          }
     501        }
     502      }
     503
     504      if (nObs > 0) {
     505        offBds = offBds / nObs;
     506      }
     507      else {
     508        offBds = 0.0;
     509      }
     510
     511      if (fabs(maxRes) > OPT->_aprSigClkOff) {
     512        LOG << "t_pppClient::cmpOffGC outlier " << maxResPrn.toString() << " " << maxRes << endl;
     513        delete obsVector.at(maxResIndex);
     514        obsVector.erase(obsVector.begin() + maxResIndex);
     515      }
     516      else {
     517        break;
     518      }
     519    }
     520  }
     521  return offBds;
    333522}
    334523
     
    472661      return finish(failure, 4);
    473662    }
     663
     664    _offGlo = cmpOffGlo(_obsRover);
     665    _offGal = cmpOffGal(_obsRover);
     666    _offBds = cmpOffBds(_obsRover);
    474667
    475668    // Prepare Pseudo Observations of the Rover
     
    596789//
    597790//////////////////////////////////////////////////////////////////////////////
    598 void t_pppClient::reset() {cout << "t_pppClient::reset()" << endl;
     791void t_pppClient::reset() {
    599792
    600793  // to delete old orbit and clock corrections
Note: See TracChangeset for help on using the changeset viewer.