Changeset 11227 in ntrip for trunk/BNC/src/ssrQc.cpp


Ignore:
Timestamp:
Nov 26, 2026, 1:23:29 PM (less than one hour ago)
Author:
stuerze
Message:

proposed IGS SSR 202 message added in SSR QC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/ssrQc.cpp

    r11220 r11227  
    7979  const double VTEC_CMP_DELAY = 120.0;  // [s] VTEC epochs compared when data this much newer arrived
    8080  const double VTEC_HIST      = 3600.0; // [s] VTEC models kept for the comparison
     81  const double VTEC_RMS_MIN   = 0.05;   // [TECU] stated RMS below this is not used for normalized differences
    8182  const double VTEC_GRID_LAT  = 10.0;   // [deg] grid of the VTEC evaluation, latitudes -80 ... 80
    8283  const double VTEC_GRID_LON  = 15.0;   // [deg]
    … …  
    196197  connect(BNC_CORE, SIGNAL(newTec(t_vTec)),
    197198          this, SLOT(slotNewTec(t_vTec)), Qt::DirectConnection);
     199  connect(BNC_CORE, SIGNAL(newTecRms(t_vTec)),
     200          this, SLOT(slotNewTecRms(t_vTec)), Qt::DirectConnection);
    198201  // combined corrections (stream INTERNAL)
    199202  if (bncComb::exists()) {
    … …  
    16121615}
    16131616
     1617// RMS of the VTEC (IGS-SSR IM202, proposal of CAS, Dec 2025): kept for the
     1618// streams checked, compared with the actual differences in compareVtec()
     1619////////////////////////////////////////////////////////////////////////////
     1620void t_ssrQc::slotNewTecRms(t_vTec vTec) {
     1621  QMutexLocker locker(&_mutex);
     1622  if (vTec._layers.empty() || badEpoch(vTec._staID, vTec._time) || !selected(vTec._staID)) {
     1623    return;
     1624  }
     1625  QString sta = QString::fromStdString(vTec._staID);
     1626  QMap<double, t_vTec>& hist = _vtecRmsHist[sta];
     1627  hist[tKey(vTec._time)] = vTec;
     1628  while (!hist.isEmpty() && tKey(vTec._time) - hist.firstKey() > VTEC_HIST) {
     1629    hist.erase(hist.begin());
     1630  }
     1631  QStringList layers;
     1632  for (const t_vTecLayer& layer : vTec._layers) {
     1633    layers << QString("%1 km (degree/order %2/%3)").arg(layer._height / 1000.0, 0, 'f', 0)
     1634              .arg(layer._C.Nrows() - 1).arg(layer._C.Ncols() - 1);
     1635  }
     1636  _vtecStat[sta].rmsModel = QString("%1 layer(s): %2").arg(vTec._layers.size()).arg(layers.join(", "));
     1637}
     1638
    16141639// VTEC [TECU] of a model at a geocentric latitude and longitude [rad] and
    16151640// epoch: spherical harmonics in the sun-fixed frame as used in PPP, sum of
    … …  
    17201745    st.numCmp += 1;
    17211746    st.numSol += perSol.size();
     1747
     1748    // RMS map of the model (IM202): latest one not newer than the comparison
     1749    // epoch and not older than the VTEC model used
     1750    QVector<double> rmsVal;
     1751    if (_vtecRmsHist.contains(staID)) {
     1752      const QMap<double, t_vTec>& hist = _vtecRmsHist[staID];
     1753      QMap<double, t_vTec>::const_iterator it = hist.upperBound(tk);
     1754      if (it != hist.constBegin()) {
     1755        --it;
     1756        if (it.key() >= tKey(models[staID]->_time)) {
     1757          rmsVal.resize(grid.size());
     1758          for (int ii = 0; ii < grid.size(); ii++) {
     1759            bool negative = false;
     1760            rmsVal[ii] = vtecAt(it.value(), grid[ii].first, grid[ii].second, tt, negative);
     1761            if (negative) st.numRmsNeg += 1;
     1762          }
     1763          st.numRmsCmp += 1;
     1764        }
     1765      }
     1766    }
     1767
    17221768    for (int ii = 0; ii < grid.size(); ii++) {
    17231769      QVector<double> solVal;
    … …  
    17321778      st.sDiff2  += diff * diff;
    17331779      st.maxAbs   = max(st.maxAbs, fabs(diff));
     1780      if (!rmsVal.isEmpty()) {
     1781        double rr = rmsVal[ii];
     1782        if (st.numRms + st.numRmsZero == 0 || rr < st.minR) st.minR = rr;
     1783        if (st.numRms + st.numRmsZero == 0 || rr > st.maxR) st.maxR = rr;
     1784        st.sR2 += rr * rr;
     1785        st.sD2 += diff * diff;
     1786        if (rr > VTEC_RMS_MIN) {
     1787          st.numRms += 1;
     1788          st.sN2    += (diff / rr) * (diff / rr);
     1789          if (fabs(diff) <= rr)       st.in1 += 1;
     1790          if (fabs(diff) <= 2.0 * rr) st.in2 += 1;
     1791        }
     1792        else {
     1793          st.numRmsZero += 1;
     1794        }
     1795      }
    17341796    }
    17351797  }
    … …  
    18941956          else {
    18951957            lines << "VTEC not compared: no other model available";
     1958          }
     1959          if (!vs.rmsModel.isEmpty()) {
     1960            lines << "VTEC RMS map (IGS-SSR 202): " + vs.rmsModel;
     1961          }
     1962          unsigned numR = vs.numRms + vs.numRmsZero;
     1963          if (numR) {
     1964            lines << QString("VTEC RMS map, %1 epochs: stated RMS %2 ... %3 TECU (RMS %4 TECU), "
     1965                             "actual RMS of the differences %5 TECU, negative (set to zero) %6 %")
     1966                     .arg(vs.numRmsCmp).arg(vs.minR, 0, 'f', 1).arg(vs.maxR, 0, 'f', 1)
     1967                     .arg(sqrt(vs.sR2 / numR), 0, 'f', 2).arg(sqrt(vs.sD2 / numR), 0, 'f', 2)
     1968                     .arg(100.0 * vs.numRmsNeg / numR, 0, 'f', 1);
     1969            if (vs.numRms) {
     1970              lines << QString("VTEC differences normalized by the stated RMS: RMS %1, "
     1971                               "|diff| <= RMS %2 %, <= 2 RMS %3 % (normal distribution: 68 %, 95 %)%4")
     1972                       .arg(sqrt(vs.sN2 / vs.numRms), 0, 'f', 2)
     1973                       .arg(100.0 * vs.in1 / vs.numRms, 0, 'f', 1)
     1974                       .arg(100.0 * vs.in2 / vs.numRms, 0, 'f', 1)
     1975                       .arg(vs.numRmsZero ? QString(", %1 grid values with RMS <= %2 TECU not normalized")
     1976                                            .arg(vs.numRmsZero).arg(VTEC_RMS_MIN) : QString());
     1977            }
     1978          }
     1979          else if (!vs.rmsModel.isEmpty()) {
     1980            lines << "VTEC RMS map not compared: no matching VTEC comparison";
    18961981          }
    18971982        }
    … …  
    22532338  for (QMap<QString, t_vtecStat>::iterator it = _vtecStat.begin(); it != _vtecStat.end(); ++it) {
    22542339    t_vtecStat fresh;
    2255     fresh.model = it.value().model;
     2340    fresh.model    = it.value().model;
     2341    fresh.rmsModel = it.value().rmsModel;
    22562342    it.value() = fresh;
    22572343  }
Note: See TracChangeset for help on using the changeset viewer.