Changeset 8905 in ntrip for trunk/BNC/src/PPP
- Timestamp:
- Mar 18, 2020, 11:13:50 AM (5 years ago)
- Location:
- trunk/BNC/src/PPP
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppClient.cpp
r8453 r8905 55 55 _obsPool = new t_pppObsPool(); 56 56 _staRover = new t_pppStation(); 57 _filter = new t_pppFilter( );57 _filter = new t_pppFilter(_obsPool); 58 58 _tides = new t_tides(); 59 59 _antex = 0; 60 60 if (!_opt->_antexFileName.empty()) { 61 61 _antex = new bncAntex(_opt->_antexFileName.c_str()); 62 62 } 63 else {64 _antex = 0;65 }66 67 63 if (!_opt->_blqFileName.empty()) { 68 _loading = new t_loading(_opt->_blqFileName.c_str()); 69 } 70 else { 71 _loading = 0; 72 } 73 64 if (_tides->readBlqFile(_opt->_blqFileName.c_str()) == success) { 65 //_tides->printAllBlqSets(); 66 } 67 } 68 69 if (OPT->_refSatRequired) { 70 for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) { 71 char system = OPT->systems()[iSys]; 72 _obsPool->initRefSatMapElement(system); 73 } 74 } 75 _offGG = 0.0; 74 76 CLIENTS.setLocalData(this); // CLIENTS takes ownership over "this" 75 77 } … … 80 82 delete _log; 81 83 delete _opt; 84 delete _filter; 82 85 delete _ephPool; 83 86 delete _obsPool; … … 86 89 delete _antex; 87 90 } 88 delete _filter;89 91 delete _tides; 90 if (_loading) {91 delete _loading;92 }93 92 clearObs(); 94 93 } … … 157 156 t_irc t_pppClient::prepareObs(const vector<t_satObs*>& satObs, 158 157 vector<t_pppSatObs*>& obsVector, bncTime& epoTime) { 158 159 159 // Default 160 160 // ------- … … 176 176 } 177 177 178 // (re)set reference satellites per system if required 179 // --------------------------------------------------- 180 if (_opt->_refSatRequired) { 181 // reference satellite definition per system 182 for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) { 183 char system = OPT->systems()[iSys]; 184 bool refSatDefined = false; 185 t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system); 186 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 187 const t_pppSatObs* satObs = obsVector.at(ii); 188 // reference satellite is unchanged 189 if (!_obsPool->epoReProcessing() && refSat->prn() == satObs->prn()) { 190 refSatDefined = true; 191 obsVector[ii]->setAsReference(); 192 refSat->setStatus(t_pppRefSat::unchanged); 193 } 194 // reference satellite has changed 195 else if (_obsPool->epoReProcessing() && refSat->prn() != satObs->prn()) { 196 if (satObs->prn().system() == system) { 197 refSatDefined = true; 198 obsVector[ii]->setAsReference(); 199 refSat->setStatus(t_pppRefSat::changed); 200 refSat->setPrn(satObs->prn()); 201 } 202 } 203 if (refSatDefined) { 204 break; 205 } 206 } 207 // reference satellite has to be initialized 208 if (!refSatDefined) { 209 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 210 const t_pppSatObs* satObs = obsVector.at(ii); 211 if (satObs->prn().system() == system) { 212 obsVector[ii]->setAsReference(); 213 refSat->setStatus(t_pppRefSat::initialized); 214 refSat->setPrn(satObs->prn()); 215 } 216 } 217 } 218 } 219 _obsPool->setEpoReProcessing(false); //TODO: später erst nach Trafo false setzen 220 } 221 178 222 // Check whether data are synchronized, compute epoTime 179 223 // ---------------------------------------------------- … … 202 246 } 203 247 248 // 249 ////////////////////////////////////////////////////////////////////////////// 250 bool t_pppClient::preparePseudoObs(std::vector<t_pppSatObs*>& obsVector) { 251 252 bool pseudoObsIono = false; 253 254 if (OPT->_pseudoObsIono) { 255 vector<t_pppSatObs*>::iterator it = obsVector.begin(); 256 while (it != obsVector.end()) { 257 t_pppSatObs* satObs = *it; 258 char system = satObs->prn().system(); 259 t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system); 260 double stecRef = refSat->stecValue(); 261 if (stecRef && !satObs->isReference()) { 262 pseudoObsIono = true; 263 satObs->setPseudoObsIono(t_frequency::G1, stecRef); 264 } 265 satObs->printObsMinusComputed(); 266 it++; 267 } 268 } 269 270 return pseudoObsIono; 271 } 272 204 273 // Compute the Bancroft position, check for blunders 205 274 ////////////////////////////////////////////////////////////////////////////// … … 250 319 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 251 320 const t_pppSatObs* satObs = obsVector.at(ii); 252 if ( satObs->isValid() && satObs->prn().system() == 'G' && 253 (!satObs->modelSet() || satObs->eleSat() >= OPT->_minEle) ) { 321 if (satObs->isValid() && 322 satObs->prn().system() == 'G' && 323 (!satObs->modelSet() || satObs->eleSat() >= OPT->_minEle) ) { 254 324 ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3); 255 double res = rr. norm_Frobenius() - satObs->obsValue(tLC)325 double res = rr.NormFrobenius() - satObs->obsValue(tLC) 256 326 - (satObs->xc()[3] - xyzc[3]) * t_CST::c; 257 327 if (std::isnan(res) || fabs(res) > maxRes) { … … 393 463 t_irc t_pppClient::cmpModel(t_pppStation* station, const ColumnVector& xyzc, 394 464 vector<t_pppSatObs*>& obsVector) { 395 396 465 bncTime time; 397 466 time = _epoTimeRover; 398 467 station->setName(OPT->_roverName); 399 468 station->setAntName(OPT->_antNameRover); 469 station->setEpochTime(time); 400 470 if (OPT->xyzAprRoverSet()) { 401 471 station->setXyzApr(OPT->_xyzAprRover); … … 412 482 // Tides 413 483 // ----- 414 station->setTideDspl( _tides->displacement(time, station->xyzApr()) ); 415 416 // Ionosphere 417 // ---------- 418 station->setIonoEpochTime(time); 484 station->setTideDsplEarth(_tides->earth(time, station->xyzApr())); 485 station->setTideDsplOcean(_tides->ocean(time, station->xyzApr(), station->name())); 419 486 420 487 // Observation model … … 430 497 satObs->eleSat() >= OPT->_minEle && 431 498 modelSetup == success) { 499 if (satObs->isReference() && OPT->_pseudoObsIono) { 500 char system = satObs->prn().system(); 501 t_pppRefSat* refSat = _obsPool->getRefSatMapElement(system); 502 refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1)); 503 } 432 504 ++it; 433 505 } … … 447 519 try { 448 520 initOutput(output); 449 450 // Prepare Observations of the Rover 451 // --------------------------------- 452 if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) { 453 return finish(failure); 454 } 455 456 LOG << "\nPPP of Epoch "; 457 if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover); 458 LOG << "\n---------------------------------------------------------------\n"; 459 460 for (int iter = 1; iter <= 2; iter++) { 461 ColumnVector xyzc(4); xyzc = 0.0; 462 bool print = (iter == 2); 463 if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) { 521 _num = 0; 522 _obsPool->setEpoReProcessing(false); // initialize for epoch 523 524 do { 525 _num++; 526 527 // Prepare Observations of the Rover 528 // --------------------------------- 529 if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) { 464 530 return finish(failure); 465 531 } 466 if (cmpModel(_staRover, xyzc, _obsRover) != success) { 532 533 LOG << "\nPPP of Epoch "; 534 if (!_epoTimeRover.undef()) LOG << string(_epoTimeRover); 535 LOG << "\n---------------------------------------------------------------\n"; 536 537 for (int iter = 1; iter <= 2; iter++) { 538 ColumnVector xyzc(4); xyzc = 0.0; 539 bool print = (iter == 2); 540 if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) { 541 return finish(failure); 542 } 543 if (cmpModel(_staRover, xyzc, _obsRover) != success) { 544 return finish(failure); 545 } 546 } 547 548 _offGG = cmpOffGG(_obsRover); 549 550 // Prepare Pseudo Observations of the Rover 551 // ---------------------------------------- 552 _pseudoObsIono = preparePseudoObs(_obsRover);//qDebug() << "_pseudoObsIonoAvailable: " << _pseudoObsIono; 553 554 if (int(_obsRover.size()) < OPT->_minObs) { 555 LOG << "t_pppClient::processEpoch not enough observations" << endl; 467 556 return finish(failure); 468 557 } 469 } 470 471 _offGG = cmpOffGG(_obsRover); 472 473 if (int(_obsRover.size()) < OPT->_minObs) { 474 LOG << "t_pppClient::processEpoch not enough observations" << endl; 475 return finish(failure); 476 } 477 478 // Store last epoch of data 479 // ------------------------ 480 _obsPool->putEpoch(_epoTimeRover, _obsRover); 481 482 // Process Epoch in Filter 483 // ----------------------- 484 if (_filter->processEpoch(_obsPool) != success) { 485 return finish(failure); 486 } 558 559 if (OPT->_refSatRequired) { 560 LOG.setf(ios::fixed); 561 QMapIterator<char, t_pppRefSat*> it(_obsPool->getRefSatMap()); 562 while (it.hasNext()) { 563 it.next(); 564 char sys = it.key(); 565 string prn = it.value()->prn().toString(); 566 LOG << string(_epoTimeRover) << " REFSAT " << sys << ": " << prn << endl; 567 } 568 } 569 570 // Store last epoch of data 571 // ------------------------ 572 //_obsRover.resize(2); 573 _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono); 574 575 // Process Epoch in Filter 576 // ----------------------- 577 if (_filter->processEpoch(_num) != success) { 578 return finish(failure); 579 } 580 // if num > 1 und !obsPool->epoReProcessing() => filter ->datumTransformation 581 } while (_obsPool->epoReProcessing()); 487 582 } 488 583 catch (Exception& exc) { … … 588 683 void t_pppClient::reset() { 589 684 590 // to delete all parameters591 delete _filter;592 _filter = new t_pppFilter();593 594 685 // to delete old orbit and clock corrections 595 686 delete _ephPool; … … 599 690 delete _obsPool; 600 691 _obsPool = new t_pppObsPool(); 601 } 692 693 // to delete all parameters 694 delete _filter; 695 _filter = new t_pppFilter(_obsPool); 696 697 } -
trunk/BNC/src/PPP/pppClient.h
r7996 r8905 10 10 11 11 class bncAntex; 12 class t_pppRefSat; 12 13 13 14 namespace BNC_PPP { … … 34 35 const t_pppEphPool* ephPool() const {return _ephPool;} 35 36 const t_pppObsPool* obsPool() const {return _obsPool;} 36 const bncAntex* antex() const {return _antex;}37 const bncAntex* antex() const {return _antex;} 37 38 const t_pppStation* staRover() const {return _staRover;} 38 double offGG() const {return _offGG;}39 double offGG() const {return _offGG;} 39 40 40 41 std::ostringstream& log() {return *_log;} … … 53 54 t_irc prepareObs(const std::vector<t_satObs*>& satObs, 54 55 std::vector<t_pppSatObs*>& obsVector, bncTime& epoTime); 56 bool preparePseudoObs(std::vector<t_pppSatObs*>& obsVector); 55 57 t_irc cmpModel(t_pppStation* station, const ColumnVector& xyzc, 56 58 std::vector<t_pppSatObs*>& obsVector); … … 71 73 t_pppOptions* _opt; 72 74 t_tides* _tides; 73 t_loading* _loading; 75 bool _pseudoObsIono; 76 int _num; 74 77 }; 75 78 -
trunk/BNC/src/PPP/pppFilter.cpp
r8329 r8905 34 34 // Constructor 35 35 //////////////////////////////////////////////////////////////////////////// 36 t_pppFilter::t_pppFilter( ) {36 t_pppFilter::t_pppFilter(t_pppObsPool* obsPool) { 37 37 _parlist = 0; 38 _numSat = 0; 39 _obsPool = obsPool; 38 40 } 39 41 … … 46 48 // Process Single Epoch 47 49 //////////////////////////////////////////////////////////////////////////// 48 t_irc t_pppFilter::processEpoch(t_pppObsPool* obsPool) { 49 50 t_irc t_pppFilter::processEpoch(int num) { 50 51 _numSat = 0; 51 52 const double maxSolGap = 60.0; … … 57 58 // Vector of all Observations 58 59 // -------------------------- 59 t_pppObsPool::t_epoch* epoch = obsPool->lastEpoch();60 t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch(); 60 61 if (!epoch) { 61 62 return failure; … … 75 76 string epoTimeStr = string(_epoTime); 76 77 78 //-- 77 79 // Set Parameters 78 80 // -------------- … … 91 93 for (unsigned ii = 0; ii < params.size(); ii++) { 92 94 const t_pppParam* par1 = params[ii]; 93 94 95 _x0[ii] = par1->x0(); 95 96 96 int iOld = par1->indexOld(); 97 97 if (iOld < 0) { … … 113 113 predictCovCrdPart(QFltOld); 114 114 115 116 // Pre-Process Satellite Systems separately 117 // ---------------------------------------- 118 bool preProcessing = false; 119 if (OPT->_obsModelType == OPT->DCMcodeBias || 120 OPT->_obsModelType == OPT->DCMphaseBias) { 121 preProcessing = true; 122 for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) { 123 char system = OPT->systems()[iSys]; 124 t_prn refPrn = (_obsPool->getRefSatMapElement(system))->prn(); 125 vector<t_pppSatObs*> obsVector; 126 for (unsigned jj = 0; jj < allObs.size(); jj++) { 127 if (allObs[jj]->prn().system() == system) { 128 obsVector.push_back(allObs[jj]); 129 } 130 } 131 if (processSystem(OPT->LCs(system), obsVector, refPrn, 132 epoch->pseudoObsIono(), preProcessing) != success) { 133 return failure; 134 } 135 } 136 } 137 115 138 // Process Satellite Systems separately 116 139 // ------------------------------------ 117 140 for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) { 118 141 char system = OPT->systems()[iSys]; 142 t_prn refPrn = (_obsPool->getRefSatMapElement(system))->prn(); 119 143 unsigned int num = 0; 120 144 vector<t_pppSatObs*> obsVector; … … 126 150 } 127 151 LOG << epoTimeStr << " SATNUM " << system << ' ' << right << setw(2) << num << endl; 128 if ( processSystem(OPT->LCs(system), obsVector) != success ) { 152 if (processSystem(OPT->LCs(system), obsVector, refPrn, 153 epoch->pseudoObsIono(), preProcessing) != success) { 129 154 return failure; 130 155 } 131 156 } 132 133 cmpDOP(allObs); 134 135 _parlist->printResult(_epoTime, _QFlt, _xFlt); 136 _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing 157 if (_obsPool->epoReProcessing()) { 158 // set A1 und A2 abhängig von num 159 // if num == 1 => A1 160 // if num > 1 => A2 161 } 162 else { 163 cmpDOP(allObs); 164 _parlist->printResult(_epoTime, _QFlt, _xFlt); 165 _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing 166 } 167 137 168 return success; 138 169 } … … 141 172 //////////////////////////////////////////////////////////////////////////// 142 173 t_irc t_pppFilter::processSystem(const vector<t_lc::type>& LCs, 143 const vector<t_pppSatObs*>& obsVector) { 144 174 const vector<t_pppSatObs*>& obsVector, 175 const t_prn& refPrn, 176 bool pseudoObsIonoAvailable, 177 bool preProcessing) { 178 qDebug() << "======t_pppFilter::processSystem======="; 145 179 LOG.setf(ios::fixed); 146 180 147 181 // Detect Cycle Slips 148 182 // ------------------ 149 if (detectCycleSlips(LCs, obsVector ) != success) {183 if (detectCycleSlips(LCs, obsVector, refPrn, preProcessing) != success) { 150 184 return failure; 151 185 } 152 186 153 ColumnVector xSav = _xFlt; 154 SymmetricMatrix QSav = _QFlt; 155 string epoTimeStr = string(_epoTime); 187 unsigned usedLCs = LCs.size(); //qDebug() << "usedLCs: " << usedLCs; 188 if (OPT->_pseudoObsIono && !pseudoObsIonoAvailable) { 189 usedLCs -= 1; // GIM not used 190 } 191 ColumnVector xSav = _xFlt; 192 SymmetricMatrix QSav = _QFlt; 193 string epoTimeStr = string(_epoTime); 156 194 const vector<t_pppParam*>& params = _parlist->params(); 157 unsigned maxObs = obsVector.size() * LCs.size(); 195 unsigned maxObs = obsVector.size() * usedLCs; 196 //unsigned maxObs = 2 * usedLCs; 197 198 if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) { // stecDiff w.r.t refSat 199 maxObs -= 1; 200 } 201 qDebug() << "par.size() : " << _parlist->nPar() << " LCs.size(): " << usedLCs; 202 qDebug() << "obsVector.size(): " << obsVector.size() << " maxObs : " << maxObs; 158 203 159 204 // Outlier Detection Loop 160 205 // ---------------------- 161 206 for (unsigned iOutlier = 0; iOutlier < maxObs; iOutlier++) { 207 qDebug() << "iOutlier: " << iOutlier; 162 208 163 209 if (iOutlier > 0) { … … 168 214 // First-Design Matrix, Terms Observed-Computed, Weight Matrix 169 215 // ----------------------------------------------------------- 216 qDebug() << "A(" << maxObs << "," << _parlist->nPar() << ")"; 170 217 Matrix AA(maxObs, _parlist->nPar()); 171 218 ColumnVector ll(maxObs); 172 219 DiagonalMatrix PP(maxObs); PP = 0.0; 220 //TETSPLOT 221 for (unsigned iPar = 0; iPar < params.size(); iPar++) { 222 const t_pppParam* par = params[iPar]; 223 cout << " " << par->toString() <<endl; 224 } 225 cout << endl; 173 226 174 227 int iObs = -1; … … 176 229 vector<t_lc::type> usedTypes; 177 230 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 178 t_pppSatObs* obs = obsVector[ii]; 231 t_pppSatObs* obs = obsVector[ii]; qDebug() << "SATELLITE: " << obs->prn().toString().c_str() << "isRef: " << obs->isReference(); 179 232 if (!obs->outlier()) { 180 for (unsigned jj = 0; jj < LCs.size(); jj++) {233 for (unsigned jj = 0; jj < usedLCs; jj++) { 181 234 const t_lc::type tLC = LCs[jj]; 235 if (tLC == t_lc::GIM && obs->isReference()) {continue;} 182 236 ++iObs; 183 237 usedObs.push_back(obs); … … 186 240 const t_pppParam* par = params[iPar]; 187 241 AA[iObs][iPar] = par->partial(_epoTime, obs, tLC); 242 cout << setw(10) << par->partial(_epoTime, obs, tLC); 188 243 } 244 cout << endl; 189 245 ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1)); 190 246 PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC)); 247 //qDebug() << "ll[iObs]: " << ll[iObs]; 248 //qDebug() << "PP[iObs]: " << PP[iObs]; 191 249 } 192 250 } … … 229 287 t_pppSatObs* obs = usedObs[maxOutlierIndex]; 230 288 t_pppParam* par = 0; 231 LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' ' 232 << obs->prn().toString() << ' ' 233 << setw(8) << setprecision(4) << maxOutlier << endl; 289 if (!preProcessing) { 290 LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' ' 291 << obs->prn().toString() << ' ' 292 << setw(8) << setprecision(4) << maxOutlier << endl; 293 } 234 294 for (unsigned iPar = 0; iPar < params.size(); iPar++) { 235 295 t_pppParam* hlp = params[iPar]; 236 if (hlp->type() == t_pppParam::amb && hlp->prn() == obs->prn() && 296 if (hlp->type() == t_pppParam::amb && 297 hlp->prn() == obs->prn() && 237 298 hlp->tLC() == usedTypes[maxOutlierIndex]) { 238 299 par = hlp; 239 300 } 240 301 } 241 if (par) { 302 if (par && preProcessing) { 303 if (par->prn() == refPrn) { 304 _obsPool->setEpoReProcessing(true); 305 } 306 } 307 else if (par && !preProcessing) { 242 308 if (par->ambResetCandidate()) { 243 309 resetAmb(par->prn(), obsVector, &QSav, &xSav); … … 248 314 } 249 315 } 250 else {316 else if (!par && !preProcessing){ 251 317 obs->setOutlier(); 252 318 } … … 256 322 // --------------- 257 323 else { 258 for (unsigned jj = 0; jj < LCs.size(); jj++) { 259 for (unsigned ii = 0; ii < usedObs.size(); ii++) { 260 const t_lc::type tLC = usedTypes[ii]; 261 t_pppSatObs* obs = usedObs[ii]; 262 if (tLC == LCs[jj]) { 263 obs->setRes(tLC, vv[ii]); 264 LOG << epoTimeStr << " RES " 265 << left << setw(3) << t_lc::toString(tLC) << right << ' ' 266 << obs->prn().toString().substr(0,3) << ' ' 267 << setw(8) << setprecision(4) << vv[ii] << endl; 324 if (!preProcessing) { 325 for (unsigned jj = 0; jj < LCs.size(); jj++) { 326 for (unsigned ii = 0; ii < usedObs.size(); ii++) { 327 const t_lc::type tLC = usedTypes[ii]; 328 t_pppSatObs* obs = usedObs[ii]; 329 if (tLC == LCs[jj]) { 330 obs->setRes(tLC, vv[ii]); 331 LOG << epoTimeStr << " RES " 332 << left << setw(3) << t_lc::toString(tLC) << right << ' ' 333 << obs->prn().toString().substr(0,3) << ' ' 334 << setw(8) << setprecision(4) << vv[ii] << endl; 335 } 268 336 } 269 337 } … … 279 347 //////////////////////////////////////////////////////////////////////////// 280 348 t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type>& LCs, 281 const vector<t_pppSatObs*>& obsVector) { 349 const vector<t_pppSatObs*>& obsVector, 350 const t_prn& refPrn, 351 bool preProcessing) { 282 352 283 353 const double SLIP = 20.0; // slip threshold 284 354 string epoTimeStr = string(_epoTime); 285 const vector<t_pppParam*>& params 355 const vector<t_pppParam*>& params = _parlist->params(); 286 356 287 357 for (unsigned ii = 0; ii < LCs.size(); ii++) { … … 294 364 // --------------------------------- 295 365 bool slip = false; 296 297 366 if (obs->slip()) { 298 367 LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() << endl; … … 312 381 slip = true; 313 382 } 314 _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();315 383 316 384 // Slip Set 317 385 // -------- 318 386 if (slip) { 319 resetAmb(obs->prn(), obsVector); 320 } 321 387 if (preProcessing) { 388 if (obs->prn() == refPrn) { 389 _obsPool->setEpoReProcessing(true); 390 } 391 } 392 else { 393 resetAmb(obs->prn(), obsVector); 394 } 395 } 322 396 // Check Pre-Fit Residuals 323 397 // ----------------------- … … 328 402 AA[iPar] = par->partial(_epoTime, obs, tLC); 329 403 } 330 331 404 double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA); 332 405 double vv = DotProduct(AA, _xFlt) - ll; 333 334 406 if (fabs(vv) > SLIP) { 335 LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' ' 336 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl; 337 resetAmb(obs->prn(), obsVector); 407 if (preProcessing) { 408 if (obs->prn() == refPrn) { 409 _obsPool->setEpoReProcessing(true); 410 } 411 } 412 else { 413 LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' ' 414 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl; 415 resetAmb(obs->prn(), obsVector); 416 } 338 417 } 339 418 } -
trunk/BNC/src/PPP/pppFilter.h
r7928 r8905 17 17 class t_pppFilter { 18 18 public: 19 t_pppFilter( );19 t_pppFilter(t_pppObsPool* obsPool); 20 20 ~t_pppFilter(); 21 21 22 t_irc processEpoch( t_pppObsPool* obsPool);22 t_irc processEpoch(int num); 23 23 24 24 const ColumnVector& x() const {return _xFlt;} … … 74 74 75 75 t_irc processSystem(const std::vector<t_lc::type>& LCs, 76 const std::vector<t_pppSatObs*>& obsVector); 76 const std::vector<t_pppSatObs*>& obsVector, 77 const t_prn& refPrn, 78 bool pseudoObsIonoAvailable, 79 bool preProcessing); 77 80 78 81 t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs, 79 const std::vector<t_pppSatObs*>& obsVector); 82 const std::vector<t_pppSatObs*>& obsVector, 83 const t_prn& refPrn, 84 bool preProcessing); 80 85 81 86 t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector, … … 88 93 bncTime _epoTime; 89 94 t_pppParlist* _parlist; 95 t_pppObsPool* _obsPool; 90 96 SymmetricMatrix _QFlt; 91 97 ColumnVector _xFlt; -
trunk/BNC/src/PPP/pppObsPool.cpp
r7643 r8905 22 22 // Constructor 23 23 ///////////////////////////////////////////////////////////////////////////// 24 t_pppObsPool::t_epoch::t_epoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector) { 25 _epoTime = epoTime; 24 t_pppObsPool::t_epoch::t_epoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector, 25 bool pseudoObsIono) { 26 _epoTime = epoTime; 27 _pseudoObsIono = pseudoObsIono; 26 28 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 27 29 _obsVector.push_back(obsVector[ii]); … … 48 50 } 49 51 _vTec = 0; 52 _epoReProcessing = false; 50 53 } 51 54 … … 64 67 _epochs.pop_front(); 65 68 } 69 clearRefSatMap(); 66 70 } 67 71 … … 92 96 // 93 97 ///////////////////////////////////////////////////////////////////////////// 94 void t_pppObsPool::putEpoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector) { 98 void t_pppObsPool::putEpoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector, 99 bool pseudoObsIono) { 95 100 const unsigned MAXSIZE = 2; 96 _epochs.push_back(new t_epoch(epoTime, obsVector)); 101 102 if (epoReProcessing()) { 103 delete _epochs.back(); 104 _epochs.pop_back(); 105 } 106 _epochs.push_back(new t_epoch(epoTime, obsVector,pseudoObsIono)); 97 107 if (_epochs.size() > MAXSIZE) { 98 108 delete _epochs.front(); -
trunk/BNC/src/PPP/pppObsPool.h
r7288 r8905 4 4 #include <vector> 5 5 #include <deque> 6 #include <QMap> 6 7 #include "pppSatObs.h" 7 8 #include "bnctime.h" 9 #include "pppRefSat.h" 8 10 9 11 namespace BNC_PPP { … … 14 16 class t_epoch { 15 17 public: 16 t_epoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector); 18 t_epoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector, 19 bool pseudoObsIono); 17 20 ~t_epoch(); 18 std::vector<t_pppSatObs*>& obsVector() {return _obsVector;}21 std::vector<t_pppSatObs*>& obsVector() {return _obsVector;} 19 22 const std::vector<t_pppSatObs*>& obsVector() const {return _obsVector;} 20 23 const bncTime& epoTime() const {return _epoTime;} 24 bool pseudoObsIono() const {return _pseudoObsIono;} 21 25 private: 22 bncTime _epoTime;26 bncTime _epoTime; 23 27 std::vector<t_pppSatObs*> _obsVector; 28 bool _pseudoObsIono; 24 29 }; 25 30 … … 30 35 void putTec(t_vTec* _vTec); 31 36 32 void putEpoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector); 37 void putEpoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector, 38 bool pseudoObs); 33 39 34 40 const t_satCodeBias* satCodeBias(const t_prn& prn) const { … … 49 55 } 50 56 57 void initRefSatMapElement(char system) { 58 _refSatMap[system] = new t_pppRefSat(); 59 } 60 void clearRefSatMap() { 61 QMapIterator<char, t_pppRefSat*> it(_refSatMap); 62 while (it.hasNext()) { 63 it.next(); 64 delete it.value(); 65 } 66 _refSatMap.clear(); 67 } 68 t_pppRefSat* getRefSatMapElement(char system) { 69 return _refSatMap[system]; 70 } 71 QMap<char, t_pppRefSat*> getRefSatMap() {return _refSatMap;} 72 73 void setEpoReProcessing(bool epoReProcessing) { 74 _epoReProcessing = epoReProcessing; 75 } 76 bool epoReProcessing() {return _epoReProcessing;} 77 51 78 private: 52 t_satCodeBias* _satCodeBiases[t_prn::MAXPRN+1]; 53 t_satPhaseBias* _satPhaseBiases[t_prn::MAXPRN+1]; 54 t_vTec* _vTec; 55 std::deque<t_epoch*> _epochs; 79 t_satCodeBias* _satCodeBiases[t_prn::MAXPRN+1]; 80 t_satPhaseBias* _satPhaseBiases[t_prn::MAXPRN+1]; 81 t_vTec* _vTec; 82 std::deque<t_epoch*> _epochs; 83 QMap<char, t_pppRefSat*> _refSatMap; 84 bool _epoReProcessing; 56 85 }; 57 86 -
trunk/BNC/src/PPP/pppParlist.cpp
r7988 r8905 94 94 _noise = OPT->_noiseTrp; 95 95 break; 96 case ion: 97 _epoSpec = false; 98 _sigma0 = OPT->_aprSigIon; 99 _noise = OPT->_noiseIon; 100 break; 101 case cBias1: 102 case cBias2: 103 _epoSpec = false; 104 _sigma0 = OPT->_aprSigCodeBias; 105 _noise = OPT->_noiseCodeBias; 106 break; 107 case pBias1: 108 case pBias2: 109 _epoSpec = false; 110 _sigma0 = OPT->_aprSigPhaseBias; 111 _noise = OPT->_noisePhaseBias; 112 break; 96 113 } 97 114 } … … 106 123 //////////////////////////////////////////////////////////////////////////// 107 124 double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs, 108 const t_lc::type& tLC) const {125 const t_lc::type& tLC) const {//qDebug() << "t_pppParam::partial: " << tLC; 109 126 110 127 // Special Case - Melbourne-Wuebbena … … 115 132 116 133 const t_pppStation* sta = PPP_CLIENT->staRover(); 117 ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3); 134 ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3); 135 136 map<t_frequency::type, double> codeCoeff; 137 map<t_frequency::type, double> phaseCoeff; 138 map<t_frequency::type, double> ionoCoeff; 139 obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff); 118 140 119 141 switch (_type) { 120 142 case crdX: 121 return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.norm_Frobenius(); 143 if (tLC == t_lc::GIM) {return 0.0;} 144 return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius(); 122 145 case crdY: 123 return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.norm_Frobenius(); 146 if (tLC == t_lc::GIM) {return 0.0;} 147 return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius(); 124 148 case crdZ: 125 return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.norm_Frobenius(); 149 if (tLC == t_lc::GIM) {return 0.0;} 150 return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius(); 126 151 case clkR: 152 if (tLC == t_lc::GIM) {return 0.0;} 127 153 return 1.0; 128 154 case offGG: 155 if (tLC == t_lc::GIM) {return 0.0;} 129 156 return (obs->prn().system() == 'R') ? 1.0 : 0.0; 130 157 case amb: 158 if (tLC == t_lc::GIM) {return 0.0;} 159 else if ((OPT->_obsModelType == OPT->IF) || 160 (OPT->_obsModelType == OPT->PPPRTK) || 161 (OPT->_obsModelType == OPT->UncombPPP) || 162 (OPT->_obsModelType == OPT->DCMcodeBias && !obs->isReference()) || 163 (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference()) ) { 164 if (obs->prn() == _prn) { 165 if (tLC == _tLC) { 166 return (obs->lambda(tLC)); 167 } 168 else if (tLC == t_lc::lIF && _tLC == t_lc::MW) { 169 return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2); 170 } 171 else { 172 if (_tLC == t_lc::l1) { 173 return obs->lambda(t_lc::l1) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)]; 174 } 175 else if (_tLC == t_lc::l2) { 176 return obs->lambda(t_lc::l2) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)]; 177 } 178 } 179 } 180 } 181 break; 182 case trp: 183 if (tLC == t_lc::GIM) {return 0.0;} 184 return 1.0 / sin(obs->eleSat()); 185 case ion: 186 // qDebug() << "refPrn: " << _refPrn.toString().c_str(); 131 187 if (obs->prn() == _prn) { 132 if (tLC == _tLC) { 133 return (obs->lambda(tLC)); 134 } 135 else if (tLC == t_lc::lIF && _tLC == t_lc::MW) { 136 return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2); 137 } 138 else { 139 map<t_frequency::type, double> codeCoeff; 140 map<t_frequency::type, double> phaseCoeff; 141 obs->lcCoeff(tLC, codeCoeff, phaseCoeff); 142 if (_tLC == t_lc::l1) { 143 return obs->lambda(t_lc::l1) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)]; 144 } 145 else if (_tLC == t_lc::l2) { 146 return obs->lambda(t_lc::l2) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)]; 147 } 148 } 149 } 150 return 0.0; 151 case trp: 152 return 1.0 / sin(obs->eleSat()); 153 } 154 188 if (tLC == t_lc::c1) { 189 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)]; 190 } 191 else if (tLC == t_lc::c2) { 192 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)]; 193 } 194 else if (tLC == t_lc::l1) { 195 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)]; 196 } 197 else if (tLC == t_lc::l2) { 198 return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)]; 199 } 200 else if (tLC == t_lc::GIM) { 201 return -1.0; 202 } 203 } 204 if (tLC == t_lc::GIM && _prn == _refPrn) { 205 return 1.0; 206 } 207 break; 208 case cBias1: 209 if (tLC == t_lc::c1) { 210 return 1.0; 211 } 212 else { 213 return 0.0; 214 } 215 break; 216 case cBias2: 217 if (tLC == t_lc::c2) { 218 return 1.0; 219 } 220 else { 221 return 0.0; 222 } 223 break; 224 case pBias1: 225 if (tLC == t_lc::l1) { 226 return 1.0; 227 } 228 else { 229 return 0.0; 230 } 231 break; 232 case pBias2: 233 if (tLC == t_lc::l2) { 234 return 1.0; 235 } 236 else { 237 return 0.0; 238 } 239 } 155 240 return 0.0; 156 241 } … … 171 256 break; 172 257 case clkR: 173 ss << "CLK "; 174 break; 175 case amb: 176 ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString(); 258 ss << "REC_CLK "; 177 259 break; 178 260 case offGG: … … 181 263 case trp: 182 264 ss << "TRP "; 265 break; 266 case amb: 267 ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString(); 268 break; 269 case ion: 270 ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString(); 271 break; 272 case cBias1: 273 case cBias2: 274 case pBias1: 275 case pBias2: 276 ss << "BIAS " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << "REC"; 183 277 break; 184 278 } … … 201 295 // 202 296 //////////////////////////////////////////////////////////////////////////// 203 t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector) { 297 t_irc t_pppParlist::set(const bncTime& epoTime, 298 const std::vector<t_pppSatObs*>& obsVector) { 204 299 205 300 // Remove some Parameters … … 271 366 required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy)); 272 367 273 // GPS-G lonassClock Offset368 // GPS-GLONASS Clock Offset 274 369 // ------------------------ 275 370 if (OPT->useSystem('R')) { … … 283 378 } 284 379 380 // Ionosphere 381 // ---------- 382 if (OPT->_obsModelType == OPT->UncombPPP || 383 OPT->_obsModelType == OPT->DCMcodeBias || 384 OPT->_obsModelType == OPT->DCMphaseBias ) { 385 for (unsigned jj = 0; jj < obsVector.size(); jj++) { 386 const t_pppSatObs* satObs = obsVector[jj]; 387 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy)); 388 } 389 } 390 285 391 // Ambiguities 286 392 // ----------- 287 393 for (unsigned jj = 0; jj < obsVector.size(); jj++) { 288 394 const t_pppSatObs* satObs = obsVector[jj]; 289 const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system()); 290 for (unsigned ii = 0; ii < ambLCs.size(); ii++) { 291 required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector)); 292 } 395 if ((OPT->_obsModelType == OPT->IF) || 396 (OPT->_obsModelType == OPT->PPPRTK) || 397 (OPT->_obsModelType == OPT->UncombPPP) || 398 (OPT->_obsModelType == OPT->DCMcodeBias && !satObs->isReference()) || 399 (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference()) ) { 400 const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system()); 401 for (unsigned ii = 0; ii < ambLCs.size(); ii++) { 402 required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector)); 403 } 404 } 405 } 406 407 // Receiver Code Biases 408 // -------------------- 409 if (OPT->_obsModelType == OPT->DCMcodeBias) { 410 required.push_back(new t_pppParam(t_pppParam::cBias1, t_prn(), t_lc::c1)); 411 required.push_back(new t_pppParam(t_pppParam::cBias2, t_prn(), t_lc::c2)); 412 } 413 414 // Receiver Phase Biases 415 // --------------------- 416 if ((OPT->_obsModelType == OPT->DCMphaseBias) || 417 (OPT->_obsModelType == OPT->PPPRTK) ) { 418 required.push_back(new t_pppParam(t_pppParam::pBias1, t_prn(), t_lc::l1)); 419 required.push_back(new t_pppParam(t_pppParam::pBias2, t_prn(), t_lc::l2)); 293 420 } 294 421 -
trunk/BNC/src/PPP/pppParlist.h
r7237 r8905 14 14 class t_pppParam { 15 15 public: 16 enum e_type {crdX, crdY, crdZ, clkR, amb, offGG, trp };16 enum e_type {crdX, crdY, crdZ, clkR, amb, offGG, trp, ion, cBias1, cBias2, pBias1, pBias2}; 17 17 18 18 t_pppParam(e_type type, const t_prn& prn, t_lc::type tLC, … … 20 20 21 21 ~t_pppParam(); 22 22 23 e_type type() const {return _type;} 23 24 double x0() const {return _x0;} 24 double partial(const bncTime& epoTime, const t_pppSatObs* obs, 25 const t_lc::type& tLC) const; 25 double partial(const bncTime& epoTime, const t_pppSatObs* obs, const t_lc::type& tLC) const; 26 26 bool epoSpec() const {return _epoSpec;} 27 27 bool isEqual(const t_pppParam* par2) const { … … 51 51 unsigned ambNumEpo() const {return _ambInfo ? _ambInfo->_numEpo : 0;} 52 52 void stepAmbNumEpo() {if (_ambInfo) _ambInfo->_numEpo += 1;} 53 void setRefPrn(t_prn prn) {_refPrn = prn;} 53 54 54 55 static bool sortFunction(const t_pppParam* p1, const t_pppParam* p2) { … … 78 79 unsigned _numEpo; 79 80 }; 80 e_type _type; 81 t_prn _prn; 82 t_lc::type _tLC; 83 double _x0; 84 bool _epoSpec; 85 int _indexOld; 86 int _indexNew; 87 double _sigma0; 88 double _noise; 89 t_ambInfo* _ambInfo; 90 bncTime _lastObsTime; 91 bncTime _firstObsTime; 81 e_type _type; 82 t_prn _prn; 83 t_prn _refPrn; 84 t_lc::type _tLC; 85 double _x0; 86 bool _epoSpec; 87 int _indexOld; 88 int _indexNew; 89 double _sigma0; 90 double _noise; 91 t_ambInfo* _ambInfo; 92 bncTime _lastObsTime; 93 bncTime _firstObsTime; 92 94 }; 93 95 … … 100 102 unsigned nPar() const {return _params.size();} 101 103 const std::vector<t_pppParam*>& params() const {return _params;} 102 std::vector<t_pppParam*>& params(){return _params;}103 void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ, 104 std::vector<t_pppParam*>& params() {return _params;} 105 void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ, 104 106 const ColumnVector& xx) const; 107 105 108 private: 106 109 std::vector<t_pppParam*> _params; -
trunk/BNC/src/PPP/pppSatObs.cpp
r8619 r8905 35 35 //////////////////////////////////////////////////////////////////////////// 36 36 t_pppSatObs::t_pppSatObs(const t_satObs& pppSatObs) { 37 _prn = pppSatObs._prn; 38 _time = pppSatObs._time; 39 _outlier = false; 40 _valid = true; 37 _prn = pppSatObs._prn; 38 _time = pppSatObs._time; 39 _outlier = false; 40 _valid = true; 41 _reference = false; 42 _stecRefSat = 0.0; 43 _stecSat = 0.0; 41 44 for (unsigned ii = 0; ii < t_frequency::max; ii++) { 42 45 _obs[ii] = 0; … … 61 64 // Select pseudoranges and phase observations 62 65 // ------------------------------------------ 63 const string preferredAttrib = "CWPXI_"; 64 //const string preferredAttrib = "G:12&PWCSLXYN G:5&IQX R:12&PC R:3&IQX E:16&BCX E:578&IQX J:1&SLXCZ J:26&SLX J:5&IQX C:IQX I:ABCX S:1&C S:5&IQX"; 66 const string preferredAttrib = "G:12&PWCSLXYN G:5&IQX R:12&PC R:3&IQX E:16&BCX E:578&IQX J:1&SLXCZ J:26&SLX J:5&IQX C:IQX I:ABCX S:1&C S:5&IQX"; 65 67 66 68 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) { … … 90 92 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) { 91 93 t_lc::type tLC = OPT->LCs(_prn.system())[ii]; 94 if (tLC == t_lc::GIM) {continue;} 92 95 if (!isValid(tLC)) { 93 96 _valid = false; … … 121 124 ColumnVector dx = _xcSat - satPosOld; 122 125 dx[3] *= t_CST::c; 123 if (dx. norm_Frobenius() < 1.e-4) {126 if (dx.NormFrobenius() < 1.e-4) { 124 127 totOK = true; 125 128 break; … … 140 143 void t_pppSatObs::lcCoeff(t_lc::type tLC, 141 144 map<t_frequency::type, double>& codeCoeff, 142 map<t_frequency::type, double>& phaseCoeff) const { 145 map<t_frequency::type, double>& phaseCoeff, 146 map<t_frequency::type, double>& ionoCoeff) const { 143 147 144 148 codeCoeff.clear(); 145 149 phaseCoeff.clear(); 150 ionoCoeff.clear(); 146 151 147 152 double f1 = t_CST::freq(_fType1, _channel); 148 153 double f2 = t_CST::freq(_fType2, _channel); 154 double f1GPS = t_CST::freq(t_frequency::G1, 0); 149 155 150 156 switch (tLC) { 151 157 case t_lc::l1: 152 phaseCoeff[_fType1] = 1.0; 158 phaseCoeff[_fType1] = 1.0; 159 ionoCoeff [_fType1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2); 153 160 return; 154 161 case t_lc::l2: 155 phaseCoeff[_fType2] = 1.0; 162 phaseCoeff[_fType2] = 1.0; 163 ionoCoeff [_fType2] = -1.0 * pow(f1GPS, 2) / pow(f2, 2); 156 164 return; 157 165 case t_lc::lIF: … … 167 175 case t_lc::CL: 168 176 phaseCoeff[_fType1] = 0.5; 169 codeCoeff [_fType1]= 0.5;177 codeCoeff [_fType1] = 0.5; 170 178 return; 171 179 case t_lc::c1: 172 180 codeCoeff[_fType1] = 1.0; 181 ionoCoeff[_fType1] = pow(f1GPS, 2) / pow(f1, 2); 173 182 return; 174 183 case t_lc::c2: 175 184 codeCoeff[_fType2] = 1.0; 185 ionoCoeff[_fType2] = pow(f1GPS, 2) / pow(f2, 2); 176 186 return; 177 187 case t_lc::cIF: … … 179 189 codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2); 180 190 return; 191 case t_lc::GIM: 181 192 case t_lc::dummy: 182 193 case t_lc::maxLc: … … 190 201 bool valid = true; 191 202 obsValue(tLC, &valid); 203 //qDebug() << "tLC: " << tLC << " valid: " << valid; 192 204 return valid; 193 205 } … … 195 207 //////////////////////////////////////////////////////////////////////////// 196 208 double t_pppSatObs::obsValue(t_lc::type tLC, bool* valid) const { 209 210 double retVal = 0.0; 211 if (valid) *valid = true; 212 213 // Pseudo observations 214 if (tLC == t_lc::GIM) { 215 if (_stecRefSat == 0.0 || _stecSat == 0.0) { 216 if (valid) *valid = false; 217 return 0.0; 218 } 219 else { 220 return _stecRefSat - _stecSat; 221 } 222 } 197 223 198 224 map<t_frequency::type, double> codeCoeff; 199 225 map<t_frequency::type, double> phaseCoeff; 200 lcCoeff(tLC, codeCoeff, phaseCoeff); 201 202 double retVal = 0.0; 203 if (valid) *valid = true; 226 map<t_frequency::type, double> ionoCoeff; 227 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff); 204 228 205 229 map<t_frequency::type, double>::const_iterator it; 230 231 // Code observations 206 232 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) { 207 233 t_frequency::type tFreq = it->first; … … 214 240 } 215 241 } 242 // Phase observations 216 243 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) { 217 244 t_frequency::type tFreq = it->first; … … 224 251 } 225 252 } 226 227 253 return retVal; 228 254 } … … 258 284 double t_pppSatObs::sigma(t_lc::type tLC) const { 259 285 286 double retVal = 0.0; 260 287 map<t_frequency::type, double> codeCoeff; 261 288 map<t_frequency::type, double> phaseCoeff; 262 lcCoeff(tLC, codeCoeff, phaseCoeff); 263 264 double retVal = 0.0; 289 map<t_frequency::type, double> ionoCoeff; 290 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff); 291 292 if (tLC == t_lc::GIM) { 293 retVal = OPT->_sigmaGIMdiff * OPT->_sigmaGIMdiff; 294 } 265 295 266 296 map<t_frequency::type, double>::const_iterator it; 267 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {297 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {//qDebug() << "codeCoeff : " << t_frequency::toString(it->first).c_str() << ": " << it->second; 268 298 retVal += it->second * it->second * OPT->_sigmaC1 * OPT->_sigmaC1; 269 299 } 270 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) { 300 301 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {//qDebug() << "phaseCoeff: " << t_frequency::toString(it->first).c_str() << ": " << it->second; 271 302 retVal += it->second * it->second * OPT->_sigmaL1 * OPT->_sigmaL1; 272 303 } … … 295 326 // 296 327 //////////////////////////////////////////////////////////////////////////// 297 double t_pppSatObs::maxRes(t_lc::type tLC) const { 328 double t_pppSatObs::maxRes(t_lc::type tLC) const {//qDebug() << "t_pppSatObs::maxRes(t_lc::type tLC)"; 329 double retVal = 0.0; 298 330 299 331 map<t_frequency::type, double> codeCoeff; 300 332 map<t_frequency::type, double> phaseCoeff; 301 lcCoeff(tLC, codeCoeff, phaseCoeff); 302 303 double retVal = 0.0; 333 map<t_frequency::type, double> ionoCoeff; 334 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff); 304 335 305 336 map<t_frequency::type, double>::const_iterator it; 306 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {337 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {//qDebug() << "codeCoeff: " << it->first << ": " << it->second; 307 338 retVal += it->second * it->second * OPT->_maxResC1 * OPT->_maxResC1; 308 339 } 309 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) { 340 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {//qDebug() << "phaseCoeff: " << it->first << ": " << it->second; 310 341 retVal += it->second * it->second * OPT->_maxResL1 * OPT->_maxResL1; 311 342 } 312 343 if (tLC == t_lc::GIM) { 344 retVal = 3 * (OPT->_sigmaGIMdiff * OPT->_sigmaGIMdiff); 345 } 313 346 return sqrt(retVal); 314 347 } … … 326 359 // ------------------------------ 327 360 ColumnVector rSat = _xcSat.Rows(1,3); 328 ColumnVector rhoV = rSat - station->xyzApr(); 329 _model._rho = rhoV.norm_Frobenius(); 361 ColumnVector rRec = station->xyzApr(); 362 ColumnVector rhoV = rSat - rRec; 363 _model._rho = rhoV.NormFrobenius(); 330 364 331 365 ColumnVector vSat = _vvSat; … … 334 368 xyz2neu(station->ellApr().data(), rhoV.data(), neu.data()); 335 369 336 _model._eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho);370 _model._eleSat = acos(sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho); 337 371 if (neu[2] < 0) { 338 372 _model._eleSat *= -1.0; … … 354 388 Omega[1] = 0.0; 355 389 Omega[2] = t_CST::omega / t_CST::c; 356 _model._sagnac = DotProduct(Omega, crossproduct(rSat, station->xyzApr()));390 _model._sagnac = DotProduct(Omega, crossproduct(rSat, rRec)); 357 391 358 392 // Antenna Eccentricity … … 373 407 // Tropospheric Delay 374 408 // ------------------ 375 _model._tropo = t_tropo::delay_saast( station->xyzApr(), _model._eleSat);409 _model._tropo = t_tropo::delay_saast(rRec, _model._eleSat); 376 410 377 411 // Code Biases … … 392 426 // Phase Biases 393 427 // ----------- 394 // TODO: consideration of fix indicators and jump counter395 428 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn); 396 429 double yaw = 0.0; 397 430 bool ssr = false; 398 431 if (satPhaseBias) { 399 yaw = satPhaseBias->_yaw; 432 double dt = station->epochTime() - satPhaseBias->_time; 433 if (satPhaseBias->_updateInt) { 434 dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]); 435 } 436 yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt; 400 437 ssr = true; 401 438 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) { … … 414 451 _model._windUp = station->windUp(_time, _prn, rSat, ssr, yaw, vSat) ; 415 452 453 // Relativistic effect due to earth gravity 454 // ---------------------------------------- 455 double a = rSat.NormFrobenius() + rRec.NormFrobenius(); 456 double b = (rSat - rRec).NormFrobenius(); 457 double gm = 3.986004418e14; // m3/s2 458 _model._rel = 2 * gm / t_CST::c / t_CST::c * log((a + b) / (a - b)); 416 459 417 460 // Tidal Correction 418 461 // ---------------- 419 _model._tide = -DotProduct(station->tideDspl(), rhoV) / _model._rho; 462 _model._tideEarth = -DotProduct(station->tideDsplEarth(), rhoV) / _model._rho; 463 _model._tideOcean = -DotProduct(station->tideDsplOcean(), rhoV) / _model._rho; 420 464 421 465 // Ionospheric Delay … … 429 473 } 430 474 } 475 431 476 if (vTecUsage && vTec) { 432 double stec = station->stec(vTec, _signalPropagationTime, rSat); 477 double stec = station->stec(vTec, _signalPropagationTime, rSat); 478 double f1GPS = t_CST::freq(t_frequency::G1, 0); 433 479 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) { 434 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);435 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec;436 }437 }438 439 // Relativistic effect due to earth gravity440 // ----------------------------------------441 // TODO442 443 // Ocean Loading444 // -------------445 // TODO480 if (OPT->_pseudoObsIono) { // DCMcodeBias, DCMphaseBias 481 // For scaling the slant ionospheric delays the trick is to be consistent with units! 482 // The conversion of TECU into meters requires the frequency of the signal. 483 // Hence, GPS L1 frequency is used for all systems. The same is true for mu_i in lcCoeff(). 484 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(f1GPS, 2) * stec; 485 } 486 else { // PPP-RTK 487 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq); 488 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec; 489 } 490 } 491 } 446 492 447 493 // Set Model Set Flag … … 449 495 _model._set = true; 450 496 451 //printModel();497 printModel(); 452 498 453 499 return success; … … 457 503 //////////////////////////////////////////////////////////////////////////// 458 504 void t_pppSatObs::printModel() const { 459 460 LOG.setf(ios::fixed); 461 LOG << "MODEL for Satellite " << _prn.toString() << endl 462 << "RHO: " << setw(12) << setprecision(3) << _model._rho << endl 463 << "ELE: " << setw(12) << setprecision(3) << _model._eleSat * 180.0 / M_PI << endl 464 << "AZI: " << setw(12) << setprecision(3) << _model._azSat * 180.0 / M_PI << endl 465 << "SATCLK: " << setw(12) << setprecision(3) << _model._satClkM << endl 466 << "RECCLK: " << setw(12) << setprecision(3) << _model._recClkM << endl 467 << "SAGNAC: " << setw(12) << setprecision(3) << _model._sagnac << endl 468 << "ANTECC: " << setw(12) << setprecision(3) << _model._antEcc << endl 469 << "TROPO: " << setw(12) << setprecision(3) << _model._tropo << endl 470 << "WINDUP: " << setw(12) << setprecision(3) << _model._windUp << endl 471 << "TIDES: " << setw(12) << setprecision(3) << _model._tide << endl; 505 // TODO: cout should be LOG 506 cout.setf(ios::fixed); 507 cout << "\nMODEL for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "") << endl 508 << "======================= " << endl 509 << "PPP STRATEGY : " << OPT->_obsmodelTypeStr.at((int)OPT->_obsModelType).toLocal8Bit().constData() 510 << ((OPT->_pseudoObsIono) ? " with pseudo-observations for STEC" : "") << endl 511 << "RHO : " << setw(12) << setprecision(3) << _model._rho << endl 512 << "ELE : " << setw(12) << setprecision(3) << _model._eleSat * RHO_DEG << endl 513 << "AZI : " << setw(12) << setprecision(3) << _model._azSat * RHO_DEG << endl 514 << "SATCLK : " << setw(12) << setprecision(3) << _model._satClkM << endl 515 << "RECCLK : " << setw(12) << setprecision(3) << _model._recClkM << endl 516 << "SAGNAC : " << setw(12) << setprecision(3) << _model._sagnac << endl 517 << "ANTECC : " << setw(12) << setprecision(3) << _model._antEcc << endl 518 << "TROPO : " << setw(12) << setprecision(3) << _model._tropo << endl 519 << "WINDUP : " << setw(12) << setprecision(3) << _model._windUp << endl 520 << "REL : " << setw(12) << setprecision(3) << _model._rel << endl 521 << "EARTH TIDES : " << setw(12) << setprecision(3) << _model._tideEarth << endl 522 << "OCEAN TIDES : " << setw(12) << setprecision(3) << _model._tideOcean << endl 523 << endl 524 << "FREQUENCY DEPENDENT CORRECTIONS:" << endl 525 << "-------------------------------" << endl; 472 526 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) { 473 527 if (_obs[iFreq]) { 474 528 string frqStr = t_frequency::toString(t_frequency::type(iFreq)); 475 529 if (_prn.system() == frqStr[0]) { 476 LOG << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl 477 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << endl 478 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << endl 479 << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq] << endl; 480 } 481 } 482 } 530 cout << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl 531 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << endl 532 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << endl 533 << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl; 534 } 535 } 536 } 537 } 538 539 // 540 //////////////////////////////////////////////////////////////////////////// 541 void t_pppSatObs::printObsMinusComputed() const { 542 // TODO: cout should be LOG 543 cout.setf(ios::fixed); 544 cout << "\nOBS-COMP for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "") << endl 545 << "========================== " << endl; 483 546 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) { 484 547 t_lc::type tLC = OPT->LCs(_prn.system())[ii]; 485 LOG << "OBS-CMP "<< t_lc::toString(tLC) << ": " << _prn.toString() << " "548 cout << "OBS-CMP " << setw(4) << t_lc::toString(tLC) << ": " << _prn.toString() << " " 486 549 << setw(12) << setprecision(3) << obsValue(tLC) << " " 487 550 << setw(12) << setprecision(3) << cmpValue(tLC) << " " 488 551 << setw(12) << setprecision(3) << obsValue(tLC) - cmpValue(tLC) << endl; 489 490 } 491 LOG << "OBS-CMP MW: " << _prn.toString() << " " 492 << setw(12) << setprecision(3) << obsValue(t_lc::MW) << " " 493 << setw(12) << setprecision(3) << cmpValue(t_lc::MW) << " " 494 << setw(12) << setprecision(3) << obsValue(t_lc::MW) - cmpValue(t_lc::MW) << endl; 495 } 552 } 553 } 554 496 555 497 556 // … … 504 563 //////////////////////////////////////////////////////////////////////////// 505 564 double t_pppSatObs::cmpValue(t_lc::type tLC) const { 506 507 if (!isValid(tLC)) { 508 return 0.0; 509 } 510 511 // Non-Dispersive Part 512 // ------------------- 513 double nonDisp = _model._rho + _model._recClkM - _model._satClkM 514 + _model._sagnac + _model._antEcc + _model._tropo 515 + _model._tide; 516 517 // Add Dispersive Part 518 // ------------------- 519 map<t_frequency::type, double> codeCoeff; 520 map<t_frequency::type, double> phaseCoeff; 521 lcCoeff(tLC, codeCoeff, phaseCoeff); 522 523 double dispPart = 0.0; 524 525 map<t_frequency::type, double>::const_iterator it; 526 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) { 527 t_frequency::type tFreq = it->first; 528 dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq] + 529 _model._ionoCodeDelay[tFreq]); 530 } 531 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) { 532 t_frequency::type tFreq = it->first; 533 dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] + 534 _model._windUp * t_CST::lambda(tFreq, _channel) - 535 _model._ionoCodeDelay[tFreq]); 536 } 537 538 return nonDisp + dispPart; 565 double cmpValue; 566 567 if (!isValid(tLC)) { 568 cmpValue = 0.0; 569 } 570 else if (tLC == t_lc::GIM) { 571 cmpValue = 0.0; 572 } 573 else { 574 // Non-Dispersive Part 575 // ------------------- 576 double nonDisp = _model._rho 577 + _model._recClkM - _model._satClkM 578 + _model._sagnac + _model._antEcc + _model._tropo 579 + _model._tideEarth + _model._tideOcean + _model._rel; 580 581 // Add Dispersive Part 582 // ------------------- 583 double dispPart = 0.0; 584 map<t_frequency::type, double> codeCoeff; 585 map<t_frequency::type, double> phaseCoeff; 586 map<t_frequency::type, double> ionoCoeff; 587 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff); 588 map<t_frequency::type, double>::const_iterator it; 589 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) { 590 t_frequency::type tFreq = it->first; 591 dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]); 592 if (OPT->PPPRTK) { 593 dispPart += it->second * (_model._ionoCodeDelay[tFreq]); 594 } 595 } 596 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) { 597 t_frequency::type tFreq = it->first; 598 dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] + 599 _model._windUp * t_CST::lambda(tFreq, _channel)); 600 if (OPT->PPPRTK) { 601 dispPart += it->second * (- _model._ionoCodeDelay[tFreq]); 602 } 603 } 604 cmpValue = nonDisp + dispPart; 605 } 606 607 return cmpValue; 539 608 } 540 609 … … 556 625 } 557 626 } 627 628 // 629 //////////////////////////////////////////////////////////////////////////// 630 void t_pppSatObs::setPseudoObsIono(t_frequency::type freq, double stecRefSat) { 631 _stecSat = _model._ionoCodeDelay[freq]; 632 _stecRefSat = stecRefSat; 633 } -
trunk/BNC/src/PPP/pppSatObs.h
r8619 r8905 19 19 bool isValid() const {return _valid;}; 20 20 bool isValid(t_lc::type tLC) const; 21 bool isReference() const {return _reference;}; 22 void setAsReference() {_reference = true;}; 21 23 const t_prn& prn() const {return _prn;} 22 24 const ColumnVector& xc() const {return _xcSat;} … … 31 33 bool modelSet() const {return _model._set;} 32 34 void printModel() const; 35 void printObsMinusComputed() const; 33 36 void lcCoeff(t_lc::type tLC, 34 37 std::map<t_frequency::type, double>& codeCoeff, 35 std::map<t_frequency::type, double>& phaseCoeff) const; 38 std::map<t_frequency::type, double>& phaseCoeff, 39 std::map<t_frequency::type, double>& ionoCoeff) const; 36 40 double lambda(t_lc::type tLC) const; 37 41 double sigma(t_lc::type tLC) const; … … 41 45 void setRes(t_lc::type tLC, double res); 42 46 double getRes(t_lc::type tLC) const; 47 void setPseudoObsIono(t_frequency::type freq, double stecRefSat); 48 double getIonoCodeDelay(t_frequency::type freq) {return _model._ionoCodeDelay[freq];} 43 49 44 50 // RINEX … … 79 85 ~t_model() {} 80 86 void reset() { 81 _set = false; 82 _rho = 0.0; 83 _eleSat = 0.0; 84 _azSat = 0.0; 85 _recClkM = 0.0; 86 _satClkM = 0.0; 87 _sagnac = 0.0; 88 _antEcc = 0.0; 89 _tropo = 0.0; 90 _tide = 0.0; 91 _windUp = 0.0; 92 _rel = 0.0; 87 _set = false; 88 _rho = 0.0; 89 _eleSat = 0.0; 90 _azSat = 0.0; 91 _recClkM = 0.0; 92 _satClkM = 0.0; 93 _sagnac = 0.0; 94 _antEcc = 0.0; 95 _tropo = 0.0; 96 _tideEarth = 0.0; 97 _tideOcean = 0.0; 98 _windUp = 0.0; 99 _rel = 0.0; 93 100 for (unsigned ii = 0; ii < t_frequency::max; ii++) { 94 101 _antPCO[ii] = 0.0; … … 107 114 double _antEcc; 108 115 double _tropo; 109 double _tide; 116 double _tideEarth; 117 double _tideOcean; 110 118 double _windUp; 111 119 double _rel; … … 119 127 120 128 bool _valid; 129 bool _reference; 121 130 t_frequency::type _fType1; 122 131 t_frequency::type _fType2; … … 131 140 std::map<t_lc::type, double> _res; 132 141 double _signalPropagationTime; 142 double _stecRefSat; 143 double _stecSat; 133 144 }; 134 145 -
trunk/BNC/src/PPP/pppStation.h
r8619 r8905 21 21 void setNeuEcc(const ColumnVector& neuEcc); 22 22 void setDClk(double dClk) {_dClk = dClk;} 23 void setTideDspl(const ColumnVector& tideDspl) {_tideDspl = tideDspl;} 24 void setIonoEpochTime(const bncTime& epochTime) {_epochTime = epochTime;} 23 void setTideDsplEarth(const ColumnVector& tideDsplEarth) {_tideDsplEarth = tideDsplEarth;} 24 void setTideDsplOcean(const ColumnVector& tideDsplOcean) {_tideDsplOcean = tideDsplOcean;} 25 void setEpochTime(const bncTime& epochTime) {_epochTime = epochTime;} 25 26 const std::string& name() const {return _name;} 26 27 const std::string& antName() const {return _antName;} … … 29 30 const ColumnVector& neuEcc() const {return _neuEcc;} 30 31 const ColumnVector& xyzEcc() const {return _xyzEcc;} 31 const ColumnVector& tideDspl() const {return _tideDspl;} 32 const ColumnVector& tideDsplEarth() const {return _tideDsplEarth;} 33 const ColumnVector& tideDsplOcean() const {return _tideDsplOcean;} 34 const bncTime epochTime() const {return _epochTime;} 32 35 double dClk() const {return _dClk;} 33 36 double windUp(const bncTime& time, t_prn prn, const ColumnVector& rSat, bool ssr, … … 42 45 ColumnVector _neuEcc; 43 46 ColumnVector _xyzEcc; 44 ColumnVector _tideDspl; 47 ColumnVector _tideDsplEarth; 48 ColumnVector _tideDsplOcean; 45 49 double _dClk; 46 50 mutable t_windUp* _windUp;
Note:
See TracChangeset
for help on using the changeset viewer.