Changeset 11240 in ntrip


Ignore:
Timestamp:
Dec 3, 2026, 9:10:39 AM (less than one hour ago)
Author:
stuerze
Message:

clock combination improvement

Location:
trunk/BNC
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/CHANGELOG.md

    r11228 r11240  
    11# Changelog
    22## 2.13.9 (unreleased)
     3- FIXED: **Combination (Kalman filter): robust clock datum, good offsets left together with an outlier.** The deviations were measured from the median of all ACs, which a single extreme offset distorts: on 29 Nov 2026 03:43 BKG00 G13 (+5 m) took CHC00 out of the datum of G13 together with it, CAS01 left as well, and G13 was carried by GMV00 alone (whose APC code biases contain the GPS III antenna offset), combined G13 -2 ns for days. Offsets now leave one at a time, the largest deviation first, and the median is computed again over the offsets still in the datum after each departure. An offset rejoins after a deviation below the threshold from the median of the offsets in the datum; if fewer than a majority of the ACs are in the datum, from the median of all offsets not rejected as outliers (otherwise one or two remaining offsets keep the others out for good: GLONASS 29 Nov). Replay of the IGS03 inputs, 29/30 Nov, clocks vs. GFZ rapid (RMS of the per-satellite mean differences after removing the epoch-wise system median): GPS 0.166/0.173 -> 0.140/0.167 m (G13 0.45/0.58 -> 0.21/0.44 m), GLONASS 0.581/0.383 -> 0.446/0.329, Galileo 0.080/0.059 -> 0.079/0.051, BDS 0.288/0.240 -> 0.298/0.209 m. To be checked in the next SSR QC: GLONASS common level alternating by 0.1 m during periods with many outliers (29 Nov 03:53-04:08). Test case combi_datum
    34- ADDED: **SP3 comparison with clock RINEX files** (key `sp3CompClkFile`, optional, in the order of the SP3 files, '-' for none, one name = SP3 file 1). The clocks of a clock RINEX file replace those of its SP3 file; clocks and SIS are compared at all common clock epochs, orbits interpolated between the SP3 epochs (Lagrange, 10 consecutive epochs, no extrapolation or gaps; about 1 mm for 5 min orbits), orbit statistics at the common SP3 epochs only. Allows the daily comparison of 30 s BNC SP3 files with the 30 s clocks of a rapid product instead of its 5 min SP3 clocks (10 times more clock epochs, short clock events visible). GFZ rapid 21 Nov 2026 vs IGS03 (1 h): nClk G 372 -> 3978, orbits unchanged; a BNC clock file for the BNC SP3 gives identical results (same clocks). New test cases sp3_compare_clk, sp3_compare_clk_bnc
    45- ADDED: **SSR QC: RMS of the VTEC (IGS-SSR message 202).** The IGS-SSR decoder reads message 202 ('Proposal of New IGS-SSR Ionospheric RMS Message', CAS, Dec 2025; same layout as 201); a message shorter than its header is rejected. The RMS maps go to the SSR QC only (not to the .ssr files or PPP): evaluated on the VTEC grid and compared with the differences of the model to the consensus (stated vs actual RMS, differences normalized by the stated RMS, share within 1 and 2 RMS). Replay 20 Nov 2026 22-23 h: IONO00CAS1 stated 1.0-6.3 TECU (RMS 4.2) vs actual 4.5 TECU, normalized RMS 1.23, 67 %/91 % within 1/2 RMS (realistic); SSRC01CAS1 a constant 1.2 TECU (only C00) vs actual 10 TECU; IONO01IGS1 sends 202 with only 80 bits (header incomplete), rejected. New test case ssr_qc_vtec_rms
  • trunk/BNC/src/bnchelp.html

    r11235 r11240  
    87348734    rejected again in every epoch. Therefore, for each satellite, BNC compares the satellite specific clock difference
    87358735    of each AC referred to the reference signals (AC clock minus AC specific offset minus combined clock, rejected
    8736     corrections included) with the median of the ACs. A satellite offset rejected as outlier for 60 seconds is taken
     8736    corrections included) with the median of the ACs whose offsets are in the datum. A satellite offset rejected as outlier for 60 seconds is taken
    87378737    out of the zero-sum conditions (of the satellite and of the AC) and re-initialized: it then absorbs the constant
    87388738    difference, and the AC only contributes to the variation of the combined clock. This applies to any number of ACs,
    … …  
    87418741    than 'Maximal Residuum' (at most 0.5 m) for 60 seconds leaves the conditions as well: the offsets with the largest
    87428742    deviations leave first, and a majority of the ACs of the satellite (at least two) stays in the conditions, e.g. if
    8743     the ACs form two groups with a clock difference. An offset rejoins the zero-sum conditions after its deviation has
    8744     stayed below half of this threshold for 10 minutes without being rejected. The zero-sum condition of a satellite
     8743    the ACs form two groups with a clock difference. Offsets leave one at a time: after each departure the median is
     8744    computed again over the offsets still in the datum, so that a single extreme offset, which distorts the median of
     8745    all ACs, does not take good offsets out together with it. An offset rejoins the zero-sum conditions after its
     8746    deviation from the median of the offsets in the datum has stayed below half of this threshold for 10 minutes
     8747    without being rejected; if fewer than a majority of the ACs are in the datum, the median of all offsets not
     8748    rejected as outliers is used instead. The zero-sum condition of a satellite
    87458749    refers to the values of its offsets only if all offsets in the datum of the satellite (provided within the last
    87468750    hour) are present in the epoch. During a data gap of such an AC, or if its correction is rejected, the sum of the
  • trunk/BNC/src/combination/bnccomb.cpp

    r11221 r11240  
    16391639// the reference signals
    16401640//   u = clock - AC offset - combined clock
    1641 // (rejected corrections included) is compared with the median of the ACs.
     1641// (rejected corrections included) is compared with the median of the ACs
     1642// whose offsets are in the datum. Offsets leave one at a time, the largest
     1643// deviation first, and the median is computed again after each departure.
    16421644// An offset rejected as outlier for DATUM_OUT_SEC leaves the zero-sum
    16431645// conditions (satellite and AC) and is re-initialized: it then absorbs the
    … …  
    16491651// DATUM_OUT_SEC leaves as well, as long as a majority of the ACs stays in.
    16501652// An offset rejoins the datum after a deviation below DATUM_IN_DEV (at most
    1651 // half of the maximum residual) without rejection for DATUM_IN_SEC. ACs not
     1653// half of the maximum residual) from the median of the offsets in the datum
     1654// without rejection for DATUM_IN_SEC. ACs not
    16521655// referred to the reference signals are excluded from the datum anyway and
    16531656// not judged.
    … …  
    16921695    const QVector<const t_datumObs*>& obs = itSat.value();
    16931696    const bool robust = (obs.size() >= DATUM_MIN_AC); // median meaningful
    1694     QVector<double> uSat;
     1697    const int  nn     = obs.size();
     1698    // a majority of the ACs stays in the datum (e.g. two groups of ACs with
     1699    // a clock difference: the median is not meaningful)
     1700    const int  minIn  = std::max(2, (nn + 1) / 2);
     1701
     1702    auto medianOf = [&uu](const QVector<const t_datumObs*>& set) {
     1703      QVector<double> vv;
     1704      for (const t_datumObs* dObs : set) {
     1705        vv.push_back(uu[dObs->ac + ' ' + dObs->prn]);
     1706      }
     1707      std::sort(vv.begin(), vv.end());
     1708      int mm = vv.size();
     1709      return (mm % 2) ? vv[mm/2] : 0.5 * (vv[mm/2-1] + vv[mm/2]);
     1710    };
     1711    auto report = [&](const QString& msg) {
     1712      out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() << " " << msg << "\n";
     1713      emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: " + msg.toLatin1()), true);
     1714    };
     1715
     1716    QVector<const t_datumObs*> inSet, outSet;
    16951717    for (const t_datumObs* dObs : obs) {
    1696       uSat.push_back(uu[dObs->ac + ' ' + dObs->prn]);
    1697     }
    1698     std::sort(uSat.begin(), uSat.end());
    1699     int    nn     = uSat.size();
    1700     double median = (nn % 2) ? uSat[nn/2] : 0.5 * (uSat[nn/2-1] + uSat[nn/2]);
    1701 
    1702     // a majority of the ACs stays in the datum (e.g. two groups of ACs with
    1703     // a clock difference: the median is not meaningful); the offsets with the
    1704     // largest deviations leave first
    1705     const int minIn  = std::max(2, (nn + 1) / 2);
    1706     int       numIn  = 0;
    1707     QVector<const t_datumObs*> order = obs;
     1718      (states[dObs->ac + ' ' + dObs->prn].out ? outSet : inSet).push_back(dObs);
     1719    }
     1720
     1721    // Leaving: one offset at a time, the one with the largest deviation from
     1722    // the median of the offsets still in the datum first; the median is
     1723    // computed again after each departure. Otherwise one extreme offset
     1724    // shifts the median of all ACs so much that good offsets leave together
     1725    // with it (29 Nov 2026, G13: BKG00 +5 m took CHC00 out, only GMV00 stayed).
     1726    // ------------------------------------------------------------------------
     1727    if (inSet.size() == 1) {
     1728      t_datumState& state = states[inSet[0]->ac + ' ' + inSet[0]->prn];
     1729      state.dev = 0.0;
     1730      state.since.reset();
     1731    }
     1732    while (inSet.size() > 1) {
     1733      double median = medianOf(inSet);
     1734      QVector<const t_datumObs*> cand;
     1735      for (const t_datumObs* dObs : inSet) {
     1736        t_datumState& state = states[dObs->ac + ' ' + dObs->prn];
     1737        state.dev = uu[dObs->ac + ' ' + dObs->prn] - median;
     1738        if (dObs->rejected || (robust && fabs(state.dev) > DATUM_OUT_DEV)) {
     1739          if (!state.since.valid()) {
     1740            state.since = epoTime;
     1741          }
     1742          cand.push_back(dObs);
     1743        }
     1744        else {
     1745          state.since.reset();
     1746        }
     1747      }
     1748      std::stable_sort(cand.begin(), cand.end(),
     1749                       [&states](const t_datumObs* aa, const t_datumObs* bb) {
     1750                         return fabs(states[aa->ac + ' ' + aa->prn].dev) >
     1751                                fabs(states[bb->ac + ' ' + bb->prn].dev);
     1752                       });
     1753      const t_datumObs* leaving = 0;
     1754      for (const t_datumObs* dObs : cand) {
     1755        t_datumState& state = states[dObs->ac + ' ' + dObs->prn];
     1756        // the largest deviation leaves first: until it may leave, no other does
     1757        if (epoTime - state.since < DATUM_OUT_SEC) {
     1758          break;
     1759        }
     1760        // a rejected offset leaves as long as another one stays in, a
     1761        // deviating (accepted) one only as long as a majority stays in
     1762        if (inSet.size() - 1 >= (dObs->rejected ? 1 : minIn)) {
     1763          leaving = dObs;
     1764          break;
     1765        }
     1766      }
     1767      if (!leaving) {
     1768        break;
     1769      }
     1770      t_datumState& state = states[leaving->ac + ' ' + leaving->prn];
     1771      double duration = epoTime - state.since;
     1772      state.out      = true;
     1773      state.outSince = epoTime;
     1774      state.since.reset();
     1775      // re-initialize the offset: it absorbs the difference from now on
     1776      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
     1777        cmbParam* pp = _params[sys][iPar-1];
     1778        if (pp->type == cmbParam::offACSat && pp->AC == leaving->ac && pp->prn == leaving->prn) {
     1779          _QQ[sys].Row(iPar)    = 0.0;
     1780          _QQ[sys].Column(iPar) = 0.0;
     1781          _QQ[sys](iPar,iPar)   = pp->sig0 * pp->sig0;
     1782        }
     1783      }
     1784      report(QString("%1 %2 out of the clock datum: deviation %3 m from the median of %4 ACs%5")
     1785             .arg(leaving->ac).arg(leaving->prn.mid(0,3))
     1786             .arg(state.dev, 0, 'f', 2).arg(inSet.size())
     1787             .arg(leaving->rejected ? QString(", rejected as outlier for %1 s").arg(duration, 0, 'f', 0) : QString()));
     1788      inSet.removeOne(leaving);
     1789    }
     1790
     1791    // Rejoining: deviation from the median of the offsets in the datum (not
     1792    // of all ACs: offsets out of the datum, e.g. a single extreme one, would
     1793    // keep a good offset out for good). If fewer than a majority of the
     1794    // offsets are in the datum, the median of all offsets not rejected as
     1795    // outliers is used instead: one or two remaining offsets would otherwise
     1796    // keep the others out for good (29 Nov 2026, GLONASS: datum of R14
     1797    // alternating between CHC00 and SHA01 for hours).
     1798    // ------------------------------------------------------------------------
     1799    QVector<const t_datumObs*> accepted;
    17081800    for (const t_datumObs* dObs : obs) {
    1709       QString key = dObs->ac + ' ' + dObs->prn;
    1710       states[key].dev = uu[key] - median;
    1711       if (!states[key].out) {
    1712         ++numIn;
    1713       }
    1714     }
    1715     std::stable_sort(order.begin(), order.end(),
    1716                      [&states](const t_datumObs* aa, const t_datumObs* bb) {
    1717                        return fabs(states[aa->ac + ' ' + aa->prn].dev) >
    1718                               fabs(states[bb->ac + ' ' + bb->prn].dev);
    1719                      });
    1720 
    1721     for (const t_datumObs* dObs : order) {
    1722       QString       key   = dObs->ac + ' ' + dObs->prn;
    1723       t_datumState& state = states[key];
    1724       bool change = state.out ? (fabs(state.dev) < DATUM_IN_DEV && !dObs->rejected)
    1725                               : (dObs->rejected || (robust && fabs(state.dev) > DATUM_OUT_DEV));
    1726       if (!change) {
     1801      if (!dObs->rejected) {
     1802        accepted.push_back(dObs);
     1803      }
     1804    }
     1805    const QVector<const t_datumObs*>& refSet =
     1806      (inSet.size() >= minIn) ? inSet : (accepted.isEmpty() ? obs : accepted);
     1807    double medianIn = medianOf(refSet);
     1808    for (const t_datumObs* dObs : outSet) {
     1809      t_datumState& state = states[dObs->ac + ' ' + dObs->prn];
     1810      state.dev = uu[dObs->ac + ' ' + dObs->prn] - medianIn;
     1811      if (fabs(state.dev) >= DATUM_IN_DEV || dObs->rejected) {
    17271812        state.since.reset();
    17281813        continue;
    … …  
    17321817      }
    17331818      double duration = epoTime - state.since;
    1734       if (duration < (state.out ? DATUM_IN_SEC : DATUM_OUT_SEC)) {
     1819      if (duration < DATUM_IN_SEC) {
    17351820        continue;
    17361821      }
    1737       // a rejected offset leaves as long as another one stays in, a deviating
    1738       // (accepted) one only as long as a majority stays in
    1739       if (!state.out && numIn - 1 < (dObs->rejected ? 1 : minIn)) {
    1740         continue;
    1741       }
    1742       QString msg;
    1743       if (!state.out) {
    1744         --numIn;
    1745         state.out      = true;
    1746         state.outSince = epoTime;
    1747         msg = QString("%1 %2 out of the clock datum: deviation %3 m from the median of %4 ACs%5")
    1748               .arg(dObs->ac).arg(dObs->prn.mid(0,3))
    1749               .arg(state.dev, 0, 'f', 2).arg(nn)
    1750               .arg(dObs->rejected ? QString(", rejected as outlier for %1 s").arg(duration, 0, 'f', 0) : QString());
    1751         // re-initialize the offset: it absorbs the difference from now on
    1752         for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
    1753           cmbParam* pp = _params[sys][iPar-1];
    1754           if (pp->type == cmbParam::offACSat && pp->AC == dObs->ac && pp->prn == dObs->prn) {
    1755             _QQ[sys].Row(iPar)    = 0.0;
    1756             _QQ[sys].Column(iPar) = 0.0;
    1757             _QQ[sys](iPar,iPar)   = pp->sig0 * pp->sig0;
    1758           }
    1759         }
    1760       }
    1761       else {
    1762         ++numIn;
    1763         state.out = false;
    1764         msg = QString("%1 %2 back in the clock datum: deviation %3 m from the median of %4 ACs "
    1765                       "(below %5 m for %6 s)")
    1766               .arg(dObs->ac).arg(dObs->prn.mid(0,3))
    1767               .arg(state.dev, 0, 'f', 2).arg(nn)
    1768               .arg(DATUM_IN_DEV, 0, 'f', 2).arg(duration, 0, 'f', 0);
    1769       }
     1822      state.out = false;
    17701823      state.since.reset();
    1771       out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() << " " << msg << "\n";
    1772       emit newLogRecord(t_logRecord::message(t_logRecord::info, "bncComb: " + msg.toLatin1()), true);
     1824      report(QString("%1 %2 back in the clock datum: deviation %3 m from the median of %4 ACs "
     1825                     "(below %5 m for %6 s)")
     1826             .arg(dObs->ac).arg(dObs->prn.mid(0,3))
     1827             .arg(state.dev, 0, 'f', 2).arg(refSet.size())
     1828             .arg(DATUM_IN_DEV, 0, 'f', 2).arg(duration, 0, 'f', 0));
    17731829    }
    17741830  }
  • trunk/BNC/tests/README.md

    r11228 r11240  
    129129  the combined clocks must not jump (before: all BDS clocks -0.92 m and back).
    130130  `tools/clkjumps.py` lists common clock jumps > 0.1 m of the CLK file.
     131* `combi_datum`: like `combi_bds_level` from `data/combi_datum_261130_12min.raw`
     132  (30 Nov 2026 00:00-00:12, cut from the operational IGS03 recording). From
     133  00:08 BKG00 G13 is an outlier of several metres; CHC00 must stay in the clock
     134  datum of G13 (before: it left at 00:08:23 together with BKG00, the deviation
     135  being measured from the median distorted by BKG00).
    131136* `combi_refsig`: `combi` with non-default reference signals (`ssrRefSignals
    132137  C:1P&5P`): BDS clock referral and code biases from the Bias SINEX file on
Note: See TracChangeset for help on using the changeset viewer.