Changeset 9508 in ntrip for trunk/BNC/src/PPP/pppFilter.cpp


Ignore:
Timestamp:
Oct 6, 2021, 10:50:34 PM (3 years ago)
Author:
stuerze
Message:

some changes regarding PPP

File:
1 edited

Legend:

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

    r9504 r9508  
    7272  string epoTimeStr = string(_epoTime);
    7373
     74  const QMap<char, t_pppRefSat*>& refSatMap = epoch->refSatMap();
     75
    7476  if (OPT->_obsModelType == OPT->DCMcodeBias ||
    7577      OPT->_obsModelType == OPT->DCMphaseBias) {
    7678     // Save parameters of epoch before
    7779    _parlist_sav = _parlist;
    78  }
     80  }
    7981
    8082  //--
    8183  // Set Parameters
    82   if (_parlist.set(_epoTime, allObs, _obsPool->getRefSatMap()) != success) {
     84  if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
    8385    return failure;
    8486  }
    85 
    8687  const vector<t_pppParam*>& params = _parlist.params();
    8788#ifdef BNC_DEBUG_PPP
    88   for (int iPar = 0; iPar < params.size(); iPar++) {
    89     LOG << "available par " << params[iPar]->toString() << endl;
     89  for (unsigned iPar = 0; iPar < params.size(); iPar++) {
     90    LOG << "t_pppFilter::processEpoch par_cur " << params[iPar]->toString() << endl;
    9091  }
    9192#endif
     
    133134    for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    134135      char sys = usedSystems[iSys];
    135       _refPrn = (_obsPool->getRefSatMapElement(sys))->prn();
     136      _refPrn = refSatMap[sys]->prn();
    136137     vector<t_pppSatObs*> obsVector;
    137138      for (unsigned jj = 0; jj < allObs.size(); jj++) {
     
    170171    char sys = usedSystems[iSys];
    171172    if (OPT->_refSatRequired) {
    172       _refPrn = (_obsPool->getRefSatMapElement(sys))->prn();
     173      _refPrn = refSatMap[sys]->prn();
    173174    }
    174175    else {
     
    195196  // close epoch processing
    196197  // ----------------------
    197   cmpDOP(allObs);
     198  cmpDOP(allObs, refSatMap);
    198199  _parlist.printResult(_epoTime, _QFlt, _xFlt);
    199200  _lastEpoTimeOK = _epoTime;  // remember time of last successful epoch processing
    200   if (OPT->_refSatRequired) {
    201     _obsPool->saveLastEpoRefSats();
    202   }
    203201  return success;
    204202}
     
    596594// Compute various DOP Values
    597595////////////////////////////////////////////////////////////////////////////
    598 void t_pppFilter::cmpDOP(const vector<t_pppSatObs*>& obsVector) {
     596void t_pppFilter::cmpDOP(const vector<t_pppSatObs*>& obsVector,
     597                         const QMap<char, t_pppRefSat*>& refSatMap) {
    599598
    600599  _dop.reset();
     
    606605    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
    607606      t_pppSatObs* obs = obsVector[ii];
    608       char system = obs->prn().system();
     607      char sys = obs->prn().system();
    609608      t_prn refPrn = t_prn();
    610609      if (OPT->_refSatRequired) {
    611         refPrn = _obsPool->getRefSatMapElement(system)->prn();
     610        refPrn = refSatMap[sys]->prn();
    612611      }
    613612      if (obs->isValid() && !obs->outlier()) {
     
    678677// Compute datum transformation
    679678////////////////////////////////////////////////////////////////////////////
    680 t_irc t_pppFilter::datumTransformation() {
     679t_irc t_pppFilter::datumTransformation(const QMap<char, t_pppRefSat*>& refSatMap) {
     680
    681681  // get last epoch
    682682  t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch();
    683683  if (!epoch) {
    684     LOG << "!lastEpoch" << endl;
     684    LOG << "t_pppFilter::datumTransformation: !lastEpoch" << endl;
    685685    return failure;
    686686  }
    687   else {
    688     LOG.setf(ios::fixed);
    689     LOG << string(epoch->epoTime()) << " DATUM TRANSFORMATION " << endl;
    690   }
     687  _epoTime = epoch->epoTime();
     688  LOG.setf(ios::fixed);
     689  LOG << string(_epoTime) << " DATUM TRANSFORMATION " << endl;
    691690
    692691  vector<t_pppSatObs*>& allObs = epoch->obsVector();
     692
     693  const QMap<char, t_pppRefSat*>& refSatMapLastEpoch = epoch->refSatMap();
     694
     695  bool peseudoObsIono = epoch->pseudoObsIono();
    693696
    694697  // reset old and set new refSats in last epoch (ambiguities/GIM)
    695698  // =============================================================
    696   if (resetRefSatellitesLastEpoch(allObs) != true) {
     699  if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) != true) {
    697700    LOG  << "refsatChange required" << endl;
    698701    return success;
     
    705708  // set AA2
    706709  // =======
    707   if (_parlist.set(epoch->epoTime(), allObs, _obsPool->getRefSatMap()) != success) {
     710  if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
    708711    return failure;
    709712  }
    710   const vector<t_pppParam*>& _params = _parlist.params();
     713  vector<t_pppParam*>& _params = _parlist.params();
    711714  unsigned nPar = _parlist.nPar();
    712715#ifdef BNC_DEBUG_PPP
    713   LOG << " parameters of last epoch" << endl;
     716  LOG << " t_pppFilter::datumTransformation par last epoch: " << _params.size() << "/" << nPar << endl;
    714717  for (unsigned iPar = 0; iPar < nPar; iPar++) {
    715     LOG << _params[iPar]->toString() << "\t\t" << endl;
     718    LOG << _params[iPar]->toString() << "\t\t" endl;
    716719  }
    717720#endif
     
    719722  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    720723    char sys = usedSystems[iSys];
    721     t_prn refPrn = (_obsPool->getRefSatMapElement(sys))->prn();
     724    t_prn refPrn = refSatMap[sys]->prn();
    722725    vector<t_pppSatObs*> obsVector;
    723726    for (unsigned jj = 0; jj < allObs.size(); jj++) {
     
    731734    vector<t_lc::type> LCs = OPT->LCs(sys);
    732735    unsigned usedLCs = LCs.size();
    733     if (OPT->_pseudoObsIono && !epoch->pseudoObsIono()) {
     736    if (OPT->_pseudoObsIono && !peseudoObsIono) {
    734737        usedLCs -= 1;  // GIM not used
    735738    }
     
    744747      maxObs += 1;
    745748    }
    746     if (OPT->_pseudoObsIono && epoch->pseudoObsIono()) {
     749    if (OPT->_pseudoObsIono && peseudoObsIono) {
    747750      maxObs -= 1; // pseudo obs iono with respect to refSat
    748751    }
    749752    Matrix  AA(maxObs, nPar);
    750 
    751753    // Real Observations
    752754    // -----------------
     
    787789      continue;
    788790    }
    789     _datumTrafo->updateIndices(sys, iObs+1);
    790     _datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, nPar), 2);
     791    _datumTrafo->updateIndices(sys, iObs+1);    //LOG << "AA Ncols/Nrows: " << AA.Ncols() << "/" << AA.Nrows() << "  nPar: "  << nPar << endl;    //LOG << "AA.SubMatrix(1 .. " << iObs+1 << " , 1 .. " <<  nPar << ")" << endl;
     792    if(_datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, nPar), 2) != success) {
     793      return failure;
     794    }
    791795  }
    792796  _datumTrafo->updateNumObs();
     
    819823  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
    820824    char sys = usedSystems[iSys];
    821     t_prn refPrnOld = _obsPool->getRefSatMapElementLastEpoch(sys);
    822     t_prn refPrnNew = (_obsPool->getRefSatMapElement(sys))->prn();
     825    t_prn refPrnOld = refSatMapLastEpoch[sys]->prn();
     826    t_prn refPrnNew = refSatMap[sys]->prn();
    823827    if (refPrnNew != refPrnOld) {
    824       t_irc irc = resetAmb(_obsPool->getRefSatMapElementLastEpoch(sys), allObs);
     828      t_irc irc = resetAmb(refPrnOld, allObs);
    825829      if (OPT->_obsModelType == OPT->DCMcodeBias) {
    826830        if (irc == success) {
     
    834838  // =================
    835839  _datumTrafo->switchAA();
     840
     841  _obsPool->putEpoch(_epoTime, allObs, peseudoObsIono, refSatMap);
    836842
    837843  return success;
     
    877883//
    878884//////////////////////////////////////////////////////////////////////////////
    879 bool t_pppFilter::resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector) {
     885bool t_pppFilter::resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector,
     886    const QMap<char, t_pppRefSat*>& refSatMap,
     887    const QMap<char, t_pppRefSat*>& refSatMapLastEpoch) {
    880888  bool resetRefSat;
    881889  // reference satellite definition per system
     
    884892    resetRefSat = false;
    885893    char sys = usedSystems[iSys];
    886     t_pppRefSat* refSat = _obsPool->getRefSatMapElement(sys);
    887     t_prn newPrn = refSat->prn();
    888     t_prn oldPrn = _obsPool->getRefSatMapElementLastEpoch(sys);
     894    t_prn newPrn = refSatMap[sys]->prn();
     895    t_prn oldPrn = refSatMapLastEpoch[sys]->prn();
    889896#ifdef BNC_DEBUG_PPP
    890     LOG << "oldPrn: " << oldPrn.toString() << " => newPrn: " << newPrn.toString() << endl;
     897    if (oldPrn != newPrn) {
     898      LOG << "oldRef: " << oldPrn.toString() << " => newRef " <<  newPrn.toString() << endl;
     899    }
    891900#endif
    892901    vector<t_pppSatObs*>::iterator it = obsVector.begin();
     
    896905        resetRefSat = true;
    897906        satObs->setAsReference();
    898       }
    899       else if (satObs->prn() == oldPrn) {
     907      } else if (satObs->prn() == oldPrn) {
    900908        satObs->resetReference();
    901909      }
Note: See TracChangeset for help on using the changeset viewer.