Changeset 10373 in ntrip


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

changes regarding PPP

Location:
trunk/BNC/src/PPP
Files:
6 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);
  • trunk/BNC/src/PPP/pppClient.h

    r10259 r10373  
    3636  const bncAntex*     antex() const {return _antex;}
    3737  const t_pppStation* staRover() const {return _staRover;}
     38  double              offGps() const {return _offGps;}
    3839  double              offGlo() const {return _offGlo;}
    3940  double              offGal() const {return _offGal;}
    4041  double              offBds() const {return _offBds;}
     42  void                resetOffGps() {_offGps = 0.0;}
    4143  void                resetOffGlo() {_offGlo = 0.0;}
    4244  void                resetOffGal() {_offGal = 0.0;}
    4345  void                resetOffBds() {_offBds = 0.0;}
     46
    4447
    4548  std::ostringstream& log() {return *_log;}
     
    6366  t_irc cmpBancroft(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector,
    6467                    ColumnVector& xyzc, bool print);
     68  double cmpOffGps(std::vector<t_pppSatObs*>& obsVector);
    6569  double cmpOffGlo(std::vector<t_pppSatObs*>& obsVector);
    6670  double cmpOffGal(std::vector<t_pppSatObs*>& obsVector);
     
    7579  bncAntex*                 _antex;
    7680  t_pppFilter*              _filter;
     81  double                    _offGps;
    7782  double                    _offGlo;
    7883  double                    _offGal;
  • trunk/BNC/src/PPP/pppFilter.cpp

    r10369 r10373  
    7676  string epoTimeStr = string(_epoTime);
    7777
    78   const QList<char> &usedSystems = _parlist->usedSystems();
     78  const QMap<char, int> &usedSystems = _parlist->usedSystems();
    7979
    8080  // Set Parameters
     
    9292  // Process Satellite Systems separately
    9393  // ------------------------------------
    94   for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    95     char sys = usedSystems[iSys];
    96     unsigned int num = 0;
     94  for (auto it = usedSystems.begin(); it != usedSystems.end(); ++it) {
     95    char     sys = it.key();
     96    unsigned num = 0;
    9797    vector<t_pppSatObs*> obsVector;
    9898    for (unsigned jj = 0; jj < allObs.size(); jj++) {
     
    185185            AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);
    186186          }
     187          double offGps = 0.0;
     188          if (sys == 'G' && tLC != t_lc::MW) {
     189            offGps = PPP_CLIENT->offGps();
     190          }
    187191          double offGlo = 0.0;
    188192          if (sys == 'R' && tLC != t_lc::MW) {
     
    197201            offBds = PPP_CLIENT->offBds();
    198202          }
    199           ll[iObs] = obs->obsValue(tLC) - offGlo - offGal - offBds  - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
     203          ll[iObs] = obs->obsValue(tLC) -offGps - offGlo - offGal - offBds  - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
    200204          PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
    201205        }
     
    229233              AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);
    230234            }
     235            double offGps = 0.0;
     236            if (sys == 'G' && tLC != t_lc::MW) {
     237              offGps = PPP_CLIENT->offGps();
     238            }
    231239            double offGlo = 0.0;
    232240            if (sys == 'R' && tLC != t_lc::MW) {
     
    241249              offBds = PPP_CLIENT->offBds();
    242250            }
    243             ll[iObs] = obs->obsValue(tLC) - offGlo - offGal - offBds  - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
     251            ll[iObs] = obs->obsValue(tLC) -offGps - offGlo - offGal - offBds  - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
    244252            PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
    245253          }
     
    375383
    376384        // Check Pre-Fit Residuals
    377         /* -----------------------
     385        // -----------------------
    378386        else {
    379387          ColumnVector AA(params.size());
     
    382390            AA[iPar] = par->partial(_epoTime, obs, tLC);
    383391          }
     392          double offGps = 0.0;
     393          if (sys == 'G' && tLC != t_lc::MW) {
     394            offGps = PPP_CLIENT->offGps();
     395          }
    384396          double offGlo = 0.0;
    385397          if (sys == 'R' && tLC != t_lc::MW) {
     
    394406            offBds = PPP_CLIENT->offBds();
    395407          }
    396           double ll = obs->obsValue(tLC) - offGlo - offGal - offBds  - obs->cmpValue(tLC) - DotProduct(_x0, AA);
     408          double ll = obs->obsValue(tLC) -offGps - offGlo - offGal - offBds  - obs->cmpValue(tLC) - DotProduct(_x0, AA);
    397409          double vv = DotProduct(AA, _xFlt) - ll;
    398410
     
    402414            resetAmb(obs->prn(), obsVector, tLC);
    403415          }
    404         }*/
     416        }
    405417      }
    406418    }
  • trunk/BNC/src/PPP/pppParlist.cpp

    r10356 r10373  
    7474         const t_pppSatObs* obs = obsVector->at(ii);
    7575         if (obs->prn() == _prn) {
     76           double offGps = 0.0;
     77           if (_prn.system() == 'G' && tLC != t_lc::MW) {
     78             offGps = PPP_CLIENT->offGps();
     79           }
    7680           double offGlo = 0.0;
    7781           if (_prn.system() == 'R' && tLC != t_lc::MW) {
     
    8690             offBds = PPP_CLIENT->offBds();
    8791           }
    88            _x0 = floor((obs->obsValue(tLC) - offGlo - offGal - offBds - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
     92           _x0 = floor((obs->obsValue(tLC) - offGps - offGlo - offGal - offBds - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
    8993           break;
    9094         }
    9195       }
    9296     }
     97     break;
     98   case offGps:
     99     _epoSpec = true;
     100     _sigma0  = OPT->_aprSigClkOff;
     101     _x0      = PPP_CLIENT->offGps();
    93102     break;
    94103   case offGlo:
     
    171180    if (tLC == t_lc::GIM) {return 0.0;}
    172181    return 1.0;
     182  case offGps:
     183    if (tLC == t_lc::GIM) {return 0.0;}
     184    return (obs->prn().system() == 'G') ? 1.0 : 0.0;
    173185  case offGlo:
    174186    if (tLC == t_lc::GIM) {return 0.0;}
     
    299311    ss << "REC_CLK     ";
    300312    break;
     313  case offGps:
     314    ss << "OFF_GPS     ";
     315    break;
    301316  case offGlo:
    302317    ss << "OFF_GLO     ";
     
    345360////////////////////////////////////////////////////////////////////////////
    346361t_pppParlist::~t_pppParlist() {
    347   _usedSystems.clear();
    348362
    349363  for (unsigned ii = 0; ii < _params.size(); ii++) {
     
    396410  // check which systems have observations
    397411  // -------------------------------------
    398   _usedSystems.clear();
     412  _usedSystems['G'] = _usedSystems['R'] = _usedSystems['E'] = _usedSystems['C'] = 0;
    399413  for (unsigned jj = 0; jj < obsVector.size(); jj++) {
    400414    const t_pppSatObs* satObs = obsVector[jj];
    401415    char sys = satObs->prn().system();
    402     if (!_usedSystems.contains(sys)) {
    403       _usedSystems.append(sys);
    404     }
     416    _usedSystems[sys]++;
    405417  }
    406418
     
    438450                par->type() == t_pppParam::cBiasG2 ||
    439451                par->type() == t_pppParam::pBiasG1 ||
    440                 par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('G')) {
     452                par->type() == t_pppParam::pBiasG2) && !_usedSystems.value('G')) {
    441453#ifdef BNC_DEBUG_PPP
    442454       //LOG << "remove1 " << par->toString() << std::endl;
     
    448460                par->type() == t_pppParam::cBiasR2 ||
    449461                par->type() == t_pppParam::pBiasR1 ||
    450                 par->type() == t_pppParam::pBiasR2) && !usedSystems().contains('R')) {
     462                par->type() == t_pppParam::pBiasR2) && !_usedSystems.value('R')){
    451463#ifdef BNC_DEBUG_PPP
    452464        //LOG << "remove1 " << par->toString() << std::endl;
     
    458470                par->type() == t_pppParam::cBiasE2 ||
    459471                par->type() == t_pppParam::pBiasE1 ||
    460                 par->type() == t_pppParam::pBiasE2) && !usedSystems().contains('E')) {
     472                par->type() == t_pppParam::pBiasE2) && !_usedSystems.value('E')) {
    461473#ifdef BNC_DEBUG_PPP
    462474        //LOG << "remove1 " << par->toString() << std::endl;
     
    468480                par->type() == t_pppParam::cBiasC2 ||
    469481                par->type() == t_pppParam::pBiasC1 ||
    470                 par->type() == t_pppParam::pBiasC2) && !usedSystems().contains('C')) {
     482                par->type() == t_pppParam::pBiasC2) && !_usedSystems.value('C')) {
    471483#ifdef BNC_DEBUG_PPP
    472484        //LOG << "remove1 " << par->toString() << std::endl;
     
    497509  // GLONASS Clock Offset
    498510  // --------------------
    499   if (OPT->useSystem('R')) {
     511  if ( _usedSystems.value('R')  &&
     512      (_usedSystems.value('G') || _usedSystems.value('E') || _usedSystems.value('C'))) {
    500513    required.push_back(new t_pppParam(t_pppParam::offGlo, t_prn(), t_lc::dummy));
     514  }
     515  else {
     516    PPP_CLIENT->resetOffGlo();
    501517  }
    502518
    503519  // Galileo Clock Offset
    504520  // --------------------
    505   if (OPT->useSystem('E')) {
     521  if (_usedSystems.value('E') && _usedSystems.value('G') && _usedSystems.value('G') >= OPT->_minObs) {
    506522    required.push_back(new t_pppParam(t_pppParam::offGal, t_prn(), t_lc::dummy));
     523  }
     524  else {
     525    PPP_CLIENT->resetOffGal();
     526  }
     527
     528  // GPS Clock Offset
     529  // --------------------
     530  if (_usedSystems.value('E') && _usedSystems.value('G') && _usedSystems.value('G') < OPT->_minObs) {
     531    required.push_back(new t_pppParam(t_pppParam::offGps, t_prn(), t_lc::dummy));
     532  }
     533  else {
     534    PPP_CLIENT->resetOffGps();
    507535  }
    508536
    509537  // BDS Clock Offset
    510538  // ----------------
    511   if (OPT->useSystem('C')) {
     539  if (_usedSystems.contains('C')  &&
     540      (_usedSystems.contains('G') || _usedSystems.contains('E'))) {
    512541    required.push_back(new t_pppParam(t_pppParam::offBds, t_prn(), t_lc::dummy));
     542  }
     543  else {
     544    PPP_CLIENT->resetOffBds();
    513545  }
    514546
  • trunk/BNC/src/PPP/pppParlist.h

    r10256 r10373  
    1414class t_pppParam {
    1515 public:
    16   enum e_type {crdX, crdY, crdZ, rClk, offGlo, offGal, offBds, trp, ion, amb,
     16  enum e_type {crdX, crdY, crdZ, rClk, offGps, offGlo, offGal, offBds, trp, ion, amb,
    1717               cBiasG1, cBiasR1, cBiasE1, cBiasC1, pBiasG1, pBiasR1, pBiasE1, pBiasC1,
    1818               cBiasG2, cBiasR2, cBiasE2, cBiasC2, pBiasG2, pBiasR2, pBiasE2, pBiasC2};
     
    104104  const std::vector<t_pppParam*>& params() const {return _params;}
    105105  std::vector<t_pppParam*>& params() {return _params;}
    106   const QList<char>& usedSystems() const {return _usedSystems;}
     106  const QMap<char, int>& usedSystems() const {return _usedSystems;}
    107107  void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
    108108                   const ColumnVector& xx) const;
     
    111111 private:
    112112  std::vector<t_pppParam*> _params;
    113   QList<char>              _usedSystems;
     113  QMap<char, int>          _usedSystems;
    114114};
    115115
  • trunk/BNC/src/PPP/pppSatObs.cpp

    r10336 r10373  
    660660  for (unsigned ii = 0; ii < OPT->LCs(sys).size(); ii++) {
    661661    t_lc::type tLC = OPT->LCs(sys)[ii];
     662    double offGps = 0.0;
     663    if (_prn.system() == 'G' && tLC != t_lc::MW) {
     664      offGps = PPP_CLIENT->offGps();
     665    }
    662666    double offGlo = 0;
    663667    if (sys == 'R' && tLC != t_lc::MW) {
     
    675679        << setw(12) << setprecision(3) << obsValue(tLC) << " "
    676680        << setw(12) << setprecision(3) << cmpValue(tLC) << " "
    677         << setw(12) << setprecision(3) << obsValue(tLC) - offGlo - offGal - offBds  - cmpValue(tLC) << endl;
     681        << setw(12) << setprecision(3) << obsValue(tLC) - offGps - offGlo - offGal - offBds  - cmpValue(tLC) << endl;
    678682  }
    679683}
Note: See TracChangeset for help on using the changeset viewer.