- Timestamp:
- Dec 15, 2009, 9:39:21 AM (15 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncmodel.cpp
r2111 r2112 390 390 t_irc bncModel::update(t_epoData* epoData) { 391 391 392 const static double MAXRES_CODE = 10.0; 393 const static double MAXRES_PHASE = 0.10; 394 392 SymmetricMatrix QQsav; 395 393 ColumnVector dx; 396 397 bool outlier = false; 394 ColumnVector vv; 398 395 399 396 do { 400 401 outlier = false;402 397 403 398 if (epoData->size() < MINOBS) { … … 454 449 } 455 450 456 // Compute KalmanUpdate451 // Compute Filter Update 457 452 // --------------------- 458 SymmetricMatrix QQsav = _QQ; 459 Matrix ATP = AA.t() * PP; 453 QQsav = _QQ; 454 455 Matrix ATP = AA.t() * PP; 460 456 SymmetricMatrix NN = _QQ.i(); 461 NN << NN + ATP * AA; 462 _QQ = NN.i(); 463 dx = _QQ * ATP * ll; 464 465 // Outlier Detection 466 // ----------------- 467 ColumnVector vv = ll - AA * dx; 468 469 double vvMaxCode = 0.0; 470 int iMaxCode = 0; 471 double vvMaxPhase = 0.0; 472 int iMaxPhase = 0; 473 if (_usePhase) { 474 for (int ii = 1; ii <= vv.Nrows(); ii += 2) { 475 if (vvMaxCode == 0.0 || fabs(vv(ii)) > vvMaxCode) { 476 vvMaxCode = fabs(vv(ii)); 477 iMaxCode = ii; 478 } 479 if (vvMaxPhase == 0.0 || fabs(vv(ii+1)) > vvMaxPhase) { 480 vvMaxPhase = fabs(vv(ii+1)); 481 iMaxPhase = ii; 482 } 483 } 484 } 485 else { 486 for (int ii = 1; ii <= vv.Nrows(); ii++) { 487 if (vvMaxCode == 0.0 || fabs(vv(ii)) > vvMaxCode) { 488 vvMaxCode = fabs(vv(ii)); 489 iMaxCode = ii; 490 } 491 } 492 } 493 494 if (vvMaxCode > MAXRES_CODE) { 495 int iObs = 0; 496 QMutableMapIterator<QString, t_satData*> itObs(epoData->satData); 497 while (itObs.hasNext()) { 498 itObs.next(); 499 iObs += 1; 500 if (iObs == iMaxCode) { 501 QString prn = itObs.key(); 502 t_satData* satData = itObs.value(); 503 delete satData; 504 itObs.remove(); 505 _QQ = QQsav; 506 outlier = true; 507 cout << "Code " << prn.toAscii().data() << " " << vv(iObs) << endl; 508 break; 509 } 510 if (_usePhase) { 511 ++iObs; 512 } 513 } 514 } 515 else if (vvMaxPhase > MAXRES_PHASE) { 516 int iObs = 0; 517 QMutableMapIterator<QString, t_satData*> itObs(epoData->satData); 518 while (itObs.hasNext()) { 519 itObs.next(); 520 iObs += 2; 521 if (iObs == iMaxPhase) { 522 QString prn = itObs.key(); 523 t_satData* satData = itObs.value(); 524 delete satData; 525 itObs.remove(); 526 _QQ = QQsav; 527 outlier = true; 528 cout << "Code " << prn.toAscii().data() << " " << vv(iObs) << endl; 529 break; 530 } 531 } 532 } 533 534 } while (outlier); 457 NN << NN + ATP * AA; 458 _QQ = NN.i(); 459 dx = _QQ * ATP * ll; 460 vv = ll - AA * dx; 461 462 } while (outlierDetection(QQsav, vv, epoData->satData) != 0); 535 463 536 464 // Set Solution Vector … … 544 472 return success; 545 473 } 474 475 // Outlier Detection 476 //////////////////////////////////////////////////////////////////////////// 477 int bncModel::outlierDetection(const SymmetricMatrix& QQsav, 478 const ColumnVector& vv, 479 QMap<QString, t_satData*>& satData) { 480 481 const static double MAXRES_CODE = 10.0; 482 const static double MAXRES_PHASE = 0.10; 483 484 double vvMaxCode = 0.0; 485 double vvMaxPhase = 0.0; 486 QMutableMapIterator<QString, t_satData*> itMaxCode(satData); 487 QMutableMapIterator<QString, t_satData*> itMaxPhase(satData); 488 489 int ii = 0; 490 QMutableMapIterator<QString, t_satData*> it(satData); 491 while (it.hasNext()) { 492 it.next(); 493 ++ii; 494 495 if (vvMaxCode == 0.0 || fabs(vv(ii)) > vvMaxCode) { 496 vvMaxCode = fabs(vv(ii)); 497 itMaxCode = it; 498 } 499 500 if (_usePhase) { 501 ++ii; 502 if (vvMaxPhase == 0.0 || fabs(vv(ii)) > vvMaxPhase) { 503 vvMaxPhase = fabs(vv(ii)); 504 itMaxPhase = it; 505 } 506 } 507 } 508 509 if (vvMaxCode > MAXRES_CODE) { 510 QString prn = itMaxCode.key(); 511 t_satData* satData = itMaxCode.value(); 512 delete satData; 513 itMaxCode.remove(); 514 _QQ = QQsav; 515 cout << "Code " << prn.toAscii().data() << " " << vvMaxCode << endl; 516 return 1; 517 } 518 else if (vvMaxPhase > MAXRES_PHASE) { 519 QString prn = itMaxPhase.key(); 520 t_satData* satData = itMaxPhase.value(); 521 delete satData; 522 itMaxPhase.remove(); 523 _QQ = QQsav; 524 cout << "Phase " << prn.toAscii().data() << " " << vvMaxPhase << endl; 525 return 1; 526 } 527 528 return 0; 529 } -
trunk/BNC/bncmodel.h
r2110 r2112 66 66 double delay_saast(double Ele); 67 67 void predict(t_epoData* epoData); 68 int outlierDetection(const SymmetricMatrix& QQsav, 69 const ColumnVector& vv, 70 QMap<QString, t_satData*>& satData); 68 71 69 72 QVector<bncParam*> _params;
Note:
See TracChangeset
for help on using the changeset viewer.