Changeset 11221 in ntrip for trunk/BNC/src/pppRun.cpp


Ignore:
Timestamp:
Nov 23, 2026, 11:38:54 PM (less than one hour ago)
Author:
stuerze
Message:

some bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/pppRun.cpp

    r11196 r11221  
    500500
    501501//
     502// Real-time input (incl. raw file replay): true if the correction epoch is
     503// more than MAX_EPOCH_OFFSET from the current time, e.g. an erroneously
     504// encoded GLONASS epoch hours ahead (not used, as in the combination and the
     505// SSR QC). It would make the satellites unusable (age check of the
     506// corrections), discard observation epochs (correction wait time) and
     507// extrapolate the yaw angle over hours until the next correction. Biases
     508// (pastOk) are only rejected for a future epoch: their epoch may legitimately
     509// be hours old (Galileo HAS). A warning at most once per hour.
     510////////////////////////////////////////////////////////////////////////////
     511bool t_pppRun::badEpoch(const bncTime& epoTime, const string& staID,
     512                        const char* type, bool pastOk) {
     513  const double MAX_EPOCH_OFFSET = 900.0; // [s]
     514  if (!_opt->_realTime) {
     515    return false;
     516  }
     517  int    currentWeek = 0;
     518  double currentSec  = 0.0;
     519  currentGPSWeeks(currentWeek, currentSec);
     520  bncTime currentTime(currentWeek, currentSec);
     521  double offset = epoTime - currentTime;
     522  if (fabs(offset) <= MAX_EPOCH_OFFSET || (pastOk && offset < 0.0)) {
     523    return false;
     524  }
     525  if (!_badEpochWarned.valid() || currentTime - _badEpochWarned >= 3600.0) {
     526    _badEpochWarned = currentTime;
     527    emit newLogRecord(t_logRecord::message(t_logRecord::warning, QByteArray(_opt->_roverName.c_str()) + ": PPP: " +
     528                    QByteArray(staID.c_str()) + " " + type + " correction epoch " +
     529                    QByteArray(epoTime.datestr().c_str()) + " " + epoTime.timestr().c_str() +
     530                    QString(" is %1 s from the current time, not used").arg(offset, 0, 'f', 0).toLatin1() +
     531                    " (further ones not reported within the next hour)"), true);
     532  }
     533  return true;
     534}
     535
     536//
    502537////////////////////////////////////////////////////////////////////////////
    503538void t_pppRun::slotNewTec(t_vTec vTec) {
    … …  
    521556    }
    522557  }
     558  if (badEpoch(vTec._time, vTec._staID, "VTEC")) {
     559    return;
     560  }
    523561  _pppClient->putTec(&vTec);
    524562}
    … …  
    553591  vector<t_orbCorr*> corrections;
    554592  for (int ii = 0; ii < orbCorr.size(); ii++) {
    555     corrections.push_back(new t_orbCorr(orbCorr[ii]));
     593    if (!badEpoch(orbCorr[ii]._time, orbCorr[ii]._staID, "orbit")) {
     594      corrections.push_back(new t_orbCorr(orbCorr[ii]));
     595    }
     596  }
     597  if (corrections.empty()) {
     598    return;
    556599  }
    557600
    … …  
    577620  vector<t_clkCorr*> corrections;
    578621  for (int ii = 0; ii < clkCorr.size(); ii++) {
    579     corrections.push_back(new t_clkCorr(clkCorr[ii]));
    580     _lastClkCorrTime = clkCorr[ii]._time;
     622    if (!badEpoch(clkCorr[ii]._time, clkCorr[ii]._staID, "clock")) {
     623      corrections.push_back(new t_clkCorr(clkCorr[ii]));
     624      _lastClkCorrTime = clkCorr[ii]._time;
     625    }
     626  }
     627  if (corrections.empty()) {
     628    return;
    581629  }
    582630  _pppClient->putClkCorrections(corrections);
    … …  
    611659  vector<t_satCodeBias*> biases;
    612660  for (int ii = 0; ii < codeBiases.size(); ii++) {
    613     biases.push_back(new t_satCodeBias(codeBiases[ii]));
     661    if (!badEpoch(codeBiases[ii]._time, codeBiases[ii]._staID, "code bias", true)) {
     662      biases.push_back(new t_satCodeBias(codeBiases[ii]));
     663    }
     664  }
     665  if (biases.empty()) {
     666    return;
    614667  }
    615668
    … …  
    672725  vector<t_satPhaseBias*> biases;
    673726  for (int ii = 0; ii < phaseBiases.size(); ii++) {
    674     biases.push_back(new t_satPhaseBias(phaseBiases[ii]));
     727    if (!badEpoch(phaseBiases[ii]._time, phaseBiases[ii]._staID, "phase bias", true)) {
     728      biases.push_back(new t_satPhaseBias(phaseBiases[ii]));
     729    }
     730  }
     731  if (biases.empty()) {
     732    return;
    675733  }
    676734
Note: See TracChangeset for help on using the changeset viewer.