Changeset 11216 in ntrip for trunk


Ignore:
Timestamp:
Nov 20, 2026, 4:14:37 PM (5 hours ago)
Author:
stuerze
Message:

Upload Ephemeris: majority vote approach improved

Location:
trunk/BNC
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/CHANGELOG.md

    r11215 r11216  
    22## 2.13.9 (unreleased)
    33- CHANGED: **Ephemerides of satellites outside the range supported by BNC** (e.g. G39, test signal of NTS-3 since 30 Sep 2026, not IS-GPS compliant, seen 19 Nov 2026 by many stations in Australia and the Pacific) are no longer written to RINEX navigation files or the ephemeris port, uploaded, or used in PPP, combination and SSR QC; each data set is logged once with its complete RINEX navigation record. Before, they were passed on unchanged (e.g. into an uploaded Broadcast Ephemeris stream), only the warning 'outside the range supported by BNC' was logged. RINEX Edit/Concatenate keeps such records of input files. New test case eph_out_of_range, test tool bncraw.py ephsats
    4 - ADDED: **Upload Ephemeris: majority vote over the copies of a data set.** The first copy of a data set (same TOC and IOD) received from any stream is uploaded immediately as before; every further stream counts as a vote for its copy, and a copy with different content (the RTCM3 message without the GLONASS frame time tk and the system time offsets tau_c/tau_GPS, which receivers take from the string 5 of any satellite) replaces the uploaded one as soon as more streams deliver it than the current one, i.e. with at least three streams. Each replacement is logged with the streams per copy and the differing fields. Before, the fastest stream decided all fields of a data set, e.g. BCEP00BKG0 18 Nov 2026 R19/R20 with Bn = 1 (unhealthy) from RIO200ARG0/ENAO00PRT0 while all other streams sent Bn = 0, and ln3 = 1 from CUT000AUS0; replay of 89 input streams (2 h): GLONASS health different from the majority of the streams in 1 of 156 data sets (a 2:2 tie in Cn of the unhealthy R27) instead of 63. New test case upload_eph_vote
     4- ADDED: **Upload Ephemeris: majority vote over the copies of a data set.** A new data set (TOC and IOD) is uploaded as soon as three streams deliver the same content, at the latest 40 s after its first copy (before: the first copy immediately; SSR providers use a new IOD after 60 s, the 20 s left cover the upload interval and latency); meanwhile the previous data set stays in the upload (checked with each ephemeris and every second). Receivers and applications, BNC too, keep the first copy of a data set, so only this delay protects them; immediately uploaded if the previous data set came from less than three streams or for the first data set of a satellite. Replay 18 Nov 2026 (89 streams, 20 min): three agreeing streams after 14 s in the median, 87 % of 94 data sets within 40 s. Every further stream counts as a vote for its copy, and a copy with different content (the RTCM3 message without the GLONASS frame time tk and the system time offsets tau_c/tau_GPS, which receivers take from the string 5 of any satellite) replaces the uploaded one as soon as more streams deliver it than the current one, i.e. with at least three streams. Each replacement is logged with the streams per copy and the differing fields. Before, the fastest stream decided all fields of a data set, e.g. BCEP00BKG0 18 Nov 2026 R19/R20 with Bn = 1 (unhealthy) from RIO200ARG0/ENAO00PRT0 while all other streams sent Bn = 0, and ln3 = 1 from CUT000AUS0; replay of 89 input streams (2 h): GLONASS health different from the majority of the streams in 1 of 156 data sets (a 2:2 tie in Cn of the unhealthy R27) instead of 63. New test case upload_eph_vote
    55- ADDED: **SSR QC: code biases of APC and CoM streams.** For IGS-SSR and old RTCM-SSR (not new RTCM-SSR, which carries its own satellite antenna model), the code biases of an APC stream (SSRA...) are compared with those of the CoM stream of the same solution and format (SSRC...); following the IGS SSR convention (users reduce the satellite PCOs of all frequencies by the PCO of the reference frequency) they have to be equal. With 'QC ANTEX File' the differences are compared with the PCO differences z(f) - z(ref): 15 Oct 2026 SSRA00GMV0 GPS/Galileo/BDS biases shifted by z(f) - z(ref) (residuals 2/3/14 mm, up to 0.76 m, B_IF of GPS IIIA 0.78 m), GLONASS equal. New test case ssr_qc_apc_com
    66- 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
  • trunk/BNC/src/bncephuser.cpp

    r11215 r11216  
    144144  }
    145145
     146  if (_voting && realTime) {
     147    releaseHeld();
     148  }
     149
    146150  // satellite outside the range supported by BNC (e.g. G39)
    147151  if (eph->prn().toInt() == 0) {
    … …  
    196200      votes->_eph.append(clone(newEph));
    197201      votes->_station[newEph->receptStaID()] = 0;
     202      votes->_first = currentTime();
     203      if (qq.size() > 1) {
     204        const t_votes* prev = _votes.value(qq[qq.size()-2], 0);
     205        votes->_released = !(prev && prev->_station.size() >= VOTE_AGREE);
     206      }
    198207      _votes[newEph] = votes;
    199208    }
    … …  
    316325}
    317326
     327// Satellite in the vote messages, for Galileo with the navigation message
     328// (I/NAV and F/NAV data sets are buffered and voted separately)
     329////////////////////////////////////////////////////////////////////////////
     330static QString voteSat(const t_eph* eph) {
     331  QString sat(QString(eph->prn().toInternalString().c_str()).left(3));
     332  if      (eph->type() == t_eph::INAV) sat += " INAV";
     333  else if (eph->type() == t_eph::FNAV) sat += " FNAV";
     334  return sat;
     335}
     336
     337const double bncEphUser::VOTE_HOLD  = 40.0;  // SSR providers switch to a new IOD after 60 s
     338const int    bncEphUser::VOTE_AGREE = 3;
     339
     340// Current GPS time (time of the input data when replaying a file)
     341////////////////////////////////////////////////////////////////////////////
     342bncTime bncEphUser::currentTime() {
     343  return bncTime(currentDateAndTimeGPS().toString(Qt::ISODate).toStdString());
     344}
     345
     346// Release the data sets held back longer than VOTE_HOLD seconds
     347////////////////////////////////////////////////////////////////////////////
     348void bncEphUser::releaseHeld() {
     349  bncTime now = currentTime();
     350  bool changed = false;
     351  QStringList msgs;  // sorted: the QHash order differs between runs
     352  QHashIterator<const t_eph*, t_votes*> it(_votes);
     353  while (it.hasNext()) {
     354    it.next();
     355    t_votes* votes = it.value();
     356    if (!votes->_released && now - votes->_first >= VOTE_HOLD) {
     357      votes->_released = true;
     358      changed = true;
     359      const t_eph* eph = it.key();
     360      QVector<int> count(votes->_content.size(), 0);
     361      QMapIterator<QString, int> is(votes->_station);
     362      while (is.hasNext()) {
     363        is.next();
     364        count[is.value()]++;
     365      }
     366      msgs << QString("ephemeris vote %1 %2 %3: copy of %4 uploaded after %5 s without %6 agreeing streams (%7 of %8 streams)")
     367                        .arg(voteSat(eph))
     368                        .arg(eph->TOC().datestr().c_str())
     369                        .arg(eph->TOC().timestr(0).c_str())
     370                        .arg(eph->receptStaID())
     371                        .arg(int(VOTE_HOLD))
     372                        .arg(VOTE_AGREE)
     373                        .arg(count[votes->_current])
     374                        .arg(votes->_station.size());
     375    }
     376  }
     377  msgs.sort();
     378  for (const QString& msg : msgs) {
     379    BNC_CORE->message(msg.toLatin1(), false, "bce", t_logRecord::info);
     380  }
     381  if (changed) {
     382    ephBufferChanged();
     383  }
     384}
     385
     386// Vote over the copies of a data set, check of the hold every second
     387////////////////////////////////////////////////////////////////////////////
     388void bncEphUser::enableVoting() {
     389  _voting = true;
     390  QTimer* timer = new QTimer(this);
     391  connect(timer, SIGNAL(timeout()), this, SLOT(slotVoteTimer()));
     392  timer->start(1000);
     393}
     394
     395// Release of held data sets without new ephemerides; not when replaying a
     396// file, where the time of the input data decides (reproducible results)
     397////////////////////////////////////////////////////////////////////////////
     398void bncEphUser::slotVoteTimer() {
     399  if (BNC_CORE->dateAndTimeGPSSet()) {
     400    return;
     401  }
     402  QMutexLocker locker(&_mutex);
     403  releaseHeld();
     404}
     405
     406// Data set to be uploaded
     407////////////////////////////////////////////////////////////////////////////
     408t_eph* bncEphUser::ephUpload(const QString& prn) {
     409  if (!_eph.contains(prn)) {
     410    return 0;
     411  }
     412  const deque<t_eph*>& qq = _eph[prn];
     413  const t_votes* votes = _votes.value(qq.back(), 0);
     414  if (votes && !votes->_released && qq.size() > 1) {
     415    return qq[qq.size()-2];
     416  }
     417  return qq.back();
     418}
     419
    318420// Further copy of the buffered data set qq[index] received from a stream
    319421////////////////////////////////////////////////////////////////////////////
    … …  
    345447    }
    346448  }
     449  bool released = false;
     450  if (!votes->_released && count[iBest] >= VOTE_AGREE) {
     451    votes->_released = true;
     452    released = true;
     453  }
    347454  if (iBest == votes->_current) {
     455    if (released) {
     456      ephBufferChanged();
     457    }
    348458    return;
    349459  }
    … …  
    353463  if (!radialDistanceOk(newEph)) {
    354464    delete newEph;
     465    if (released) {
     466      ephBufferChanged();
     467    }
    355468    return;
    356469  }
    … …  
    380493  }
    381494  BNC_CORE->message(QString("ephemeris vote %1 %2 %3: copy of %4 replaced by that of %5 (%6 of %7 streams; %8; differing: %9)")
    382                     .arg(prn.left(3))
     495                    .arg(voteSat(oldEph))
    383496                    .arg(oldEph->TOC().datestr().c_str())
    384497                    .arg(oldEph->TOC().timestr(0).c_str())
  • trunk/BNC/src/bncephuser.h

    r11215 r11216  
    4545  void slotNewBDSEph(t_ephBDS);
    4646
     47 private slots:
     48  void slotVoteTimer();
     49
    4750 public:
    4851  bncEphUser(bool connectSlots, unsigned maxQueueSize = 6);
    … …  
    5356  // Majority vote over the copies of a data set received from different streams
    5457  // (real-time input only, used for the ephemeris upload): the first copy is
    55   // accepted immediately; a copy with different content (RTCM3 encoding without
     58  // buffered immediately; a copy with different content (RTCM3 encoding without
    5659  // the GLONASS frame time tk and the system time offsets tau_c, tau_GPS) replaces it as soon as more streams deliver it
    5760  // than the current one, i.e. with at least three streams.
    58   void enableVoting() {_voting = true;}
     61  // A new data set is held back from the upload (ephUpload() returns the
     62  // previous one) until three streams deliver the same content or VOTE_HOLD
     63  // seconds (GPS time) have passed since its first copy; no hold if fewer than
     64  // three streams delivered the previous data set or there is none. The hold
     65  // is checked with each ephemeris received and in real time every second, so
     66  // that a held data set is also uploaded when no further ephemeris arrives.
     67  void enableVoting();
     68
     69  // data set to be uploaded: the latest one, or the previous one while the
     70  // latest is held back by the vote
     71  t_eph* ephUpload(const QString& prn);
    5972
    6073  // Real-time input restricted to the ephemerides of the streams given in the
    … …  
    110123    QMap<QString, int>   _station;  // stream -> variant of its latest copy
    111124    int                  _current = 0;  // variant in the buffer
     125    bncTime              _first;        // first copy received (GPS time)
     126    bool                 _released = true;  // may be uploaded
    112127  };
     128  static const double VOTE_HOLD;    // maximum hold of a new data set [s]
     129  static const int    VOTE_AGREE;   // streams releasing a new data set
     130  static bncTime currentTime();
     131  void   releaseHeld();
    113132  static t_eph*     clone(const t_eph* eph);
    114133  static QByteArray votingContent(const t_eph* eph);
  • trunk/BNC/src/bnchelp.html

    r11215 r11216  
    1007010070  <p>
    1007110071    If the same data set (same TOC and IOD) is received from several streams, BNC votes on its content: the
    10072     first copy received is uploaded immediately; every further stream counts as a vote for the copy it delivers, and
    10073     a copy with different content replaces the uploaded one as soon as more streams deliver it than the current one,
    10074     i.e. with at least three streams. The content compared is the RTCM Version 3 message as uploaded, for GLONASS
     10072    first copy received is buffered; every further stream counts as a vote for the copy it delivers, and
     10073    a copy with different content replaces the buffered one as soon as more streams deliver it than the current one,
     10074    i.e. with at least three streams. A new data set is uploaded as soon as three streams deliver the same content as
     10075    the buffered copy, at the latest 40 seconds after its first copy; until then the previous data set of the
     10076    satellite stays in the upload; the hold is checked with each ephemeris received and every second. Data sets of satellites whose previous data set came from less than three streams
     10077    (and the first data set of a satellite) are uploaded immediately, as the vote cannot decide there. Receivers and
     10078    applications usually keep the first copy of a data set they received, also BNC itself, so a later replacement
     10079    with the same TOC and IOD would not reach them. The maximum of 40 seconds leaves time for the upload interval and
     10080    the latency before SSR providers may use the new IOD, 60 seconds after its broadcast; three streams agreed in the
     10081    median after 14 seconds and in 87 percent of the data sets within 40 seconds with 89 input streams
     10082    (18 Nov 2026). A replacement after the upload is still possible. The content compared is the RTCM Version 3 message as uploaded, for GLONASS
    1007510083    without the frame time tk and the system time offsets tau_c and tau_GPS, which differ legitimately between
    1007610084    receivers. This protects the uploaded stream against single receivers sending e.g. wrong health flags. Each
    … …  
    1008110089ephemeris vote R19 2026-11-18 17:45:18: copy of RIO200ARG0 replaced by that of BRAZ00BRA0 (2 of 3 streams;
    1008210090  - RIO200ARG0, + BRAZ00BRA0 RGDG00ARG0; differing: Cn A Bn P3 NA N4)
     10091</pre>
     10092  <p>
     10093    A data set uploaded after 40 seconds without three agreeing streams is logged as well, e.g.
     10094  </p>
     10095  <pre>
     10096ephemeris vote G14 2026-11-18 20:00:00: copy of OWMG00NZL0 uploaded after 40 s without 3 agreeing streams
     10097  (2 of 4 streams)
    1008310098</pre>
    1008410099  <p>
  • trunk/BNC/src/upload/bncephuploadcaster.cpp

    r11215 r11216  
    2626////////////////////////////////////////////////////////////////////////////
    2727bncEphUploadCaster::bncEphUploadCaster() : bncEphUser(true) {
    28   enableVoting();
    2928  bncSettings settings;
    3029  int sampl = settings.value("uploadSamplRtcmEph").toInt();
    … …  
    4948      _casters.push_back(newCaster);
    5049    }
     50  }
     51
     52  // vote (and hold back new data sets) only for an actual upload
     53  if (!_casters.isEmpty()) {
     54    enableVoting();
    5155  }
    5256}
    … …  
    7882      QListIterator<QString> it(prnList());
    7983      while (it.hasNext()) {
    80         const t_eph* eph = ephLast(it.next());
     84        const t_eph* eph = ephUpload(it.next());
    8185
    8286        bncTime toc = eph->TOC();
  • trunk/BNC/tests/cases/upload_eph_vote/case.json

    r11215 r11216  
    11{
    2   "description": "19_UploadEph replay with the majority vote over the copies of a data set: GPS, GLONASS and BDS ephemerides of 89 uploader input streams (BCEP00BKG0 removed), 18 Nov 2026 17:43-18:03; the log lists each replaced copy, e.g. R06/R19/R20 of 18:15:18 GPS time with Bn=1 from RIO200ARG0 replaced as soon as two other streams agree. The uploaded content depends on the wall-clock timing and is not compared",
     2  "description": "19_UploadEph replay with the majority vote over the copies of a data set: GPS, GLONASS and BDS ephemerides of 89 uploader input streams (BCEP00BKG0 removed), 18 Nov 2026 17:43-18:03; the log lists each replaced copy, e.g. R06/R19/R20 of 18:15:18 GPS time with Bn=1 from RIO200ARG0 replaced as soon as two other streams agree; new data sets are uploaded after three agreeing streams or at the latest after 40 s (timeouts logged). The uploaded content depends on the wall-clock timing and is not compared",
    33  "config": "Example_Configs/19_UploadEph.bnc",
    44  "raw": "data/eph_vote_261118_20min.raw",
Note: See TracChangeset for help on using the changeset viewer.