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


Ignore:
Timestamp:
Jun 18, 2026, 4:02:38 PM (5 days ago)
Author:
stuerze
Message:

bugfix regarding ionospheric constraints

File:
1 edited

Legend:

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

    r10805 r10938  
    230230
    231231  if (_opt->_pseudoObsIono) {
    232     vector<t_pppSatObs*>::iterator it = obsVector.begin();
    233     while (it != obsVector.end()) {
    234       t_pppSatObs* satObs = *it;
    235       pseudoObsIono = satObs->setPseudoObsIono(t_frequency::G1);
    236       it++;
     232
     233    // Select reference satellite per system: keep the current one if still
     234    // visible; only switch to highest elevation when the current one disappears
     235    // -------------------------------------------------------------------------
     236    map<char, t_pppSatObs*> refSatMap;
     237    map<char, t_pppSatObs*> bestEleMap;
     238    for (t_pppSatObs* satObs : obsVector) {
     239      satObs->resetReference();
     240      double stec = satObs->getIonoCodeDelay(t_frequency::G1);
     241      if (stec == 0.0) continue;
     242      char sys = satObs->prn().system();
     243      if (!bestEleMap.count(sys) || satObs->eleSat() > bestEleMap[sys]->eleSat()) {
     244        bestEleMap[sys] = satObs;
     245      }
     246      if (_refPrnMap.count(sys) && satObs->prn() == _refPrnMap[sys]) {
     247        refSatMap[sys] = satObs;
     248      }
     249    }
     250    for (auto& kv : bestEleMap) {
     251      if (!refSatMap.count(kv.first)) {
     252        refSatMap[kv.first] = kv.second;
     253      }
     254    }
     255    for (auto& kv : refSatMap) {
     256      _refPrnMap[kv.first] = kv.second->prn();
     257      kv.second->setAsReference();
     258    }
     259
     260    if (bestEleMap.empty()) {
     261      LOG << "GIM pseudo-obs unavailable: no valid STEC (vTec data missing?)" << endl;
     262    }
     263
     264    // Set STEC pseudo-observations (single-differenced vs reference satellite)
     265    // -------------------------------------------------------------------------
     266    int nGIM = 0;
     267    for (t_pppSatObs* satObs : obsVector) {
     268      char sys = satObs->prn().system();
     269      double stecRefSat = refSatMap.count(sys)
     270                          ? refSatMap[sys]->getIonoCodeDelay(t_frequency::G1)
     271                          : 0.0;
     272      if (satObs->setPseudoObsIono(t_frequency::G1, stecRefSat)) {
     273        pseudoObsIono = true;
     274        nGIM++;
     275      }
     276    }
     277    if (nGIM > 0) {
     278      LOG << "GIM pseudo-obs: " << nGIM << " satellites, ref:";
     279      for (auto& kv : refSatMap) {
     280        LOG << ' ' << kv.second->prn().toString();
     281      }
     282      LOG << endl;
    237283    }
    238284  }
     
    598644
    599645  LOG << "pppClient: reset" << endl;
     646  _refPrnMap.clear();
    600647  // to delete old orbit and clock corrections
    601648  delete _ephPool;
Note: See TracChangeset for help on using the changeset viewer.