Changeset 10038 in ntrip
- Timestamp:
- May 10, 2023, 11:19:40 AM (21 months ago)
- Location:
- trunk/BNC/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppClient.cpp
r10034 r10038 155 155 // ------- 156 156 epoTime.reset(); 157 //clearObs();157 clearObs(); 158 158 159 159 // Create vector of valid observations … … 636 636 return finish(failure, 4); 637 637 } 638 638 639 639 _offGlo = cmpOffGlo(_obsRover); 640 640 _offGal = cmpOffGal(_obsRover); 641 641 _offBds = cmpOffBds(_obsRover); 642 642 643 643 // Prepare Pseudo Observations of the Rover 644 644 // ---------------------------------------- -
trunk/BNC/src/bnccore.cpp
r10027 r10038 759 759 //////////////////////////////////////////////////////////////////////////// 760 760 void t_bncCore::initCombination() { 761 _bncComb = new bncComb();761 _bncComb = bncComb::instance(); 762 762 if (_bncComb->nStreams() < 1) { 763 763 delete _bncComb; -
trunk/BNC/src/combination/bncbiassnx.cpp
r9698 r10038 296 296 // 297 297 //////////////////////////////////////////////////////////////////////////// 298 void bncBiasSnx::determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias& satCodeBias) { 298 void bncBiasSnx::determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, 299 t_satCodeBias* satCodeBias) { 299 300 std::string rnxType2ch; 300 301 double value; … … 518 519 519 520 520 void bncBiasSnx::setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias& satCodeBias) { 521 void bncBiasSnx::setSsrSatCodeBias(std::string rnxType2ch, double value, 522 t_satCodeBias* satCodeBias) { 521 523 t_frqCodeBias frqCodeBias; 522 524 … … 524 526 frqCodeBias._value = value; 525 527 526 satCodeBias ._bias.push_back(frqCodeBias);528 satCodeBias->_bias.push_back(frqCodeBias); 527 529 return; 528 530 } -
trunk/BNC/src/combination/bncbiassnx.h
r9677 r10038 59 59 ~bncBiasSnx(); 60 60 t_irc readFile(const QString& fileName); 61 void determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias &satCodeBias);62 void setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias &satCodeBias);61 void determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias* satCodeBias); 62 void setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias* satCodeBias); 63 63 64 64 private: -
trunk/BNC/src/combination/bnccomb.cpp
r10035 r10038 114 114 } 115 115 116 117 // Define the static Singleton pointer 118 //////////////////////////////////////////////////////////////////////////// 119 bncComb* bncComb::_instPtr = NULL; 120 116 121 // Singleton 117 122 //////////////////////////////////////////////////////////////////////////// 118 123 bncComb* bncComb::instance() { 119 static bncComb _bncComb; 120 return &_bncComb; 124 if (_instPtr == NULL) { 125 _instPtr = new bncComb(); 126 } 127 return(_instPtr); 121 128 } 122 129 … … 318 325 delete _antex; 319 326 delete _bsx; 327 320 328 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 321 329 while (itSys.hasNext()) { … … 325 333 delete _params[sys][iPar-1]; 326 334 } 327 QListIterator<bncTime> itTime(_buffer[sys].keys()); 328 while (itTime.hasNext()) { 329 bncTime epoTime = itTime.next(); 330 _buffer[sys].remove(epoTime); 331 } 332 } 333 335 _buffer.remove(sys); 336 } 337 while (!_epoClkData.empty()) { 338 delete _epoClkData.front(); 339 _epoClkData.pop_front(); 340 } 334 341 } 335 342 … … 389 396 // Store the correction 390 397 // -------------------- 391 QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName]; 392 storage[orbCorr._prn] = orbCorr; 398 QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName]; 399 if (storage[orbCorr._prn]) { 400 delete storage[orbCorr._prn]; 401 } 402 storage[orbCorr._prn] = new t_orbCorr(orbCorr); 393 403 } 394 404 } … … 425 435 // Store the correction 426 436 // -------------------- 427 QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName]; 428 storage[satCodeBias._prn] = satCodeBias; 437 QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName]; 438 if (storage[satCodeBias._prn]) { 439 delete storage[satCodeBias._prn]; 440 } 441 storage[satCodeBias._prn] = new t_satCodeBias(satCodeBias); 429 442 } 430 443 } … … 434 447 void bncComb::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) { 435 448 QMutexLocker locker(&_mutex); 436 437 bncTime lastTime; 438 449 const double outWait = 1.0 * _cmbSampl; 450 451 // Loop over all observations (possible different epochs) 452 // ----------------------------------------------------- 439 453 for (int ii = 0; ii < clkCorrections.size(); ii++) { 440 t_clkCorr& clkCorr = clkCorrections[ii]; 441 QString staID(clkCorr._staID.c_str()); 442 QString prn(clkCorr._prn.toInternalString().c_str()); 443 char sys = clkCorr._prn.system(); 444 454 t_clkCorr* newClk = new t_clkCorr(clkCorrections[ii]); 455 456 char sys = newClk->_prn.system(); 445 457 if (!_cmbSysPrn.contains(sys)){ 458 delete newClk; 459 continue; 460 } 461 462 // Check Modulo Time 463 // ----------------- 464 int sec = int(nint(newClk->_time.gpssec()*10)); 465 if (sec % (_cmbSampl*10) != 0.0) { 466 delete newClk; 467 continue; 468 } 469 470 // Find/Check the AC Name 471 // ---------------------- 472 QString acName; 473 QString staID(newClk->_staID.c_str()); 474 QListIterator<cmbAC*> icAC(_ACs); 475 while (icAC.hasNext()) { 476 cmbAC* AC = icAC.next(); 477 if (AC->mountPoint == staID) { 478 acName = AC->name; 479 break; 480 } 481 } 482 if (acName.isEmpty()) { 483 delete newClk; 446 484 continue; 447 485 } … … 449 487 // Set the last time 450 488 // ----------------- 451 if (lastTime.undef() || clkCorr._time > lastTime) { 452 lastTime = clkCorr._time; 453 } 489 if (_lastClkCorrTime.undef() || newClk->_time > _lastClkCorrTime) { 490 _lastClkCorrTime = newClk->_time; 491 } 492 493 // Check Correction Age 494 // -------------------- 495 //if (_lastEpoTimeOK.valid() && newClk->_time <= _lastEpoTimeOK) { 496 if (_lastClkCorrTime.valid() && newClk->_time < _lastClkCorrTime) { 497 emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + newClk->_prn.toString().c_str() + 498 //QString(" %1 ").arg(_lastEpoTimeOK.timestr().c_str()).toLatin1() + "vs. old" + 499 QString(" %1 ").arg(_lastClkCorrTime.timestr().c_str()).toLatin1() + "vs. old" + 500 QString(" %1 ").arg(newClk->_time.timestr().c_str()).toLatin1(), true); 501 delete newClk; 502 continue; 503 } 504 505 // Find the corresponding data epoch or create a new one 506 // ----------------------------------------------------- 507 epoClkData* epoch = 0; 508 deque<epoClkData*>::const_iterator it; 509 for (it = _epoClkData.begin(); it != _epoClkData.end(); it++) { 510 if (newClk->_time == (*it)->_time) { 511 epoch = *it; 512 break; 513 } 514 } 515 if (epoch == 0) { 516 if (_epoClkData.empty() || newClk->_time > _epoClkData.back()->_time) { 517 epoch = new epoClkData; 518 epoch->_time = newClk->_time; 519 _epoClkData.push_back(epoch); 520 } 521 } 522 523 // Put data into the epoch 524 // ----------------------- 525 if (epoch != 0) { 526 epoch->_clkCorr.push_back(newClk); 527 } 528 else { 529 delete newClk; 530 } 531 } 532 533 // Make sure the buffer does not grow beyond any limit 534 // --------------------------------------------------- 535 const unsigned MAX_EPODATA_SIZE = 10; 536 if (_epoClkData.size() > MAX_EPODATA_SIZE) { 537 delete _epoClkData.front(); 538 _epoClkData.pop_front(); 539 } 540 541 // Process the oldest epochs 542 // ------------------------ 543 while (_epoClkData.size()) { 544 545 if(!_lastClkCorrTime.valid()) { 546 return; 547 } 548 549 const vector<t_clkCorr*>& clkCorrVec = _epoClkData.front()->_clkCorr; 550 551 bncTime epoTime = _epoClkData.front()->_time; 552 553 // Process the front epoch 554 // ----------------------- 555 if (epoTime < (_lastClkCorrTime - outWait)) { 556 processEpoch(epoTime, clkCorrVec); 557 delete _epoClkData.front(); 558 _epoClkData.pop_front(); 559 } 560 else { 561 return; 562 } 563 } 564 } 565 566 // Change the correction so that it refers to last received ephemeris 567 //////////////////////////////////////////////////////////////////////////// 568 void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) { 569 570 if (corr->_eph == lastEph) { 571 return; 572 } 573 574 ColumnVector oldXC(6); 575 ColumnVector oldVV(3); 576 if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) { 577 return; 578 } 579 580 ColumnVector newXC(6); 581 ColumnVector newVV(3); 582 if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) { 583 return; 584 } 585 586 ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3); 587 ColumnVector dV = newVV - oldVV; 588 double dC = newXC(4) - oldXC(4); 589 590 ColumnVector dRAO(3); 591 XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO); 592 593 ColumnVector dDotRAO(3); 594 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO); 595 596 QString msg = "switch corr " + corr->_prn.mid(0,3) 597 + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4); 598 599 emit newMessage(msg.toLatin1(), false); 600 601 corr->_iod = lastEph->IOD(); 602 corr->_eph = lastEph; 603 604 corr->_orbCorr->_xr += dRAO; 605 corr->_orbCorr->_dotXr += dDotRAO; 606 corr->_clkCorr->_dClk -= dC; 607 } 608 609 // Process Epoch 610 //////////////////////////////////////////////////////////////////////////// 611 void bncComb::processEpoch(bncTime epoTime, const vector<t_clkCorr*>& clkCorrVec) { 612 613 for (unsigned ii = 0; ii < clkCorrVec.size(); ii++) { 614 const t_clkCorr* clkCorr = clkCorrVec.at(ii); 615 QString staID(clkCorr->_staID.c_str()); 616 QString prn(clkCorr->_prn.toInternalString().c_str()); 617 char sys = clkCorr->_prn.system(); 454 618 455 619 // Find/Check the AC Name … … 466 630 } 467 631 } 468 if (acName.isEmpty()) {469 continue;470 }471 472 // Check Modulo Time473 // -----------------474 int sec = int(nint(clkCorr._time.gpssec()*10));475 if (sec % (_cmbSampl*10) != 0.0) {476 continue;477 }478 479 // Check Correction Age480 // --------------------481 if (_resTime.valid() && clkCorr._time <= _resTime) {482 emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + prn.mid(0,3).toLatin1() +483 QString("%1").arg(_resTime.timestr().c_str()).toLatin1() + " vs. old " +484 QString("%1").arg(clkCorr._time.timestr().c_str()).toLatin1(), true);485 continue;486 }487 632 488 633 // Create new correction 489 634 // --------------------- 490 cmbCorr* newCorr = new cmbCorr(); 491 newCorr->_prn = prn; 492 newCorr->_time = clkCorr._time; 493 newCorr->_iod = clkCorr._iod; 494 newCorr->_acName = acName; 495 newCorr->_clkCorr = clkCorr; 635 cmbCorr* newCorr = new cmbCorr(); 636 newCorr->_prn = prn; 637 newCorr->_time = clkCorr->_time; 638 newCorr->_iod = clkCorr->_iod; 639 newCorr->_acName = acName; 496 640 newCorr->_weightFactor = weigthFactor; 641 newCorr->_clkCorr = new t_clkCorr(*clkCorrVec[ii]); 497 642 498 643 // Check orbit correction … … 503 648 } 504 649 else { 505 QMap<t_prn, t_orbCorr >& storage = _orbCorrections[acName];506 if (!storage.contains(clkCorr ._prn) ||507 storage[clkCorr ._prn]._iod != newCorr->_iod) {650 QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName]; 651 if (!storage.contains(clkCorr->_prn) || 652 storage[clkCorr->_prn]->_iod != newCorr->_iod) { 508 653 delete newCorr; 509 654 continue; 510 655 } 511 656 else { 512 newCorr->_orbCorr = storage[clkCorr ._prn];657 newCorr->_orbCorr = storage[clkCorr->_prn]; 513 658 } 514 659 } … … 556 701 // ---------------------------- 557 702 if (_satCodeBiases.contains(acName)) { 558 QMap<t_prn, t_satCodeBias >& storage = _satCodeBiases[acName];559 if (storage.contains(clkCorr ._prn)) {560 newCorr->_satCodeBias = storage[clkCorr ._prn];703 QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName]; 704 if (storage.contains(clkCorr->_prn)) { 705 newCorr->_satCodeBias = storage[clkCorr->_prn]; 561 706 QMap<t_frequency::type, double> codeBiasesRefSig; 562 707 for (unsigned ii = 1; ii < cmbRefSig::cIF; ii++) { 563 t_frequency::type frqType = cmbRefSig::toFreq(sys, 708 t_frequency::type frqType = cmbRefSig::toFreq(sys, static_cast<cmbRefSig::type>(ii)); 564 709 char frqNum = t_frequency::toString(frqType)[1]; 565 char attrib = cmbRefSig::toAttrib(sys, 710 char attrib = cmbRefSig::toAttrib(sys, static_cast<cmbRefSig::type>(ii)); 566 711 QString rnxType2ch = QString("%1%2").arg(frqNum).arg(attrib); 567 for (unsigned ii = 0; ii < newCorr->_satCodeBias ._bias.size(); ii++) {568 const t_frqCodeBias& bias = newCorr->_satCodeBias ._bias[ii];712 for (unsigned ii = 0; ii < newCorr->_satCodeBias->_bias.size(); ii++) { 713 const t_frqCodeBias& bias = newCorr->_satCodeBias->_bias[ii]; 569 714 if (rnxType2ch.toStdString() == bias._rnxType2ch) { 570 715 codeBiasesRefSig[frqType] = bias._value; … … 582 727 } 583 728 } 584 newCorr->_satCodeBias ._bias.clear();729 newCorr->_satCodeBias->_bias.clear(); 585 730 } 586 731 } … … 588 733 // Store correction into the buffer 589 734 // -------------------------------- 590 QVector<cmbCorr*>& corrs = _buffer[sys][newCorr->_time].corrs; 591 corrs.push_back(newCorr); 592 } 593 594 // Process previous Epoch(s) 595 // ------------------------- 596 const double outWait = 1.0 * _cmbSampl; 735 QVector<cmbCorr*>& corrs = _buffer[sys].corrs; 736 737 QVectorIterator<cmbCorr*> itCorr(corrs); 738 bool available = false; 739 while (itCorr.hasNext()) { 740 cmbCorr* corr = itCorr.next(); 741 QString prn = corr->_prn; 742 QString acName = corr->_acName; 743 if (newCorr->_acName == acName && newCorr->_prn == prn) { 744 available = true; 745 } 746 } 747 if (!available) { 748 corrs.push_back(newCorr); 749 } 750 else { 751 delete newCorr; 752 continue; 753 } 754 } 755 756 // Process Systems of this Epoch 757 // ------------------------------ 597 758 QMapIterator<char, unsigned> itSys(_cmbSysPrn); 598 759 while (itSys.hasNext()) { 599 760 itSys.next(); 600 761 char sys = itSys.key(); 601 QListIterator<bncTime> itTime(_buffer[sys].keys()); 602 while (itTime.hasNext()) { 603 bncTime epoTime = itTime.next(); 604 if (epoTime < lastTime - outWait) { 605 _resTime = epoTime; 606 processEpoch(sys); 607 } 608 } 609 } 610 } 611 612 // Change the correction so that it refers to last received ephemeris 613 //////////////////////////////////////////////////////////////////////////// 614 void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) { 615 616 if (corr->_eph == lastEph) { 617 return; 618 } 619 620 ColumnVector oldXC(6); 621 ColumnVector oldVV(3); 622 if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) { 623 return; 624 } 625 626 ColumnVector newXC(6); 627 ColumnVector newVV(3); 628 if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) { 629 return; 630 } 631 632 ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3); 633 ColumnVector dV = newVV - oldVV; 634 double dC = newXC(4) - oldXC(4); 635 636 ColumnVector dRAO(3); 637 XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO); 638 639 ColumnVector dDotRAO(3); 640 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO); 641 642 QString msg = "switch corr " + corr->_prn.mid(0,3) 643 + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4); 644 645 emit newMessage(msg.toLatin1(), false); 646 647 corr->_iod = lastEph->IOD(); 648 corr->_eph = lastEph; 649 650 corr->_orbCorr._xr += dRAO; 651 corr->_orbCorr._dotXr += dDotRAO; 652 corr->_clkCorr._dClk -= dC; 653 } 654 655 // Process Epoch 656 //////////////////////////////////////////////////////////////////////////// 657 void bncComb::processEpoch(char sys) { 658 659 _log.clear(); 660 661 QTextStream out(&_log, QIODevice::WriteOnly); 762 _log.clear(); 763 QTextStream out(&_log, QIODevice::WriteOnly); 764 processSystem(epoTime, sys, out); 765 emit newMessage(_log, false); 766 } 767 } 768 769 void bncComb::processSystem(bncTime epoTime, char sys, QTextStream& out) { 662 770 663 771 out << "\n" << "Combination: " << sys << "\n" … … 694 802 if (_masterMissingEpochs[sys] < switchMasterAfterGap) { 695 803 out << "Missing Master, Epoch skipped" << "\n"; 696 _buffer [sys].remove(_resTime);804 _buffer.remove(sys); 697 805 emit newMessage(_log, false); 698 806 return; … … 707 815 << _masterOrbitAC[sys].toLatin1().data() << " --> " 708 816 << AC->name.toLatin1().data() << " " 709 << _resTime.datestr().c_str() << " "710 << _resTime.timestr().c_str() << "\n";817 << epoTime.datestr().c_str() << " " 818 << epoTime.timestr().c_str() << "\n"; 711 819 _masterOrbitAC[sys] = AC->name; 712 820 break; … … 723 831 ColumnVector dx; 724 832 if (_method == filter) { 725 irc = processEpoch_filter( sys, out, resCorr, dx);833 irc = processEpoch_filter(epoTime, sys, out, resCorr, dx); 726 834 } 727 835 else { 728 irc = processEpoch_singleEpoch( sys, out, resCorr, dx);836 irc = processEpoch_singleEpoch(epoTime, sys, out, resCorr, dx); 729 837 } 730 838 … … 746 854 t_frequency::type fType1 = cmbRefSig::toFreq(sys, cmbRefSig::c1); 747 855 t_frequency::type fType2 = cmbRefSig::toFreq(sys, cmbRefSig::c2); 856 if (resCorr[pp->prn]->_satCodeBias == 0) { 857 resCorr[pp->prn]->_satCodeBias = new t_satCodeBias(); 858 } 748 859 _bsx->determineSsrSatCodeBiases(pp->prn.mid(0,3), codeCoeff[fType1], codeCoeff[fType2], resCorr[pp->prn]->_satCodeBias); 749 860 } 750 861 } 751 862 } 752 out << _resTime.datestr().c_str() << " "753 << _resTime.timestr().c_str() << " ";863 out << epoTime.datestr().c_str() << " " 864 << epoTime.timestr().c_str() << " "; 754 865 out.setRealNumberNotation(QTextStream::FixedNotation); 755 866 out.setFieldWidth(8); … … 759 870 out.setFieldWidth(0); 760 871 } 761 printResults(out, resCorr); 762 dumpResults(resCorr); 763 } 764 765 // Delete Data, emit Message 766 // ------------------------- 767 _buffer[sys].remove(_resTime); 768 emit newMessage(_log, false); 872 printResults(epoTime, out, resCorr); 873 dumpResults(epoTime, resCorr); 874 } 875 // Delete Data 876 // ----------- 877 _buffer.remove(sys); 769 878 } 770 879 771 880 // Process Epoch - Filter Method 772 881 //////////////////////////////////////////////////////////////////////////// 773 t_irc bncComb::processEpoch_filter( char sys, QTextStream& out,882 t_irc bncComb::processEpoch_filter(bncTime epoTime, char sys, QTextStream& out, 774 883 QMap<QString, cmbCorr*>& resCorr, 775 884 ColumnVector& dx) { … … 795 904 // Check Satellite Positions for Outliers 796 905 // -------------------------------------- 797 if (checkOrbits( sys, out) != success) {906 if (checkOrbits(epoTime, sys, out) != success) { 798 907 return failure; 799 908 } … … 821 930 out.setRealNumberNotation(QTextStream::FixedNotation); 822 931 out.setRealNumberPrecision(3); 823 out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()932 out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() 824 933 << " Maximum Residuum " << maxRes << ' ' 825 934 << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3); … … 846 955 for (int ii = 0; ii < corrs(sys).size(); ii++) { 847 956 const cmbCorr* corr = corrs(sys)[ii]; 848 out << _resTime.datestr().c_str() << ' '849 << _resTime.timestr().c_str() << " "957 out << epoTime.datestr().c_str() << ' ' 958 << epoTime.timestr().c_str() << " " 850 959 << corr->_acName << ' ' << corr->_prn.mid(0,3); 851 960 out.setFieldWidth(10); … … 862 971 // Print results 863 972 //////////////////////////////////////////////////////////////////////////// 864 void bncComb::printResults( QTextStream& out,973 void bncComb::printResults(bncTime epoTime, QTextStream& out, 865 974 const QMap<QString, cmbCorr*>& resCorr) { 866 975 … … 873 982 ColumnVector xc(6); 874 983 ColumnVector vv(3); 875 if (eph->getCrd( _resTime, xc, vv, false) != success) {984 if (eph->getCrd(epoTime, xc, vv, false) != success) { 876 985 continue; 877 986 } 878 out << _resTime.datestr().c_str() << " "879 << _resTime.timestr().c_str() << " ";987 out << epoTime.datestr().c_str() << " " 988 << epoTime.timestr().c_str() << " "; 880 989 out.setFieldWidth(3); 881 990 out << "Full Clock " << corr->_prn.mid(0,3) << " " << corr->_iod << " "; … … 893 1002 // Send results to RTNet Decoder and directly to PPP Client 894 1003 //////////////////////////////////////////////////////////////////////////// 895 void bncComb::dumpResults( const QMap<QString, cmbCorr*>& resCorr) {1004 void bncComb::dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr) { 896 1005 897 1006 QList<t_orbCorr> orbCorrections; … … 901 1010 unsigned year, month, day, hour, minute; 902 1011 double sec; 903 _resTime.civil_date(year, month, day);904 _resTime.civil_time(hour, minute, sec);1012 epoTime.civil_date(year, month, day); 1013 epoTime.civil_time(hour, minute, sec); 905 1014 906 1015 QString outLines = QString().asprintf("* %4d %2d %2d %d %d %12.8f\n", … … 911 1020 it.next(); 912 1021 cmbCorr* corr = it.value(); 1022 913 1023 // ORBIT 914 t_orbCorr orbCorr( corr->_orbCorr);1024 t_orbCorr orbCorr(static_cast<t_orbCorr>(*corr->_orbCorr)); 915 1025 orbCorr._staID = "INTERNAL"; 916 1026 orbCorrections.push_back(orbCorr); 1027 917 1028 // CLOCK 918 t_clkCorr clkCorr( corr->_clkCorr);1029 t_clkCorr clkCorr(static_cast<t_clkCorr>(*corr->_clkCorr)); 919 1030 clkCorr._staID = "INTERNAL"; 920 1031 clkCorr._dClk = corr->_dClkResult; … … 922 1033 clkCorr._dotDotDClk = 0.0; 923 1034 clkCorrections.push_back(clkCorr); 1035 924 1036 // CODE BIASES 925 t_satCodeBias satCodeBias( corr->_satCodeBias);1037 t_satCodeBias satCodeBias(static_cast<t_satCodeBias>(*corr->_satCodeBias)); 926 1038 satCodeBias._staID = "INTERNAL"; 927 1039 satCodeBiasList.push_back(satCodeBias); … … 931 1043 corr->_eph->setClkCorr(dynamic_cast<const t_clkCorr*>(&clkCorr)); 932 1044 corr->_eph->setOrbCorr(dynamic_cast<const t_orbCorr*>(&orbCorr)); 933 if (corr->_eph->getCrd( _resTime, xc, vv, true) != success) {1045 if (corr->_eph->getCrd(epoTime, xc, vv, true) != success) { 934 1046 delete corr; 935 1047 continue; … … 940 1052 ColumnVector dx(3); dx = 0.0; 941 1053 if (_antex) { 942 double Mjd = _resTime.mjd() + _resTime.daysec()/86400.0;1054 double Mjd = epoTime.mjd() + epoTime.daysec()/86400.0; 943 1055 if (_antex->satCoMcorrection(corr->_prn, Mjd, xc.Rows(1,3), dx) != success) { 944 1056 dx = 0; … … 1034 1146 } 1035 1147 1036 ll(iObs) = (corr->_clkCorr ._dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);1148 ll(iObs) = (corr->_clkCorr->_dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0); 1037 1149 1038 1150 PP(iObs, iObs) *= 1.0 / (corr->_weightFactor * corr->_weightFactor); … … 1081 1193 // Process Epoch - Single-Epoch Method 1082 1194 //////////////////////////////////////////////////////////////////////////// 1083 t_irc bncComb::processEpoch_singleEpoch( char sys, QTextStream& out,1195 t_irc bncComb::processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out, 1084 1196 QMap<QString, cmbCorr*>& resCorr, 1085 1197 ColumnVector& dx) { … … 1087 1199 // Check Satellite Positions for Outliers 1088 1200 // -------------------------------------- 1089 if (checkOrbits( sys, out) != success) {1201 if (checkOrbits(epoTime, sys, out) != success) { 1090 1202 return failure; 1091 1203 } … … 1203 1315 out.setRealNumberNotation(QTextStream::FixedNotation); 1204 1316 out.setRealNumberPrecision(3); 1205 out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()1317 out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str() 1206 1318 << " Maximum Residuum " << maxRes << ' ' 1207 1319 << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3); … … 1218 1330 for (int ii = 0; ii < vv.Nrows(); ii++) { 1219 1331 const cmbCorr* corr = corrs(sys)[ii]; 1220 out << _resTime.datestr().c_str() << ' '1221 << _resTime.timestr().c_str() << " "1332 out << epoTime.datestr().c_str() << ' ' 1333 << epoTime.timestr().c_str() << " " 1222 1334 << corr->_acName << ' ' << corr->_prn.mid(0,3); 1223 1335 out.setFieldWidth(6); … … 1235 1347 // Check Satellite Positions for Outliers 1236 1348 //////////////////////////////////////////////////////////////////////////// 1237 t_irc bncComb::checkOrbits( char sys, QTextStream& out) {1349 t_irc bncComb::checkOrbits(bncTime epoTime, char sys, QTextStream& out) { 1238 1350 1239 1351 const double MAX_DISPLACEMENT = 0.20; … … 1283 1395 if (meanRao.find(prn) == meanRao.end()) { 1284 1396 meanRao[prn].ReSize(4); 1285 meanRao[prn].Rows(1,3) = corr->_orbCorr ._xr;1397 meanRao[prn].Rows(1,3) = corr->_orbCorr->_xr; 1286 1398 meanRao[prn](4) = 1; 1287 1399 } 1288 1400 else { 1289 meanRao[prn].Rows(1,3) += corr->_orbCorr ._xr;1401 meanRao[prn].Rows(1,3) += corr->_orbCorr->_xr; 1290 1402 meanRao[prn](4) += 1; 1291 1403 } … … 1309 1421 meanRao[prn](4) = 0; 1310 1422 } 1311 corr->_diffRao = corr->_orbCorr ._xr - meanRao[prn].Rows(1,3);1423 corr->_diffRao = corr->_orbCorr->_xr - meanRao[prn].Rows(1,3); 1312 1424 if (maxDiff.find(prn) == maxDiff.end()) { 1313 1425 maxDiff[prn] = corr; … … 1340 1452 double norm = corr->_diffRao.NormFrobenius(); 1341 1453 if (norm > MAX_DISPLACEMENT) { 1342 out << _resTime.datestr().c_str() << " "1343 << _resTime.timestr().c_str() << " "1454 out << epoTime.datestr().c_str() << " " 1455 << epoTime.timestr().c_str() << " " 1344 1456 << "Orbit Outlier: " 1345 1457 << corr->_acName.toLatin1().data() << " " … … 1374 1486 QListIterator<cmbAC*> icAC(_ACs); 1375 1487 while (icAC.hasNext()) { 1376 cmbAC *AC = icAC.next();1488 cmbAC *AC = icAC.next(); 1377 1489 if (AC->mountPoint == mountPoint) { 1378 1490 acName = AC->name; 1379 out << "Provider ID changed: AC " << AC->name.toLatin1().data() 1380 << _resTime.datestr().c_str() << " " 1381 << _resTime.timestr().c_str() <<"\n";1491 out << "Provider ID changed: AC " << AC->name.toLatin1().data() << " " 1492 // << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str() 1493 << "\n"; 1382 1494 break; 1383 1495 } … … 1392 1504 // Remove all corrections of the corresponding AC 1393 1505 // ---------------------------------------------- 1394 QListIterator<bncTime> itTime(_buffer[sys].keys()); 1395 while (itTime.hasNext()) { 1396 bncTime epoTime = itTime.next(); 1397 QVector<cmbCorr*>& corrVec = _buffer[sys][epoTime].corrs; 1398 QMutableVectorIterator<cmbCorr*> it(corrVec); 1399 while (it.hasNext()) { 1400 cmbCorr* corr = it.next(); 1401 if (acName == corr->_acName) { 1402 delete corr; 1403 it.remove(); 1404 } 1405 } 1406 } 1407 1506 QVector<cmbCorr*> &corrVec = _buffer[sys].corrs; 1507 QMutableVectorIterator<cmbCorr*> it(corrVec); 1508 while (it.hasNext()) { 1509 cmbCorr *corr = it.next(); 1510 if (acName == corr->_acName) { 1511 delete corr; 1512 it.remove(); 1513 } 1514 } 1408 1515 // Reset Satellite Offsets 1409 1516 // ----------------------- 1410 1517 if (_method == filter) { 1411 1518 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) { 1412 cmbParam * pp = _params[sys][iPar-1];1519 cmbParam *pp = _params[sys][iPar - 1]; 1413 1520 if (pp->AC == acName && pp->type == cmbParam::offACSat) { 1414 1521 pp->xx = 0.0; 1415 _QQ[sys].Row(iPar) 1522 _QQ[sys].Row(iPar) = 0.0; 1416 1523 _QQ[sys].Column(iPar) = 0.0; 1417 _QQ[sys](iPar, iPar) = pp->sig0 * pp->sig0;1524 _QQ[sys](iPar, iPar) = pp->sig0 * pp->sig0; 1418 1525 } 1419 1526 } -
trunk/BNC/src/combination/bnccomb.h
r9821 r10038 4 4 5 5 #include <fstream> 6 #include <iostream> 6 7 #include <map> 7 8 #include <newmat.h> 9 #include <deque> 8 10 #include "bncephuser.h" 9 11 #include "satObs.h" … … 20 22 Q_OBJECT 21 23 public: 22 bncComb();23 24 virtual ~bncComb(); 24 25 static bncComb* instance(); … … 42 43 43 44 private: 45 static bncComb* _instPtr; // The one, single instance 46 bncComb(); // private constructor 47 bncComb(const bncComb&); 48 bncComb& operator=(const bncComb&); 49 44 50 enum e_method{singleEpoch, filter}; 45 51 … … 85 91 cmbCorr() { 86 92 _eph = 0; 93 _orbCorr = 0; 94 _clkCorr = 0; 95 _satCodeBias = 0; 87 96 _iod = 0; 88 97 _dClkResult = 0.0; 89 98 _satCodeBiasIF = 0.0; 99 _weightFactor = 1.0; 90 100 } 91 101 ~cmbCorr() {} … … 94 104 unsigned long _iod; 95 105 t_eph* _eph; 96 t_orbCorr _orbCorr;97 t_clkCorr _clkCorr;98 t_satCodeBias 106 t_orbCorr* _orbCorr; 107 t_clkCorr* _clkCorr; 108 t_satCodeBias* _satCodeBias; 99 109 QString _acName; 100 110 double _satCodeBiasIF; … … 109 119 cmbEpoch() {} 110 120 ~cmbEpoch() { 121 clear(); 122 } 123 void clear() { 111 124 QVectorIterator<cmbCorr*> it(corrs); 112 125 while (it.hasNext()) { … … 115 128 } 116 129 QVector<cmbCorr*> corrs; 130 }; 131 132 class epoClkData { 133 public: 134 epoClkData() {} 135 ~epoClkData() { 136 for (unsigned ii = 0; ii < _clkCorr.size(); ii++) { 137 delete _clkCorr[ii]; 138 } 139 } 140 bncTime _time; 141 std::vector<t_clkCorr*> _clkCorr; 117 142 }; 118 143 … … 196 221 }; 197 222 198 199 void processEpoch(char sys); 200 t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, 201 ColumnVector& dx); 202 t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, 203 ColumnVector& dx); 223 void processEpoch(bncTime epoTime, const std::vector<t_clkCorr*>& clkCorrVec); 224 void processSystem(bncTime epoTime, char sys, QTextStream& out); 225 t_irc processEpoch_filter(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx); 226 t_irc processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx); 204 227 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP, 205 228 const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr); 206 void dumpResults( const QMap<QString, cmbCorr*>& resCorr);207 void printResults( QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);229 void dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr); 230 void printResults(bncTime epoTime, QTextStream& out, const QMap<QString, cmbCorr*>& resCorr); 208 231 void switchToLastEph(t_eph* lastEph, cmbCorr* corr); 209 t_irc checkOrbits( char sys, QTextStream& out);210 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys] [_resTime].corrs;}232 t_irc checkOrbits(bncTime epoTime, char sys, QTextStream& out); 233 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys].corrs;} 211 234 212 235 QMutex _mutex; 213 236 QList<cmbAC*> _ACs; 214 bncTime _resTime; 237 std::deque<epoClkData*> _epoClkData; 238 bncTime _lastClkCorrTime; 215 239 QMap<char, QVector<cmbParam*>> _params; 216 QMap<char, QMap<bncTime, cmbEpoch>>_buffer;240 QMap<char, cmbEpoch> _buffer; 217 241 bncRtnetDecoder* _rtnetDecoder; 218 242 QMap<char, SymmetricMatrix> _QQ; … … 227 251 int _ms; 228 252 QString _cmbRefAttributes; 229 QMap<QString, QMap<t_prn, t_orbCorr > > _orbCorrections;230 QMap<QString, QMap<t_prn, t_satCodeBias > > _satCodeBiases;253 QMap<QString, QMap<t_prn, t_orbCorr*> > _orbCorrections; 254 QMap<QString, QMap<t_prn, t_satCodeBias*> > _satCodeBiases; 231 255 bncEphUser _ephUser; 232 256 SsrCorr* _ssrCorr; -
trunk/BNC/src/satObs.h
r9567 r10038 49 49 class t_satObs { 50 50 public: 51 t_satObs() {} 51 t_satObs() { 52 _type = 0; 53 } 52 54 t_satObs(const t_satObs& old) { // copy constructor (deep copy) 53 55 _staID = old._staID; … … 62 64 * Destructor of satellite measurement storage class 63 65 */ 64 ~t_satObs() 65 { 66 ~t_satObs() { 66 67 clear(); 67 68 } … … 70 71 * Cleanup function resets all elements to initial state. 71 72 */ 72 inline void clear(void) 73 { 73 inline void clear(void) { 74 74 for (unsigned ii = 0; ii < _obs.size(); ii++) 75 75 delete _obs[ii]; … … 92 92 public: 93 93 t_orbCorr(); 94 t_orbCorr(const t_orbCorr& old) { // copy constructor (deep copy) 95 _staID = old._staID; 96 _prn = old._prn; 97 _iod = old._iod; 98 _time = old._time; 99 _updateInt = old._updateInt; 100 _system = old._system; 101 _xr = old._xr; 102 _dotXr = old._dotXr; 103 } 94 104 static void writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList); 95 105 static void readEpoch(const std::string& epoLine, std::istream& in, QList<t_orbCorr>& corrList); … … 107 117 public: 108 118 t_clkCorr(); 119 t_clkCorr(const t_clkCorr& old) { // copy constructor (deep copy) 120 _staID = old._staID; 121 _prn = old._prn; 122 _iod = old._iod; 123 _time = old._time; 124 _updateInt = old._updateInt; 125 _dClk = old._dClk; 126 _dotDClk = old._dotDClk; 127 _dotDotDClk = old._dotDotDClk; 128 } 109 129 static void writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList); 110 130 static void readEpoch(const std::string& epoLine, std::istream& in, QList<t_clkCorr>& corrList); … … 143 163 class t_satCodeBias { 144 164 public: 165 t_satCodeBias() { 166 _updateInt = 0; 167 } 168 t_satCodeBias(const t_satCodeBias& old) { // copy constructor (deep copy) 169 _staID = old._staID; 170 _prn = old._prn; 171 _time = old._time; 172 _updateInt = old._updateInt; 173 for (unsigned ii = 0; ii < old._bias.size(); ii++) { 174 _bias.push_back(old._bias[ii]); 175 } 176 } 145 177 static void writeEpoch(std::ostream* out, const QList<t_satCodeBias>& biasList); 146 178 static void readEpoch(const std::string& epoLine, std::istream& in, QList<t_satCodeBias>& biasList); … … 175 207 _yaw = 0.0; 176 208 _yawRate = 0.0; 209 } 210 t_satPhaseBias(const t_satPhaseBias& old) { // copy constructor (deep copy) 211 _staID = old._staID; 212 _prn = old._prn; 213 _time = old._time; 214 _updateInt = old._updateInt; 215 _dispBiasConstistInd = old._dispBiasConstistInd; 216 _MWConsistInd = old._MWConsistInd; 217 _yaw = old._yaw; 218 _yawRate = old._yawRate; 219 for (unsigned ii = 0; ii < old._bias.size(); ii++) { 220 _bias.push_back(old._bias[ii]); 221 } 177 222 } 178 223 static void writeEpoch(std::ostream* out, const QList<t_satPhaseBias>& biasList); … … 201 246 class t_vTec { 202 247 public: 248 t_vTec(){ 249 _updateInt = 0; 250 } 251 t_vTec(const t_vTec& old) { // copy constructor (deep copy) 252 _staID = old._staID; 253 _time = old._time; 254 _updateInt = old._updateInt; 255 for (unsigned ii = 0; ii < old._layers.size(); ii++) { 256 _layers.push_back(old._layers[ii]); 257 } 258 } 203 259 static void write(std::ostream* out, const t_vTec& vTec); 204 260 static void read(const std::string& epoLine, std::istream& in, t_vTec& vTec);
Note:
See TracChangeset
for help on using the changeset viewer.