[7237] | 1 | /* -------------------------------------------------------------------------
|
---|
| 2 | * BKG NTRIP Client
|
---|
| 3 | * -------------------------------------------------------------------------
|
---|
| 4 | *
|
---|
| 5 | * Class: t_pppFilter
|
---|
| 6 | *
|
---|
| 7 | * Purpose: Filter Adjustment
|
---|
| 8 | *
|
---|
| 9 | * Author: L. Mervart
|
---|
| 10 | *
|
---|
| 11 | * Created: 29-Jul-2014
|
---|
| 12 | *
|
---|
[7267] | 13 | * Changes:
|
---|
[7237] | 14 | *
|
---|
| 15 | * -----------------------------------------------------------------------*/
|
---|
| 16 |
|
---|
| 17 | #include <iostream>
|
---|
| 18 | #include <iomanip>
|
---|
| 19 | #include <cmath>
|
---|
| 20 | #include <newmat.h>
|
---|
| 21 | #include <newmatio.h>
|
---|
| 22 | #include <newmatap.h>
|
---|
| 23 |
|
---|
| 24 | #include "pppFilter.h"
|
---|
| 25 | #include "bncutils.h"
|
---|
| 26 | #include "pppParlist.h"
|
---|
| 27 | #include "pppObsPool.h"
|
---|
| 28 | #include "pppStation.h"
|
---|
| 29 |
|
---|
| 30 | using namespace BNC_PPP;
|
---|
| 31 | using namespace std;
|
---|
| 32 |
|
---|
| 33 | // Constructor
|
---|
| 34 | ////////////////////////////////////////////////////////////////////////////
|
---|
[8905] | 35 | t_pppFilter::t_pppFilter(t_pppObsPool* obsPool) {
|
---|
| 36 | _numSat = 0;
|
---|
| 37 | _obsPool = obsPool;
|
---|
[8910] | 38 | _refPrn = t_prn();
|
---|
[8915] | 39 | _datumTrafo = new t_datumTrafo();
|
---|
[7237] | 40 | }
|
---|
| 41 |
|
---|
| 42 | // Destructor
|
---|
| 43 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 44 | t_pppFilter::~t_pppFilter() {
|
---|
[8915] | 45 | delete _datumTrafo;
|
---|
[7237] | 46 | }
|
---|
| 47 |
|
---|
| 48 | // Process Single Epoch
|
---|
| 49 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9386] | 50 | t_irc t_pppFilter::processEpoch() {
|
---|
[7237] | 51 | _numSat = 0;
|
---|
[7302] | 52 | const double maxSolGap = 60.0;
|
---|
[7237] | 53 |
|
---|
| 54 | // Vector of all Observations
|
---|
| 55 | // --------------------------
|
---|
[8905] | 56 | t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch();
|
---|
[7237] | 57 | if (!epoch) {
|
---|
| 58 | return failure;
|
---|
| 59 | }
|
---|
| 60 | vector<t_pppSatObs*>& allObs = epoch->obsVector();
|
---|
| 61 |
|
---|
| 62 | // Time of the Epoch
|
---|
| 63 | // -----------------
|
---|
| 64 | _epoTime = epoch->epoTime();
|
---|
| 65 |
|
---|
[7302] | 66 | if (!_firstEpoTime.valid() ||
|
---|
| 67 | !_lastEpoTimeOK.valid() ||
|
---|
| 68 | (maxSolGap > 0.0 && _epoTime - _lastEpoTimeOK > maxSolGap)) {
|
---|
[7237] | 69 | _firstEpoTime = _epoTime;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
[7267] | 72 | string epoTimeStr = string(_epoTime);
|
---|
| 73 |
|
---|
[9508] | 74 | const QMap<char, t_pppRefSat*>& refSatMap = epoch->refSatMap();
|
---|
[9532] | 75 |
|
---|
| 76 | //LOG << "processEpoch: printParams before set" << endl;
|
---|
| 77 | //_parlist.printParams(_epoTime);
|
---|
| 78 |
|
---|
[8905] | 79 | //--
|
---|
[7237] | 80 | // Set Parameters
|
---|
[9508] | 81 | if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
|
---|
[9419] | 82 | return failure;
|
---|
| 83 | }
|
---|
[9526] | 84 |
|
---|
[9527] | 85 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
| 86 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
[9386] | 87 | #ifdef BNC_DEBUG_PPP
|
---|
[9534] | 88 | _parlist.printParams(_epoTime);
|
---|
[9386] | 89 | #endif
|
---|
[9527] | 90 | }
|
---|
[7237] | 91 | // Status Vector, Variance-Covariance Matrix
|
---|
| 92 | // -----------------------------------------
|
---|
| 93 | ColumnVector xFltOld = _xFlt;
|
---|
| 94 | SymmetricMatrix QFltOld = _QFlt;
|
---|
[9526] | 95 | setStateVectorAndVarCovMatrix(xFltOld, QFltOld);
|
---|
[8956] | 96 |
|
---|
[8905] | 97 | // Pre-Process Satellite Systems separately
|
---|
| 98 | // ----------------------------------------
|
---|
| 99 | bool preProcessing = false;
|
---|
| 100 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
| 101 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
| 102 | preProcessing = true;
|
---|
[9504] | 103 | const QList<char>& usedSystems = _parlist.usedSystems();
|
---|
[9431] | 104 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 105 | char sys = usedSystems[iSys];
|
---|
[9526] | 106 | _refPrn.set(sys, 0);
|
---|
| 107 | if (OPT->_refSatRequired) {
|
---|
| 108 | _refPrn = refSatMap[sys]->prn();
|
---|
| 109 | }
|
---|
[9386] | 110 | vector<t_pppSatObs*> obsVector;
|
---|
[8905] | 111 | for (unsigned jj = 0; jj < allObs.size(); jj++) {
|
---|
[9386] | 112 | if (allObs[jj]->prn().system() == sys) {
|
---|
[8905] | 113 | obsVector.push_back(allObs[jj]);
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
[9431] | 116 | if (iSys == 0) {
|
---|
| 117 | _datumTrafo->setFirstSystem(sys);
|
---|
[9419] | 118 | }
|
---|
[9386] | 119 | if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
|
---|
[8905] | 120 | epoch->pseudoObsIono(), preProcessing) != success) {
|
---|
[9537] | 121 | LOG << "processSystem != success (pre-processing)" << endl;
|
---|
[9386] | 122 | _xFlt = xFltOld;
|
---|
| 123 | _QFlt = QFltOld;
|
---|
[9532] | 124 | _obsPool->deleteLastEpoch();
|
---|
[9527] | 125 | restoreState(2);
|
---|
[8905] | 126 | return failure;
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
[8956] | 129 | // refSat change required?
|
---|
| 130 | // -----------------------
|
---|
| 131 | if (_obsPool->refSatChangeRequired()) {
|
---|
| 132 | _xFlt = xFltOld;
|
---|
| 133 | _QFlt = QFltOld;
|
---|
| 134 | return success;
|
---|
| 135 | }
|
---|
[9386] | 136 | else if (!_obsPool->refSatChangeRequired()) {
|
---|
[9419] | 137 | initDatumTransformation(allObs, epoch->pseudoObsIono());
|
---|
[8956] | 138 | }
|
---|
[8905] | 139 | }
|
---|
| 140 |
|
---|
[7237] | 141 | // Process Satellite Systems separately
|
---|
| 142 | // ------------------------------------
|
---|
[8912] | 143 | preProcessing = false;
|
---|
[9504] | 144 | const QList<char>& usedSystems = _parlist. usedSystems();
|
---|
[9431] | 145 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 146 | char sys = usedSystems[iSys];
|
---|
[9526] | 147 | _refPrn.set(sys, 0);
|
---|
[8910] | 148 | if (OPT->_refSatRequired) {
|
---|
[9508] | 149 | _refPrn = refSatMap[sys]->prn();
|
---|
[8910] | 150 | }
|
---|
[7267] | 151 | unsigned int num = 0;
|
---|
[7237] | 152 | vector<t_pppSatObs*> obsVector;
|
---|
| 153 | for (unsigned jj = 0; jj < allObs.size(); jj++) {
|
---|
[9419] | 154 | if (allObs[jj]->prn().system() == sys) {
|
---|
[7237] | 155 | obsVector.push_back(allObs[jj]);
|
---|
[9419] | 156 | ++num;
|
---|
[7237] | 157 | }
|
---|
| 158 | }
|
---|
[9431] | 159 | if (iSys == 0 && OPT->_obsModelType == OPT->UncombPPP) {
|
---|
| 160 | _datumTrafo->setFirstSystem(sys);
|
---|
[9419] | 161 | }
|
---|
| 162 | LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num << endl;
|
---|
| 163 | if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
|
---|
[8905] | 164 | epoch->pseudoObsIono(), preProcessing) != success) {
|
---|
[9537] | 165 | LOG << "processSystem != success (fin-processing)" << endl;
|
---|
| 166 | _xFlt = xFltOld;
|
---|
| 167 | _QFlt = QFltOld;
|
---|
| 168 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
| 169 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
| 170 | _obsPool->deleteLastEpoch();
|
---|
| 171 | restoreState(3);
|
---|
| 172 | }
|
---|
[7237] | 173 | return failure;
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
[8912] | 176 |
|
---|
| 177 | // close epoch processing
|
---|
| 178 | // ----------------------
|
---|
[9508] | 179 | cmpDOP(allObs, refSatMap);
|
---|
[9504] | 180 | _parlist.printResult(_epoTime, _QFlt, _xFlt);
|
---|
[8956] | 181 | _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing
|
---|
[7237] | 182 | return success;
|
---|
| 183 | }
|
---|
| 184 |
|
---|
| 185 | // Process Selected LCs
|
---|
| 186 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7267] | 187 | t_irc t_pppFilter::processSystem(const vector<t_lc::type>& LCs,
|
---|
[8905] | 188 | const vector<t_pppSatObs*>& obsVector,
|
---|
| 189 | const t_prn& refPrn,
|
---|
| 190 | bool pseudoObsIonoAvailable,
|
---|
| 191 | bool preProcessing) {
|
---|
[7237] | 192 | LOG.setf(ios::fixed);
|
---|
[9386] | 193 | char sys = refPrn.system();
|
---|
[7237] | 194 |
|
---|
| 195 | // Detect Cycle Slips
|
---|
| 196 | // ------------------
|
---|
[8905] | 197 | if (detectCycleSlips(LCs, obsVector, refPrn, preProcessing) != success) {
|
---|
[7237] | 198 | return failure;
|
---|
| 199 | }
|
---|
[9398] | 200 | if (preProcessing && _obsPool->refSatChangeRequired(sys)) {
|
---|
[9386] | 201 | return success;
|
---|
| 202 | }
|
---|
[7237] | 203 |
|
---|
[8905] | 204 | ColumnVector xSav = _xFlt;
|
---|
| 205 | SymmetricMatrix QSav = _QFlt;
|
---|
| 206 | string epoTimeStr = string(_epoTime);
|
---|
[9504] | 207 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
[9524] | 208 | unsigned nPar = _parlist.nPar();
|
---|
[8965] | 209 |
|
---|
[9386] | 210 | unsigned usedLCs = LCs.size();
|
---|
[8965] | 211 | if (OPT->_pseudoObsIono && !pseudoObsIonoAvailable) {
|
---|
[9386] | 212 | usedLCs -= 1; // GIM not used
|
---|
[8961] | 213 | }
|
---|
| 214 | // max Obs
|
---|
[9538] | 215 | unsigned maxObs = obsVector.size() * usedLCs;
|
---|
| 216 |
|
---|
[8965] | 217 | if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) {
|
---|
| 218 | maxObs -= 1; // pseudo obs iono with respect to refSat
|
---|
[8905] | 219 | }
|
---|
| 220 |
|
---|
[7237] | 221 | // Outlier Detection Loop
|
---|
| 222 | // ----------------------
|
---|
| 223 | for (unsigned iOutlier = 0; iOutlier < maxObs; iOutlier++) {
|
---|
| 224 |
|
---|
| 225 | if (iOutlier > 0) {
|
---|
| 226 | _xFlt = xSav;
|
---|
| 227 | _QFlt = QSav;
|
---|
| 228 | }
|
---|
| 229 |
|
---|
| 230 | // First-Design Matrix, Terms Observed-Computed, Weight Matrix
|
---|
| 231 | // -----------------------------------------------------------
|
---|
[9524] | 232 | Matrix AA(maxObs, nPar);
|
---|
[7237] | 233 | ColumnVector ll(maxObs);
|
---|
| 234 | DiagonalMatrix PP(maxObs); PP = 0.0;
|
---|
[8912] | 235 |
|
---|
[7237] | 236 | int iObs = -1;
|
---|
| 237 | vector<t_pppSatObs*> usedObs;
|
---|
| 238 | vector<t_lc::type> usedTypes;
|
---|
[9386] | 239 |
|
---|
| 240 | // Real Observations
|
---|
| 241 | // =================
|
---|
[7237] | 242 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
[8956] | 243 | t_pppSatObs* obs = obsVector[ii];
|
---|
[9419] | 244 | if (iOutlier == 0 && !preProcessing) {
|
---|
| 245 | obs->resetOutlier();
|
---|
| 246 | }
|
---|
[7237] | 247 | if (!obs->outlier()) {
|
---|
[8905] | 248 | for (unsigned jj = 0; jj < usedLCs; jj++) {
|
---|
[7237] | 249 | const t_lc::type tLC = LCs[jj];
|
---|
[9386] | 250 | if (tLC == t_lc::GIM) {continue;}
|
---|
| 251 | if (tLC == t_lc::Tz0) {continue;}
|
---|
[7237] | 252 | ++iObs;
|
---|
| 253 | usedObs.push_back(obs);
|
---|
| 254 | usedTypes.push_back(tLC);
|
---|
[9524] | 255 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[7237] | 256 | const t_pppParam* par = params[iPar];
|
---|
[8956] | 257 | AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
[7237] | 258 | }
|
---|
| 259 | ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1));
|
---|
| 260 | PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
|
---|
| 261 | }
|
---|
| 262 | }
|
---|
| 263 | }
|
---|
| 264 |
|
---|
[9386] | 265 | if ((!iOutlier) &&
|
---|
| 266 | (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
[9419] | 267 | OPT->_obsModelType == OPT->DCMphaseBias) &&
|
---|
| 268 | (!preProcessing)) {
|
---|
| 269 | _datumTrafo->updateIndices(sys, iObs+1);
|
---|
[9504] | 270 | _datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, _parlist.nPar()), 1);
|
---|
[9386] | 271 | }
|
---|
| 272 |
|
---|
| 273 | // Pseudo Obs Iono
|
---|
| 274 | // ================
|
---|
| 275 | if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) {
|
---|
| 276 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
| 277 | t_pppSatObs* obs = obsVector[ii];
|
---|
| 278 | if (!obs->outlier()) {
|
---|
| 279 | for (unsigned jj = 0; jj < usedLCs; jj++) {
|
---|
| 280 | const t_lc::type tLC = LCs[jj];
|
---|
| 281 | if (tLC == t_lc::GIM && !obs->isReference()) {
|
---|
| 282 | ++iObs;
|
---|
| 283 | } else {continue;}
|
---|
| 284 | usedObs.push_back(obs);
|
---|
| 285 | usedTypes.push_back(tLC);
|
---|
[9524] | 286 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[9386] | 287 | const t_pppParam* par = params[iPar];
|
---|
| 288 | AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
| 289 | }
|
---|
| 290 | ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1));
|
---|
| 291 | PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
|
---|
| 292 | }
|
---|
| 293 | }
|
---|
[8956] | 294 | }
|
---|
[8915] | 295 | }
|
---|
| 296 |
|
---|
[7237] | 297 | // Check number of observations, truncate matrices
|
---|
| 298 | // -----------------------------------------------
|
---|
[9537] | 299 | if (iObs == -1) {LOG << "iObs == -1\n";
|
---|
[7237] | 300 | return failure;
|
---|
| 301 | }
|
---|
| 302 | AA = AA.Rows(1, iObs+1);
|
---|
| 303 | ll = ll.Rows(1, iObs+1);
|
---|
| 304 | PP = PP.SymSubMatrix(1, iObs+1);
|
---|
| 305 |
|
---|
| 306 | // Kalman update step
|
---|
| 307 | // ------------------
|
---|
| 308 | kalman(AA, ll, PP, _QFlt, _xFlt);
|
---|
| 309 |
|
---|
| 310 | // Check Residuals
|
---|
| 311 | // ---------------
|
---|
| 312 | ColumnVector vv = AA * _xFlt - ll;
|
---|
| 313 | double maxOutlier = 0.0;
|
---|
| 314 | int maxOutlierIndex = -1;
|
---|
| 315 | t_lc::type maxOutlierLC = t_lc::dummy;
|
---|
| 316 | for (unsigned ii = 0; ii < usedObs.size(); ii++) {
|
---|
| 317 | const t_lc::type tLC = usedTypes[ii];
|
---|
| 318 | double res = fabs(vv[ii]);
|
---|
| 319 | if (res > usedObs[ii]->maxRes(tLC)) {
|
---|
| 320 | if (res > fabs(maxOutlier)) {
|
---|
| 321 | maxOutlier = vv[ii];
|
---|
| 322 | maxOutlierIndex = ii;
|
---|
| 323 | maxOutlierLC = tLC;
|
---|
| 324 | }
|
---|
| 325 | }
|
---|
| 326 | }
|
---|
| 327 |
|
---|
| 328 | // Mark outlier or break outlier detection loop
|
---|
| 329 | // --------------------------------------------
|
---|
| 330 | if (maxOutlierIndex > -1) {
|
---|
| 331 | t_pppSatObs* obs = usedObs[maxOutlierIndex];
|
---|
| 332 | t_pppParam* par = 0;
|
---|
[9386] | 333 | LOG << epoTimeStr << " Outlier ("
|
---|
| 334 | << ((preProcessing) ? "pre-processing) " : "fin-processing) ") << t_lc::toString(maxOutlierLC) << ' '
|
---|
| 335 | << obs->prn().toString() << ' '
|
---|
| 336 | << setw(8) << setprecision(4) << maxOutlier << endl;
|
---|
[9524] | 337 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[7237] | 338 | t_pppParam* hlp = params[iPar];
|
---|
[8905] | 339 | if (hlp->type() == t_pppParam::amb &&
|
---|
| 340 | hlp->prn() == obs->prn() &&
|
---|
[7237] | 341 | hlp->tLC() == usedTypes[maxOutlierIndex]) {
|
---|
| 342 | par = hlp;
|
---|
| 343 | }
|
---|
| 344 | }
|
---|
[8956] | 345 | if (preProcessing) {
|
---|
[9491] | 346 | // for refSats no ambiguity parameter exists
|
---|
[9386] | 347 | if ((obs->prn() == refPrn) &&
|
---|
| 348 | (t_lc::toString(maxOutlierLC) == "l1" ||
|
---|
| 349 | t_lc::toString(maxOutlierLC) == "l2") ) {
|
---|
| 350 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
[9491] | 351 | break;
|
---|
[9386] | 352 | }
|
---|
| 353 | else {
|
---|
| 354 | if (par) {
|
---|
| 355 | par->setAmbResetCandidate();
|
---|
| 356 | obs->setOutlier();
|
---|
| 357 | }
|
---|
| 358 | else {
|
---|
| 359 | obs->setOutlier();
|
---|
| 360 | }
|
---|
[8905] | 361 | }
|
---|
| 362 | }
|
---|
[9386] | 363 | else {// fin-processing
|
---|
[8956] | 364 | if (par) {
|
---|
[9386] | 365 | if (par->ambResetCandidate()) {
|
---|
[8956] | 366 | resetAmb(par->prn(), obsVector, &QSav, &xSav);
|
---|
| 367 | }
|
---|
| 368 | else {
|
---|
| 369 | par->setAmbResetCandidate();
|
---|
| 370 | obs->setOutlier();
|
---|
| 371 | }
|
---|
[7237] | 372 | }
|
---|
| 373 | else {
|
---|
| 374 | obs->setOutlier();
|
---|
| 375 | }
|
---|
| 376 | }
|
---|
| 377 | }
|
---|
| 378 | // Print Residuals
|
---|
| 379 | // ---------------
|
---|
| 380 | else {
|
---|
[8905] | 381 | if (!preProcessing) {
|
---|
| 382 | for (unsigned jj = 0; jj < LCs.size(); jj++) {
|
---|
| 383 | for (unsigned ii = 0; ii < usedObs.size(); ii++) {
|
---|
| 384 | const t_lc::type tLC = usedTypes[ii];
|
---|
[9386] | 385 | t_pppSatObs* obs = usedObs[ii];
|
---|
[8905] | 386 | if (tLC == LCs[jj]) {
|
---|
| 387 | obs->setRes(tLC, vv[ii]);
|
---|
| 388 | LOG << epoTimeStr << " RES "
|
---|
[9386] | 389 | << left << setw(3) << t_lc::toString(tLC) << right << ' ';
|
---|
| 390 | if (t_lc::toString(tLC) == "Tz0") {LOG << sys << " ";}
|
---|
| 391 | else {LOG << obs->prn().toString();}
|
---|
[9435] | 392 | LOG << setw(9) << setprecision(4) << vv[ii] << endl;
|
---|
[8905] | 393 | }
|
---|
[7237] | 394 | }
|
---|
| 395 | }
|
---|
| 396 | }
|
---|
| 397 | break;
|
---|
| 398 | }
|
---|
| 399 | }
|
---|
| 400 | return success;
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 | // Cycle-Slip Detection
|
---|
| 404 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7267] | 405 | t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type>& LCs,
|
---|
[8905] | 406 | const vector<t_pppSatObs*>& obsVector,
|
---|
| 407 | const t_prn& refPrn,
|
---|
| 408 | bool preProcessing) {
|
---|
[9386] | 409 | const double SLIP = 20.0;
|
---|
| 410 | char sys = refPrn.system();
|
---|
| 411 | string epoTimeStr = string(_epoTime);
|
---|
[9504] | 412 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
[9524] | 413 | unsigned nPar = _parlist.nPar();
|
---|
[7237] | 414 |
|
---|
| 415 | for (unsigned ii = 0; ii < LCs.size(); ii++) {
|
---|
| 416 | const t_lc::type& tLC = LCs[ii];
|
---|
| 417 | if (t_lc::includesPhase(tLC)) {
|
---|
| 418 | for (unsigned iObs = 0; iObs < obsVector.size(); iObs++) {
|
---|
| 419 | const t_pppSatObs* obs = obsVector[iObs];
|
---|
| 420 |
|
---|
[7267] | 421 | // Check set Slips and Jump Counters
|
---|
[7237] | 422 | // ---------------------------------
|
---|
| 423 | bool slip = false;
|
---|
[9386] | 424 |
|
---|
| 425 | // in pre-processing only the reference satellite has to be checked
|
---|
| 426 | if (preProcessing && obs->prn() != refPrn) {
|
---|
| 427 | continue;
|
---|
| 428 | }
|
---|
| 429 |
|
---|
[7237] | 430 | if (obs->slip()) {
|
---|
[8329] | 431 | LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() << endl;
|
---|
[7237] | 432 | slip = true;
|
---|
| 433 | }
|
---|
| 434 |
|
---|
| 435 | if (_slips[obs->prn()]._obsSlipCounter != -1 &&
|
---|
[9088] | 436 | _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) {
|
---|
[8329] | 437 | LOG << epoTimeStr << "cycle slip set (obsSlipCounter) " << obs->prn().toString() << endl;
|
---|
[7237] | 438 | slip = true;
|
---|
| 439 | }
|
---|
[8956] | 440 | if (!preProcessing) {
|
---|
| 441 | _slips[obs->prn()]._obsSlipCounter = obs->slipCounter();
|
---|
| 442 | }
|
---|
[7237] | 443 | if (_slips[obs->prn()]._biasJumpCounter != -1 &&
|
---|
| 444 | _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) {
|
---|
[8329] | 445 | LOG << epoTimeStr << "cycle slip set (biasJumpCounter) " << obs->prn().toString() << endl;
|
---|
[7237] | 446 | slip = true;
|
---|
| 447 | }
|
---|
[8956] | 448 | if (!preProcessing) {
|
---|
| 449 | _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();
|
---|
| 450 | }
|
---|
[7237] | 451 | // Slip Set
|
---|
[7267] | 452 | // --------
|
---|
[7237] | 453 | if (slip) {
|
---|
[8905] | 454 | if (preProcessing) {
|
---|
[9386] | 455 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
[8905] | 456 | }
|
---|
| 457 | else {
|
---|
| 458 | resetAmb(obs->prn(), obsVector);
|
---|
| 459 | }
|
---|
[7237] | 460 | }
|
---|
| 461 | // Check Pre-Fit Residuals
|
---|
| 462 | // -----------------------
|
---|
| 463 | else {
|
---|
[9419] | 464 | if (refPrn != t_prn()) {return success;}
|
---|
[9524] | 465 | ColumnVector AA(nPar);
|
---|
| 466 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[7237] | 467 | const t_pppParam* par = params[iPar];
|
---|
[8956] | 468 | AA[iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
[7237] | 469 | }
|
---|
| 470 | double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA);
|
---|
| 471 | double vv = DotProduct(AA, _xFlt) - ll;
|
---|
| 472 | if (fabs(vv) > SLIP) {
|
---|
[9386] | 473 | LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' '
|
---|
| 474 | << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl;
|
---|
[8905] | 475 | if (preProcessing) {
|
---|
[9386] | 476 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
[8905] | 477 | }
|
---|
| 478 | else {
|
---|
| 479 | resetAmb(obs->prn(), obsVector);
|
---|
| 480 | }
|
---|
[7237] | 481 | }
|
---|
| 482 | }
|
---|
| 483 | }
|
---|
| 484 | }
|
---|
| 485 | }
|
---|
| 486 | return success;
|
---|
| 487 | }
|
---|
| 488 |
|
---|
| 489 | // Reset Ambiguity Parameter (cycle slip)
|
---|
| 490 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 491 | t_irc t_pppFilter::resetAmb(t_prn prn, const vector<t_pppSatObs*>& obsVector,
|
---|
| 492 | SymmetricMatrix* QSav, ColumnVector* xSav) {
|
---|
[8965] | 493 |
|
---|
[7237] | 494 | t_irc irc = failure;
|
---|
[9504] | 495 | vector<t_pppParam*>& params = _parlist.params();
|
---|
[7237] | 496 | for (unsigned iPar = 0; iPar < params.size(); iPar++) {
|
---|
| 497 | t_pppParam* par = params[iPar];
|
---|
| 498 | if (par->type() == t_pppParam::amb && par->prn() == prn) {
|
---|
| 499 | int ind = par->indexNew();
|
---|
| 500 | t_lc::type tLC = par->tLC();
|
---|
| 501 | LOG << string(_epoTime) << " RESET " << par->toString() << endl;
|
---|
| 502 | delete par; par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);
|
---|
| 503 | par->setIndex(ind);
|
---|
| 504 | params[iPar] = par;
|
---|
| 505 | for (unsigned ii = 1; ii <= params.size(); ii++) {
|
---|
| 506 | _QFlt(ii, ind+1) = 0.0;
|
---|
| 507 | if (QSav) {
|
---|
| 508 | (*QSav)(ii, ind+1) = 0.0;
|
---|
| 509 | }
|
---|
| 510 | }
|
---|
| 511 | _QFlt(ind+1,ind+1) = par->sigma0() * par->sigma0();
|
---|
| 512 | if (QSav) {
|
---|
| 513 | (*QSav)(ind+1,ind+1) = _QFlt(ind+1,ind+1);
|
---|
| 514 | }
|
---|
| 515 | _xFlt[ind] = 0.0;
|
---|
| 516 | if (xSav) {
|
---|
| 517 | (*xSav)[ind] = _xFlt[ind];
|
---|
| 518 | }
|
---|
| 519 | _x0[ind] = par->x0();
|
---|
| 520 | irc = success;
|
---|
| 521 | }
|
---|
| 522 | }
|
---|
| 523 |
|
---|
| 524 | return irc;
|
---|
| 525 | }
|
---|
| 526 |
|
---|
[9395] | 527 | // Add infinite noise to iono
|
---|
[9386] | 528 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 529 | t_irc t_pppFilter::addNoiseToIono(char sys) {
|
---|
| 530 |
|
---|
| 531 | t_irc irc = failure;
|
---|
[9504] | 532 | vector<t_pppParam*>& params = _parlist.params();
|
---|
[9386] | 533 | for (unsigned iPar = 0; iPar < params.size(); iPar++) {
|
---|
| 534 | t_pppParam* par = params[iPar];
|
---|
| 535 | if (par->type() == t_pppParam::ion && par->prn().system() == sys) {
|
---|
| 536 | int ind = par->indexNew();
|
---|
| 537 | LOG << string(_epoTime) << " ADD IONO_NOISE TO " << par->prn().toString() << endl;
|
---|
| 538 | par->setIndex(ind);
|
---|
| 539 | _QFlt(ind+1,ind+1) += par->sigma0() * par->sigma0();
|
---|
| 540 | irc = success;
|
---|
| 541 | }
|
---|
| 542 | }
|
---|
| 543 |
|
---|
| 544 | return irc;
|
---|
| 545 | }
|
---|
| 546 |
|
---|
[7237] | 547 | // Compute various DOP Values
|
---|
| 548 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9521] | 549 | void t_pppFilter::cmpDOP(const vector<t_pppSatObs*>& obsVector,
|
---|
[9508] | 550 | const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
[7237] | 551 |
|
---|
| 552 | _dop.reset();
|
---|
| 553 |
|
---|
| 554 | try {
|
---|
| 555 | const unsigned numPar = 4;
|
---|
| 556 | Matrix AA(obsVector.size(), numPar);
|
---|
| 557 | _numSat = 0;
|
---|
| 558 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
| 559 | t_pppSatObs* obs = obsVector[ii];
|
---|
[9508] | 560 | char sys = obs->prn().system();
|
---|
[8956] | 561 | t_prn refPrn = t_prn();
|
---|
| 562 | if (OPT->_refSatRequired) {
|
---|
[9508] | 563 | refPrn = refSatMap[sys]->prn();
|
---|
[8956] | 564 | }
|
---|
[7237] | 565 | if (obs->isValid() && !obs->outlier()) {
|
---|
| 566 | ++_numSat;
|
---|
| 567 | for (unsigned iPar = 0; iPar < numPar; iPar++) {
|
---|
[9504] | 568 | const t_pppParam* par = _parlist.params()[iPar];
|
---|
[8956] | 569 | AA[_numSat-1][iPar] = par->partial(_epoTime, obs, t_lc::c1, refPrn);
|
---|
[7237] | 570 | }
|
---|
| 571 | }
|
---|
| 572 | }
|
---|
| 573 | if (_numSat < 4) {
|
---|
| 574 | return;
|
---|
| 575 | }
|
---|
| 576 | AA = AA.Rows(1, _numSat);
|
---|
[7267] | 577 | SymmetricMatrix NN; NN << AA.t() * AA;
|
---|
[7237] | 578 | SymmetricMatrix QQ = NN.i();
|
---|
[7267] | 579 |
|
---|
[7928] | 580 | _dop.H = sqrt(QQ(1,1) + QQ(2,2));
|
---|
| 581 | _dop.V = sqrt(QQ(3,3));
|
---|
[7237] | 582 | _dop.P = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3));
|
---|
| 583 | _dop.T = sqrt(QQ(4,4));
|
---|
| 584 | _dop.G = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3) + QQ(4,4));
|
---|
| 585 | }
|
---|
| 586 | catch (...) {
|
---|
| 587 | }
|
---|
| 588 | }
|
---|
| 589 |
|
---|
[9526] | 590 | //
|
---|
[7237] | 591 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 592 | void t_pppFilter::predictCovCrdPart(const SymmetricMatrix& QFltOld) {
|
---|
| 593 |
|
---|
[9504] | 594 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
[7237] | 595 | if (params.size() < 3) {
|
---|
| 596 | return;
|
---|
| 597 | }
|
---|
| 598 |
|
---|
| 599 | bool first = (params[0]->indexOld() < 0);
|
---|
| 600 |
|
---|
| 601 | SymmetricMatrix Qneu(3); Qneu = 0.0;
|
---|
| 602 | for (unsigned ii = 0; ii < 3; ii++) {
|
---|
| 603 | const t_pppParam* par = params[ii];
|
---|
| 604 | if (first) {
|
---|
| 605 | Qneu[ii][ii] = par->sigma0() * par->sigma0();
|
---|
| 606 | }
|
---|
| 607 | else {
|
---|
| 608 | Qneu[ii][ii] = par->noise() * par->noise();
|
---|
| 609 | }
|
---|
| 610 | }
|
---|
| 611 |
|
---|
| 612 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
| 613 | SymmetricMatrix Qxyz(3);
|
---|
| 614 | covariNEU_XYZ(Qneu, sta->ellApr().data(), Qxyz);
|
---|
| 615 |
|
---|
| 616 | if (first) {
|
---|
| 617 | _QFlt.SymSubMatrix(1,3) = Qxyz;
|
---|
| 618 | }
|
---|
| 619 | else {
|
---|
| 620 | double dt = _epoTime - _firstEpoTime;
|
---|
| 621 | if (dt < OPT->_seedingTime) {
|
---|
| 622 | _QFlt.SymSubMatrix(1,3) = QFltOld.SymSubMatrix(1,3);
|
---|
| 623 | }
|
---|
| 624 | else {
|
---|
| 625 | _QFlt.SymSubMatrix(1,3) = QFltOld.SymSubMatrix(1,3) + Qxyz;
|
---|
| 626 | }
|
---|
| 627 | }
|
---|
| 628 | }
|
---|
[8912] | 629 |
|
---|
[9526] | 630 | //
|
---|
| 631 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 632 | void t_pppFilter::setStateVectorAndVarCovMatrix(const ColumnVector& xFltOld,
|
---|
| 633 | const SymmetricMatrix& QFltOld) {
|
---|
| 634 |
|
---|
| 635 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
| 636 | unsigned nPar = params.size();
|
---|
| 637 |
|
---|
| 638 | _QFlt.ReSize(nPar); _QFlt = 0.0;
|
---|
| 639 | _xFlt.ReSize(nPar); _xFlt = 0.0;
|
---|
| 640 | _x0.ReSize(nPar); _x0 = 0.0;
|
---|
| 641 |
|
---|
| 642 | for (unsigned ii = 0; ii < nPar; ii++) {
|
---|
| 643 | t_pppParam* par1 = params[ii];
|
---|
| 644 | if (QFltOld.size() == 0) {
|
---|
| 645 | par1->resetIndex();
|
---|
| 646 | }
|
---|
| 647 | _x0[ii] = par1->x0();
|
---|
| 648 | int iOld = par1->indexOld();
|
---|
| 649 | if (iOld < 0) {
|
---|
| 650 | _QFlt[ii][ii] = par1->sigma0() * par1->sigma0(); // new parameter
|
---|
| 651 | }
|
---|
| 652 | else {
|
---|
| 653 | _QFlt[ii][ii] = QFltOld[iOld][iOld] + par1->noise() * par1->noise();
|
---|
| 654 | _xFlt[ii] = xFltOld[iOld];
|
---|
| 655 | for (unsigned jj = 0; jj < ii; jj++) {
|
---|
| 656 | t_pppParam* par2 = params[jj];
|
---|
| 657 | int jOld = par2->indexOld();
|
---|
| 658 | if (jOld >= 0) {
|
---|
| 659 | _QFlt[ii][jj] = QFltOld(iOld+1,jOld+1);
|
---|
| 660 | }
|
---|
| 661 | }
|
---|
| 662 | }
|
---|
| 663 | }
|
---|
| 664 | predictCovCrdPart(QFltOld);
|
---|
| 665 | }
|
---|
| 666 |
|
---|
[8915] | 667 | // Compute datum transformation
|
---|
[8912] | 668 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9508] | 669 | t_irc t_pppFilter::datumTransformation(const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
| 670 |
|
---|
[9419] | 671 | // get last epoch
|
---|
[9386] | 672 | t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch();
|
---|
[9419] | 673 | if (!epoch) {
|
---|
[9508] | 674 | LOG << "t_pppFilter::datumTransformation: !lastEpoch" << endl;
|
---|
[9386] | 675 | return failure;
|
---|
| 676 | }
|
---|
[9508] | 677 | _epoTime = epoch->epoTime();
|
---|
| 678 | LOG.setf(ios::fixed);
|
---|
| 679 | LOG << string(_epoTime) << " DATUM TRANSFORMATION " << endl;
|
---|
[9419] | 680 |
|
---|
[9386] | 681 | vector<t_pppSatObs*>& allObs = epoch->obsVector();
|
---|
| 682 |
|
---|
[9508] | 683 | const QMap<char, t_pppRefSat*>& refSatMapLastEpoch = epoch->refSatMap();
|
---|
| 684 |
|
---|
| 685 | bool peseudoObsIono = epoch->pseudoObsIono();
|
---|
| 686 |
|
---|
[9419] | 687 | // reset old and set new refSats in last epoch (ambiguities/GIM)
|
---|
| 688 | // =============================================================
|
---|
[9508] | 689 | if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) != true) {
|
---|
[9527] | 690 | LOG << "datumTransformation: refsatChange required" << endl;
|
---|
[9431] | 691 | return success;
|
---|
[9386] | 692 | }
|
---|
| 693 |
|
---|
[9419] | 694 | if (OPT->_obsModelType == OPT->UncombPPP) {
|
---|
[9545] | 695 | _obsPool->putEpoch(_epoTime, allObs, peseudoObsIono, refSatMap);
|
---|
[9419] | 696 | return success;
|
---|
| 697 | }
|
---|
[9537] | 698 | //LOG << "datumTransformation: printParams before set" << endl;
|
---|
| 699 | //_parlist.printParams(_epoTime);
|
---|
[9419] | 700 |
|
---|
[9386] | 701 | // set AA2
|
---|
| 702 | // =======
|
---|
[9508] | 703 | if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
|
---|
[9419] | 704 | return failure;
|
---|
| 705 | }
|
---|
[9526] | 706 |
|
---|
[9386] | 707 | #ifdef BNC_DEBUG_PPP
|
---|
[9534] | 708 | _parlist.printParams(_epoTime);
|
---|
[9386] | 709 | #endif
|
---|
[9526] | 710 |
|
---|
[9504] | 711 | const QList<char>& usedSystems = _parlist.usedSystems();
|
---|
[9431] | 712 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 713 | char sys = usedSystems[iSys];
|
---|
[9508] | 714 | t_prn refPrn = refSatMap[sys]->prn();
|
---|
[9386] | 715 | vector<t_pppSatObs*> obsVector;
|
---|
| 716 | for (unsigned jj = 0; jj < allObs.size(); jj++) {
|
---|
| 717 | if (allObs[jj]->prn().system() == sys) {
|
---|
| 718 | obsVector.push_back(allObs[jj]);
|
---|
| 719 | }
|
---|
| 720 | }
|
---|
[9431] | 721 | if (iSys == 0) {
|
---|
| 722 | _datumTrafo->setFirstSystem(sys);
|
---|
[9419] | 723 | }
|
---|
[9386] | 724 | vector<t_lc::type> LCs = OPT->LCs(sys);
|
---|
| 725 | unsigned usedLCs = LCs.size();
|
---|
[9508] | 726 | if (OPT->_pseudoObsIono && !peseudoObsIono) {
|
---|
[9386] | 727 | usedLCs -= 1; // GIM not used
|
---|
| 728 | }
|
---|
| 729 | // max Obs
|
---|
[9538] | 730 | unsigned maxObs = obsVector.size() * usedLCs;
|
---|
[9419] | 731 |
|
---|
[9508] | 732 | if (OPT->_pseudoObsIono && peseudoObsIono) {
|
---|
[9386] | 733 | maxObs -= 1; // pseudo obs iono with respect to refSat
|
---|
| 734 | }
|
---|
[9526] | 735 |
|
---|
| 736 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
| 737 | unsigned nPar = _parlist.nPar();
|
---|
| 738 |
|
---|
[9419] | 739 | Matrix AA(maxObs, nPar);
|
---|
[9524] | 740 |
|
---|
[9386] | 741 | // Real Observations
|
---|
| 742 | // -----------------
|
---|
| 743 | int iObs = -1;
|
---|
| 744 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
| 745 | t_pppSatObs* obs = obsVector[ii];
|
---|
[9419] | 746 | for (unsigned jj = 0; jj < usedLCs; jj++) {
|
---|
| 747 | const t_lc::type tLC = LCs[jj];
|
---|
| 748 | if (tLC == t_lc::GIM) {continue;}
|
---|
| 749 | if (tLC == t_lc::Tz0) {continue;}
|
---|
| 750 | ++iObs;
|
---|
[9524] | 751 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
| 752 | const t_pppParam* par = params[iPar];
|
---|
[9419] | 753 | AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
[9386] | 754 | }
|
---|
| 755 | }
|
---|
| 756 | }
|
---|
[9538] | 757 |
|
---|
[9419] | 758 | if (!iObs) {
|
---|
| 759 | continue;
|
---|
| 760 | }
|
---|
[9508] | 761 | _datumTrafo->updateIndices(sys, iObs+1); //LOG << "AA Ncols/Nrows: " << AA.Ncols() << "/" << AA.Nrows() << " nPar: " << nPar << endl; //LOG << "AA.SubMatrix(1 .. " << iObs+1 << " , 1 .. " << nPar << ")" << endl;
|
---|
| 762 | if(_datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, nPar), 2) != success) {
|
---|
| 763 | return failure;
|
---|
| 764 | }
|
---|
[9386] | 765 | }
|
---|
[9419] | 766 | _datumTrafo->updateNumObs();
|
---|
[9386] | 767 |
|
---|
| 768 | // Datum Transformation
|
---|
| 769 | // ====================
|
---|
| 770 | #ifdef BNC_DEBUG_PPP
|
---|
[9537] | 771 | //LOG << "AA1\n"; _datumTrafo->printMatrix(_datumTrafo->AA1(), _datumTrafo->numObs(), _datumTrafo->numPar());
|
---|
| 772 | //LOG << "AA2\n"; _datumTrafo->printMatrix(_datumTrafo->AA2(), _datumTrafo->numObs(), _datumTrafo->numPar());
|
---|
[9386] | 773 | #endif
|
---|
[9419] | 774 | if(_datumTrafo->computeTrafoMatrix() != success) {
|
---|
| 775 | return failure;
|
---|
| 776 | }
|
---|
[9386] | 777 | #ifdef BNC_DEBUG_PPP
|
---|
[9419] | 778 | //LOG << "D21" << endl; _datumTrafo->printMatrix(_datumTrafo->D21(), _datumTrafo->numObs(), _datumTrafo->numPar());
|
---|
[9386] | 779 | #endif
|
---|
| 780 | ColumnVector xFltOld = _xFlt;
|
---|
| 781 | SymmetricMatrix QFltOld = _QFlt;
|
---|
| 782 |
|
---|
[9419] | 783 | _QFlt << _datumTrafo->D21() * QFltOld * _datumTrafo->D21().t();
|
---|
| 784 | _xFlt = _datumTrafo->D21() * xFltOld;
|
---|
[9386] | 785 |
|
---|
| 786 | #ifdef BNC_DEBUG_PPP
|
---|
[9527] | 787 | //LOG << "xFltOld:\n" << xFltOld << endl;
|
---|
| 788 | //LOG << "xFlt :\n" << _xFlt << endl;
|
---|
[9386] | 789 | #endif
|
---|
| 790 |
|
---|
| 791 | // Reset Ambiguities after Datum Transformation
|
---|
| 792 | // ============================================
|
---|
[9431] | 793 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 794 | char sys = usedSystems[iSys];
|
---|
[9508] | 795 | t_prn refPrnOld = refSatMapLastEpoch[sys]->prn();
|
---|
| 796 | t_prn refPrnNew = refSatMap[sys]->prn();
|
---|
[9419] | 797 | if (refPrnNew != refPrnOld) {
|
---|
[9508] | 798 | t_irc irc = resetAmb(refPrnOld, allObs);
|
---|
[9419] | 799 | if (OPT->_obsModelType == OPT->DCMcodeBias) {
|
---|
| 800 | if (irc == success) {
|
---|
| 801 | addNoiseToIono(sys);
|
---|
| 802 | }
|
---|
| 803 | }
|
---|
[9386] | 804 | }
|
---|
| 805 | }
|
---|
| 806 |
|
---|
| 807 | // switch AA2 to AA1
|
---|
| 808 | // =================
|
---|
| 809 | _datumTrafo->switchAA();
|
---|
| 810 |
|
---|
[9508] | 811 | _obsPool->putEpoch(_epoTime, allObs, peseudoObsIono, refSatMap);
|
---|
| 812 |
|
---|
[9386] | 813 | return success;
|
---|
[8912] | 814 | }
|
---|
| 815 |
|
---|
[9386] | 816 | // Init datum transformation
|
---|
[8956] | 817 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9419] | 818 | void t_pppFilter::initDatumTransformation(const std::vector<t_pppSatObs*>& allObs,
|
---|
| 819 | bool pseudoObsIono) {
|
---|
[9395] | 820 | unsigned trafoObs = 0;
|
---|
[9504] | 821 | const QList<char>& usedSystems = _parlist. usedSystems();
|
---|
[9431] | 822 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 823 | char sys = usedSystems[iSys];
|
---|
[9386] | 824 | int satNum = 0;
|
---|
| 825 | for (unsigned jj = 0; jj < allObs.size(); jj++) {
|
---|
[9419] | 826 | if (allObs[jj]->prn().system() == sys) {
|
---|
[9386] | 827 | satNum++;
|
---|
[8956] | 828 | }
|
---|
| 829 | }
|
---|
[9386] | 830 | // all LCs
|
---|
[9419] | 831 | unsigned realUsedLCs = OPT->LCs(sys).size();
|
---|
[9386] | 832 | // exclude pseudo obs GIM
|
---|
[9419] | 833 | if (OPT->_pseudoObsIono && !pseudoObsIono) {
|
---|
[9386] | 834 | realUsedLCs -= 1;
|
---|
| 835 | }
|
---|
[9538] | 836 |
|
---|
[9395] | 837 | trafoObs += satNum * realUsedLCs;
|
---|
| 838 |
|
---|
[9419] | 839 | if (OPT->_pseudoObsIono && pseudoObsIono) {
|
---|
| 840 | trafoObs -= 1; // pseudo obs iono with respect to refSat
|
---|
| 841 | }
|
---|
[8956] | 842 | }
|
---|
[9419] | 843 | _datumTrafo->setNumObs(trafoObs);
|
---|
[9504] | 844 | _datumTrafo->setNumPar(_parlist.nPar());
|
---|
[9386] | 845 | _datumTrafo->initAA();
|
---|
[8956] | 846 | }
|
---|
[9386] | 847 |
|
---|
| 848 | //
|
---|
| 849 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9508] | 850 | bool t_pppFilter::resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector,
|
---|
| 851 | const QMap<char, t_pppRefSat*>& refSatMap,
|
---|
| 852 | const QMap<char, t_pppRefSat*>& refSatMapLastEpoch) {
|
---|
[9431] | 853 | bool resetRefSat;
|
---|
[9386] | 854 | // reference satellite definition per system
|
---|
[9504] | 855 | const QList<char>& usedSystems = _parlist.usedSystems();
|
---|
[9431] | 856 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 857 | resetRefSat = false;
|
---|
| 858 | char sys = usedSystems[iSys];
|
---|
[9508] | 859 | t_prn newPrn = refSatMap[sys]->prn();
|
---|
| 860 | t_prn oldPrn = refSatMapLastEpoch[sys]->prn();
|
---|
[9386] | 861 | #ifdef BNC_DEBUG_PPP
|
---|
[9508] | 862 | if (oldPrn != newPrn) {
|
---|
| 863 | LOG << "oldRef: " << oldPrn.toString() << " => newRef " << newPrn.toString() << endl;
|
---|
| 864 | }
|
---|
[9386] | 865 | #endif
|
---|
| 866 | vector<t_pppSatObs*>::iterator it = obsVector.begin();
|
---|
| 867 | while (it != obsVector.end()) {
|
---|
| 868 | t_pppSatObs* satObs = *it;
|
---|
| 869 | if (satObs->prn() == newPrn) {
|
---|
| 870 | resetRefSat = true;
|
---|
| 871 | satObs->setAsReference();
|
---|
[9508] | 872 | } else if (satObs->prn() == oldPrn) {
|
---|
[9386] | 873 | satObs->resetReference();
|
---|
| 874 | }
|
---|
| 875 | it++;
|
---|
| 876 | }
|
---|
[9431] | 877 | if (!resetRefSat) {
|
---|
| 878 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
| 879 | return resetRefSat;
|
---|
| 880 | }
|
---|
[9386] | 881 | }
|
---|
| 882 | return resetRefSat;
|
---|
| 883 | }
|
---|