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