- Timestamp:
- Sep 22, 2011, 4:58:48 PM (13 years ago)
- Location:
- trunk/BNC/combination
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/combination/bnccomb.cpp
r3447 r3448 35 35 const double sig0_offACSat = 100.0; 36 36 const double sigP_offACSat = 0.0; 37 const double sig0_clkSat = 10.0; 38 const double sigP_clkSat = 0.1; 39 40 const double sigObs = 0.05; 37 const double sig0_clkSat = 100.0; 38 const double sigP_clkSat = 100.0; 41 39 42 40 const int MAXPRN_GPS = 32; … … 54 52 prn = prn_; 55 53 xx = 0.0; 56 eph = 0;57 54 58 55 if (type == offAC) { … … 186 183 } 187 184 185 // Not yet regularized 186 // ------------------- 187 _firstReg = false; 188 188 189 // Maximal Residuum 189 190 // ---------------- … … 337 338 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO); 338 339 339 QString msg = "switch corr" + corr->prn340 QString msg = "switch " + corr->prn 340 341 + QString(" %1 -> %2 %3").arg(corr->iod,3) 341 342 .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4); … … 355 356 356 357 int nPar = _params.size(); 358 int nObs = corrs().size(); 359 360 if (nObs == 0) { 361 return; 362 } 357 363 358 364 _log.clear(); … … 383 389 ColumnVector x0(nPar); 384 390 for (int iPar = 1; iPar <= _params.size(); iPar++) { 385 cmbParam* pp = _params[iPar-1]; 386 QString prn = pp->prn; 387 if (!prn.isEmpty() && _eph.find(prn) != _eph.end()) { 388 switchToLastEph(_eph[prn]->last, pp); 389 } 391 cmbParam* pp = _params[iPar-1]; 390 392 if (pp->epoSpec) { 391 393 pp->xx = 0.0; … … 400 402 } 401 403 404 // Create First Design Matrix and Vector of Measurements 405 // ----------------------------------------------------- 406 const double Pl = 1.0 / (0.05 * 0.05); 407 408 const int nCon = (_firstReg == false) ? 1 + MAXPRN_GPS : 1; 409 Matrix AA(nObs+nCon, nPar); AA = 0.0; 410 ColumnVector ll(nObs+nCon); ll = 0.0; 411 DiagonalMatrix PP(nObs+nCon); PP = Pl; 412 413 int iObs = 0; 414 415 QMap<QString, t_corr*> resCorr; 416 417 QVectorIterator<cmbCorr*> itCorr(corrs()); 418 while (itCorr.hasNext()) { 419 cmbCorr* corr = itCorr.next(); 420 QString prn = corr->prn; 421 switchToLastEph(_eph[prn]->last, corr); 422 ++iObs; 423 424 if (resCorr.find(prn) == resCorr.end()) { 425 resCorr[prn] = new t_corr(*corr); 426 } 427 428 for (int iPar = 1; iPar <= _params.size(); iPar++) { 429 cmbParam* pp = _params[iPar-1]; 430 AA(iObs, iPar) = pp->partial(corr->acName, prn); 431 } 432 433 ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0); 434 } 435 436 // Regularization 437 // -------------- 438 const double Ph = 1.e6; 439 int iCond = 1; 440 PP(nObs+iCond) = Ph; 441 for (int iPar = 1; iPar <= _params.size(); iPar++) { 442 cmbParam* pp = _params[iPar-1]; 443 if (pp->type == cmbParam::clkSat && 444 AA.Column(iPar).maximum_absolute_value() > 0.0) { 445 AA(nObs+iCond, iPar) = 1.0; 446 } 447 } 448 449 if (!_firstReg) { 450 _firstReg = true; 451 for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) { 452 ++iCond; 453 QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0')); 454 PP(nObs+1+iGps) = Ph; 455 for (int iPar = 1; iPar <= _params.size(); iPar++) { 456 cmbParam* pp = _params[iPar-1]; 457 if (pp->type == cmbParam::offACSat && pp->prn == prn) { 458 AA(nObs+iCond, iPar) = 1.0; 459 } 460 } 461 } 462 } 463 464 ColumnVector dx; 402 465 SymmetricMatrix QQ_sav = _QQ; 403 466 404 ColumnVector dx;405 QMap<QString, t_corr*> resCorr;406 407 467 // Update and outlier detection loop 408 468 // --------------------------------- 409 while (true) { 410 411 Matrix AA; 412 ColumnVector ll; 413 DiagonalMatrix PP; 414 415 if (createAmat(AA, ll, PP, x0, resCorr) != success) { 416 return; 417 } 418 469 for (int ii = 1; ii < 10; ii++) { 419 470 bncModel::kalman(AA, ll, PP, _QQ, dx); 420 471 ColumnVector vv = ll - AA * dx; … … 442 493 out << " Outlier" << endl; 443 494 _QQ = QQ_sav; 444 corrs().remove(maxResIndex-1); 495 AA.Row(maxResIndex) = 0.0; 496 ll.Row(maxResIndex) = 0.0; 445 497 } 446 498 else { … … 637 689 } 638 690 } 639 640 // Create First Design Matrix and Vector of Measurements641 ////////////////////////////////////////////////////////////////////////////642 t_irc bncComb::createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,643 const ColumnVector& x0,644 QMap<QString, t_corr*>& resCorr) {645 646 unsigned nPar = _params.size();647 unsigned nObs = corrs().size();648 649 if (nObs == 0) {650 return failure;651 }652 653 const int nCon = 2;654 655 AA.ReSize(nObs+nCon, nPar); AA = 0.0;656 ll.ReSize(nObs+nCon); ll = 0.0;657 PP.ReSize(nObs+nCon); PP = 1.0 / (sigObs * sigObs);658 659 int iObs = 0;660 661 QVectorIterator<cmbCorr*> itCorr(corrs());662 while (itCorr.hasNext()) {663 cmbCorr* corr = itCorr.next();664 QString prn = corr->prn;665 switchToLastEph(_eph[prn]->last, corr);666 ++iObs;667 668 if (resCorr.find(prn) == resCorr.end()) {669 resCorr[prn] = new t_corr(*corr);670 }671 672 for (int iPar = 1; iPar <= _params.size(); iPar++) {673 cmbParam* pp = _params[iPar-1];674 AA(iObs, iPar) = pp->partial(corr->acName, prn);675 }676 677 ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);678 }679 680 // Regularization681 // --------------682 const double Ph = 1.e6;683 PP(nObs+1) = Ph;684 PP(nObs+2) = Ph;685 for (int iPar = 1; iPar <= _params.size(); iPar++) {686 cmbParam* pp = _params[iPar-1];687 if (pp->type == cmbParam::clkSat) {688 AA(nObs+1, iPar) = 1.0;689 }690 else if (pp->type == cmbParam::offAC) {691 AA(nObs+2, iPar) = 1.0;692 }693 }694 695 return success;696 }697 698 // Change the parameter so that it refers to last received ephemeris699 ////////////////////////////////////////////////////////////////////////////700 void bncComb::switchToLastEph(const t_eph* lastEph, cmbParam* pp) {701 702 if (pp->type != cmbParam::clkSat) {703 return;704 }705 706 if (pp->eph == 0) {707 pp->eph = lastEph;708 return;709 }710 711 if (pp->eph == lastEph) {712 return;713 }714 715 ColumnVector oldXC(4);716 ColumnVector oldVV(3);717 pp->eph->position(_resTime.gpsw(), _resTime.gpssec(),718 oldXC.data(), oldVV.data());719 720 ColumnVector newXC(4);721 ColumnVector newVV(3);722 lastEph->position(_resTime.gpsw(), _resTime.gpssec(),723 newXC.data(), newVV.data());724 725 double dC = newXC(4) - oldXC(4);726 727 QString msg = "switch param " + pp->prn728 + QString(" %1 -> %2 %3").arg(pp->eph->IOD(),3)729 .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);730 731 emit newMessage(msg.toAscii(), false);732 733 pp->eph = lastEph;734 pp->xx -= dC * t_CST::c;735 }736 -
trunk/BNC/combination/bnccomb.h
r3442 r3448 26 26 double sigP; 27 27 bool epoSpec; 28 const t_eph* eph;29 28 }; 30 29 … … 74 73 75 74 void processEpoch(); 76 t_irc createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,77 const ColumnVector& x0, QMap<QString, t_corr*>& resCorr);78 75 void dumpResults(const QMap<QString, t_corr*>& resCorr); 79 76 void printResults(QTextStream& out, const QMap<QString, t_corr*>& resCorr); 80 77 void switchToLastEph(const t_eph* lastEph, t_corr* corr); 81 void switchToLastEph(const t_eph* lastEph, cmbParam* pp);82 78 83 79 QVector<cmbCorr*>& corrs() {return _buffer[_resTime].corrs;} … … 89 85 bncRtnetDecoder* _rtnetDecoder; 90 86 SymmetricMatrix _QQ; 87 bool _firstReg; 91 88 QByteArray _log; 92 89 bncAntex* _antex;
Note:
See TracChangeset
for help on using the changeset viewer.