Changeset 9258 in ntrip for trunk/BNC/src
- Timestamp:
- Nov 17, 2020, 3:50:34 PM (4 years ago)
- Location:
- trunk/BNC/src/combination
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/combination/bnccomb.cpp
r9025 r9258 48 48 eph = 0; 49 49 50 if (type == offACgps) { 51 epoSpec = true; 52 sig0 = sig0_offAC; 53 sigP = sig0; 54 } 55 else if (type == offACglo) { 50 if (type == offACgnss) { 56 51 epoSpec = true; 57 52 sig0 = sig0_offAC; … … 77 72 // Partial 78 73 //////////////////////////////////////////////////////////////////////////// 79 double bncComb::cmbParam::partial(const QString& AC_, const QString& prn_) { 80 81 if (type == offACgps) { 82 if (AC == AC_ && prn_[0] == 'G') { 83 return 1.0; 84 } 85 } 86 else if (type == offACglo) { 87 if (AC == AC_ && prn_[0] == 'R') { 74 double bncComb::cmbParam::partial(char sys, const QString& AC_, const QString& prn_) { 75 76 if (type == offACgnss) { 77 if (AC == AC_ && prn_[0].toLatin1() == sys) { 88 78 return 1.0; 89 79 } … … 105 95 // 106 96 //////////////////////////////////////////////////////////////////////////// 107 QString bncComb::cmbParam::toString( ) const {97 QString bncComb::cmbParam::toString(char sys) const { 108 98 109 99 QString outStr; 110 100 111 if (type == offACgps) { 112 outStr = "AC offset GPS " + AC; 113 } 114 else if (type == offACglo) { 115 outStr = "AC offset GLO " + AC; 101 if (type == offACgnss) { 102 outStr = "AC Offset " + AC + " " + sys ; 116 103 } 117 104 else if (type == offACSat) { … … 145 132 } 146 133 147 _masterMissingEpochs = 0; 134 _cmbSysPrn['G'] = t_prn::MAXPRN_GPS; _masterMissingEpochs['G'] = 0; 135 _cmbSysPrn['R'] = t_prn::MAXPRN_GLONASS; _masterMissingEpochs['R'] = 0; 136 _cmbSysPrn['E'] = t_prn::MAXPRN_GALILEO; _masterMissingEpochs['E'] = 0; 137 _cmbSysPrn['C'] = t_prn::MAXPRN_BDS; _masterMissingEpochs['C'] = 0;/* 138 _cmbSysPrn['J'] = t_prn::MAXPRN_QZSS; _masterMissingEpochs['J'] = 0; 139 _cmbSysPrn['S'] = t_prn::MAXPRN_SBAS; _masterMissingEpochs['S'] = 0; 140 */ 148 141 149 142 if (cmbStreams.size() >= 1 && !cmbStreams[0].isEmpty()) { … … 155 148 newAC->name = hlp[1]; 156 149 newAC->weight = hlp[2].toDouble(); 157 if (_masterOrbitAC.isEmpty()) { 158 _masterOrbitAC = newAC->name; 150 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 151 // init 152 while (itSys.hasNext()) { 153 itSys.next(); 154 char sys = itSys.key(); 155 if (_masterOrbitAC.isEmpty()) { 156 _masterOrbitAC[sys] = newAC->name; 157 } 159 158 } 160 159 _ACs.append(newAC); … … 163 162 164 163 QString ssrFormat; 164 _ssrCorr = 0; 165 165 QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList()); 166 166 while (it.hasNext()) { … … 170 170 } 171 171 } 172 _ssrCorr = 0;173 172 if (ssrFormat == "IGS-SSR") { 174 173 _ssrCorr = new SsrCorrIgs(); … … 177 176 _ssrCorr = new SsrCorrRtcm(); 178 177 } 179 178 else { // default 179 _ssrCorr = new SsrCorrIgs(); 180 } 180 181 181 182 _rtnetDecoder = 0; … … 192 193 connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)), 193 194 this, SLOT(slotNewClkCorrections(QList<t_clkCorr>))); 195 196 194 197 195 198 // Combination Method … … 202 205 } 203 206 204 // Use Glonass205 // -----------206 if ( Qt::CheckState(settings.value("cmbUseGlonass").toInt()) == Qt::Checked) {207 _useGlonass = true;208 }209 else {210 _useGlonass = false;211 }212 213 207 // Initialize Parameters (model: Clk_Corr = AC_Offset + Sat_Offset + Clk) 214 208 // ---------------------------------------------------------------------- 215 209 if (_method == filter) { 216 int nextPar = 0; 217 QListIterator<cmbAC*> it(_ACs); 218 while (it.hasNext()) { 219 cmbAC* AC = it.next(); 220 _params.push_back(new cmbParam(cmbParam::offACgps, ++nextPar, AC->name, "")); 221 for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) { 222 QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0')); 223 _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar, 224 AC->name, prn)); 225 } 226 if (_useGlonass) { 227 _params.push_back(new cmbParam(cmbParam::offACglo, ++nextPar, AC->name, "")); 228 for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) { 229 QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0')); 230 _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar, 231 AC->name, prn)); 210 // SYSTEM 211 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 212 while (itSys.hasNext()) { 213 itSys.next(); 214 int nextPar = 0; 215 char sys = itSys.key(); 216 unsigned maxPrn = itSys.value(); 217 unsigned flag = 0; 218 if (sys == 'E') { 219 flag = 1; 220 } 221 // AC 222 QListIterator<cmbAC*> itAc(_ACs); 223 while (itAc.hasNext()) { 224 cmbAC* AC = itAc.next(); 225 _params[sys].push_back(new cmbParam(cmbParam::offACgnss, ++nextPar, AC->name, "")); 226 for (unsigned iGnss = 1; iGnss <= maxPrn; iGnss++) { 227 QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag); 228 _params[sys].push_back(new cmbParam(cmbParam::offACSat, ++nextPar, AC->name, prn)); 232 229 } 233 230 } 234 } 235 for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) { 236 QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0')); 237 _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn)); 238 } 239 if (_useGlonass) { 240 for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) { 241 QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0')); 242 _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn)); 243 } 244 } 245 246 // Initialize Variance-Covariance Matrix 247 // ------------------------------------- 248 _QQ.ReSize(_params.size()); 249 _QQ = 0.0; 250 for (int iPar = 1; iPar <= _params.size(); iPar++) { 251 cmbParam* pp = _params[iPar-1]; 252 _QQ(iPar,iPar) = pp->sig0 * pp->sig0; 231 for (unsigned iGnss = 1; iGnss <= maxPrn; iGnss++) { 232 QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag); 233 _params[sys].push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn)); 234 } 235 // Initialize Variance-Covariance Matrix 236 // ------------------------------------- 237 _QQ[sys].ReSize(_params[sys].size()); 238 _QQ[sys] = 0.0; 239 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 240 cmbParam* pp = _params[sys][iPar-1]; 241 _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0; 242 } 253 243 } 254 244 } … … 287 277 } 288 278 delete _antex; 289 for (int iPar = 1; iPar <= _params.size(); iPar++) { 290 delete _params[iPar-1]; 291 } 292 QListIterator<bncTime> itTime(_buffer.keys()); 293 while (itTime.hasNext()) { 294 bncTime epoTime = itTime.next(); 295 _buffer.remove(epoTime); 296 } 279 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 280 while (itSys.hasNext()) { 281 itSys.next(); 282 char sys = itSys.key(); 283 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 284 delete _params[sys][iPar-1]; 285 } 286 QListIterator<bncTime> itTime(_buffer[sys].keys()); 287 while (itTime.hasNext()) { 288 bncTime epoTime = itTime.next(); 289 _buffer[sys].remove(epoTime); 290 } 291 } 292 297 293 } 298 294 … … 340 336 QString staID(clkCorr._staID.c_str()); 341 337 QString prn(clkCorr._prn.toInternalString().c_str()); 338 char sys = clkCorr._prn.system(); 342 339 343 340 // Set the last time … … 362 359 } 363 360 364 // Check GLONASS365 // -------------366 if (!_useGlonass && clkCorr._prn.system() == 'R') {367 continue;368 }369 370 if (371 clkCorr._prn.system() == 'E' ||372 clkCorr._prn.system() == 'C' ||373 clkCorr._prn.system() == 'J' ||374 clkCorr._prn.system() == 'I' ||375 clkCorr._prn.system() == 'S' ) {376 continue;377 }378 379 361 // Check Modulo Time 380 362 // ----------------- … … 408 390 else { 409 391 QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName]; 410 if (!storage.contains(clkCorr._prn) || storage[clkCorr._prn]._iod != newCorr->_iod) { 392 if (!storage.contains(clkCorr._prn) || 393 storage[clkCorr._prn]._iod != newCorr->_iod) { 411 394 delete newCorr; 412 395 continue; … … 422 405 t_eph* ephPrev = _ephUser.ephPrev(prn); 423 406 if (ephLast == 0) { 424 emit newMessage("bncComb: eph not found for " + prn.mid(0,3).toLatin1(), true);407 //emit newMessage("bncComb: eph not found for " + prn.mid(0,3).toLatin1(), true); 425 408 delete newCorr; 426 409 continue; … … 435 418 } 436 419 else { 437 emit newMessage("bncComb: eph not found for " + prn.mid(0,3).toLatin1() +438 QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true);420 //emit newMessage("bncComb: eph not found for " + prn.mid(0,3).toLatin1() + 421 //QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true); 439 422 delete newCorr; 440 423 continue; … … 444 427 // Store correction into the buffer 445 428 // -------------------------------- 446 QVector<cmbCorr*>& corrs = _buffer[ newCorr->_time].corrs;429 QVector<cmbCorr*>& corrs = _buffer[sys][newCorr->_time].corrs; 447 430 corrs.push_back(newCorr); 431 432 448 433 } 449 434 … … 451 436 // ------------------------- 452 437 const double outWait = 1.0 * _cmbSampl; 453 QListIterator<bncTime> itTime(_buffer.keys()); 454 while (itTime.hasNext()) { 455 bncTime epoTime = itTime.next(); 456 if (epoTime < lastTime - outWait) { 457 _resTime = epoTime; 458 processEpoch(); 438 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 439 while (itSys.hasNext()) { 440 itSys.next(); 441 char sys = itSys.key(); 442 QListIterator<bncTime> itTime(_buffer[sys].keys()); 443 while (itTime.hasNext()) { 444 bncTime epoTime = itTime.next(); 445 if (epoTime < lastTime - outWait) { 446 _resTime = epoTime; 447 processEpoch(sys); 448 } 459 449 } 460 450 } … … 502 492 // Process Epoch 503 493 //////////////////////////////////////////////////////////////////////////// 504 void bncComb::processEpoch( ) {494 void bncComb::processEpoch(char sys) { 505 495 506 496 _log.clear(); … … 508 498 QTextStream out(&_log, QIODevice::WriteOnly); 509 499 510 out << endl << "Combination: "<< endl511 << "------------------------------ " << endl;500 out << endl << "Combination: " << sys << endl 501 << "--------------------------------" << endl; 512 502 513 503 // Observation Statistics … … 517 507 while (icAC.hasNext()) { 518 508 cmbAC* AC = icAC.next(); 519 AC->numObs = 0;520 QVectorIterator<cmbCorr*> itCorr(corrs( ));509 AC->numObs[sys] = 0; 510 QVectorIterator<cmbCorr*> itCorr(corrs(sys)); 521 511 while (itCorr.hasNext()) { 522 512 cmbCorr* corr = itCorr.next(); 523 513 if (corr->_acName == AC->name) { 524 AC->numObs += 1;525 if (AC->name == _masterOrbitAC ) {514 AC->numObs[sys] += 1; 515 if (AC->name == _masterOrbitAC[sys]) { 526 516 masterPresent = true; 527 517 } 528 518 } 529 519 } 530 out << AC->name.toLatin1().data() << ": " << AC->numObs << endl;520 out << AC->name.toLatin1().data() << ": " << AC->numObs[sys] << endl; 531 521 } 532 522 … … 535 525 const unsigned switchMasterAfterGap = 1; 536 526 if (masterPresent) { 537 _masterMissingEpochs = 0;527 _masterMissingEpochs[sys] = 0; 538 528 } 539 529 else { 540 ++_masterMissingEpochs ;541 if (_masterMissingEpochs < switchMasterAfterGap) {530 ++_masterMissingEpochs[sys]; 531 if (_masterMissingEpochs[sys] < switchMasterAfterGap) { 542 532 out << "Missing Master, Epoch skipped" << endl; 543 _buffer .remove(_resTime);533 _buffer[sys].remove(_resTime); 544 534 emit newMessage(_log, false); 545 535 return; 546 536 } 547 537 else { 548 _masterMissingEpochs = 0;538 _masterMissingEpochs[sys] = 0; 549 539 QListIterator<cmbAC*> icAC(_ACs); 550 540 while (icAC.hasNext()) { 551 541 cmbAC* AC = icAC.next(); 552 if (AC->numObs > 0) {542 if (AC->numObs[sys] > 0) { 553 543 out << "Switching Master AC " 554 << _masterOrbitAC .toLatin1().data() << " --> "544 << _masterOrbitAC[sys].toLatin1().data() << " --> " 555 545 << AC->name.toLatin1().data() << " " 556 546 << _resTime.datestr().c_str() << " " 557 547 << _resTime.timestr().c_str() << endl; 558 _masterOrbitAC = AC->name;548 _masterOrbitAC[sys] = AC->name; 559 549 break; 560 550 } … … 570 560 ColumnVector dx; 571 561 if (_method == filter) { 572 irc = processEpoch_filter( out, resCorr, dx);562 irc = processEpoch_filter(sys, out, resCorr, dx); 573 563 } 574 564 else { 575 irc = processEpoch_singleEpoch( out, resCorr, dx);565 irc = processEpoch_singleEpoch(sys, out, resCorr, dx); 576 566 } 577 567 … … 579 569 // -------------------------------------- 580 570 if (irc == success) { 581 for (int iPar = 1; iPar <= _params .size(); iPar++) {582 cmbParam* pp = _params[ iPar-1];571 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 572 cmbParam* pp = _params[sys][iPar-1]; 583 573 pp->xx += dx(iPar); 584 574 if (pp->type == cmbParam::clkSat) { … … 592 582 out.setFieldWidth(8); 593 583 out.setRealNumberPrecision(4); 594 out << pp->toString( ) << " "595 << pp->xx << " +- " << sqrt(_QQ (pp->index,pp->index)) << endl;584 out << pp->toString(sys) << " " 585 << pp->xx << " +- " << sqrt(_QQ[sys](pp->index,pp->index)) << endl; 596 586 out.setFieldWidth(0); 597 587 } … … 602 592 // Delete Data, emit Message 603 593 // ------------------------- 604 _buffer .remove(_resTime);594 _buffer[sys].remove(_resTime); 605 595 emit newMessage(_log, false); 606 596 } … … 608 598 // Process Epoch - Filter Method 609 599 //////////////////////////////////////////////////////////////////////////// 610 t_irc bncComb::processEpoch_filter( QTextStream& out,600 t_irc bncComb::processEpoch_filter(char sys, QTextStream& out, 611 601 QMap<QString, cmbCorr*>& resCorr, 612 602 ColumnVector& dx) { … … 614 604 // Prediction Step 615 605 // --------------- 616 int nPar = _params .size();606 int nPar = _params[sys].size(); 617 607 ColumnVector x0(nPar); 618 for (int iPar = 1; iPar <= _params.size(); iPar++) {619 cmbParam* pp = _params[ iPar-1];608 for (int iPar = 1; iPar <= nPar; iPar++) { 609 cmbParam* pp = _params[sys][iPar-1]; 620 610 if (pp->epoSpec) { 621 611 pp->xx = 0.0; 622 _QQ .Row(iPar) = 0.0;623 _QQ .Column(iPar) = 0.0;624 _QQ (iPar,iPar) = pp->sig0 * pp->sig0;612 _QQ[sys].Row(iPar) = 0.0; 613 _QQ[sys].Column(iPar) = 0.0; 614 _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0; 625 615 } 626 616 else { 627 _QQ (iPar,iPar) += pp->sigP * pp->sigP;617 _QQ[sys](iPar,iPar) += pp->sigP * pp->sigP; 628 618 } 629 619 x0(iPar) = pp->xx; … … 632 622 // Check Satellite Positions for Outliers 633 623 // -------------------------------------- 634 if (checkOrbits( out) != success) {624 if (checkOrbits(sys, out) != success) { 635 625 return failure; 636 626 } … … 638 628 // Update and outlier detection loop 639 629 // --------------------------------- 640 SymmetricMatrix QQ_sav = _QQ ;630 SymmetricMatrix QQ_sav = _QQ[sys]; 641 631 while (true) { 642 632 … … 645 635 DiagonalMatrix PP; 646 636 647 if (createAmat( AA, ll, PP, x0, resCorr) != success) {637 if (createAmat(sys, AA, ll, PP, x0, resCorr) != success) { 648 638 return failure; 649 639 } 650 640 651 641 dx.ReSize(nPar); dx = 0.0; 652 kalman(AA, ll, PP, _QQ , dx);642 kalman(AA, ll, PP, _QQ[sys], dx); 653 643 654 644 ColumnVector vv = ll - AA * dx; … … 660 650 out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str() 661 651 << " Maximum Residuum " << maxRes << ' ' 662 << corrs( )[maxResIndex-1]->_acName << ' ' << corrs()[maxResIndex-1]->_prn.mid(0,3);652 << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3); 663 653 if (maxRes > _MAXRES) { 664 for (int iPar = 1; iPar <= _params .size(); iPar++) {665 cmbParam* pp = _params[ iPar-1];654 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 655 cmbParam* pp = _params[sys][iPar-1]; 666 656 if (pp->type == cmbParam::offACSat && 667 pp->AC == corrs( )[maxResIndex-1]->_acName &&668 pp->prn == corrs( )[maxResIndex-1]->_prn.mid(0,3)) {657 pp->AC == corrs(sys)[maxResIndex-1]->_acName && 658 pp->prn == corrs(sys)[maxResIndex-1]->_prn.mid(0,3)) { 669 659 QQ_sav.Row(iPar) = 0.0; 670 660 QQ_sav.Column(iPar) = 0.0; … … 674 664 675 665 out << " Outlier" << endl; 676 _QQ = QQ_sav;677 corrs( ).remove(maxResIndex-1);666 _QQ[sys] = QQ_sav; 667 corrs(sys).remove(maxResIndex-1); 678 668 } 679 669 else { … … 681 671 out.setRealNumberNotation(QTextStream::FixedNotation); 682 672 out.setRealNumberPrecision(4); 683 for (int ii = 0; ii < corrs( ).size(); ii++) {684 const cmbCorr* corr = corrs( )[ii];673 for (int ii = 0; ii < corrs(sys).size(); ii++) { 674 const cmbCorr* corr = corrs(sys)[ii]; 685 675 out << _resTime.datestr().c_str() << ' ' 686 676 << _resTime.timestr().c_str() << " " … … 734 724 735 725 QString outLines; 736 //QStringList corrLines;737 726 738 727 unsigned year, month, day, hour, minute; … … 809 798 corr->_orbCorr._dotXr[2], 810 799 0.0); 811 //corrLines << line;812 800 813 801 delete corr; … … 833 821 // Create First Design Matrix and Vector of Measurements 834 822 //////////////////////////////////////////////////////////////////////////// 835 t_irc bncComb::createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP, 836 const ColumnVector& x0, 837 QMap<QString, cmbCorr*>& resCorr) { 838 839 unsigned nPar = _params.size(); 840 unsigned nObs = corrs().size(); 823 t_irc bncComb::createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP, 824 const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr) { 825 826 unsigned nPar = _params[sys].size(); 827 unsigned nObs = corrs(sys).size(); 841 828 842 829 if (nObs == 0) { … … 844 831 } 845 832 846 int maxSat = t_prn::MAXPRN_GPS; 847 // if (_useGlonass) { 848 // maxSat = t_prn::MAXPRN_GPS + t_prn::MAXPRN_GLONASS; 849 // } 850 851 const int nCon = (_method == filter) ? 1 + maxSat : 0; 833 int maxSat = _cmbSysPrn[sys]; 834 835 const int nCon = (_method == filter) ? 1 + maxSat : 0; //(maybe not for GLONASS) 852 836 853 837 AA.ReSize(nObs+nCon, nPar); AA = 0.0; … … 856 840 857 841 int iObs = 0; 858 QVectorIterator<cmbCorr*> itCorr(corrs( ));842 QVectorIterator<cmbCorr*> itCorr(corrs(sys)); 859 843 while (itCorr.hasNext()) { 860 844 cmbCorr* corr = itCorr.next(); … … 863 847 ++iObs; 864 848 865 if (corr->_acName == _masterOrbitAC && resCorr.find(prn) == resCorr.end()) {849 if (corr->_acName == _masterOrbitAC[sys] && resCorr.find(prn) == resCorr.end()) { 866 850 resCorr[prn] = new cmbCorr(*corr); 867 851 } 868 852 869 for (int iPar = 1; iPar <= _params .size(); iPar++) {870 cmbParam* pp = _params[ iPar-1];871 AA(iObs, iPar) = pp->partial( corr->_acName, prn);853 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 854 cmbParam* pp = _params[sys][iPar-1]; 855 AA(iObs, iPar) = pp->partial(sys, corr->_acName, prn); 872 856 } 873 857 … … 880 864 const double Ph = 1.e6; 881 865 PP(nObs+1) = Ph; 882 for (int iPar = 1; iPar <= _params .size(); iPar++) {883 cmbParam* pp = _params[ iPar-1];866 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 867 cmbParam* pp = _params[sys][iPar-1]; 884 868 if ( AA.Column(iPar).maximum_absolute_value() > 0.0 && 885 869 pp->type == cmbParam::clkSat ) { … … 888 872 } 889 873 int iCond = 1; 890 for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) { 891 QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0')); 874 unsigned flag = 0; 875 if (sys == 'E') { 876 flag = 1; 877 } 878 // GNSS (maybe not for GLONASS) 879 for (unsigned iGnss = 1; iGnss <= _cmbSysPrn[sys]; iGnss++) { 880 QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag); 892 881 ++iCond; 893 882 PP(nObs+iCond) = Ph; 894 for (int iPar = 1; iPar <= _params .size(); iPar++) {895 cmbParam* pp = _params[ iPar-1];883 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 884 cmbParam* pp = _params[sys][iPar-1]; 896 885 if ( pp && 897 886 AA.Column(iPar).maximum_absolute_value() > 0.0 && … … 902 891 } 903 892 } 904 // if (_useGlonass) {// liefert schlechtere Höhenkomponente im PPP905 // for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {906 // QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));907 // ++iCond;908 // PP(nObs+iCond) = Ph;909 // for (int iPar = 1; iPar <= _params.size(); iPar++) {910 // cmbParam* pp = _params[iPar-1];911 // if ( pp &&912 // AA.Column(iPar).maximum_absolute_value() > 0.0 &&913 // pp->type == cmbParam::offACSat &&914 // pp->prn == prn) {915 // AA(nObs+iCond, iPar) = 1.0;916 // }917 // }918 // }919 // }920 893 } 921 894 … … 925 898 // Process Epoch - Single-Epoch Method 926 899 //////////////////////////////////////////////////////////////////////////// 927 t_irc bncComb::processEpoch_singleEpoch( QTextStream& out,900 t_irc bncComb::processEpoch_singleEpoch(char sys, QTextStream& out, 928 901 QMap<QString, cmbCorr*>& resCorr, 929 902 ColumnVector& dx) { … … 931 904 // Check Satellite Positions for Outliers 932 905 // -------------------------------------- 933 if (checkOrbits( out) != success) {906 if (checkOrbits(sys, out) != success) { 934 907 return failure; 935 908 } … … 941 914 // Remove Satellites that are not in Master 942 915 // ---------------------------------------- 943 QMutableVectorIterator<cmbCorr*> it(corrs( ));916 QMutableVectorIterator<cmbCorr*> it(corrs(sys)); 944 917 while (it.hasNext()) { 945 918 cmbCorr* corr = it.next(); 946 919 QString prn = corr->_prn; 947 920 bool foundMaster = false; 948 QVectorIterator<cmbCorr*> itHlp(corrs( ));921 QVectorIterator<cmbCorr*> itHlp(corrs(sys)); 949 922 while (itHlp.hasNext()) { 950 923 cmbCorr* corrHlp = itHlp.next(); 951 924 QString prnHlp = corrHlp->_prn; 952 925 QString ACHlp = corrHlp->_acName; 953 if (ACHlp == _masterOrbitAC && prn == prnHlp) {926 if (ACHlp == _masterOrbitAC[sys] && prn == prnHlp) { 954 927 foundMaster = true; 955 928 break; … … 966 939 QMap<QString, int> numObsPrn; 967 940 QMap<QString, int> numObsAC; 968 QVectorIterator<cmbCorr*> itCorr(corrs( ));941 QVectorIterator<cmbCorr*> itCorr(corrs(sys)); 969 942 while (itCorr.hasNext()) { 970 943 cmbCorr* corr = itCorr.next(); … … 985 958 } 986 959 987 // Clean-Up the Param ters988 // ---------------------- 989 for (int iPar = 1; iPar <= _params .size(); iPar++) {990 delete _params[ iPar-1];991 } 992 _params .clear();960 // Clean-Up the Parameters 961 // ----------------------- 962 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 963 delete _params[sys][iPar-1]; 964 } 965 _params[sys].clear(); 993 966 994 967 // Set new Parameters … … 1001 974 const QString& AC = itAC.key(); 1002 975 int numObs = itAC.value(); 1003 if (AC != _masterOrbitAC && numObs > 0) { 1004 _params.push_back(new cmbParam(cmbParam::offACgps, ++nextPar, AC, "")); 1005 if (_useGlonass) { 1006 _params.push_back(new cmbParam(cmbParam::offACglo, ++nextPar, AC, "")); 1007 } 976 if (AC != _masterOrbitAC[sys] && numObs > 0) { 977 _params[sys].push_back(new cmbParam(cmbParam::offACgnss, ++nextPar, AC, "")); 1008 978 } 1009 979 } … … 1015 985 int numObs = itPrn.value(); 1016 986 if (numObs > 0) { 1017 _params .push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));1018 } 1019 } 1020 1021 int nPar = _params .size();987 _params[sys].push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn)); 988 } 989 } 990 991 int nPar = _params[sys].size(); 1022 992 ColumnVector x0(nPar); 1023 993 x0 = 0.0; … … 1028 998 ColumnVector ll; 1029 999 DiagonalMatrix PP; 1030 if (createAmat( AA, ll, PP, x0, resCorr) != success) {1000 if (createAmat(sys, AA, ll, PP, x0, resCorr) != success) { 1031 1001 return failure; 1032 1002 } … … 1037 1007 SymmetricMatrix NN; NN << ATP * AA; 1038 1008 ColumnVector bb = ATP * ll; 1039 _QQ = NN.i();1040 dx = _QQ * bb;1009 _QQ[sys] = NN.i(); 1010 dx = _QQ[sys] * bb; 1041 1011 vv = ll - AA * dx; 1042 1012 } … … 1052 1022 out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str() 1053 1023 << " Maximum Residuum " << maxRes << ' ' 1054 << corrs( )[maxResIndex-1]->_acName << ' ' << corrs()[maxResIndex-1]->_prn.mid(0,3);1024 << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3); 1055 1025 1056 1026 if (maxRes > _MAXRES) { 1057 1027 out << " Outlier" << endl; 1058 delete corrs( )[maxResIndex-1];1059 corrs( ).remove(maxResIndex-1);1028 delete corrs(sys)[maxResIndex-1]; 1029 corrs(sys).remove(maxResIndex-1); 1060 1030 } 1061 1031 else { … … 1064 1034 out.setRealNumberPrecision(3); 1065 1035 for (int ii = 0; ii < vv.Nrows(); ii++) { 1066 const cmbCorr* corr = corrs( )[ii];1036 const cmbCorr* corr = corrs(sys)[ii]; 1067 1037 out << _resTime.datestr().c_str() << ' ' 1068 1038 << _resTime.timestr().c_str() << " " … … 1082 1052 // Check Satellite Positions for Outliers 1083 1053 //////////////////////////////////////////////////////////////////////////// 1084 t_irc bncComb::checkOrbits( QTextStream& out) {1054 t_irc bncComb::checkOrbits(char sys, QTextStream& out) { 1085 1055 1086 1056 const double MAX_DISPLACEMENT = 0.20; … … 1088 1058 // Switch to last ephemeris (if possible) 1089 1059 // -------------------------------------- 1090 QMutableVectorIterator<cmbCorr*> im(corrs( ));1060 QMutableVectorIterator<cmbCorr*> im(corrs(sys)); 1091 1061 while (im.hasNext()) { 1092 1062 cmbCorr* corr = im.next(); … … 1124 1094 QMap<QString, int> numCorr; 1125 1095 QMap<QString, ColumnVector> meanRao; 1126 QVectorIterator<cmbCorr*> it(corrs( ));1096 QVectorIterator<cmbCorr*> it(corrs(sys)); 1127 1097 while (it.hasNext()) { 1128 1098 cmbCorr* corr = it.next(); … … 1145 1115 } 1146 1116 1147 // Compute Differences wrt Mean, find Maximum1148 // ------------------------------------------ 1117 // Compute Differences wrt. Mean, find Maximum 1118 // ------------------------------------------- 1149 1119 QMap<QString, cmbCorr*> maxDiff; 1150 1120 it.toFront(); … … 1176 1146 // --------------- 1177 1147 bool removed = false; 1178 QMutableVectorIterator<cmbCorr*> im(corrs( ));1148 QMutableVectorIterator<cmbCorr*> im(corrs(sys)); 1179 1149 while (im.hasNext()) { 1180 1150 cmbCorr* corr = im.next(); … … 1233 1203 return; 1234 1204 } 1235 1236 // Remove all corrections of the corresponding AC 1237 // ---------------------------------------------- 1238 QListIterator<bncTime> itTime(_buffer.keys()); 1239 while (itTime.hasNext()) { 1240 bncTime epoTime = itTime.next(); 1241 QVector<cmbCorr*>& corrVec = _buffer[epoTime].corrs; 1242 QMutableVectorIterator<cmbCorr*> it(corrVec); 1243 while (it.hasNext()) { 1244 cmbCorr* corr = it.next(); 1245 if (acName == corr->_acName) { 1246 delete corr; 1247 it.remove(); 1248 } 1249 } 1250 } 1251 1252 // Reset Satellite Offsets 1253 // ----------------------- 1254 if (_method == filter) { 1255 for (int iPar = 1; iPar <= _params.size(); iPar++) { 1256 cmbParam* pp = _params[iPar-1]; 1257 if (pp->AC == acName && pp->type == cmbParam::offACSat) { 1258 pp->xx = 0.0; 1259 _QQ.Row(iPar) = 0.0; 1260 _QQ.Column(iPar) = 0.0; 1261 _QQ(iPar,iPar) = pp->sig0 * pp->sig0; 1262 } 1263 } 1264 } 1265 } 1205 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 1206 while (itSys.hasNext()) { 1207 itSys.next(); 1208 char sys = itSys.key(); 1209 // Remove all corrections of the corresponding AC 1210 // ---------------------------------------------- 1211 QListIterator<bncTime> itTime(_buffer[sys].keys()); 1212 while (itTime.hasNext()) { 1213 bncTime epoTime = itTime.next(); 1214 QVector<cmbCorr*>& corrVec = _buffer[sys][epoTime].corrs; 1215 QMutableVectorIterator<cmbCorr*> it(corrVec); 1216 while (it.hasNext()) { 1217 cmbCorr* corr = it.next(); 1218 if (acName == corr->_acName) { 1219 delete corr; 1220 it.remove(); 1221 } 1222 } 1223 } 1224 1225 // Reset Satellite Offsets 1226 // ----------------------- 1227 if (_method == filter) { 1228 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 1229 cmbParam* pp = _params[sys][iPar-1]; 1230 if (pp->AC == acName && pp->type == cmbParam::offACSat) { 1231 pp->xx = 0.0; 1232 _QQ[sys].Row(iPar) = 0.0; 1233 _QQ[sys].Column(iPar) = 0.0; 1234 _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0; 1235 } 1236 } 1237 } 1238 } 1239 } -
trunk/BNC/src/combination/bnccomb.h
r9025 r9258 37 37 class cmbParam { 38 38 public: 39 enum parType {offACg ps, offACglo, offACSat, clkSat};39 enum parType {offACgnss, offACSat, clkSat}; 40 40 cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_); 41 41 ~cmbParam(); 42 double partial(c onst QString& AC_, const QString& prn_);43 QString toString( ) const;42 double partial(char sys, const QString& AC_, const QString& prn_); 43 QString toString(char sys) const; 44 44 parType type; 45 45 int index; … … 57 57 cmbAC() { 58 58 weight = 0.0; 59 numObs = 0; 59 numObs['G'] = 0; 60 numObs['R'] = 0; 61 numObs['E'] = 0; 62 numObs['C'] = 0; 63 numObs['J'] = 0; 64 numObs['S'] = 0; 60 65 } 61 66 ~cmbAC() {} … … 63 68 QString name; 64 69 double weight; 65 unsignednumObs;70 QMap<char, unsigned> numObs; 66 71 }; 67 72 … … 98 103 }; 99 104 100 void processEpoch( );101 t_irc processEpoch_filter( QTextStream& out, QMap<QString, cmbCorr*>& resCorr,105 void processEpoch(char sys); 106 t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, 102 107 ColumnVector& dx); 103 t_irc processEpoch_singleEpoch( QTextStream& out, QMap<QString, cmbCorr*>& resCorr,108 t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, 104 109 ColumnVector& dx); 105 t_irc createAmat( Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,110 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP, 106 111 const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr); 107 112 void dumpResults(const QMap<QString, cmbCorr*>& resCorr); 108 113 void printResults(QTextStream& out, const QMap<QString, cmbCorr*>& resCorr); 109 114 void switchToLastEph(t_eph* lastEph, cmbCorr* corr); 110 t_irc checkOrbits( QTextStream& out);111 QVector<cmbCorr*>& corrs( ) {return _buffer[_resTime].corrs;}115 t_irc checkOrbits(char sys, QTextStream& out); 116 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys][_resTime].corrs;} 112 117 113 118 QMutex _mutex; 114 119 QList<cmbAC*> _ACs; 115 120 bncTime _resTime; 116 Q Vector<cmbParam*>_params;117 QMap< bncTime, cmbEpoch>_buffer;121 QMap<char, QVector<cmbParam*>> _params; 122 QMap<char, QMap<bncTime, cmbEpoch>> _buffer; 118 123 bncRtnetDecoder* _rtnetDecoder; 119 SymmetricMatrix_QQ;124 QMap<char, SymmetricMatrix> _QQ; 120 125 QByteArray _log; 121 126 bncAntex* _antex; 122 127 double _MAXRES; 123 Q String_masterOrbitAC;124 unsigned_masterMissingEpochs;128 QMap<char, QString> _masterOrbitAC; 129 QMap<char, unsigned> _masterMissingEpochs; 125 130 e_method _method; 126 bool _useGlonass;127 131 int _cmbSampl; 128 132 QMap<QString, QMap<t_prn, t_orbCorr> > _orbCorrections; 129 133 bncEphUser _ephUser; 130 134 SsrCorr* _ssrCorr; 135 QMap<char, unsigned> _cmbSysPrn; 131 136 }; 132 137
Note:
See TracChangeset
for help on using the changeset viewer.