Changeset 8905 in ntrip
- Timestamp:
- Mar 18, 2020, 11:13:50 AM (5 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 2 added
- 21 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; -
trunk/BNC/src/bncwindow.cpp
r8733 r8905 1023 1023 pppLayout3->addWidget(_pppWidgets._minEle, ir, 7); 1024 1024 ++ir; 1025 pppLayout3->addWidget(new QLabel("Wait for clock corr."), ir, 0, Qt::AlignLeft); 1026 pppLayout3->addWidget(_pppWidgets._corrWaitTime, ir, 1); 1027 pppLayout3->addWidget(new QLabel("Seeding (sec)"), ir, 3, Qt::AlignLeft); 1028 pppLayout3->addWidget(_pppWidgets._seedingTime, ir, 4); 1025 pppLayout3->addWidget(new QLabel("Model Obs"), ir, 0, Qt::AlignLeft); 1026 pppLayout3->addWidget(_pppWidgets._modelObs, ir, 1); 1027 pppLayout3->addWidget(new QLabel("Wait for clock corr."), ir, 3, Qt::AlignLeft); 1028 pppLayout3->addWidget(_pppWidgets._corrWaitTime, ir, 4); 1029 pppLayout3->addWidget(new QLabel("Seeding (sec)"), ir, 6, Qt::AlignLeft); 1030 pppLayout3->addWidget(_pppWidgets._seedingTime, ir, 7); 1031 ++ir; 1032 pppLayout3->addWidget(new QLabel("Pseudo Obs"), ir, 0, Qt::AlignLeft); 1033 pppLayout3->addWidget(_pppWidgets._pseudoObs, ir, 1); 1029 1034 ++ir; 1030 1035 pppLayout3->addWidget(new QLabel(""), ir, 8); 1031 1036 pppLayout3->setColumnStretch(8, 999); 1032 1037 ++ir; 1033 pppLayout3->addWidget(new QLabel(""), 1038 pppLayout3->addWidget(new QLabel(""), ir, 1); 1034 1039 pppLayout3->setRowStretch(ir, 999); 1035 1040 … … 1402 1407 _pppWidgets._lcGLONASS->setWhatsThis(tr("<p>Specify which kind of GLONASS observations you want to use and on which kind of ionosphere-free linear combination of GLONASS observations you want to base ambiguity resolutions.</p><p><ul><li>Specifying 'P3' means that you request BNC to use code data and so-called P3 ionosphere-free linear combination of code observations.</li><li>'L3' means that you request BNC to use phase data and so-called L3 ionosphere-free linear combination of phase observations.</li> <li>'P3&L3' means that you request BNC to use both, code and phase data and so-called P3 and L3 ionosphere-free linear combination of code and phase observations.</li></ul></p><p>Specifying 'no' means that you don't want BNC to use GLONASS data. <i>[key: PPP/lcGLONASS]</i></p>")); 1403 1408 _pppWidgets._lcGalileo->setWhatsThis(tr("<p>Specify which kind of Galileo observations you want to use and on which kind of of ionosphere-free linear combination of Galileo observations you want to base ambiguity resolutions.</p><p><ul><li>Specifying 'P3' means that you request BNC to use code data and so-called P3 ionosphere-free linear combination of code observations.</li><li>'L3' means that you request BNC to use phase data and so-called L3 ionosphere-free linear combination of phase observations.</li> <li>'P3&L3' means that you request BNC to use both, code and phase data and so-called P3 and L3 ionosphere-free linear combination of code and phase observations.</li></ul></p><p>Specifying on of these options makes only sense if Galileo data are part of the processed observation stream.</p><p>Specifying 'no' means that you don't want BNC to use Galileo data. <i>[key: PPP/lcGalileo]</i></p>")); 1404 _pppWidgets._lcBDS->setWhatsThis(tr("<p>Specify which kind of BDS observations you want to use and on which kind of ionosphere-free linear combination of BDS observations you want to base ambiguity resolutions.</p><p><ul><li>Specifying 'P3' means that you request BNC to use code data and so-called P3 ionosphere-free linear combination of code observations.</li><li>'L3' means that you request BNC to use phase data and so-called L3 ionosphere-free linear combination of phase observations.</li> <li>'P3&L3' means that you request BNC to use both, code and phase data and so-called P3 and L3 ionosphere-free linear combination of code and phase observations.</li></ul></p><p>Specifying on of these options makes only sense if BDS data are part of the processed observation stream.</p><p>Specifying 'no' means that you don't want to use BDS data. <i>[key: PPP/lcBDS]</i></p>")); 1409 _pppWidgets._lcBDS->setWhatsThis(tr("<p>Specify which kind of model for observations you want to use and on which kind of ionosphere-free linear combination of BDS observations you want to base ambiguity resolutions.</p><p><ul><li>Specifying 'P3' means that you request BNC to use code data and so-called P3 ionosphere-free linear combination of code observations.</li><li>'L3' means that you request BNC to use phase data and so-called L3 ionosphere-free linear combination of phase observations.</li> <li>'P3&L3' means that you request BNC to use both, code and phase data and so-called P3 and L3 ionosphere-free linear combination of code and phase observations.</li></ul></p><p>Specifying on of these options makes only sense if BDS data are part of the processed observation stream.</p><p>Specifying 'no' means that you don't want to use BDS data. <i>[key: PPP/lcBDS]</i></p>")); 1410 _pppWidgets._modelObs->setWhatsThis(tr("<p>Specify which kind of PPP model you want to use. <i>[key: PPP/modelObs]</i></p>")); 1405 1411 _pppWidgets._sigmaC1->setWhatsThis(tr("<p>Enter a Sigma for GNSS C1 code observations in meters.</p><p>The higher the sigma you enter, the less the contribution of C1 code observations to a PPP solution from combined code and phase data. 2.0 is likely to be an appropriate choice.</p><p>Default is an empty option field, meaning<br>'Sigma C1 = 2.0' <i>[key: PPP/sigmaC1]</i></p>")); 1406 1412 _pppWidgets._sigmaL1->setWhatsThis(tr("<p>Enter a Sigma for GNSS L1 phase observations in meters.</p><p>The higher the sigma you enter, the less the contribution of L1 phase observations to a PPP solutions from combined code and phase data. 0.01 is likely to be an appropriate choice.</p><p>Default is an empty option field, meaning<br>'Sigma L1 = 0.01' <i>[key: PPP/sigmaL1]</i></p>")); … … 2855 2861 QComboBox* system = new QComboBox(); 2856 2862 system->setEditable(false); 2857 system->addItems(QString("ALL,GPS,GLONASS,Galileo,BDS,QZSS,SBAS ").split(","));2863 system->addItems(QString("ALL,GPS,GLONASS,Galileo,BDS,QZSS,SBAS,IRNSS").split(",")); 2858 2864 system->setFrame(false); 2859 2865 _uploadEphTable->setCellWidget(iRow, iCol, system); … … 2941 2947 QComboBox* system = new QComboBox(); 2942 2948 system->setEditable(false); 2943 system->addItems(QString("ALL,GPS,GLONASS,Galileo,BDS,QZSS,SBAS ").split(","));2949 system->addItems(QString("ALL,GPS,GLONASS,Galileo,BDS,QZSS,SBAS,IRNSS").split(",")); 2944 2950 system->setFrame(false); 2945 2951 system->setCurrentIndex(system->findText(hlp[iCol])); -
trunk/BNC/src/pppInclude.h
r7926 r8905 42 42 class t_lc { 43 43 public: 44 enum type {dummy = 0, l1, l2, c1, c2, lIF, cIF, MW, CL, maxLc};44 enum type {dummy = 0, l1, l2, c1, c2, lIF, cIF, MW, CL, GIM, maxLc}; 45 45 46 46 static bool includesPhase(type tt) { … … 56 56 case cIF: 57 57 return false; 58 case dummy: case maxLc: return false; 58 case dummy: 59 case maxLc: 60 case GIM: 61 return false; 59 62 } 60 63 return false; … … 73 76 case lIF: 74 77 return false; 75 case dummy: case maxLc: return false; 78 case dummy: 79 case maxLc: 80 case GIM: 81 return false; 76 82 } 77 83 return false; … … 94 100 case lIF: case cIF: case MW: case CL: 95 101 return t_frequency::dummy; 96 case dummy: case maxLc: return t_frequency::dummy; 102 case dummy: 103 case maxLc: 104 case GIM: 105 return t_frequency::dummy; 97 106 } 98 107 return t_frequency::dummy; … … 109 118 case c2: return "c2"; 110 119 case cIF: return "cIF"; 111 case dummy: case maxLc: return ""; 120 case GIM: return "GIM"; 121 case dummy: 122 case maxLc: 123 return ""; 112 124 } 113 125 return ""; -
trunk/BNC/src/pppMain.cpp
r8773 r8905 109 109 } 110 110 delete pppThread; 111 111 } 112 112 #endif 113 113 } 114 114 _pppThreads.clear(); 115 115 } 116 116 117 117 _running = false; … … 183 183 opt->_corrWaitTime = 0; 184 184 } 185 opt->_obsModelType = t_pppOptions::IF; 186 opt->_pseudoObsIono = false; 187 opt->_refSatRequired = false; 188 #ifdef USE_PPP 189 // Pseudo Observations 190 if (settings.value("PPP/pseudoObs").toString() == "Ionosphere") { 191 opt->_pseudoObsIono = true; 192 } 193 else if (settings.value("PPP/pseudoObs").toString() == "no") { 194 opt->_pseudoObsIono = false; 195 } 196 // Observation Model 197 if (settings.value("PPP/modelObs").toString() == "Ionosphere-free PPP") { 198 opt->_obsModelType = t_pppOptions::IF; 199 opt->_pseudoObsIono = false; 200 } 201 else if (settings.value("PPP/modelObs").toString() == "PPP-RTK") { 202 opt->_obsModelType = t_pppOptions::PPPRTK; 203 opt->_pseudoObsIono = false; 204 } 205 else if (settings.value("PPP/modelObs").toString() == "Uncombined PPP") { 206 opt->_obsModelType = t_pppOptions::UncombPPP; 207 if (opt->_pseudoObsIono) { 208 opt->_refSatRequired = true; 209 } 210 } 211 else if (settings.value("PPP/modelObs").toString() == "DCM with Code Biases") { 212 opt->_obsModelType = t_pppOptions::DCMcodeBias; 213 opt->_refSatRequired = true; 214 } 215 else if (settings.value("PPP/modelObs").toString() == "DCM with Phase Biases") { 216 opt->_obsModelType = t_pppOptions::DCMphaseBias; 217 opt->_refSatRequired = true; 218 } 219 #endif 185 220 // GPS 186 if (settings.value("PPP/lcGPS").toString() == "Pi") { 187 opt->_LCsGPS.push_back(t_lc::c1); 188 opt->_LCsGPS.push_back(t_lc::c2); 221 if (settings.value("PPP/lcGPS").toString() == "Pi") { 222 if (opt->_obsModelType == t_pppOptions::IF) { 223 opt->_LCsGPS.push_back(t_lc::cIF); 224 } 225 else { 226 opt->_LCsGPS.push_back(t_lc::c1); 227 opt->_LCsGPS.push_back(t_lc::c2); 228 if (opt->_pseudoObsIono) { 229 opt->_LCsGPS.push_back(t_lc::GIM); 230 } 231 } 189 232 } 190 233 else if (settings.value("PPP/lcGPS").toString() == "Li") { 191 opt->_LCsGPS.push_back(t_lc::l1); 192 opt->_LCsGPS.push_back(t_lc::l2); 234 if (opt->_obsModelType == t_pppOptions::IF) { 235 opt->_LCsGPS.push_back(t_lc::lIF); 236 } 237 else { 238 opt->_LCsGPS.push_back(t_lc::l1); 239 opt->_LCsGPS.push_back(t_lc::l2); 240 if (opt->_pseudoObsIono) { 241 opt->_LCsGPS.push_back(t_lc::GIM); 242 } 243 } 193 244 } 194 245 else if (settings.value("PPP/lcGPS").toString() == "Pi&Li") { 195 opt->_LCsGPS.push_back(t_lc::c1); 196 opt->_LCsGPS.push_back(t_lc::c2); 197 opt->_LCsGPS.push_back(t_lc::l1); 198 opt->_LCsGPS.push_back(t_lc::l2); 199 } 200 if (settings.value("PPP/lcGPS").toString() == "P3") { 201 opt->_LCsGPS.push_back(t_lc::cIF); 202 } 203 else if (settings.value("PPP/lcGPS").toString() == "L3") { 204 opt->_LCsGPS.push_back(t_lc::lIF); 205 } 206 else if (settings.value("PPP/lcGPS").toString() == "P3&L3") { 207 opt->_LCsGPS.push_back(t_lc::cIF); 208 opt->_LCsGPS.push_back(t_lc::lIF); 246 if (opt->_obsModelType == t_pppOptions::IF) { 247 opt->_LCsGPS.push_back(t_lc::cIF); 248 opt->_LCsGPS.push_back(t_lc::lIF); 249 } 250 else { 251 opt->_LCsGPS.push_back(t_lc::c1); 252 opt->_LCsGPS.push_back(t_lc::c2); 253 opt->_LCsGPS.push_back(t_lc::l1); 254 opt->_LCsGPS.push_back(t_lc::l2); 255 if (opt->_pseudoObsIono) { 256 opt->_LCsGPS.push_back(t_lc::GIM); 257 } 258 } 209 259 } 210 260 // GLONASS 211 if (settings.value("PPP/lcGLONASS").toString() == "Pi") { 212 opt->_LCsGLONASS.push_back(t_lc::c1); 213 opt->_LCsGLONASS.push_back(t_lc::c2); 261 if (settings.value("PPP/lcGLONASS").toString() == "Pi") { 262 if (opt->_obsModelType == t_pppOptions::IF) { 263 opt->_LCsGLONASS.push_back(t_lc::cIF); 264 } 265 else { 266 opt->_LCsGLONASS.push_back(t_lc::c1); 267 opt->_LCsGLONASS.push_back(t_lc::c2); 268 if (opt->_pseudoObsIono) { 269 opt->_LCsGLONASS.push_back(t_lc::GIM); 270 } 271 } 214 272 } 215 273 else if (settings.value("PPP/lcGLONASS").toString() == "Li") { 216 opt->_LCsGLONASS.push_back(t_lc::l1); 217 opt->_LCsGLONASS.push_back(t_lc::l2); 274 if (opt->_obsModelType == t_pppOptions::IF) { 275 opt->_LCsGLONASS.push_back(t_lc::lIF); 276 } 277 else { 278 opt->_LCsGLONASS.push_back(t_lc::l1); 279 opt->_LCsGLONASS.push_back(t_lc::l2); 280 if (opt->_obsModelType == t_pppOptions::IF) { 281 opt->_LCsGLONASS.push_back(t_lc::GIM); 282 } 283 } 218 284 } 219 285 else if (settings.value("PPP/lcGLONASS").toString() == "Pi&Li") { 220 opt->_LCsGLONASS.push_back(t_lc::c1); 221 opt->_LCsGLONASS.push_back(t_lc::c2); 222 opt->_LCsGLONASS.push_back(t_lc::l1); 223 opt->_LCsGLONASS.push_back(t_lc::l2); 224 } 225 if (settings.value("PPP/lcGLONASS").toString() == "P3") { 226 opt->_LCsGLONASS.push_back(t_lc::cIF); 227 } 228 else if (settings.value("PPP/lcGLONASS").toString() == "L3") { 229 opt->_LCsGLONASS.push_back(t_lc::lIF); 230 } 231 else if (settings.value("PPP/lcGLONASS").toString() == "P3&L3") { 232 opt->_LCsGLONASS.push_back(t_lc::cIF); 233 opt->_LCsGLONASS.push_back(t_lc::lIF); 286 if (opt->_obsModelType == t_pppOptions::IF) { 287 opt->_LCsGLONASS.push_back(t_lc::cIF); 288 opt->_LCsGLONASS.push_back(t_lc::lIF); 289 } 290 else { 291 opt->_LCsGLONASS.push_back(t_lc::c1); 292 opt->_LCsGLONASS.push_back(t_lc::c2); 293 opt->_LCsGLONASS.push_back(t_lc::l1); 294 opt->_LCsGLONASS.push_back(t_lc::l2); 295 if (opt->_pseudoObsIono) { 296 opt->_LCsGLONASS.push_back(t_lc::GIM); 297 } 298 } 234 299 } 235 300 // Galileo 236 if (settings.value("PPP/lcGalileo").toString() == "Pi") { 237 opt->_LCsGalileo.push_back(t_lc::c1); 238 opt->_LCsGalileo.push_back(t_lc::c2); 301 if (settings.value("PPP/lcGalileo").toString() == "Pi") { 302 if (opt->_obsModelType == t_pppOptions::IF) { 303 opt->_LCsGalileo.push_back(t_lc::cIF); 304 } 305 else { 306 opt->_LCsGalileo.push_back(t_lc::c1); 307 opt->_LCsGalileo.push_back(t_lc::c2); 308 if (opt->_pseudoObsIono) { 309 opt->_LCsGalileo.push_back(t_lc::GIM); 310 } 311 } 239 312 } 240 313 else if (settings.value("PPP/lcGalileo").toString() == "Li") { 241 opt->_LCsGalileo.push_back(t_lc::l1); 242 opt->_LCsGalileo.push_back(t_lc::l2); 314 if (opt->_obsModelType == t_pppOptions::IF) { 315 opt->_LCsGalileo.push_back(t_lc::lIF); 316 } 317 else { 318 opt->_LCsGalileo.push_back(t_lc::l1); 319 opt->_LCsGalileo.push_back(t_lc::l2); 320 if (opt->_pseudoObsIono) { 321 opt->_LCsGalileo.push_back(t_lc::GIM); 322 } 323 } 243 324 } 244 325 else if (settings.value("PPP/lcGalileo").toString() == "Pi&Li") { 245 opt->_LCsGalileo.push_back(t_lc::c1); 246 opt->_LCsGalileo.push_back(t_lc::c2); 247 opt->_LCsGalileo.push_back(t_lc::l1); 248 opt->_LCsGalileo.push_back(t_lc::l2); 249 } 250 if (settings.value("PPP/lcGalileo").toString() == "P3") { 251 opt->_LCsGalileo.push_back(t_lc::cIF); 252 } 253 else if (settings.value("PPP/lcGalileo").toString() == "L3") { 254 opt->_LCsGalileo.push_back(t_lc::lIF); 255 } 256 else if (settings.value("PPP/lcGalileo").toString() == "P3&L3") { 257 opt->_LCsGalileo.push_back(t_lc::cIF); 258 opt->_LCsGalileo.push_back(t_lc::lIF); 326 if (opt->_obsModelType == t_pppOptions::IF) { 327 opt->_LCsGalileo.push_back(t_lc::cIF); 328 opt->_LCsGalileo.push_back(t_lc::lIF); 329 } 330 else { 331 opt->_LCsGalileo.push_back(t_lc::c1); 332 opt->_LCsGalileo.push_back(t_lc::c2); 333 opt->_LCsGalileo.push_back(t_lc::l1); 334 opt->_LCsGalileo.push_back(t_lc::l2); 335 if (opt->_pseudoObsIono) { 336 opt->_LCsGalileo.push_back(t_lc::GIM); 337 } 338 } 259 339 } 260 340 // BDS 261 if (settings.value("PPP/lcBDS").toString() == "Pi") { 262 opt->_LCsBDS.push_back(t_lc::c1); 263 opt->_LCsBDS.push_back(t_lc::c2); 341 if (settings.value("PPP/lcBDS").toString() == "Pi") { 342 if (opt->_obsModelType == t_pppOptions::IF) { 343 opt->_LCsBDS.push_back(t_lc::cIF); 344 } 345 else { 346 opt->_LCsBDS.push_back(t_lc::c1); 347 opt->_LCsBDS.push_back(t_lc::c2); 348 if (opt->_pseudoObsIono) { 349 opt->_LCsBDS.push_back(t_lc::GIM); 350 } 351 } 264 352 } 265 353 else if (settings.value("PPP/lcBDS").toString() == "Li") { 266 opt->_LCsBDS.push_back(t_lc::l1); 267 opt->_LCsBDS.push_back(t_lc::l2); 354 if (opt->_obsModelType == t_pppOptions::IF) { 355 opt->_LCsBDS.push_back(t_lc::lIF); 356 } 357 else { 358 opt->_LCsBDS.push_back(t_lc::l1); 359 opt->_LCsBDS.push_back(t_lc::l2); 360 if (opt->_pseudoObsIono) { 361 opt->_LCsBDS.push_back(t_lc::GIM); 362 } 363 } 268 364 } 269 365 else if (settings.value("PPP/lcBDS").toString() == "Pi&Li") { 270 opt->_LCsBDS.push_back(t_lc::c1); 271 opt->_LCsBDS.push_back(t_lc::c2); 272 opt->_LCsBDS.push_back(t_lc::l1); 273 opt->_LCsBDS.push_back(t_lc::l2); 274 } 275 if (settings.value("PPP/lcBDS").toString() == "P3") { 276 opt->_LCsBDS.push_back(t_lc::cIF); 277 } 278 else if (settings.value("PPP/lcBDS").toString() == "L3") { 279 opt->_LCsBDS.push_back(t_lc::lIF); 280 } 281 else if (settings.value("PPP/lcBDS").toString() == "P3&L3") { 282 opt->_LCsBDS.push_back(t_lc::cIF); 283 opt->_LCsBDS.push_back(t_lc::lIF); 366 if (opt->_obsModelType == t_pppOptions::IF) { 367 opt->_LCsBDS.push_back(t_lc::cIF); 368 opt->_LCsBDS.push_back(t_lc::lIF); 369 } 370 else { 371 opt->_LCsBDS.push_back(t_lc::c1); 372 opt->_LCsBDS.push_back(t_lc::c2); 373 opt->_LCsBDS.push_back(t_lc::l1); 374 opt->_LCsBDS.push_back(t_lc::l2); 375 if (opt->_pseudoObsIono) { 376 opt->_LCsBDS.push_back(t_lc::GIM); 377 } 378 } 284 379 } 285 380 … … 316 411 // Some default values 317 412 // ------------------- 318 opt->_aprSigAmb = 1000.0; 319 opt->_noiseClk = 1000.0; 413 opt->_aprSigAmb = 1000.0; 414 opt->_aprSigIon = 1000.0; 415 opt->_noiseClk = 1000.0; 416 opt->_aprSigCodeBias = 1000.0; 417 opt->_aprSigPhaseBias = 1000.0; 418 opt->_noiseIon = 1.0; 419 opt->_noiseCodeBias = 1.0; 420 opt->_noisePhaseBias = 0.1; 421 opt->_sigmaGIMdiff = 0.05; // pseudo observation GIM: STEC(ref_sat) - STEC(sat) 320 422 321 423 _options << opt; -
trunk/BNC/src/pppModel.cpp
r8774 r8905 1 2 1 // Part of BNC, a utility for retrieving decoding and 3 2 // converting GNSS data streams from NTRIP broadcasters. … … 40 39 * -----------------------------------------------------------------------*/ 41 40 42 43 41 #include <cmath> 44 42 … … 48 46 using namespace std; 49 47 50 const double t_astro::RHO_DEG = 180.0 / M_PI; 51 const double t_astro::RHO_SEC = 3600.0 * 180.0 / M_PI; 52 const double t_astro::MJD_J2000 = 51544.5; 48 53 49 54 50 Matrix t_astro::rotX(double Angle) { 55 51 const double C = cos(Angle); 56 52 const double S = sin(Angle); 57 Matrix UU(3,3); 58 UU[0][0] = 1.0; UU[0][1] = 0.0; UU[0][2] = 0.0; 59 UU[1][0] = 0.0; UU[1][1] = +C; UU[1][2] = +S; 60 UU[2][0] = 0.0; UU[2][1] = -S; UU[2][2] = +C; 53 Matrix UU(3, 3); 54 UU[0][0] = 1.0; 55 UU[0][1] = 0.0; 56 UU[0][2] = 0.0; 57 UU[1][0] = 0.0; 58 UU[1][1] = +C; 59 UU[1][2] = +S; 60 UU[2][0] = 0.0; 61 UU[2][1] = -S; 62 UU[2][2] = +C; 61 63 return UU; 62 64 } … … 65 67 const double C = cos(Angle); 66 68 const double S = sin(Angle); 67 Matrix UU(3,3); 68 UU[0][0] = +C; UU[0][1] = 0.0; UU[0][2] = -S; 69 UU[1][0] = 0.0; UU[1][1] = 1.0; UU[1][2] = 0.0; 70 UU[2][0] = +S; UU[2][1] = 0.0; UU[2][2] = +C; 69 Matrix UU(3, 3); 70 UU[0][0] = +C; 71 UU[0][1] = 0.0; 72 UU[0][2] = -S; 73 UU[1][0] = 0.0; 74 UU[1][1] = 1.0; 75 UU[1][2] = 0.0; 76 UU[2][0] = +S; 77 UU[2][1] = 0.0; 78 UU[2][2] = +C; 71 79 return UU; 72 80 } … … 75 83 const double C = cos(Angle); 76 84 const double S = sin(Angle); 77 Matrix UU(3,3); 78 UU[0][0] = +C; UU[0][1] = +S; UU[0][2] = 0.0; 79 UU[1][0] = -S; UU[1][1] = +C; UU[1][2] = 0.0; 80 UU[2][0] = 0.0; UU[2][1] = 0.0; UU[2][2] = 1.0; 85 Matrix UU(3, 3); 86 UU[0][0] = +C; 87 UU[0][1] = +S; 88 UU[0][2] = 0.0; 89 UU[1][0] = -S; 90 UU[1][1] = +C; 91 UU[1][2] = 0.0; 92 UU[2][0] = 0.0; 93 UU[2][1] = 0.0; 94 UU[2][2] = 1.0; 81 95 return UU; 82 96 } … … 89 103 90 104 double Mjd_0 = floor(Mjd_UT1); 91 double UT1 = Secs*(Mjd_UT1-Mjd_0);92 double T_0 = (Mjd_0 -MJD_J2000)/36525.0;93 double T = (Mjd_UT1-MJD_J2000)/36525.0;94 95 double gmst = 24110.54841 + 8640184.812866*T_0 + 1.002737909350795*UT196 + (0.093104-6.2e-6*T)*T*T;97 98 return 2.0*M_PI*Frac(gmst/Secs);105 double UT1 = Secs * (Mjd_UT1 - Mjd_0); 106 double T_0 = (Mjd_0 - MJD_J2000) / 36525.0; 107 double T = (Mjd_UT1 - MJD_J2000) / 36525.0; 108 109 double gmst = 24110.54841 + 8640184.812866 * T_0 + 1.002737909350795 * UT1 110 + (0.093104 - 6.2e-6 * T) * T * T; 111 112 return 2.0 * M_PI * Frac(gmst / Secs); 99 113 } 100 114 … … 103 117 Matrix t_astro::NutMatrix(double Mjd_TT) { 104 118 105 const double T = (Mjd_TT-MJD_J2000)/36525.0; 106 107 double ls = 2.0*M_PI*Frac(0.993133+ 99.997306*T); 108 double D = 2.0*M_PI*Frac(0.827362+1236.853087*T); 109 double F = 2.0*M_PI*Frac(0.259089+1342.227826*T); 110 double N = 2.0*M_PI*Frac(0.347346- 5.372447*T); 111 112 double dpsi = ( -17.200*sin(N) - 1.319*sin(2*(F-D+N)) - 0.227*sin(2*(F+N)) 113 + 0.206*sin(2*N) + 0.143*sin(ls) ) / RHO_SEC; 114 double deps = ( + 9.203*cos(N) + 0.574*cos(2*(F-D+N)) + 0.098*cos(2*(F+N)) 115 - 0.090*cos(2*N) ) / RHO_SEC; 116 117 double eps = 0.4090928-2.2696E-4*T; 118 119 return rotX(-eps-deps)*rotZ(-dpsi)*rotX(+eps); 119 const double T = (Mjd_TT - MJD_J2000) / 36525.0; 120 121 double ls = 2.0 * M_PI * Frac(0.993133 + 99.997306 * T); 122 double D = 2.0 * M_PI * Frac(0.827362 + 1236.853087 * T); 123 double F = 2.0 * M_PI * Frac(0.259089 + 1342.227826 * T); 124 double N = 2.0 * M_PI * Frac(0.347346 - 5.372447 * T); 125 126 double dpsi = (-17.200 * sin(N) - 1.319 * sin(2 * (F - D + N)) 127 - 0.227 * sin(2 * (F + N)) 128 + 0.206 * sin(2 * N) + 0.143 * sin(ls)) / RHO_SEC; 129 double deps = (+9.203 * cos(N) + 0.574 * cos(2 * (F - D + N)) 130 + 0.098 * cos(2 * (F + N)) 131 - 0.090 * cos(2 * N)) / RHO_SEC; 132 133 double eps = 0.4090928 - 2.2696E-4 * T; 134 135 return rotX(-eps - deps) * rotZ(-dpsi) * rotX(+eps); 120 136 } 121 137 … … 124 140 Matrix t_astro::PrecMatrix(double Mjd_1, double Mjd_2) { 125 141 126 const double T = (Mjd_1-MJD_J2000)/36525.0; 127 const double dT = (Mjd_2-Mjd_1)/36525.0; 128 129 double zeta = ( (2306.2181+(1.39656-0.000139*T)*T)+ 130 ((0.30188-0.000344*T)+0.017998*dT)*dT )*dT/RHO_SEC; 131 double z = zeta + ( (0.79280+0.000411*T)+0.000205*dT)*dT*dT/RHO_SEC; 132 double theta = ( (2004.3109-(0.85330+0.000217*T)*T)- 133 ((0.42665+0.000217*T)+0.041833*dT)*dT )*dT/RHO_SEC; 142 const double T = (Mjd_1 - MJD_J2000) / 36525.0; 143 const double dT = (Mjd_2 - Mjd_1) / 36525.0; 144 145 double zeta = ((2306.2181 + (1.39656 - 0.000139 * T) * T) + 146 ((0.30188 - 0.000344 * T) + 0.017998 * dT) * dT) * dT / RHO_SEC; 147 double z = zeta 148 + ((0.79280 + 0.000411 * T) + 0.000205 * dT) * dT * dT / RHO_SEC; 149 double theta = ((2004.3109 - (0.85330 + 0.000217 * T) * T) - 150 ((0.42665 + 0.000217 * T) + 0.041833 * dT) * dT) * dT / RHO_SEC; 134 151 135 152 return rotZ(-z) * rotY(theta) * rotZ(-zeta); … … 140 157 ColumnVector t_astro::Sun(double Mjd_TT) { 141 158 142 const double eps = 23.43929111 /RHO_DEG;143 const double T = (Mjd_TT-MJD_J2000)/36525.0;144 145 double M = 2.0 *M_PI * Frac ( 0.9931267 + 99.9973583*T);146 double L = 2.0 *M_PI * Frac ( 0.7859444 + M/2.0/M_PI +147 (6892.0*sin(M)+72.0*sin(2.0*M)) / 1296.0e3);148 double r = 149.619e9 - 2.499e9 *cos(M) - 0.021e9*cos(2*M);159 const double eps = 23.43929111 / RHO_DEG; 160 const double T = (Mjd_TT - MJD_J2000) / 36525.0; 161 162 double M = 2.0 * M_PI * Frac(0.9931267 + 99.9973583 * T); 163 double L = 2.0 * M_PI * Frac(0.7859444 + M / 2.0 / M_PI + 164 (6892.0 * sin(M) + 72.0 * sin(2.0 * M)) / 1296.0e3); 165 double r = 149.619e9 - 2.499e9 * cos(M) - 0.021e9 * cos(2 * M); 149 166 150 167 ColumnVector r_Sun(3); 151 r_Sun << r*cos(L) << r*sin(L) << 0.0; r_Sun = rotX(-eps) * r_Sun; 152 153 return rotZ(GMST(Mjd_TT)) 154 * NutMatrix(Mjd_TT) 155 * PrecMatrix(MJD_J2000, Mjd_TT) 156 * r_Sun; 168 r_Sun << r * cos(L) << r * sin(L) << 0.0; 169 r_Sun = rotX(-eps) * r_Sun; 170 171 return rotZ(GMST(Mjd_TT)) 172 * NutMatrix(Mjd_TT) 173 * PrecMatrix(MJD_J2000, Mjd_TT) 174 * r_Sun; 157 175 } 158 176 … … 161 179 ColumnVector t_astro::Moon(double Mjd_TT) { 162 180 163 const double eps = 23.43929111/RHO_DEG; 164 const double T = (Mjd_TT-MJD_J2000)/36525.0; 165 166 double L_0 = Frac ( 0.606433 + 1336.851344*T ); 167 double l = 2.0*M_PI*Frac ( 0.374897 + 1325.552410*T ); 168 double lp = 2.0*M_PI*Frac ( 0.993133 + 99.997361*T ); 169 double D = 2.0*M_PI*Frac ( 0.827361 + 1236.853086*T ); 170 double F = 2.0*M_PI*Frac ( 0.259086 + 1342.227825*T ); 171 172 double dL = +22640*sin(l) - 4586*sin(l-2*D) + 2370*sin(2*D) + 769*sin(2*l) 173 -668*sin(lp) - 412*sin(2*F) - 212*sin(2*l-2*D)- 206*sin(l+lp-2*D) 174 +192*sin(l+2*D) - 165*sin(lp-2*D) - 125*sin(D) - 110*sin(l+lp) 175 +148*sin(l-lp) - 55*sin(2*F-2*D); 176 177 double L = 2.0*M_PI * Frac( L_0 + dL/1296.0e3 ); 178 179 double S = F + (dL+412*sin(2*F)+541*sin(lp)) / RHO_SEC; 180 double h = F-2*D; 181 double N = -526*sin(h) + 44*sin(l+h) - 31*sin(-l+h) - 23*sin(lp+h) 182 +11*sin(-lp+h) - 25*sin(-2*l+F) + 21*sin(-l+F); 183 184 double B = ( 18520.0*sin(S) + N ) / RHO_SEC; 181 const double eps = 23.43929111 / RHO_DEG; 182 const double T = (Mjd_TT - MJD_J2000) / 36525.0; 183 184 double L_0 = Frac(0.606433 + 1336.851344 * T); 185 double l = 2.0 * M_PI * Frac(0.374897 + 1325.552410 * T); 186 double lp = 2.0 * M_PI * Frac(0.993133 + 99.997361 * T); 187 double D = 2.0 * M_PI * Frac(0.827361 + 1236.853086 * T); 188 double F = 2.0 * M_PI * Frac(0.259086 + 1342.227825 * T); 189 190 double dL = +22640 * sin(l) - 4586 * sin(l - 2 * D) + 2370 * sin(2 * D) 191 + 769 * sin(2 * l) 192 - 668 * sin(lp) - 412 * sin(2 * F) - 212 * sin(2 * l - 2 * D) 193 - 206 * sin(l + lp - 2 * D) 194 + 192 * sin(l + 2 * D) - 165 * sin(lp - 2 * D) - 125 * sin(D) 195 - 110 * sin(l + lp) 196 + 148 * sin(l - lp) - 55 * sin(2 * F - 2 * D); 197 198 double L = 2.0 * M_PI * Frac(L_0 + dL / 1296.0e3); 199 200 double S = F + (dL + 412 * sin(2 * F) + 541 * sin(lp)) / RHO_SEC; 201 double h = F - 2 * D; 202 double N = -526 * sin(h) + 44 * sin(l + h) - 31 * sin(-l + h) 203 - 23 * sin(lp + h) 204 + 11 * sin(-lp + h) - 25 * sin(-2 * l + F) + 21 * sin(-l + F); 205 206 double B = (18520.0 * sin(S) + N) / RHO_SEC; 185 207 186 208 double cosB = cos(B); 187 209 188 double R = 385000e3 - 20905e3*cos(l) - 3699e3*cos(2*D-l) - 2956e3*cos(2*D) 189 -570e3*cos(2*l) + 246e3*cos(2*l-2*D) - 205e3*cos(lp-2*D) 190 -171e3*cos(l+2*D) - 152e3*cos(l+lp-2*D); 210 double R = 385000e3 - 20905e3 * cos(l) - 3699e3 * cos(2 * D - l) 211 - 2956e3 * cos(2 * D) 212 - 570e3 * cos(2 * l) + 246e3 * cos(2 * l - 2 * D) 213 - 205e3 * cos(lp - 2 * D) 214 - 171e3 * cos(l + 2 * D) - 152e3 * cos(l + lp - 2 * D); 191 215 192 216 ColumnVector r_Moon(3); 193 r_Moon << R *cos(L)*cosB << R*sin(L)*cosB << R*sin(B);217 r_Moon << R * cos(L) * cosB << R * sin(L) * cosB << R * sin(B); 194 218 r_Moon = rotX(-eps) * r_Moon; 195 219 196 return 197 198 199 220 return rotZ(GMST(Mjd_TT)) 221 * NutMatrix(Mjd_TT) 222 * PrecMatrix(MJD_J2000, Mjd_TT) 223 * r_Moon; 200 224 } 201 225 202 226 // Tidal Correction 203 227 //////////////////////////////////////////////////////////////////////////// 204 ColumnVector t_tides:: displacement(const bncTime& time, const ColumnVector& xyz) {228 ColumnVector t_tides::earth(const bncTime& time, const ColumnVector& xyz) { 205 229 206 230 if (time.undef()) { 207 ColumnVector dX(3); dX = 0.0; 231 ColumnVector dX(3); 232 dX = 0.0; 208 233 return dX; 209 234 } … … 214 239 _lastMjd = Mjd; 215 240 _xSun = t_astro::Sun(Mjd); 216 _rSun = sqrt(DotProduct(_xSun, _xSun));241 _rSun = sqrt(DotProduct(_xSun, _xSun)); 217 242 _xSun /= _rSun; 218 243 _xMoon = t_astro::Moon(Mjd); 219 _rMoon = sqrt(DotProduct(_xMoon, _xMoon));244 _rMoon = sqrt(DotProduct(_xMoon, _xMoon)); 220 245 _xMoon /= _rMoon; 221 246 } 222 247 223 double rRec= sqrt(DotProduct(xyz, xyz));248 double rRec = sqrt(DotProduct(xyz, xyz)); 224 249 ColumnVector xyzUnit = xyz / rRec; 225 250 … … 231 256 // Tidal Displacement 232 257 // ------------------ 233 double scSun 258 double scSun = DotProduct(xyzUnit, _xSun); 234 259 double scMoon = DotProduct(xyzUnit, _xMoon); 235 260 236 double p2Sun = 3.0 * (H2/2.0-L2) * scSun * scSun - H2/2.0;237 double p2Moon = 3.0 * (H2 /2.0-L2) * scMoon * scMoon - H2/2.0;238 239 double x2Sun 261 double p2Sun = 3.0 * (H2 / 2.0 - L2) * scSun * scSun - H2 / 2.0; 262 double p2Moon = 3.0 * (H2 / 2.0 - L2) * scMoon * scMoon - H2 / 2.0; 263 264 double x2Sun = 3.0 * L2 * scSun; 240 265 double x2Moon = 3.0 * L2 * scMoon; 241 266 242 267 const double gmWGS = 398.6005e12; 243 const double gms 244 const double gmm 245 246 double facSun 247 268 const double gms = 1.3271250e20; 269 const double gmm = 4.9027890e12; 270 271 double facSun = gms / gmWGS * 272 (rRec * rRec * rRec * rRec) / (_rSun * _rSun * _rSun); 248 273 249 274 double facMoon = gmm / gmWGS * 250 251 252 ColumnVector dX = facSun * (x2Sun * _xSun + p2Sun * xyzUnit) +253 275 (rRec * rRec * rRec * rRec) / (_rMoon * _rMoon * _rMoon); 276 277 ColumnVector dX = facSun * (x2Sun * _xSun + p2Sun * xyzUnit) 278 + facMoon * (x2Moon * _xMoon + p2Moon * xyzUnit); 254 279 255 280 return dX; … … 258 283 // Constructor 259 284 /////////////////////////////////////////////////////////////////////////// 260 t_loading::t_loading(const QString& fileName) { 261 285 t_tides::t_tides() { 286 _lastMjd = 0.0; 287 _rSun = 0.0; 288 _rMoon = 0.0; 262 289 newBlqData = 0; 263 readFile(fileName); 264 printAll(); 265 } 266 267 t_loading::~t_loading() { 290 } 291 292 t_tides::~t_tides() { 268 293 269 294 if (newBlqData) { … … 278 303 } 279 304 280 t_irc t_ loading::readFile(const QString&fileName) {305 t_irc t_tides::readBlqFile(const char* fileName) { 281 306 QFile inFile(fileName); 282 307 inFile.open(QIODevice::ReadOnly | QIODevice::Text); … … 285 310 QString site = QString(); 286 311 287 while ( !in.atEnd()) {312 while (!in.atEnd()) { 288 313 289 314 QString line = in.readLine(); 290 315 291 316 // skip empty lines and comments 292 if (line.indexOf("$$") != -1 || line.size() == 0) {317 if (line.indexOf("$$") != -1) { 293 318 continue; 294 319 } 295 296 320 line = line.trimmed(); 297 321 QTextStream inLine(line.toLatin1(), QIODevice::ReadOnly); 298 299 322 switch (row) { 300 323 case 0: 301 324 site = line; 302 325 site = site.toUpper(); 303 if (!newBlqData) { 304 newBlqData = new t_blqData; 305 newBlqData->amplitudes.ReSize(3,11); 306 newBlqData->phases.ReSize(3,11); 326 newBlqData = new t_blqData; 327 newBlqData->amplitudes.ReSize(3, 11); 328 newBlqData->phases.ReSize(3, 11); 329 break; 330 case 1: 331 case 2: 332 case 3: 333 for (int ii = 0; ii < 11; ii++) { 334 inLine >> newBlqData->amplitudes[row - 1][ii]; 307 335 } 308 336 break; 309 case 1: case 2: case 3: 337 case 4: 338 case 5: 310 339 for (int ii = 0; ii < 11; ii++) { 311 inLine >> newBlqData-> amplitudes[row-1][ii];340 inLine >> newBlqData->phases[row - 4][ii]; 312 341 } 313 342 break; 314 case 4: case 5: case6:343 case 6: 315 344 for (int ii = 0; ii < 11; ii++) { 316 inLine >> newBlqData->phases[row -4][ii];345 inLine >> newBlqData->phases[row - 4][ii]; 317 346 } 318 break;319 case 7:320 347 if (newBlqData && !site.isEmpty()) { 321 348 blqMap[site] = newBlqData; 322 349 site = QString(); 323 row = -1;324 350 newBlqData = 0; 325 351 } 352 row = -1; 326 353 break; 327 354 } … … 332 359 } 333 360 361 ColumnVector t_tides::ocean(const bncTime& time, const ColumnVector& xyz, 362 const std::string& station) { 363 ColumnVector dX(3); dX = 0.0; 364 if (time.undef()) { 365 return dX; 366 } 367 QString stationQ = station.c_str(); 368 if (blqMap.find(stationQ) == blqMap.end()) { 369 return dX; 370 } 371 t_blqData* blqSet = blqMap[stationQ]; //printBlqSet(station, blqSet); 372 373 // angular argument: see arg2.f from IERS Conventions software collection 374 double speed[11] = {1.40519e-4, 1.45444e-4, 1.3788e-4, 1.45842e-4, 7.2921e-5, 375 6.7598e-5, 7.2523e-5, 6.4959e-5, 5.3234e-6, 2.6392e-6, 3.982e-7}; 376 377 double angfac[4][11]; 378 angfac[0][0] = 2.0; 379 angfac[1][0] =-2.0; 380 angfac[2][0] = 0.0; 381 angfac[3][0] = 0.0; 382 383 angfac[0][1] = 0.0; 384 angfac[1][1] = 0.0; 385 angfac[2][1] = 0.0; 386 angfac[3][1] = 0.0; 387 388 angfac[0][2] = 2.0; 389 angfac[1][2] =-3.0; 390 angfac[2][2] = 1.0; 391 angfac[3][2] = 0.0; 392 393 angfac[0][3] = 2.0; 394 angfac[1][3] = 0.0; 395 angfac[2][3] = 0.0; 396 angfac[3][3] = 0.0; 397 398 angfac[0][4] = 1.0; 399 angfac[1][4] = 0.0; 400 angfac[2][4] = 0.0; 401 angfac[3][4] = .25; 402 403 angfac[0][5] = 1.0; 404 angfac[1][5] =-2.0; 405 angfac[2][5] = 0.0; 406 angfac[3][5] =-.25; 407 408 angfac[0][6] =-1.0; 409 angfac[1][6] = 0.0; 410 angfac[2][6] = 0.0; 411 angfac[3][6] =-.25; 412 413 angfac[0][7] = 1.0; 414 angfac[1][7] =-3.0; 415 angfac[2][7] = 1.0; 416 angfac[3][7] =-.25; 417 418 angfac[0][8] = 0.0; 419 angfac[1][8] = 2.0; 420 angfac[2][8] = 0.0; 421 angfac[3][8] = 0.0; 422 423 angfac[0][9] = 0.0; 424 angfac[1][9] = 1.0; 425 angfac[2][9] =-1.0; 426 angfac[3][9] = 0.0; 427 428 angfac[0][10] = 2.0; 429 angfac[1][10] = 0.0; 430 angfac[2][10] = 0.0; 431 angfac[3][10] = 0.0; 432 433 double twopi = 6.283185307179586476925287e0; 434 double dtr = 0.0174532925199; 435 436 // fractional part of the day in seconds 437 unsigned int year, month, day; 438 time.civil_date(year, month, day); 439 int iyear = year - 2000; 440 QDateTime datTim = QDateTime::fromString(QString::fromStdString(time.datestr()), Qt::ISODate); 441 int doy = datTim.date().dayOfYear(); 442 double fday = time.daysec(); 443 int icapd = doy + 365 * (iyear - 75) + ((iyear - 73) / 4); 444 double capt = (icapd * 1.000000035 + 27392.500528) / 36525.0; 445 446 // mean longitude of the sun at the beginning of the day 447 double h0 = (279.69668e0 + (36000.768930485e0 + 3.03e-4 * capt) * capt) * dtr; 448 449 // mean longitude of moon at the beginning of the day 450 double s0 = (((1.9e-6 * capt - .001133e0) * capt + 481267.88314137e0) * capt + 270.434358e0) * dtr; 451 452 // mean longitude of lunar perigee at the beginning of the day 453 double p0 = (((-1.2e-5 * capt - .010325e0) * capt + 4069.0340329577e0) * capt + 334.329653e0) * dtr; 454 455 // tidal angle arguments 456 double angle[11]; 457 for (int k = 0; k < 11; ++k) { 458 angle[k] = speed[k] * fday 459 + angfac[0][k] * h0 460 + angfac[1][k] * s0 461 + angfac[2][k] * p0 462 + angfac[3][k] * twopi; 463 angle[k] = fmod(angle[k], twopi); 464 if (angle[k] < 0.0) { 465 angle[k] += twopi; 466 } 467 } 468 469 // displacement by 11 constituents 470 ColumnVector rwsSta(3); rwsSta = 0.0; // radial, west, south 471 for (int rr = 0; rr < 3; rr++) { 472 for (int cc = 0; cc < 11; cc++) { 473 rwsSta[rr] += blqSet->amplitudes[rr][cc] * cos((angle[cc] - (blqSet->phases[rr][cc]/RHO_DEG))); 474 } 475 } 476 477 // neu2xyz 478 ColumnVector dneu(3); // neu 479 dneu[0] = -rwsSta[2]; 480 dneu[1] = -rwsSta[1]; 481 dneu[2] = rwsSta[0]; 482 double recEll[3]; xyz2ell(xyz.data(), recEll) ; 483 neu2xyz(recEll, dneu.data(), dX.data()); 484 485 return dX; 486 } 487 334 488 // Print 335 489 //////////////////////////////////////////////////////////////////////////// 336 void t_ loading::printAll() const {490 void t_tides::printAllBlqSets() const { 337 491 338 492 QMapIterator<QString, t_blqData*> it(blqMap); … … 341 495 t_blqData* blq = it.value(); 342 496 QString site = it.key(); 343 cout << site.toStdString().c_str() << "\n ";497 cout << site.toStdString().c_str() << "\n===============\n"; 344 498 for (int rr = 0; rr < 3; rr++) { 345 499 for (int cc = 0; cc < 11; cc++) { … … 357 511 } 358 512 513 // Print 514 //////////////////////////////////////////////////////////////////////////// 515 void t_tides::printBlqSet(const std::string& station, t_blqData* blq) { 516 cout << station << endl; 517 for (int rr = 0; rr < 3; rr++) { 518 for (int cc = 0; cc < 11; cc++) { 519 cout << blq->amplitudes[rr][cc] << " "; 520 } 521 cout << endl; 522 } 523 for (int rr = 0; rr < 3; rr++) { 524 for (int cc = 0; cc < 11; cc++) { 525 cout << blq->phases[rr][cc] << " "; 526 } 527 cout << endl; 528 } 529 } 530 359 531 // Constructor 360 532 /////////////////////////////////////////////////////////////////////////// 361 533 t_windUp::t_windUp() { 362 534 for (unsigned ii = 0; ii <= t_prn::MAXPRN; ii++) { 363 sumWind[ii] 535 sumWind[ii] = 0.0; 364 536 lastEtime[ii] = 0.0; 365 537 } … … 369 541 /////////////////////////////////////////////////////////////////////////// 370 542 double t_windUp::value(const bncTime& etime, const ColumnVector& rRec, 371 372 543 t_prn prn, const ColumnVector& rSat, bool ssr, 544 double yaw, const ColumnVector& vSat) { 373 545 374 546 if (etime.mjddec() != lastEtime[prn.toInt()]) { … … 377 549 // -------------------------------------- 378 550 ColumnVector rho = rRec - rSat; 379 rho /= rho. norm_Frobenius();551 rho /= rho.NormFrobenius(); 380 552 381 553 // GPS Satellite unit Vectors sz, sy, sx … … 392 564 sHlp = vSat + crossproduct(Omega, rSat); 393 565 } 394 sHlp /= sHlp. norm_Frobenius();395 396 ColumnVector sz = -rSat / rSat. norm_Frobenius();566 sHlp /= sHlp.NormFrobenius(); 567 568 ColumnVector sz = -rSat / rSat.NormFrobenius(); 397 569 ColumnVector sy = crossproduct(sz, sHlp); 398 570 ColumnVector sx = crossproduct(sy, sz); 399 571 400 // Yaw consideration 401 sx = t_astro::rotZ(yaw) * sx; 402 572 if (ssr) { 573 // Yaw angle consideration 574 Matrix SXYZ(3, 3); 575 SXYZ.Column(1) = sx; 576 SXYZ.Column(2) = sy; 577 SXYZ.Column(3) = sz; 578 SXYZ = DotProduct(t_astro::rotZ(yaw), SXYZ); 579 sx = SXYZ.Column(1); 580 sy = SXYZ.Column(2); 581 sz = SXYZ.Column(3); 582 } 403 583 // Effective Dipole of the GPS Satellite Antenna 404 584 // --------------------------------------------- 405 ColumnVector dipSat = sx - rho * DotProduct(rho,sx) - crossproduct(rho, sy); 585 ColumnVector dipSat = sx - rho * DotProduct(rho, sx) 586 - crossproduct(rho, sy); 406 587 407 588 // Receiver unit Vectors rx, ry … … 409 590 ColumnVector rx(3); 410 591 ColumnVector ry(3); 411 double recEll[3]; xyz2ell(rRec.data(), recEll) ; 592 double recEll[3]; 593 xyz2ell(rRec.data(), recEll); 412 594 double neu[3]; 413 595 … … 417 599 neu2xyz(recEll, neu, rx.data()); 418 600 419 neu[0] = 601 neu[0] = 0.0; 420 602 neu[1] = -1.0; 421 neu[2] = 603 neu[2] = 0.0; 422 604 neu2xyz(recEll, neu, ry.data()); 423 605 424 606 // Effective Dipole of the Receiver Antenna 425 607 // ---------------------------------------- 426 ColumnVector dipRec = rx - rho * DotProduct(rho,rx) + crossproduct(rho, ry); 608 ColumnVector dipRec = rx - rho * DotProduct(rho, rx) 609 + crossproduct(rho, ry); 427 610 428 611 // Resulting Effect 429 612 // ---------------- 430 double alpha = DotProduct(dipSat,dipRec) / 431 (dipSat.norm_Frobenius() * dipRec.norm_Frobenius()); 432 /* 433 if (alpha > 1.0) alpha = 1.0; 434 if (alpha < -1.0) alpha = -1.0; 435 */ 613 double alpha = DotProduct(dipSat, dipRec) 614 / (dipSat.NormFrobenius() * dipRec.NormFrobenius()); 615 616 if (alpha > 1.0) 617 alpha = 1.0; 618 if (alpha < -1.0) 619 alpha = -1.0; 620 436 621 double dphi = acos(alpha) / 2.0 / M_PI; // in cycles 437 622 438 if ( DotProduct(rho, crossproduct(dipSat, dipRec)) < 0.0) {623 if (DotProduct(rho, crossproduct(dipSat, dipRec)) < 0.0) { 439 624 dphi = -dphi; 440 625 } … … 467 652 double height = ell[2]; 468 653 469 double pp = 1013.25 * pow(1.0 - 2.26e-5 * height, 5.225); 470 double TT = 18.0 - height * 0.0065 + 273.15; 471 double hh = 50.0 * exp(-6.396e-4 * height); 472 double ee = hh / 100.0 * exp(-37.2465 + 0.213166*TT - 0.000256908*TT*TT); 654 double pp = 1013.25 * pow(1.0 - 2.26e-5 * height, 5.225); 655 double TT = 18.0 - height * 0.0065 + 273.15; 656 double hh = 50.0 * exp(-6.396e-4 * height); 657 double ee = hh / 100.0 658 * exp(-37.2465 + 0.213166 * TT - 0.000256908 * TT * TT); 473 659 474 660 double h_km = height / 1000.0; 475 661 476 if (h_km < 0.0) h_km = 0.0; 477 if (h_km > 5.0) h_km = 5.0; 478 int ii = int(h_km + 1); if (ii > 5) ii = 5; 662 if (h_km < 0.0) 663 h_km = 0.0; 664 if (h_km > 5.0) 665 h_km = 5.0; 666 int ii = int(h_km + 1); 667 if (ii > 5) 668 ii = 5; 479 669 double href = ii - 1; 480 670 … … 487 677 bCor[5] = 0.563; 488 678 489 double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href); 490 491 double zen = M_PI/2.0 - Ele; 492 493 return (0.002277/cos(zen)) * (pp + ((1255.0/TT)+0.05)*ee - BB*(tan(zen)*tan(zen))); 679 double BB = bCor[ii - 1] + (bCor[ii] - bCor[ii - 1]) * (h_km - href); 680 681 double zen = M_PI / 2.0 - Ele; 682 683 return (0.002277 / cos(zen)) 684 * (pp + ((1255.0 / TT) + 0.05) * ee - BB * (tan(zen) * tan(zen))); 494 685 } 495 686 … … 500 691 } 501 692 502 t_iono::~t_iono() {} 693 t_iono::~t_iono() { 694 } 503 695 504 696 double t_iono::stec(const t_vTec* vTec, double signalPropagationTime, 505 506 697 const ColumnVector& rSat, const bncTime& epochTime, 698 const ColumnVector& xyzSta) { 507 699 508 700 // Latitude, longitude, height are defined with respect to a spherical earth model … … 524 716 // ------------------------------------------------------------- 525 717 ColumnVector rhoV = xyzSat - xyzSta; 526 double rho = rhoV. norm_Frobenius();718 double rho = rhoV.NormFrobenius(); 527 719 ColumnVector neu(3); 528 720 xyz2neu(geocSta.data(), rhoV.data(), neu.data()); 529 double sphEle = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho);721 double sphEle = acos(sqrt(neu[0] * neu[0] + neu[1] * neu[1]) / rho); 530 722 if (neu[2] < 0) { 531 723 sphEle *= -1.0; … … 537 729 double stec = 0.0; 538 730 for (unsigned ii = 0; ii < vTec->_layers.size(); ii++) { 539 piercePoint(vTec->_layers[ii]._height, epoch, geocSta.data(), sphEle, sphAzi); 731 piercePoint(vTec->_layers[ii]._height, epoch, geocSta.data(), sphEle, 732 sphAzi); 540 733 double vtec = vtecSingleLayerContribution(vTec->_layers[ii]); 541 734 stec += vtec * sin(sphEle + _psiPP); … … 547 740 548 741 double vtec = 0.0; 549 int N = vTecLayer._C.Nrows() -1;550 int M = vTecLayer._C.Ncols() -1;742 int N = vTecLayer._C.Nrows() - 1; 743 int M = vTecLayer._C.Ncols() - 1; 551 744 double fac; 552 745 … … 576 769 } 577 770 578 void t_iono::piercePoint(double layerHeight, double epoch, const double* geocSta, 771 void t_iono::piercePoint(double layerHeight, double epoch, 772 const double* geocSta, 579 773 double sphEle, double sphAzi) { 580 774 581 775 double q = (t_CST::rgeoc + geocSta[2]) / (t_CST::rgeoc + layerHeight); 582 776 583 _psiPP = M_PI/2 - sphEle - asin(q * cos(sphEle)); 584 585 _phiPP = asin(sin(geocSta[0]) * cos(_psiPP) + cos(geocSta[0]) * sin(_psiPP) * cos(sphAzi)); 586 587 if (( (geocSta[0]*180.0/M_PI > 0) && ( tan(_psiPP) * cos(sphAzi) > tan(M_PI/2 - geocSta[0])) ) || 588 ( (geocSta[0]*180.0/M_PI < 0) && (-(tan(_psiPP) * cos(sphAzi)) > tan(M_PI/2 + geocSta[0])) )) { 589 _lambdaPP = geocSta[1] + M_PI - asin((sin(_psiPP) * sin(sphAzi) / cos(_phiPP))); 590 } else { 591 _lambdaPP = geocSta[1] + asin((sin(_psiPP) * sin(sphAzi) / cos(_phiPP))); 592 } 593 594 _lonS = fmod((_lambdaPP + (epoch - 50400) * M_PI / 43200), 2*M_PI); 777 _psiPP = M_PI / 2 - sphEle - asin(q * cos(sphEle)); 778 779 _phiPP = asin( 780 sin(geocSta[0]) * cos(_psiPP) 781 + cos(geocSta[0]) * sin(_psiPP) * cos(sphAzi)); 782 783 if (((geocSta[0] * 180.0 / M_PI > 0) 784 && (tan(_psiPP) * cos(sphAzi) > tan(M_PI / 2 - geocSta[0]))) 785 || 786 ((geocSta[0] * 180.0 / M_PI < 0) 787 && (-(tan(_psiPP) * cos(sphAzi)) > tan(M_PI / 2 + geocSta[0])))) { 788 _lambdaPP = geocSta[1] + M_PI 789 - asin((sin(_psiPP) * sin(sphAzi) / cos(_phiPP))); 790 } 791 else { 792 _lambdaPP = geocSta[1] + asin((sin(_psiPP) * sin(sphAzi) / cos(_phiPP))); 793 } 794 795 _lonS = fmod((_lambdaPP + (epoch - 50400) * M_PI / 43200), 2 * M_PI); 595 796 596 797 return; -
trunk/BNC/src/pppModel.h
r8619 r8905 5 5 #include <newmat.h> 6 6 #include <iostream> 7 #include <string> 7 8 #include "bnctime.h" 8 9 #include "t_prn.h" … … 21 22 22 23 private: 23 static const double RHO_DEG;24 static const double RHO_SEC;25 static const double MJD_J2000;26 27 24 static double GMST(double Mjd_UT1); 28 25 static Matrix NutMatrix(double Mjd_TT); … … 32 29 class t_tides { 33 30 public: 34 t_tides() { 35 _lastMjd = 0.0; 36 _rSun = 0.0; 37 _rMoon = 0.0; 38 } 39 ~t_tides() {} 40 ColumnVector displacement(const bncTime& time, const ColumnVector& xyz); 31 t_tides(); 32 ~t_tides(); 33 ColumnVector earth(const bncTime& time, const ColumnVector& xyz); 34 ColumnVector ocean(const bncTime& time, const ColumnVector& xyz, const std::string& station); 35 t_irc readBlqFile(const char* fileName); 36 void printAllBlqSets() const; 41 37 private: 42 38 double _lastMjd; … … 45 41 double _rSun; 46 42 double _rMoon; 47 };48 43 49 class t_loading {50 public:51 t_loading(const QString& fileName);52 ~t_loading();53 t_irc readFile(const QString& fileName);54 void printAll() const;55 56 private:57 44 class t_blqData { 58 45 public: … … 63 50 t_blqData* newBlqData; 64 51 QMap <QString, t_blqData*> blqMap; 65 52 void printBlqSet(const std::string& station, t_blqData* blq); 66 53 }; 67 54 … … 98 85 double _lambdaPP; 99 86 double _lonS; 100 101 102 87 }; 103 88 -
trunk/BNC/src/pppOptions.cpp
r7048 r8905 35 35 * Created: 29-Jul-2014 36 36 * 37 * Changes: 37 * Changes: 38 38 * 39 39 * -----------------------------------------------------------------------*/ … … 59 59 } 60 60 61 // 61 // 62 62 ////////////////////////////////////////////////////////////////////////////// 63 63 const std::vector<t_lc::type>& t_pppOptions::LCs(char system) const { … … 77 77 } 78 78 79 // 79 // 80 80 ////////////////////////////////////////////////////////////////////////////// 81 81 bool t_pppOptions::useOrbClkCorr() const { … … 99 99 } 100 100 101 // 101 // 102 102 ///////////////////////////////////////////////////////////////////////////// 103 103 vector<t_lc::type> t_pppOptions::ambLCs(char system) const { 104 104 105 105 const vector<t_lc::type>& allLCs = LCs(system); 106 106 vector<t_lc::type> phaseLCs; … … 146 146 return answ; 147 147 } 148 149 -
trunk/BNC/src/pppOptions.h
r7961 r8905 11 11 class t_pppOptions { 12 12 public: 13 enum e_type {IF, UncombPPP, PPPRTK, DCMcodeBias, DCMphaseBias}; 13 14 t_pppOptions(); 14 15 ~t_pppOptions(); … … 18 19 std::vector<t_lc::type> ambLCs(char system) const; 19 20 std::vector<t_lc::type> codeLCs(char system) const; 21 std::vector<t_lc::type> ionoLCs(char system) const; 20 22 bool useSystem(char system) const {return LCs(system).size() > 0;} 21 23 bool useOrbClkCorr() const; … … 25 27 } 26 28 29 e_type _obsModelType; 30 QStringList _obsmodelTypeStr = QStringList() 31 << "IF PPP" 32 << "Uncombined PPP" 33 << "PPP-RTK" 34 << "DCM with Code Biases" 35 << "DCM with Phase Biases"; 27 36 bool _realTime; 28 37 std::string _crdFile; … … 43 52 double _maxResC1; 44 53 double _maxResL1; 54 double _sigmaGIMdiff; 55 double _maxResGIMdiff; 45 56 bool _eleWgtCode; 46 57 bool _eleWgtPhase; … … 52 63 double _aprSigTrp; 53 64 double _noiseTrp; 65 double _aprSigIon; 66 double _noiseIon; 67 double _aprSigCodeBias; 68 double _noiseCodeBias; 69 double _aprSigPhaseBias; 70 double _noisePhaseBias; 54 71 int _nmeaPort; 55 72 double _aprSigAmb; … … 59 76 std::vector<t_lc::type> _LCsGalileo; 60 77 std::vector<t_lc::type> _LCsBDS; 78 bool _pseudoObsIono; 79 bool _refSatRequired; 61 80 }; 62 81 -
trunk/BNC/src/pppWidgets.cpp
r8773 r8905 82 82 _lcGalileo = new QComboBox(); _lcGalileo ->setObjectName("PPP/lcGalileo"); _widgets << _lcGalileo; 83 83 _lcBDS = new QComboBox(); _lcBDS ->setObjectName("PPP/lcBDS"); _widgets << _lcBDS; 84 _modelObs = new QComboBox(); _modelObs ->setObjectName("PPP/modelObs"); _widgets << _modelObs; 85 _pseudoObs = new QComboBox(); _pseudoObs ->setObjectName("PPP/pseudoObs"); _widgets << _pseudoObs; 84 86 _sigmaC1 = new QLineEdit(); _sigmaC1 ->setObjectName("PPP/sigmaC1"); _widgets << _sigmaC1; 85 87 _sigmaL1 = new QLineEdit(); _sigmaL1 ->setObjectName("PPP/sigmaL1"); _widgets << _sigmaL1; … … 111 113 _dataSource->addItems(QString(",Real-Time Streams,RINEX Files").split(",")); 112 114 connect(_dataSource, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets())); 113 114 connect(_snxtroPath, SIGNAL(textChanged(const QString &)), 115 this, SLOT(slotPPPTextChanged())); 116 117 connect(_snxtroAc, SIGNAL(textChanged(const QString &)), 118 this, SLOT(slotPPPTextChanged())); 119 120 connect(_snxtroSol, SIGNAL(textChanged(const QString &)), 121 this, SLOT(slotPPPTextChanged())); 115 connect(_modelObs, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotEnableWidgets())); 116 connect(_snxtroPath, SIGNAL(textChanged(const QString &)), this, SLOT(slotPPPTextChanged())); 117 connect(_snxtroAc, SIGNAL(textChanged(const QString &)), this, SLOT(slotPPPTextChanged())); 118 connect(_snxtroSol, SIGNAL(textChanged(const QString &)), this, SLOT(slotPPPTextChanged())); 122 119 123 120 slotEnableWidgets(); … … 127 124 _lcGPS->addItems(QString("P3,P3&L3").split(",")); 128 125 #else 129 _lcGPS->addItems(QString("no,Pi,Li,Pi&Li ,P3,L3,P3&L3").split(","));126 _lcGPS->addItems(QString("no,Pi,Li,Pi&Li").split(",")); 130 127 #endif 131 128 … … 134 131 _lcGLONASS->addItems(QString("no,P3,L3,P3&L3").split(",")); 135 132 #else 136 _lcGLONASS->addItems(QString("no,Pi,Li,Pi&Li ,P3,L3,P3&L3").split(","));133 _lcGLONASS->addItems(QString("no,Pi,Li,Pi&Li").split(",")); 137 134 #endif 138 135 … … 141 138 _lcGalileo->addItems(QString("no,P3,L3,P3&L3").split(",")); 142 139 #else 143 _lcGalileo->addItems(QString("no,Pi,Li,Pi&Li ,P3,L3,P3&L3").split(","));140 _lcGalileo->addItems(QString("no,Pi,Li,Pi&Li").split(",")); 144 141 #endif 145 142 … … 148 145 _lcBDS->addItems(QString("no,P3,L3,P3&L3").split(",")); 149 146 #else 150 _lcBDS->addItems(QString("no,Pi,Li,Pi&Li,P3,L3,P3&L3").split(",")); 147 _lcBDS->addItems(QString("no,Pi,Li,Pi&Li").split(",")); 148 #endif 149 150 _modelObs->setEditable(false); 151 _pseudoObs->setEditable(false); 152 #ifdef USE_PPP_SSR_I 153 _modelObs->addItems(QString("Ionosphere-free PPP").split(",")); 154 _pseudoObs->addItems(QString("no").split(",")); 155 #else 156 _modelObs->addItems(QString("Ionosphere-free PPP,Uncombined PPP,PPP-RTK,DCM with Code Biases,DCM with Phase Biases").split(",")); 157 _pseudoObs->addItems(QString("no,Ionosphere").split(",")); 151 158 #endif 152 159 … … 247 254 delete _lcGalileo; 248 255 delete _lcBDS; 256 delete _modelObs; 257 delete _pseudoObs; 249 258 delete _sigmaC1; 250 259 delete _sigmaL1; … … 297 306 _lcBDS->setCurrentIndex(ii); 298 307 } 308 ii = _modelObs->findText(settings.value(_modelObs->objectName()).toString()); 309 if (ii != -1) { 310 _modelObs->setCurrentIndex(ii); 311 } 312 ii = _pseudoObs->findText(settings.value(_pseudoObs->objectName()).toString()); 313 if (ii != -1) { 314 _pseudoObs->setCurrentIndex(ii); 315 } 299 316 ii = _snxtroIntr->findText(settings.value(_snxtroIntr->objectName()).toString()); 300 317 if (ii != -1) { … … 433 450 settings.setValue(_lcGalileo ->objectName(), _lcGalileo ->currentText()); 434 451 settings.setValue(_lcBDS ->objectName(), _lcBDS ->currentText()); 452 settings.setValue(_modelObs ->objectName(), _modelObs ->currentText()); 453 settings.setValue(_pseudoObs ->objectName(), _pseudoObs ->currentText()); 435 454 settings.setValue(_sigmaC1 ->objectName(), _sigmaC1 ->text()); 436 455 settings.setValue(_sigmaL1 ->objectName(), _sigmaL1 ->text()); … … 477 496 bool realTime = _dataSource->currentText() == "Real-Time Streams"; 478 497 bool rinexFiles = _dataSource->currentText() == "RINEX Files"; 498 bool enablePseudoObs; 499 if (_modelObs->currentText() == "PPP-RTK" || 500 _modelObs->currentText() == "Ionosphere-free PPP") { 501 enablePseudoObs = false; 502 } 503 else { 504 enablePseudoObs = true; 505 } 479 506 480 507 QListIterator<QWidget*> it(_widgets); … … 490 517 } 491 518 else if (rinexFiles) { 492 _corrMount->setEnabled(false); 493 // _plotCoordinates->setEnabled(false); 494 // _audioResponse->setEnabled(false); 519 _corrMount ->setEnabled(false); 520 _audioResponse->setEnabled(false); 495 521 } 496 522 … … 506 532 _snxtroAc ->setEnabled(false); 507 533 _snxtroSol ->setEnabled(false); 534 } 535 536 if (enablePseudoObs) { 537 _pseudoObs->setEnabled(true); 538 } else { 539 _pseudoObs->setEnabled(false); 508 540 } 509 541 … … 592 624 } 593 625 } 594 } 626 627 628 } -
trunk/BNC/src/pppWidgets.h
r8403 r8905 66 66 QComboBox* _lcGalileo; 67 67 QComboBox* _lcBDS; 68 QComboBox* _modelObs; 69 QComboBox* _pseudoObs; 68 70 QLineEdit* _sigmaC1; 69 71 QLineEdit* _sigmaL1; -
trunk/BNC/src/src.pri
r8267 r8905 122 122 HEADERS += PPP/pppClient.h PPP/pppObsPool.h PPP/pppEphPool.h \ 123 123 PPP/pppStation.h PPP/pppFilter.h PPP/pppParlist.h \ 124 PPP/pppSatObs.h 124 PPP/pppSatObs.h PPP/pppRefSat.h 125 125 SOURCES += PPP/pppClient.cpp PPP/pppObsPool.cpp PPP/pppEphPool.cpp \ 126 126 PPP/pppStation.cpp PPP/pppFilter.cpp PPP/pppParlist.cpp \ 127 PPP/pppSatObs.cpp 127 PPP/pppSatObs.cpp PPP/pppRefSat.cpp 128 128 } 129 129 else {
Note:
See TracChangeset
for help on using the changeset viewer.