Changeset 3571 in ntrip for branches/BNC_LM


Ignore:
Timestamp:
Dec 25, 2011, 7:27:03 PM (12 years ago)
Author:
mervart
Message:
 
Location:
branches/BNC_LM
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • branches/BNC_LM/GPSS/hassDecoder.cpp

    r3508 r3571  
    1616 * -----------------------------------------------------------------------*/
    1717
     18#include <iostream>
    1819#include "hassDecoder.h"
    1920#include "bnctime.h"
     21#include "bncutils.h"
    2022
    2123using namespace std;
     
    4446  while ( (indexEOL = _buffer.indexOf('\n')) != -1) {
    4547    QByteArray line = _buffer.left(indexEOL-1);
    46     _buffer = _buffer.mid(indexEOL);
     48    _buffer = _buffer.mid(indexEOL+1);
    4749
    48     if (QString(line).split(QRegExp("\\s+")).count() != 11) {
     50    if (QString(line).split(QRegExp("\\s+"), QString::SkipEmptyParts).count() != 11) {
    4951      continue;
    5052    }
     
    5658    int     mjd, IOD;
    5759    double  daySec;
    58     double  deltaX, deltaY, deltaZ, deltaClk;
    59     double  rateDeltaX, rateDeltaY, rateDeltaZ;
     60    ColumnVector dx(3);
     61    ColumnVector dxRate(3);
     62    double clkFull;
     63
    6064    QString prn;
    6165   
    62     in >> mjd >> daySec >> prn >> IOD >> deltaX >> deltaY >> deltaZ
    63        >> deltaClk >> rateDeltaX >> rateDeltaY >> rateDeltaZ;
     66    in >> mjd >> daySec >> prn >> IOD >> dx[0] >> dx[1] >> dx[2] >> clkFull
     67       >> dxRate[0] >> dxRate[1] >> dxRate[2];
    6468
     69    // Correction Time
     70    // ---------------
    6571    bncTime tt;
    6672    tt.setmjd(daySec, mjd);
     
    6975    long coTime = tt.gpsw() * 7*24*3600 + long(floor(_GPSweeks+0.5));
    7076
     77    // Transform Correction
     78    // --------------------
     79    dx     = -dx;
     80    dxRate = -dxRate;
     81
     82    //// beg test
     83    continue;
     84    //// end test
     85    ////  t_eph* eph = 0;
     86    ////  if (_eph.contains(prn)) {
     87    ////    if      (_eph.value(prn)->last && _eph.value(prn)->last->IOD() == IOD) {
     88    ////      eph = _eph.value(prn)->last;
     89    ////    }
     90    ////    else if (_eph.value(prn)->prev && _eph.value(prn)->prev->IOD() == IOD) {
     91    ////      eph = _eph.value(prn)->prev;
     92    ////    }
     93    ////  }
     94    ////  if (!eph) {
     95    ////    continue;
     96    ////  }
     97
     98    ColumnVector xc(4);
     99    ColumnVector vv(3);
     100    ////  eph->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
     101
     102    ColumnVector rao(3);
     103    XYZ_to_RSW(xc.Rows(1,3), vv, dx,     rao);
     104
     105    ColumnVector dotRao(3);
     106    XYZ_to_RSW(xc.Rows(1,3), vv, dxRate, dotRao);
     107
     108    double dClk = clkFull - xc[3] * t_CST::c;
     109
     110    // Print Correction Line
     111    // ---------------------
    71112    QString corrLine;
    72113
    73     int updateInterval =  0;
    74     int messageType = 0;
     114    int updateInterval = 0;
     115    int messageType    = 0;
    75116    if      (prn[0] == 'G') {
    76       messageType = -COTYPE_GPSCOMBINED;
     117      messageType = COTYPE_GPSCOMBINED;
    77118    }
    78119    else if (prn[0] == 'R') {
    79       messageType = -COTYPE_GLONASSCOMBINED;
     120      messageType = COTYPE_GLONASSCOMBINED;
    80121    }
    81122
     
    87128                     messageType, updateInterval, tt.gpsw(), _GPSweeks,
    88129                     prn.toAscii().data(), IOD,
    89                      deltaClk, deltaX, deltaY, deltaZ,
    90                      0.0, rateDeltaX, rateDeltaY, rateDeltaZ, 0.0);
    91    
     130                     dClk, rao[0], rao[1], rao[2],
     131                     0.0, dotRao[0], dotRao[1], dotRao[2], 0.0);
     132
     133    reopen(_fileNameSkl, _fileName, _out);   
    92134    printLine(corrLine, coTime);
    93135  }
  • branches/BNC_LM/RTCM3/ephemeris.cpp

    r3280 r3571  
    395395////////////////////////////////////////////////////////////////////////////
    396396int t_ephGlo::IOD() const {
    397 
    398   bool old = false;
    399 
    400   if (old) { // 5 LSBs of iod are equal to 5 LSBs of tb
    401     unsigned int tb  = int(fmod(_GPSweeks,86400.0)); //sec of day
    402     const int shift = sizeof(tb) * 8 - 5;
    403     unsigned int iod = tb << shift;
    404     return (iod >> shift);
    405   }
    406   else     { 
    407     bncTime tGPS(_GPSweek, _GPSweeks);
    408     int hlpWeek = _GPSweek;
    409     int hlpSec  = int(_GPSweeks);
    410     int hlpMsec = int(_GPSweeks * 1000);
    411     updatetime(&hlpWeek, &hlpSec, hlpMsec, 0);
    412     bncTime tHlp(hlpWeek, hlpSec);
    413     double diffSec = tGPS - tHlp;
    414     bncTime tMoscow = tGPS + diffSec;
    415     return int(tMoscow.daysec() / 900);
    416   }
     397  bncTime tGPS(_GPSweek, _GPSweeks);
     398  bncTime tMoscow = tGPS - _gps_utc + 3 * 3600.0;
     399  return int(tMoscow.daysec() / 900);
    417400}
    418401
  • branches/BNC_LM/bncantex.cpp

    r3295 r3571  
    119119    else if (line.indexOf("END OF ANTENNA") == 60) {
    120120      if (newAntMap) {
     121        if (_maps.contains(newAntMap->antName)) {
     122          delete _maps[newAntMap->antName];
     123        }
    121124        _maps[newAntMap->antName] = newAntMap;
    122125        newAntMap = 0;
     
    163166        if (newFrqMap) {
    164167          if      (line.indexOf("G01") == 3 || line.indexOf("R01") == 3) {
     168            delete newAntMap->frqMapL1;
    165169            newAntMap->frqMapL1 = newFrqMap;
    166170          }
    167171          else if (line.indexOf("G02") == 3 || line.indexOf("R02") == 3) {
     172            delete newAntMap->frqMapL2;
    168173            newAntMap->frqMapL2 = newFrqMap;
    169174          }
  • branches/BNC_LM/bncapp.cpp

    r3371 r3571  
    867867    QByteArray fileName = settings.value("rawOutFile").toByteArray();
    868868    if (!fileName.isEmpty()) {
    869       _rawFile = new bncRawFile(fileName, staID, format, bncRawFile::output);
     869      _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
    870870    }
    871871  }
  • branches/BNC_LM/bnccaster.cpp

    r3341 r3571  
    127127  _epochs = new QMultiMap<long, t_obs>;
    128128
     129  _samplingRate = settings.value("binSampl").toInt();
     130  _waitTime     = settings.value("waitTime").toInt();
    129131  _lastDumpSec  = 0;
    130   _waitTime     = 0;
    131132  _confInterval = -1;
    132133}
     
    262263  qRegisterMetaType<gpsephemeris>("gpsephemeris");
    263264  qRegisterMetaType<glonassephemeris>("glonassephemeris");
     265  qRegisterMetaType<galileoephemeris>("galileoephemeris");
    264266
    265267  connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs)),
     
    271273  connect(getThread, SIGNAL(newNMEAstr(QByteArray)),
    272274          this, SLOT(slotNewNMEAstr(QByteArray)));
    273 
    274   connect(((bncApp*)qApp), SIGNAL(newEphGPS(gpsephemeris)),
    275           getThread, SLOT(slotNewEphGPS(gpsephemeris)));
    276275
    277276  _staIDs.push_back(getThread->staID());
     
    314313  for (long sec = minTime; sec <= maxTime; sec++) {
    315314
    316     bool first = true;
    317315    QList<t_obs> allObs = _epochs->values(sec);
    318316
     
    365363
    366364      _epochs->remove(sec);
    367       first = false;
    368365    }
    369366  }
  • branches/BNC_LM/bncephuser.cpp

    r3508 r3571  
    165165  if (!relevantMessageType(messageType)) {
    166166    return failure;
    167   }
    168 
    169   if (messageType < 0) {
    170     xyzCorr = true;  // correction in xyz instead of rao
    171167  }
    172168
  • branches/BNC_LM/bncephuser.h

    r3508 r3571  
    4444    eph     = 0;
    4545    hrClk   = 0.0;
    46     xyzCorr = false;
    4746  }
    4847  bool ready() {return raoSet && dClkSet;}
    4948
    5049  static bool relevantMessageType(int msgType) {
    51     if (msgType < 0) {
    52       msgType = -msgType;
    53     }
    5450    return ( msgType == COTYPE_GPSCOMBINED     ||
    5551             msgType == COTYPE_GLONASSCOMBINED ||
     
    7672  bool         raoSet;
    7773  bool         dClkSet;
    78   bool         xyzCorr;
    7974  const t_eph* eph;
    8075};
  • branches/BNC_LM/bncgetthread.cpp

    r3509 r3571  
    141141  }
    142142  else {
    143     _rnx = new bncRinex(_staID, _mountPoint, _format, _latitude,
     143    _rnx = new bncRinex(_staID, _mountPoint, _latitude,
    144144                        _longitude, _nmea, _ntripVersion);
    145145  }
     
    491491            _rnx->deepCopy(obs);
    492492          }
    493           _rnx->dumpEpoch(obsTime);
     493          _rnx->dumpEpoch(_format, obsTime);
    494494        }
    495495     
  • branches/BNC_LM/bncmain.cpp

    r3364 r3571  
    6464  bool       GUIenabled  = true;
    6565  QByteArray rawFileName;
    66   QByteArray format;
    67   QByteArray staID;
    6866  QString    confFileName;
    6967
     
    8078        rawFileName = QByteArray(argv[ii+1]);
    8179      }
    82       if (QByteArray(argv[ii]).indexOf("-format") != -1) {
    83         format = QByteArray(argv[ii+1]);
    84       }
    85       if (QByteArray(argv[ii]).indexOf("-mountpoint") != -1) {
    86         staID = QByteArray(argv[ii+1]);
    87       }
    8880    }
    8981  }
     
    9587  QString printHelp = "Usage: bnc --nw\n"
    9688                      "           --conf       <confFileName>\n"
    97                       "           --file       <rawFileName>\n"
    98                       "           --mountpoint <station>\n"
    99                       "           --format     <RTCM_2 | RTCM_3>\n";
     89                      "           --file       <rawFileName>\n";
    10090
    10191  bncApp app(argc, argv, GUIenabled);
     
    162152    else {
    163153      app.setMode(bncApp::batchPostProcessing);
    164 
    165       if ( format.isEmpty() || staID.isEmpty() ) {
    166         cout << printHelp.toAscii().data() << endl;
    167         exit(0);
    168       }
    169 
    170       bncRawFile* rawFile = new bncRawFile(rawFileName, staID, format,
    171                                            bncRawFile::input);
    172 
     154      bncRawFile*   rawFile   = new bncRawFile(rawFileName, "",
     155                                               bncRawFile::input);
    173156      bncGetThread* getThread = new bncGetThread(rawFile);
    174157      caster->addGetThread(getThread, true);
  • branches/BNC_LM/bncmodel.cpp

    r3422 r3571  
    272272    delete _params[iPar-1];
    273273  }
     274  for (int iPar = 1; iPar <= _params_sav.size(); iPar++) {
     275    delete _params_sav[iPar-1];
     276  }
    274277  delete _epoData_sav;
    275278}
     
    477480    bncSettings settings;
    478481   
    479     _time = epoData->tt; // current epoch time
    480    
    481482    _maxSolGap = settings.value("pppMaxSolGap").toDouble();
    482483   
     
    642643
    643644  _log.clear(); 
     645
     646  _time = epoData->tt; // current epoch time
    644647
    645648  if (settings.value("pppSPP").toString() == "PPP") {
  • branches/BNC_LM/bncnetqueryv0.cpp

    r2011 r3571  
    2828bncNetQueryV0::bncNetQueryV0() {
    2929  _socket  = 0;
    30   _timeOut = 20000;
     30  _timeOut = 120000;
    3131}
    3232
  • branches/BNC_LM/bncpppclient.cpp

    r3508 r3571  
    399399////////////////////////////////////////////////////////////////////////////
    400400t_irc bncPPPclient::applyCorr(const bncTime& tt, const t_corr* cc,
    401                              ColumnVector& xc, ColumnVector& vv) {
    402   ColumnVector dx(3);
     401                              ColumnVector& xc, ColumnVector& vv) {
    403402
    404403  double dt = tt - cc->tt;
     
    409408  }
    410409
    411   if (cc->xyzCorr) {
    412     dx = raoHlp;
    413   }
    414   else {
    415     RSW_to_XYZ(xc.Rows(1,3), vv, raoHlp, dx);
    416   }
    417 
     410  ColumnVector dx(3);
     411  RSW_to_XYZ(xc.Rows(1,3), vv, raoHlp, dx);
    418412  xc[0] -= dx[0];
    419413  xc[1] -= dx[1];
  • branches/BNC_LM/bncpppclient.h

    r3408 r3571  
    126126  static t_irc applyCorr(const bncTime& tt, const t_corr* cc, ColumnVector& xc,
    127127                         ColumnVector& vv);
     128  QByteArray staID() const {return _staID;}
    128129
    129130 public slots:
  • branches/BNC_LM/bncrawfile.cpp

    r3327 r3571  
    5151////////////////////////////////////////////////////////////////////////////
    5252bncRawFile::bncRawFile(const QByteArray& fileName, const QByteArray& staID,
    53                        const QByteArray& format, inpOutFlag ioFlg) {
     53                       inpOutFlag ioFlg) {
    5454
    5555  _fileName   = fileName; expandEnvVar(_fileName);
     56  _format     = "unset";
    5657  _staID      = staID;
    57   _format     = format;
    5858  _inpFile    = 0;
    5959  _outFile    = 0;
  • branches/BNC_LM/bncrawfile.h

    r3004 r3571  
    3737
    3838  bncRawFile(const QByteArray& fileName, const QByteArray& staID,
    39              const QByteArray& format, inpOutFlag ioflg);
     39             inpOutFlag ioflg);
    4040
    4141  ~bncRawFile(); 
  • branches/BNC_LM/bncrinex.cpp

    r3344 r3571  
    6666////////////////////////////////////////////////////////////////////////////
    6767bncRinex::bncRinex(const QByteArray& statID, const QUrl& mountPoint,
    68                    const QByteArray& format, const QByteArray& latitude,
    69                    const QByteArray& longitude, const QByteArray& nmea,
    70                    const QByteArray& ntripVersion) {
     68                   const QByteArray& latitude, const QByteArray& longitude,
     69                   const QByteArray& nmea, const QByteArray& ntripVersion) {
    7170
    7271  _statID        = statID;
    7372  _mountPoint    = mountPoint;
    74   _format        = format.left(6);
    7573  _latitude      = latitude;
    7674  _longitude     = longitude;
     
    103101
    104102  _approxPos[0] = _approxPos[1] = _approxPos[2] = 0.0;
     103
     104  _samplingRate = settings.value("rnxSampl").toInt();
    105105}
    106106
     
    377377// Write RINEX Header
    378378////////////////////////////////////////////////////////////////////////////
    379 void bncRinex::writeHeader(const QDateTime& datTim,
     379void bncRinex::writeHeader(const QByteArray& format, const QDateTime& datTim,
    380380                           const QDateTime& datTimNom) {
    381381
     
    439439                                "    hh    mm   ss.zzz0000").toAscii().data();
    440440        _out << "     GPS         TIME OF FIRST OBS"    << endl;
    441         QString hlp = (_format + QString(" %1").arg(_mountPoint.host() +
     441        QString hlp = (format.left(6) + QString(" %1").arg(_mountPoint.host() +
    442442                      _mountPoint.path())).leftJustified(60, ' ', true);
    443443        _out << hlp.toAscii().data() << "COMMENT" << endl;
     
    511511                                "    hh    mm   ss.zzz0000").toAscii().data();
    512512    _out << "     GPS         TIME OF FIRST OBS"    << endl;
    513     QString hlp = (_format + QString(" %1").arg(_mountPoint.host() +
     513    QString hlp = (format.left(6) + QString(" %1").arg(_mountPoint.host() +
    514514          _mountPoint.path())).leftJustified(60, ' ', true);
    515515    _out << hlp.toAscii().data() << "COMMENT" << endl;
     
    533533// Write One Epoch into the RINEX File
    534534////////////////////////////////////////////////////////////////////////////
    535 void bncRinex::dumpEpoch(long maxTime) {
     535void bncRinex::dumpEpoch(const QByteArray& format, long maxTime) {
    536536
    537537  // Select observations older than maxTime
     
    570570  // ------------------
    571571  if (!_headerWritten) {
    572     writeHeader(datTim, datTimNom);
     572    writeHeader(format, datTim, datTimNom);
    573573  }
    574574
  • branches/BNC_LM/bncrinex.h

    r3344 r3571  
    2626#define BNCRINEX_H
    2727
    28 #include <QByteArray>
    29 #include <QDateTime>
    30 #include <QList>
    31 
     28#include <QtCore>
    3229#include <fstream>
    3330
    3431#include "bncconst.h"
    35 #include "RTCM/GPSDecoder.h"
     32
     33class t_obs;
    3634
    3735class bncRinex {
    3836 public:
    3937   bncRinex(const QByteArray& statID, const QUrl& mountPoint,
    40             const QByteArray& format, const QByteArray& latitude,
    41             const QByteArray& longitude, const QByteArray& nmea,
    42             const QByteArray& ntripVersion);
     38            const QByteArray& latitude, const QByteArray& longitude,
     39            const QByteArray& nmea, const QByteArray& ntripVersion);
    4340   ~bncRinex();
    4441   void deepCopy(t_obs obs);
    45    void dumpEpoch(long maxTime);
     42   void dumpEpoch(const QByteArray& format, long maxTime);
    4643   void setReconnectFlag(bool flag){_reconnectFlag = flag;}
    4744   static QString nextEpochStr(const QDateTime& datTim,
    4845                               const QString& intStr,
    4946                               QDateTime* nextEpoch = 0);
     47
     48   int samplingRate() const {return _samplingRate;}
    5049
    5150   void setApproxPos(double stax, double stay, double staz) {
     
    6463   void resolveFileName(const QDateTime& datTim);
    6564   void readSkeleton();
    66    void writeHeader(const QDateTime& datTim, const QDateTime& datTimNom);
     65   void writeHeader(const QByteArray& format, const QDateTime& datTim,
     66                    const QDateTime& datTimNom);
    6767   void closeFile();
    6868   t_irc downloadSkeleton();
     
    8080   QString       _userName;
    8181   QString       _sklName;
    82    QByteArray    _format;
    8382   QByteArray    _latitude;
    8483   QByteArray    _longitude;
     
    9190   bool          _reloadDone;
    9291   double        _approxPos[3];
     92   int           _samplingRate;
    9393
    9494   QMap<QString, int>  _slip_cnt_L1;
  • branches/BNC_LM/combination/bnccomb.cpp

    r3503 r3571  
    257257    delete _params[iPar-1];
    258258  }
    259   QVectorIterator<cmbCorr*> itCorr(corrs());
    260   while (itCorr.hasNext()) {
    261     delete itCorr.next();
     259  QListIterator<bncTime> itTime(_buffer.keys());
     260  while (itTime.hasNext()) {
     261    bncTime epoTime = itTime.next();
     262    _buffer.remove(epoTime);
    262263  }
    263264}
     
    355356  while (itCorr.hasNext()) {
    356357    cmbCorr* hlp = itCorr.next();
    357     if (hlp->prn == newCorr->prn && hlp->acName == newCorr->prn) {
     358    if (hlp->prn == newCorr->prn && hlp->acName == newCorr->acName) {
    358359      existingCorr = hlp;
    359360      break;
     
    875876      }
    876877      if (!foundMaster) {
     878        delete corr;
    877879        it.remove();
    878880      }
     
    973975    if (maxRes > _MAXRES) {
    974976      out << "  Outlier" << endl;
     977      delete corrs()[maxResIndex-1];
    975978      corrs().remove(maxResIndex-1);
    976979    }
     
    10101013    if      (_eph.find(prn) == _eph.end()) {
    10111014      out << "checkOrbit: missing eph (not found) " << corr->prn << endl;
     1015      delete corr;
    10121016      im.remove();
    10131017    }
    10141018    else if (corr->eph == 0) {
    10151019      out << "checkOrbit: missing eph (zero) " << corr->prn << endl;
     1020      delete corr;
    10161021      im.remove();
    10171022    }
     
    10221027      else {
    10231028        out << "checkOrbit: missing eph (deleted) " << corr->prn << endl;
     1029        delete corr;
    10241030        im.remove();
    10251031      }
     
    10861092      QString  prn  = corr->prn;
    10871093      if      (numCorr[prn] < 2) {
     1094        delete corr;
    10881095        im.remove();
    10891096      }
     
    10981105              << corr->iod                     << " "
    10991106              << norm                          << endl;
     1107          delete corr;
    11001108          im.remove();
    11011109          removed = true;
Note: See TracChangeset for help on using the changeset viewer.