Changeset 9642 in ntrip for trunk/BNC/src/PPP
- Timestamp:
- Mar 4, 2022, 10:38:38 AM (3 years ago)
- Location:
- trunk/BNC/src/PPP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppFilter.cpp
r9641 r9642 33 33 // Constructor 34 34 //////////////////////////////////////////////////////////////////////////// 35 t_pppFilter::t_pppFilter(t_pppObsPool *obsPool) {35 t_pppFilter::t_pppFilter(t_pppObsPool *obsPool) { 36 36 _numSat = 0; 37 37 _obsPool = obsPool; 38 _refPrn 38 _refPrn = t_prn(); 39 39 _datumTrafo = new t_datumTrafo(); 40 40 } … … 49 49 //////////////////////////////////////////////////////////////////////////// 50 50 t_irc t_pppFilter::processEpoch() { 51 _numSat 51 _numSat = 0; 52 52 const double maxSolGap = 60.0; 53 53 54 54 // Vector of all Observations 55 55 // -------------------------- 56 t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch();56 t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch(); 57 57 if (!epoch) { 58 58 return failure; 59 59 } 60 vector<t_pppSatObs*> &allObs = epoch->obsVector();60 vector<t_pppSatObs*> &allObs = epoch->obsVector(); 61 61 62 62 // Time of the Epoch … … 64 64 _epoTime = epoch->epoTime(); 65 65 66 if (!_firstEpoTime.valid() || 67 !_lastEpoTimeOK.valid() || 68 (maxSolGap > 0.0 && _epoTime - _lastEpoTimeOK > maxSolGap)) { 66 if (!_firstEpoTime.valid() || !_lastEpoTimeOK.valid() 67 || (maxSolGap > 0.0 && _epoTime - _lastEpoTimeOK > maxSolGap)) { 69 68 _firstEpoTime = _epoTime; 70 69 } … … 72 71 string epoTimeStr = string(_epoTime); 73 72 74 const QMap<char, t_pppRefSat*> &refSatMap = epoch->refSatMap();73 const QMap<char, t_pppRefSat*> &refSatMap = epoch->refSatMap(); 75 74 76 75 //LOG << "processEpoch: printParams before set" << endl; … … 84 83 85 84 if (OPT->_obsModelType == OPT->DCMcodeBias || 86 85 OPT->_obsModelType == OPT->DCMphaseBias) { 87 86 #ifdef BNC_DEBUG_PPP 88 87 _parlist.printParams(_epoTime); … … 91 90 // Status Vector, Variance-Covariance Matrix 92 91 // ----------------------------------------- 93 ColumnVector 92 ColumnVector xFltOld = _xFlt; 94 93 SymmetricMatrix QFltOld = _QFlt; 95 94 setStateVectorAndVarCovMatrix(xFltOld, QFltOld); … … 99 98 bool preProcessing = false; 100 99 if (OPT->_obsModelType == OPT->DCMcodeBias || 101 100 OPT->_obsModelType == OPT->DCMphaseBias) { 102 101 preProcessing = true; 103 const QList<char> &usedSystems = _parlist.usedSystems();102 const QList<char> &usedSystems = _parlist.usedSystems(); 104 103 for (int iSys = 0; iSys < usedSystems.size(); iSys++) { 105 104 char sys = usedSystems[iSys]; … … 108 107 _refPrn = refSatMap[sys]->prn(); 109 108 } 110 vector<t_pppSatObs*> obsVector;109 vector<t_pppSatObs*> obsVector; 111 110 for (unsigned jj = 0; jj < allObs.size(); jj++) { 112 111 if (allObs[jj]->prn().system() == sys) { … … 118 117 } 119 118 if (processSystem(OPT->LCs(sys), obsVector, _refPrn, 120 119 epoch->pseudoObsIono(), preProcessing) != success) { 121 120 LOG << sys << ": processSystem != success (pre-processing)" << endl; 122 121 _xFlt = xFltOld; … … 133 132 _QFlt = QFltOld; 134 133 return success; 135 } 136 else if (!_obsPool->refSatChangeRequired()) { 134 } else if (!_obsPool->refSatChangeRequired()) { 137 135 initDatumTransformation(allObs, epoch->pseudoObsIono()); 138 136 } … … 142 140 // ------------------------------------ 143 141 preProcessing = false; 144 const QList<char> & usedSystems = _parlist.usedSystems();142 const QList<char> &usedSystems = _parlist.usedSystems(); 145 143 for (int iSys = 0; iSys < usedSystems.size(); iSys++) { 146 144 char sys = usedSystems[iSys]; … … 160 158 _datumTrafo->setFirstSystem(sys); 161 159 } 162 LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num << endl; 163 if (processSystem(OPT->LCs(sys), obsVector, _refPrn, 164 epoch->pseudoObsIono(), preProcessing) != success) { 160 LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num 161 << endl; 162 if (processSystem(OPT->LCs(sys), obsVector, _refPrn, epoch->pseudoObsIono(), 163 preProcessing) != success) { 165 164 LOG << "processSystem != success (fin-processing)" << endl; 166 165 if (OPT->_obsModelType == OPT->DCMcodeBias || 167 166 OPT->_obsModelType == OPT->DCMphaseBias) { 168 167 _xFlt = xFltOld; 169 168 _QFlt = QFltOld; … … 179 178 cmpDOP(allObs, refSatMap); 180 179 _parlist.printResult(_epoTime, _QFlt, _xFlt); 181 _lastEpoTimeOK = _epoTime; 180 _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing 182 181 return success; 183 182 } … … 185 184 // Process Selected LCs 186 185 //////////////////////////////////////////////////////////////////////////// 187 t_irc t_pppFilter::processSystem(const vector<t_lc::type>& LCs, 188 const vector<t_pppSatObs*>& obsVector, 189 const t_prn& refPrn, 190 bool pseudoObsIonoAvailable, 191 bool preProcessing) { 186 t_irc t_pppFilter::processSystem(const vector<t_lc::type> &LCs, 187 const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn, 188 bool pseudoObsIonoAvailable, bool preProcessing) { 192 189 LOG.setf(ios::fixed); 193 190 char sys = refPrn.system(); … … 202 199 } 203 200 204 ColumnVector xSav= _xFlt;205 SymmetricMatrix QSav= _QFlt;206 string 207 const vector<t_pppParam*> & params= _parlist.params();201 ColumnVector xSav = _xFlt; 202 SymmetricMatrix QSav = _QFlt; 203 string epoTimeStr = string(_epoTime); 204 const vector<t_pppParam*> ¶ms = _parlist.params(); 208 205 unsigned nPar = _parlist.nPar(); 209 206 210 unsigned usedLCs 207 unsigned usedLCs = LCs.size(); 211 208 if (OPT->_pseudoObsIono && !pseudoObsIonoAvailable) { 212 209 usedLCs -= 1; // GIM not used 213 210 } 214 211 // max Obs … … 230 227 // First-Design Matrix, Terms Observed-Computed, Weight Matrix 231 228 // ----------------------------------------------------------- 232 Matrix AA(maxObs, nPar); 233 ColumnVector ll(maxObs); 234 DiagonalMatrix PP(maxObs); PP = 0.0; 229 Matrix AA(maxObs, nPar); 230 ColumnVector ll(maxObs); 231 DiagonalMatrix PP(maxObs); 232 PP = 0.0; 235 233 236 234 int iObs = -1; 237 235 vector<t_pppSatObs*> usedObs; 238 vector<t_lc::type> 236 vector<t_lc::type> usedTypes; 239 237 240 238 // Real Observations … … 242 240 double nSat = 0; 243 241 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 244 t_pppSatObs *obs = obsVector[ii];242 t_pppSatObs *obs = obsVector[ii]; 245 243 if (iOutlier == 0 && !preProcessing) { 246 244 obs->resetOutlier(); … … 250 248 for (unsigned jj = 0; jj < usedLCs; jj++) { 251 249 const t_lc::type tLC = LCs[jj]; 252 if (tLC == t_lc::GIM) {continue;} 250 if (tLC == t_lc::GIM) { 251 continue; 252 } 253 253 ++iObs; 254 254 usedObs.push_back(obs); 255 255 usedTypes.push_back(tLC); 256 256 for (unsigned iPar = 0; iPar < nPar; iPar++) { 257 const t_pppParam *par = params[iPar];257 const t_pppParam *par = params[iPar]; 258 258 AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn); 259 259 } 260 ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1)); 260 ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) 261 - DotProduct(_x0, AA.Row(iObs + 1)); 261 262 PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC)); 262 263 } … … 271 272 } 272 273 273 if ((!iOutlier) && 274 (OPT->_obsModelType == OPT->DCMcodeBias || 275 OPT->_obsModelType == OPT->DCMphaseBias) && 276 (!preProcessing)) { 277 _datumTrafo->updateIndices(sys, iObs+1); 278 _datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, _parlist.nPar()), 1); 274 if ((!iOutlier) && (OPT->_obsModelType == OPT->DCMcodeBias || 275 OPT->_obsModelType == OPT->DCMphaseBias) && (!preProcessing)) { 276 _datumTrafo->updateIndices(sys, iObs + 1); 277 _datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, _parlist.nPar()), 1); 279 278 } 280 279 … … 283 282 if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) { 284 283 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 285 t_pppSatObs *obs = obsVector[ii];284 t_pppSatObs *obs = obsVector[ii]; 286 285 if (!obs->outlier()) { 287 286 for (unsigned jj = 0; jj < usedLCs; jj++) { … … 289 288 if (tLC == t_lc::GIM && !obs->isReference()) { 290 289 ++iObs; 291 } else {continue;} 290 } else { 291 continue; 292 } 292 293 usedObs.push_back(obs); 293 294 usedTypes.push_back(tLC); 294 295 for (unsigned iPar = 0; iPar < nPar; iPar++) { 295 const t_pppParam *par = params[iPar];296 const t_pppParam *par = params[iPar]; 296 297 AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn); 297 298 } 298 ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1)); 299 ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) 300 - DotProduct(_x0, AA.Row(iObs + 1)); 299 301 PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC)); 300 302 } … … 305 307 // Truncate matrices 306 308 // ----------------- 307 AA = AA.Rows(1, iObs +1);308 ll = ll.Rows(1, iObs +1);309 PP = PP.SymSubMatrix(1, iObs +1);309 AA = AA.Rows(1, iObs + 1); 310 ll = ll.Rows(1, iObs + 1); 311 PP = PP.SymSubMatrix(1, iObs + 1); 310 312 311 313 // Kalman update step … … 316 318 // --------------- 317 319 ColumnVector vv = AA * _xFlt - ll; 318 double maxOutlier= 0.0;319 int 320 t_lc::type maxOutlierLC 320 double maxOutlier = 0.0; 321 int maxOutlierIndex = -1; 322 t_lc::type maxOutlierLC = t_lc::dummy; 321 323 for (unsigned ii = 0; ii < usedObs.size(); ii++) { 322 324 const t_lc::type tLC = usedTypes[ii]; … … 324 326 if (res > usedObs[ii]->maxRes(tLC)) { 325 327 if (res > fabs(maxOutlier)) { 326 maxOutlier 328 maxOutlier = vv[ii]; 327 329 maxOutlierIndex = ii; 328 maxOutlierLC 330 maxOutlierLC = tLC; 329 331 } 330 332 } … … 334 336 // -------------------------------------------- 335 337 if (maxOutlierIndex > -1) { 336 t_pppSatObs *obs = usedObs[maxOutlierIndex];337 t_pppParam *par = 0;338 t_pppSatObs *obs = usedObs[maxOutlierIndex]; 339 t_pppParam *par = 0; 338 340 for (unsigned iPar = 0; iPar < nPar; iPar++) { 339 t_pppParam* hlp = params[iPar]; 340 if (hlp->type() == t_pppParam::amb && 341 hlp->prn() == obs->prn() && 342 hlp->tLC() == usedTypes[maxOutlierIndex]) { 341 t_pppParam *hlp = params[iPar]; 342 if (hlp->type() == t_pppParam::amb && hlp->prn() == obs->prn() 343 && hlp->tLC() == usedTypes[maxOutlierIndex]) { 343 344 par = hlp; 344 345 } … … 346 347 if (preProcessing) { 347 348 // for refSats no ambiguity parameter exists 348 if ((obs->prn() == refPrn) && 349 (t_lc::toString(maxOutlierLC) == "l1" || 350 t_lc::toString(maxOutlierLC) == "l2" )) { 351 _obsPool->setRefSatChangeRequired(sys, true); 352 LOG << epoTimeStr << " Outlier (" 353 << ((preProcessing) ? "pre-processing) " : "fin-processing) ") << t_lc::toString(maxOutlierLC) << ' ' 354 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << maxOutlier << endl; 355 break; 356 } 357 else { 358 obs->setOutlier(); 359 } 360 } 361 else {// fin-processing 349 if ((obs->prn() == refPrn) 350 && (t_lc::toString(maxOutlierLC) == "l1" 351 || t_lc::toString(maxOutlierLC) == "l2")) { 352 _obsPool->setRefSatChangeRequired(sys, true); 353 LOG << epoTimeStr << " Outlier (" 354 << ((preProcessing) ? "pre-processing) " : "fin-processing) ") 355 << t_lc::toString(maxOutlierLC) << ' ' << obs->prn().toString() 356 << ' ' << setw(8) << setprecision(4) << maxOutlier << endl; 357 break; 358 } else { 359 obs->setOutlier(); 360 } 361 } else { // fin-processing 362 362 LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' ' 363 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << maxOutlier << endl; 363 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) 364 << maxOutlier << endl; 364 365 if (par) { 365 366 resetAmb(par->prn(), obsVector, &QSav, &xSav); 366 } 367 else { 367 } else { 368 368 obs->setOutlier(); 369 369 } … … 377 377 for (unsigned ii = 0; ii < usedObs.size(); ii++) { 378 378 const t_lc::type tLC = usedTypes[ii]; 379 t_pppSatObs *obs = usedObs[ii];379 t_pppSatObs *obs = usedObs[ii]; 380 380 if (tLC == LCs[jj]) { 381 381 obs->setRes(tLC, vv[ii]); 382 LOG << epoTimeStr << " RES " 383 << left << setw(3) << t_lc::toString(tLC) << right << ' '; 384 if (t_lc::toString(tLC) == "Tz0") {LOG << sys << " ";} 385 else {LOG << obs->prn().toString();} 382 LOG << epoTimeStr << " RES " << left << setw(3) 383 << t_lc::toString(tLC) << right << ' '; 384 if (t_lc::toString(tLC) == "Tz0") { 385 LOG << sys << " "; 386 } else { 387 LOG << obs->prn().toString(); 388 } 386 389 LOG << setw(9) << setprecision(4) << vv[ii] << endl; 387 390 } … … 397 400 // Cycle-Slip Detection 398 401 //////////////////////////////////////////////////////////////////////////// 399 t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type>& LCs, 400 const vector<t_pppSatObs*>& obsVector, 401 const t_prn& refPrn, 402 bool preProcessing) { 402 t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type> &LCs, 403 const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn, 404 bool preProcessing) { 403 405 const double SLIP = 20.0; 404 406 char sys = refPrn.system(); 405 407 string epoTimeStr = string(_epoTime); 406 const vector<t_pppParam*> & params= _parlist.params();408 const vector<t_pppParam*> ¶ms = _parlist.params(); 407 409 unsigned nPar = _parlist.nPar(); 408 410 409 411 for (unsigned ii = 0; ii < LCs.size(); ii++) { 410 const t_lc::type &tLC = LCs[ii];412 const t_lc::type &tLC = LCs[ii]; 411 413 if (t_lc::includesPhase(tLC)) { 412 414 for (unsigned iObs = 0; iObs < obsVector.size(); iObs++) { 413 const t_pppSatObs *obs = obsVector[iObs];415 const t_pppSatObs *obs = obsVector[iObs]; 414 416 415 417 // Check set Slips and Jump Counters … … 423 425 424 426 if (obs->slip()) { 425 LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() << endl; 427 LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() 428 << endl; 426 429 slip = true; 427 430 } 428 431 429 if (_slips[obs->prn()]._obsSlipCounter != -1 && 430 _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) { 431 LOG << epoTimeStr << "cycle slip set (obsSlipCounter) " << obs->prn().toString() << endl; 432 if (_slips[obs->prn()]._obsSlipCounter != -1 433 && _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) { 434 LOG << epoTimeStr << "cycle slip set (obsSlipCounter) " 435 << obs->prn().toString() << endl; 432 436 slip = true; 433 437 } … … 435 439 _slips[obs->prn()]._obsSlipCounter = obs->slipCounter(); 436 440 } 437 if (_slips[obs->prn()]._biasJumpCounter != -1 && 438 _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) { 439 LOG << epoTimeStr << "cycle slip set (biasJumpCounter) " << obs->prn().toString() << endl; 441 if (_slips[obs->prn()]._biasJumpCounter != -1 442 && _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) { 443 LOG << epoTimeStr << "cycle slip set (biasJumpCounter) " 444 << obs->prn().toString() << endl; 440 445 slip = true; 441 446 } … … 448 453 if (preProcessing) { 449 454 _obsPool->setRefSatChangeRequired(sys, true); 450 } 451 else { 455 } else { 452 456 resetAmb(obs->prn(), obsVector); 453 457 } … … 456 460 // ----------------------- 457 461 else { 458 if (refPrn != t_prn()) {return success;} 462 if (refPrn != t_prn()) { 463 return success; 464 } 459 465 ColumnVector AA(nPar); 460 466 for (unsigned iPar = 0; iPar < nPar; iPar++) { 461 const t_pppParam *par = params[iPar];467 const t_pppParam *par = params[iPar]; 462 468 AA[iPar] = par->partial(_epoTime, obs, tLC, refPrn); 463 469 } 464 double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA); 470 double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) 471 - DotProduct(_x0, AA); 465 472 double vv = DotProduct(AA, _xFlt) - ll; 466 473 if (fabs(vv) > SLIP) { 467 LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' ' 468 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl; 474 LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) 475 << ' ' << obs->prn().toString() << ' ' << setw(8) 476 << setprecision(4) << vv << endl; 469 477 if (preProcessing) { 470 478 _obsPool->setRefSatChangeRequired(sys, true); 471 } 472 else { 479 } else { 473 480 resetAmb(obs->prn(), obsVector); 474 481 } … … 483 490 // Reset Ambiguity Parameter (cycle slip) 484 491 //////////////////////////////////////////////////////////////////////////// 485 t_irc t_pppFilter::resetAmb(t_prn prn, const vector<t_pppSatObs*> &obsVector,486 SymmetricMatrix* QSav, ColumnVector*xSav) {492 t_irc t_pppFilter::resetAmb(t_prn prn, const vector<t_pppSatObs*> &obsVector, 493 SymmetricMatrix *QSav, ColumnVector *xSav) { 487 494 488 495 t_irc irc = failure; 489 vector<t_pppParam*> ¶ms = _parlist.params();496 vector<t_pppParam*> ¶ms = _parlist.params(); 490 497 for (unsigned iPar = 0; iPar < params.size(); iPar++) { 491 t_pppParam *par = params[iPar];498 t_pppParam *par = params[iPar]; 492 499 if (par->type() == t_pppParam::amb && par->prn() == prn) { 493 500 int ind = par->indexNew(); 494 501 t_lc::type tLC = par->tLC(); 495 502 LOG << string(_epoTime) << " RESET " << par->toString() << endl; 496 delete par; par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector); 503 delete par; 504 par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector); 497 505 par->setIndex(ind); 498 506 params[iPar] = par; 499 507 for (unsigned ii = 1; ii <= params.size(); ii++) { 500 _QFlt(ii, ind +1) = 0.0;508 _QFlt(ii, ind + 1) = 0.0; 501 509 if (QSav) { 502 (*QSav)(ii, ind +1) = 0.0;503 } 504 } 505 _QFlt(ind +1,ind+1) = par->sigma0() * par->sigma0();510 (*QSav)(ii, ind + 1) = 0.0; 511 } 512 } 513 _QFlt(ind + 1, ind + 1) = par->sigma0() * par->sigma0(); 506 514 if (QSav) { 507 (*QSav)(ind +1,ind+1) = _QFlt(ind+1,ind+1);515 (*QSav)(ind + 1, ind + 1) = _QFlt(ind + 1, ind + 1); 508 516 } 509 517 _xFlt[ind] = 0.0; … … 521 529 // Add infinite noise to iono 522 530 //////////////////////////////////////////////////////////////////////////// 523 t_irc t_pppFilter::addNoiseTo Iono(char sys) {531 t_irc t_pppFilter::addNoiseToPar(t_pppParam::e_type parType, char sys) { 524 532 525 533 t_irc irc = failure; 526 vector<t_pppParam*> ¶ms = _parlist.params();534 vector<t_pppParam*> ¶ms = _parlist.params(); 527 535 for (unsigned iPar = 0; iPar < params.size(); iPar++) { 528 t_pppParam *par = params[iPar];529 if (par->type() == t_pppParam::ion&& par->prn().system() == sys) {536 t_pppParam *par = params[iPar]; 537 if (par->type() == parType && par->prn().system() == sys) { 530 538 int ind = par->indexNew(); 531 LOG << string(_epoTime) << " ADD IONO_NOISE TO " << par->prn().toString() << endl; 539 LOG << string(_epoTime) << " ADD IONO_NOISE TO " << par->prn().toString() 540 << endl; 532 541 par->setIndex(ind); 533 _QFlt(ind +1,ind+1) = par->sigma0() * par->sigma0();542 _QFlt(ind + 1, ind + 1) = par->sigma0() * par->sigma0(); 534 543 irc = success; 535 544 } … … 541 550 // Compute various DOP Values 542 551 //////////////////////////////////////////////////////////////////////////// 543 void t_pppFilter::cmpDOP(const vector<t_pppSatObs*> &obsVector,544 const QMap<char, t_pppRefSat*>&refSatMap) {552 void t_pppFilter::cmpDOP(const vector<t_pppSatObs*> &obsVector, 553 const QMap<char, t_pppRefSat*> &refSatMap) { 545 554 546 555 _dop.reset(); … … 551 560 _numSat = 0; 552 561 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 553 t_pppSatObs *obs = obsVector[ii];562 t_pppSatObs *obs = obsVector[ii]; 554 563 char sys = obs->prn().system(); 555 564 t_prn refPrn = t_prn(); … … 560 569 ++_numSat; 561 570 for (unsigned iPar = 0; iPar < numPar; iPar++) { 562 const t_pppParam *par = _parlist.params()[iPar];563 AA[_numSat -1][iPar] = par->partial(_epoTime, obs, t_lc::c1, refPrn);571 const t_pppParam *par = _parlist.params()[iPar]; 572 AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, t_lc::c1, refPrn); 564 573 } 565 574 } … … 569 578 } 570 579 AA = AA.Rows(1, _numSat); 571 SymmetricMatrix NN; NN << AA.t() * AA; 580 SymmetricMatrix NN; 581 NN << AA.t() * AA; 572 582 SymmetricMatrix QQ = NN.i(); 573 583 574 _dop.H = sqrt(QQ(1,1) + QQ(2,2)); 575 _dop.V = sqrt(QQ(3,3)); 576 _dop.P = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3)); 577 _dop.T = sqrt(QQ(4,4)); 578 _dop.G = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3) + QQ(4,4)); 579 } 580 catch (...) { 584 _dop.H = sqrt(QQ(1, 1) + QQ(2, 2)); 585 _dop.V = sqrt(QQ(3, 3)); 586 _dop.P = sqrt(QQ(1, 1) + QQ(2, 2) + QQ(3, 3)); 587 _dop.T = sqrt(QQ(4, 4)); 588 _dop.G = sqrt(QQ(1, 1) + QQ(2, 2) + QQ(3, 3) + QQ(4, 4)); 589 } catch (...) { 581 590 } 582 591 } … … 584 593 // 585 594 //////////////////////////////////////////////////////////////////////////// 586 void t_pppFilter::predictCovCrdPart(const SymmetricMatrix &QFltOld) {587 588 const vector<t_pppParam*> ¶ms = _parlist.params();595 void t_pppFilter::predictCovCrdPart(const SymmetricMatrix &QFltOld) { 596 597 const vector<t_pppParam*> ¶ms = _parlist.params(); 589 598 if (params.size() < 3) { 590 599 return; … … 593 602 bool first = (params[0]->indexOld() < 0); 594 603 595 SymmetricMatrix Qneu(3); Qneu = 0.0; 604 SymmetricMatrix Qneu(3); 605 Qneu = 0.0; 596 606 for (unsigned ii = 0; ii < 3; ii++) { 597 const t_pppParam *par = params[ii];607 const t_pppParam *par = params[ii]; 598 608 if (first) { 599 609 Qneu[ii][ii] = par->sigma0() * par->sigma0(); 600 } 601 else { 610 } else { 602 611 Qneu[ii][ii] = par->noise() * par->noise(); 603 612 } 604 613 } 605 614 606 const t_pppStation *sta = PPP_CLIENT->staRover();615 const t_pppStation *sta = PPP_CLIENT->staRover(); 607 616 SymmetricMatrix Qxyz(3); 608 617 covariNEU_XYZ(Qneu, sta->ellApr().data(), Qxyz); 609 618 610 619 if (first) { 611 _QFlt.SymSubMatrix(1,3) = Qxyz; 612 } 613 else { 620 _QFlt.SymSubMatrix(1, 3) = Qxyz; 621 } else { 614 622 double dt = _epoTime - _firstEpoTime; 615 623 if (dt < OPT->_seedingTime) { 616 _QFlt.SymSubMatrix(1,3) = QFltOld.SymSubMatrix(1,3); 617 } 618 else { 619 _QFlt.SymSubMatrix(1,3) = QFltOld.SymSubMatrix(1,3) + Qxyz; 624 _QFlt.SymSubMatrix(1, 3) = QFltOld.SymSubMatrix(1, 3); 625 } else { 626 _QFlt.SymSubMatrix(1, 3) = QFltOld.SymSubMatrix(1, 3) + Qxyz; 620 627 } 621 628 } … … 624 631 // 625 632 //////////////////////////////////////////////////////////////////////////// 626 void t_pppFilter::setStateVectorAndVarCovMatrix(const ColumnVector &xFltOld,627 const SymmetricMatrix&QFltOld) {628 629 const vector<t_pppParam*> ¶ms = _parlist.params();633 void t_pppFilter::setStateVectorAndVarCovMatrix(const ColumnVector &xFltOld, 634 const SymmetricMatrix &QFltOld) { 635 636 const vector<t_pppParam*> ¶ms = _parlist.params(); 630 637 unsigned nPar = params.size(); 631 638 632 _QFlt.ReSize(nPar); _QFlt = 0.0; 633 _xFlt.ReSize(nPar); _xFlt = 0.0; 634 _x0.ReSize(nPar); _x0 = 0.0; 639 _QFlt.ReSize(nPar); 640 _QFlt = 0.0; 641 _xFlt.ReSize(nPar); 642 _xFlt = 0.0; 643 _x0.ReSize(nPar); 644 _x0 = 0.0; 635 645 636 646 for (unsigned ii = 0; ii < nPar; ii++) { 637 t_pppParam *par1 = params[ii];647 t_pppParam *par1 = params[ii]; 638 648 if (QFltOld.size() == 0) { 639 649 par1->resetIndex(); … … 643 653 if (iOld < 0) { 644 654 _QFlt[ii][ii] = par1->sigma0() * par1->sigma0(); // new parameter 645 } 646 else { 655 } else { 647 656 _QFlt[ii][ii] = QFltOld[iOld][iOld] + par1->noise() * par1->noise(); 648 _xFlt[ii] 657 _xFlt[ii] = xFltOld[iOld]; 649 658 for (unsigned jj = 0; jj < ii; jj++) { 650 t_pppParam *par2 = params[jj];651 int 659 t_pppParam *par2 = params[jj]; 660 int jOld = par2->indexOld(); 652 661 if (jOld >= 0) { 653 _QFlt[ii][jj] = QFltOld(iOld +1,jOld+1);662 _QFlt[ii][jj] = QFltOld(iOld + 1, jOld + 1); 654 663 } 655 664 } … … 661 670 // Compute datum transformation 662 671 //////////////////////////////////////////////////////////////////////////// 663 t_irc t_pppFilter::datumTransformation(const QMap<char, t_pppRefSat*>& refSatMap) { 672 t_irc t_pppFilter::datumTransformation( 673 const QMap<char, t_pppRefSat*> &refSatMap) { 664 674 665 675 // get last epoch 666 t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch();676 t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch(); 667 677 if (!epoch) { 668 678 LOG << "t_pppFilter::datumTransformation: !lastEpoch" << endl; … … 673 683 LOG << string(_epoTime) << " DATUM TRANSFORMATION " << endl; 674 684 675 vector<t_pppSatObs*> &allObs = epoch->obsVector();676 677 const QMap<char, t_pppRefSat*> &refSatMapLastEpoch = epoch->refSatMap();685 vector<t_pppSatObs*> &allObs = epoch->obsVector(); 686 687 const QMap<char, t_pppRefSat*> &refSatMapLastEpoch = epoch->refSatMap(); 678 688 679 689 bool pseudoObsIono = epoch->pseudoObsIono(); … … 681 691 // reset old and set new refSats in last epoch (ambiguities/GIM) 682 692 // ============================================================= 683 if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) != true) { 684 LOG << "datumTransformation: resetRefSatellitesLastEpoch != success" << endl; 693 if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) 694 != true) { 695 LOG << "datumTransformation: resetRefSatellitesLastEpoch != success" 696 << endl; 685 697 return failure; 686 698 } … … 703 715 #endif 704 716 705 const QList<char> &usedSystems = _parlist.usedSystems();717 const QList<char> &usedSystems = _parlist.usedSystems(); 706 718 for (int iSys = 0; iSys < usedSystems.size(); iSys++) { 707 719 char sys = usedSystems[iSys]; … … 720 732 unsigned usedLCs = LCs.size(); 721 733 if (OPT->_pseudoObsIono && !pseudoObsIono) { 722 734 usedLCs -= 1; // GIM not used 723 735 } 724 736 // max Obs … … 729 741 } 730 742 731 const vector<t_pppParam*> ¶ms = _parlist.params();743 const vector<t_pppParam*> ¶ms = _parlist.params(); 732 744 unsigned nPar = _parlist.nPar(); 733 745 734 Matrix 746 Matrix AA(maxObs, nPar); 735 747 736 748 // Real Observations … … 738 750 int iObs = -1; 739 751 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 740 t_pppSatObs *obs = obsVector[ii];752 t_pppSatObs *obs = obsVector[ii]; 741 753 for (unsigned jj = 0; jj < usedLCs; jj++) { 742 754 const t_lc::type tLC = LCs[jj]; 743 if (tLC == t_lc::GIM) {continue;} 755 if (tLC == t_lc::GIM) { 756 continue; 757 } 744 758 ++iObs; 745 759 for (unsigned iPar = 0; iPar < nPar; iPar++) { 746 const t_pppParam *par = params[iPar];760 const t_pppParam *par = params[iPar]; 747 761 AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn); 748 762 } … … 753 767 continue; 754 768 } 755 _datumTrafo->updateIndices(sys, iObs+1); //LOG << "AA Ncols/Nrows: " << AA.Ncols() << "/" << AA.Nrows() << " nPar: " << nPar << endl; //LOG << "AA.SubMatrix(1 .. " << iObs+1 << " , 1 .. " << nPar << ")" << endl; 756 if(_datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, nPar), 2) != success) { 769 _datumTrafo->updateIndices(sys, iObs + 1); //LOG << "AA Ncols/Nrows: " << AA.Ncols() << "/" << AA.Nrows() << " nPar: " << nPar << endl; //LOG << "AA.SubMatrix(1 .. " << iObs+1 << " , 1 .. " << nPar << ")" << endl; 770 if (_datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, nPar), 2) 771 != success) { 757 772 return failure; 758 773 } … … 766 781 //LOG << "AA2\n"; _datumTrafo->printMatrix(_datumTrafo->AA2(), _datumTrafo->numObs(), _datumTrafo->numPar()); 767 782 #endif 768 if (_datumTrafo->computeTrafoMatrix() != success) {783 if (_datumTrafo->computeTrafoMatrix() != success) { 769 784 return failure; 770 785 } … … 772 787 //LOG << "D21" << endl; _datumTrafo->printMatrix(_datumTrafo->D21(), _datumTrafo->numObs(), _datumTrafo->numPar()); 773 788 #endif 774 ColumnVector 789 ColumnVector xFltOld = _xFlt; 775 790 SymmetricMatrix QFltOld = _QFlt; 776 791 777 792 _QFlt << _datumTrafo->D21() * QFltOld * _datumTrafo->D21().t(); 778 _xFlt = 793 _xFlt = _datumTrafo->D21() * xFltOld; 779 794 780 795 #ifdef BNC_DEBUG_PPP … … 790 805 t_prn refPrnNew = refSatMap[sys]->prn(); 791 806 if (refPrnNew != refPrnOld) { 792 t_irc irc = resetAmb(refPrnOld, allObs); 793 if (OPT->_obsModelType == OPT->DCMcodeBias) {if (irc == success) {addNoiseToIono(sys);}} 807 if (resetAmb(refPrnOld, allObs) == success) { 808 if (OPT->_obsModelType == OPT->DCMcodeBias) { 809 addNoiseToPar(t_pppParam::ion, sys); 810 } else if (OPT->_obsModelType == OPT->DCMphaseBias) { 811 if (sys == 'G') { 812 addNoiseToPar(t_pppParam::pBiasG1, sys); 813 addNoiseToPar(t_pppParam::pBiasG2, sys); 814 } else if (sys == 'R') { 815 addNoiseToPar(t_pppParam::pBiasR1, sys); 816 addNoiseToPar(t_pppParam::pBiasR2, sys); 817 } else if (sys == 'E') { 818 addNoiseToPar(t_pppParam::pBiasE1, sys); 819 addNoiseToPar(t_pppParam::pBiasE2, sys); 820 } else if (sys == 'C') { 821 addNoiseToPar(t_pppParam::pBiasC1, sys); 822 addNoiseToPar(t_pppParam::pBiasC2, sys); 823 } 824 } 825 } 794 826 } 795 827 } … … 806 838 // Init datum transformation 807 839 //////////////////////////////////////////////////////////////////////////// 808 void t_pppFilter::initDatumTransformation( const std::vector<t_pppSatObs*>& allObs,809 840 void t_pppFilter::initDatumTransformation( 841 const std::vector<t_pppSatObs*> &allObs, bool pseudoObsIono) { 810 842 unsigned trafoObs = 0; 811 const QList<char> & usedSystems = _parlist.usedSystems();843 const QList<char> &usedSystems = _parlist.usedSystems(); 812 844 for (int iSys = 0; iSys < usedSystems.size(); iSys++) { 813 845 char sys = usedSystems[iSys]; … … 838 870 // 839 871 ////////////////////////////////////////////////////////////////////////////// 840 bool t_pppFilter::resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector, 841 const QMap<char, t_pppRefSat*>& refSatMap, 842 const QMap<char, t_pppRefSat*>& refSatMapLastEpoch) { 872 bool t_pppFilter::resetRefSatellitesLastEpoch( 873 std::vector<t_pppSatObs*> &obsVector, 874 const QMap<char, t_pppRefSat*> &refSatMap, 875 const QMap<char, t_pppRefSat*> &refSatMapLastEpoch) { 843 876 bool resetRefSat; 844 877 // reference satellite definition per system 845 const QList<char> &usedSystems = _parlist.usedSystems();878 const QList<char> &usedSystems = _parlist.usedSystems(); 846 879 for (int iSys = 0; iSys < usedSystems.size(); iSys++) { 847 880 resetRefSat = false; … … 856 889 vector<t_pppSatObs*>::iterator it = obsVector.begin(); 857 890 while (it != obsVector.end()) { 858 t_pppSatObs *satObs = *it;859 if 891 t_pppSatObs *satObs = *it; 892 if (satObs->prn() == newPrn) { 860 893 resetRefSat = true; 861 894 satObs->setAsReference(); … … 863 896 satObs->resetReference(); 864 897 } 865 it++;898 it++; 866 899 } 867 900 if (!resetRefSat) { -
trunk/BNC/src/PPP/pppFilter.h
r9552 r9642 195 195 void predictCovCrdPart(const SymmetricMatrix& QFltOld); 196 196 197 t_irc addNoiseTo Iono(char sys);197 t_irc addNoiseToPar(t_pppParam::e_type parType, char sys); 198 198 199 199 bool resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector, -
trunk/BNC/src/PPP/pppParlist.cpp
r9631 r9642 102 102 _noise = OPT->_noiseIon; 103 103 break; 104 case cBiasG1: case cBias R1: case cBiasE1: case cBiasC1:105 case cBiasG2: case cBias R2: case cBiasE2: case cBiasC2:104 case cBiasG1: case cBiasE1: case cBiasC1: 105 case cBiasG2: case cBiasE2: case cBiasC2: 106 106 _epoSpec = false; 107 107 _sigma0 = OPT->_aprSigCodeBias; 108 108 _noise = OPT->_noiseCodeBias; 109 109 break; 110 case pBiasG1: case pBiasR1: case pBiasE1: case pBiasC1: 111 case pBiasG2: case pBiasR2: case pBiasE2: case pBiasC2: 110 case cBiasR1: 111 case cBiasR2: 112 _epoSpec = false; 113 _sigma0 = OPT->_aprSigCodeBias; 114 _noise = 10.0 * OPT->_noiseCodeBias; 115 break; 116 case pBiasG1: case pBiasE1: case pBiasC1: 117 case pBiasG2: case pBiasE2: case pBiasC2: 112 118 _epoSpec = false; 113 119 _sigma0 = OPT->_aprSigPhaseBias; 114 120 _noise = OPT->_noisePhaseBias; 121 break; 122 case pBiasR1: 123 case pBiasR2: 124 _epoSpec = false; 125 _sigma0 = OPT->_aprSigPhaseBias; 126 _noise = 10.0 * OPT->_noisePhaseBias; 115 127 break; 116 128 }
Note:
See TracChangeset
for help on using the changeset viewer.