[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;}
|
---|
[7237] | 251 | ++iObs;
|
---|
| 252 | usedObs.push_back(obs);
|
---|
| 253 | usedTypes.push_back(tLC);
|
---|
[9524] | 254 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[7237] | 255 | const t_pppParam* par = params[iPar];
|
---|
[8956] | 256 | AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
[7237] | 257 | }
|
---|
| 258 | ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1));
|
---|
| 259 | PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
|
---|
| 260 | }
|
---|
| 261 | }
|
---|
| 262 | }
|
---|
| 263 |
|
---|
[9556] | 264 | // Check number of observations
|
---|
| 265 | // ----------------------------
|
---|
| 266 | if (iObs == -1) {LOG << "iObs == -1\n";
|
---|
| 267 | return failure;
|
---|
| 268 | }
|
---|
| 269 |
|
---|
[9386] | 270 | if ((!iOutlier) &&
|
---|
| 271 | (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
[9419] | 272 | OPT->_obsModelType == OPT->DCMphaseBias) &&
|
---|
| 273 | (!preProcessing)) {
|
---|
| 274 | _datumTrafo->updateIndices(sys, iObs+1);
|
---|
[9504] | 275 | _datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, _parlist.nPar()), 1);
|
---|
[9386] | 276 | }
|
---|
| 277 |
|
---|
| 278 | // Pseudo Obs Iono
|
---|
| 279 | // ================
|
---|
| 280 | if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) {
|
---|
| 281 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
| 282 | t_pppSatObs* obs = obsVector[ii];
|
---|
| 283 | if (!obs->outlier()) {
|
---|
| 284 | for (unsigned jj = 0; jj < usedLCs; jj++) {
|
---|
| 285 | const t_lc::type tLC = LCs[jj];
|
---|
| 286 | if (tLC == t_lc::GIM && !obs->isReference()) {
|
---|
| 287 | ++iObs;
|
---|
| 288 | } else {continue;}
|
---|
| 289 | usedObs.push_back(obs);
|
---|
| 290 | usedTypes.push_back(tLC);
|
---|
[9524] | 291 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[9386] | 292 | const t_pppParam* par = params[iPar];
|
---|
| 293 | AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
| 294 | }
|
---|
| 295 | ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs+1));
|
---|
| 296 | PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
|
---|
| 297 | }
|
---|
| 298 | }
|
---|
[8956] | 299 | }
|
---|
[8915] | 300 | }
|
---|
| 301 |
|
---|
[9556] | 302 | // Truncate matrices
|
---|
| 303 | // -----------------
|
---|
[7237] | 304 | AA = AA.Rows(1, iObs+1);
|
---|
| 305 | ll = ll.Rows(1, iObs+1);
|
---|
| 306 | PP = PP.SymSubMatrix(1, iObs+1);
|
---|
| 307 |
|
---|
| 308 | // Kalman update step
|
---|
| 309 | // ------------------
|
---|
| 310 | kalman(AA, ll, PP, _QFlt, _xFlt);
|
---|
| 311 |
|
---|
| 312 | // Check Residuals
|
---|
| 313 | // ---------------
|
---|
| 314 | ColumnVector vv = AA * _xFlt - ll;
|
---|
| 315 | double maxOutlier = 0.0;
|
---|
| 316 | int maxOutlierIndex = -1;
|
---|
| 317 | t_lc::type maxOutlierLC = t_lc::dummy;
|
---|
| 318 | for (unsigned ii = 0; ii < usedObs.size(); ii++) {
|
---|
| 319 | const t_lc::type tLC = usedTypes[ii];
|
---|
| 320 | double res = fabs(vv[ii]);
|
---|
| 321 | if (res > usedObs[ii]->maxRes(tLC)) {
|
---|
| 322 | if (res > fabs(maxOutlier)) {
|
---|
| 323 | maxOutlier = vv[ii];
|
---|
| 324 | maxOutlierIndex = ii;
|
---|
| 325 | maxOutlierLC = tLC;
|
---|
| 326 | }
|
---|
| 327 | }
|
---|
| 328 | }
|
---|
| 329 |
|
---|
| 330 | // Mark outlier or break outlier detection loop
|
---|
| 331 | // --------------------------------------------
|
---|
| 332 | if (maxOutlierIndex > -1) {
|
---|
| 333 | t_pppSatObs* obs = usedObs[maxOutlierIndex];
|
---|
| 334 | t_pppParam* par = 0;
|
---|
[9524] | 335 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[7237] | 336 | t_pppParam* hlp = params[iPar];
|
---|
[8905] | 337 | if (hlp->type() == t_pppParam::amb &&
|
---|
| 338 | hlp->prn() == obs->prn() &&
|
---|
[7237] | 339 | hlp->tLC() == usedTypes[maxOutlierIndex]) {
|
---|
| 340 | par = hlp;
|
---|
| 341 | }
|
---|
| 342 | }
|
---|
[8956] | 343 | if (preProcessing) {
|
---|
[9491] | 344 | // for refSats no ambiguity parameter exists
|
---|
[9386] | 345 | if ((obs->prn() == refPrn) &&
|
---|
[9582] | 346 | (t_lc::toString(maxOutlierLC) == "l1" ||
|
---|
| 347 | t_lc::toString(maxOutlierLC) == "l2" )) {
|
---|
[9386] | 348 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
[9556] | 349 | LOG << epoTimeStr << " Outlier ("
|
---|
| 350 | << ((preProcessing) ? "pre-processing) " : "fin-processing) ") << t_lc::toString(maxOutlierLC) << ' '
|
---|
| 351 | << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << maxOutlier << endl;
|
---|
[9491] | 352 | break;
|
---|
[9386] | 353 | }
|
---|
| 354 | else {
|
---|
[9582] | 355 | obs->setOutlier();
|
---|
[8905] | 356 | }
|
---|
| 357 | }
|
---|
[9386] | 358 | else {// fin-processing
|
---|
[9556] | 359 | LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '
|
---|
| 360 | << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << maxOutlier << endl;
|
---|
[8956] | 361 | if (par) {
|
---|
[9582] | 362 | resetAmb(par->prn(), obsVector, &QSav, &xSav);
|
---|
[7237] | 363 | }
|
---|
| 364 | else {
|
---|
| 365 | obs->setOutlier();
|
---|
| 366 | }
|
---|
| 367 | }
|
---|
| 368 | }
|
---|
| 369 | // Print Residuals
|
---|
| 370 | // ---------------
|
---|
| 371 | else {
|
---|
[8905] | 372 | if (!preProcessing) {
|
---|
| 373 | for (unsigned jj = 0; jj < LCs.size(); jj++) {
|
---|
| 374 | for (unsigned ii = 0; ii < usedObs.size(); ii++) {
|
---|
| 375 | const t_lc::type tLC = usedTypes[ii];
|
---|
[9386] | 376 | t_pppSatObs* obs = usedObs[ii];
|
---|
[8905] | 377 | if (tLC == LCs[jj]) {
|
---|
| 378 | obs->setRes(tLC, vv[ii]);
|
---|
| 379 | LOG << epoTimeStr << " RES "
|
---|
[9386] | 380 | << left << setw(3) << t_lc::toString(tLC) << right << ' ';
|
---|
| 381 | if (t_lc::toString(tLC) == "Tz0") {LOG << sys << " ";}
|
---|
| 382 | else {LOG << obs->prn().toString();}
|
---|
[9435] | 383 | LOG << setw(9) << setprecision(4) << vv[ii] << endl;
|
---|
[8905] | 384 | }
|
---|
[7237] | 385 | }
|
---|
| 386 | }
|
---|
| 387 | }
|
---|
| 388 | break;
|
---|
| 389 | }
|
---|
| 390 | }
|
---|
| 391 | return success;
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | // Cycle-Slip Detection
|
---|
| 395 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7267] | 396 | t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type>& LCs,
|
---|
[8905] | 397 | const vector<t_pppSatObs*>& obsVector,
|
---|
| 398 | const t_prn& refPrn,
|
---|
| 399 | bool preProcessing) {
|
---|
[9386] | 400 | const double SLIP = 20.0;
|
---|
| 401 | char sys = refPrn.system();
|
---|
| 402 | string epoTimeStr = string(_epoTime);
|
---|
[9504] | 403 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
[9524] | 404 | unsigned nPar = _parlist.nPar();
|
---|
[7237] | 405 |
|
---|
| 406 | for (unsigned ii = 0; ii < LCs.size(); ii++) {
|
---|
| 407 | const t_lc::type& tLC = LCs[ii];
|
---|
| 408 | if (t_lc::includesPhase(tLC)) {
|
---|
| 409 | for (unsigned iObs = 0; iObs < obsVector.size(); iObs++) {
|
---|
| 410 | const t_pppSatObs* obs = obsVector[iObs];
|
---|
| 411 |
|
---|
[7267] | 412 | // Check set Slips and Jump Counters
|
---|
[7237] | 413 | // ---------------------------------
|
---|
| 414 | bool slip = false;
|
---|
[9386] | 415 |
|
---|
| 416 | // in pre-processing only the reference satellite has to be checked
|
---|
| 417 | if (preProcessing && obs->prn() != refPrn) {
|
---|
| 418 | continue;
|
---|
| 419 | }
|
---|
| 420 |
|
---|
[7237] | 421 | if (obs->slip()) {
|
---|
[8329] | 422 | LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() << endl;
|
---|
[7237] | 423 | slip = true;
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | if (_slips[obs->prn()]._obsSlipCounter != -1 &&
|
---|
[9088] | 427 | _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) {
|
---|
[8329] | 428 | LOG << epoTimeStr << "cycle slip set (obsSlipCounter) " << obs->prn().toString() << endl;
|
---|
[7237] | 429 | slip = true;
|
---|
| 430 | }
|
---|
[8956] | 431 | if (!preProcessing) {
|
---|
| 432 | _slips[obs->prn()]._obsSlipCounter = obs->slipCounter();
|
---|
| 433 | }
|
---|
[7237] | 434 | if (_slips[obs->prn()]._biasJumpCounter != -1 &&
|
---|
| 435 | _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) {
|
---|
[8329] | 436 | LOG << epoTimeStr << "cycle slip set (biasJumpCounter) " << obs->prn().toString() << endl;
|
---|
[7237] | 437 | slip = true;
|
---|
| 438 | }
|
---|
[8956] | 439 | if (!preProcessing) {
|
---|
| 440 | _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();
|
---|
| 441 | }
|
---|
[7237] | 442 | // Slip Set
|
---|
[7267] | 443 | // --------
|
---|
[7237] | 444 | if (slip) {
|
---|
[8905] | 445 | if (preProcessing) {
|
---|
[9386] | 446 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
[8905] | 447 | }
|
---|
| 448 | else {
|
---|
| 449 | resetAmb(obs->prn(), obsVector);
|
---|
| 450 | }
|
---|
[7237] | 451 | }
|
---|
| 452 | // Check Pre-Fit Residuals
|
---|
| 453 | // -----------------------
|
---|
| 454 | else {
|
---|
[9419] | 455 | if (refPrn != t_prn()) {return success;}
|
---|
[9524] | 456 | ColumnVector AA(nPar);
|
---|
| 457 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
[7237] | 458 | const t_pppParam* par = params[iPar];
|
---|
[8956] | 459 | AA[iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
[7237] | 460 | }
|
---|
| 461 | double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA);
|
---|
| 462 | double vv = DotProduct(AA, _xFlt) - ll;
|
---|
| 463 | if (fabs(vv) > SLIP) {
|
---|
[9386] | 464 | LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' '
|
---|
| 465 | << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl;
|
---|
[8905] | 466 | if (preProcessing) {
|
---|
[9386] | 467 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
[8905] | 468 | }
|
---|
| 469 | else {
|
---|
| 470 | resetAmb(obs->prn(), obsVector);
|
---|
| 471 | }
|
---|
[7237] | 472 | }
|
---|
| 473 | }
|
---|
| 474 | }
|
---|
| 475 | }
|
---|
| 476 | }
|
---|
| 477 | return success;
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 | // Reset Ambiguity Parameter (cycle slip)
|
---|
| 481 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 482 | t_irc t_pppFilter::resetAmb(t_prn prn, const vector<t_pppSatObs*>& obsVector,
|
---|
| 483 | SymmetricMatrix* QSav, ColumnVector* xSav) {
|
---|
[8965] | 484 |
|
---|
[7237] | 485 | t_irc irc = failure;
|
---|
[9504] | 486 | vector<t_pppParam*>& params = _parlist.params();
|
---|
[7237] | 487 | for (unsigned iPar = 0; iPar < params.size(); iPar++) {
|
---|
| 488 | t_pppParam* par = params[iPar];
|
---|
| 489 | if (par->type() == t_pppParam::amb && par->prn() == prn) {
|
---|
| 490 | int ind = par->indexNew();
|
---|
| 491 | t_lc::type tLC = par->tLC();
|
---|
| 492 | LOG << string(_epoTime) << " RESET " << par->toString() << endl;
|
---|
| 493 | delete par; par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);
|
---|
| 494 | par->setIndex(ind);
|
---|
| 495 | params[iPar] = par;
|
---|
| 496 | for (unsigned ii = 1; ii <= params.size(); ii++) {
|
---|
| 497 | _QFlt(ii, ind+1) = 0.0;
|
---|
| 498 | if (QSav) {
|
---|
| 499 | (*QSav)(ii, ind+1) = 0.0;
|
---|
| 500 | }
|
---|
| 501 | }
|
---|
| 502 | _QFlt(ind+1,ind+1) = par->sigma0() * par->sigma0();
|
---|
| 503 | if (QSav) {
|
---|
| 504 | (*QSav)(ind+1,ind+1) = _QFlt(ind+1,ind+1);
|
---|
| 505 | }
|
---|
| 506 | _xFlt[ind] = 0.0;
|
---|
| 507 | if (xSav) {
|
---|
| 508 | (*xSav)[ind] = _xFlt[ind];
|
---|
| 509 | }
|
---|
| 510 | _x0[ind] = par->x0();
|
---|
| 511 | irc = success;
|
---|
| 512 | }
|
---|
| 513 | }
|
---|
| 514 |
|
---|
| 515 | return irc;
|
---|
| 516 | }
|
---|
| 517 |
|
---|
[9395] | 518 | // Add infinite noise to iono
|
---|
[9386] | 519 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 520 | t_irc t_pppFilter::addNoiseToIono(char sys) {
|
---|
| 521 |
|
---|
| 522 | t_irc irc = failure;
|
---|
[9504] | 523 | vector<t_pppParam*>& params = _parlist.params();
|
---|
[9386] | 524 | for (unsigned iPar = 0; iPar < params.size(); iPar++) {
|
---|
| 525 | t_pppParam* par = params[iPar];
|
---|
| 526 | if (par->type() == t_pppParam::ion && par->prn().system() == sys) {
|
---|
| 527 | int ind = par->indexNew();
|
---|
| 528 | LOG << string(_epoTime) << " ADD IONO_NOISE TO " << par->prn().toString() << endl;
|
---|
| 529 | par->setIndex(ind);
|
---|
[9579] | 530 | _QFlt(ind+1,ind+1) = par->sigma0() * par->sigma0();
|
---|
[9386] | 531 | irc = success;
|
---|
| 532 | }
|
---|
| 533 | }
|
---|
| 534 |
|
---|
| 535 | return irc;
|
---|
| 536 | }
|
---|
| 537 |
|
---|
[7237] | 538 | // Compute various DOP Values
|
---|
| 539 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9521] | 540 | void t_pppFilter::cmpDOP(const vector<t_pppSatObs*>& obsVector,
|
---|
[9508] | 541 | const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
[7237] | 542 |
|
---|
| 543 | _dop.reset();
|
---|
| 544 |
|
---|
| 545 | try {
|
---|
| 546 | const unsigned numPar = 4;
|
---|
| 547 | Matrix AA(obsVector.size(), numPar);
|
---|
| 548 | _numSat = 0;
|
---|
| 549 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
| 550 | t_pppSatObs* obs = obsVector[ii];
|
---|
[9508] | 551 | char sys = obs->prn().system();
|
---|
[8956] | 552 | t_prn refPrn = t_prn();
|
---|
| 553 | if (OPT->_refSatRequired) {
|
---|
[9508] | 554 | refPrn = refSatMap[sys]->prn();
|
---|
[8956] | 555 | }
|
---|
[7237] | 556 | if (obs->isValid() && !obs->outlier()) {
|
---|
| 557 | ++_numSat;
|
---|
| 558 | for (unsigned iPar = 0; iPar < numPar; iPar++) {
|
---|
[9504] | 559 | const t_pppParam* par = _parlist.params()[iPar];
|
---|
[8956] | 560 | AA[_numSat-1][iPar] = par->partial(_epoTime, obs, t_lc::c1, refPrn);
|
---|
[7237] | 561 | }
|
---|
| 562 | }
|
---|
| 563 | }
|
---|
| 564 | if (_numSat < 4) {
|
---|
| 565 | return;
|
---|
| 566 | }
|
---|
| 567 | AA = AA.Rows(1, _numSat);
|
---|
[7267] | 568 | SymmetricMatrix NN; NN << AA.t() * AA;
|
---|
[7237] | 569 | SymmetricMatrix QQ = NN.i();
|
---|
[7267] | 570 |
|
---|
[7928] | 571 | _dop.H = sqrt(QQ(1,1) + QQ(2,2));
|
---|
| 572 | _dop.V = sqrt(QQ(3,3));
|
---|
[7237] | 573 | _dop.P = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3));
|
---|
| 574 | _dop.T = sqrt(QQ(4,4));
|
---|
| 575 | _dop.G = sqrt(QQ(1,1) + QQ(2,2) + QQ(3,3) + QQ(4,4));
|
---|
| 576 | }
|
---|
| 577 | catch (...) {
|
---|
| 578 | }
|
---|
| 579 | }
|
---|
| 580 |
|
---|
[9526] | 581 | //
|
---|
[7237] | 582 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 583 | void t_pppFilter::predictCovCrdPart(const SymmetricMatrix& QFltOld) {
|
---|
| 584 |
|
---|
[9504] | 585 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
[7237] | 586 | if (params.size() < 3) {
|
---|
| 587 | return;
|
---|
| 588 | }
|
---|
| 589 |
|
---|
| 590 | bool first = (params[0]->indexOld() < 0);
|
---|
| 591 |
|
---|
| 592 | SymmetricMatrix Qneu(3); Qneu = 0.0;
|
---|
| 593 | for (unsigned ii = 0; ii < 3; ii++) {
|
---|
| 594 | const t_pppParam* par = params[ii];
|
---|
| 595 | if (first) {
|
---|
| 596 | Qneu[ii][ii] = par->sigma0() * par->sigma0();
|
---|
| 597 | }
|
---|
| 598 | else {
|
---|
| 599 | Qneu[ii][ii] = par->noise() * par->noise();
|
---|
| 600 | }
|
---|
| 601 | }
|
---|
| 602 |
|
---|
| 603 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
| 604 | SymmetricMatrix Qxyz(3);
|
---|
| 605 | covariNEU_XYZ(Qneu, sta->ellApr().data(), Qxyz);
|
---|
| 606 |
|
---|
| 607 | if (first) {
|
---|
| 608 | _QFlt.SymSubMatrix(1,3) = Qxyz;
|
---|
| 609 | }
|
---|
| 610 | else {
|
---|
| 611 | double dt = _epoTime - _firstEpoTime;
|
---|
| 612 | if (dt < OPT->_seedingTime) {
|
---|
| 613 | _QFlt.SymSubMatrix(1,3) = QFltOld.SymSubMatrix(1,3);
|
---|
| 614 | }
|
---|
| 615 | else {
|
---|
| 616 | _QFlt.SymSubMatrix(1,3) = QFltOld.SymSubMatrix(1,3) + Qxyz;
|
---|
| 617 | }
|
---|
| 618 | }
|
---|
| 619 | }
|
---|
[8912] | 620 |
|
---|
[9526] | 621 | //
|
---|
| 622 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 623 | void t_pppFilter::setStateVectorAndVarCovMatrix(const ColumnVector& xFltOld,
|
---|
| 624 | const SymmetricMatrix& QFltOld) {
|
---|
| 625 |
|
---|
| 626 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
| 627 | unsigned nPar = params.size();
|
---|
| 628 |
|
---|
| 629 | _QFlt.ReSize(nPar); _QFlt = 0.0;
|
---|
| 630 | _xFlt.ReSize(nPar); _xFlt = 0.0;
|
---|
| 631 | _x0.ReSize(nPar); _x0 = 0.0;
|
---|
| 632 |
|
---|
| 633 | for (unsigned ii = 0; ii < nPar; ii++) {
|
---|
| 634 | t_pppParam* par1 = params[ii];
|
---|
| 635 | if (QFltOld.size() == 0) {
|
---|
| 636 | par1->resetIndex();
|
---|
| 637 | }
|
---|
| 638 | _x0[ii] = par1->x0();
|
---|
| 639 | int iOld = par1->indexOld();
|
---|
| 640 | if (iOld < 0) {
|
---|
| 641 | _QFlt[ii][ii] = par1->sigma0() * par1->sigma0(); // new parameter
|
---|
| 642 | }
|
---|
| 643 | else {
|
---|
| 644 | _QFlt[ii][ii] = QFltOld[iOld][iOld] + par1->noise() * par1->noise();
|
---|
| 645 | _xFlt[ii] = xFltOld[iOld];
|
---|
| 646 | for (unsigned jj = 0; jj < ii; jj++) {
|
---|
| 647 | t_pppParam* par2 = params[jj];
|
---|
| 648 | int jOld = par2->indexOld();
|
---|
| 649 | if (jOld >= 0) {
|
---|
| 650 | _QFlt[ii][jj] = QFltOld(iOld+1,jOld+1);
|
---|
| 651 | }
|
---|
| 652 | }
|
---|
| 653 | }
|
---|
| 654 | }
|
---|
| 655 | predictCovCrdPart(QFltOld);
|
---|
| 656 | }
|
---|
| 657 |
|
---|
[8915] | 658 | // Compute datum transformation
|
---|
[8912] | 659 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9508] | 660 | t_irc t_pppFilter::datumTransformation(const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
| 661 |
|
---|
[9419] | 662 | // get last epoch
|
---|
[9386] | 663 | t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch();
|
---|
[9419] | 664 | if (!epoch) {
|
---|
[9508] | 665 | LOG << "t_pppFilter::datumTransformation: !lastEpoch" << endl;
|
---|
[9386] | 666 | return failure;
|
---|
| 667 | }
|
---|
[9508] | 668 | _epoTime = epoch->epoTime();
|
---|
| 669 | LOG.setf(ios::fixed);
|
---|
| 670 | LOG << string(_epoTime) << " DATUM TRANSFORMATION " << endl;
|
---|
[9419] | 671 |
|
---|
[9386] | 672 | vector<t_pppSatObs*>& allObs = epoch->obsVector();
|
---|
| 673 |
|
---|
[9508] | 674 | const QMap<char, t_pppRefSat*>& refSatMapLastEpoch = epoch->refSatMap();
|
---|
| 675 |
|
---|
[9548] | 676 | bool pseudoObsIono = epoch->pseudoObsIono();
|
---|
[9508] | 677 |
|
---|
[9419] | 678 | // reset old and set new refSats in last epoch (ambiguities/GIM)
|
---|
| 679 | // =============================================================
|
---|
[9508] | 680 | if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) != true) {
|
---|
[9548] | 681 | LOG << "datumTransformation: resetRefSatellitesLastEpoch != success" << endl;
|
---|
| 682 | return failure;
|
---|
[9386] | 683 | }
|
---|
| 684 |
|
---|
[9419] | 685 | if (OPT->_obsModelType == OPT->UncombPPP) {
|
---|
[9548] | 686 | _obsPool->putEpoch(_epoTime, allObs, pseudoObsIono, refSatMap);
|
---|
[9419] | 687 | return success;
|
---|
| 688 | }
|
---|
[9537] | 689 | //LOG << "datumTransformation: printParams before set" << endl;
|
---|
| 690 | //_parlist.printParams(_epoTime);
|
---|
[9419] | 691 |
|
---|
[9386] | 692 | // set AA2
|
---|
| 693 | // =======
|
---|
[9508] | 694 | if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
|
---|
[9419] | 695 | return failure;
|
---|
| 696 | }
|
---|
[9526] | 697 |
|
---|
[9386] | 698 | #ifdef BNC_DEBUG_PPP
|
---|
[9534] | 699 | _parlist.printParams(_epoTime);
|
---|
[9386] | 700 | #endif
|
---|
[9526] | 701 |
|
---|
[9504] | 702 | const QList<char>& usedSystems = _parlist.usedSystems();
|
---|
[9431] | 703 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 704 | char sys = usedSystems[iSys];
|
---|
[9508] | 705 | t_prn refPrn = refSatMap[sys]->prn();
|
---|
[9386] | 706 | vector<t_pppSatObs*> obsVector;
|
---|
| 707 | for (unsigned jj = 0; jj < allObs.size(); jj++) {
|
---|
| 708 | if (allObs[jj]->prn().system() == sys) {
|
---|
| 709 | obsVector.push_back(allObs[jj]);
|
---|
| 710 | }
|
---|
| 711 | }
|
---|
[9431] | 712 | if (iSys == 0) {
|
---|
| 713 | _datumTrafo->setFirstSystem(sys);
|
---|
[9419] | 714 | }
|
---|
[9386] | 715 | vector<t_lc::type> LCs = OPT->LCs(sys);
|
---|
| 716 | unsigned usedLCs = LCs.size();
|
---|
[9548] | 717 | if (OPT->_pseudoObsIono && !pseudoObsIono) {
|
---|
[9386] | 718 | usedLCs -= 1; // GIM not used
|
---|
| 719 | }
|
---|
| 720 | // max Obs
|
---|
[9538] | 721 | unsigned maxObs = obsVector.size() * usedLCs;
|
---|
[9419] | 722 |
|
---|
[9548] | 723 | if (OPT->_pseudoObsIono && pseudoObsIono) {
|
---|
[9386] | 724 | maxObs -= 1; // pseudo obs iono with respect to refSat
|
---|
| 725 | }
|
---|
[9526] | 726 |
|
---|
| 727 | const vector<t_pppParam*>& params = _parlist.params();
|
---|
| 728 | unsigned nPar = _parlist.nPar();
|
---|
| 729 |
|
---|
[9419] | 730 | Matrix AA(maxObs, nPar);
|
---|
[9524] | 731 |
|
---|
[9386] | 732 | // Real Observations
|
---|
| 733 | // -----------------
|
---|
| 734 | int iObs = -1;
|
---|
| 735 | for (unsigned ii = 0; ii < obsVector.size(); ii++) {
|
---|
| 736 | t_pppSatObs* obs = obsVector[ii];
|
---|
[9419] | 737 | for (unsigned jj = 0; jj < usedLCs; jj++) {
|
---|
| 738 | const t_lc::type tLC = LCs[jj];
|
---|
| 739 | if (tLC == t_lc::GIM) {continue;}
|
---|
| 740 | ++iObs;
|
---|
[9524] | 741 | for (unsigned iPar = 0; iPar < nPar; iPar++) {
|
---|
| 742 | const t_pppParam* par = params[iPar];
|
---|
[9419] | 743 | AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
|
---|
[9386] | 744 | }
|
---|
| 745 | }
|
---|
| 746 | }
|
---|
[9538] | 747 |
|
---|
[9419] | 748 | if (!iObs) {
|
---|
| 749 | continue;
|
---|
| 750 | }
|
---|
[9508] | 751 | _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;
|
---|
| 752 | if(_datumTrafo->prepareAA(AA.SubMatrix(1, iObs+1 , 1, nPar), 2) != success) {
|
---|
| 753 | return failure;
|
---|
| 754 | }
|
---|
[9386] | 755 | }
|
---|
[9419] | 756 | _datumTrafo->updateNumObs();
|
---|
[9386] | 757 |
|
---|
| 758 | // Datum Transformation
|
---|
| 759 | // ====================
|
---|
| 760 | #ifdef BNC_DEBUG_PPP
|
---|
[9548] | 761 | //LOG << "AA1\n"; _datumTrafo->printMatrix(_datumTrafo->AA1(), _datumTrafo->numObs(), _datumTrafo->numPar());
|
---|
| 762 | //LOG << "AA2\n"; _datumTrafo->printMatrix(_datumTrafo->AA2(), _datumTrafo->numObs(), _datumTrafo->numPar());
|
---|
[9386] | 763 | #endif
|
---|
[9419] | 764 | if(_datumTrafo->computeTrafoMatrix() != success) {
|
---|
| 765 | return failure;
|
---|
| 766 | }
|
---|
[9386] | 767 | #ifdef BNC_DEBUG_PPP
|
---|
[9548] | 768 | //LOG << "D21" << endl; _datumTrafo->printMatrix(_datumTrafo->D21(), _datumTrafo->numObs(), _datumTrafo->numPar());
|
---|
[9386] | 769 | #endif
|
---|
| 770 | ColumnVector xFltOld = _xFlt;
|
---|
| 771 | SymmetricMatrix QFltOld = _QFlt;
|
---|
| 772 |
|
---|
[9419] | 773 | _QFlt << _datumTrafo->D21() * QFltOld * _datumTrafo->D21().t();
|
---|
| 774 | _xFlt = _datumTrafo->D21() * xFltOld;
|
---|
[9386] | 775 |
|
---|
[9579] | 776 | #ifdef BNC_DEBUG_PPP
|
---|
[9562] | 777 | LOG << "xFltOld:\n" << xFltOld << endl;
|
---|
| 778 | LOG << "xFlt :\n" << _xFlt << endl;
|
---|
[9579] | 779 | #endif
|
---|
[9386] | 780 |
|
---|
| 781 | // Reset Ambiguities after Datum Transformation
|
---|
| 782 | // ============================================
|
---|
[9431] | 783 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 784 | char sys = usedSystems[iSys];
|
---|
[9508] | 785 | t_prn refPrnOld = refSatMapLastEpoch[sys]->prn();
|
---|
| 786 | t_prn refPrnNew = refSatMap[sys]->prn();
|
---|
[9419] | 787 | if (refPrnNew != refPrnOld) {
|
---|
[9508] | 788 | t_irc irc = resetAmb(refPrnOld, allObs);
|
---|
[9582] | 789 | if (OPT->_obsModelType == OPT->DCMcodeBias) {
|
---|
| 790 | if (irc == success) {
|
---|
| 791 | addNoiseToIono(sys);
|
---|
| 792 | }
|
---|
| 793 | }
|
---|
[9386] | 794 | }
|
---|
| 795 | }
|
---|
| 796 |
|
---|
| 797 | // switch AA2 to AA1
|
---|
| 798 | // =================
|
---|
| 799 | _datumTrafo->switchAA();
|
---|
| 800 |
|
---|
[9548] | 801 | _obsPool->putEpoch(_epoTime, allObs, pseudoObsIono, refSatMap);
|
---|
[9508] | 802 |
|
---|
[9386] | 803 | return success;
|
---|
[8912] | 804 | }
|
---|
| 805 |
|
---|
[9386] | 806 | // Init datum transformation
|
---|
[8956] | 807 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9419] | 808 | void t_pppFilter::initDatumTransformation(const std::vector<t_pppSatObs*>& allObs,
|
---|
| 809 | bool pseudoObsIono) {
|
---|
[9395] | 810 | unsigned trafoObs = 0;
|
---|
[9504] | 811 | const QList<char>& usedSystems = _parlist. usedSystems();
|
---|
[9431] | 812 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 813 | char sys = usedSystems[iSys];
|
---|
[9386] | 814 | int satNum = 0;
|
---|
| 815 | for (unsigned jj = 0; jj < allObs.size(); jj++) {
|
---|
[9419] | 816 | if (allObs[jj]->prn().system() == sys) {
|
---|
[9386] | 817 | satNum++;
|
---|
[8956] | 818 | }
|
---|
| 819 | }
|
---|
[9386] | 820 | // all LCs
|
---|
[9419] | 821 | unsigned realUsedLCs = OPT->LCs(sys).size();
|
---|
[9386] | 822 | // exclude pseudo obs GIM
|
---|
[9419] | 823 | if (OPT->_pseudoObsIono && !pseudoObsIono) {
|
---|
[9386] | 824 | realUsedLCs -= 1;
|
---|
| 825 | }
|
---|
[9538] | 826 |
|
---|
[9395] | 827 | trafoObs += satNum * realUsedLCs;
|
---|
| 828 |
|
---|
[9419] | 829 | if (OPT->_pseudoObsIono && pseudoObsIono) {
|
---|
| 830 | trafoObs -= 1; // pseudo obs iono with respect to refSat
|
---|
| 831 | }
|
---|
[8956] | 832 | }
|
---|
[9419] | 833 | _datumTrafo->setNumObs(trafoObs);
|
---|
[9504] | 834 | _datumTrafo->setNumPar(_parlist.nPar());
|
---|
[9386] | 835 | _datumTrafo->initAA();
|
---|
[8956] | 836 | }
|
---|
[9386] | 837 |
|
---|
| 838 | //
|
---|
| 839 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9508] | 840 | bool t_pppFilter::resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector,
|
---|
| 841 | const QMap<char, t_pppRefSat*>& refSatMap,
|
---|
| 842 | const QMap<char, t_pppRefSat*>& refSatMapLastEpoch) {
|
---|
[9431] | 843 | bool resetRefSat;
|
---|
[9386] | 844 | // reference satellite definition per system
|
---|
[9504] | 845 | const QList<char>& usedSystems = _parlist.usedSystems();
|
---|
[9431] | 846 | for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
|
---|
| 847 | resetRefSat = false;
|
---|
| 848 | char sys = usedSystems[iSys];
|
---|
[9508] | 849 | t_prn newPrn = refSatMap[sys]->prn();
|
---|
| 850 | t_prn oldPrn = refSatMapLastEpoch[sys]->prn();
|
---|
[9386] | 851 | #ifdef BNC_DEBUG_PPP
|
---|
[9508] | 852 | if (oldPrn != newPrn) {
|
---|
| 853 | LOG << "oldRef: " << oldPrn.toString() << " => newRef " << newPrn.toString() << endl;
|
---|
| 854 | }
|
---|
[9386] | 855 | #endif
|
---|
| 856 | vector<t_pppSatObs*>::iterator it = obsVector.begin();
|
---|
| 857 | while (it != obsVector.end()) {
|
---|
| 858 | t_pppSatObs* satObs = *it;
|
---|
| 859 | if (satObs->prn() == newPrn) {
|
---|
| 860 | resetRefSat = true;
|
---|
| 861 | satObs->setAsReference();
|
---|
[9508] | 862 | } else if (satObs->prn() == oldPrn) {
|
---|
[9386] | 863 | satObs->resetReference();
|
---|
| 864 | }
|
---|
| 865 | it++;
|
---|
| 866 | }
|
---|
[9431] | 867 | if (!resetRefSat) {
|
---|
| 868 | _obsPool->setRefSatChangeRequired(sys, true);
|
---|
| 869 | return resetRefSat;
|
---|
| 870 | }
|
---|
[9386] | 871 | }
|
---|
| 872 | return resetRefSat;
|
---|
| 873 | }
|
---|