Changeset 6073 in ntrip for trunk/BNC/src/PPP_free
- Timestamp:
- Sep 7, 2014, 11:23:53 AM (10 years ago)
- Location:
- trunk/BNC/src/PPP_free
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP_free/bncpppclient.cpp
r6072 r6073 49 49 #include "bncmodel.h" 50 50 #include "pppOptions.h" 51 #include "pppClient.h" 51 52 52 53 using namespace BNC_PPP; … … 57 58 bncPPPclient::bncPPPclient(QByteArray staID, const t_pppOptions* opt) : bncEphUser(false) { 58 59 59 _opt = opt; 60 _staID = staID; 61 _model = new bncModel(this); 60 _opt = opt; 61 _staID = staID; 62 _model = new bncModel(this); 63 _epoData = new t_epoData(); 62 64 } 63 65 … … 65 67 //////////////////////////////////////////////////////////////////////////// 66 68 bncPPPclient::~bncPPPclient() { 67 while (!_epoData.empty()) { 68 delete _epoData.front(); 69 _epoData.pop(); 70 } 69 _epoData->clear(); 70 71 71 QMapIterator<QString, t_corr*> ic(_corr); 72 72 while (ic.hasNext()) { … … 74 74 delete ic.value(); 75 75 } 76 76 77 QMapIterator<QString, t_bias*> ib(_bias); 77 78 while (ib.hasNext()) { … … 79 80 delete ib.value(); 80 81 } 82 81 83 delete _model; 82 84 } … … 84 86 // 85 87 //////////////////////////////////////////////////////////////////////////// 86 void bncPPPclient::p utNewObs(t_satData* satData, t_output* output) {88 void bncPPPclient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) { 87 89 QMutexLocker locker(&_mutex); 88 90 89 // Add new epoch, process the older ones 90 // ------------------------------------- 91 if (_epoData.size() == 0) { 92 _epoData.push(new t_epoData()); 93 _epoData.back()->tt = satData->tt; 94 } 95 else if (satData->tt != _epoData.back()->tt) { 96 processEpochs(output); 97 _epoData.push(new t_epoData()); 98 _epoData.back()->tt = satData->tt; 99 } 91 _epoData->clear(); 92 93 output->_numSat = 0; 94 output->_pDop = 0.0; 95 output->_error = false; 96 output->_log.clear(); 97 98 for (unsigned ii = 0; ii < satObs.size(); ii++) { 99 const t_satObs* obs = satObs[ii]; 100 t_satData* satData = new t_satData(); 101 satData->tt = obs->_time; 102 satData->prn = QString(obs->_prn.toString().c_str()); 103 satData->slipFlag = false; 104 satData->P1 = 0.0; 105 satData->P2 = 0.0; 106 satData->P5 = 0.0; 107 satData->L1 = 0.0; 108 satData->L2 = 0.0; 109 satData->L5 = 0.0; 110 for (unsigned ifrq = 0; ifrq < obs->_obs.size(); ifrq++) { 111 t_frqObs* frqObs = obs->_obs[ifrq]; 112 if (frqObs->_rnxType2ch[0] == '1') { 113 if (frqObs->_codeValid) satData->P1 = frqObs->_code; 114 if (frqObs->_phaseValid) satData->L1 = frqObs->_phase; 115 if (frqObs->_slip) satData->slipFlag = true; 116 } 117 else if (frqObs->_rnxType2ch[0] == '2') { 118 if (frqObs->_codeValid) satData->P2 = frqObs->_code; 119 if (frqObs->_phaseValid) satData->L2 = frqObs->_phase; 120 if (frqObs->_slip) satData->slipFlag = true; 121 } 122 else if (frqObs->_rnxType2ch[0] == '5') { 123 if (frqObs->_codeValid) satData->P5 = frqObs->_code; 124 if (frqObs->_phaseValid) satData->L5 = frqObs->_phase; 125 if (frqObs->_slip) satData->slipFlag = true; 126 } 127 } 128 putNewObs(satData); 129 } 130 131 // Data Pre-Processing 132 // ------------------- 133 QMutableMapIterator<QString, t_satData*> it(_epoData->satData); 134 while (it.hasNext()) { 135 it.next(); 136 QString prn = it.key(); 137 t_satData* satData = it.value(); 138 139 if (cmpToT(satData) != success) { 140 delete satData; 141 it.remove(); 142 continue; 143 } 144 } 145 146 // Filter Solution 147 // --------------- 148 if (_model->update(_epoData) == success) { 149 /// emit newPosition(_model->time(), _model->x(), _model->y(), _model->z()); 150 } 151 else { 152 output->_error = true; 153 } 154 155 output->_log = LOG.str(); 156 } 157 158 // 159 //////////////////////////////////////////////////////////////////////////// 160 void bncPPPclient::putNewObs(t_satData* satData) { 100 161 101 162 // Set Observations GPS and Glonass … … 120 181 satData->L3 = a1 * satData->L1 + a2 * satData->L2; 121 182 satData->lambda3 = a1 * t_CST::c / f1 + a2 * t_CST::c / f2; 122 _epoData .back()->satData[satData->prn] = satData;183 _epoData->satData[satData->prn] = satData; 123 184 } 124 185 else { … … 139 200 satData->L3 = a1 * satData->L1 + a5 * satData->L5; 140 201 satData->lambda3 = a1 * t_CST::c / f1 + a5 * t_CST::c / f5; 141 _epoData .back()->satData[satData->prn] = satData;202 _epoData->satData[satData->prn] = satData; 142 203 } 143 204 else { … … 321 382 } 322 383 323 //324 ////////////////////////////////////////////////////////////////////////////325 void bncPPPclient::processFrontEpoch(t_output* output) {326 327 #ifdef BNC_DEBUG328 QString msg = "List of Corrections\n";329 QMapIterator<QString, t_corr*> itC(_corr);330 while (itC.hasNext()) {331 itC.next();332 QString src = itC.key();333 const t_corr* corr = itC.value();334 msg += QString("%1 %2 %3 %4\n")335 .arg(corr->prn)336 .arg(corr->iod)337 .arg(QString(corr->tClk.datestr().c_str()) + "_" + QString(corr->tClk.timestr().c_str()))338 .arg(QString(corr->tRao.datestr().c_str()) + "_" + QString(corr->tRao.timestr().c_str()));339 }340 341 msg += "List of Ephemeris\n";342 QMapIterator<QString, t_ephPair*> itE(_eph);343 while (itE.hasNext()) {344 itE.next();345 QString prn = itE.key();346 const t_ephPair* ephPair = itE.value();347 if (ephPair->prev) {348 msg += QString("%1 %2 %3 %4 %5\n")349 .arg(prn)350 .arg(ephPair->last->IOD())351 .arg(QString(ephPair->last->TOC().datestr().c_str()) + "_" +352 QString(ephPair->last->TOC().timestr().c_str()))353 .arg(ephPair->prev->IOD())354 .arg(QString(ephPair->prev->TOC().datestr().c_str()) + "_" +355 QString(ephPair->prev->TOC().timestr().c_str()));356 }357 else {358 msg += QString("%1 %2 %3\n")359 .arg(prn)360 .arg(ephPair->last->IOD())361 .arg(QString(ephPair->last->TOC().datestr().c_str()) + "_" +362 QString(ephPair->last->TOC().timestr().c_str()));363 }364 }365 366 LOG << msg.toAscii() << endl;367 #endif // BNC_DEBUG368 369 // Data Pre-Processing370 // -------------------371 QMutableMapIterator<QString, t_satData*> it(_epoData.front()->satData);372 while (it.hasNext()) {373 it.next();374 QString prn = it.key();375 t_satData* satData = it.value();376 377 if (cmpToT(satData) != success) {378 delete satData;379 it.remove();380 continue;381 }382 }383 384 // Filter Solution385 // ---------------386 if (_model->update(_epoData.front()) == success) {387 /// emit newPosition(_model->time(), _model->x(), _model->y(), _model->z());388 }389 }390 391 //392 ////////////////////////////////////////////////////////////////////////////393 void bncPPPclient::processEpochs(t_output* output) {394 395 // Make sure the buffer does not grow beyond any limit396 // ---------------------------------------------------397 const unsigned MAX_EPODATA_SIZE = 120;398 if (_epoData.size() > MAX_EPODATA_SIZE) {399 delete _epoData.front();400 _epoData.pop();401 }402 403 // Loop over all unprocessed epochs404 // --------------------------------405 while (!_epoData.empty()) {406 407 t_epoData* frontEpoData = _epoData.front();408 409 // No corrections yet, skip the epoch410 // ----------------------------------411 if (_opt->useOrbClkCorr() && !_corr_tt.valid()) {412 return;413 }414 415 // Process the front epoch416 // -----------------------417 if (_opt->_corrWaitTime == 0.0 || frontEpoData->tt - _corr_tt >= _opt->_corrWaitTime) {418 processFrontEpoch(output);419 delete _epoData.front();420 _epoData.pop();421 }422 else {423 return;424 }425 }426 } -
trunk/BNC/src/PPP_free/bncpppclient.h
r6072 r6073 26 26 #define BNCPPPCLIENT_H 27 27 28 #include < queue>28 #include <vector> 29 29 #include "bncephuser.h" 30 30 #include "GPSDecoder.h" … … 35 35 class bncModel; 36 36 class t_pppOptions; 37 class t_satObs; 37 38 class t_satData; 38 39 class t_epoData; … … 43 44 bncPPPclient(QByteArray staID, const t_pppOptions* opt); 44 45 ~bncPPPclient(); 45 void p utNewObs(t_satData* satData, t_output* output);46 void processEpoch(const std::vector<t_satObs*>& satObs, t_output* output); 46 47 void putNewCorrections(QList<QString> corrList); 47 48 QByteArray staID() const {return _staID;} … … 63 64 64 65 t_irc getSatPos(const bncTime& tt, const QString& prn, ColumnVector& xc, ColumnVector& vv); 65 void processEpochs(t_output* output); 66 void processFrontEpoch(t_output* output); 66 void putNewObs(t_satData* satData); 67 67 t_irc cmpToT(t_satData* satData); 68 68 static t_irc applyCorr(const bncTime& tt, const t_corr* cc, ColumnVector& xc, ColumnVector& vv); … … 73 73 bncTime _corr_tt; 74 74 QMap<QString, t_bias*> _bias; 75 std::queue<t_epoData*>_epoData;75 t_epoData* _epoData; 76 76 bncModel* _model; 77 77 }; -
trunk/BNC/src/PPP_free/pppClient.cpp
r6072 r6073 118 118 ////////////////////////////////////////////////////////////////////////////// 119 119 void t_pppClient::processEpoch(const vector<t_satObs*>& satObs, t_output* output) { 120 121 output->_numSat = 0; 122 output->_pDop = 0.0; 123 output->_error = false; 124 output->_log.clear(); 125 126 for (unsigned ii = 0; ii < satObs.size(); ii++) { 127 const t_satObs* obs = satObs[ii]; 128 t_satData* satData = new t_satData(); 129 satData->tt = obs->_time; 130 satData->prn = QString(obs->_prn.toString().c_str()); 131 satData->slipFlag = false; 132 satData->P1 = 0.0; 133 satData->P2 = 0.0; 134 satData->P5 = 0.0; 135 satData->L1 = 0.0; 136 satData->L2 = 0.0; 137 satData->L5 = 0.0; 138 for (unsigned ifrq = 0; ifrq < obs->_obs.size(); ifrq++) { 139 t_frqObs* frqObs = obs->_obs[ifrq]; 140 if (frqObs->_rnxType2ch[0] == '1') { 141 if (frqObs->_codeValid) satData->P1 = frqObs->_code; 142 if (frqObs->_phaseValid) satData->L1 = frqObs->_phase; 143 if (frqObs->_slip) satData->slipFlag = true; 144 } 145 else if (frqObs->_rnxType2ch[0] == '2') { 146 if (frqObs->_codeValid) satData->P2 = frqObs->_code; 147 if (frqObs->_phaseValid) satData->L2 = frqObs->_phase; 148 if (frqObs->_slip) satData->slipFlag = true; 149 } 150 else if (frqObs->_rnxType2ch[0] == '5') { 151 if (frqObs->_codeValid) satData->P5 = frqObs->_code; 152 if (frqObs->_phaseValid) satData->L5 = frqObs->_phase; 153 if (frqObs->_slip) satData->slipFlag = true; 154 } 155 } 156 157 // _client->putNewObs(pp, output); 158 } 159 output->_log = _log->str(); 120 _client->processEpoch(satObs, output); 160 121 } 161 122
Note:
See TracChangeset
for help on using the changeset viewer.