Changeset 11220 in ntrip for trunk/BNC/src/combination


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

combination improved

Location:
trunk/BNC/src/combination
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.