Changeset 6100 in ntrip for trunk/BNC/src/PPP_free/pppFilter.cpp
- Timestamp:
- Sep 8, 2014, 9:02:33 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP_free/pppFilter.cpp
r6094 r6100 62 62 const double GLONASS_WEIGHT_FACTOR = 5.0; 63 63 64 #define LOG (_pppClient->log()) 65 #define OPT (_pppClient->opt()) 66 64 67 // Constructor 65 68 //////////////////////////////////////////////////////////////////////////// … … 152 155 153 156 _pppClient = pppClient; 154 _staID = pppClient->staID();155 _opt = pppClient->opt();156 157 157 _tides = new t_tides(); 158 158 … … 160 160 // ------------------------ 161 161 _antex = 0; 162 if (! _opt->_antexFileName.empty()) {163 _antex = new bncAntex( _opt->_antexFileName.c_str());162 if (!OPT->_antexFileName.empty()) { 163 _antex = new bncAntex(OPT->_antexFileName.c_str()); 164 164 } 165 165 … … 178 178 t_pppFilter::~t_pppFilter() { 179 179 delete _tides; 180 for (int ii = 0; ii < _posAverage.size(); ++ii) {181 delete _posAverage[ii];182 }183 180 delete _antex; 184 181 for (int iPar = 1; iPar <= _params.size(); iPar++) { … … 212 209 _params.push_back(new t_pppParam(t_pppParam::CRD_Z, ++nextPar, "")); 213 210 _params.push_back(new t_pppParam(t_pppParam::RECCLK, ++nextPar, "")); 214 if ( _opt->estTrp()) {211 if (OPT->estTrp()) { 215 212 _params.push_back(new t_pppParam(t_pppParam::TROPO, ++nextPar, "")); 216 213 } 217 if ( _opt->useSystem('R')) {214 if (OPT->useSystem('R')) { 218 215 _params.push_back(new t_pppParam(t_pppParam::GLONASS_OFFSET, ++nextPar, "")); 219 216 } 220 if ( _opt->useSystem('E')) {217 if (OPT->useSystem('E')) { 221 218 _params.push_back(new t_pppParam(t_pppParam::GALILEO_OFFSET, ++nextPar, "")); 222 219 } … … 228 225 pp->xx = 0.0; 229 226 if (pp->isCrd()) { 230 _QQ(iPar,iPar) = _opt->_aprSigCrd(1) * _opt->_aprSigCrd(1);227 _QQ(iPar,iPar) = OPT->_aprSigCrd(1) * OPT->_aprSigCrd(1); 231 228 } 232 229 else if (pp->type == t_pppParam::RECCLK) { 233 _QQ(iPar,iPar) = _opt->_noiseClk * _opt->_noiseClk;230 _QQ(iPar,iPar) = OPT->_noiseClk * OPT->_noiseClk; 234 231 } 235 232 else if (pp->type == t_pppParam::TROPO) { 236 _QQ(iPar,iPar) = _opt->_aprSigTrp * _opt->_aprSigTrp;233 _QQ(iPar,iPar) = OPT->_aprSigTrp * OPT->_aprSigTrp; 237 234 pp->xx = lastTrp; 238 235 } … … 253 250 254 251 if (epoData->sizeSys('G') < MINOBS) { 255 _log +="t_pppFilter::cmpBancroft: not enough data\n";252 LOG << "t_pppFilter::cmpBancroft: not enough data\n"; 256 253 return failure; 257 254 } … … 337 334 if (_antex) { 338 335 bool found; 339 phaseCenter = _antex->pco(QString( _opt->_antNameRover.c_str()), satData->eleSat, found);336 phaseCenter = _antex->pco(QString(OPT->_antNameRover.c_str()), satData->eleSat, found); 340 337 if (!found) { 341 LOG << "ANTEX: antenna >" << _opt->_antNameRover << "< not found\n";338 LOG << "ANTEX: antenna >" << OPT->_antNameRover << "< not found\n"; 342 339 } 343 340 } … … 348 345 double cose = cos(satData->eleSat); 349 346 double sine = sin(satData->eleSat); 350 antennaOffset = - _opt->_neuEccRover(1) * cosa*cose351 - _opt->_neuEccRover(2) * sina*cose352 - _opt->_neuEccRover(3) * sine;347 antennaOffset = -OPT->_neuEccRover(1) * cosa*cose 348 -OPT->_neuEccRover(2) * sina*cose 349 -OPT->_neuEccRover(3) * sine; 353 350 354 351 return satData->rho + phaseCenter + antennaOffset + clk() … … 416 413 // Use different white noise for Quick-Start mode 417 414 // ---------------------------------------------- 418 double sigCrdP_used = _opt->_noiseCrd(1);419 if ( _opt->_seedingTime > 0.0 && _opt->_seedingTime > (epoData->tt - _startTime) ) {415 double sigCrdP_used = OPT->_noiseCrd(1); 416 if ( OPT->_seedingTime > 0.0 && OPT->_seedingTime > (epoData->tt - _startTime) ) { 420 417 sigCrdP_used = 0.0; 421 418 } … … 430 427 if (pp->type == t_pppParam::CRD_X) { 431 428 if (firstCrd) { 432 if ( _opt->xyzAprRoverSet()) {433 pp->xx = _opt->_xyzAprRover[0];429 if (OPT->xyzAprRoverSet()) { 430 pp->xx = OPT->_xyzAprRover[0]; 434 431 } 435 432 else { … … 441 438 else if (pp->type == t_pppParam::CRD_Y) { 442 439 if (firstCrd) { 443 if ( _opt->xyzAprRoverSet()) {444 pp->xx = _opt->_xyzAprRover[1];440 if (OPT->xyzAprRoverSet()) { 441 pp->xx = OPT->_xyzAprRover[1]; 445 442 } 446 443 else { … … 452 449 else if (pp->type == t_pppParam::CRD_Z) { 453 450 if (firstCrd) { 454 if ( _opt->xyzAprRoverSet()) {455 pp->xx = _opt->_xyzAprRover[2];451 if (OPT->xyzAprRoverSet()) { 452 pp->xx = OPT->_xyzAprRover[2]; 456 453 } 457 454 else { … … 469 466 _QQ(iPar, jj) = 0.0; 470 467 } 471 _QQ(iPar,iPar) = _opt->_noiseClk * _opt->_noiseClk;468 _QQ(iPar,iPar) = OPT->_noiseClk * OPT->_noiseClk; 472 469 } 473 470 … … 475 472 // ------------------ 476 473 else if (pp->type == t_pppParam::TROPO) { 477 _QQ(iPar,iPar) += _opt->_noiseTrp * _opt->_noiseTrp;474 _QQ(iPar,iPar) += OPT->_noiseTrp * OPT->_noiseTrp; 478 475 } 479 476 … … 498 495 // Add New Ambiguities if necessary 499 496 // -------------------------------- 500 if ( _opt->ambLCs('G').size() || _opt->ambLCs('R').size() || _opt->ambLCs('E').size()) {497 if (OPT->ambLCs('G').size() || OPT->ambLCs('R').size() || OPT->ambLCs('E').size()) { 501 498 502 499 // Make a copy of QQ and xx, set parameter indices … … 556 553 t_pppParam* par = _params[ii-1]; 557 554 if (par->index_old == 0) { 558 _QQ(par->index, par->index) = _opt->_aprSigAmb * _opt->_aprSigAmb;555 _QQ(par->index, par->index) = OPT->_aprSigAmb * OPT->_aprSigAmb; 559 556 } 560 557 par->index_old = par->index; … … 569 566 Tracer tracer("t_pppFilter::update"); 570 567 571 _log.clear();572 573 568 _time = epoData->tt; // current epoch time 574 569 575 if (_opt->useOrbClkCorr()) { 576 _log += "Precise Point Positioning of Epoch " 577 + QByteArray(_time.timestr(1).c_str()) + 578 "\n---------------------------------------------------------------\n"; 570 if (OPT->useOrbClkCorr()) { 571 LOG << "Precise Point Positioning of Epoch " << _time.timestr(1) 572 << "\n---------------------------------------------------------------\n"; 579 573 } 580 574 else { 581 _log += "Single Point Positioning of Epoch " 582 + QByteArray(_time.timestr(1).c_str()) + 583 "\n--------------------------------------------------------------\n"; 575 LOG << "Single Point Positioning of Epoch " << _time.timestr(1) 576 << "\n--------------------------------------------------------------\n"; 584 577 } 585 578 … … 587 580 // ---------------------- 588 581 if (update_p(epoData) != success) { 589 LOG << _log.data() << endl;590 582 return failure; 591 583 } 592 593 // Remember the Epoch-specific Results for the computation of means594 // ----------------------------------------------------------------595 pppPos* newPos = new pppPos;596 newPos->time = epoData->tt;597 584 598 585 // Set Solution Vector 599 586 // ------------------- 600 ostringstream strB; 601 strB.setf(ios::fixed); 587 LOG.setf(ios::fixed); 602 588 QVectorIterator<t_pppParam*> itPar(_params); 603 589 while (itPar.hasNext()) { 604 590 t_pppParam* par = itPar.next(); 605 606 591 if (par->type == t_pppParam::RECCLK) { 607 strB<< "\n clk = " << setw(10) << setprecision(3) << par->xx608 609 592 LOG << "\n clk = " << setw(10) << setprecision(3) << par->xx 593 << " +- " << setw(6) << setprecision(3) 594 << sqrt(_QQ(par->index,par->index)); 610 595 } 611 596 else if (par->type == t_pppParam::AMB_L3) { 612 597 ++par->numEpo; 613 strB<< "\n amb " << par->prn.toAscii().data() << " = "614 615 616 617 598 LOG << "\n amb " << par->prn.toAscii().data() << " = " 599 << setw(10) << setprecision(3) << par->xx 600 << " +- " << setw(6) << setprecision(3) 601 << sqrt(_QQ(par->index,par->index)) 602 << " nEpo = " << par->numEpo; 618 603 } 619 604 else if (par->type == t_pppParam::TROPO) { 620 605 double aprTrp = delay_saast(M_PI/2.0); 621 strB << "\n trp = " << par->prn.toAscii().data() 622 << setw(7) << setprecision(3) << aprTrp << " " 623 << setw(6) << setprecision(3) << showpos << par->xx << noshowpos 624 << " +- " << setw(6) << setprecision(3) 625 << sqrt(_QQ(par->index,par->index)); 626 newPos->xnt[6] = aprTrp + par->xx; 606 LOG << "\n trp = " << par->prn.toAscii().data() 607 << setw(7) << setprecision(3) << aprTrp << " " 608 << setw(6) << setprecision(3) << showpos << par->xx << noshowpos 609 << " +- " << setw(6) << setprecision(3) 610 << sqrt(_QQ(par->index,par->index)); 627 611 } 628 612 else if (par->type == t_pppParam::GLONASS_OFFSET) { 629 strB<< "\n offGlo = " << setw(10) << setprecision(3) << par->xx630 631 613 LOG << "\n offGlo = " << setw(10) << setprecision(3) << par->xx 614 << " +- " << setw(6) << setprecision(3) 615 << sqrt(_QQ(par->index,par->index)); 632 616 } 633 617 else if (par->type == t_pppParam::GALILEO_OFFSET) { 634 strB << "\n offGal = " << setw(10) << setprecision(3) << par->xx 635 << " +- " << setw(6) << setprecision(3) 636 << sqrt(_QQ(par->index,par->index)); 637 } 638 } 639 strB << '\n'; 640 _log += strB.str().c_str(); 641 LOG << _log.data() << endl; 618 LOG << "\n offGal = " << setw(10) << setprecision(3) << par->xx 619 << " +- " << setw(6) << setprecision(3) 620 << sqrt(_QQ(par->index,par->index)); 621 } 622 } 623 624 LOG << endl; 642 625 643 626 // Final Message (both log file and screen) 644 627 // ---------------------------------------- 645 ostringstream strC; 646 strC.setf(ios::fixed); 647 strC << _staID.data() << " PPP " 648 << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " " 649 << setw(14) << setprecision(3) << x() << " +- " 650 << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " " 651 << setw(14) << setprecision(3) << y() << " +- " 652 << setw(6) << setprecision(3) << sqrt(_QQ(2,2)) << " " 653 << setw(14) << setprecision(3) << z() << " +- " 654 << setw(6) << setprecision(3) << sqrt(_QQ(3,3)); 628 LOG << OPT->_roverName << " PPP " 629 << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " " 630 << setw(14) << setprecision(3) << x() << " +- " 631 << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " " 632 << setw(14) << setprecision(3) << y() << " +- " 633 << setw(6) << setprecision(3) << sqrt(_QQ(2,2)) << " " 634 << setw(14) << setprecision(3) << z() << " +- " 635 << setw(6) << setprecision(3) << sqrt(_QQ(3,3)); 655 636 656 637 // NEU Output 657 638 // ---------- 658 if (_opt->xyzAprRoverSet()) { 659 newPos->xnt[0] = x() - _opt->_xyzAprRover[0]; 660 newPos->xnt[1] = y() - _opt->_xyzAprRover[1]; 661 newPos->xnt[2] = z() - _opt->_xyzAprRover[2]; 639 if (OPT->xyzAprRoverSet()) { 640 double xyz[3]; 641 xyz[0] = x() - OPT->_xyzAprRover[0]; 642 xyz[1] = y() - OPT->_xyzAprRover[1]; 643 xyz[2] = z() - OPT->_xyzAprRover[2]; 662 644 663 645 double ellRef[3]; 664 xyz2ell(_opt->_xyzAprRover.data(), ellRef); 665 xyz2neu(ellRef, newPos->xnt, &newPos->xnt[3]); 666 667 strC << " NEU " 668 << setw(8) << setprecision(3) << newPos->xnt[3] << " " 669 << setw(8) << setprecision(3) << newPos->xnt[4] << " " 670 << setw(8) << setprecision(3) << newPos->xnt[5] << endl; 671 672 } 673 674 LOG << strC.str() << endl; 675 676 delete newPos; 646 xyz2ell(OPT->_xyzAprRover.data(), ellRef); 647 double neu[3]; 648 xyz2neu(ellRef, xyz, neu); 649 650 LOG << " NEU " 651 << setw(8) << setprecision(3) << neu[0] << " " 652 << setw(8) << setprecision(3) << neu[1] << " " 653 << setw(8) << setprecision(3) << neu[2] << endl; 654 } 655 else { 656 LOG << endl; 657 } 677 658 678 659 _lastTimeOK = _time; // remember time of last successful update … … 695 676 if (iPhase == 1) { 696 677 if (maxResGlo > MAXRES_PHASE_GLONASS) { 697 _log += "Outlier Phase " + prnGlo + " " 698 + QByteArray::number(maxResGlo, 'f', 3) + "\n"; 678 LOG << "Outlier Phase " << prnGlo.toAscii().data() << ' ' << maxResGlo << endl; 699 679 return prnGlo; 700 680 } 701 681 else if (maxResGPS > MAXRES_PHASE_GPS) { 702 _log += "Outlier Phase " + prnGPS + " " 703 + QByteArray::number(maxResGPS, 'f', 3) + "\n"; 682 LOG << "Outlier Phase " << prnGPS.toAscii().data() << ' ' << maxResGPS << endl; 704 683 return prnGPS; 705 684 } 706 685 } 707 686 else if (iPhase == 0 && maxResGPS > MAXRES_CODE) { 708 _log += "Outlier Code " + prnGPS + " " 709 + QByteArray::number(maxResGPS, 'f', 3) + "\n"; 687 LOG << "Outlier Code " << prnGPS.toAscii().data() << ' ' << maxResGPS << endl; 710 688 return prnGPS; 711 689 } … … 894 872 if (iPhase == 1) { 895 873 ll(iObs) = satData->L3 - cmpValue(satData, true); 896 double sigL3 = 2.98 * _opt->_sigmaL1;874 double sigL3 = 2.98 * OPT->_sigmaL1; 897 875 if (satData->system() == 'R') { 898 876 sigL3 *= GLONASS_WEIGHT_FACTOR; … … 911 889 // ----------------- 912 890 else { 913 double sigP3 = 2.98 * _opt->_sigmaC1;891 double sigP3 = 2.98 * OPT->_sigmaC1; 914 892 ll(iObs) = satData->P3 - cmpValue(satData, false); 915 893 PP(iObs,iObs) = 1.0 / (sigP3 * sigP3) / (ellWgtCoef * ellWgtCoef); … … 1006 984 // First update using code observations, then phase observations 1007 985 // ------------------------------------------------------------- 1008 bool usePhase = _opt->ambLCs('G').size() || _opt->ambLCs('R').size() ||1009 _opt->ambLCs('E').size();986 bool usePhase = OPT->ambLCs('G').size() || OPT->ambLCs('R').size() || 987 OPT->ambLCs('E').size(); 1010 988 1011 989 for (int iPhase = 0; iPhase <= (usePhase ? 1 : 0); iPhase++) { … … 1074 1052 if (!usePhase || iPhase == 1) { 1075 1053 if (_outlierGPS.size() > 0 || _outlierGlo.size() > 0) { 1076 _log +="Neglected PRNs: ";1054 LOG << "Neglected PRNs: "; 1077 1055 if (!_outlierGPS.isEmpty()) { 1078 _log += _outlierGPS.last() +' ';1056 LOG << _outlierGPS.last().toAscii().data() << ' '; 1079 1057 } 1080 1058 QStringListIterator itGlo(_outlierGlo); 1081 1059 while (itGlo.hasNext()) { 1082 1060 QString prn = itGlo.next(); 1083 _log += prn +' ';1061 LOG << prn.toAscii().data() << ' '; 1084 1062 } 1085 1063 } 1086 _log += '\n'; 1087 1088 _log += strResCode + strResPhase; 1064 LOG << endl << strResCode.data() << strResPhase.data(); 1089 1065 1090 1066 return success;
Note:
See TracChangeset
for help on using the changeset viewer.