Changeset 2933 in ntrip for trunk/BNC/combination
- Timestamp:
- Jan 29, 2011, 3:50:06 PM (14 years ago)
- Location:
- trunk/BNC/combination
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/combination/bnccomb.cpp
r2931 r2933 15 15 * -----------------------------------------------------------------------*/ 16 16 17 #include <newmatio.h> 17 18 #include <iomanip> 18 19 … … 21 22 #include "cmbcaster.h" 22 23 #include "bncsettings.h" 24 #include "bncmodel.h" 23 25 24 26 using namespace std; 27 28 // Constructor 29 //////////////////////////////////////////////////////////////////////////// 30 cmbParam::cmbParam(cmbParam::parType typeIn, int indexIn, 31 const QString& acIn, const QString& prnIn) { 32 type = typeIn; 33 index = indexIn; 34 AC = acIn; 35 prn = prnIn; 36 xx = 0.0; 37 } 38 39 // Destructor 40 //////////////////////////////////////////////////////////////////////////// 41 cmbParam::~cmbParam() { 42 } 43 44 // Partial 45 //////////////////////////////////////////////////////////////////////////// 46 double cmbParam::partial(const QString& acIn, t_corr* corr) { 47 48 if (type == offset) { 49 if (AC == acIn && prn == corr->prn) { 50 return 1.0; 51 } 52 } 53 else if (type == clk) { 54 if (prn == corr->prn) { 55 return 1.0; 56 } 57 } 58 59 return 0.0; 60 } 61 62 25 63 26 64 // Constructor … … 46 84 47 85 _caster = new cmbCaster(); 48 49 86 connect(_caster, SIGNAL(error(const QByteArray)), 50 87 this, SLOT(slotError(const QByteArray))); 51 52 88 connect(_caster, SIGNAL(newMessage(const QByteArray)), 53 89 this, SLOT(slotMessage(const QByteArray))); 90 91 // Initialize Parameters 92 // --------------------- 93 int nextPar = 0; 94 for (int iGps = 1; iGps <= 32; iGps++) { 95 QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0')); 96 _params.push_back(new cmbParam(cmbParam::clk, ++nextPar, "", prn)); 97 QMapIterator<QString, cmbAC*> it(_ACs); 98 while (it.hasNext()) { 99 it.next(); 100 cmbAC* AC = it.value(); 101 _params.push_back(new cmbParam(cmbParam::offset, ++nextPar, AC->name,prn)); 102 } 103 } 104 105 unsigned nPar = _params.size(); 106 _QQ.ReSize(nPar); 107 _QQ = 0.0; 108 109 _sigClk0 = 100.0; 110 _sigOff0 = 100.0; 111 112 for (int iPar = 1; iPar <= _params.size(); iPar++) { 113 cmbParam* pp = _params[iPar-1]; 114 if (pp->type == cmbParam::clk) { 115 _QQ(iPar,iPar) = _sigClk0 * _sigClk0; 116 } 117 else if (pp->type == cmbParam::offset) { 118 _QQ(iPar,iPar) = _sigOff0 * _sigOff0; 119 } 120 } 54 121 } 55 122 … … 243 310 void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) { 244 311 312 // Predict Parameters Values, Add White Noise 313 // ------------------------------------------ 314 for (int iPar = 1; iPar <= _params.size(); iPar++) { 315 cmbParam* pp = _params[iPar-1]; 316 if (pp->type == cmbParam::clk) { 317 pp->xx = 0.0; 318 for (int jj = 1; jj <= _params.size(); jj++) { 319 _QQ(iPar, jj) = 0.0; 320 } 321 _QQ(iPar,iPar) = _sigClk0 * _sigClk0; 322 } 323 } 324 245 325 bncTime resTime = epochs.first()->time; 246 326 QMap<QString, t_corr*> resCorr; 247 327 328 int nPar = _params.size(); 329 int nObs = 0; 330 331 ColumnVector x0(nPar); 332 for (int iPar = 1; iPar <= _params.size(); iPar++) { 333 cmbParam* pp = _params[iPar-1]; 334 x0(iPar) = pp->xx; 335 } 336 337 // Count Observations 338 // ------------------ 248 339 QListIterator<cmbEpoch*> itEpo(epochs); 249 340 while (itEpo.hasNext()) { 250 341 cmbEpoch* epo = itEpo.next(); 251 342 QMapIterator<QString, t_corr*> itCorr(epo->corr); 252 253 343 while (itCorr.hasNext()) { 254 344 itCorr.next(); 255 t_corr* corr = itCorr.value(); 256 257 //// beg test 258 if (epo->acName == "BKG") { 259 resCorr[corr->prn] = new t_corr(*corr); 345 ++nObs; 346 } 347 } 348 349 if (nObs > 0) { 350 Matrix AA(nObs, nPar); 351 ColumnVector ll(nObs); 352 DiagonalMatrix PP(nObs); PP = 1.0; 353 354 int iObs = 0; 355 QListIterator<cmbEpoch*> itEpo(epochs); 356 while (itEpo.hasNext()) { 357 cmbEpoch* epo = itEpo.next(); 358 QMapIterator<QString, t_corr*> itCorr(epo->corr); 359 360 while (itCorr.hasNext()) { 361 itCorr.next(); 362 ++iObs; 363 t_corr* corr = itCorr.value(); 364 365 //// beg test 366 if (epo->acName == "BKG") { 367 resCorr[corr->prn] = new t_corr(*corr); 368 } 369 //// end test 370 371 for (int iPar = 1; iPar <= _params.size(); iPar++) { 372 cmbParam* pp = _params[iPar-1]; 373 AA(iObs, iPar) = pp->partial(epo->acName, corr); 374 } 375 376 ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0); 377 378 printSingleCorr(epo->acName, corr); 379 delete corr; 260 380 } 261 //// end test 262 263 printSingleCorr(epo->acName, corr); 264 delete corr; 265 } 381 } 382 383 ColumnVector dx; 384 bncModel::kalman(AA, ll, PP, _QQ, dx); 385 ColumnVector vv = ll - AA * dx; 386 387 for (int iPar = 1; iPar <= _params.size(); iPar++) { 388 cmbParam* pp = _params[iPar-1]; 389 pp->xx += dx(iPar); 390 } 391 392 cout << "ll = " << ll.t(); 393 cout << "dx = " << dx.t(); 394 cout << "vv = " << vv.t(); 395 266 396 } 267 397 -
trunk/BNC/combination/bnccomb.h
r2929 r2933 3 3 #define BNCCOMB_H 4 4 5 #include <newmat.h> 5 6 #include "bncephuser.h" 6 7 7 8 class cmbCaster; 9 10 class cmbParam { 11 public: 12 enum parType {offset, clk}; 13 cmbParam(parType typeIn, int indexIn, 14 const QString& acIn, const QString& prnIn); 15 ~cmbParam(); 16 double partial(const QString& acIn, t_corr* corr); 17 parType type; 18 int index; 19 QString AC; 20 QString prn; 21 double xx; 22 }; 8 23 9 24 class bncComb : public bncEphUser { … … 63 78 bncTime _processedBeforeTime; 64 79 cmbCaster* _caster; 80 QVector<cmbParam*> _params; 81 double _sigClk0; 82 double _sigOff0; 83 SymmetricMatrix _QQ; 65 84 }; 66 85
Note:
See TracChangeset
for help on using the changeset viewer.