Changeset 11041 in ntrip for trunk/BNC/src/PPP/pppSatObs.cpp


Ignore:
Timestamp:
Sep 22, 2026, 4:08:55 PM (10 hours ago)
Author:
stuerze
Message:

updates regarding RTCM-SSR

File:
1 edited

Legend:

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

    r10942 r11041  
    400400
    401401
     402// A system's Satellite Antenna message is only trustworthy once the
     403// provider has confirmed it via Metadata: SatelliteAntennaIOD (DF+010) must
     404// be non-zero, and must match the Data IOD (DF+069) of a Metadata entry for
     405// model-correction type 1 (satellite antenna PCV) or type 2 (GDV) - either
     406// entry matching is sufficient. Metadata carries this IOD once globally, not
     407// per system (DF+010 is GNSS-specific, DF+069 is not), so the same Metadata
     408// entries are reused as the trust anchor for every system's check - the
     409// provider is relied on to keep DF+010 synchronized with DF+069 across all
     410// systems for this to work.
     411////////////////////////////////////////////////////////////////////////////
     412static bool ssrSatAntennaTrusted(const t_satAntenna* satAntenna) {
     413  if (!satAntenna || satAntenna->_satelliteAntennaIOD == 0) {
     414    return false;
     415  }
     416  const t_metaData* metaData = PPP_CLIENT->obsPool()->metaData();
     417  if (!metaData) {
     418    return false;
     419  }
     420  for (unsigned ii = 0; ii < metaData->_entries.size(); ii++) {
     421    const t_metaDataEntry& entry = metaData->_entries[ii];
     422    if ((entry._typeIndicator == 1 || entry._typeIndicator == 2) && // PCV or GDV
     423        entry._dataIODIndicator &&
     424        entry._dataIOD == satAntenna->_satelliteAntennaIOD) {
     425      return true;
     426    }
     427  }
     428  return false;
     429}
     430
     431// Satellite antenna correction (offset + nadir-angle-dependent PCV) from a
     432// live SSR Satellite Antenna message, in the same additive sense as
     433// bncAntex::satCorr(). Returns false (corr untouched) if no trusted SSR data
     434// is available for this PRN/frequency (see ssrSatAntennaTrusted), so the
     435// caller falls back to the static ANTEX file.
     436////////////////////////////////////////////////////////////////////////////
     437static bool ssrSatAntennaCorr(const t_satAntenna* satAntenna, const string& frqStr,
     438                               double elTx, double& corr) {
     439  if (!satAntenna) {
     440    return false;
     441  }
     442  for (unsigned ii = 0; ii < satAntenna->_freq.size(); ii++) {
     443    const t_frqAntenna& frq = satAntenna->_freq[ii];
     444    if (frq._frqType != frqStr) {
     445      continue;
     446    }
     447    corr = 0.0;
     448    if (frq._nadirCorrectionIndicator) {
     449      corr += frq._nadirCorrection;
     450    }
     451    if (!frq._nadirAngleCorrection.empty()) {
     452      // 1-degree bins starting at nadir (0 deg), per RTCM-SSR spec
     453      double nadirDeg = 90.0 - elTx * 180.0 / M_PI;
     454      int    idx      = int(nadirDeg + 0.5);
     455      if (idx < 0) {
     456        idx = 0;
     457      }
     458      else if (idx >= (int)frq._nadirAngleCorrection.size()) {
     459        idx = (int)frq._nadirAngleCorrection.size() - 1;
     460      }
     461      corr += frq._nadirAngleCorrection[idx];
     462    }
     463    return true;
     464  }
     465  return false;
     466}
     467
    402468//
    403469////////////////////////////////////////////////////////////////////////////
     
    476542  // -------------------------------------------
    477543  if (PPP_CLIENT->antex()) {
     544    const t_satAntenna* satAntenna = PPP_CLIENT->obsPool()->satAntenna(_prn);
     545    if (!ssrSatAntennaTrusted(satAntenna)) {
     546      satAntenna = 0; // untrusted (IOD zero, or not confirmed via Metadata) - fall back to ANTEX
     547    }
    478548    for (unsigned ii = 0; ii < t_frequency::max; ii++) {
    479549      t_frequency::type frqType = static_cast<t_frequency::type>(ii);
     
    482552      bool found;
    483553      QString prn(_prn.toString().c_str());
    484       _model._antPCO[ii]  = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
    485       _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
    486       if (OPT->_isAPC && found) {
    487         // the PCOs as given in the satellite antenna correction for all frequencies
    488         // have to be reduced by the PCO of the respective reference frequency
    489         if      (_prn.system() == 'G') {
    490           _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
     554      _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
     555
     556      // Prefer a live, trusted SSR Satellite Antenna correction over the
     557      // static ANTEX file when available for this satellite/frequency,
     558      // mirroring how SSR orbit/clock corrections already take precedence
     559      // over broadcast ephemerides elsewhere in this codebase. Unlike
     560      // ANTEX's satCorr() (a single geometric PCO/PCV value shared by code
     561      // and phase alike), the SSR message's DF+011/DF+012 indicators say
     562      // explicitly which observable(s) the correction applies to, so it is
     563      // routed into the dedicated phase-only/code-only fields instead of
     564      // the shared _antPCO - both may fire for the same ssrCorr value if
     565      // both indicators are set.
     566      double ssrCorr;
     567      if (ssrSatAntennaCorr(satAntenna, frqStr, _model._elTx, ssrCorr)) {
     568        if (satAntenna->_phaseCenterInfoInd) {
     569          _model._antPCV[ii] += ssrCorr;
    491570        }
    492         else if (_prn.system() == 'R') {
    493           _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
     571        if (satAntenna->_groupDelayInfoInd) {
     572          _model._antGDV[ii] += ssrCorr;
    494573        }
    495         else if (_prn.system() == 'E') {
    496           _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
    497         }
    498         else if (_prn.system() == 'C') {
    499           _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
     574      }
     575      else {
     576        _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
     577        if (OPT->_isAPC && found) {
     578          // the PCOs as given in the satellite antenna correction for all frequencies
     579          // have to be reduced by the PCO of the respective reference frequency
     580          if      (_prn.system() == 'G') {
     581            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
     582          }
     583          else if (_prn.system() == 'R') {
     584            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
     585          }
     586          else if (_prn.system() == 'E') {
     587            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
     588          }
     589          else if (_prn.system() == 'C') {
     590            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
     591          }
    500592        }
    501593      }
     
    645737      if (_prn.system() == frqStr[0]) {
    646738      LOG << "PCO           : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq]       << endl
     739          << "SSR PCV       : " << frqStr << setw(12) << setprecision(3) << _model._antPCV[iFreq]       << endl
     740          << "SSR GDV       : " << frqStr << setw(12) << setprecision(3) << _model._antGDV[iFreq]       << endl
    647741          << "BIAS CODE     : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq]     << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
    648742          << "BIAS PHASE    : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq]    << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
     
    704798    for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
    705799      t_frequency::type tFreq = it->first;
    706       dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]);
     800      dispPart += it->second * (_model._antPCO[tFreq] + _model._antGDV[tFreq] - _model._codeBias[tFreq]);
    707801    }
    708802    for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
    709803      t_frequency::type tFreq = it->first;
    710       dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
     804      dispPart += it->second * (_model._antPCO[tFreq] + _model._antPCV[tFreq] - _model._phaseBias[tFreq] +
    711805                                _model._windUp * t_CST::lambda(tFreq, _channel));
    712806    }
Note: See TracChangeset for help on using the changeset viewer.