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


Ignore:
Timestamp:
Mar 25, 2021, 3:17:35 PM (3 years ago)
Author:
stuerze
Message:

update regarding PPP

File:
1 edited

Legend:

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

    r9288 r9386  
    309309    }
    310310    if (!std::isnan(maxRes) && maxRes < BLUNDER) {
    311       if (print) {
     311      if (print && _numEpoProcessing == 1) {
    312312        LOG.setf(ios::fixed);
    313313        LOG << string(epoTime) << " BANCROFT:"        << ' '
     
    370370        offGR = 0.0;
    371371      }
    372 
    373       if (fabs(maxRes) > 1000.0) {
     372      if (fabs(maxRes) > OPT->_aprSigOGC) {
    374373        LOG << "t_pppClient::cmpOffGR outlier " << maxResPrn.toString() << " " << maxRes << endl;
    375374        delete obsVector.at(maxResIndex);
     
    424423      }
    425424
    426       if (fabs(maxRes) > 1000.0) {
     425      if (fabs(maxRes) > OPT->_aprSigOGE) {
    427426        LOG << "t_pppClient::cmpOffGE outlier " << maxResPrn.toString() << " " << maxRes << endl;
    428427        delete obsVector.at(maxResIndex);
     
    477476      }
    478477
    479       if (fabs(maxRes) > 1000.0) {
     478      if (fabs(maxRes) > OPT->_aprSigOGC) {
    480479        LOG << "t_pppClient::cmpOffGC outlier " << maxResPrn.toString() << " " << maxRes << endl;
    481480        delete obsVector.at(maxResIndex);
     
    529528    _output->_trpStdev = _filter->trpStdev();
    530529
    531     _output->_numSat     = _filter->numSat();
    532     _output->_hDop       = _filter->HDOP();
     530    _output->_numSat   = _filter->numSat();
     531    _output->_hDop     = _filter->HDOP();
    533532    _output->_error = false;
    534533  }
     
    593592void t_pppClient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) {
    594593
    595   _historicalRefSats.clear();
    596594  try {
    597595    initOutput(output);
    598     int num = 0;
    599596    bool epochReProcessing = false;
    600 
     597    _numEpoProcessing = 0;
    601598    do {
    602       num++;
    603       if (num == 1) {
    604         LOG << "\nPPP of Epoch ";
    605         if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
    606         LOG << "\n---------------------------------------------------------------\n";
    607       }
    608 
     599      _numEpoProcessing++;
     600      if (_obsPool->refSatChanged()) {
     601        if(_filter->datumTransformation() != success) {
     602          return finish(failure);
     603        }
     604        else {
     605          _obsPool->saveLastEpoRefSats();
     606        }
     607      }
    609608      // Prepare Observations of the Rover
    610609      // ---------------------------------
    611610      if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
    612611        return finish(failure);
     612      }
     613
     614      if (_numEpoProcessing == 1) {
     615        LOG << "\nPPP of Epoch ";
     616        if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover);
     617        LOG << "\n---------------------------------------------------------------\n";
    613618      }
    614619
     
    624629      }
    625630
     631      if (_opt->_refSatRequired) {
     632        if (handleRefSatellites(_obsRover) != success) {
     633          _historicalRefSats.clear();
     634          return finish(failure);
     635        }
     636        if (_obsPool->refSatChanged()) {
     637            epochReProcessing = true;
     638            continue;
     639        }
     640      }
     641
    626642      _offGR = cmpOffGR(_obsRover);
    627643      _offGE = cmpOffGE(_obsRover);
    628644      _offGC = cmpOffGC(_obsRover);
    629645
    630       if (_opt->_refSatRequired) {
    631         setRefSatellites(_obsRover);
    632         LOG.setf(ios::fixed);
    633         QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
    634         while (it.hasNext()) {
    635           it.next();
    636           char   sys = it.key();
    637           string prn = it.value()->prn().toString();
    638           if (num == 1) {
    639             LOG << "set   ";
    640           }
    641           else {
    642             LOG << "reset ";
    643           }
    644           LOG << string(_epoTimeRover) << " REFSAT  " << sys << ": " << prn << endl;
    645         }
    646       }
    647 
    648 
    649646      // Prepare Pseudo Observations of the Rover
    650647      // ----------------------------------------
     
    656653      }
    657654
    658 
    659655      // Store last epoch of data
    660656      // ------------------------
    661657      _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono);
    662       _obsPool->setHistoricalRefSatList(_historicalRefSats);
    663658
    664659      // Process Epoch in Filter
    665660      // -----------------------
    666       if (_filter->processEpoch(num) != success) {
     661      if (_filter->processEpoch() != success) {
    667662        return finish(failure);
    668663      }
     
    670665      // Epoch re-processing required?
    671666      // -----------------------------
    672       if (_obsPool->refSatChangeRequired()) {
     667      if (_obsPool->refSatChangeRequired()) {//SLIP
    673668        epochReProcessing = true;
    674669        _obsPool->deleteLastEpoch();
    675         QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
    676         while (it.hasNext()) {
    677           it.next();
    678           _historicalRefSats.append(it.value()->prn());
    679         }
     670        setHistoricalRefSats();
    680671      }
    681672      else {
    682673        epochReProcessing = false;
    683 
     674        _historicalRefSats.clear();
    684675      }
    685676    } while (epochReProcessing);
     
    789780  // reference satellite definition per system
    790781  for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
    791     char system = _opt->systems()[iSys];
     782    char sys = _opt->systems()[iSys];
    792783    bool refSatDefined = false;
    793     t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system);
     784    t_pppRefSat* refSat = _obsPool->getRefSatMapElement(sys);
    794785    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    795786      t_pppSatObs* satObs = obsVector.at(ii);
    796       if (satObs->eleSat() < _opt->_minEle) {continue;}
     787      if (satObs->eleSat() < _opt->_minEle) {
     788        continue;
     789      }
    797790      // reference satellite is unchanged
    798       if      (!_obsPool->refSatChangeRequired() && refSat->prn() == satObs->prn()) {
     791      if      (!_obsPool->refSatChangeRequired(sys) && refSat->prn() == satObs->prn()) {
    799792        refSatDefined = true;
    800793        obsVector[ii]->setAsReference();
     794#ifdef BNC_DEBUG_PPP
     795        LOG << "=> unchanged refsatprn: "  <<  satObs->prn().toString() << endl;
     796#endif
    801797      }
    802798      // reference satellite has changed
    803       else if ( _obsPool->refSatChangeRequired() && refSat->prn() != satObs->prn() && !_historicalRefSats.contains(satObs->prn())) {
    804         if (satObs->prn().system() == system) {
     799      else if ( _obsPool->refSatChangeRequired(sys) &&
     800                refSat->prn() != satObs->prn() &&
     801                !_historicalRefSats[sys].contains(satObs->prn())) {
     802        if (satObs->prn().system() == sys) {
    805803          refSatDefined = true;
    806804          obsVector[ii]->setAsReference();
    807805          refSat->setPrn(satObs->prn());
     806#ifdef BNC_DEBUG_PPP
     807          LOG << "=> set refsatprn: "  <<  satObs->prn().toString() << endl;
     808#endif
    808809        }
    809810      }
     
    822823          continue;
    823824        }
    824         if (satObs->prn().system() == system) {
     825        if (satObs->prn().system() == sys &&
     826            !_historicalRefSats[sys].contains(satObs->prn())) {
    825827          obsVector[ii]->setAsReference();
    826828          refSat->setPrn(satObs->prn());
     829#ifdef BNC_DEBUG_PPP
     830          LOG << " => set refsatprn: "  <<  satObs->prn().toString() << endl;
     831#endif
    827832          if (OPT->_pseudoObsIono) {
    828833            refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
     
    833838      }
    834839    }
    835   }
    836   _obsPool->setRefSatChangeRequired(false);
    837 
     840    if (!refSatDefined) {
     841      refSat->setPrn(t_prn());
     842    }
     843    _obsPool->setRefSatChangeRequired(sys, false);
     844  }
     845}
     846
     847//
     848//////////////////////////////////////////////////////////////////////////////
     849t_irc t_pppClient::handleRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
     850
     851  // set refSats in current epoch
     852  // ============================
     853  setRefSatellites(obsVector); // current epoch
     854  LOG.setf(ios::fixed);
     855  QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
     856  while (it.hasNext()) {
     857    it.next();
     858    char  sys = it.key();
     859    t_prn prn = it.value()->prn();
     860    if (prn.number() == 0) {
     861      return failure;
     862    }
     863    QString str;
     864    if (prn == _obsPool->getRefSatMapElementLastEpoch(sys) ||
     865               _obsPool->getRefSatMapElementLastEpoch(sys) == t_prn() )  {
     866      _obsPool->setRefSatChanged(sys, false);
     867      str = " SET   ";
     868    }
     869    else {
     870      _obsPool->setRefSatChanged(sys, true);
     871      str = " RESET ";
     872    }
     873    LOG << string(_epoTimeRover) <<  str.toStdString() << " REFSAT  " << sys << ": " << prn.toString() << endl;
     874  }
     875  return success;
     876}
     877
     878void t_pppClient::setHistoricalRefSats() {
     879  QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap());
     880  while (it.hasNext()) {
     881    it.next();
     882    t_prn prn = it.value()->prn();
     883    char sys = prn.system();
     884    if (_obsPool->refSatChangeRequired(sys)){
     885      _historicalRefSats[sys].append(prn);
     886    }
     887  }
    838888}
    839889
Note: See TracChangeset for help on using the changeset viewer.