Changeset 11212 in ntrip


Ignore:
Timestamp:
Nov 18, 2026, 12:25:58 PM (67 minutes ago)
Author:
stuerze
Message:

SSR QC and clock combination improved

Location:
trunk/BNC
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/CHANGELOG.md

    r11206 r11212  
    11# Changelog
     2## 2.13.9 (unreleased)
     3- ADDED: **SSR QC: phase bias indicators and Melbourne-Wuebbena check.** Per stream and system the SSR format, the dispersive bias and MW consistency indicators, the integer and wide-lane integer indicators per signal and the satellites with discontinuity counter changes are reported. Every 300 s the MW combination of the phase and code biases of the reference signals (wide-lane cycles) is differenced with that of each other AC; the RMS of the fractional parts about the common offset shows whether the wide-lane biases are consistent (< 0.10 cycles) as required for a PPP-AR combination. 2 Oct 2026: MW consistency indicator 1 only for CNES and NRCan, CNES vs NRCan GPS 0.14 cycles (single satellites up to 0.3), all other pairs ~0.25 cycles (random). New test case ssr_qc_phase_bias
     4- CHANGED: **Combination (Kalman filter): robust clock datum.** Per satellite, the satellite-specific clock difference of each AC referred to the reference signals is compared with the median of the ACs; an offset rejected as outlier for 60 s leaves the zero-sum conditions and absorbs the difference (any number of ACs, as long as another offset of the satellite stays in), with at least 3 ACs also an offset deviating by more than 'Maximal Residuum' (at most 0.5 m) for 60 s (largest deviations first, a majority of the ACs stays in); it rejoins after a deviation below half of the threshold without rejection for 10 min. During a data gap of an AC in the datum of a satellite (or if its correction is rejected), the sum of the present offsets is kept, so that the gap does not shift the combined clock; offsets out of the datum never define it. Before, such a difference either shifted the combined clock or the corrections were rejected in every epoch (outlier lock-in), depending on when the filter was started (e.g. SHA G26 2.4 m). Changes are logged, offsets out of the datum are listed in the hourly outlier report. Start-time test (7 ACs, start 2.5 min later): GPS max. difference 2.4 m -> 0.08 m
     5- CHANGED: Combination: an AC excluded from the clock datum again because of inconsistent code biases needs twice as many passing checks to be used again as the time before (1, 2, 4, ... up to 16 hours); each change of the datum shifts the combined clocks of the system (GMV00 BDS 15 Oct: excluded 08:40, used again 18:00, excluded 18:05)
     6- FIXED: Combination (Kalman filter): the zero-sum conditions of the satellite offsets constrained the increments of the epoch instead of the values: after a change of the offsets in a condition (e.g. a satellite no longer provided by an AC) the sum kept its previous, non-zero value, so that the clock datum depended on the history of the filter
    27## 2.13.8 (2026-11-13)
    38- FIXED: RINEX 3/4 observation files: MARKER NAME was cut to 9 characters (A60 in RINEX 3/4); RINEX 2 keeps the 4-character station ID, the marker name derived from the stream name in real-time RINEX files stays 9 characters (e.g. WTZR00DEU)
  • trunk/BNC/src/bnchelp.html

    r11205 r11212  
    53875387      The latest code biases of each stream are used,</li>
    53885388    <li>the phase bias signals provided,</li>
     5389    <li>the phase bias indicators: the SSR format, for IGS-SSR and old RTCM-SSR the dispersive bias consistency
     5390      indicator and the Melbourne-Wübbena (MW) consistency indicator (new RTCM-SSR has none), per signal the integer
     5391      and the wide-lane integer indicator (with percentages if they change), and the satellites with changes of the
     5392      discontinuity counter (PPP-AR users have to reset their ambiguities),</li>
     5393    <li>the Melbourne-Wübbena check of the phase biases: the indicators only declare the integer property; it is
     5394      checked with the biases themselves. Every 300 seconds, the MW combination of the phase and code biases of the
     5395      reference signals is formed per satellite in wide-lane cycles (phase bias of another signal of the frequency if
     5396      the reference signal has none, e.g. L1C instead of L1W), and differenced with that of each stream of another
     5397      AC. If the wide-lane biases of both streams are consistent (integer wide-lane ambiguities can be fixed with
     5398      either), the fractional parts of these differences are the same for all satellites of a system: a common
     5399      offset, e.g. from different code datums. The RMS of the fractional parts about this offset is reported per
     5400      other stream (at least 4 satellites; GLONASS not checked, FDMA): below 0.10 cycles consistent, above 0.15
     5401      cycles not consistent (0.29 cycles for random fractional parts), with the satellites above 0.15 cycles. This
     5402      checks what a combination of the phase biases (PPP-AR) of several ACs requires, e.g.
     5403      <pre>
     5404  G phase bias format and indicators: IGS-SSR, dispersive bias consistency indicator 0, MW consistency indicator 1
     5405  G phase bias integer / wide-lane integer indicators: 1C integer 1 / wide-lane 2; 2W integer 1 / wide-lane 2; 5I integer 1 / wide-lane 2
     5406  G MW check: phase biases L1C L2W with the code biases C1W C2W of the reference signals, wide-lane cycles (0.862 m)
     5407  G MW biases vs. SSRA00CHC1 (1 epochs, 30 satellites): fractional parts about the common offset -0.12 cycles: RMS 0.265 cycles, NOT consistent
     5408  G MW biases vs. SSRA00NRC0 (1 epochs, 30 satellites): fractional parts about the common offset -0.12 cycles: RMS 0.139 cycles, not clearly consistent
     5409  G MW biases vs. SSRA00NRC0: satellites with RMS &gt; 0.15 cycles: G01(0.21) G04(0.26) G11(0.24) G21(0.15) G23(0.29) G28(0.30) G29(0.17)
     5410</pre></li>
    53895411    <li>the availability of the satellite yaw angle with the phase biases: 'not provided', or the number of
    53905412      satellites and the percentage of phase bias records with yaw angle, listing satellites without or only partly
    … …  
    83398361  10 seconds). The solution is regularized by minimal constraints: per epoch the combined clocks sum up to zero, the
    83408362  satellite specific offsets of all ACs providing a satellite sum up to zero, and the satellite specific offsets of
    8341   each AC sum up to zero. The last condition makes the AC specific offset the mean clock difference of the AC; without
     8363  each AC sum up to zero (offsets of ACs differing persistently from the other ACs are left out, see 'Robust clock
     8364  datum' below). The last condition makes the AC specific offset the mean clock difference of the AC; without
    83428365  it, the combined clock of a satellite not provided by all ACs would depend on the history of the filter (e.g. after a
    83438366  restart). In case of a change of the 'SSR Provider ID',
    … …  
    85278550    AC is used for the clock datum again, which is reported in both logfiles. A single passing check is not
    85288551    sufficient, because the offsets are reset with the exclusion and not yet converged; a borderline AC would
    8529     otherwise change the clock datum every few minutes. A smaller weight factor of the AC would not
     8552    otherwise change the clock datum every few minutes. Since each change of the datum shifts the combined clocks of
     8553    the system, the number of passing checks required is doubled each time the same AC is excluded again (2, 4, 8 and
     8554    at most 16 hours). A smaller weight factor of the AC would not
    85308555    help instead: the weights act on the epoch-wise clock variations, while the satellite-specific constant part is
    85318556    fixed by the zero-sum conditions, independent of the weights.
    … …  
    85378562  </p>
    85388563  <p>
    8539     <b>Persistent outliers:</b>
     8564    <b>Robust clock datum and persistent outliers:</b>
    85408565    A clock correction whose residual exceeds 'Maximal Residuum' is rejected as outlier. If an AC's clock for a single
    8541     satellite differs persistently from those of the other ACs, its satellite offset cannot absorb the difference, since
    8542     the offsets of all ACs of a satellite sum up to zero, and the correction is rejected again in every epoch. This
    8543     protects the combined clock, but it is worth to be reported to the AC. Therefore, once per hour and system, BNC
    8544     reports all AC satellites rejected in at least half of their epochs of the last hour (minimum 10 epochs), in the
    8545     combination logfile and in the BNC logfile, e.g.
     8566    satellite differs persistently from those of the other ACs, its satellite offset cannot absorb the difference as
     8567    long as it is part of the zero-sum condition of the satellite: depending on the history of the filter, the
     8568    difference either shifts the combined clock (e.g. accepted at the start of the filter) or the correction is
     8569    rejected again in every epoch. Therefore, for each satellite, BNC compares the satellite specific clock difference
     8570    of each AC referred to the reference signals (AC clock minus AC specific offset minus combined clock, rejected
     8571    corrections included) with the median of the ACs. A satellite offset rejected as outlier for 60 seconds is taken
     8572    out of the zero-sum conditions (of the satellite and of the AC) and re-initialized: it then absorbs the constant
     8573    difference, and the AC only contributes to the variation of the combined clock. This applies to any number of ACs,
     8574    as long as another offset of the satellite stays in the conditions; a rejected offset in the conditions would
     8575    otherwise shift the combined clock. For satellites provided by at least three such ACs, an offset deviating by more
     8576    than 'Maximal Residuum' (at most 0.5 m) for 60 seconds leaves the conditions as well: the offsets with the largest
     8577    deviations leave first, and a majority of the ACs of the satellite (at least two) stays in the conditions, e.g. if
     8578    the ACs form two groups with a clock difference. An offset rejoins the zero-sum conditions after its deviation has
     8579    stayed below half of this threshold for 10 minutes without being rejected. The zero-sum condition of a satellite
     8580    refers to the values of its offsets only if all offsets in the datum of the satellite (provided within the last
     8581    hour) are present in the epoch. During a data gap of such an AC, or if its correction is rejected, the sum of the
     8582    present offsets is kept instead, so that the gap does not shift the combined clock; offsets out of the datum
     8583    never define it, even if no offset of the datum is present. Both changes are reported in the combination logfile and in the BNC
     8584    logfile, e.g.
     8585  </p>
     8586  <pre>
     8587bncComb: SHA G26 out of the clock datum: deviation -3.33 m from the median of 6 ACs, rejected as outlier for 60 s
     8588bncComb: CAS01 G13 back in the clock datum: deviation 0.08 m from the median of 3 ACs (below 0.10 m for 600 s)
     8589</pre>
     8590  <p>
     8591    Corrections can still be rejected persistently, e.g. for satellites provided by fewer than three ACs or for noisy
     8592    clocks. This protects the combined clock, but it is worth to be reported to the AC. Therefore, once per hour and
     8593    system, BNC reports all AC satellites rejected in at least half of their epochs of the last hour (minimum 10
     8594    epochs) and the satellite offsets out of the clock datum, in the combination logfile and in the BNC logfile, e.g.
    85468595  </p>
    85478596  <pre>
    85488597bncComb: SHA G26 rejected as outlier in 99% of 720 epochs in the last hour (median residual 1.08 m)
     8598bncComb: G satellite offsets out of the clock datum: SHA G26 (-3.33 m, since 2026-10-02 11:42:15)
    85498599</pre>
    85508600  <p>
  • trunk/BNC/src/combination/bnccomb.cpp

    r11205 r11212  
    12621262  // Update and outlier detection loop
    12631263  // ---------------------------------
    1264   SymmetricMatrix QQ_sav = _QQ[sys];
     1264  SymmetricMatrix     QQ_sav = _QQ[sys];
     1265  QVector<t_datumObs> datumObs; // all corrections of the epoch, incl. outliers
    12651266  while (_running) {
    12661267
    … …  
    12731274    }
    12741275
     1276    if (datumObs.isEmpty()) {
     1277      bool referredAC = false;
     1278      for (int ii = 0; ii < corrs(sys).size(); ii++) {
     1279        const cmbCorr* corr = corrs(sys)[ii];
     1280        t_datumObs dObs;
     1281        dObs.ac       = corr->_acName;
     1282        dObs.prn      = corr->_prn;
     1283        dObs.value    = ll(ii+1) + DotProduct(AA.Row(ii+1), x0);
     1284        dObs.iAC      = 0;
     1285        dObs.iSat     = 0;
     1286        dObs.referred = !_biasInconsistent.contains(corr->_acName + sys) && corr->_refBiasesOK;
     1287        dObs.rejected = false;
     1288        referredAC    = referredAC || dObs.referred;
     1289        for (int iPar = 1; iPar <= nPar; iPar++) {
     1290          const cmbParam* pp = _params[sys][iPar-1];
     1291          if      (pp->type == cmbParam::offACgnss && pp->AC == corr->_acName) {
     1292            dObs.iAC = iPar;
     1293          }
     1294          else if (pp->type == cmbParam::clkSat && pp->prn == corr->_prn) {
     1295            dObs.iSat = iPar;
     1296          }
     1297        }
     1298        datumObs.push_back(dObs);
     1299      }
     1300      if (!referredAC) { // as in createAmat: then all clocks define the datum
     1301        for (t_datumObs& dObs : datumObs) {
     1302          dObs.referred = true;
     1303        }
     1304      }
     1305    }
     1306
    12751307    dx.ReSize(nPar); dx = 0.0;
    12761308    kalman(AA, ll, PP, _QQ[sys], dx);
    … …  
    12781310    ColumnVector vv = ll - AA * dx;
    12791311
     1312    // outliers among the observations only (not the conditions)
    12801313    int     maxResIndex;
    1281     double  maxRes = vv.maximum_absolute_value1(maxResIndex);
     1314    double  maxRes = vv.Rows(1, corrs(sys).size()).maximum_absolute_value1(maxResIndex);
    12821315    out.setRealNumberNotation(QTextStream::FixedNotation);
    12831316    out.setRealNumberPrecision(3);
    … …  
    13001333      _outlierStat[sys][corrs(sys)[maxResIndex-1]->_acName + ' ' +
    13011334                        corrs(sys)[maxResIndex-1]->_prn.mid(0,3)].residuals.push_back(maxRes);
     1335      for (t_datumObs& dObs : datumObs) {
     1336        if (dObs.ac  == corrs(sys)[maxResIndex-1]->_acName &&
     1337            dObs.prn == corrs(sys)[maxResIndex-1]->_prn) {
     1338          dObs.rejected = true;
     1339        }
     1340      }
    13021341      _QQ[sys] = QQ_sav;
    13031342      delete corrs(sys)[maxResIndex-1];
    … …  
    13171356        out.setFieldWidth(0);
    13181357      }
     1358      updateDatum(epoTime, sys, out, datumObs, x0 + dx);
    13191359      break;
    13201360    }
    … …  
    14011441    // exclusion the offsets are reset and not yet converged, so a single
    14021442    // passing check does not prove consistency; a borderline AC would
    1403     // otherwise change the clock datum every few minutes.
    1404     const int REINCLUDE_CHECKS = 12;
     1443    // otherwise change the clock datum every few minutes. Each change of the
     1444    // datum shifts the combined clocks of the system, so the number of
     1445    // passing checks required is doubled with each further exclusion of the
     1446    // AC (up to 16 hours).
     1447    const int REINCLUDE_CHECKS = 12 << std::min(4, std::max(0, _biasExclusions.value(key) - 1));
    14051448    if (spread < MIN_SPREAD || slope < MIN_SLOPE || corrCoeff < MIN_CORR) {
    14061449      if (_biasInconsistent.contains(key) && ++_biasConsistentChecks[key] < REINCLUDE_CHECKS) {
    … …  
    14331476    if (!_biasInconsistent.contains(key)) {
    14341477      _biasInconsistent.insert(key);
     1478      ++_biasExclusions[key];
    14351479      msg += ", AC excluded from the clock datum";
    14361480      _biasCheckWarned.remove(key);
    … …  
    15151559}
    15161560
     1561// Robust clock datum
     1562////////////////////////////////////////////////////////////////////////////
     1563// A persistent clock difference of one AC for a satellite cannot be absorbed
     1564// by its satellite offset as long as the offset is in the zero-sum condition
     1565// of the satellite: either it shifts the combined clock (accepted, e.g. at
     1566// the start of the filter) or the correction is rejected in every epoch
     1567// (outlier lock-in), depending on the history of the filter. Therefore, per
     1568// satellite, the satellite-specific clock difference of each AC referred to
     1569// the reference signals
     1570//   u = clock - AC offset - combined clock
     1571// (rejected corrections included) is compared with the median of the ACs.
     1572// An offset rejected as outlier for DATUM_OUT_SEC leaves the zero-sum
     1573// conditions (satellite and AC) and is re-initialized: it then absorbs the
     1574// constant difference, and the AC contributes to the variation of the
     1575// combined clock only. This applies to any number of ACs, as long as another
     1576// offset of the satellite stays in the datum (otherwise a rejected offset in
     1577// the datum would shift the combined clock). For satellites with at least
     1578// DATUM_MIN_AC ACs, an offset deviating by more than DATUM_OUT_DEV for
     1579// DATUM_OUT_SEC leaves as well, as long as a majority of the ACs stays in.
     1580// An offset rejoins the datum after a deviation below DATUM_IN_DEV (at most
     1581// half of the maximum residual) without rejection for DATUM_IN_SEC. ACs not
     1582// referred to the reference signals are excluded from the datum anyway and
     1583// not judged.
     1584////////////////////////////////////////////////////////////////////////////
     1585void bncComb::updateDatum(bncTime epoTime, char sys, QTextStream& out,
     1586                          const QVector<t_datumObs>& datumObs, const ColumnVector& xx) {
     1587
     1588  const int    DATUM_MIN_AC  = 3;
     1589  const double DATUM_OUT_DEV = std::min(0.5, _MAX_RES); // [m]
     1590  const double DATUM_OUT_SEC = 60.0;
     1591  const double DATUM_IN_DEV  = 0.5 * DATUM_OUT_DEV;       // [m]
     1592  const double DATUM_IN_SEC  = 600.0;
     1593  const double DATUM_FORGET  = 3600.0; // state of offsets not provided for this time is dropped
     1594
     1595  QMap<QString, t_datumState>& states = _datumState[sys];
     1596
     1597  // parameters observed by accepted corrections
     1598  QSet<int> observed;
     1599  for (const t_datumObs& dObs : datumObs) {
     1600    if (!dObs.rejected) {
     1601      observed << dObs.iAC << dObs.iSat;
     1602    }
     1603  }
     1604
     1605  // satellite-specific clock differences per satellite
     1606  QMap<QString, QVector<const t_datumObs*> > satObs;
     1607  QMap<QString, double> uu; // key "AC PRN"
     1608  for (const t_datumObs& dObs : datumObs) {
     1609    QString key = dObs.ac + ' ' + dObs.prn;
     1610    states[key].lastSeen = epoTime;
     1611    states[key].referred = dObs.referred;
     1612    if (dObs.referred && dObs.iAC && dObs.iSat &&
     1613        observed.contains(dObs.iAC) && observed.contains(dObs.iSat)) {
     1614      uu[key] = dObs.value - xx(dObs.iAC) - xx(dObs.iSat);
     1615      satObs[dObs.prn].push_back(&dObs);
     1616    }
     1617  }
     1618
     1619  QMapIterator<QString, QVector<const t_datumObs*> > itSat(satObs);
     1620  while (itSat.hasNext()) {
     1621    itSat.next();
     1622    const QVector<const t_datumObs*>& obs = itSat.value();
     1623    const bool robust = (obs.size() >= DATUM_MIN_AC); // median meaningful
     1624    QVector<double> uSat;
     1625    for (const t_datumObs* dObs : obs) {
     1626      uSat.push_back(uu[dObs->ac + ' ' + dObs->prn]);
     1627    }
     1628    std::sort(uSat.begin(), uSat.end());
     1629    int    nn     = uSat.size();
     1630    double median = (nn % 2) ? uSat[nn/2] : 0.5 * (uSat[nn/2-1] + uSat[nn/2]);
     1631
     1632    // a majority of the ACs stays in the datum (e.g. two groups of ACs with
     1633    // a clock difference: the median is not meaningful); the offsets with the
     1634    // largest deviations leave first
     1635    const int minIn  = std::max(2, (nn + 1) / 2);
     1636    int       numIn  = 0;
     1637    QVector<const t_datumObs*> order = obs;
     1638    for (const t_datumObs* dObs : obs) {
     1639      QString key = dObs->ac + ' ' + dObs->prn;
     1640      states[key].dev = uu[key] - median;
     1641      if (!states[key].out) {
     1642        ++numIn;
     1643      }
     1644    }
     1645    std::stable_sort(order.begin(), order.end(),
     1646                     [&states](const t_datumObs* aa, const t_datumObs* bb) {
     1647                       return fabs(states[aa->ac + ' ' + aa->prn].dev) >
     1648                              fabs(states[bb->ac + ' ' + bb->prn].dev);
     1649                     });
     1650
     1651    for (const t_datumObs* dObs : order) {
     1652      QString       key   = dObs->ac + ' ' + dObs->prn;
     1653      t_datumState& state = states[key];
     1654      bool change = state.out ? (fabs(state.dev) < DATUM_IN_DEV && !dObs->rejected)
     1655                              : (dObs->rejected || (robust && fabs(state.dev) > DATUM_OUT_DEV));
     1656      if (!change) {
     1657        state.since.reset();
     1658        continue;
     1659      }
     1660      if (!state.since.valid()) {
     1661        state.since = epoTime;
     1662      }
     1663      double duration = epoTime - state.since;
     1664      if (duration < (state.out ? DATUM_IN_SEC : DATUM_OUT_SEC)) {
     1665        continue;
     1666      }
     1667      // a rejected offset leaves as long as another one stays in, a deviating
     1668      // (accepted) one only as long as a majority stays in
     1669      if (!state.out && numIn - 1 < (dObs->rejected ? 1 : minIn)) {
     1670        continue;
     1671      }
     1672      QString msg;
     1673      if (!state.out) {
     1674        --numIn;
     1675        state.out      = true;
     1676        state.outSince = epoTime;
     1677        msg = QString("%1 %2 out of the clock datum: deviation %3 m from the median of %4 ACs%5")
     1678              .arg(dObs->ac).arg(dObs->prn.mid(0,3))
     1679              .arg(state.dev, 0, 'f', 2).arg(nn)
     1680              .arg(dObs->rejected ? QString(", rejected as outlier for %1 s").arg(duration, 0, 'f', 0) : QString());
     1681        // re-initialize the offset: it absorbs the difference from now on
     1682        for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
     1683          cmbParam* pp = _params[sys][iPar-1];
     1684          if (pp->type == cmbParam::offACSat && pp->AC == dObs->ac && pp->prn == dObs->prn) {
     1685            _QQ[sys].Row(iPar)    = 0.0;
     1686            _QQ[sys].Column(iPar) = 0.0;
     1687            _QQ[sys](iPar,iPar)   = pp->sig0 * pp->sig0;
     1688          }
     1689        }
     1690      }
     1691      else {
     1692        ++numIn;
     1693        state.out = false;
     1694        msg = QString("%1 %2 back in the clock datum: deviation %3 m from the median of %4 ACs "
     1695                      "(below %5 m for %6 s)")
     1696              .arg(dObs->ac).arg(dObs->prn.mid(0,3))
     1697              .arg(state.dev, 0, 'f', 2).arg(nn)
     1698              .arg(DATUM_IN_DEV, 0, 'f', 2).arg(duration, 0, 'f', 0);
     1699      }
     1700      state.since.reset();
     1701      out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() << " " << msg << "\n";
     1702      emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: " + msg.toLatin1()), true);
     1703    }
     1704  }
     1705
     1706  // drop the state of offsets no longer provided
     1707  QMutableMapIterator<QString, t_datumState> itState(states);
     1708  while (itState.hasNext()) {
     1709    itState.next();
     1710    if (epoTime - itState.value().lastSeen > DATUM_FORGET) {
     1711      itState.remove();
     1712    }
     1713  }
     1714}
     1715
    15171716// Report AC satellites rejected as outliers in most epochs
    15181717////////////////////////////////////////////////////////////////////////////
    1519 // A persistent clock difference of one AC for a satellite cannot be absorbed
    1520 // by its satellite offset, as the offsets of all ACs of the satellite sum up
    1521 // to zero: the correction is rejected again in every epoch. Once per hour
    1522 // and system, AC satellites rejected in at least half of their epochs are
    1523 // reported.
     1718// Corrections of an AC for a satellite can still be rejected persistently,
     1719// e.g. for satellites with fewer than DATUM_MIN_AC ACs (see updateDatum) or
     1720// for noisy clocks. Once per hour and system, AC satellites rejected in at
     1721// least half of their epochs are reported, as well as the offsets out of
     1722// the clock datum.
    15241723////////////////////////////////////////////////////////////////////////////
    15251724void bncComb::checkPersistentOutliers(bncTime epoTime, char sys, QTextStream& out) {
    … …  
    15521751    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() << " " << msg << "\n";
    15531752    emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + msg.toLatin1()), true);
     1753  }
     1754  QStringList outList;
     1755  QMapIterator<QString, t_datumState> itState(_datumState[sys]);
     1756  while (itState.hasNext()) {
     1757    itState.next();
     1758    const t_datumState& state = itState.value();
     1759    if (state.out) {
     1760      QStringList hlp = itState.key().split(' ');
     1761      outList << QString("%1 %2 (%3 m, since %4 %5)")
     1762                 .arg(hlp[0]).arg(hlp[1].mid(0,3)).arg(state.dev, 0, 'f', 2)
     1763                 .arg(state.outSince.datestr().c_str()).arg(state.outSince.timestr(0).c_str());
     1764    }
     1765  }
     1766  if (!outList.isEmpty()) {
     1767    QString msg = QString("%1 satellite offsets out of the clock datum: ").arg(sys) + outList.join(", ");
     1768    out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() << " " << msg << "\n";
     1769    emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: " + msg.toLatin1()), true);
    15541770  }
    15551771  _outlierStat[sys].clear();
    … …  
    18702086  }
    18712087
     2088  // Offsets out of the robust clock datum (see updateDatum) and the nominal
     2089  // datum per satellite: offsets in the datum, provided within the last hour
     2090  QSet<QString>                outOfDatum;   // "AC PRN" (full PRN)
     2091  QMap<QString, QSet<QString> > nominalDatum; // PRN -> "AC PRN"
     2092  if (_method == filter) {
     2093    QMapIterator<QString, t_datumState> itState(_datumState[sys]);
     2094    while (itState.hasNext()) {
     2095      itState.next();
     2096      const t_datumState& state = itState.value();
     2097      if (state.out) {
     2098        outOfDatum.insert(itState.key());
     2099      }
     2100      else if (state.referred &&
     2101               !_biasInconsistent.contains(itState.key().section(' ', 0, 0) + sys)) {
     2102        nominalDatum[itState.key().section(' ', 1, 1)].insert(itState.key());
     2103      }
     2104    }
     2105  }
     2106
    18722107  // ACs of this epoch, each with a zero-sum condition of its satellite offsets
    18732108  QStringList epoACs;
    … …  
    19512186   // }
    19522187    int iCond = 1;
     2188    QSet<int>     incrementRows; // conditions on the increments (continuity)
     2189    QSet<int>     offIncrement;  // offsets in satellite conditions on the increments
    19532190    QSet<int>     offExcluded; // offsets excluded from the zero-sum condition of their satellite
    19542191    QSet<int>     offInDatum;  // offsets in the zero-sum condition of their satellite
    … …  
    19602197      ++iCond;
    19612198      PP(nObs+iCond) = Ph;
    1962       QList<int> offAll, offConsistent;
     2199      QList<int>    offAll, offConsistent, offRobust;
     2200      QSet<QString> robustKeys;
    19632201      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
    19642202        cmbParam* pp = _params[sys][iPar-1];
    … …  
    19702208          if (!excludedOff.contains(pp->AC + ' ' + pp->prn)) {
    19712209            offConsistent << iPar;
     2210            if (!outOfDatum.contains(pp->AC + ' ' + pp->prn)) {
     2211              offRobust << iPar;
     2212              robustKeys.insert(pp->AC + ' ' + pp->prn);
     2213            }
    19722214          }
    19732215        }
    19742216      }
    1975       // satellite observed by inconsistent ACs only: all its offsets are used
    1976       const QList<int>& offUsed = offConsistent.isEmpty() ? offAll : offConsistent;
     2217      // The condition refers to the values of the offsets (see below) only if
     2218      // all offsets of the nominal datum of the satellite are present. If one
     2219      // of them is missing in this epoch (data gap of the AC, correction
     2220      // rejected as outlier in this iteration), the sum of the present ones
     2221      // is kept (condition on the increments): otherwise the gap would shift
     2222      // the combined clock by the offsets of the remaining ACs.
     2223      const QSet<QString>& nominal = nominalDatum[prn];
     2224      bool complete = true;
     2225      for (const QString& key : nominal) {
     2226        if (!robustKeys.contains(key)) {
     2227          complete = false;
     2228          break;
     2229        }
     2230      }
     2231      if (!complete) {
     2232        incrementRows.insert(iCond);
     2233        for (int iPar : offRobust) {
     2234          offIncrement << iPar;
     2235        }
     2236      }
     2237      // satellite observed by inconsistent ACs only: all its offsets are used;
     2238      // all consistent offsets out of the robust datum: these are used. If
     2239      // the nominal datum of the satellite is missing completely, the offsets
     2240      // out of the datum only keep their sum (increments, see above) and are
     2241      // not used in the conditions of their ACs: they must not define the
     2242      // clock datum (their differences to the datum ACs are the reason for
     2243      // their exclusion).
     2244      const bool keepOnly = offRobust.isEmpty() && !nominal.isEmpty();
     2245      const QList<int>& offUsed = !offRobust.isEmpty()     ? offRobust     :
     2246                                  !offConsistent.isEmpty() ? offConsistent : offAll;
    19772247      for (int iPar : offAll) {
    1978         if (offUsed.contains(iPar)) {
     2248        if (keepOnly && offUsed.contains(iPar)) {
     2249          AA(nObs+iCond, iPar) = 1.0;
     2250        }
     2251        else if (offUsed.contains(iPar)) {
    19792252          AA(nObs+iCond, iPar) = 1.0;
    19802253          offInDatum << iPar;
    … …  
    20022275        if (_params[sys][iPar-1]->AC == acName) {
    20032276          AA(nObs+iCond, iPar) = 1.0;
    2004         }
     2277          // an offset kept by its satellite condition (increments) cannot
     2278          // follow a condition of the AC on the values: both on the increments
     2279          if (offIncrement.contains(iPar)) {
     2280            incrementRows.insert(iCond);
     2281          }
     2282        }
     2283      }
     2284    }
     2285    // The conditions refer to the parameter values, not to their increments:
     2286    // with ll = 0, a sum would keep its value of the previous epoch, which
     2287    // differs from zero after a change of the offsets in the condition (an
     2288    // offset out of or back in the datum, a satellite no longer provided by
     2289    // an AC for more than an hour), leaving the datum to the history of the
     2290    // filter. Exception: incomplete nominal datum of a satellite (see above).
     2291    for (int iCon = 1; iCon <= nCon; iCon++) {
     2292      if (!incrementRows.contains(iCon)) {
     2293        ll(nObs+iCon) = -DotProduct(AA.Row(nObs+iCon), x0);
    20052294      }
    20062295    }
  • trunk/BNC/src/combination/bnccomb.h

    r11195 r11212  
    264264  QSet<QString>                              _biasInconsistent; // AC+system excluded from the clock datum
    265265  QMap<QString, int>                         _biasConsistentChecks; // flagged AC+system: passing checks in a row
     266  QMap<QString, int>                         _biasExclusions; // AC+system: number of exclusions (hysteresis)
    266267  QMap<char, bncTime>                        _lastFilterEpoch;      // per system: last epoch of the filter prediction
    267268  void checkBiasConsistency(bncTime epoTime, char sys, QTextStream& out);
    … …  
    278279  QMap<char, QMap<QString, t_outlierStat> > _outlierStat;      // per system, key "AC PRN"
    279280  QMap<char, bncTime>                       _outlierStatStart; // start of the statistics interval
     281  // Robust clock datum: membership of the AC satellite offsets in the
     282  // zero-sum conditions, decided by the deviation from the median of the ACs
     283  struct t_datumObs {
     284    QString ac;
     285    QString prn;       // full PRN (with navigation type flag)
     286    double  value;     // AC clock referred to the reference signals, corrected [m]
     287    int     iAC;       // index of the AC offset parameter (0: none)
     288    int     iSat;      // index of the combined clock parameter (0: none)
     289    bool    referred;  // AC clock referred to the reference signals
     290    bool    rejected;  // rejected as outlier in this epoch
     291  };
     292  struct t_datumState {
     293    t_datumState() : out(false), referred(true), dev(0.0) {}
     294    bool    out;      // excluded from the zero-sum conditions
     295    bool    referred; // latest correction referred to the reference signals
     296    bncTime since;    // start of the condition for a change (out <-> in)
     297    bncTime outSince; // excluded since
     298    bncTime lastSeen; // last epoch with a correction of the AC for the satellite
     299    double  dev;      // latest deviation from the median of the ACs [m]
     300  };
     301  QMap<char, QMap<QString, t_datumState> >  _datumState; // per system, key "AC PRN" (full PRN)
    280302  void resetSatOffsets(char sys);
     303  void updateDatum(bncTime epoTime, char sys, QTextStream& out,
     304                   const QVector<t_datumObs>& datumObs, const ColumnVector& xx);
    281305  bool allACsDelivered(const bncTime& epoTime) const;
    282306  bncTime                                    _resTime;
  • trunk/BNC/src/ssrQc.cpp

    r11195 r11212  
    7777  const double VTEC_GRID_LAT  = 10.0;   // [deg] grid of the VTEC evaluation, latitudes -80 ... 80
    7878  const double VTEC_GRID_LON  = 15.0;   // [deg]
     79  const double MW_SAMPL       = 300.0;  // [s] sampling of the Melbourne-Wuebbena check
     80  const double MW_MAX_AGE     = 900.0;  // [s] phase biases older than this are not used
     81  const int    MW_MIN_SAT     = 4;      // satellites needed for the common offset
     82  const double MW_OK          = 0.10;   // [cycles] RMS of the fractional parts: consistent below,
     83  const double MW_BAD         = 0.15;   //          not consistent above (uniform: 0.29)
    7984
    8085  double tKey(const bncTime& tt) {
    … …  
    253258           << "Checks: epochs and update intervals, gaps (interval > 2 x max(declared, median)), latency,"
    254259           << " completeness w.r.t. healthy broadcast ephemerides," << endl
    255            << "IOD matching, code and phase bias signals, yaw angle, code biases of the reference signals, clock jumps > "
     260           << "IOD matching, code and phase bias signals, phase bias indicators, Melbourne-Wuebbena consistency"
     261           << " with the other ACs, yaw angle, code biases of the reference signals, clock jumps > "
    256262           << MAX_CLK_JUMP << " m, largest orbit corrections, VTEC models (system V)" << endl
    257263           << "Reference signals of the clocks: " << t_ssrRefSig::currentString().toStdString() << endl;
    … …  
    311317    compareEpoch(_nextCmpEpoch);
    312318    _nextCmpEpoch = _nextCmpEpoch + CMP_SAMPL;
     319  }
     320  // Melbourne-Wuebbena check of the phase biases
     321  if (!_pbLast.isEmpty()) {
     322    if (!_nextMwCmp.valid()) {
     323      double sec = ceil(time.gpssec() / MW_SAMPL) * MW_SAMPL;
     324      _nextMwCmp = bncTime(time.gpsw(), sec);
     325    }
     326    while (time - _nextMwCmp >= CMP_DELAY) {
     327      compareMw(_nextMwCmp);
     328      _nextMwCmp = _nextMwCmp + MW_SAMPL;
     329    }
    313330  }
    314331  // VTEC comparison
    … …  
    545562  QMutexLocker locker(&_mutex);
    546563  for (const t_satPhaseBias& bias : phaseBiases) {
     564    QString staID = QString::fromStdString(bias._staID);
     565    QString prn   = QString::fromStdString(bias._prn.toString());
     566    // latest biases for the Melbourne-Wuebbena check (also as other AC)
     567    if (!_excluded.contains(staID) || staID == _reference) {
     568      t_pbLast& pl = _pbLast[staID][prn];
     569      pl.time = bias._time;
     570      pl.values.clear();
     571      for (const t_frqPhaseBias& frqBias : bias._bias) {
     572        pl.values[QString::fromStdString(frqBias._rnxType2ch)] = frqBias._value;
     573      }
     574    }
    547575    if (!selected(bias._staID)) continue;
    548576    checkInterval(bias._time);
    549     newEpoch(bias._staID, bias._prn.system(), PBIAS, bias._time, bias._updateInt,
    550              QString::fromStdString(bias._prn.toString()));
    551     QString staSys = QString("%1 %2").arg(bias._staID.c_str()).arg(bias._prn.system());
     577    newEpoch(bias._staID, bias._prn.system(), PBIAS, bias._time, bias._updateInt, prn);
     578    QString staSys = QString("%1 %2").arg(staID).arg(bias._prn.system());
     579    t_satStat& stat = _satStat[staID + ' ' + prn];
     580    t_pbIndStat& ind = _pbIndStat[staSys];
     581    ind.numRec++;
     582    ind.format[(bias._ssrFormat == ssrRtcmNew) ? "new RTCM-SSR" :
     583               (bias._ssrFormat == ssrRtcmOld) ? "old RTCM-SSR" : "IGS-SSR"]++;
     584    if (bias._ssrFormat != ssrRtcmNew) {  // new RTCM-SSR: no consistency indicators
     585      ind.dispInd[bias._dispBiasConsistInd]++;
     586      ind.mwInd[bias._MelbWuebConsistInd]++;
     587    }
     588    bool jumped = false;  // counted once per record, not per signal
    552589    for (const t_frqPhaseBias& frqBias : bias._bias) {
    553       _phaseSignals[staSys].insert(QString::fromStdString(frqBias._rnxType2ch));
     590      QString sig = QString::fromStdString(frqBias._rnxType2ch);
     591      _phaseSignals[staSys].insert(sig);
     592      ind.intInd[sig][frqBias._fixIndicator]++;
     593      ind.wlInd[sig][frqBias._fixWideLaneIndicator]++;
     594      QString jumpKey = staID + ' ' + prn + ' ' + sig;
     595      if (_pbJumpLast.contains(jumpKey) && _pbJumpLast[jumpKey] != frqBias._jumpCounter) {
     596        jumped = true;
     597      }
     598      _pbJumpLast[jumpKey] = frqBias._jumpCounter;
     599    }
     600    if (jumped) {
     601      stat.pbJumps++;
    554602    }
    555603    // Yaw angle: new RTCM-SSR has an indicator, old RTCM-SSR and IGS-SSR always
    556604    // carry the field, providers without attitude information send zeros
    557     t_satStat& stat = _satStat[QString::fromStdString(bias._staID) + ' ' +
    558                                QString::fromStdString(bias._prn.toString())];
    559605    stat.numPB++;
    560606    bool yawProvided = (bias._ssrFormat == ssrRtcmNew) ? (bias._satYawInfoInd != 0)
    … …  
    570616      yl.yaw  = bias._yaw;
    571617      yl.rate = bias._yawRate;
     618    }
     619  }
     620}
     621
     622// Melbourne-Wuebbena combination of the phase and code biases of the
     623// reference signals of a stream and satellite in wide-lane cycles:
     624//   (f1 b_L1 - f2 b_L2) / (f1 - f2) - (f1 b_C1 + f2 b_C2) / (f1 + f2)
     625// The phase bias of a frequency is that of the reference signal or, if not
     626// provided, of another signal of the frequency; the code biases are those
     627// of the reference signals (as used for the clocks and a combination; with
     628// the code bias of the phase signal instead, e.g. C1C for CNES' L1C, CNES and
     629// NRCan agreed less on 2026-10-02)
     630////////////////////////////////////////////////////////////////////////////
     631bool t_ssrQc::mwBias(const QString& staID, const QString& prn, char sys, const bncTime& tt, double& mwCyc) {
     632  QString sig1, sig2;
     633  t_frequency::type frq1, frq2;
     634  if (sys == 'R' || !refSignals(sys, sig1, sig2, frq1, frq2)) {
     635    return false;  // GLONASS FDMA: no integer wide-lane ambiguities between satellites
     636  }
     637  if (!_pbLast.value(staID).contains(prn) || !_cbLast.value(staID).contains(prn)) {
     638    return false;
     639  }
     640  const t_pbLast& pl = _pbLast[staID][prn];
     641  if (fabs(tt - pl.time) > MW_MAX_AGE) {
     642    return false;
     643  }
     644  const QMap<QString, double>& cb = _cbLast[staID][prn];
     645  auto biases = [&pl, &cb](const QString& sig, double& phase, double& code) {
     646    QString used;
     647    if (pl.values.contains(sig)) {
     648      used = sig;
     649    }
     650    else {
     651      QMapIterator<QString, double> it(pl.values);
     652      while (it.hasNext()) {
     653        it.next();
     654        if (it.key()[0] == sig[0]) {
     655          used = it.key();
     656          break;
     657        }
     658      }
     659    }
     660    if (used.isEmpty()) {
     661      return false;
     662    }
     663    if (!cb.contains(sig)) {
     664      return false;
     665    }
     666    phase = pl.values[used];
     667    code  = cb[sig];
     668    return true;
     669  };
     670  double pb1, pb2, cb1, cb2;
     671  if (!biases(sig1, pb1, cb1) || !biases(sig2, pb2, cb2)) {
     672    return false;
     673  }
     674  double f1 = t_CST::freq(frq1, 0);
     675  double f2 = t_CST::freq(frq2, 0);
     676  double mw = (f1 * pb1 - f2 * pb2) / (f1 - f2) - (f1 * cb1 + f2 * cb2) / (f1 + f2);
     677  mwCyc = mw / (t_CST::c / (f1 - f2));
     678  return true;
     679}
     680
     681// Melbourne-Wuebbena check of one epoch: per pair of streams of different
     682// ACs and system, the fractional parts of the MW differences of the
     683// satellites about their common (circular mean) offset
     684////////////////////////////////////////////////////////////////////////////
     685void t_ssrQc::compareMw(const bncTime& tt) {
     686  QStringList streams = _pbLast.keys();
     687  for (const QString& staA : streams) {
     688    if (!selected(staA.toStdString())) continue;
     689    for (const QString& staB : streams) {
     690      if (staB == staA || !votes(staB) || acOf(staB) == acOf(staA)) continue;
     691      QMap<char, QMap<QString, double> > diff;  // system, PRN: MW difference [cycles]
     692      for (const QString& prn : _pbLast[staA].keys()) {
     693        char   sys = prn[0].toLatin1();
     694        double mwA, mwB;
     695        if (mwBias(staA, prn, sys, tt, mwA) && mwBias(staB, prn, sys, tt, mwB)) {
     696          diff[sys][prn] = mwA - mwB;
     697        }
     698      }
     699      QMapIterator<char, QMap<QString, double> > itSys(diff);
     700      while (itSys.hasNext()) {
     701        itSys.next();
     702        const QMap<QString, double>& dd = itSys.value();
     703        if (dd.size() < MW_MIN_SAT) continue;
     704        double sSin = 0.0, sCos = 0.0;
     705        for (double val : dd) {
     706          sSin += sin(2.0 * M_PI * val);
     707          sCos += cos(2.0 * M_PI * val);
     708        }
     709        double offset = atan2(sSin, sCos) / (2.0 * M_PI);
     710        t_mwStat& ms = _mwStat[staA][staB][itSys.key()];
     711        ms.numEpo++;
     712        ms.offset = offset;
     713        QMapIterator<QString, double> itD(dd);
     714        while (itD.hasNext()) {
     715          itD.next();
     716          double res = itD.value() - offset;
     717          res -= floor(res + 0.5);   // fractional part in [-0.5, 0.5)
     718          ms.numRes++;
     719          ms.sRes2 += res * res;
     720          QPair<unsigned, double>& sr = ms.satRes[itD.key()];
     721          sr.first++;
     722          sr.second += res * res;
     723        }
     724      }
    572725    }
    573726  }
    … …  
    15371690      double maxEarly = 0.0;
    15381691      QMap<QString, unsigned> missOrb, missClk, missCB, missPB, iodUnknown, unhealthy, noEph,
    1539                               jumps, missRef, noYaw, yawPartly;
     1692                              jumps, missRef, noYaw, yawPartly, pbJumps;
    15401693      unsigned numPB = 0, numYaw = 0, yawSats = 0;
    15411694      double maxRadial = 0.0, maxAlongCross = 0.0;
    … …  
    15761729        if (stat.noEph)        noEph[prn]      = stat.noEph;
    15771730        if (stat.clkJumps)     jumps[prn]      = stat.clkJumps;
     1731        if (stat.pbJumps)      pbJumps[prn]    = stat.pbJumps;
    15781732        if (stat.maxRadial > maxRadial) {
    15791733          maxRadial    = stat.maxRadial;
    … …  
    16701824        lines << "phase bias signals: " + sigs.join(" ");
    16711825      }
     1826      if (_pbIndStat.contains(staSys)) {
     1827        const t_pbIndStat& ind = _pbIndStat[staSys];
     1828        // value list "1" or "0 (12 %), 1 (88 %)"
     1829        auto values = [](const QMap<int, unsigned>& counts) {
     1830          unsigned total = 0;
     1831          for (unsigned nn : counts) total += nn;
     1832          QStringList parts;
     1833          QMapIterator<int, unsigned> it(counts);
     1834          while (it.hasNext()) {
     1835            it.next();
     1836            parts << ((counts.size() == 1) ? QString::number(it.key())
     1837                                           : QString("%1 (%2 %)").arg(it.key())
     1838                                             .arg(100.0 * it.value() / total, 0, 'f', 0));
     1839          }
     1840          return parts.join(", ");
     1841        };
     1842        QStringList formats = ind.format.keys();
     1843        QString line = "phase bias format and indicators: " + formats.join("/");
     1844        if (!ind.mwInd.isEmpty()) {
     1845          line += QString(", dispersive bias consistency indicator %1, MW consistency indicator %2")
     1846                  .arg(values(ind.dispInd)).arg(values(ind.mwInd));
     1847        }
     1848        else {
     1849          line += " (no consistency indicators)";
     1850        }
     1851        lines << line;
     1852        QStringList sigParts;
     1853        QMapIterator<QString, QMap<int, unsigned> > itSig(ind.intInd);
     1854        while (itSig.hasNext()) {
     1855          itSig.next();
     1856          sigParts << QString("%1 integer %2 / wide-lane %3").arg(itSig.key())
     1857                      .arg(values(itSig.value())).arg(values(ind.wlInd.value(itSig.key())));
     1858        }
     1859        if (!sigParts.isEmpty()) {
     1860          lines << "phase bias integer / wide-lane integer indicators: " + sigParts.join("; ");
     1861        }
     1862        addSats("phase bias discontinuity counter changes", pbJumps);
     1863      }
     1864      bool mwAny = false;
     1865      for (const QMap<char, t_mwStat>& mm : _mwStat.value(staID)) {
     1866        mwAny = mwAny || mm.contains(sys);
     1867      }
     1868      QString mwSig1, mwSig2;
     1869      t_frequency::type mwFrq1, mwFrq2;
     1870      if (mwAny && refSignals(sys, mwSig1, mwSig2, mwFrq1, mwFrq2)) {
     1871        // phase signals used (see mwBias)
     1872        QStringList used;
     1873        QStringList pSigs = _phaseSignals.value(staSys).values();
     1874        pSigs.sort();
     1875        for (const QString& sig : {mwSig1, mwSig2}) {
     1876          QString uu = pSigs.contains(sig) ? sig : QString();
     1877          for (const QString& ps : pSigs) {
     1878            if (uu.isEmpty() && ps[0] == sig[0]) uu = ps;
     1879          }
     1880          used << "L" + uu;
     1881        }
     1882        lines << QString("MW check: phase biases %1 with the code biases C%2 C%3 of the reference signals, "
     1883                         "wide-lane cycles (%4 m)")
     1884                 .arg(used.join(" ")).arg(mwSig1).arg(mwSig2)
     1885                 .arg(t_CST::c / (t_CST::freq(mwFrq1, 0) - t_CST::freq(mwFrq2, 0)), 0, 'f', 3);
     1886      }
     1887      if (_mwStat.contains(staID)) {
     1888        QMapIterator<QString, QMap<char, t_mwStat> > itOther(_mwStat[staID]);
     1889        while (itOther.hasNext()) {
     1890          itOther.next();
     1891          if (!itOther.value().contains(sys)) continue;
     1892          const t_mwStat& ms = itOther.value()[sys];
     1893          if (ms.numRes == 0) continue;
     1894          double rms = sqrt(ms.sRes2 / ms.numRes);
     1895          QString verdict = (rms < MW_OK)  ? "consistent (integer wide-lane biases)" :
     1896                            (rms > MW_BAD) ? "NOT consistent" : "not clearly consistent";
     1897          lines << QString("MW biases vs. %1 (%2 epochs, %3 satellites): fractional parts about the "
     1898                           "common offset %4 cycles: RMS %5 cycles, %6")
     1899                   .arg(itOther.key()).arg(ms.numEpo).arg(ms.satRes.size())
     1900                   .arg(ms.offset, 0, 'f', 2).arg(rms, 0, 'f', 3).arg(verdict);
     1901          QStringList dev;
     1902          QMapIterator<QString, QPair<unsigned, double> > itS(ms.satRes);
     1903          while (itS.hasNext()) {
     1904            itS.next();
     1905            double rmsSat = sqrt(itS.value().second / itS.value().first);
     1906            if (rmsSat > MW_BAD) {
     1907              dev << QString("%1(%2)").arg(itS.key()).arg(rmsSat, 0, 'f', 2);
     1908            }
     1909          }
     1910          if (!dev.isEmpty() && rms < MW_BAD) {
     1911            lines << QString("MW biases vs. %1: satellites with RMS > %2 cycles: %3")
     1912                     .arg(itOther.key()).arg(MW_BAD, 0, 'f', 2).arg(dev.join(" "));
     1913          }
     1914        }
     1915      }
    16721916      if (numPB) {
    16731917        if (numYaw == 0) {
    … …  
    17682012  _cmpEpochs.clear();
    17692013  _attEvents.clear();
     2014  _pbIndStat.clear();
     2015  _mwStat.clear();
    17702016  for (QMap<QString, t_vtecStat>::iterator it = _vtecStat.begin(); it != _vtecStat.end(); ++it) {
    17712017    t_vtecStat fresh;
  • trunk/BNC/src/ssrQc.h

    r11195 r11212  
    7878    unsigned      numPB  = 0;    // phase bias records
    7979    unsigned      numYaw = 0;    // phase bias records with yaw angle
     80    unsigned      pbJumps = 0;   // changes of the phase bias discontinuity counter
    8081  };
    8182
    … …  
    155156  QMap<QString, QSet<QString> > _phaseSignals; // key "STA SYS": signals with phase biases
    156157
     158  // Phase bias indicators per stream and system: SSR format, consistency
     159  // indicators, integer and wide-lane integer indicators per signal
     160  class t_pbIndStat {
     161   public:
     162    unsigned                              numRec = 0;
     163    QMap<QString, unsigned>               format;   // format name: records
     164    QMap<int, unsigned>                   dispInd;  // dispersive bias consistency indicator: records
     165    QMap<int, unsigned>                   mwInd;    // Melbourne-Wuebbena consistency indicator: records
     166    QMap<QString, QMap<int, unsigned> >   intInd;   // signal, integer indicator: records
     167    QMap<QString, QMap<int, unsigned> >   wlInd;    // signal, wide-lane integer indicator: records
     168  };
     169  QMap<QString, t_pbIndStat> _pbIndStat;    // key "STA SYS"
     170  QMap<QString, int>         _pbJumpLast;   // key "STA PRN SIG": latest discontinuity counter
     171
     172  // Melbourne-Wuebbena check: every MW_SAMPL seconds the MW combination of the
     173  // phase and code biases of the reference signals (wide-lane cycles) of each
     174  // stream is differenced with that of the other ACs per satellite; for
     175  // consistent (integer) wide-lane biases the fractional parts of these
     176  // differences agree for all satellites of a system (one common offset)
     177  class t_pbLast {           // latest phase biases of a stream and satellite
     178   public:
     179    bncTime                 time;
     180    QMap<QString, double>   values;   // signal: bias [m]
     181  };
     182  class t_mwStat {           // per stream, other stream and system
     183   public:
     184    unsigned numEpo  = 0;
     185    unsigned numRes  = 0;
     186    double   sRes2   = 0.0;           // [cycles^2]
     187    double   offset  = 0.0;           // latest common offset [cycles]
     188    QMap<QString, QPair<unsigned, double> > satRes; // PRN: residuals, sum of squares
     189  };
     190  void   compareMw(const bncTime& tt);
     191  bool   mwBias(const QString& staID, const QString& prn, char sys, const bncTime& tt, double& mwCyc);
     192  QMap<QString, QMap<QString, t_pbLast> >                 _pbLast;  // stream, PRN
     193  QMap<QString, QMap<QString, QMap<char, t_mwStat> > >    _mwStat;  // stream, other stream, system
     194  bncTime                                                 _nextMwCmp;
     195
    157196  // Code bias check: DCBs of each stream compared with the other ACs (or
    158197  // the reference stream) and optionally with a Bias SINEX file
  • trunk/BNC/tests/README.md

    r11200 r11212  
    153153  from two `bncraw.py slice` outputs; 'Ephemeris streams' BCEP00BKG0): the R14 data sets from
    154154  tb 13:15 Moscow time on have ln = 1 with Bn = 0, Cn = 1 and are unhealthy (ICD 5.1, 5.3).
     155* `ssr_qc_phase_bias`: phase bias indicators and Melbourne-Wuebbena check on
     156  `data/combi_multi_261002_5min.raw` (one MW epoch, 11:45): CHC1, CNE1, SHA1 (IGS-SSR) and NRC0
     157  (old RTCM-SSR); MW consistency indicator 1 only for CNE1/NRC0, CNE1 vs NRC0 GPS 0.14 cycles
     158  (G01 G04 G11 G23 G28 0.2-0.3 cycles, verified by hand from the decoded .ssr files), all other
     159  pairs ~0.25 cycles; CNE1 BeiDou phase biases with integer indicator 0.
    155160
    156161* `decoder_limits`: crafted, CRC-valid frames from `tools/mkcrafted.py`
Note: See TracChangeset for help on using the changeset viewer.