Changeset 1562 in ntrip


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

* empty log message *

Location:
trunk/BNC
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM/GPSDecoder.h

    r1269 r1562  
    136136  }
    137137
     138  virtual QList<int>* epochList() {return 0;}
     139
    138140  struct t_antInfo {
    139141    enum t_type { ARP, APC };
     
    157159  QList<p_obs>     _obsList;
    158160  QList<int>       _typeList;  // RTCM   message types
    159   QList<int>       _epochList; // Broadcast corrections
    160161  QStringList      _antType;   // RTCM   antenna descriptor
    161162  QList<t_antInfo> _antList;   // RTCM   antenna XYZ
  • trunk/BNC/RTCM3/RTCM3Decoder.cpp

    r1535 r1562  
    4444
    4545#include "RTCM3Decoder.h"
    46 #include "RTCM3coDecoder.h"
    4746#include "bncconst.h"
    4847#include "bncapp.h"
     
    6867  _checkMountPoint = settings.value("messTypes").toString();
    6968  _staID = staID;
    70 
    71   // Latency
    72   _numLat = 0;
    73   _minLat = 1000.;
    74   _maxLat = -1000.;
    75   _sumLat = 0.;
    76   _sumLatQ = 0.;
    77   _followSec = false;
    78   _meanDiff = 0.;
    79   _diffSecGPS= 0.;
    80   _numGaps = 0;
    81   _oldSecGPS = 0.;
    82   _newSecGPS = 0.;
    83   _curLat = 0.;
    84   _perfIntr = 86400;
    85   if ( settings.value("perfIntr").toString().isEmpty() ) { _perfIntr = 0; }
    86   if ( settings.value("perfIntr").toString().indexOf("1 min") != -1 ) { _perfIntr = 60; }
    87   if ( settings.value("perfIntr").toString().indexOf("5 min") != -1 ) { _perfIntr = 300; }
    88   if ( settings.value("perfIntr").toString().indexOf("15 min") != -1 ) { _perfIntr = 900; }
    89   if ( settings.value("perfIntr").toString().indexOf("1 hour") != -1 ) { _perfIntr = 3600; }
    90   if ( settings.value("perfIntr").toString().indexOf("6 hours") != -1 ) { _perfIntr = 21600; }
    91   if ( settings.value("perfIntr").toString().indexOf("1 day") != -1 ) { _perfIntr = 86400; }
    9269
    9370  // Ensure, that the Decoder uses the "old" convention for the data structure for Rinex2. Perlt
     
    133110    if ( _coDecoder->Decode(buffer, bufLen, errmsg) == success ) {
    134111      decoded = true;
    135 
    136       // Latency
    137       // -------
    138       if (_perfIntr>0) {
    139         if (0<_coDecoder->_epochList.size()) {
    140           for (int ii=0;ii<_coDecoder->_epochList.size();ii++) {
    141             int week;
    142             double sec;
    143             _newSecGPS = _coDecoder->_epochList[ii];
    144             currentGPSWeeks(week, sec);
    145             double dt = fabs(sec - _newSecGPS);
    146             const double secPerWeek = 7.0 * 24.0 * 3600.0;
    147             if (dt > 0.5 * secPerWeek) {
    148               if (sec > _newSecGPS) {
    149                 sec  -= secPerWeek;
    150               } else {
    151                 sec  += secPerWeek;
    152               }
    153             }
    154             if (_newSecGPS != _oldSecGPS) {
    155               if (int(_newSecGPS) % _perfIntr < int(_oldSecGPS) % _perfIntr) {
    156                 if (_numLat>0) {
    157                   QString late;
    158                   if (_meanDiff>0.) {
    159                     late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps")
    160                     .arg(int(_sumLat/_numLat*100)/100.)
    161                     .arg(int(_minLat*100)/100.)
    162                     .arg(int(_maxLat*100)/100.)
    163                     .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
    164                     .arg(_numLat)
    165                     .arg(_numGaps);
    166                     emit(newMessage(QString(_staID + late ).toAscii(), true) );
    167                   } else {
    168                   late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs")
    169                     .arg(int(_sumLat/_numLat*100)/100.)
    170                     .arg(int(_minLat*100)/100.)
    171                     .arg(int(_maxLat*100)/100.)
    172                     .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
    173                     .arg(_numLat);
    174                   emit(newMessage(QString(_staID + late ).toAscii(), true) );
    175                   }
    176                 }
    177                 _meanDiff = int(_diffSecGPS)/_numLat;
    178                 _diffSecGPS = 0.;
    179                 _numGaps = 0;
    180                 _sumLat = 0.;
    181                 _sumLatQ = 0.;
    182                 _numLat = 0;
    183                 _minLat = 1000.;
    184                 _maxLat = -1000.;
    185               }
    186               if (_followSec) {
    187                 _diffSecGPS += _newSecGPS - _oldSecGPS;
    188                 if (_meanDiff>0.) {
    189                   if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
    190                     _numGaps += 1;
    191                   }
    192                 }
    193               }
    194               _curLat = sec - _newSecGPS;
    195               _sumLat += _curLat;
    196               _sumLatQ += _curLat * _curLat;
    197               if (_curLat < _minLat) {_minLat = _curLat;}
    198               if (_curLat >= _maxLat) {_maxLat = _curLat;}
    199               _numLat += 1;
    200               _oldSecGPS = _newSecGPS;
    201               _followSec = true;
    202             }
    203           }
    204         }
    205       }
    206112      if (_mode == unknown) {
    207113        _mode = corrections;
    208114      }
    209115    }
    210     _coDecoder->_epochList.clear();
    211116  }
    212117
     
    360265            decoded = true;
    361266            gpsephemeris* ep = new gpsephemeris(_Parser.ephemerisGPS);
    362 
    363 #ifdef DEBUG_RTCM2_2021
    364             QString msg = QString("%1: got eph %2 IODC %3 GPSweek %4 TOC %5 TOE %6")
    365               .arg(_staID)
    366               .arg(ep->satellite, 2)
    367               .arg(ep->IODC,      4)
    368               .arg(ep->GPSweek,   4)
    369               .arg(ep->TOC,       6)
    370               .arg(ep->TOE,       6);
    371             emit newMessage(msg.toAscii(), false);
    372 #endif
    373 
    374267            emit newGPSEph(ep);
    375268          }
  • trunk/BNC/RTCM3/RTCM3Decoder.h

    r1299 r1562  
    2828#include <QtCore>
    2929#include "../RTCM/GPSDecoder.h"
     30#include "../RTCM/GPSDecoder.h"
     31#include "RTCM3coDecoder.h"
    3032
    3133extern "C" {
    3234#include "rtcm3torinex.h"
    3335}
    34 
    35 class RTCM3coDecoder;
    3636
    3737class RTCM3Decoder : public QObject, public GPSDecoder {
     
    4141  virtual ~RTCM3Decoder();
    4242  virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
     43  virtual QList<int>* epochList() {
     44    return (_coDecoder ? &(_coDecoder->_epochList) : 0);
     45  }
    4346 signals:
    4447  void newMessage(QByteArray msg,bool showOnScreen);
     
    5356  RTCM3coDecoder*        _coDecoder;
    5457  t_mode                 _mode;
    55   int _perfIntr;
    56   int _numLat;
    57   int _numGaps;
    58   bool _followSec;
    59   double _curLat;
    60   double _sumLat;
    61   double _sumLatQ;
    62   double _minLat;
    63   double _maxLat;
    64   double _newSecGPS;
    65   double _oldSecGPS;
    66   double _diffSecGPS;
    67   double _meanDiff;
    68 } ;
     58};
    6959
    7060#endif
  • trunk/BNC/RTCM3/RTCM3coDecoder.h

    r1222 r1562  
    4343  virtual ~RTCM3coDecoder();
    4444  virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
     45  virtual QList<int>* epochList() {return &_epochList;}
     46  QList<int>     _epochList;
    4547
    4648 signals:
     
    5153  void printLine(const QString& line, long coTime);
    5254
    53   int                 _port;
    54   std::ofstream*      _out;
    55   QString             _staID;
    56   QString             _fileNameSkl;
    57   QString             _fileName;
    58   QByteArray          _buffer;
    59   ClockOrbit          _co;
    60   Bias                _bias;
     55  int            _port;
     56  std::ofstream* _out;
     57  QString        _staID;
     58  QString        _fileNameSkl;
     59  QString        _fileName;
     60  QByteArray     _buffer;
     61  ClockOrbit     _co;
     62  Bias           _bias;
    6163};
    6264
  • trunk/BNC/bncgetthread.cpp

    r1561 r1562  
    371371      // -----------
    372372      vector<string> errmsg;
    373       _decoder->Decode(data.data(), data.size(), errmsg);
     373      t_irc irc = _decoder->Decode(data.data(), data.size(), errmsg);
    374374
    375375      // Perform various scans and checks
    376376      // --------------------------------
     377      _latencyChecker->checkOutage(irc == success);
     378      _latencyChecker->checkObsLatency(_decoder->_obsList);
     379      _latencyChecker->checkCorrLatency(_decoder->epochList());
    377380      scanRTCM();           
    378       _latencyChecker->check(_decoder->_obsList);
    379381
    380382      // Loop over all observations (observations output)
  • 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
  • trunk/BNC/latencychecker.h

    r1561 r1562  
    3636  latencyChecker(QByteArray staID);
    3737  ~latencyChecker();
    38   void check(const QList<p_obs>& obsList);
     38  void checkOutage(bool decoded);
     39  void checkObsLatency(const QList<p_obs>& obsList);
     40  void checkCorrLatency(QList<int>* epochList);
    3941
    4042 signals:
Note: See TracChangeset for help on using the changeset viewer.