Index: trunk/BNC/src/PPP/pppSatObs.cpp
===================================================================
--- trunk/BNC/src/PPP/pppSatObs.cpp	(revision 10942)
+++ trunk/BNC/src/PPP/pppSatObs.cpp	(revision 11041)
@@ -400,4 +400,70 @@
 
 
+// A system's Satellite Antenna message is only trustworthy once the
+// provider has confirmed it via Metadata: SatelliteAntennaIOD (DF+010) must
+// be non-zero, and must match the Data IOD (DF+069) of a Metadata entry for
+// model-correction type 1 (satellite antenna PCV) or type 2 (GDV) - either
+// entry matching is sufficient. Metadata carries this IOD once globally, not
+// per system (DF+010 is GNSS-specific, DF+069 is not), so the same Metadata
+// entries are reused as the trust anchor for every system's check - the
+// provider is relied on to keep DF+010 synchronized with DF+069 across all
+// systems for this to work.
+////////////////////////////////////////////////////////////////////////////
+static bool ssrSatAntennaTrusted(const t_satAntenna* satAntenna) {
+  if (!satAntenna || satAntenna->_satelliteAntennaIOD == 0) {
+    return false;
+  }
+  const t_metaData* metaData = PPP_CLIENT->obsPool()->metaData();
+  if (!metaData) {
+    return false;
+  }
+  for (unsigned ii = 0; ii < metaData->_entries.size(); ii++) {
+    const t_metaDataEntry& entry = metaData->_entries[ii];
+    if ((entry._typeIndicator == 1 || entry._typeIndicator == 2) && // PCV or GDV
+        entry._dataIODIndicator &&
+        entry._dataIOD == satAntenna->_satelliteAntennaIOD) {
+      return true;
+    }
+  }
+  return false;
+}
+
+// Satellite antenna correction (offset + nadir-angle-dependent PCV) from a
+// live SSR Satellite Antenna message, in the same additive sense as
+// bncAntex::satCorr(). Returns false (corr untouched) if no trusted SSR data
+// is available for this PRN/frequency (see ssrSatAntennaTrusted), so the
+// caller falls back to the static ANTEX file.
+////////////////////////////////////////////////////////////////////////////
+static bool ssrSatAntennaCorr(const t_satAntenna* satAntenna, const string& frqStr,
+                               double elTx, double& corr) {
+  if (!satAntenna) {
+    return false;
+  }
+  for (unsigned ii = 0; ii < satAntenna->_freq.size(); ii++) {
+    const t_frqAntenna& frq = satAntenna->_freq[ii];
+    if (frq._frqType != frqStr) {
+      continue;
+    }
+    corr = 0.0;
+    if (frq._nadirCorrectionIndicator) {
+      corr += frq._nadirCorrection;
+    }
+    if (!frq._nadirAngleCorrection.empty()) {
+      // 1-degree bins starting at nadir (0 deg), per RTCM-SSR spec
+      double nadirDeg = 90.0 - elTx * 180.0 / M_PI;
+      int    idx      = int(nadirDeg + 0.5);
+      if (idx < 0) {
+        idx = 0;
+      }
+      else if (idx >= (int)frq._nadirAngleCorrection.size()) {
+        idx = (int)frq._nadirAngleCorrection.size() - 1;
+      }
+      corr += frq._nadirAngleCorrection[idx];
+    }
+    return true;
+  }
+  return false;
+}
+
 //
 ////////////////////////////////////////////////////////////////////////////
@@ -476,4 +542,8 @@
   // -------------------------------------------
   if (PPP_CLIENT->antex()) {
+    const t_satAntenna* satAntenna = PPP_CLIENT->obsPool()->satAntenna(_prn);
+    if (!ssrSatAntennaTrusted(satAntenna)) {
+      satAntenna = 0; // untrusted (IOD zero, or not confirmed via Metadata) - fall back to ANTEX
+    }
     for (unsigned ii = 0; ii < t_frequency::max; ii++) {
       t_frequency::type frqType = static_cast<t_frequency::type>(ii);
@@ -482,20 +552,42 @@
       bool found;
       QString prn(_prn.toString().c_str());
-      _model._antPCO[ii]  = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
-      _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
-      if (OPT->_isAPC && found) {
-        // the PCOs as given in the satellite antenna correction for all frequencies
-        // have to be reduced by the PCO of the respective reference frequency
-        if      (_prn.system() == 'G') {
-          _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
+      _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
+
+      // Prefer a live, trusted SSR Satellite Antenna correction over the
+      // static ANTEX file when available for this satellite/frequency,
+      // mirroring how SSR orbit/clock corrections already take precedence
+      // over broadcast ephemerides elsewhere in this codebase. Unlike
+      // ANTEX's satCorr() (a single geometric PCO/PCV value shared by code
+      // and phase alike), the SSR message's DF+011/DF+012 indicators say
+      // explicitly which observable(s) the correction applies to, so it is
+      // routed into the dedicated phase-only/code-only fields instead of
+      // the shared _antPCO - both may fire for the same ssrCorr value if
+      // both indicators are set.
+      double ssrCorr;
+      if (ssrSatAntennaCorr(satAntenna, frqStr, _model._elTx, ssrCorr)) {
+        if (satAntenna->_phaseCenterInfoInd) {
+          _model._antPCV[ii] += ssrCorr;
         }
-        else if (_prn.system() == 'R') {
-          _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
+        if (satAntenna->_groupDelayInfoInd) {
+          _model._antGDV[ii] += ssrCorr;
         }
-        else if (_prn.system() == 'E') {
-          _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
-        }
-        else if (_prn.system() == 'C') {
-          _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
+      }
+      else {
+        _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
+        if (OPT->_isAPC && found) {
+          // the PCOs as given in the satellite antenna correction for all frequencies
+          // have to be reduced by the PCO of the respective reference frequency
+          if      (_prn.system() == 'G') {
+            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
+          }
+          else if (_prn.system() == 'R') {
+            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
+          }
+          else if (_prn.system() == 'E') {
+            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
+          }
+          else if (_prn.system() == 'C') {
+            _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
+          }
         }
       }
@@ -645,4 +737,6 @@
       if (_prn.system() == frqStr[0]) {
       LOG << "PCO           : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq]       << endl
+          << "SSR PCV       : " << frqStr << setw(12) << setprecision(3) << _model._antPCV[iFreq]       << endl
+          << "SSR GDV       : " << frqStr << setw(12) << setprecision(3) << _model._antGDV[iFreq]       << endl
           << "BIAS CODE     : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq]     << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
           << "BIAS PHASE    : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq]    << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
@@ -704,9 +798,9 @@
     for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
       t_frequency::type tFreq = it->first;
-      dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]);
+      dispPart += it->second * (_model._antPCO[tFreq] + _model._antGDV[tFreq] - _model._codeBias[tFreq]);
     }
     for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
       t_frequency::type tFreq = it->first;
-      dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
+      dispPart += it->second * (_model._antPCO[tFreq] + _model._antPCV[tFreq] - _model._phaseBias[tFreq] +
                                 _model._windUp * t_CST::lambda(tFreq, _channel));
     }
