Changeset 10791 in ntrip for trunk/BNC/src/PPP
- Timestamp:
- Dec 3, 2025, 5:37:16 PM (5 months ago)
- Location:
- trunk/BNC/src/PPP
- Files:
-
- 4 added
- 11 edited
-
ambres.cpp (added)
-
ambres.h (added)
-
lambda.cpp (added)
-
lambda.h (added)
-
pppClient.cpp (modified) (12 diffs)
-
pppClient.h (modified) (3 diffs)
-
pppEphPool.cpp (modified) (3 diffs)
-
pppFilter.cpp (modified) (17 diffs)
-
pppFilter.h (modified) (1 diff)
-
pppObsPool.cpp (modified) (3 diffs)
-
pppObsPool.h (modified) (1 diff)
-
pppParlist.cpp (modified) (14 diffs)
-
pppParlist.h (modified) (6 diffs)
-
pppSatObs.cpp (modified) (29 diffs)
-
pppSatObs.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppClient.cpp
r10765 r10791 117 117 ////////////////////////////////////////////////////////////////////////////// 118 118 void t_pppClient::putOrbCorrections(const vector<t_orbCorr*>& corr) { 119 if (OPT->_logMode == t_pppOptions::normal && corr.size() > 0) { 120 LOG << "orbCorrections " << string(corr[0]->_time) << ' ' << corr.size() << endl; 121 } 119 122 for (unsigned ii = 0; ii < corr.size(); ii++) { 120 123 _ephPool->putOrbCorrection(new t_orbCorr(*corr[ii])); … … 125 128 ////////////////////////////////////////////////////////////////////////////// 126 129 void t_pppClient::putClkCorrections(const vector<t_clkCorr*>& corr) { 130 if (OPT->_logMode == t_pppOptions::normal && corr.size() > 0) { 131 LOG << "clkCorrections " << string(corr[0]->_time) << ' ' << corr.size() << endl; 132 } 127 133 for (unsigned ii = 0; ii < corr.size(); ii++) { 128 134 _ephPool->putClkCorrection(new t_clkCorr(*corr[ii])); … … 133 139 ////////////////////////////////////////////////////////////////////////////// 134 140 void t_pppClient::putCodeBiases(const vector<t_satCodeBias*>& biases) { 141 if (OPT->_logMode == t_pppOptions::normal && biases.size() > 0) { 142 LOG << "codeBiases " << string(biases[0]->_time) << ' ' << biases.size() << endl; 143 } 144 set<char> systems; 135 145 for (unsigned ii = 0; ii < biases.size(); ii++) { 136 _obsPool->putCodeBias(new t_satCodeBias(*biases[ii])); 146 t_satCodeBias* newBias = new t_satCodeBias(*biases[ii]); 147 char sys = newBias->_prn.system(); 148 if (systems.find(sys) == systems.end()) { 149 _obsPool->clearCodeBiases(sys); 150 systems.insert(sys); 151 } 152 _obsPool->putCodeBias(newBias); 137 153 } 138 154 } … … 141 157 ////////////////////////////////////////////////////////////////////////////// 142 158 void t_pppClient::putPhaseBiases(const vector<t_satPhaseBias*>& biases) { 159 if (OPT->_logMode == t_pppOptions::normal && biases.size() > 0) { 160 LOG << "phaseBiases " << string(biases[0]->_time) << ' ' << biases.size() << endl; 161 } 162 set<char> systems; 143 163 for (unsigned ii = 0; ii < biases.size(); ii++) { 144 _obsPool->putPhaseBias(new t_satPhaseBias(*biases[ii])); 164 t_satPhaseBias* newBias = new t_satPhaseBias(*biases[ii]); 165 char sys = newBias->_prn.system(); 166 if (systems.find(sys) == systems.end()) { 167 _obsPool->clearPhaseBiases(sys); 168 systems.insert(sys); 169 } 170 _obsPool->putPhaseBias(newBias); 145 171 } 146 172 } … … 211 237 } 212 238 } 213 /* 214 vector<t_pppSatObs*>::iterator it = obsVector.begin(); 215 while (it != obsVector.end()) { 216 t_pppSatObs* satObs = *it; 217 satObs->printObsMinusComputed(); 218 it++; 219 } 220 */ 239 240 if (OPT->_logMode == t_pppOptions::all) { 241 vector<t_pppSatObs*>::iterator it = obsVector.begin(); 242 while (it != obsVector.end()) { 243 t_pppSatObs* satObs = *it; 244 satObs->printObsMinusComputed(); 245 it++; 246 } 247 } 221 248 return pseudoObsIono; 222 249 } 223 224 //225 //////////////////////////////////////////////////////////////////////////////226 void t_pppClient::useObsWithCodeBiasesOnly(std::vector<t_pppSatObs*>& obsVector) {227 228 vector<t_pppSatObs*>::iterator it = obsVector.begin();229 while (it != obsVector.end()) {230 t_pppSatObs* pppSatObs = *it;231 bool codeBiasesAvailable = false;232 if (pppSatObs->getCodeBias(pppSatObs->fType1()) &&233 pppSatObs->getCodeBias(pppSatObs->fType2())) {234 codeBiasesAvailable = true;235 }236 if (codeBiasesAvailable) {237 ++it;238 }239 else {240 it = obsVector.erase(it);241 delete pppSatObs;242 }243 }244 return;245 }246 247 250 248 251 // Compute the Bancroft position, check for blunders … … 251 254 vector<t_pppSatObs*>& obsVector, 252 255 ColumnVector& xyzc, bool print) { 253 t_lc::type tLC = t_lc::dummy; 256 254 257 int numBancroft = obsVector.size(); 255 258 … … 259 262 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 260 263 const t_pppSatObs* satObs = obsVector.at(ii); 261 if (tLC == t_lc::dummy) { 262 if (satObs->isValid(t_lc::cIF)) { 263 tLC = t_lc::cIF; 264 } 265 else if (satObs->isValid(t_lc::c1)) { 266 tLC = t_lc::c1; 267 } 268 else if (satObs->isValid(t_lc::c2)) { 269 tLC = t_lc::c2; 270 } 271 } 272 if ( satObs->isValid(tLC) && 264 t_lc LC = satObs->rangeLC(); 265 if ( satObs->isValid(LC) && 273 266 (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) { 274 267 ++iObs; … … 276 269 BB[iObs][1] = satObs->xc()[1]; 277 270 BB[iObs][2] = satObs->xc()[2]; 278 BB[iObs][3] = satObs->obsValue( tLC) - satObs->cmpValueForBanc(tLC);271 BB[iObs][3] = satObs->obsValue(LC) - satObs->cmpValueForBanc(LC); 279 272 } 280 273 } … … 297 290 for (unsigned ii = 0; ii < obsVector.size(); ii++) { 298 291 const t_pppSatObs* satObs = obsVector.at(ii); 299 if (satObs->isValid() && 292 t_lc LC = satObs->rangeLC(); 293 if (satObs->isValid(LC) && 300 294 (!satObs->modelSet() || satObs->eleSat() >= _opt->_minEle) ) { 301 295 ColumnVector rr = satObs->xc().Rows(1,3) - xyzc.Rows(1,3); 302 double res = rr.NormFrobenius() - satObs->obsValue( tLC)296 double res = rr.NormFrobenius() - satObs->obsValue(LC) 303 297 - (satObs->xc()[3] - xyzc[3]) * t_CST::c; 304 298 if (fabs(res) > maxRes) { … … 354 348 // 355 349 ////////////////////////////////////////////////////////////////////////////// 356 void t_pppClient::finish(t_irc irc, int ind) {350 void t_pppClient::finish(t_irc irc, int /*ind*/) { 357 351 #ifdef BNC_DEBUG_PPP 358 352 LOG << "t_pppClient::finish(" << ind << "): " << irc << endl; … … 463 457 } 464 458 } 465 // use observations only if satellite code biases are available 466 /* ------------------------------------------------------------ 467 if (!_opt->_corrMount.empty() { 468 useObsWithCodeBiasesOnly(_obsRover); 469 }*/ 459 460 // Use observations only if satellite code biases are available 461 // ------------------------------------------------------------ 462 if (_opt->ambRes()) { 463 useObsWithBiasesOnly(_obsRover); 464 } 470 465 471 466 if (int(_obsRover.size()) < _opt->_minObs) { … … 613 608 614 609 } 610 611 // 612 ////////////////////////////////////////////////////////////////////////////// 613 void t_pppClient::useObsWithBiasesOnly(vector<t_pppSatObs*>& obsVector) const { 614 vector<t_pppSatObs*>::iterator it = obsVector.begin(); 615 while (it != obsVector.end()) { 616 t_pppSatObs* pppSatObs = *it; 617 if (pppSatObs->hasBiases()) { 618 ++it; 619 } 620 else { 621 it = obsVector.erase(it); 622 delete pppSatObs; 623 } 624 } 625 } -
trunk/BNC/src/PPP/pppClient.h
r10599 r10791 52 52 std::vector<t_pppSatObs*>& obsVector, bncTime& epoTime); 53 53 bool preparePseudoObs(std::vector<t_pppSatObs*>& obsVector); 54 void useObsWithCodeBiasesOnly(std::vector<t_pppSatObs*>& obsVector);55 54 t_irc cmpModel(t_pppStation* station, const ColumnVector& xyzc, 56 55 std::vector<t_pppSatObs*>& obsVector); … … 61 60 double cmpOffGal(std::vector<t_pppSatObs*>& obsVector); 62 61 double cmpOffBds(std::vector<t_pppSatObs*>& obsVector); 63 62 void useObsWithBiasesOnly(std::vector<t_pppSatObs*>& obsVector) const; 64 63 65 64 t_output* _output; … … 75 74 t_tides* _tides; 76 75 bool _pseudoObsIono; 77 QMap<char, int> _usedSystems;78 76 bool _running; 79 77 }; -
trunk/BNC/src/PPP/pppEphPool.cpp
r10330 r10791 16 16 17 17 #include <iostream> 18 #include <iomanip> 18 19 #include "pppEphPool.h" 19 20 #include "pppInclude.h" … … 41 42 if (corr) { 42 43 _satEphPool[corr->_prn.toInt()].putOrbCorrection(corr); 44 if (OPT->_logMode > t_pppOptions::normal) { 45 LOG << "orbCorr " << string(corr->_time) << ' ' << corr->_prn.toString() << endl; 46 } 43 47 } 44 48 } … … 49 53 if (corr) { 50 54 _satEphPool[corr->_prn.toInt()].putClkCorrection(corr); 55 if (OPT->_logMode > t_pppOptions::normal) { 56 LOG.setf(ios::fixed); 57 LOG << "clkCorr " << string(corr->_time) << ' ' << corr->_prn.toString() << ' ' 58 << setw(7) << setprecision(3) << corr->_dClk * t_CST::c << endl; 59 } 51 60 } 52 61 } -
trunk/BNC/src/PPP/pppFilter.cpp
r10631 r10791 16 16 17 17 #include <iostream> 18 #include <sstream> 18 19 #include <iomanip> 19 20 #include <cmath> … … 28 29 #include "pppStation.h" 29 30 #include "pppClient.h" 31 #include "ambres.h" 30 32 31 33 using namespace BNC_PPP; … … 107 109 } 108 110 109 // close epoch processing111 // Dillution of Precision 110 112 // ---------------------- 111 113 cmpDOP(allObs); 112 _parlist->printResult(_epoTime, _QFlt, _xFlt); 114 115 // Ambiguity Resolution 116 // -------------------- 117 if (OPT->ambRes()) { 118 AmbRes ambRes; 119 ostringstream msg; 120 ColumnVector xFix = _xFlt; 121 SymmetricMatrix QFix = _QFlt; 122 double fixRatio = 0.0; 123 ambRes.run(_epoTime, _parlist->params(), QFix, xFix, fixRatio, msg); 124 LOG << msg.str(); 125 _parlist->printResult(_epoTime, QFix, xFix, fixRatio); 126 } 127 128 // Float Solution 129 // -------------- 130 else { 131 _parlist->printResult(_epoTime, _QFlt, _xFlt); 132 } 133 113 134 _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing 135 114 136 return success; 115 137 } … … 117 139 // Process Selected LCs 118 140 //////////////////////////////////////////////////////////////////////////// 119 t_irc t_pppFilter::processSystem(const vector<t_lc ::type> &LCs,141 t_irc t_pppFilter::processSystem(const vector<t_lc>& LCs, 120 142 const vector<t_pppSatObs*> &obsVector, 121 143 bool pseudoObsIonoAvailable) { … … 158 180 int iObs = -1; 159 181 vector<t_pppSatObs*> usedObs; 160 vector<t_lc ::type>usedTypes;182 vector<t_lc> usedTypes; 161 183 162 184 // Real Observations … … 171 193 nSat++; 172 194 for (unsigned jj = 0; jj < usedLCs; jj++) { 173 const t_lc::type tLC = LCs[jj]; 174 if (tLC == t_lc::GIM) { 195 const t_lc LC = LCs[jj]; 196 if (LC._type == t_lc::GIM) { 197 continue; 198 } 199 if (LC._frq1 == t_frequency::G5 && !obs->isValid(LC)) { 175 200 continue; 176 201 } 177 202 ++iObs; 178 203 usedObs.push_back(obs); 179 usedTypes.push_back( tLC);204 usedTypes.push_back(LC); 180 205 for (unsigned iPar = 0; iPar < nPar; iPar++) { 181 206 const t_pppParam *par = params[iPar]; 182 AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);183 } 184 185 ll[iObs] = obs->obsValue( tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));186 PP[iObs] = 1.0 / (obs->sigma( tLC) * obs->sigma(tLC));207 AA[iObs][iPar] = par->partial(_epoTime, obs, LC); 208 } 209 210 ll[iObs] = obs->obsValue(LC) - obs->cmpValue(LC) - DotProduct(_x0, AA.Row(iObs + 1)); 211 PP[iObs] = 1.0 / (obs->sigma(LC) * obs->sigma(LC)); 187 212 } 188 213 } … … 202 227 if (!obs->outlier()) { 203 228 for (unsigned jj = 0; jj < usedLCs; jj++) { 204 const t_lc ::type tLC = LCs[jj];205 if ( tLC== t_lc::GIM) {229 const t_lc LC = LCs[jj]; 230 if (LC._type == t_lc::GIM) { 206 231 ++iObs; 207 232 } else { … … 209 234 } 210 235 usedObs.push_back(obs); 211 usedTypes.push_back( tLC);236 usedTypes.push_back(LC); 212 237 for (unsigned iPar = 0; iPar < nPar; iPar++) { 213 238 const t_pppParam *par = params[iPar]; 214 AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);239 AA[iObs][iPar] = par->partial(_epoTime, obs, LC); 215 240 } 216 ll[iObs] = obs->obsValue( tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));217 PP[iObs] = 1.0 / (obs->sigma( tLC) * obs->sigma(tLC));241 ll[iObs] = obs->obsValue(LC) - obs->cmpValue(LC) - DotProduct(_x0, AA.Row(iObs + 1)); 242 PP[iObs] = 1.0 / (obs->sigma(LC) * obs->sigma(LC)); 218 243 } 219 244 } … … 236 261 double maxOutlier = 0.0; 237 262 int maxOutlierIndex = -1; 238 t_lc ::typemaxOutlierLC= t_lc::dummy;263 t_lc maxOutlierLC; 239 264 for (unsigned ii = 0; ii < usedObs.size(); ii++) { 240 const t_lc ::type tLC = usedTypes[ii];265 const t_lc LC = usedTypes[ii]; 241 266 double res = fabs(vv[ii]); 242 if (res > usedObs[ii]->maxRes( tLC)) {267 if (res > usedObs[ii]->maxRes(LC)) { 243 268 if (res > fabs(maxOutlier)) { 244 269 maxOutlier = vv[ii]; 245 270 maxOutlierIndex = ii; 246 maxOutlierLC = tLC;271 maxOutlierLC = LC; 247 272 } 248 273 } … … 254 279 t_pppSatObs *obs = usedObs[maxOutlierIndex]; 255 280 t_pppParam *par = 0; 256 LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '281 LOG << epoTimeStr << " Outlier " << maxOutlierLC.toString() << ' ' 257 282 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) 258 283 << maxOutlier << endl; 259 284 for (unsigned iPar = 0; iPar < nPar; iPar++) { 260 t_pppParam *hlp = params[iPar];285 t_pppParam* hlp = params[iPar]; 261 286 if (hlp->type() == t_pppParam::amb && 262 287 hlp->prn() == obs->prn() && 263 hlp-> tLC()== usedTypes[maxOutlierIndex]) {288 hlp->LC() == usedTypes[maxOutlierIndex]) { 264 289 par = hlp; 265 290 } … … 277 302 for (unsigned jj = 0; jj < LCs.size(); jj++) { 278 303 for (unsigned ii = 0; ii < usedObs.size(); ii++) { 279 const t_lc ::type tLC = usedTypes[ii];280 t_pppSatObs *obs = usedObs[ii];281 if ( tLC == LCs[jj]) {282 obs->setRes( tLC, vv[ii]);304 const t_lc LC = usedTypes[ii]; 305 t_pppSatObs* obs = usedObs[ii]; 306 if (LC == LCs[jj]) { 307 obs->setRes(LC, vv[ii]); 283 308 LOG << epoTimeStr << " RES " << left << setw(3) 284 << t_lc::toString(tLC) << right << ' '309 << LC.toString() << right << ' ' 285 310 << obs->prn().toString() << ' ' 286 311 << setw(8) << setprecision(4) << vv[ii] << endl; … … 296 321 // Cycle-Slip Detection 297 322 //////////////////////////////////////////////////////////////////////////// 298 t_irc t_pppFilter::detectCycleSlips(const vector<t_lc ::type> &LCs,323 t_irc t_pppFilter::detectCycleSlips(const vector<t_lc>& LCs, 299 324 const vector<t_pppSatObs*> &obsVector) { 300 325 … … 309 334 SLIP *= fac; 310 335 string epoTimeStr = string(_epoTime); 311 const vector<t_pppParam*> ¶ms = _parlist->params();312 336 313 337 for (unsigned ii = 0; ii < LCs.size(); ii++) { 314 const t_lc ::type &tLC = LCs[ii];315 if ( t_lc::includesPhase(tLC)) {338 const t_lc& LC = LCs[ii]; 339 if (LC.includesPhase()) { 316 340 for (unsigned iObs = 0; iObs < obsVector.size(); iObs++) { 317 341 const t_pppSatObs *obs = obsVector[iObs]; … … 343 367 // -------- 344 368 if (slip) { 345 resetAmb(obs->prn(), obsVector, tLC); 346 } 347 348 // Check Pre-Fit Residuals 349 /* ----------------------- 350 else { 351 ColumnVector AA(params.size()); 352 for (unsigned iPar = 0; iPar < params.size(); iPar++) { 353 const t_pppParam* par = params[iPar]; 354 AA[iPar] = par->partial(_epoTime, obs, tLC); 355 } 356 double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA); 357 double vv = DotProduct(AA, _xFlt) - ll; 358 359 if (fabs(vv) > SLIP) { 360 LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' ' 361 << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl; 362 resetAmb(obs->prn(), obsVector, tLC); 363 } 364 }*/ 369 resetAmb(obs->prn(), obsVector, t_lc()); 370 } 365 371 } 366 372 } … … 371 377 // Reset Ambiguity Parameter (cycle slip) 372 378 //////////////////////////////////////////////////////////////////////////// 373 t_irc t_pppFilter::resetAmb(const t_prn prn, const vector<t_pppSatObs*> &obsVector, t_lc ::typelc,379 t_irc t_pppFilter::resetAmb(const t_prn prn, const vector<t_pppSatObs*> &obsVector, t_lc lc, 374 380 SymmetricMatrix *QSav, ColumnVector *xSav) { 375 381 … … 386 392 (par->firstObsTime().undef()) ? 387 393 firstObsTime = lastObsTime : firstObsTime = par->firstObsTime(); 388 t_lc ::type tLC = par->tLC();389 if ( tLC != lc) {continue;}394 t_lc LC = par->LC(); 395 if (lc.valid() && LC != lc) {continue;} 390 396 LOG << string(_epoTime) << " RESET " << par->toString() << endl; 391 delete par; par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);397 delete par; par = new t_pppParam(t_pppParam::amb, prn, LC, &obsVector); 392 398 par->setIndex(ind); 393 399 par->setFirstObsTime(firstObsTime); … … 436 442 for (unsigned iPar = 0; iPar < numPar; iPar++) { 437 443 t_pppParam* par = _parlist->params()[iPar]; 438 AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, t_lc::c1);444 AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, obs->rangeLC()); 439 445 if (par->type() == t_pppParam::crdX) { 440 446 parX = par; -
trunk/BNC/src/PPP/pppFilter.h
r10256 r10791 73 73 }; 74 74 75 t_irc processSystem(const std::vector<t_lc ::type>& LCs,75 t_irc processSystem(const std::vector<t_lc>& LCs, 76 76 const std::vector<t_pppSatObs*>& obsVector, 77 77 bool pseudoObsIonoAvailable); 78 78 79 t_irc detectCycleSlips(const std::vector<t_lc ::type>& LCs,79 t_irc detectCycleSlips(const std::vector<t_lc>& LCs, 80 80 const std::vector<t_pppSatObs*>& obsVector); 81 81 82 t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector, t_lc ::typelc,82 t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector, t_lc lc, 83 83 SymmetricMatrix* QSav = 0, ColumnVector* xSav = 0); 84 84 -
trunk/BNC/src/PPP/pppObsPool.cpp
r10034 r10791 15 15 * -----------------------------------------------------------------------*/ 16 16 17 #include <iomanip> 17 18 #include "pppObsPool.h" 19 #include "pppClient.h" 18 20 19 21 using namespace BNC_PPP; … … 74 76 delete _satCodeBiases[iPrn]; 75 77 _satCodeBiases[iPrn] = satCodeBias; 78 if (OPT->_logMode > t_pppOptions::normal) { 79 LOG << "codeBias " << string(satCodeBias->_time) << ' ' << satCodeBias->_prn.toString(); 80 for (const auto& bias : satCodeBias->_bias) { 81 LOG << " " << bias._rnxType2ch << ' ' << setw(7) << setprecision(3) << bias._value; 82 } 83 LOG << endl; 84 } 76 85 } 77 86 … … 82 91 delete _satPhaseBiases[iPrn]; 83 92 _satPhaseBiases[iPrn] = satPhaseBias; 93 if (OPT->_logMode > t_pppOptions::normal) { 94 LOG.setf(ios::fixed); 95 LOG << "phaseBias " << string(satPhaseBias->_time) << ' ' << satPhaseBias->_prn.toString() 96 << ' ' << setw(7) << setprecision(2) << satPhaseBias->_yaw * 180.0 / M_PI 97 << ' ' << setw(7) << setprecision(3) << satPhaseBias->_yawRate * 180.0 / M_PI; 98 for (const auto& bias : satPhaseBias->_bias) { 99 LOG << " " << bias._rnxType2ch << ' ' << setw(2) << bias._jumpCounter; 100 if (bias._fixIndicator) { 101 LOG << " x "; 102 } 103 else { 104 LOG << " . "; 105 } 106 LOG << setw(6) << setprecision(3) << bias._value; 107 } 108 LOG << endl; 109 } 110 } 111 112 // 113 ///////////////////////////////////////////////////////////////////////////// 114 void t_pppObsPool::clearCodeBiases(char sys) { 115 for (unsigned iPrn = 1; iPrn <= t_prn::MAXPRN; ++iPrn) { 116 t_prn prn; prn.set(iPrn); 117 if (prn.system() == sys) { 118 delete _satCodeBiases[iPrn]; 119 _satCodeBiases[iPrn] = 0; 120 } 121 } 122 } 123 124 // 125 ///////////////////////////////////////////////////////////////////////////// 126 void t_pppObsPool::clearPhaseBiases(char sys) { 127 for (unsigned iPrn = 1; iPrn <= t_prn::MAXPRN; ++iPrn) { 128 t_prn prn; prn.set(iPrn); 129 if (prn.system() == sys) { 130 delete _satPhaseBiases[iPrn]; 131 _satPhaseBiases[iPrn] = 0; 132 } 133 } 84 134 } 85 135 -
trunk/BNC/src/PPP/pppObsPool.h
r10034 r10791 33 33 void putPhaseBias(t_satPhaseBias* satPhaseBias); 34 34 void putTec(t_vTec* _vTec); 35 void clearCodeBiases(char sys); 36 void clearPhaseBiases(char sys); 35 37 36 38 void putEpoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector, -
trunk/BNC/src/PPP/pppParlist.cpp
r10623 r10791 34 34 // Constructor 35 35 //////////////////////////////////////////////////////////////////////////// 36 t_pppParam::t_pppParam(e_type type, const t_prn& prn, t_lc ::type tLC,36 t_pppParam::t_pppParam(e_type type, const t_prn& prn, t_lc LC, 37 37 const vector<t_pppSatObs*>* obsVector) { 38 38 39 39 _type = type; 40 40 _prn = prn; 41 _tLC = tLC; 41 _sys = '?'; 42 _LC = LC; 42 43 _x0 = 0.0; 43 44 _indexOld = -1; … … 47 48 48 49 switch (_type) { 49 case crdX: 50 _epoSpec = false; 51 _sigma0 = OPT->_aprSigCrd[0]; 52 _noise = OPT->_noiseCrd[0]; 53 break; 54 case crdY: 55 _epoSpec = false; 56 _sigma0 = OPT->_aprSigCrd[1]; 57 _noise = OPT->_noiseCrd[1]; 58 break; 59 case crdZ: 60 _epoSpec = false; 61 _sigma0 = OPT->_aprSigCrd[2]; 62 _noise = OPT->_noiseCrd[2]; 63 break; 64 case rClkG: 65 _epoSpec = true; 66 _sigma0 = OPT->_aprSigClk; 67 break; 68 case rClkR: 69 _epoSpec = true; 70 _sigma0 = OPT->_aprSigClk; 71 break; 72 case rClkE: 73 _epoSpec = true; 74 _sigma0 = OPT->_aprSigClk; 75 break; 76 case rClkC: 77 _epoSpec = true; 78 _sigma0 = OPT->_aprSigClk; 79 break; 80 case amb: 81 _epoSpec = false; 82 _sigma0 = OPT->_aprSigAmb; 83 if (obsVector) { 84 for (unsigned ii = 0; ii < obsVector->size(); ii++) { 85 const t_pppSatObs* obs = obsVector->at(ii); 86 if (obs->prn() == _prn) { 87 _x0 = floor((obs->obsValue(tLC) - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5); 88 break; 89 } 90 } 91 } 92 break; 93 case trp: 94 _epoSpec = false; 95 _sigma0 = OPT->_aprSigTrp; 96 _noise = OPT->_noiseTrp; 97 break; 98 case ion: 99 _epoSpec = false; 100 _sigma0 = OPT->_aprSigIon; 101 _noise = OPT->_noiseIon; 102 break; 103 case cBiasG1: case cBiasR1: case cBiasE1: case cBiasC1: 104 case cBiasG2: case cBiasR2: case cBiasE2: case cBiasC2: 105 _epoSpec = false; 106 _sigma0 = OPT->_aprSigCodeBias; 107 _noise = OPT->_noiseCodeBias; 108 break; 109 case pBiasG1: case pBiasR1: case pBiasE1: case pBiasC1: 110 case pBiasG2: case pBiasR2: case pBiasE2: case pBiasC2: 111 _epoSpec = false; 112 _sigma0 = OPT->_aprSigPhaseBias; 113 _noise = OPT->_noisePhaseBias; 114 break; 50 case crdX: 51 _epoSpec = false; 52 _sigma0 = OPT->_aprSigCrd[0]; 53 _noise = OPT->_noiseCrd[0]; 54 break; 55 case crdY: 56 _epoSpec = false; 57 _sigma0 = OPT->_aprSigCrd[1]; 58 _noise = OPT->_noiseCrd[1]; 59 break; 60 case crdZ: 61 _epoSpec = false; 62 _sigma0 = OPT->_aprSigCrd[2]; 63 _noise = OPT->_noiseCrd[2]; 64 break; 65 case rClk: 66 _epoSpec = true; 67 _sigma0 = OPT->_aprSigClk; 68 break; 69 case amb: 70 _epoSpec = false; 71 _sigma0 = OPT->_aprSigAmb; 72 if (obsVector) { 73 for (unsigned ii = 0; ii < obsVector->size(); ii++) { 74 const t_pppSatObs* obs = obsVector->at(ii); 75 if (obs->prn() == _prn) { 76 _x0 = floor((obs->obsValue(LC) - obs->cmpValue(LC)) / obs->lambda(LC) + 0.5); 77 break; 78 } 79 } 80 } 81 break; 82 case trp: 83 _epoSpec = false; 84 _sigma0 = OPT->_aprSigTrp; 85 _noise = OPT->_noiseTrp; 86 break; 87 case ion: 88 _epoSpec = true; 89 _sigma0 = OPT->_aprSigIon; 90 break; 91 case bias: 92 _epoSpec = true; 93 _sigma0 = OPT->_aprSigCodeBias; 94 break; 115 95 } 116 96 } … … 124 104 //////////////////////////////////////////////////////////////////////////// 125 105 double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs, 126 const t_lc ::type& tLC) const {106 const t_lc& obsLC) const { 127 107 128 108 // Special Case - Melbourne-Wuebbena 129 109 // --------------------------------- 130 if ( tLC== t_lc::MW && _type != amb) {110 if (obsLC._type == t_lc::MW && _type != amb) { 131 111 return 0.0; 112 } 113 114 // Special Case - GIM 115 // ------------------ 116 if (obsLC._type == t_lc::GIM) { 117 if (_type == ion) { 118 return 1.0; 119 } 120 else { 121 return 0.0; 122 } 132 123 } 133 124 … … 138 129 map<t_frequency::type, double> phaseCoeff; 139 130 map<t_frequency::type, double> ionoCoeff; 140 obs->lcCoeff( tLC, codeCoeff, phaseCoeff, ionoCoeff);141 131 obs->lcCoeff(obsLC, codeCoeff, phaseCoeff, ionoCoeff); 132 142 133 switch (_type) { 143 134 case crdX: 144 if (tLC == t_lc::GIM) {return 0.0;}145 135 return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius(); 146 136 case crdY: 147 if (tLC == t_lc::GIM) {return 0.0;}148 137 return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius(); 149 138 case crdZ: 150 if (tLC == t_lc::GIM) {return 0.0;}151 139 return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius(); 152 case rClkG: 153 if (tLC == t_lc::GIM) {return 0.0;} 154 return (obs->prn().system() == 'G') ? 1.0 : 0.0; 155 case rClkR: 156 if (tLC == t_lc::GIM) {return 0.0;} 157 return (obs->prn().system() == 'R') ? 1.0 : 0.0; 158 case rClkE: 159 if (tLC == t_lc::GIM) {return 0.0;} 160 return (obs->prn().system() == 'E') ? 1.0 : 0.0; 161 case rClkC: 162 if (tLC == t_lc::GIM) {return 0.0;} 163 return (obs->prn().system() == 'C') ? 1.0 : 0.0; 140 case rClk: 141 return (_sys != obsLC.system() || obsLC.isGeometryFree()) ? 0.0 : 1.0; 164 142 case amb: 165 if (tLC == t_lc::GIM) { 166 return 0.0; 167 } 168 else { 169 if (obs->prn() == _prn) { 170 if (tLC == _tLC) { 171 return (obs->lambda(tLC)); 172 } 173 else if (tLC == t_lc::lIF && _tLC == t_lc::MW) { 174 return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2); 175 } 176 else { 177 if (_tLC == t_lc::l1) { 178 return obs->lambda(t_lc::l1) * phaseCoeff[obs->fType1()]; 179 } 180 else if (_tLC == t_lc::l2) { 181 return obs->lambda(t_lc::l2) * phaseCoeff[obs->fType2()]; 182 } 183 } 143 if (obs->prn() == _prn) { 144 if (obsLC == _LC) { 145 return (obs->lambda(obsLC)); 146 } 147 else if (_LC._type == t_lc::phase) { 148 return obs->lambda(_LC) * phaseCoeff[_LC._frq1]; 149 } 150 else if (obsLC._type == t_lc::phaseIF && _LC._type == t_lc::MW) { 151 return obs->lambda(obsLC) * obs->lambda(_LC) / obs->lambda(t_lc(t_lc::phase, _LC._frq2)); 184 152 } 185 153 } 186 154 break; 187 155 case trp: 188 if (tLC == t_lc::GIM) { 189 return 0.0; 190 } 191 else { 192 return 1.0 / sin(obs->eleSat()); 193 } 156 return 1.0 / sin(obs->eleSat()); 194 157 case ion: 195 158 if (obs->prn() == _prn) { 196 if (tLC == t_lc::c1) { 197 return ionoCoeff[obs->fType1()]; 198 } 199 else if (tLC == t_lc::c2) { 200 return ionoCoeff[obs->fType2()]; 201 } 202 else if (tLC == t_lc::l1) { 203 return ionoCoeff[obs->fType1()]; 204 } 205 else if (tLC == t_lc::l2) { 206 return ionoCoeff[obs->fType2()]; 207 } 208 else if (tLC == t_lc::GIM) { 209 return 1.0; 210 } 211 } 212 break; 213 case cBiasG1: 214 if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;} 215 break; 216 case cBiasR1: 217 if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;} 218 break; 219 case cBiasE1: 220 if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;} 221 break; 222 case cBiasC1: 223 if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;} 224 break; 225 case cBiasG2: 226 if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;} 227 break; 228 case cBiasR2: 229 if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;} 230 break; 231 case cBiasE2: 232 if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;} 233 break; 234 case cBiasC2: 235 if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;} 236 break; 237 case pBiasG1: 238 if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;} 239 break; 240 case pBiasR1: 241 if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;} 242 break; 243 case pBiasE1: 244 if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;} 245 break; 246 case pBiasC1: 247 if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;} 248 break; 249 case pBiasG2: 250 if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;} 251 break; 252 case pBiasR2: 253 if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;} 254 break; 255 case pBiasE2: 256 if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;} 257 break; 258 case pBiasC2: 259 if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;} 260 break; 261 159 if (obsLC._type == t_lc::code || obsLC._type == t_lc::phase) { 160 return ionoCoeff[obsLC._frq1]; 161 } 162 } 163 break; 164 case bias: 165 return (_LC == obsLC ? 1.0 : 0.0); 262 166 } 263 167 return 0.0; … … 278 182 ss << "CRD_Z"; 279 183 break; 280 case rClkG: 281 ss << "REC_CLK G "; 282 break; 283 case rClkR: 284 ss << "REC_CLK R "; 285 break; 286 case rClkE: 287 ss << "REC_CLK E "; 288 break; 289 case rClkC: 290 ss << "REC_CLK C "; 184 case rClk: 185 ss << "REC_CLK " << _sys << " "; 291 186 break; 292 187 case trp: … … 294 189 break; 295 190 case amb: 296 ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();191 ss << "AMB " << left << setw(3) << _LC.toString() << right << ' ' << _prn.toString(); 297 192 break; 298 193 case ion: 299 ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString(); 300 break; 301 case cBiasG1: case pBiasG1: 302 case cBiasG2: case pBiasG2: 303 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G "; 304 break; 305 case cBiasR1: case pBiasR1: 306 case cBiasR2: case pBiasR2: 307 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R "; 308 break; 309 case cBiasE1: case pBiasE1: 310 case cBiasE2: case pBiasE2: 311 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E "; 312 break; 313 case cBiasC1: case pBiasC1: 314 case cBiasC2: case pBiasC2: 315 ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C "; 194 ss << "ION " << left << setw(3) << _LC.toString() << right << ' ' << _prn.toString(); 195 break; 196 case bias: 197 char sys = t_frequency::toSystem(_LC._frq1); 198 ss << "BIA " << left << setw(3) << _LC.toString() << right << ' ' << sys << " "; 316 199 break; 317 200 } … … 353 236 par->type() == t_pppParam::crdY || 354 237 par->type() == t_pppParam::crdZ || 355 par->type() == t_pppParam::ion || 356 par->type() == t_pppParam::cBiasC1 || 357 par->type() == t_pppParam::cBiasC2 || 358 par->type() == t_pppParam::cBiasE1 || 359 par->type() == t_pppParam::cBiasE2 || 360 par->type() == t_pppParam::cBiasR1 || 361 par->type() == t_pppParam::cBiasR2 || 362 par->type() == t_pppParam::pBiasC1 || 363 par->type() == t_pppParam::pBiasC2 || 364 par->type() == t_pppParam::pBiasE1 || 365 par->type() == t_pppParam::pBiasE2 || 366 par->type() == t_pppParam::pBiasR1 || 367 par->type() == t_pppParam::pBiasR2) { 238 par->type() == t_pppParam::ion ) { 368 239 if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) { 369 240 remove = true; … … 383 254 } 384 255 385 // check which systems have observations256 // Check which systems have observations 386 257 // ------------------------------------- 387 _usedSystems['G'] = _usedSystems['R'] = _usedSystems['E'] = _usedSystems['C'] = 0; 388 for (unsigned jj = 0; jj < obsVector.size(); jj++) { 389 const t_pppSatObs* satObs = obsVector[jj]; 390 char sys = satObs->prn().system(); 391 if (OPT->LCs(sys).size()) { 392 _usedSystems[sys]++; 258 vector<char> systems = OPT->systems(); 259 for (char sys : systems) { 260 _usedSystems[sys] = 0; 261 for (unsigned jj = 0; jj < obsVector.size(); jj++) { 262 const t_pppSatObs* satObs = obsVector[jj]; 263 if (satObs->prn().system() == sys) { 264 _usedSystems[sys]++; 265 } 393 266 } 394 267 }; 395 396 268 397 269 // Check whether parameters have observations … … 425 297 // Coordinates 426 298 // ----------- 427 required.push_back(new t_pppParam(t_pppParam::crdX, t_prn() , t_lc::dummy));428 required.push_back(new t_pppParam(t_pppParam::crdY, t_prn() , t_lc::dummy));429 required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn() , t_lc::dummy));299 required.push_back(new t_pppParam(t_pppParam::crdX, t_prn())); 300 required.push_back(new t_pppParam(t_pppParam::crdY, t_prn())); 301 required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn())); 430 302 431 303 // Receiver Clocks 432 304 // --------------- 433 if (_usedSystems['G']) { 434 //if (OPT->useSystem('G')) { 435 required.push_back(new t_pppParam(t_pppParam::rClkG, t_prn(), t_lc::dummy)); 436 } 437 if (_usedSystems['R']) { 438 //if (OPT->useSystem('R')) { 439 required.push_back(new t_pppParam(t_pppParam::rClkR, t_prn(), t_lc::dummy)); 440 } 441 if (_usedSystems['E']) { 442 //if (OPT->useSystem('E')) { 443 required.push_back(new t_pppParam(t_pppParam::rClkE, t_prn(), t_lc::dummy)); 444 } 445 if (_usedSystems['C']) { 446 //if (OPT->useSystem('C')) { 447 required.push_back(new t_pppParam(t_pppParam::rClkC, t_prn(), t_lc::dummy)); 448 } 305 for (const auto& [sys, numObs] : _usedSystems) { 306 if (numObs > 0) { 307 t_pppParam* clk = new t_pppParam(t_pppParam::rClk, t_prn()); 308 clk->setSystem(sys); 309 required.push_back(clk); 310 } 311 } 449 312 450 313 // Troposphere 451 314 // ----------- 452 315 if (OPT->estTrp()) { 453 required.push_back(new t_pppParam(t_pppParam::trp, t_prn() , t_lc::dummy));316 required.push_back(new t_pppParam(t_pppParam::trp, t_prn())); 454 317 } 455 318 … … 459 322 for (unsigned jj = 0; jj < obsVector.size(); jj++) { 460 323 const t_pppSatObs* satObs = obsVector[jj]; 461 char sys = satObs->prn().system(); 462 std::vector<t_lc::type> LCs = OPT->LCs(sys); 463 if (std::find(LCs.begin(), LCs.end(), t_lc::cIF) == LCs.end() && 464 std::find(LCs.begin(), LCs.end(), t_lc::lIF) == LCs.end()) { 465 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy)); 466 } 467 } 468 } 324 std::vector<t_lc> LCs = OPT->LCs(satObs->prn().system()); 325 for (auto it = LCs.begin(); it != LCs.end(); ++it) { 326 const t_lc& lc = *it; 327 if (!lc.isIonoFree()) { 328 required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn())); 329 break; 330 } 331 } 332 } 333 } 334 469 335 // Ambiguities 470 336 // ----------- … … 472 338 const t_pppSatObs* satObs = obsVector[jj]; 473 339 char sys = satObs->prn().system(); 474 const vector<t_lc ::type>& ambLCs = OPT->ambLCs(sys);340 const vector<t_lc>& ambLCs = OPT->ambLCs(sys); 475 341 for (unsigned ii = 0; ii < ambLCs.size(); ii++) { 342 if (ambLCs[ii]._frq1 == t_frequency::G5 && !satObs->isValid(ambLCs[ii])) { 343 continue; 344 } 476 345 required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector)); 477 346 } 478 347 } 479 348 480 // Receiver Code Biases 481 // -------------------- 482 if (OPT->_ionoModelType == OPT->PPP_RTK) { 483 std::vector<t_lc::type> lc; 484 if (OPT->useSystem('G')) { 485 lc = OPT->LCs('G'); 486 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) { 487 required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1)); 488 } 489 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 490 required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2)); 491 } 492 } 493 if (OPT->useSystem('R')) { 494 lc = OPT->LCs('R'); 495 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) { 496 required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1)); 497 } 498 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 499 required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2)); 500 } 501 } 502 if (OPT->useSystem('E')) { 503 lc = OPT->LCs('E'); 504 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) { 505 required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1)); 506 } 507 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 508 required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2)); 509 } 510 } 511 if (OPT->useSystem('C')) { 512 lc = OPT->LCs('C'); 513 if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) { 514 required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1)); 515 } 516 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 517 required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2)); 518 } 519 } 520 } 521 522 if (OPT->_pseudoObsIono) { 523 std::vector<t_lc::type> lc; 524 if (OPT->useSystem('G')) { 525 lc = OPT->LCs('G'); 526 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 527 required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2)); 528 } 529 } 530 if (OPT->useSystem('R')) { 531 lc = OPT->LCs('R'); 532 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 533 required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2)); 534 } 535 } 536 if (OPT->useSystem('E')) { 537 lc = OPT->LCs('E'); 538 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 539 required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2)); 540 } 541 } 542 if (OPT->useSystem('C')) { 543 lc = OPT->LCs('C'); 544 if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) { 545 required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2)); 546 } 547 } 548 } 549 550 if (OPT->_ionoModelType == OPT->PPP_RTK) { 551 std::vector<t_lc::type> lc; 552 if (OPT->useSystem('G')) { 553 lc = OPT->LCs('G'); 554 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) { 555 required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1)); 556 } 557 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) { 558 required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2)); 559 } 560 } 561 if (OPT->useSystem('R')) { 562 lc = OPT->LCs('R'); 563 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) { 564 required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1)); 565 } 566 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) { 567 required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2)); 568 } 569 } 570 if (OPT->useSystem('E')) { 571 lc = OPT->LCs('E'); 572 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) { 573 required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1)); 574 } 575 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) { 576 required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2)); 577 } 578 } 579 if (OPT->useSystem('C')) { 580 lc = OPT->LCs('C'); 581 if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) { 582 required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1)); 583 } 584 if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) { 585 required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2)); 349 // Biases 350 // ------ 351 int maxSkip = (OPT->_pseudoObsIono ? 1 : 2); 352 for (const auto& [sys, numObs] : _usedSystems) { 353 if (numObs > 0) { 354 bool ar = OPT->arSystem(sys); 355 int skip = 0; 356 vector<t_lc> LCs = OPT->LCs(sys); 357 for (const t_lc& lc : LCs) { 358 if (ar) { 359 if (skip < maxSkip && lc.includesPhase()) { 360 skip += 1; 361 } 362 else { 363 required.push_back(new t_pppParam(t_pppParam::bias, t_prn(), lc)); 364 } 365 } 366 else { 367 if (lc.includesCode()) { 368 if (skip < maxSkip) { 369 skip += 1; 370 } 371 else { 372 required.push_back(new t_pppParam(t_pppParam::bias, t_prn(), lc)); 373 } 374 } 375 } 586 376 } 587 377 } … … 605 395 } 606 396 else { 607 #ifdef BNC_DEBUG_PPP608 //LOG << "push_back parReq " << parReq->toString() << std::endl;609 #endif610 397 _params.push_back(parReq); 611 398 } … … 634 421 //////////////////////////////////////////////////////////////////////////// 635 422 void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ, 636 const ColumnVector& xx) const { 423 const ColumnVector& xx, double fixRatio) const { 637 424 638 425 string epoTimeStr = string(epoTime); … … 703 490 704 491 << " dU = " << setprecision(4) << neu[2] << " +- " 705 << setprecision(4) << sqrt(QQneu[2][2]) 706 707 << endl; 492 << setprecision(4) << sqrt(QQneu[2][2]); 493 494 if (fixRatio > 0.0) { 495 LOG << " fix " << int(100*fixRatio) << " %"; 496 } 497 else { 498 LOG << " flt "; 499 } 500 501 LOG << endl; 708 502 } 709 503 return; -
trunk/BNC/src/PPP/pppParlist.h
r10583 r10791 14 14 class t_pppParam { 15 15 public: 16 enum e_type {crdX, crdY, crdZ, rClkG, rClkR, rClkE, rClkC, trp, ion, amb, 17 cBiasG1, cBiasR1, cBiasE1, cBiasC1, pBiasG1, pBiasR1, pBiasE1, pBiasC1, 18 cBiasG2, cBiasR2, cBiasE2, cBiasC2, pBiasG2, pBiasR2, pBiasE2, pBiasC2}; 16 enum e_type {crdX, crdY, crdZ, rClk, trp, ion, amb, bias}; 19 17 20 t_pppParam(e_type type, const t_prn& prn, t_lc ::type tLC, const std::vector<t_pppSatObs*>* obsVector = 0);18 t_pppParam(e_type type, const t_prn& prn, t_lc LC = t_lc(), const std::vector<t_pppSatObs*>* obsVector = 0); 21 19 ~t_pppParam(); 22 20 23 21 e_type type() const {return _type;} 24 22 double x0() const {return _x0;} 25 double partial(const bncTime& epoTime, const t_pppSatObs* obs, 26 const t_lc::type& tLC) const; 23 double partial(const bncTime& epoTime, const t_pppSatObs* obs, const t_lc& LC) const; 27 24 bool epoSpec() const {return _epoSpec;} 28 25 bool isEqual(const t_pppParam* par2) const { 29 return (_type == par2->_type && _prn == par2->_prn && _ tLC == par2->_tLC);26 return (_type == par2->_type && _prn == par2->_prn && _LC == par2->_LC && _sys == par2->_sys); 30 27 } 31 28 void setIndex(int indexNew) { … … 36 33 _indexOld = -1; 37 34 } 38 int indexOld() const {return _indexOld;} 39 int indexNew() const {return _indexNew;} 40 double sigma0() const {return _sigma0;} 41 double noise() const {return _noise;} 42 t_lc ::type tLC() const {return _tLC;}43 t_prn prn() const {return _prn;} 35 int indexOld() const {return _indexOld;} 36 int indexNew() const {return _indexNew;} 37 double sigma0() const {return _sigma0;} 38 double noise() const {return _noise;} 39 t_lc LC() const {return _LC;} 40 t_prn prn() const {return _prn;} 44 41 std::string toString() const; 45 42 … … 55 52 unsigned ambNumEpo() const {return _ambInfo ? _ambInfo->_numEpo : 0;} 56 53 void stepAmbNumEpo() {if (_ambInfo) _ambInfo->_numEpo += 1;} 54 char system() const { 55 if (_prn.valid()) { 56 return _prn.system(); 57 } 58 else if (_LC.valid()) { 59 return _LC.system(); 60 } 61 else { 62 return _sys; 63 } 64 } 65 void setSystem(char sys) {_sys = sys;} 57 66 58 67 static bool sortFunction(const t_pppParam* p1, const t_pppParam* p2) { … … 60 69 return p1->_type < p2->_type; 61 70 } 62 else if (p1->_ tLC != p2->_tLC) {63 return p1->_ tLC < p2->_tLC;71 else if (p1->_LC != p2->_LC) { 72 return p1->_LC < p2->_LC; 64 73 } 65 74 else if (p1->_prn != p2->_prn) { … … 84 93 e_type _type; 85 94 t_prn _prn; 86 t_lc::type _tLC; 95 char _sys; 96 t_lc _LC; 87 97 double _x0; 88 98 bool _epoSpec; … … 104 114 const std::vector<t_pppParam*>& params() const {return _params;} 105 115 std::vector<t_pppParam*>& params() {return _params;} 106 const QMap<char, int>& usedSystems() const {return _usedSystems;}107 116 void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ, 108 const ColumnVector& xx) const; 117 const ColumnVector& xx, double fixRatio = 0.0) const; 109 118 void printParams(const bncTime& epoTime); 110 119 111 120 private: 112 121 std::vector<t_pppParam*> _params; 113 QMap<char, int>_usedSystems;122 std::map<char, int> _usedSystems; 114 123 }; 115 124 -
trunk/BNC/src/PPP/pppSatObs.cpp
r10626 r10791 19 19 #include <iomanip> 20 20 #include <cmath> 21 #include <algorithm> 22 #include <set> 21 23 #include <newmatio.h> 22 24 … … 43 45 _reference = false; 44 46 _stecSat = 0.0; 45 _signalPriorities = QString::fromStdString(OPT->_signalPriorities);46 47 for (unsigned ii = 0; ii < t_frequency::max; ii++) { 47 48 _obs[ii] = 0; … … 60 61 // 61 62 //////////////////////////////////////////////////////////////////////////// 62 void t_pppSatObs::prepareObs(const t_satObs& pppSatObs) { 63 bool t_pppSatObs::isBetter(const t_frqObs* aa, t_frqObs* bb, const string& trkModes) const { 64 65 if (!trkModes.empty()) { 66 size_t posA = trkModes.find(aa->trkChar()); 67 size_t posB = trkModes.find(bb->trkChar()); 68 if (posA != posB) { 69 if (posA == string::npos) { 70 return false; 71 } 72 else if (posB == string::npos) { 73 return true; 74 } 75 else { 76 return posA < posB; 77 } 78 } 79 } 80 81 unsigned numValA = 0; 82 if (aa->_codeValid) numValA += 1; 83 if (aa->_phaseValid) numValA += 1; 84 85 unsigned numValB = 0; 86 if (bb->_codeValid) numValB += 1; 87 if (bb->_phaseValid) numValB += 1; 88 89 if (numValA != numValB) { 90 return numValA > numValB; 91 } 92 93 return false; 94 } 95 96 // 97 //////////////////////////////////////////////////////////////////////////// 98 void t_pppSatObs::prepareObs(const t_satObs& satObs) { 63 99 64 100 _model.reset(); 65 101 66 std::vector<char> bb = OPT->frqBands(_prn.system()); 67 char frqNum1 = '0'; 68 if (bb.size() >= 1) { 69 frqNum1 = bb[0]; 70 } 71 char frqNum2 = '0'; 72 if (bb.size() == 2) { 73 frqNum2 = bb[1]; 74 } 75 76 // Select pseudo-ranges and phase observations 77 // ------------------------------------------- 78 QStringList priorList = _signalPriorities.split(" ", Qt::SkipEmptyParts); 79 string preferredAttrib; 80 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) { 81 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq); 82 char frqSys = t_frequency::toString(frqType)[0]; //cout << "frqSys: " << frqSys << endl; 83 char frqNum = t_frequency::toString(frqType)[1]; //cout << "frqNum: " << frqNum << endl; 84 if (frqSys != _prn.system()) { 85 continue; 86 } 87 if (frqNum != frqNum1 && 88 frqNum != frqNum2 ) { 89 continue; 90 } 91 QStringList hlp; 92 for (int ii = 0; ii < priorList.size(); ii++) { 93 if (priorList[ii].indexOf(":") != -1) { 94 hlp = priorList[ii].split(":", Qt::SkipEmptyParts); 95 if (hlp.size() == 2 && hlp[0].length() == 1 && hlp[0][0] == frqSys) { 96 hlp = hlp[1].split("&", Qt::SkipEmptyParts); 97 } 98 if (hlp.size() == 2 && hlp[0].indexOf(frqNum) != -1) { 99 preferredAttrib = hlp[1].toStdString(); //cout << "preferredAttrib: " << preferredAttrib << endl; 100 } 101 } 102 for (unsigned iPref = 0; iPref < preferredAttrib.length(); iPref++) { 103 QString obsType = QString("%1").arg(frqNum) + preferredAttrib[iPref]; //cout << "obstype: " << obsType.toStdString().c_str() << endl; 104 if (_obs[iFreq] == 0) { 105 for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) { 106 const t_frqObs* obs = pppSatObs._obs[ii]; 107 //cout << "observation2char: " << obs->_rnxType2ch << " vs. " << obsType.toStdString().c_str()<< endl; 108 if (obs->_rnxType2ch == obsType.toStdString() && 109 obs->_codeValid && obs->_code && 110 obs->_phaseValid && obs->_phase) { 111 _obs[iFreq] = new t_frqObs(*obs); //cout << "================> newObs: " << obs->_rnxType2ch << " obs->_lockTime: " << obs->_lockTime << endl; 112 } 113 } 114 } 115 } 116 } 117 } 118 119 // Used frequency types 120 // -------------------- 121 _fType1 = t_frqBand::toFreq(_prn.system(), frqNum1); 122 _fType2 = t_frqBand::toFreq(_prn.system(), frqNum2); 123 102 const t_pppOptions::SysTrkModes* sysTrkModes = OPT->sysTrkModes(_prn.system()); 103 using FrqTrkModes = t_pppOptions::SysTrkModes::FrqTrkModes; 104 105 for (const t_frqObs* obs : satObs._obs) { 106 if ( (obs->_codeValid || obs->_phaseValid)) { 107 t_frequency::type frq = t_frequency::toFreq(_prn.system(), obs->frqChar()); 108 if (frq == t_frequency::dummy) { 109 continue; 110 } 111 string trkModes; 112 if (sysTrkModes) { 113 const vector<FrqTrkModes>& frqTrkModes = sysTrkModes->_frqTrkModes; 114 auto it = find_if(frqTrkModes.begin(), frqTrkModes.end(), 115 [frq](const FrqTrkModes& mm){return mm._frq == frq;}); 116 if (it != frqTrkModes.end()) { 117 trkModes = it->_trkModes; 118 } 119 } 120 if (_obs[frq] == 0 || isBetter(obs, _obs[frq], trkModes)) { 121 delete _obs[frq]; 122 _obs[frq] = new t_frqObs(*obs); 123 } 124 } 125 } 126 124 127 // Check whether all required frequencies available 125 128 // ------------------------------------------------ 126 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) { 127 t_lc::type tLC = OPT->LCs(_prn.system())[ii]; 128 if (tLC == t_lc::GIM) {continue;} 129 if (!isValid(tLC)) { 129 const std::vector<t_lc>& LCs = OPT->LCs(_prn.system()); 130 for (unsigned ii = 0; ii < LCs.size(); ii++) { 131 t_lc LC = LCs[ii]; 132 if (LC._type == t_lc::GIM) { 133 continue; 134 } 135 if (LC._frq1 != t_frequency::G5 && !isValid(LC)) { 130 136 _valid = false; 131 137 return; … … 148 154 bool totOK = false; 149 155 ColumnVector satPosOld(6); satPosOld = 0.0; 150 t_lc::type tLC = t_lc::dummy; 151 if (isValid(t_lc::cIF)) { 152 tLC = t_lc::cIF; 153 } 154 if (tLC == t_lc::dummy && isValid(t_lc::c1)) { 155 tLC = t_lc::c1; 156 } 157 if (tLC == t_lc::dummy && isValid(t_lc::c2)) { 158 tLC = t_lc::c2; 159 } 160 if (tLC == t_lc::dummy) { 161 _valid = false; 156 157 _valid = false; 158 t_frequency::type frq1 = t_frequency::dummy; 159 t_frequency::type frq2 = t_frequency::dummy; 160 OPT->defaultFrqs(_prn.system(), frq1, frq2); 161 if (frq1 != t_frequency::dummy) { 162 t_lc lc1(t_lc::code, frq1); 163 if (isValid(lc1)) { 164 _valid = true; 165 _rangeLC = lc1; 166 } 167 if (frq2 != t_frequency::dummy) { 168 t_lc lcIF(t_lc::codeIF, frq1, frq2); 169 if (isValid(lcIF)) { 170 _valid = true; 171 _rangeLC = lcIF; 172 } 173 } 174 } 175 if (!_valid) { 162 176 return; 163 177 } 164 double prange = obsValue(tLC); 178 179 double prange = obsValue(_rangeLC); 165 180 for (int ii = 1; ii <= 10; ii++) { 166 181 bncTime ToT = _time - prange / t_CST::c - _xcSat[3]; … … 188 203 // 189 204 //////////////////////////////////////////////////////////////////////////// 190 void t_pppSatObs::lcCoeff(t_lc ::type tLC,205 void t_pppSatObs::lcCoeff(t_lc LC, 191 206 map<t_frequency::type, double>& codeCoeff, 192 207 map<t_frequency::type, double>& phaseCoeff, … … 197 212 ionoCoeff.clear(); 198 213 199 double f1 = t_CST::freq( _fType1, _channel);200 double f2 = t_CST::freq( _fType2, _channel);214 double f1 = t_CST::freq(LC._frq1, _channel); 215 double f2 = t_CST::freq(LC._frq2, _channel); 201 216 double f1GPS = t_CST::freq(t_frequency::G1, 0); 202 217 203 switch ( tLC) {204 case t_lc:: l1:205 phaseCoeff[ _fType1] = 1.0;206 ionoCoeff [ _fType1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2);218 switch (LC._type) { 219 case t_lc::phase: 220 phaseCoeff[LC._frq1] = 1.0; 221 ionoCoeff [LC._frq1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2); 207 222 return; 208 case t_lc:: l2:209 phaseCoeff[_fType2] =1.0;210 ionoCoeff [_fType2] = -1.0 *pow(f1GPS, 2) / pow(f2, 2);223 case t_lc::code: 224 codeCoeff[LC._frq1] = 1.0; 225 ionoCoeff[LC._frq1] = pow(f1GPS, 2) / pow(f1, 2); 211 226 return; 212 case t_lc::lIF: 213 phaseCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2); 214 phaseCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2); 227 case t_lc::phaseIF: 228 phaseCoeff[LC._frq1] = f1 * f1 / (f1 * f1 - f2 * f2); 229 phaseCoeff[LC._frq2] = -f2 * f2 / (f1 * f1 - f2 * f2); 230 return; 231 case t_lc::codeIF: 232 codeCoeff[LC._frq1] = f1 * f1 / (f1 * f1 - f2 * f2); 233 codeCoeff[LC._frq2] = -f2 * f2 / (f1 * f1 - f2 * f2); 215 234 return; 216 235 case t_lc::MW: 217 phaseCoeff[ _fType1] = f1 / (f1 - f2);218 phaseCoeff[ _fType2] = -f2 / (f1 - f2);219 codeCoeff [_fType1]= -f1 / (f1 + f2);220 codeCoeff [_fType2]= -f2 / (f1 + f2);236 phaseCoeff[LC._frq1] = f1 / (f1 - f2); 237 phaseCoeff[LC._frq2] = -f2 / (f1 - f2); 238 codeCoeff [LC._frq1] = -f1 / (f1 + f2); 239 codeCoeff [LC._frq2] = -f2 / (f1 + f2); 221 240 return; 222 241 case t_lc::CL: 223 phaseCoeff[_fType1] = 0.5; 224 codeCoeff [_fType1] = 0.5; 225 return; 226 case t_lc::c1: 227 codeCoeff[_fType1] = 1.0; 228 ionoCoeff[_fType1] = pow(f1GPS, 2) / pow(f1, 2); 229 return; 230 case t_lc::c2: 231 codeCoeff[_fType2] = 1.0; 232 ionoCoeff[_fType2] = pow(f1GPS, 2) / pow(f2, 2); 233 return; 234 case t_lc::cIF: 235 codeCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2); 236 codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2); 242 phaseCoeff[LC._frq1] = 0.5; 243 codeCoeff [LC._frq1] = 0.5; 237 244 return; 238 245 case t_lc::GIM: … … 245 252 // 246 253 //////////////////////////////////////////////////////////////////////////// 247 bool t_pppSatObs::isValid(t_lc ::type tLC) const {254 bool t_pppSatObs::isValid(t_lc LC) const { 248 255 bool valid = true; 249 obsValue( tLC, &valid);256 obsValue(LC, &valid); 250 257 251 258 return valid; … … 253 260 // 254 261 //////////////////////////////////////////////////////////////////////////// 255 double t_pppSatObs::obsValue(t_lc ::type tLC, bool* valid) const {262 double t_pppSatObs::obsValue(t_lc LC, bool* valid) const { 256 263 257 264 double retVal = 0.0; … … 259 266 260 267 // Pseudo observations 261 if ( tLC== t_lc::GIM) {268 if (LC._type == t_lc::GIM) { 262 269 if (_stecSat == 0.0) { 263 270 if (valid) *valid = false; … … 272 279 map<t_frequency::type, double> phaseCoeff; 273 280 map<t_frequency::type, double> ionoCoeff; 274 lcCoeff( tLC, codeCoeff, phaseCoeff, ionoCoeff);281 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff); 275 282 276 283 map<t_frequency::type, double>::const_iterator it; … … 303 310 // 304 311 //////////////////////////////////////////////////////////////////////////// 305 double t_pppSatObs::lambda(t_lc ::type tLC) const {306 307 double f1 = t_CST::freq( _fType1, _channel);308 double f2 = t_CST::freq( _fType2, _channel);309 310 if ( tLC== t_lc::l1) {312 double t_pppSatObs::lambda(t_lc LC) const { 313 314 double f1 = t_CST::freq(LC._frq1, _channel); 315 double f2 = t_CST::freq(LC._frq2, _channel); 316 317 if (LC._type == t_lc::phase) { 311 318 return t_CST::c / f1; 312 319 } 313 else if (tLC == t_lc::l2) { 314 return t_CST::c / f2; 315 } 316 else if (tLC == t_lc::lIF) { 320 else if (LC._type == t_lc::phaseIF) { 317 321 return t_CST::c / (f1 + f2); 318 322 } 319 else if ( tLC== t_lc::MW) {323 else if (LC._type == t_lc::MW) { 320 324 return t_CST::c / (f1 - f2); 321 325 } 322 else if ( tLC== t_lc::CL) {326 else if (LC._type == t_lc::CL) { 323 327 return t_CST::c / f1 / 2.0; 324 328 } … … 329 333 // 330 334 //////////////////////////////////////////////////////////////////////////// 331 double t_pppSatObs::sigma(t_lc ::type tLC) const {335 double t_pppSatObs::sigma(t_lc LC) const { 332 336 333 337 double retVal = 0.0; … … 335 339 map<t_frequency::type, double> phaseCoeff; 336 340 map<t_frequency::type, double> ionoCoeff; 337 lcCoeff( tLC, codeCoeff, phaseCoeff, ionoCoeff);338 339 if ( tLC== t_lc::GIM) {341 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff); 342 343 if (LC._type == t_lc::GIM) { 340 344 retVal = OPT->_sigmaGIM * OPT->_sigmaGIM; 341 345 } … … 354 358 // De-Weight R 355 359 // ----------- 356 if (_prn.system() == 'R'&& t_lc::includesCode(tLC)) {360 if (_prn.system() == 'R'&& LC.includesCode()) { 357 361 retVal *= 5.0; 358 362 } … … 361 365 // ----------------------------- 362 366 double cEle = 1.0; 363 if ( (OPT->_eleWgtCode && t_lc::includesCode(tLC)) ||364 (OPT->_eleWgtPhase && t_lc::includesPhase(tLC)) ) {367 if ( (OPT->_eleWgtCode && LC.includesCode()) || 368 (OPT->_eleWgtPhase && LC.includesPhase()) ) { 365 369 double eleD = eleSat()*180.0/M_PI; 366 370 double hlp = fabs(90.0 - eleD); … … 373 377 // 374 378 //////////////////////////////////////////////////////////////////////////// 375 double t_pppSatObs::maxRes(t_lc ::type tLC) const {379 double t_pppSatObs::maxRes(t_lc LC) const { 376 380 double retVal = 0.0; 377 381 … … 379 383 map<t_frequency::type, double> phaseCoeff; 380 384 map<t_frequency::type, double> ionoCoeff; 381 lcCoeff( tLC, codeCoeff, phaseCoeff, ionoCoeff);385 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff); 382 386 383 387 map<t_frequency::type, double>::const_iterator it; … … 388 392 retVal += it->second * it->second * OPT->_maxResL1 * OPT->_maxResL1; 389 393 } 390 if ( tLC== t_lc::GIM) {394 if (LC._type == t_lc::GIM) { 391 395 retVal = OPT->_maxResGIM * OPT->_maxResGIM + OPT->_maxResGIM * OPT->_maxResGIM; 392 396 } … … 517 521 } 518 522 const t_frqObs* obs = _obs[iFreq]; 519 if (obs && 520 obs->_rnxType2ch == bias._rnxType2ch) { 521 _model._codeBias[iFreq] = bias._value; 523 if (obs && obs->_rnxType2ch == bias._rnxType2ch) { 524 _model._codeBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE); 522 525 } 523 526 } … … 527 530 // Phase Biases 528 531 // ----------- 529 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn); 530 double yaw = 0.0; 531 bool ssr = false; 532 if (satPhaseBias) { 533 double dt = station->epochTime() - satPhaseBias->_time; 534 if (satPhaseBias->_updateInt) { 535 dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]); 536 } 537 yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt; 538 ssr = true; 539 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) { 540 const t_frqPhaseBias& bias = satPhaseBias->_bias[ii]; 541 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) { 542 string frqStr = t_frequency::toString(t_frequency::type(iFreq)); 543 if (frqStr[0] != _prn.system()) { 544 continue; 545 } 546 const t_frqObs* obs = _obs[iFreq]; 547 if (obs && 548 obs->_rnxType2ch == bias._rnxType2ch) { 549 _model._phaseBias[iFreq] = bias._value; 532 double yaw = 0.0; 533 bool useYaw = false; 534 if (OPT->arSystem(_prn.system())) { 535 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn); 536 if (satPhaseBias) { 537 if (OPT->_ar._useYaw) { 538 double dt = station->epochTime() - satPhaseBias->_time; 539 if (satPhaseBias->_updateInt) { 540 dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]); 541 } 542 yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt; 543 useYaw = true; 544 } 545 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) { 546 const t_frqPhaseBias& bias = satPhaseBias->_bias[ii]; 547 if (bias._fixIndicator) { // if AR, biases without fixIndicator not used 548 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) { 549 string frqStr = t_frequency::toString(t_frequency::type(iFreq)); 550 if (frqStr[0] != _prn.system()) { 551 continue; 552 } 553 t_frqObs* obs = _obs[iFreq]; 554 if (obs && obs->_rnxType2ch[0] == bias._rnxType2ch[0]) { // allow different tracking mode 555 _model._phaseBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE); 556 obs->_biasJumpCounter = bias._jumpCounter; 557 } 558 } 550 559 } 551 560 } … … 555 564 // Phase Wind-Up 556 565 // ------------- 557 _model._windUp = station->windUp(_time, _prn, rSat, ssr, yaw, vSat) ;566 _model._windUp = station->windUp(_time, _prn, rSat, useYaw, yaw, vSat) ; 558 567 559 568 // Relativistic effect due to earth gravity … … 574 583 bool vTecUsage = true; 575 584 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) { 576 t_lc ::type tLC = OPT->LCs(_prn.system())[ii];577 if ( tLC== t_lc::cIF || tLC== t_lc::lIF) {585 t_lc LC = OPT->LCs(_prn.system())[ii]; 586 if (LC._type == t_lc::codeIF || LC._type == t_lc::phaseIF) { 578 587 vTecUsage = false; 579 588 } … … 601 610 _model._set = true; 602 611 603 //printModel(); 612 if (OPT->_logMode == t_pppOptions::all) { 613 printModel(); 614 } 604 615 605 616 return success; … … 636 647 if (_prn.system() == frqStr[0]) { 637 648 LOG << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl 638 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << "\t(" << _obs[iFreq]-> _rnxType2ch[1]<< ") " << endl639 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << "\t(" << _obs[iFreq]-> _rnxType2ch[1]<< ") " << endl649 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << "\t(" << _obs[iFreq]->trkChar() << ") " << endl 650 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << "\t(" << _obs[iFreq]->trkChar() << ") " << endl 640 651 << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl; 641 652 } … … 652 663 char sys = _prn.system(); 653 664 for (unsigned ii = 0; ii < OPT->LCs(sys).size(); ii++) { 654 t_lc ::type tLC = OPT->LCs(sys)[ii];655 LOG << "OBS-CMP " << setw(4) << t_lc::toString(tLC) << ": " << _prn.toString() << " "656 << setw(12) << setprecision(3) << obsValue( tLC) << " "657 << setw(12) << setprecision(3) << cmpValue( tLC) << " "658 << setw(12) << setprecision(3) << obsValue( tLC) - cmpValue(tLC) << endl;659 } 660 } 661 662 // 663 //////////////////////////////////////////////////////////////////////////// 664 double t_pppSatObs::cmpValueForBanc(t_lc ::type tLC) const {665 return cmpValue( tLC) - _model._rho - _model._sagnac - _model._recClkM;666 } 667 668 // 669 //////////////////////////////////////////////////////////////////////////// 670 double t_pppSatObs::cmpValue(t_lc ::type tLC) const {665 t_lc LC = OPT->LCs(sys)[ii]; 666 LOG << "OBS-CMP " << setw(4) << LC.toString() << ": " << _prn.toString() << " " 667 << setw(12) << setprecision(3) << obsValue(LC) << " " 668 << setw(12) << setprecision(3) << cmpValue(LC) << " " 669 << setw(12) << setprecision(3) << obsValue(LC) - cmpValue(LC) << endl; 670 } 671 } 672 673 // 674 //////////////////////////////////////////////////////////////////////////// 675 double t_pppSatObs::cmpValueForBanc(t_lc LC) const { 676 return cmpValue(LC) - _model._rho - _model._sagnac - _model._recClkM; 677 } 678 679 // 680 //////////////////////////////////////////////////////////////////////////// 681 double t_pppSatObs::cmpValue(t_lc LC) const { 671 682 double cmpValue; 672 683 673 if (!isValid( tLC)) {684 if (!isValid(LC)) { 674 685 cmpValue = 0.0; 675 686 } 676 else if ( tLC== t_lc::GIM) {687 else if (LC._type == t_lc::GIM) { 677 688 cmpValue = _stecSat; 678 689 } … … 691 702 map<t_frequency::type, double> phaseCoeff; 692 703 map<t_frequency::type, double> ionoCoeff; 693 lcCoeff( tLC, codeCoeff, phaseCoeff, ionoCoeff);704 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff); 694 705 map<t_frequency::type, double>::const_iterator it; 695 706 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) { 696 707 t_frequency::type tFreq = it->first; 697 708 dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]); 698 if (OPT->PPP_RTK) {699 dispPart += it->second * (_model._ionoCodeDelay[tFreq]);700 }701 709 } 702 710 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) { … … 704 712 dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] + 705 713 _model._windUp * t_CST::lambda(tFreq, _channel)); 706 if (OPT->PPP_RTK) {707 dispPart += it->second * (- _model._ionoCodeDelay[tFreq]);708 }709 714 } 710 715 cmpValue = nonDisp + dispPart; … … 716 721 // 717 722 //////////////////////////////////////////////////////////////////////////// 718 void t_pppSatObs::setRes(t_lc ::type tLC, double res) {719 _res[ tLC] = res;720 } 721 722 // 723 //////////////////////////////////////////////////////////////////////////// 724 double t_pppSatObs::getRes(t_lc ::type tLC) const {725 map<t_lc ::type, double>::const_iterator it = _res.find(tLC);723 void t_pppSatObs::setRes(t_lc LC, double res) { 724 _res[LC] = res; 725 } 726 727 // 728 //////////////////////////////////////////////////////////////////////////// 729 double t_pppSatObs::getRes(t_lc LC) const { 730 map<t_lc, double>::const_iterator it = _res.find(LC); 726 731 if (it != _res.end()) { 727 732 return it->second; … … 742 747 return pseudoObsIono; 743 748 } 749 750 // 751 //////////////////////////////////////////////////////////////////////////// 752 bool t_pppSatObs::hasBiases() const { 753 bool ar = OPT->arSystem(_prn.system()); 754 set<t_frequency::type> frqs; 755 for (const auto& lc : OPT->LCs(_prn.system())) { 756 if (lc._frq1 != t_frequency::dummy) frqs.insert(lc._frq1); 757 if (lc._frq2 != t_frequency::dummy) frqs.insert(lc._frq2); 758 } 759 for (int iFreq : frqs) { 760 if (_obs[iFreq] != 0) { 761 if (_model._codeBias[iFreq] == 0 || (ar && _model._phaseBias[iFreq] == 0)) { 762 return false; 763 } 764 } 765 } 766 return true; 767 } -
trunk/BNC/src/PPP/pppSatObs.h
r10251 r10791 11 11 namespace BNC_PPP { 12 12 13 class t_pppStation; 13 class t_pppStation; 14 14 15 class t_pppSatObs { 16 public: 17 t_pppSatObs(const t_satObs& satObs); 18 ~t_pppSatObs(); 19 bool isValid() const {return _valid;}; 20 bool isValid(t_lc ::type tLC) const;21 boolisReference() const {return _reference;};22 voidsetAsReference(){_reference = true;};23 void resetReference() {_reference =false;};24 const t_prn&prn() const {return _prn;}25 const ColumnVector& xc() const {return _xcSat;}26 const bncTime& time() const {return _time;}27 t_irc cmpModel(const t_pppStation* station);28 doubleobsValue(t_lc::type tLC, bool* valid = 0) const;29 double cmpValue(t_lc::type tLC) const;30 double cmpValue ForBanc(t_lc::type tLC) const;31 double rho() const{return _model._rho;}32 double sagnac() const {return _model._sagnac;}33 double eleSat() const {return _model._eleSat;}34 boolmodelSet() const {return _model._set;}35 voidprintModel() const;36 void print ObsMinusComputed() const;37 void lcCoeff(t_lc::type tLC,38 std::map<t_frequency::type, double>& codeCoeff,39 std::map<t_frequency::type, double>& phaseCoeff,40 std::map<t_frequency::type, double>& ionoCoeff) const;41 doublelambda(t_lc::type tLC) const;42 double sigma(t_lc::type tLC) const;43 double maxRes(t_lc::type tLC) const;44 booloutlier() const{return _outlier;}45 voidsetOutlier(){_outlier= true;}46 void resetOutlier() {_outlier =false;}47 void setRes(t_lc::type tLC, double res);48 doublegetRes(t_lc::type tLC) const;49 boolsetPseudoObsIono(t_frequency::type freq);50 doublegetIonoCodeDelay(t_frequency::type freq){return _model._ionoCodeDelay[freq];}51 double get CodeBias(t_frequency::type freq) {return _model._codeBias[freq];}52 t_frequency::type fType1() const{return _fType1;}53 t_frequency::type fType2() const{return _fType2;}15 class t_pppSatObs { 16 public: 17 t_pppSatObs(const t_satObs& satObs); 18 ~t_pppSatObs(); 19 bool isValid() const {return _valid;}; 20 bool isValid(t_lc LC) const; 21 t_lc rangeLC() const {return _rangeLC;}; 22 bool isReference() const {return _reference;}; 23 void setAsReference() {_reference = true;}; 24 void resetReference() {_reference = false;}; 25 const t_prn& prn() const {return _prn;} 26 const ColumnVector& xc() const {return _xcSat;} 27 const bncTime& time() const {return _time;} 28 t_irc cmpModel(const t_pppStation* station); 29 double obsValue(t_lc LC, bool* valid = 0) const; 30 double cmpValue(t_lc LC) const; 31 double cmpValueForBanc(t_lc LC) const; 32 double rho() const {return _model._rho;} 33 double sagnac() const {return _model._sagnac;} 34 double eleSat() const {return _model._eleSat;} 35 bool modelSet() const {return _model._set;} 36 void printModel() const; 37 void printObsMinusComputed() const; 38 void lcCoeff(t_lc LC, 39 std::map<t_frequency::type, double>& codeCoeff, 40 std::map<t_frequency::type, double>& phaseCoeff, 41 std::map<t_frequency::type, double>& ionoCoeff) const; 42 double lambda(t_lc LC) const; 43 double sigma(t_lc LC) const; 44 double maxRes(t_lc LC) const; 45 bool outlier() const {return _outlier;} 46 void setOutlier() {_outlier = true;} 47 void resetOutlier() {_outlier = false;} 48 void setRes(t_lc LC, double res); 49 double getRes(t_lc LC) const; 50 bool setPseudoObsIono(t_frequency::type freq); 51 double getIonoCodeDelay(t_frequency::type freq) {return _model._ionoCodeDelay[freq];} 52 double getCodeBias(t_frequency::type freq) {return _model._codeBias[freq];} 53 bool hasBiases() const; 54 54 55 // RINEX 56 bool slip() const { 57 for (unsigned ii = 1; ii < t_frequency::max; ii++) { 58 if (_obs[ii] && _obs[ii]->_slip) { 59 return true; 55 // RINEX 56 bool slip() const { 57 for (unsigned ii = 1; ii < t_frequency::max; ii++) { 58 if (_obs[ii] && _obs[ii]->_slip) { 59 return true; 60 } 60 61 } 62 return false; 61 63 } 62 return false;63 }64 64 65 // RTCM 66 int slipCounter() const { 67 int cnt = -1; 68 for (unsigned ii = 1; ii < t_frequency::max; ii++) { 69 if (_obs[ii] && _obs[ii]->_slipCounter > cnt) { 70 cnt = _obs[ii]->_slipCounter; 65 // RTCM 66 int slipCounter() const { 67 int cnt = -1; 68 for (unsigned ii = 1; ii < t_frequency::max; ii++) { 69 if (_obs[ii] && _obs[ii]->_slipCounter > cnt) { 70 cnt = _obs[ii]->_slipCounter; 71 } 71 72 } 73 return cnt; 72 74 } 73 return cnt;74 }75 75 76 int biasJumpCounter() const { 77 int jmp = -1; 78 for (unsigned ii = 1; ii < t_frequency::max; ii++) { 79 if (_obs[ii] && _obs[ii]->_biasJumpCounter > jmp) { 80 jmp = _obs[ii]->_biasJumpCounter; 76 int biasJumpCounter() const { 77 int jmp = -1; 78 for (unsigned ii = 1; ii < t_frequency::max; ii++) { 79 if (_obs[ii] && _obs[ii]->_biasJumpCounter > jmp) { 80 jmp = _obs[ii]->_biasJumpCounter; 81 } 81 82 } 83 return jmp; 82 84 } 83 return jmp;84 }85 85 86 private: 87 class t_model { 88 public: 89 t_model() {reset();} 90 ~t_model() {} 91 void reset() { 92 _set = false; 93 _rho = 0.0; 94 _eleSat = 0.0; 95 _azSat = 0.0; 96 _elTx = 0.0; 97 _azTx = 0.0; 98 _recClkM = 0.0; 99 _satClkM = 0.0; 100 _sagnac = 0.0; 101 _antEcc = 0.0; 102 _tropo = 0.0; 103 _tropo0 = 0.0; 104 _tideEarth = 0.0; 105 _tideOcean = 0.0; 106 _windUp = 0.0; 107 _rel = 0.0; 108 for (unsigned ii = 0; ii < t_frequency::max; ii++) { 109 _antPCO[ii] = 0.0; 110 _codeBias[ii] = 0.0; 111 _phaseBias[ii] = 0.0; 112 _ionoCodeDelay[ii] = 0.0; 86 private: 87 class t_model { 88 public: 89 t_model() {reset();} 90 ~t_model() {} 91 void reset() { 92 _set = false; 93 _rho = 0.0; 94 _eleSat = 0.0; 95 _azSat = 0.0; 96 _elTx = 0.0; 97 _azTx = 0.0; 98 _recClkM = 0.0; 99 _satClkM = 0.0; 100 _sagnac = 0.0; 101 _antEcc = 0.0; 102 _tropo = 0.0; 103 _tropo0 = 0.0; 104 _tideEarth = 0.0; 105 _tideOcean = 0.0; 106 _windUp = 0.0; 107 _rel = 0.0; 108 for (unsigned ii = 0; ii < t_frequency::max; ii++) { 109 _antPCO[ii] = 0.0; 110 _codeBias[ii] = 0.0; 111 _phaseBias[ii] = 0.0; 112 _ionoCodeDelay[ii] = 0.0; 113 } 113 114 } 114 } 115 bool _set; 116 double _rho; 117 double _eleSat; 118 double _azSat; 119 double _elTx; 120 double _azTx; 121 double _recClkM; 122 double _satClkM; 123 double _sagnac; 124 double _antEcc; 125 double _tropo; 126 double _tropo0; 127 double _tideEarth; 128 double _tideOcean; 129 double _windUp; 130 double _rel; 131 double _antPCO[t_frequency::max]; 132 double _codeBias[t_frequency::max]; 133 double _phaseBias[t_frequency::max]; 134 double _ionoCodeDelay[t_frequency::max]; 115 bool _set; 116 double _rho; 117 double _eleSat; 118 double _azSat; 119 double _elTx; 120 double _azTx; 121 double _recClkM; 122 double _satClkM; 123 double _sagnac; 124 double _antEcc; 125 double _tropo; 126 double _tropo0; 127 double _tideEarth; 128 double _tideOcean; 129 double _windUp; 130 double _rel; 131 double _antPCO[t_frequency::max]; 132 double _codeBias[t_frequency::max]; 133 double _phaseBias[t_frequency::max]; 134 double _ionoCodeDelay[t_frequency::max]; 135 }; 136 137 void prepareObs(const t_satObs& satObs); 138 139 bool isBetter(const t_frqObs* aa, t_frqObs* bb, const std::string& trkModes) const; 140 141 bool _valid; 142 bool _reference; 143 t_lc _rangeLC; 144 t_prn _prn; 145 bncTime _time; 146 int _channel; 147 t_frqObs* _obs[t_frequency::max]; 148 ColumnVector _xcSat; 149 ColumnVector _vvSat; 150 t_model _model; 151 bool _outlier; 152 std::map<t_lc, double> _res; 153 double _signalPropagationTime; 154 double _stecSat; 155 double _tropo0; 135 156 }; 136 137 void prepareObs(const t_satObs& satObs);138 139 bool _valid;140 bool _reference;141 t_frequency::type _fType1;142 t_frequency::type _fType2;143 t_prn _prn;144 bncTime _time;145 int _channel;146 t_frqObs* _obs[t_frequency::max];147 ColumnVector _xcSat;148 ColumnVector _vvSat;149 t_model _model;150 bool _outlier;151 std::map<t_lc::type, double> _res;152 double _signalPropagationTime;153 double _stecSat;154 double _tropo0;155 QString _signalPriorities;156 };157 157 158 158 }
Note:
See TracChangeset
for help on using the changeset viewer.
