Changeset 709 in ntrip for trunk/BNC/bncgetthread.cpp


Ignore:
Timestamp:
Mar 7, 2008, 5:56:07 PM (16 years ago)
Author:
weber
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncgetthread.cpp

    r704 r709  
    117117  _adviseScript = settings.value("adviseScript").toString();
    118118  expandEnvVar(_adviseScript);
     119
     120  // Latency interval/average
     121  // ------------------------
     122  _latIntr = 86400;
     123  if ( settings.value("latIntr").toString().isEmpty() ) { _latIntr = 0; }
     124  if ( settings.value("latIntr").toString().indexOf("1 min") != -1 ) { _latIntr = 60; }
     125  if ( settings.value("latIntr").toString().indexOf("5 min") != -1 ) { _latIntr = 300; }
     126  if ( settings.value("latIntr").toString().indexOf("15 min") != -1 ) { _latIntr = 900; }
     127  if ( settings.value("latIntr").toString().indexOf("1 hour") != -1 ) { _latIntr = 3600; }
     128  if ( settings.value("latIntr").toString().indexOf("6 hours") != -1 ) { _latIntr = 21600; }
     129  if ( settings.value("latIntr").toString().indexOf("1 day") != -1 ) { _latIntr = 86400; }
    119130
    120131  // RINEX writer
     
    377388void bncGetThread::run() {
    378389
     390  const double maxDt = 600.0;  // Check observation epoch
    379391  bool wrongEpoch = false;
    380392  bool decode = true;
     
    382394  int secSucc = 0;
    383395  int secFail = 0;
    384   int initPause = 30;
     396  int initPause = 30;  // Initial pause for corrupted streams
    385397  int currPause = 0;
    386398  bool begCorrupt = false;
    387399  bool endCorrupt = false;
     400  int oldSec= 0;
     401  int newSec = 0;
     402  int numLat = 0;
     403  double sumLat = 0.;
     404  double minLat = maxDt;
     405  double maxLat = -maxDt;
     406  double curLat = 0.;
     407  double leapsec = 14.;  // Leap second for latency estimation
    388408
    389409  _decodeTime = QDateTime::currentDateTime();
     
    539559         
    540560          const double secPerWeek = 7.0 * 24.0 * 3600.0;
    541           const double maxDt      = 600.0;           
    542561
    543562          if (week < obs->_o.GPSWeek) {
     
    560579          else {
    561580            wrongEpoch = false;
     581
     582            // Latency
     583            // -------
     584            if (_latIntr>0) {
     585              newSec = static_cast<int>(sec);
     586              if (newSec != oldSec) {
     587                if (newSec % _latIntr < oldSec % _latIntr) {
     588                  if (numLat>0) {
     589                    emit( newMessage(QString("%1: %2 sec mean latency, min %3, max %4")
     590                      .arg(_staID.data())
     591                      .arg(int(sumLat/numLat*100)/100.)
     592                      .arg(int(minLat*100)/100.)
     593                      .arg(int(maxLat*100)/100.)
     594                      .toAscii()) );
     595                  }
     596                  sumLat = 0.;
     597                  numLat = 0;
     598                  minLat = maxDt;
     599                  maxLat = -maxDt;
     600                }
     601                curLat = sec - obs->_o.GPSWeeks + leapsec;
     602                sumLat += curLat;
     603                if (curLat < minLat) minLat = curLat;
     604                if (curLat >= maxLat) maxLat = curLat;
     605                numLat += 1;
     606                oldSec = newSec;
     607              }
     608            }
    562609          }
    563610
Note: See TracChangeset for help on using the changeset viewer.