Changeset 1562 in ntrip for trunk/BNC/latencychecker.cpp


Ignore:
Timestamp:
Feb 2, 2009, 10:42:47 PM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/latencychecker.cpp

    r1561 r1562  
    157157//////////////////////////////////////////////////////////////////////////////
    158158latencyChecker::~latencyChecker() {
    159 
    160159}
    161160
    162 // Perform latency checks
     161// Perform check for outages
    163162//////////////////////////////////////////////////////////////////////////////
    164 void latencyChecker::check(const QList<p_obs>& obsList) {
     163void latencyChecker::checkOutage(bool decoded) {
    165164
    166165  // Check - once per inspect segment
    167166  // --------------------------------
    168   if (obsList.size() > 0) {
     167  if (decoded) {
    169168
    170169    _decodeTime = QDateTime::currentDateTime();
     
    244243    }
    245244  }
    246      
    247   // Latency and completeness
    248   // ------------------------
     245}     
     246
     247// Perform latency checks (observations)
     248//////////////////////////////////////////////////////////////////////////////
     249void latencyChecker::checkObsLatency(const QList<p_obs>& obsList) {
     250
    249251  if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
    250252    if (_perfIntr > 0 ) {
     
    317319          if (_curLat < _minLat) {
    318320            _minLat = _curLat;
    319           }
     321          }
    320322          if (_curLat >= _maxLat) {
    321323            _maxLat = _curLat;
    322           }
     324          }
    323325          _numLat += 1;
    324326          _oldSecGPS = _newSecGPS;
     
    328330    }
    329331  }
     332}
     333
     334// Perform latency checks (corrections)
     335//////////////////////////////////////////////////////////////////////////////
     336void latencyChecker::checkCorrLatency(QList<int>* epochList) {
     337
     338  if (epochList == 0) {
     339    return;
     340  }
     341
     342  if (_perfIntr > 0) {
     343    if (0 < epochList->size()) {
     344      for (int ii = 0; ii < epochList->size(); ii++) {
     345        int week;
     346        double sec;
     347        _newSecGPS = epochList->at(ii);
     348        currentGPSWeeks(week, sec);
     349        double dt = fabs(sec - _newSecGPS);
     350        const double secPerWeek = 7.0 * 24.0 * 3600.0;
     351        if (dt > 0.5 * secPerWeek) {
     352          if (sec > _newSecGPS) {
     353            sec  -= secPerWeek;
     354          } else {
     355            sec  += secPerWeek;
     356          }
     357        }
     358        if (_newSecGPS != _oldSecGPS) {
     359          if (int(_newSecGPS) % _perfIntr < int(_oldSecGPS) % _perfIntr) {
     360            if (_numLat>0) {
     361              QString late;
     362              if (_meanDiff>0.) {
     363                late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps")
     364                .arg(int(_sumLat/_numLat*100)/100.)
     365                .arg(int(_minLat*100)/100.)
     366                .arg(int(_maxLat*100)/100.)
     367                .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
     368                .arg(_numLat)
     369                .arg(_numGaps);
     370                emit(newMessage(QString(_staID + late ).toAscii(), true) );
     371              }
     372              else {
     373                late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs")
     374                .arg(int(_sumLat/_numLat*100)/100.)
     375                .arg(int(_minLat*100)/100.)
     376                .arg(int(_maxLat*100)/100.)
     377                .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
     378                .arg(_numLat);
     379                emit(newMessage(QString(_staID + late ).toAscii(), true) );
     380              }
     381            }
     382            _meanDiff = int(_diffSecGPS)/_numLat;
     383            _diffSecGPS = 0;
     384            _numGaps    = 0;
     385            _sumLat     = 0.0;
     386            _sumLatQ    = 0.0;
     387            _numLat     = 0;
     388            _minLat     = 1000.;
     389            _maxLat     = -1000.;
     390          }
     391          if (_followSec) {
     392            _diffSecGPS += _newSecGPS - _oldSecGPS;
     393            if (_meanDiff>0.) {
     394              if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
     395                _numGaps += 1;
     396              }
     397            }
     398          }
     399          _curLat   = sec - _newSecGPS;
     400          _sumLat  += _curLat;
     401          _sumLatQ += _curLat * _curLat;
     402          if (_curLat < _minLat) {
     403            _minLat = _curLat;
     404          }
     405          if (_curLat >= _maxLat) {
     406            _maxLat = _curLat;
     407          }
     408          _numLat += 1;
     409          _oldSecGPS = _newSecGPS;
     410          _followSec = true;
     411        }
     412      }
     413    }
     414  }
     415 
     416  epochList->clear();
    330417}
    331418
Note: See TracChangeset for help on using the changeset viewer.