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


Ignore:
Timestamp:
Mar 1, 2024, 4:12:31 PM (5 months ago)
Author:
stuerze
Message:

changes regarding PPP

File:
1 edited

Legend:

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

    r10356 r10373  
    6767    }
    6868  }
     69  _offGps = 0.0;
    6970  _offGlo = 0.0;
    7071  _offGal = 0.0;
     
    255256                                  ColumnVector& xyzc, bool print) {
    256257  t_lc::type tLC = t_lc::dummy;
     258  char sysBancroft = 'G';
    257259  int  numBancroft = obsVector.size();
     260
     261  _usedSystems['G'] = _usedSystems['R'] = _usedSystems['E'] = _usedSystems['C'] = 0;
     262  for (unsigned jj = 0; jj < obsVector.size(); jj++) {
     263    const t_pppSatObs* satObs = obsVector[jj];
     264    char sys = satObs->prn().system();
     265    _usedSystems[sys]++;
     266  }
     267
     268  if      ((numBancroft = _usedSystems.value('G')) >= _opt->_minObs) {
     269    sysBancroft = 'G';
     270  }
     271  else if ((numBancroft = _usedSystems.value('E')) >= _opt->_minObs) {
     272    sysBancroft = 'E';
     273  }
     274  else if ((numBancroft = _usedSystems.value('C')) >= _opt->_minObs) {
     275    sysBancroft = 'C';
     276  }
     277  else if ((numBancroft = _usedSystems.value('R')) >= _opt->_minObs) {
     278    sysBancroft = 'R';
     279  }
     280  else {
     281    LOG << "t_pppClient::cmpBancroft not enough observations: " << endl;
     282    return failure;
     283  }
    258284
    259285  while (_running) {
     
    262288    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    263289      const t_pppSatObs* satObs = obsVector.at(ii);
     290      if (satObs->prn().system() == sysBancroft) {
    264291      if (tLC == t_lc::dummy) {
    265292        if (satObs->isValid(t_lc::cIF)) {
     
    282309      }
    283310    }
     311    }
    284312    if (iObs + 1 < _opt->_minObs) {
    285313      LOG << "t_pppClient::cmpBancroft not enough observations: " << iObs + 1 << endl;
     
    300328    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    301329      const t_pppSatObs* satObs = obsVector.at(ii);
    302       if (satObs->isValid() && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
     330      char sys = satObs->prn().system();
     331      if (satObs->isValid() && sys == sysBancroft &&
     332          (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) {
    303333        ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3);
    304334        double res = rr.NormFrobenius() - satObs->obsValue(tLC)
     
    316346        if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
    317347        LOG << "\n---------------------------------------------------------------\n";
    318         LOG << string(epoTime) << " BANCROFT " << ": "
     348        LOG << string(epoTime) << " BANCROFT " <<   sysBancroft << ": "
    319349            << setw(14) << setprecision(3) << xyzc[0] << ' '
    320350            << setw(14) << setprecision(3) << xyzc[1] << ' '
     
    334364
    335365  return success;
     366}
     367// Compute A Priori Gps Clock Offset
     368//////////////////////////////////////////////////////////////////////////////
     369double t_pppClient::cmpOffGps(vector<t_pppSatObs*>& obsVector) {
     370
     371  t_lc::type tLC   = t_lc::dummy;
     372  double     offGps = 0.0;
     373
     374  if (_opt->useSystem('G')) {
     375    while (obsVector.size() > 0) {
     376      offGps = 0.0;
     377      double   maxRes      = 0.0;
     378      int      maxResIndex = -1;
     379      unsigned nObs        = 0;
     380      t_prn    maxResPrn;
     381      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
     382        const t_pppSatObs* satObs = obsVector.at(ii);
     383        if (satObs->prn().system() == 'G') {
     384          if (tLC == t_lc::dummy) {
     385            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
     386          }
     387          if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle)) {
     388            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
     389            ++nObs;
     390            offGps += ll;
     391            if (fabs(ll) > fabs(maxRes)) {
     392              maxRes      = ll;
     393              maxResIndex = ii;
     394              maxResPrn   = satObs->prn();
     395            }
     396          }
     397        }
     398      }
     399
     400      if (nObs > 0) {
     401        offGps = offGps / nObs;
     402      }
     403      else {
     404        offGps = 0.0;
     405      }
     406
     407      if (fabs(maxRes) > 100.0) {
     408        LOG << "t_pppClient::cmpOffGps outlier " << maxResPrn.toString() << " " << maxRes << endl;
     409        delete obsVector.at(maxResIndex);
     410        obsVector.erase(obsVector.begin() + maxResIndex);
     411      }
     412      else {
     413        break;
     414      }
     415    }
     416  }
     417  return offGps;
    336418}
    337419
     
    636718    }
    637719
     720    _offGps = cmpOffGps(_obsRover);
    638721    _offGlo = cmpOffGlo(_obsRover);
    639722    _offGal = cmpOffGal(_obsRover);
Note: See TracChangeset for help on using the changeset viewer.