Changeset 1562 in ntrip for trunk/BNC/RTCM3


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

* empty log message *

Location:
trunk/BNC/RTCM3
Files:
3 edited

Legend:

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