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