Changeset 11220 in ntrip for trunk/BNC/src


Ignore:
Timestamp:
Nov 23, 2026, 10:25:45 PM (7 days ago)
Author:
stuerze
Message:

combination improved

Location:
trunk/BNC/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bnchelp.html

    r11218 r11220  
    53515351    Corrections with an epoch time more than 900 seconds from their reception, e.g. an erroneously encoded GLONASS
    53525352    epoch (see the decoder message 'SSR epoch time ... differs by ... s from the GPS SSR epoch time of the stream'),
    5353     are not used and their number is given below the table; they would otherwise move the report interval.
     5353    are not used and their number is given below the table; they would otherwise move the report interval. Code and
     5354    phase biases are only rejected for a future epoch, as their epoch may legitimately be hours old (Galileo HAS keeps
     5355    the reference time of its quasi-static biases).
    53545356  </p>
    53555357  <p>
    … …  
    86398641    sum relaxes to zero with a time constant of one hour, so that a permanent change of the combined satellites shifts
    86408642    the clocks only slowly. After a gap of more than 60 seconds (and at the start) the sum is set to zero.
     8643  </p>
     8644  <p>
     8645    Clock corrections with an epoch time more than 60 seconds from the current time are not combined. Orbit corrections
     8646    and biases more than 900 seconds from the current time are not stored either, e.g. an erroneously encoded GLONASS
     8647    epoch hours ahead; it would otherwise mark the AC as having delivered all epochs up to then, so that the
     8648    combination would no longer wait for it. Biases are only rejected for a future epoch: their epoch may legitimately
     8649    be hours old (Galileo HAS). Such an epoch is reported in the logfile at most once per hour and AC
     8650    ('bncComb: SHA00 orbit correction epoch ... is 11116 s from the current time, not used').
    86418651  </p>
    86428652  <p>
  • trunk/BNC/src/combination/bnccomb.cpp

    r11218 r11220  
    4747const double CLK_LEVEL_TAU    = 3600.0; // [s] relaxation of the sum to zero
    4848const double CLK_LEVEL_MAXGAP =   60.0; // [s] longer gap: sum set to zero again
     49
     50// Real-time input: corrections whose epoch differs more than this from the
     51// current time are not used (bogus epochs, e.g. a GLONASS epoch encoded hours
     52// ahead); clocks are limited to CLK_MAX_EPOCH_OFFSET anyway
     53const double MAX_EPOCH_OFFSET     = 900.0; // [s]
     54const double CLK_MAX_EPOCH_OFFSET =  60.0; // [s]
    4955
    5056using namespace std;
    … …  
    471477      continue;
    472478    }
     479    if (epochOutOfRange(acName, orbCorr._time, MAX_EPOCH_OFFSET, "orbit")) {
     480      continue;
     481    }
    473482
    474483    // Store the correction; the latest orbit of the previous IOD is kept as
    … …  
    514523      continue;
    515524    }
     525    if (epochOutOfRange(acName, satCodeBias._time, MAX_EPOCH_OFFSET, "code bias", true)) {
     526      continue;
     527    }
    516528
    517529    // Store the correction
    … …  
    553565      continue;
    554566    }
     567    if (epochOutOfRange(acName, satPhaseBias._time, MAX_EPOCH_OFFSET, "phase bias", true)) {
     568      continue;
     569    }
    555570
    556571    // Store the correction
    … …  
    562577}
    563578
     579
     580// Real-time input: true if the correction epoch differs more than maxOffset
     581// from the current time (not used; replay of a raw file: more than
     582// MAX_EPOCH_OFFSET); pastOk: biases, whose epoch may legitimately be hours
     583// old (Galileo HAS: reference time of quasi-static biases), only future
     584// epochs are rejected; a warning at most once per hour and AC
     585// for offsets beyond MAX_EPOCH_OFFSET (bogus epochs, not just the backlog of
     586// a stream after a (re)connect)
     587////////////////////////////////////////////////////////////////////////////
     588bool bncComb::epochOutOfRange(const QString& acName, const bncTime& epoTime,
     589                              double maxOffset, const char* type, bool pastOk) {
     590  // replay of a raw file (batch): only bogus epochs, the current time is
     591  // that of the replayed chunk
     592  if (BNC_CORE->mode() == t_bncCore::batchPostProcessing) {
     593    if (!BNC_CORE->dateAndTimeGPSSet()) {
     594      return false;
     595    }
     596    maxOffset = max(maxOffset, MAX_EPOCH_OFFSET);
     597  }
     598  int    currentWeek = 0;
     599  double currentSec  = 0.0;
     600  currentGPSWeeks(currentWeek, currentSec);
     601  bncTime currentTime(currentWeek, currentSec);
     602  double offset = epoTime - currentTime;
     603  if (fabs(offset) <= maxOffset || (pastOk && offset < 0.0)) {
     604    return false;
     605  }
     606  if (fabs(offset) > MAX_EPOCH_OFFSET) {
     607    bncTime& warned = _badEpochWarned[acName];
     608    if (!warned.valid() || currentTime - warned >= 3600.0) {
     609      warned = currentTime;
     610      emit newLogRecord(t_logRecord::message(t_logRecord::warning, "bncComb: " + acName.toLatin1() + " " + type +
     611                      " correction epoch " + QByteArray(epoTime.datestr().c_str()) + " " + epoTime.timestr().c_str() +
     612                      QString(" is %1 s from the current time, not used").arg(offset, 0, 'f', 0).toLatin1() +
     613                      " (further ones of this AC not reported within the next hour)"), true);
     614    }
     615  }
     616#ifdef BNC_DEBUG_CMB
     617  emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: future or very old data sets: " + acName.toLatin1() + " " + type +
     618      QString(" %1 ").arg(epoTime.timestr().c_str()).toLatin1() + "vs. current time" +
     619      QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1()), true);
     620#endif
     621  return true;
     622}
    564623
    565624// True if every AC has delivered clock corrections for epoTime or a later
    … …  
    598657    }
    599658
     659    // Check regarding current time (before the epoch is remembered: a bogus
     660    // future epoch would mark the AC as delivered for hours, the combination
     661    // would no longer wait for it)
     662    // ----------------------------
     663    QString acOfClk;
     664    QListIterator<cmbAC*> itClkAC(_ACs);
     665    while (itClkAC.hasNext()) {
     666      cmbAC* AC = itClkAC.next();
     667      if (AC->mountPoint == QString(newClk._staID.c_str())) {
     668        acOfClk = AC->name;
     669        break;
     670      }
     671    }
     672    if (acOfClk.isEmpty() ||
     673        epochOutOfRange(acOfClk, newClk._time, CLK_MAX_EPOCH_OFFSET, "clock")) { // future or very old data sets
     674      continue;
     675    }
     676
    600677    // Remember the latest correction epoch of each AC (whether or not the
    601678    // correction is used), to know when an AC has finished an epoch
    602679    // --------------------------------------------------------------------
    603     QListIterator<cmbAC*> itAC(_ACs);
    604     while (itAC.hasNext()) {
    605       cmbAC* AC = itAC.next();
    606       if (AC->mountPoint == QString(newClk._staID.c_str())) {
    607         bncTime& acLast = _acLastClkTime[AC->name];
    608         if (!acLast.valid() || newClk._time > acLast) {
    609           acLast = newClk._time;
    610         }
    611         break;
    612       }
     680    bncTime& acLast = _acLastClkTime[acOfClk];
     681    if (!acLast.valid() || newClk._time > acLast) {
     682      acLast = newClk._time;
    613683    }
    614684
    … …  
    649719      }
    650720      continue;
    651     }
    652 
    653     // Check regarding current time
    654     // ----------------------------
    655     if (BNC_CORE->mode() != t_bncCore::batchPostProcessing) {
    656       if (fabs(currentTime - newClk._time) > 60.0) { // future or very old data sets
    657   #ifdef BNC_DEBUG_CMB
    658         emit newLogRecord(t_logRecord::debugMessage("cmb", "bncComb: future or very old data sets: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
    659             QString(" %1 ").arg(newClk._time.timestr().c_str()).toLatin1() + "vs. current time" +
    660             QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1()), true);
    661   #endif
    662         continue;
    663       }
    664721    }
    665722
  • trunk/BNC/src/combination/bnccomb.h

    r11218 r11220  
    257257  QMap<QString, bncTime>                     _acLastClkTime; // latest correction epoch per AC
    258258  QMap<QString, bncTime>                     _refBiasWarned; // last warning per AC and system
     259  QMap<QString, bncTime>                     _badEpochWarned; // last bad-epoch warning per AC (current time)
    259260  QMap<char, bncTime>                        _singleACWarned; // last 'fewer than 2 ACs' message per system
    260261  QMap<QString, QMap<QString, double> >      _acBiasIF;       // latest B_IF of the reference signals per AC and satellite
    … …  
    312313                   const QVector<t_datumObs>& datumObs, const ColumnVector& xx);
    313314  bool allACsDelivered(const bncTime& epoTime) const;
     315  bool epochOutOfRange(const QString& acName, const bncTime& epoTime, double maxOffset, const char* type,
     316                       bool pastOk = false);
    314317  bncTime                                    _resTime;
    315318  cmbCorr*                                   _newCorr;
  • trunk/BNC/src/ssrQc.cpp

    r11218 r11220  
    508508// the report interval (no reports for hours) and distort all statistics
    509509////////////////////////////////////////////////////////////////////////////
    510 bool t_ssrQc::badEpoch(const string& staID, const bncTime& time) {
    511   if (fabs(currentTime() - time) <= MAX_EPOCH_OFFSET) {
     510bool t_ssrQc::badEpoch(const string& staID, const bncTime& time, bool pastOk) {
     511  double offset = time - currentTime();
     512  if (fabs(offset) <= MAX_EPOCH_OFFSET || (pastOk && offset < 0.0)) {
    512513    return false;
    513514  }
    … …  
    585586  QMutexLocker locker(&_mutex);
    586587  for (const t_satCodeBias& bias : codeBiases) {
    587     if (badEpoch(bias._staID, bias._time)) continue;
     588    if (badEpoch(bias._staID, bias._time, true)) continue;
    588589    bool sel = selected(bias._staID);
    589590    if (_excluded.contains(QString::fromStdString(bias._staID)) && bias._staID != _reference.toStdString()) continue;
    … …  
    635636  QMutexLocker locker(&_mutex);
    636637  for (const t_satPhaseBias& bias : phaseBiases) {
    637     if (badEpoch(bias._staID, bias._time)) continue;
     638    if (badEpoch(bias._staID, bias._time, true)) continue;
    638639    QString staID = QString::fromStdString(bias._staID);
    639640    QString prn   = QString::fromStdString(bias._prn.toString());
  • trunk/BNC/src/ssrQc.h

    r11218 r11220  
    114114  // Corrections with an epoch time far from the reception time (erroneously
    115115  // encoded): not used, counted per stream
    116   bool   badEpoch(const std::string& staID, const bncTime& time);
     116  // pastOk: biases, whose epoch may legitimately be old (e.g. Galileo HAS)
     117  bool   badEpoch(const std::string& staID, const bncTime& time, bool pastOk = false);
    117118  QMap<QString, unsigned> _badEpochs;
    118119
Note: See TracChangeset for help on using the changeset viewer.