Changeset 5883 in ntrip


Ignore:
Timestamp:
Aug 8, 2014, 3:51:27 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
2 deleted
7 edited
2 moved

Legend:

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

    r5879 r5883  
    2828 * -------------------------------------------------------------------------
    2929 *
    30  * Class:      t_pppRunRealTime
     30 * Class:      t_pppRun
    3131 *
    3232 * Purpose:    Single Real-Time PPP Client
     
    4646#include <map>
    4747
    48 #include "pppRunRealTime.h"
     48#include "pppRun.h"
    4949#include "bnccore.h"
    5050#include "bncephuser.h"
     51#include "rinex/rnxobsfile.h"
     52#include "rinex/rnxnavfile.h"
     53#include "rinex/corrfile.h"
    5154
    5255using namespace BNC_PPP;
     
    5558// Constructor
    5659////////////////////////////////////////////////////////////////////////////
    57 t_pppRunRealTime::t_pppRunRealTime(const t_pppOptions* opt) {
     60t_pppRun::t_pppRun(const t_pppOptions* opt) {
     61
    5862  _opt = opt;
     63
    5964  connect(this, SIGNAL(newMessage(QByteArray,bool)),
    6065          BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     66
     67  connect(this, SIGNAL(newPosition(bncTime, QVector<double>)),
     68          BNC_CORE, SIGNAL(newPosition(bncTime, QVector<double>)));
     69
     70  for (unsigned iPrn = 0; iPrn <= t_prn::MAXPRN; iPrn++) {
     71    _lastOrbCorrIOD[iPrn]   = -1;
     72    _lastClkCorrValue[iPrn] = 0.0;
     73  }
     74
     75  _pppClient = new t_pppClient(_opt);
     76
    6177  if (_opt->_realTime) {
    6278    connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_obs>)),
     
    7490    connect(BNC_CORE, SIGNAL(newCorrections(QStringList)),
    7591            this, SLOT(slotNewCorrections(QStringList)));
    76 
    77     connect(this, SIGNAL(newPosition(bncTime, QVector<double>)),
    78             BNC_CORE, SIGNAL(newPosition(bncTime, QVector<double>)));
    79 
    80     for (unsigned iPrn = 0; iPrn <= t_prn::MAXPRN; iPrn++) {
    81       _lastOrbCorrIOD[iPrn]   = -1;
    82       _lastClkCorrValue[iPrn] = 0.0;
    83     }
    84 
    85     _pppClient = new t_pppClient(_opt);
    8692  }
    8793  else {
    88     throw t_except("t_pppRunRealTime: post-processing not yet implemented");
     94    processFiles();
    8995  }
    9096}
     
    9298// Destructor
    9399////////////////////////////////////////////////////////////////////////////
    94 t_pppRunRealTime::~t_pppRunRealTime() {
     100t_pppRun::~t_pppRun() {
    95101}
    96102
    97103//
    98104////////////////////////////////////////////////////////////////////////////
    99 void t_pppRunRealTime::slotNewEphGPS(gpsephemeris gpseph) {
     105void t_pppRun::slotNewEphGPS(gpsephemeris gpseph) {
    100106  QMutexLocker locker(&_mutex);
    101107  t_ephGPS eph;
     
    106112//
    107113////////////////////////////////////////////////////////////////////////////
    108 void t_pppRunRealTime::slotNewEphGlonass(glonassephemeris gloeph) {
     114void t_pppRun::slotNewEphGlonass(glonassephemeris gloeph) {
    109115  QMutexLocker locker(&_mutex);
    110116  t_ephGlo eph;
     
    115121//
    116122////////////////////////////////////////////////////////////////////////////
    117 void t_pppRunRealTime::slotNewEphGalileo(galileoephemeris galeph) {
     123void t_pppRun::slotNewEphGalileo(galileoephemeris galeph) {
    118124  QMutexLocker locker(&_mutex);
    119125  t_ephGal eph;
     
    124130//
    125131////////////////////////////////////////////////////////////////////////////
    126 void t_pppRunRealTime::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
     132void t_pppRun::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
    127133  QMutexLocker locker(&_mutex);
    128134
     
    222228//
    223229////////////////////////////////////////////////////////////////////////////
    224 void t_pppRunRealTime::slotNewCorrections(QStringList corrList) {
     230void t_pppRun::slotNewCorrections(QStringList corrList) {
    225231  QMutexLocker locker(&_mutex);
    226232
     
    330336  }
    331337}
     338
     339
     340//
     341////////////////////////////////////////////////////////////////////////////
     342void t_pppRun::processFiles() {
     343
     344  try {
     345    _rnxObsFile = new t_rnxObsFile(_opt->obsFileName, t_rnxObsFile::input);
     346  }
     347  catch (...) {
     348    delete _rnxObsFile; _rnxObsFile = 0;
     349    emit finished();
     350    return;
     351  }
     352
     353  _rnxNavFile = new t_rnxNavFile(_opt->navFileName, t_rnxNavFile::input);
     354  _pppClient  = new bncPPPclient("POST", _opt, false);
     355
     356  if (!_opt->corrFileName.isEmpty()) {
     357    _corrFile = new t_corrFile(_opt->corrFileName);
     358    connect(_corrFile, SIGNAL(newCorrections(QStringList)),
     359            _pppClient, SLOT(slotNewCorrections(QStringList)));
     360  }
     361
     362  // Read/Process Observations
     363  // -------------------------
     364  int   nEpo = 0;
     365  const t_rnxObsFile::t_rnxEpo* epo = 0;
     366  while ( (epo = _rnxObsFile->nextEpoch()) != 0 ) {
     367    ++nEpo;
     368
     369    if (_maxSpeed != 0) {
     370      QMutexLocker locker(&_mutex);
     371      if (_speed < _maxSpeed) {
     372        double sleepTime = 0.02 * _maxSpeed / _speed;
     373        msleep(sleepTime*1.e3);
     374      }
     375    }
     376
     377    // Get Corrections
     378    // ---------------
     379    if (_corrFile) {
     380      _corrFile->syncRead(epo->tt);
     381    }
     382
     383    // Get Ephemerides
     384    // ----------------
     385    t_eph* eph = 0;
     386    const QMap<QString, int>* corrIODs = _corrFile ? &_corrFile->corrIODs() : 0;
     387    while ( (eph = _rnxNavFile->getNextEph(epo->tt, corrIODs)) != 0 ) {
     388      if (_pppClient->putNewEph(eph) != success) {
     389        delete eph; eph = 0;
     390      }
     391    }
     392
     393    for (unsigned iObs = 0; iObs < epo->rnxSat.size(); iObs++) {
     394
     395      if (_isToBeDeleted) {
     396        QThread::exit(0);
     397        return;
     398      }
     399
     400      const t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iObs];
     401   
     402      t_obs obs;
     403      t_rnxObsFile::setObsFromRnx(_rnxObsFile, epo, rnxSat, obs);
     404
     405      _pppClient->putNewObs(obs);
     406    }
     407    if (nEpo % 10 == 0) {
     408      emit progress(nEpo);
     409    }
     410  }
     411
     412  if (BNC_CORE->mode() != t_bncCore::interactive) {
     413    qApp->exit(0);
     414  }
     415  else {
     416    emit finished();
     417    deleteLater();
     418  }
     419}
     420
     421// 
     422////////////////////////////////////////////////////////////////////////////
     423void t_pppRun::slotSetSpeed(int speed) {
     424  QMutexLocker locker(&_mutex);
     425  _speed = speed;
     426}
  • trunk/BNC/src/PPP/pppRun.h

    r5879 r5883  
    1 #ifndef PPPRUNREALTIME_H
    2 #define PPPRUNREALTIME_H
     1#ifndef PPPRUN_H
     2#define PPPRUN_H
    33
    44#include <deque>
     
    1010#include "pppClient.h"
    1111
     12class t_rnxObsFile;
     13class t_rnxNavFile;
     14class t_corrFile;
     15
    1216namespace BNC_PPP {
    1317
    14 class t_pppRunRealTime : public QObject {
     18class t_pppRun : public QObject {
    1519 Q_OBJECT
    1620 public:
    17   t_pppRunRealTime(const t_pppOptions* opt);
    18   ~t_pppRunRealTime();
     21  t_pppRun(const t_pppOptions* opt);
     22  ~t_pppRun();
     23
     24  void processFiles();
    1925
    2026 signals:
     
    5056  double                 _lastClkCorrValue[t_prn::MAXPRN+1];
    5157  bncTime                _lastClkCorrTime;
     58
     59  t_rnxObsFile* _rnxObsFile;
     60  t_rnxNavFile* _rnxNavFile;
     61  t_corrFile*   _corrFile;
     62  int           _maxSpeed;
     63  int           _speed;
    5264};
    5365
  • trunk/BNC/src/PPP/pppThread.cpp

    r5860 r5883  
    5656////////////////////////////////////////////////////////////////////////////
    5757t_pppThread::t_pppThread(const t_pppOptions* opt) : QThread(0) {
    58   _opt            = opt;
    59   _pppRunRealTime = 0;
     58  _opt    = opt;
     59  _pppRun = 0;
     60
    6061  connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
    6162
     
    6768////////////////////////////////////////////////////////////////////////////
    6869t_pppThread::~t_pppThread() {
    69   delete _pppRunRealTime;
     70  delete _pppRun;
    7071}
    7172
     
    7475void t_pppThread::run() {
    7576  try {
    76     _pppRunRealTime = new t_pppRunRealTime(_opt);
    77     QThread::exec();
     77    _pppRun = new t_pppRun(_opt);
     78    if (_opt->_realTime) {
     79      QThread::exec();
     80    }
     81    else {
     82      _ppRun->processFiles();
     83    }
    7884  }
    7985  catch (t_except exc) {
    80     _pppRunRealTime = 0;
     86    _pppRun = 0;
    8187    emit newMessage(QByteArray(exc.what().c_str()), true);
    8288  }
  • trunk/BNC/src/PPP/pppThread.h

    r5860 r5883  
    99#include "pppOptions.h"
    1010#include "pppClient.h"
    11 #include "pppRunRealTime.h"
     11#include "pppRun.h"
    1212
    1313namespace BNC_PPP {
     
    2525 private:
    2626  const t_pppOptions* _opt;
    27   t_pppRunRealTime*   _pppRunRealTime;
     27  t_pppRun*           _pppRun;
    2828};
    2929
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r5863 r5883  
    5757
    5858const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
    59 
    60 // Set Observations from RINEX File
    61 ////////////////////////////////////////////////////////////////////////////
    62 void t_reqcAnalyze::setObsFromRnx(const t_rnxObsFile* rnxObsFile,
    63                                   const t_rnxObsFile::t_rnxEpo* epo,
    64                                   const t_rnxObsFile::t_rnxSat& rnxSat,
    65                                   t_obs& obs) {
    66 
    67   strncpy(obs.StatID, rnxObsFile->markerName().toAscii().constData(),
    68           sizeof(obs.StatID));
    69 
    70   obs.satSys   = rnxSat.satSys;
    71   obs.satNum   = rnxSat.satNum;
    72   obs.GPSWeek  = epo->tt.gpsw();
    73   obs.GPSWeeks = epo->tt.gpssec();
    74 
    75   for (int iType = 0; iType < rnxObsFile->nTypes(obs.satSys); iType++) {
    76     QString type = rnxObsFile->obsType(obs.satSys,iType).toAscii();
    77     obs.setMeasdata(type, rnxObsFile->version(), rnxSat.obs[iType]);
    78     if      (type.indexOf("L1") == 0) {
    79       obs.snrL1  = rnxSat.snr[iType];
    80       obs.slipL1 = (rnxSat.lli[iType] & 1);
    81     }
    82     else if (type.indexOf("L2") == 0) {
    83       obs.snrL2  = rnxSat.snr[iType];
    84       obs.slipL2 = (rnxSat.lli[iType] & 1);
    85     }
    86     else if (type.indexOf("L5") == 0) {
    87       obs.snrL5  = rnxSat.snr[iType];
    88       obs.slipL5 = (rnxSat.lli[iType] & 1);
    89     }
    90   }
    91 }
    9259
    9360// Constructor
  • trunk/BNC/src/rinex/reqcanalyze.h

    r5863 r5883  
    169169                   QVector<t_polarPoint*>* dataSNR2);
    170170
    171   void setObsFromRnx(const t_rnxObsFile* rnxObsFile,
    172                      const t_rnxObsFile::t_rnxEpo* epo,
    173                     const t_rnxObsFile::t_rnxSat& rnxSat,
    174                     t_obs& obs);
    175 
    176171  QString                    _logFileName;
    177172  QFile*                     _logFile;
  • trunk/BNC/src/rinex/rnxobsfile.cpp

    r5742 r5883  
    11041104  }
    11051105}
     1106
     1107// Set Observations from RINEX File
     1108////////////////////////////////////////////////////////////////////////////
     1109void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile,
     1110                                 const t_rnxObsFile::t_rnxEpo* epo,
     1111                                 const t_rnxObsFile::t_rnxSat& rnxSat,
     1112                                 t_obs& obs) {
     1113
     1114  strncpy(obs.StatID, rnxObsFile->markerName().toAscii().constData(),
     1115          sizeof(obs.StatID));
     1116
     1117  obs.satSys   = rnxSat.satSys;
     1118  obs.satNum   = rnxSat.satNum;
     1119  obs.GPSWeek  = epo->tt.gpsw();
     1120  obs.GPSWeeks = epo->tt.gpssec();
     1121
     1122  for (int iType = 0; iType < rnxObsFile->nTypes(obs.satSys); iType++) {
     1123    QString type = rnxObsFile->obsType(obs.satSys,iType).toAscii();
     1124    obs.setMeasdata(type, rnxObsFile->version(), rnxSat.obs[iType]);
     1125    if      (type.indexOf("L1") == 0) {
     1126      obs.snrL1  = rnxSat.snr[iType];
     1127      obs.slipL1 = (rnxSat.lli[iType] & 1);
     1128    }
     1129    else if (type.indexOf("L2") == 0) {
     1130      obs.snrL2  = rnxSat.snr[iType];
     1131      obs.slipL2 = (rnxSat.lli[iType] & 1);
     1132    }
     1133    else if (type.indexOf("L5") == 0) {
     1134      obs.snrL5  = rnxSat.snr[iType];
     1135      obs.slipL5 = (rnxSat.lli[iType] & 1);
     1136    }
     1137  }
     1138}
     1139
  • trunk/BNC/src/rinex/rnxobsfile.h

    r5742 r5883  
    3636#include "bnctime.h"
    3737#include "t_prn.h"
     38#include "GPSDecoder.h"
    3839
    3940class t_rnxObsHeader {
     
    144145  QTextStream* stream() {return _stream;}
    145146
     147  static void setObsFromRnx(const t_rnxObsFile* rnxObsFile,
     148                            const t_rnxObsFile::t_rnxEpo* epo,
     149                            const t_rnxObsFile::t_rnxSat& rnxSat,
     150                            t_obs& obs);
     151
    146152 private:
    147153  enum e_trafo {trafoNone, trafo2to3, trafo3to2};
  • trunk/BNC/src/src.pri

    r5874 r5883  
    6262          PPP/pppObsPool.h   PPP/pppStation.h   PPP/pppFilter.h       \
    6363          PPP/pppEphPool.h   PPP/pppModel.h     PPP/pppParlist.h      \
    64           PPP/pppSatObs.h    PPP/pppRunRealTime.h
     64          PPP/pppSatObs.h    PPP/pppRun.h
    6565
    6666HEADERS       += serial/qextserialbase.h serial/qextserialport.h
     
    9494          PPP/pppObsPool.cpp PPP/pppStation.cpp PPP/pppFilter.cpp     \
    9595          PPP/pppEphPool.cpp PPP/pppModel.cpp   PPP/pppParlist.cpp    \
    96           PPP/pppSatObs.cpp  PPP/pppRunRealTime.cpp
     96          PPP/pppSatObs.cpp  PPP/pppRun.cpp
    9797
    9898SOURCES       += serial/qextserialbase.cpp serial/qextserialport.cpp
Note: See TracChangeset for help on using the changeset viewer.