- Timestamp:
- Jan 23, 2012, 3:28:58 PM (13 years ago)
- Location:
- trunk/BNC
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncmodel.cpp
r3540 r3636 49 49 #include "bancroft.h" 50 50 #include "bncutils.h" 51 #include "bncsettings.h"52 51 #include "bnctides.h" 53 52 #include "bncantex.h" 53 #include "pppopt.h" 54 54 55 55 using namespace std; … … 138 138 // Constructor 139 139 //////////////////////////////////////////////////////////////////////////// 140 bncModel::bncModel(QByteArray staID) { 141 142 _staID = staID; 140 bncModel::bncModel(QByteArray staID, const t_pppOpt* opt) { 141 142 _staID = staID; 143 _opt = opt; 143 144 144 145 connect(this, SIGNAL(newMessage(QByteArray,bool)), 145 146 ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool))); 146 147 147 bncSettings settings;148 149 // Observation Sigmas150 // ------------------151 _sigP3 = 5.0;152 if (!settings.value("pppSigmaCode").toString().isEmpty()) {153 _sigP3 = settings.value("pppSigmaCode").toDouble();154 }155 _sigL3 = 0.02;156 if (!settings.value("pppSigmaPhase").toString().isEmpty()) {157 _sigL3 = settings.value("pppSigmaPhase").toDouble();158 }159 160 // Parameter Sigmas161 // ----------------162 _sigCrd0 = 100.0;163 if (!settings.value("pppSigCrd0").toString().isEmpty()) {164 _sigCrd0 = settings.value("pppSigCrd0").toDouble();165 }166 _sigCrdP = 100.0;167 if (!settings.value("pppSigCrdP").toString().isEmpty()) {168 _sigCrdP = settings.value("pppSigCrdP").toDouble();169 }170 _sigTrp0 = 0.1;171 if (!settings.value("pppSigTrp0").toString().isEmpty()) {172 _sigTrp0 = settings.value("pppSigTrp0").toDouble();173 }174 _sigTrpP = 1e-6;175 if (!settings.value("pppSigTrpP").toString().isEmpty()) {176 _sigTrpP = settings.value("pppSigTrpP").toDouble();177 }178 _sigClk0 = 1000.0;179 _sigAmb0 = 1000.0;180 _sigGalileoOffset0 = 1000.0;181 _sigGalileoOffsetP = 0.0;182 183 // Quick-Start Mode184 // ----------------185 _quickStart = 0;186 if (settings.value("pppRefCrdX").toString() != "" &&187 settings.value("pppRefCrdY").toString() != "" &&188 settings.value("pppRefCrdZ").toString() != "" &&189 !settings.value("pppQuickStart").toString().isEmpty()) {190 _quickStart = settings.value("pppQuickStart").toDouble();191 }192 193 // Several options194 // ---------------195 _usePhase = false;196 if ( Qt::CheckState(settings.value("pppUsePhase").toInt()) == Qt::Checked) {197 _usePhase = true;198 }199 200 _estTropo = false;201 if ( Qt::CheckState(settings.value("pppEstTropo").toInt()) == Qt::Checked) {202 _estTropo = true;203 }204 205 _useGalileo = false;206 if ( Qt::CheckState(settings.value("pppGalileo").toInt()) == Qt::Checked) {207 _useGalileo = true;208 }209 210 148 // NMEA Output 211 149 // ----------- 212 QString nmeaFileName = settings.value("nmeaFile").toString(); 213 if (nmeaFileName.isEmpty()) { 150 if (_opt->nmeaFile.isEmpty()) { 214 151 _nmeaFile = 0; 215 152 _nmeaStream = 0; 216 153 } 217 154 else { 218 expandEnvVar( nmeaFileName);219 _nmeaFile = new QFile( nmeaFileName);220 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {155 QString hlpName = _opt->nmeaFile; expandEnvVar(hlpName); 156 _nmeaFile = new QFile(hlpName); 157 if (_opt->rnxAppend) { 221 158 _nmeaFile->open(QIODevice::WriteOnly | QIODevice::Append); 222 159 } … … 231 168 // ------------------------ 232 169 _antex = 0; 233 QString antexFileName = settings.value("pppAntex").toString(); 234 if (!antexFileName.isEmpty()) { 170 if (!_opt->antexFile.isEmpty()) { 235 171 _antex = new bncAntex(); 236 if (_antex->readFile(antexFil eName) != success) {172 if (_antex->readFile(_opt->antexFile) != success) { 237 173 emit newMessage("wrong ANTEX file", true); 238 174 delete _antex; 239 175 _antex = 0; 240 176 } 241 else { 242 _antennaName = settings.value("pppAntenna").toString(); 243 } 244 } 245 246 // Antenna Eccentricities 247 // ---------------------- 248 _dN = settings.value("pppRefdN").toDouble(); 249 _dE = settings.value("pppRefdE").toDouble(); 250 _dU = settings.value("pppRefdU").toDouble(); 177 } 251 178 252 179 // Bancroft Coordinates … … 294 221 _params.push_back(new bncParam(bncParam::CRD_Z, ++nextPar, "")); 295 222 _params.push_back(new bncParam(bncParam::RECCLK, ++nextPar, "")); 296 if (_estTropo) { 223 if (_opt->estTropo) { 297 224 _params.push_back(new bncParam(bncParam::TROPO, ++nextPar, "")); 298 225 } 299 if (_useGalileo) { 226 if (_opt->useGalileo) { 300 227 _params.push_back(new bncParam(bncParam::GALILEO_OFFSET, ++nextPar, "")); 301 228 } … … 307 234 pp->xx = 0.0; 308 235 if (pp->isCrd()) { 309 _QQ(iPar,iPar) = _sigCrd0 * _sigCrd0; 236 _QQ(iPar,iPar) = _opt->sigCrd0 * _opt->sigCrd0; 310 237 } 311 238 else if (pp->type == bncParam::RECCLK) { 312 _QQ(iPar,iPar) = _sigClk0 * _sigClk0; 239 _QQ(iPar,iPar) = _opt->sigClk0 * _opt->sigClk0; 313 240 } 314 241 else if (pp->type == bncParam::TROPO) { 315 _QQ(iPar,iPar) = _sigTrp0 * _sigTrp0; 242 _QQ(iPar,iPar) = _opt->sigTrp0 * _opt->sigTrp0; 316 243 } 317 244 else if (pp->type == bncParam::GALILEO_OFFSET) { 318 _QQ(iPar,iPar) = _sigGalileoOffset0 * _sigGalileoOffset0; 245 _QQ(iPar,iPar) = _opt->sigGalileoOffset0 * _opt->sigGalileoOffset0; 319 246 } 320 247 } … … 409 336 if (_antex) { 410 337 bool found; 411 phaseCenter = _antex->pco(_antennaName, satData->eleSat, found); 338 phaseCenter = _antex->pco(_opt->antennaName, satData->eleSat, found); 412 339 if (!found) { 413 340 emit newMessage("ANTEX: antenna >" 414 + _antennaName.toAscii() + "< not found", true); 341 + _opt->antennaName.toAscii() + "< not found", true); 415 342 } 416 343 } 417 344 418 345 double antennaOffset = 0.0; 419 if (_ dN != 0.0 || _dE != 0.0 || _dU != 0.0) {346 if (_opt->antEccSet()) { 420 347 double cosa = cos(satData->azSat); 421 348 double sina = sin(satData->azSat); 422 349 double cose = cos(satData->eleSat); 423 350 double sine = sin(satData->eleSat); 424 antennaOffset = -_dN * cosa*cose - _dE * sina*cose - _dU * sine; 351 antennaOffset = -_opt->antEccNEU[0] * cosa*cose 352 -_opt->antEccNEU[1] * sina*cose 353 -_opt->antEccNEU[2] * sine; 425 354 } 426 355 … … 478 407 if (iPhase == 0) { 479 408 480 bncSettings settings;481 482 _maxSolGap = settings.value("pppMaxSolGap").toDouble();483 484 409 bool firstCrd = false; 485 if (!_lastTimeOK.valid() || (_maxSolGap > 0 && _time - _lastTimeOK > _maxSolGap)) { 410 if (!_lastTimeOK.valid() || (_opt->maxSolGap > 0 && _time - _lastTimeOK > _opt->maxSolGap)) { 486 411 firstCrd = true; 487 412 _startTime = epoData->tt; … … 491 416 // Use different white noise for Quick-Start mode 492 417 // ---------------------------------------------- 493 double sigCrdP_used = _sigCrdP;494 if ( _quickStart > 0.0 && _quickStart > (epoData->tt - _startTime) ) { 418 double sigCrdP_used = _opt->sigCrdP; 419 if ( _opt->quickStart > 0.0 && _opt->quickStart > (epoData->tt - _startTime) ) { 495 420 sigCrdP_used = 0.0; 496 421 } … … 505 430 if (pp->type == bncParam::CRD_X) { 506 431 if (firstCrd) { 507 if (settings.value("pppRefCrdX").toString() != "" && 508 settings.value("pppRefCrdY").toString() != "" && 509 settings.value("pppRefCrdZ").toString() != "") { 510 pp->xx = settings.value("pppRefCrdX").toDouble(); 432 if (_opt->refCrdSet()) { 433 pp->xx = _opt->refCrd[0]; 511 434 } 512 435 else { … … 518 441 else if (pp->type == bncParam::CRD_Y) { 519 442 if (firstCrd) { 520 if (settings.value("pppRefCrdX").toString() != "" && 521 settings.value("pppRefCrdY").toString() != "" && 522 settings.value("pppRefCrdZ").toString() != "") { 523 pp->xx = settings.value("pppRefCrdY").toDouble(); 443 if (_opt->refCrdSet()) { 444 pp->xx = _opt->refCrd[1]; 524 445 } 525 446 else { … … 531 452 else if (pp->type == bncParam::CRD_Z) { 532 453 if (firstCrd) { 533 if (settings.value("pppRefCrdX").toString() != "" && 534 settings.value("pppRefCrdY").toString() != "" && 535 settings.value("pppRefCrdZ").toString() != "") { 536 pp->xx = settings.value("pppRefCrdZ").toDouble(); 454 if (_opt->refCrdSet()) { 455 pp->xx = _opt->refCrd[2]; 537 456 } 538 457 else { … … 550 469 _QQ(iPar, jj) = 0.0; 551 470 } 552 _QQ(iPar,iPar) = _sigClk0 * _sigClk0; 471 _QQ(iPar,iPar) = _opt->sigClk0 * _opt->sigClk0; 553 472 } 554 473 … … 556 475 // ------------------ 557 476 else if (pp->type == bncParam::TROPO) { 558 _QQ(iPar,iPar) += _sigTrpP * _sigTrpP; 477 _QQ(iPar,iPar) += _opt->sigTrpP * _opt->sigTrpP; 559 478 } 560 479 … … 562 481 // -------------- 563 482 else if (pp->type == bncParam::GALILEO_OFFSET) { 564 _QQ(iPar,iPar) += _sigGalileoOffsetP * _sigGalileoOffsetP; 483 _QQ(iPar,iPar) += _opt->sigGalileoOffsetP * _opt->sigGalileoOffsetP; 565 484 } 566 485 } … … 569 488 // Add New Ambiguities if necessary 570 489 // -------------------------------- 571 if (_usePhase) { 490 if (_opt->usePhase) { 572 491 573 492 // Make a copy of QQ and xx, set parameter indices … … 627 546 bncParam* par = _params[ii-1]; 628 547 if (par->index_old == 0) { 629 _QQ(par->index, par->index) = _sigAmb0 * _sigAmb0; 548 _QQ(par->index, par->index) = _opt->sigAmb0 * _opt->sigAmb0; 630 549 } 631 550 par->index_old = par->index; … … 640 559 Tracer tracer("bncModel::update"); 641 560 642 bncSettings settings;643 644 561 _log.clear(); 645 562 646 563 _time = epoData->tt; // current epoch time 647 564 648 if ( settings.value("pppSPP").toString() == "PPP") {565 if (_opt->pppMode) { 649 566 _log += "Precise Point Positioning of Epoch " 650 567 + QByteArray(_time.timestr(1).c_str()) + … … 724 641 // NEU Output 725 642 // ---------- 726 double xyzRef[3]; 727 728 if (settings.value("pppRefCrdX").toString() != "" && 729 settings.value("pppRefCrdY").toString() != "" && 730 settings.value("pppRefCrdZ").toString() != "") { 731 732 xyzRef[0] = settings.value("pppRefCrdX").toDouble(); 733 xyzRef[1] = settings.value("pppRefCrdY").toDouble(); 734 xyzRef[2] = settings.value("pppRefCrdZ").toDouble(); 735 736 newPos->xnt[0] = x() - xyzRef[0]; 737 newPos->xnt[1] = y() - xyzRef[1]; 738 newPos->xnt[2] = z() - xyzRef[2]; 643 if (_opt->refCrdSet()) { 644 newPos->xnt[0] = x() - _opt->refCrd[0]; 645 newPos->xnt[1] = y() - _opt->refCrd[1]; 646 newPos->xnt[2] = z() - _opt->refCrd[2]; 739 647 740 648 double ellRef[3]; 741 xyz2ell( xyzRef, ellRef);649 xyz2ell(_opt->refCrd, ellRef); 742 650 xyz2neu(ellRef, newPos->xnt, &newPos->xnt[3]); 743 651 … … 751 659 emit newMessage(QByteArray(strC.str().c_str()), true); 752 660 753 if ( settings.value("pppAverage").toString() == "") {661 if (_opt->pppAverage == 0.0) { 754 662 delete newPos; 755 663 } … … 758 666 _posAverage.push_back(newPos); 759 667 760 // Time Span for Average Computation761 // ---------------------------------762 double tRangeAverage = settings.value("pppAverage").toDouble() * 60.;763 if (tRangeAverage < 0) {764 tRangeAverage = 0;765 }766 if (tRangeAverage > 86400) {767 tRangeAverage = 86400;768 }769 770 668 // Compute the Mean 771 669 // ---------------- … … 775 673 while (it.hasNext()) { 776 674 pppPos* pp = it.next(); 777 if ( (epoData->tt - pp->time) >= tRangeAverage ) {675 if ( (epoData->tt - pp->time) >= _opt->pppAverage ) { 778 676 delete pp; 779 677 it.remove(); … … 806 704 } 807 705 808 if (settings.value("pppRefCrdX").toString() != "" && 809 settings.value("pppRefCrdY").toString() != "" && 810 settings.value("pppRefCrdZ").toString() != "") { 811 706 if (_opt->refCrdSet()) { 812 707 ostringstream strD; strD.setf(ios::fixed); 813 708 strD << _staID.data() << " AVE-XYZ " 814 709 << epoData->tt.timestr(1) << " " 815 << setw(13) << setprecision(3) << mean[0] + xyzRef[0] << " +- "710 << setw(13) << setprecision(3) << mean[0] + _opt->refCrd[0] << " +- " 816 711 << setw(6) << setprecision(3) << std[0] << " " 817 << setw(14) << setprecision(3) << mean[1] + xyzRef[1] << " +- "712 << setw(14) << setprecision(3) << mean[1] + _opt->refCrd[1] << " +- " 818 713 << setw(6) << setprecision(3) << std[1] << " " 819 << setw(14) << setprecision(3) << mean[2] + xyzRef[2] << " +- "714 << setw(14) << setprecision(3) << mean[2] + _opt->refCrd[2] << " +- " 820 715 << setw(6) << setprecision(3) << std[2]; 821 716 emit newMessage(QByteArray(strD.str().c_str()), true); … … 832 727 emit newMessage(QByteArray(strE.str().c_str()), true); 833 728 834 if ( Qt::CheckState(settings.value("pppEstTropo").toInt()) == Qt::Checked) {729 if (_opt->estTropo) { 835 730 ostringstream strF; strF.setf(ios::fixed); 836 731 strF << _staID.data() << " AVE-TRP " … … 1141 1036 if (iPhase == 1) { 1142 1037 ll(iObs) = satData->L3 - cmpValue(satData, true); 1143 double sigL3 = _sigL3; 1038 double sigL3 = _opt->sigL3; 1144 1039 if (satData->system() == 'R') { 1145 1040 sigL3 *= GLONASS_WEIGHT_FACTOR; … … 1159 1054 else { 1160 1055 ll(iObs) = satData->P3 - cmpValue(satData, false); 1161 PP(iObs,iObs) = 1.0 / (_sigP3 * _sigP3) / (ellWgtCoef * ellWgtCoef); 1056 PP(iObs,iObs) = 1.0 / (_opt->sigP3 * _opt->sigP3) / (ellWgtCoef * ellWgtCoef); 1162 1057 for (int iPar = 1; iPar <= _params.size(); iPar++) { 1163 1058 AA(iObs, iPar) = _params[iPar-1]->partial(satData, false); … … 1252 1147 // First update using code observations, then phase observations 1253 1148 // ------------------------------------------------------------- 1254 for (int iPhase = 0; iPhase <= (_usePhase ? 1 : 0); iPhase++) { 1149 for (int iPhase = 0; iPhase <= (_opt->usePhase ? 1 : 0); iPhase++) { 1255 1150 1256 1151 // Status Prediction … … 1315 1210 } 1316 1211 1317 if (!_usePhase || iPhase == 1) { 1212 if (!_opt->usePhase || iPhase == 1) { 1318 1213 if (_outlierGPS.size() > 0 || _outlierGlo.size() > 0) { 1319 1214 _log += "Neglected PRNs: "; -
trunk/BNC/bncmodel.h
r3414 r3636 36 36 class t_satData; 37 37 class bncAntex; 38 class t_pppOpt; 38 39 39 40 class bncParam { … … 57 58 Q_OBJECT 58 59 public: 59 bncModel(QByteArray staID); 60 bncModel(QByteArray staID, const t_pppOpt* opt); 60 61 ~bncModel(); 61 62 t_irc update(t_epoData* epoData); … … 135 136 }; 136 137 138 const t_pppOpt* _opt; 137 139 bncTime _time; 138 140 bncTime _lastTimeOK; … … 145 147 ColumnVector _xcBanc; 146 148 ColumnVector _ellBanc; 147 bool _usePhase;148 bool _estTropo;149 bool _useGalileo;150 149 QByteArray _log; 151 150 QFile* _nmeaFile; … … 154 153 QMap<QString, double> _windUpSum; 155 154 QVector<pppPos*> _posAverage; 156 double _quickStart;157 double _maxSolGap;158 double _sigCrd0;159 double _sigCrdP;160 double _sigTrp0;161 double _sigTrpP;162 double _sigGalileoOffset0;163 double _sigGalileoOffsetP;164 double _sigL3;165 double _sigP3;166 double _sigAmb0;167 double _sigClk0;168 double _dN;169 double _dE;170 double _dU;171 bncAntex* _antex;172 QString _antennaName;173 155 QStringList _outlierGPS; 174 156 QStringList _outlierGlo; 157 bncAntex* _antex; 175 158 }; 176 159 -
trunk/BNC/bncpppclient.cpp
r3635 r3636 66 66 67 67 _staID = staID; 68 _model = new bncModel(staID); 68 _model = new bncModel(staID, _opt); 69 69 70 70 connect(this, SIGNAL(newMessage(QByteArray,bool)), -
trunk/BNC/pppopt.cpp
r3635 r3636 50 50 bncSettings settings; 51 51 52 sig maCode= settingsToDouble("pppSigmaCode", 5.0);53 sig maPhase= settingsToDouble("pppSigmaPhase", 0.02);52 sigP3 = settingsToDouble("pppSigmaCode", 5.0); 53 sigL3 = settingsToDouble("pppSigmaPhase", 0.02); 54 54 sigCrd0 = settingsToDouble("pppSigCrd0", 100.0); 55 55 sigCrdP = settingsToDouble("pppSigCrdP", 100.0); … … 65 65 quickStart = settingsToDouble("pppQuickStart"); 66 66 corrSync = settingsToDouble("pppSync"); 67 pppAverage = settingsToDouble("pppAverage") * 60.0; 68 if (pppAverage < 0.0) { 69 pppAverage = 0.0; 70 } 71 else if (pppAverage > 86400.0) { 72 pppAverage = 86400.0; 73 } 67 74 68 75 pppCorrMount = settings.value("pppCorrMount").toString(); … … 80 87 if (!refCrdSet()) quickStart = 0.0; 81 88 if (!pppMode) corrSync = 0.0; 89 90 sigGalileoOffset0 = 1000.0; 91 sigGalileoOffsetP = 0.0; 92 sigClk0 = 1000.0; 93 sigAmb0 = 1000.0; 82 94 } 83 95 -
trunk/BNC/pppopt.h
r3633 r3636 32 32 t_pppOpt(); 33 33 ~t_pppOpt(); 34 bool refCrdSet() { 34 bool refCrdSet() const { 35 35 return refCrd[0] != 0.0 || refCrd[1] != 0 || refCrd[2] != 0.0; 36 36 } 37 double sigmaCode; 38 double sigmaPhase; 37 bool antEccSet() const { 38 return antEccNEU[0] != 0.0 || antEccNEU[1] != 0.0 || antEccNEU[2] != 0.0; 39 } 40 double sigL3; 41 double sigP3; 39 42 double sigCrd0; 40 43 double sigCrdP; … … 46 49 double quickStart; 47 50 double corrSync; 51 double pppAverage; 48 52 QString pppCorrMount; 49 53 QString nmeaFile; … … 56 60 bool useGlonass; 57 61 bool useGalileo; 62 double sigGalileoOffset0; 63 double sigGalileoOffsetP; 64 double sigAmb0; 65 double sigClk0; 58 66 private: 59 67 double settingsToDouble(const QByteArray& keyName, double defaultValue = 0.0) const;
Note:
See TracChangeset
for help on using the changeset viewer.