source: ntrip/branches/BNC_2.12/src/combination/bnccomb.cpp@ 9180

Last change on this file since 9180 was 9180, checked in by stuerze, 5 years ago

check if orbit and clock corrections are in defined ranges is added

File size: 35.3 KB
RevLine 
[2898]1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: bncComb
6 *
7 * Purpose: Combinations of Orbit/Clock Corrections
8 *
9 * Author: L. Mervart
10 *
11 * Created: 22-Jan-2011
12 *
[7297]13 * Changes:
[2898]14 *
15 * -----------------------------------------------------------------------*/
16
[2933]17#include <newmatio.h>
[2921]18#include <iomanip>
[3214]19#include <sstream>
[2898]20
21#include "bnccomb.h"
[5070]22#include "bnccore.h"
[3201]23#include "upload/bncrtnetdecoder.h"
[2910]24#include "bncsettings.h"
[2988]25#include "bncutils.h"
[3181]26#include "bncsp3.h"
[3052]27#include "bncantex.h"
[5742]28#include "t_prn.h"
[2898]29
[3455]30const double sig0_offAC = 1000.0;
31const double sig0_offACSat = 100.0;
[3468]32const double sigP_offACSat = 0.01;
[3455]33const double sig0_clkSat = 100.0;
34
35const double sigObs = 0.05;
36
37using namespace std;
38
[2898]39// Constructor
40////////////////////////////////////////////////////////////////////////////
[6155]41bncComb::cmbParam::cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_) {
[3032]42
[3433]43 type = type_;
44 index = index_;
45 AC = ac_;
46 prn = prn_;
47 xx = 0.0;
[3455]48 eph = 0;
[3429]49
[3485]50 if (type == offACgps) {
[3455]51 epoSpec = true;
52 sig0 = sig0_offAC;
53 sigP = sig0;
[3429]54 }
[3485]55 else if (type == offACglo) {
56 epoSpec = true;
57 sig0 = sig0_offAC;
58 sigP = sig0;
59 }
[3429]60 else if (type == offACSat) {
[3455]61 epoSpec = false;
62 sig0 = sig0_offACSat;
63 sigP = sigP_offACSat;
[3429]64 }
65 else if (type == clkSat) {
[3455]66 epoSpec = true;
67 sig0 = sig0_clkSat;
68 sigP = sig0;
[3429]69 }
[2933]70}
71
72// Destructor
73////////////////////////////////////////////////////////////////////////////
[6155]74bncComb::cmbParam::~cmbParam() {
[2933]75}
76
77// Partial
78////////////////////////////////////////////////////////////////////////////
[6155]79double bncComb::cmbParam::partial(const QString& AC_, const QString& prn_) {
[7297]80
[3485]81 if (type == offACgps) {
82 if (AC == AC_ && prn_[0] == 'G') {
[2934]83 return 1.0;
84 }
85 }
[3485]86 else if (type == offACglo) {
87 if (AC == AC_ && prn_[0] == 'R') {
88 return 1.0;
89 }
90 }
[3429]91 else if (type == offACSat) {
92 if (AC == AC_ && prn == prn_) {
[2933]93 return 1.0;
94 }
95 }
[3429]96 else if (type == clkSat) {
97 if (prn == prn_) {
[2933]98 return 1.0;
99 }
100 }
101
102 return 0.0;
103}
104
[7297]105//
[2990]106////////////////////////////////////////////////////////////////////////////
[6155]107QString bncComb::cmbParam::toString() const {
[2933]108
[2990]109 QString outStr;
[7297]110
[3485]111 if (type == offACgps) {
112 outStr = "AC offset GPS " + AC;
[2990]113 }
[3485]114 else if (type == offACglo) {
115 outStr = "AC offset GLO " + AC;
116 }
[3429]117 else if (type == offACSat) {
[7008]118 outStr = "Sat Offset " + AC + " " + prn.mid(0,3);
[2990]119 }
[3429]120 else if (type == clkSat) {
[7008]121 outStr = "Clk Corr " + prn.mid(0,3);
[2990]122 }
[2933]123
[2990]124 return outStr;
125}
126
[7299]127// Singleton
128////////////////////////////////////////////////////////////////////////////
129bncComb* bncComb::instance() {
130 static bncComb _bncComb;
131 return &_bncComb;
132}
133
[2933]134// Constructor
135////////////////////////////////////////////////////////////////////////////
[6443]136bncComb::bncComb() : _ephUser(true) {
[2910]137
138 bncSettings settings;
139
[7297]140 QStringList cmbStreams = settings.value("cmbStreams").toStringList();
[2918]141
[4183]142 _cmbSampl = settings.value("cmbSampl").toInt();
143 if (_cmbSampl <= 0) {
144 _cmbSampl = 10;
145 }
146
[3455]147 _masterMissingEpochs = 0;
148
[7297]149 if (cmbStreams.size() >= 1 && !cmbStreams[0].isEmpty()) {
150 QListIterator<QString> it(cmbStreams);
[2910]151 while (it.hasNext()) {
152 QStringList hlp = it.next().split(" ");
[2918]153 cmbAC* newAC = new cmbAC();
154 newAC->mountPoint = hlp[0];
155 newAC->name = hlp[1];
156 newAC->weight = hlp[2].toDouble();
[3453]157 if (_masterOrbitAC.isEmpty()) {
158 _masterOrbitAC = newAC->name;
159 }
[3429]160 _ACs.append(newAC);
[2910]161 }
162 }
[2927]163
[9036]164 QString ssrFormat;
165 QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList());
166 while (it.hasNext()) {
167 QStringList hlp = it.next().split(",");
[9080]168 if (hlp.size() > 5) {
169 ssrFormat = hlp[5];
[9036]170 }
171 }
172 _ssrCorr = 0;
173 if (ssrFormat == "IGS-SSR") {
174 _ssrCorr = new SsrCorrIgs();
175 }
176 else if (ssrFormat == "RTCM-SSR") {
177 _ssrCorr = new SsrCorrRtcm();
178 }
179
[3211]180 _rtnetDecoder = 0;
[3201]181
[7297]182 connect(this, SIGNAL(newMessage(QByteArray,bool)),
[5068]183 BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
[2933]184
[5583]185 connect(BNC_CORE, SIGNAL(providerIDChanged(QString)),
[6155]186 this, SLOT(slotProviderIDChanged(QString)));
[5583]187
[6155]188 connect(BNC_CORE, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
189 this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)));
190
191 connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
192 this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)));
193
[3470]194 // Combination Method
195 // ------------------
[3481]196 if (settings.value("cmbMethod").toString() == "Single-Epoch") {
197 _method = singleEpoch;
[3470]198 }
199 else {
[3481]200 _method = filter;
[3470]201 }
[3032]202
[3484]203 // Use Glonass
204 // -----------
[6174]205 if ( Qt::CheckState(settings.value("cmbUseGlonass").toInt()) == Qt::Checked) {
[3484]206 _useGlonass = true;
207 }
208 else {
209 _useGlonass = false;
210 }
211
[3032]212 // Initialize Parameters (model: Clk_Corr = AC_Offset + Sat_Offset + Clk)
213 // ----------------------------------------------------------------------
[3470]214 if (_method == filter) {
215 int nextPar = 0;
216 QListIterator<cmbAC*> it(_ACs);
217 while (it.hasNext()) {
218 cmbAC* AC = it.next();
[3485]219 _params.push_back(new cmbParam(cmbParam::offACgps, ++nextPar, AC->name, ""));
[5808]220 for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) {
[7008]221 QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0'));
[7297]222 _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar,
[3470]223 AC->name, prn));
224 }
[3483]225 if (_useGlonass) {
[3485]226 _params.push_back(new cmbParam(cmbParam::offACglo, ++nextPar, AC->name, ""));
[5808]227 for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {
[7008]228 QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));
[7297]229 _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar,
[3483]230 AC->name, prn));
231 }
232 }
[3470]233 }
[5808]234 for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) {
[7008]235 QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0'));
[3470]236 _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
[2991]237 }
[3483]238 if (_useGlonass) {
[5808]239 for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {
[7008]240 QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));
[3483]241 _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
242 }
243 }
[7297]244
[3470]245 // Initialize Variance-Covariance Matrix
246 // -------------------------------------
247 _QQ.ReSize(_params.size());
248 _QQ = 0.0;
249 for (int iPar = 1; iPar <= _params.size(); iPar++) {
250 cmbParam* pp = _params[iPar-1];
251 _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
252 }
[2991]253 }
[2933]254
[3052]255 // ANTEX File
256 // ----------
257 _antex = 0;
[6667]258 QString antexFileName = settings.value("uploadAntexFile").toString();
[3052]259 if (!antexFileName.isEmpty()) {
260 _antex = new bncAntex();
261 if (_antex->readFile(antexFileName) != success) {
262 emit newMessage("wrong ANTEX file", true);
263 delete _antex;
264 _antex = 0;
265 }
266 }
[3138]267
[3329]268 // Maximal Residuum
269 // ----------------
270 _MAXRES = settings.value("cmbMaxres").toDouble();
271 if (_MAXRES <= 0.0) {
272 _MAXRES = 999.0;
273 }
[2898]274}
275
276// Destructor
277////////////////////////////////////////////////////////////////////////////
278bncComb::~bncComb() {
[3429]279 QListIterator<cmbAC*> icAC(_ACs);
280 while (icAC.hasNext()) {
281 delete icAC.next();
[2918]282 }
[3201]283 delete _rtnetDecoder;
[9036]284 if (_ssrCorr) {
285 delete _ssrCorr;
286 }
[3052]287 delete _antex;
[3296]288 for (int iPar = 1; iPar <= _params.size(); iPar++) {
289 delete _params[iPar-1];
290 }
[3556]291 QListIterator<bncTime> itTime(_buffer.keys());
[3551]292 while (itTime.hasNext()) {
[3556]293 bncTime epoTime = itTime.next();
294 _buffer.remove(epoTime);
[3429]295 }
[2898]296}
297
[6155]298// Remember orbit corrections
[2898]299////////////////////////////////////////////////////////////////////////////
[6155]300void bncComb::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) {
[2906]301 QMutexLocker locker(&_mutex);
[2913]302
[6155]303 for (int ii = 0; ii < orbCorrections.size(); ii++) {
304 t_orbCorr& orbCorr = orbCorrections[ii];
305 QString staID(orbCorr._staID.c_str());
[7008]306 QString prn(orbCorr._prn.toInternalString().c_str());
[6155]307
308 // Find/Check the AC Name
309 // ----------------------
310 QString acName;
311 QListIterator<cmbAC*> icAC(_ACs);
312 while (icAC.hasNext()) {
313 cmbAC* AC = icAC.next();
314 if (AC->mountPoint == staID) {
315 acName = AC->name;
316 break;
317 }
[3431]318 }
[6155]319 if (acName.isEmpty()) {
320 continue;
321 }
[3431]322
[6155]323 // Store the correction
324 // --------------------
325 QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
326 storage[orbCorr._prn] = orbCorr;
[2913]327 }
[6155]328}
[2913]329
[6155]330// Process clock corrections
331////////////////////////////////////////////////////////////////////////////
332void bncComb::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) {
333 QMutexLocker locker(&_mutex);
334
335 bncTime lastTime;
336
337 for (int ii = 0; ii < clkCorrections.size(); ii++) {
338 t_clkCorr& clkCorr = clkCorrections[ii];
339 QString staID(clkCorr._staID.c_str());
[6961]340 QString prn(clkCorr._prn.toInternalString().c_str());
[6155]341
342 // Set the last time
343 // -----------------
344 if (lastTime.undef() || clkCorr._time > lastTime) {
345 lastTime = clkCorr._time;
[3483]346 }
347
[6155]348 // Find/Check the AC Name
349 // ----------------------
350 QString acName;
351 QListIterator<cmbAC*> icAC(_ACs);
352 while (icAC.hasNext()) {
353 cmbAC* AC = icAC.next();
354 if (AC->mountPoint == staID) {
355 acName = AC->name;
356 break;
357 }
[3588]358 }
[6155]359 if (acName.isEmpty()) {
360 continue;
361 }
[3588]362
[6155]363 // Check GLONASS
364 // -------------
365 if (!_useGlonass && clkCorr._prn.system() == 'R') {
366 continue;
[3590]367 }
368
[8176]369 if (
370 clkCorr._prn.system() == 'E' ||
371 clkCorr._prn.system() == 'C' ||
372 clkCorr._prn.system() == 'J' ||
373 clkCorr._prn.system() == 'I' ||
374 clkCorr._prn.system() == 'S' ) {
375 continue;
376 }
[8484]377
[6155]378 // Check Modulo Time
379 // -----------------
[8448]380 int sec = int(nint(clkCorr._time.gpssec()*10));
381 if (sec % (_cmbSampl*10) != 0.0) {
[6155]382 continue;
383 }
[3274]384
[6155]385 // Check Correction Age
386 // --------------------
387 if (_resTime.valid() && clkCorr._time <= _resTime) {
[7008]388 emit newMessage("bncComb: old correction: " + acName.toAscii() + " " + prn.mid(0,3).toAscii(), true);
[6155]389 continue;
390 }
[7297]391
[6155]392 // Create new correction
393 // ---------------------
394 cmbCorr* newCorr = new cmbCorr();
[6157]395 newCorr->_prn = prn;
[6155]396 newCorr->_time = clkCorr._time;
397 newCorr->_iod = clkCorr._iod;
398 newCorr->_acName = acName;
[6159]399 newCorr->_clkCorr = clkCorr;
[6155]400
[6156]401 // Check orbit correction
402 // ----------------------
403 if (!_orbCorrections.contains(acName)) {
404 delete newCorr;
405 continue;
406 }
407 else {
408 QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
409 if (!storage.contains(clkCorr._prn) || storage[clkCorr._prn]._iod != newCorr->_iod) {
410 delete newCorr;
411 continue;
412 }
413 else {
[6159]414 newCorr->_orbCorr = storage[clkCorr._prn];
[6156]415 }
416 }
417
[6155]418 // Check the Ephemeris
419 //--------------------
[7012]420 t_eph* ephLast = _ephUser.ephLast(prn);
421 t_eph* ephPrev = _ephUser.ephPrev(prn);
[6443]422 if (ephLast == 0) {
[8696]423 emit newMessage("bncComb: eph not found for " + prn.mid(0,3).toAscii(), true);
[6155]424 delete newCorr;
425 continue;
[2986]426 }
[3029]427 else {
[6443]428 if (ephLast->IOD() == newCorr->_iod) {
429 newCorr->_eph = ephLast;
[6155]430 }
[6443]431 else if (ephPrev && ephPrev->IOD() == newCorr->_iod) {
432 newCorr->_eph = ephPrev;
433 switchToLastEph(ephLast, newCorr);
[6155]434 }
435 else {
[8696]436 emit newMessage("bncComb: eph not found for " + prn.mid(0,3).toAscii() +
437 QString(" with IOD %1").arg(newCorr->_iod).toAscii(), true);
[6155]438 delete newCorr;
439 continue;
440 }
[2986]441 }
[6155]442
443 // Store correction into the buffer
444 // --------------------------------
445 QVector<cmbCorr*>& corrs = _buffer[newCorr->_time].corrs;
446 corrs.push_back(newCorr);
[2986]447 }
448
[3435]449 // Process previous Epoch(s)
450 // -------------------------
[7392]451 const double outWait = 1.0 * _cmbSampl;
[3556]452 QListIterator<bncTime> itTime(_buffer.keys());
[3435]453 while (itTime.hasNext()) {
[3556]454 bncTime epoTime = itTime.next();
[7392]455 if (epoTime < lastTime - outWait) {
[3556]456 _resTime = epoTime;
[3435]457 processEpoch();
458 }
[2927]459 }
[2898]460}
461
[7297]462// Change the correction so that it refers to last received ephemeris
[2986]463////////////////////////////////////////////////////////////////////////////
[7012]464void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) {
[3028]465
[6155]466 if (corr->_eph == lastEph) {
[3429]467 return;
468 }
469
[8541]470 ColumnVector oldXC(6);
[2987]471 ColumnVector oldVV(3);
[6155]472 corr->_eph->getCrd(corr->_time, oldXC, oldVV, false);
[2988]473
[8541]474 ColumnVector newXC(6);
[2987]475 ColumnVector newVV(3);
[6155]476 lastEph->getCrd(corr->_time, newXC, newVV, false);
[2988]477
478 ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
[2989]479 ColumnVector dV = newVV - oldVV;
480 double dC = newXC(4) - oldXC(4);
481
[2988]482 ColumnVector dRAO(3);
483 XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
[2989]484
485 ColumnVector dDotRAO(3);
486 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
487
[6963]488 QString msg = "switch corr " + corr->_prn.mid(0,3)
[6155]489 + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
[3013]490
[3029]491 emit newMessage(msg.toAscii(), false);
[3028]492
[6155]493 corr->_iod = lastEph->IOD();
494 corr->_eph = lastEph;
495
[6159]496 corr->_orbCorr._xr += dRAO;
497 corr->_orbCorr._dotXr += dDotRAO;
498 corr->_clkCorr._dClk -= dC;
[2986]499}
500
[3429]501// Process Epoch
[2928]502////////////////////////////////////////////////////////////////////////////
[3429]503void bncComb::processEpoch() {
[2918]504
[2990]505 _log.clear();
506
507 QTextStream out(&_log, QIODevice::WriteOnly);
508
[7297]509 out << endl << "Combination:" << endl
[3472]510 << "------------------------------" << endl;
[2990]511
[3433]512 // Observation Statistics
513 // ----------------------
[3455]514 bool masterPresent = false;
[3433]515 QListIterator<cmbAC*> icAC(_ACs);
516 while (icAC.hasNext()) {
517 cmbAC* AC = icAC.next();
518 AC->numObs = 0;
[3434]519 QVectorIterator<cmbCorr*> itCorr(corrs());
[3433]520 while (itCorr.hasNext()) {
521 cmbCorr* corr = itCorr.next();
[6157]522 if (corr->_acName == AC->name) {
[3433]523 AC->numObs += 1;
[3453]524 if (AC->name == _masterOrbitAC) {
525 masterPresent = true;
526 }
[3433]527 }
528 }
529 out << AC->name.toAscii().data() << ": " << AC->numObs << endl;
530 }
531
[3453]532 // If Master not present, switch to another one
533 // --------------------------------------------
[4889]534 const unsigned switchMasterAfterGap = 1;
[3456]535 if (masterPresent) {
536 _masterMissingEpochs = 0;
537 }
538 else {
[3455]539 ++_masterMissingEpochs;
[4889]540 if (_masterMissingEpochs < switchMasterAfterGap) {
[3457]541 out << "Missing Master, Epoch skipped" << endl;
[3556]542 _buffer.remove(_resTime);
[3455]543 emit newMessage(_log, false);
544 return;
[3453]545 }
[3455]546 else {
547 _masterMissingEpochs = 0;
548 QListIterator<cmbAC*> icAC(_ACs);
549 while (icAC.hasNext()) {
550 cmbAC* AC = icAC.next();
551 if (AC->numObs > 0) {
552 out << "Switching Master AC "
[7297]553 << _masterOrbitAC.toAscii().data() << " --> "
554 << AC->name.toAscii().data() << " "
555 << _resTime.datestr().c_str() << " "
[3455]556 << _resTime.timestr().c_str() << endl;
557 _masterOrbitAC = AC->name;
558 break;
559 }
[3452]560 }
561 }
562 }
563
[6157]564 QMap<QString, cmbCorr*> resCorr;
[3472]565
566 // Perform the actual Combination using selected Method
567 // ----------------------------------------------------
568 t_irc irc;
[3475]569 ColumnVector dx;
[3472]570 if (_method == filter) {
[3475]571 irc = processEpoch_filter(out, resCorr, dx);
[3472]572 }
573 else {
[3475]574 irc = processEpoch_singleEpoch(out, resCorr, dx);
[3472]575 }
576
[3475]577 // Update Parameter Values, Print Results
578 // --------------------------------------
[3472]579 if (irc == success) {
[3475]580 for (int iPar = 1; iPar <= _params.size(); iPar++) {
581 cmbParam* pp = _params[iPar-1];
582 pp->xx += dx(iPar);
583 if (pp->type == cmbParam::clkSat) {
584 if (resCorr.find(pp->prn) != resCorr.end()) {
[6160]585 resCorr[pp->prn]->_dClkResult = pp->xx / t_CST::c;
[3475]586 }
587 }
[7297]588 out << _resTime.datestr().c_str() << " "
[3475]589 << _resTime.timestr().c_str() << " ";
590 out.setRealNumberNotation(QTextStream::FixedNotation);
591 out.setFieldWidth(8);
592 out.setRealNumberPrecision(4);
593 out << pp->toString() << " "
594 << pp->xx << " +- " << sqrt(_QQ(pp->index,pp->index)) << endl;
595 out.setFieldWidth(0);
596 }
[3472]597 printResults(out, resCorr);
598 dumpResults(resCorr);
599 }
600
601 // Delete Data, emit Message
602 // -------------------------
[3556]603 _buffer.remove(_resTime);
[3472]604 emit newMessage(_log, false);
605}
606
607// Process Epoch - Filter Method
608////////////////////////////////////////////////////////////////////////////
609t_irc bncComb::processEpoch_filter(QTextStream& out,
[6157]610 QMap<QString, cmbCorr*>& resCorr,
[3475]611 ColumnVector& dx) {
[3472]612
[3429]613 // Prediction Step
614 // ---------------
[3472]615 int nPar = _params.size();
[2933]616 ColumnVector x0(nPar);
617 for (int iPar = 1; iPar <= _params.size(); iPar++) {
[3455]618 cmbParam* pp = _params[iPar-1];
619 if (pp->epoSpec) {
[3451]620 pp->xx = 0.0;
[3455]621 _QQ.Row(iPar) = 0.0;
622 _QQ.Column(iPar) = 0.0;
623 _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
[3451]624 }
[3455]625 else {
626 _QQ(iPar,iPar) += pp->sigP * pp->sigP;
627 }
[2933]628 x0(iPar) = pp->xx;
629 }
630
[3487]631 // Check Satellite Positions for Outliers
632 // --------------------------------------
[3497]633 if (checkOrbits(out) != success) {
[3487]634 return failure;
635 }
[3441]636
[3455]637 // Update and outlier detection loop
638 // ---------------------------------
[3487]639 SymmetricMatrix QQ_sav = _QQ;
[3455]640 while (true) {
[3135]641
[3455]642 Matrix AA;
643 ColumnVector ll;
644 DiagonalMatrix PP;
[3429]645
[3455]646 if (createAmat(AA, ll, PP, x0, resCorr) != success) {
[3472]647 return failure;
[3441]648 }
[2933]649
[6169]650 dx.ReSize(nPar); dx = 0.0;
[5808]651 kalman(AA, ll, PP, _QQ, dx);
[6164]652
[3429]653 ColumnVector vv = ll - AA * dx;
[3080]654
[3429]655 int maxResIndex;
[7297]656 double maxRes = vv.maximum_absolute_value1(maxResIndex);
[3429]657 out.setRealNumberNotation(QTextStream::FixedNotation);
[7297]658 out.setRealNumberPrecision(3);
[3429]659 out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
[3432]660 << " Maximum Residuum " << maxRes << ' '
[6962]661 << corrs()[maxResIndex-1]->_acName << ' ' << corrs()[maxResIndex-1]->_prn.mid(0,3);
[3432]662 if (maxRes > _MAXRES) {
663 for (int iPar = 1; iPar <= _params.size(); iPar++) {
664 cmbParam* pp = _params[iPar-1];
[7297]665 if (pp->type == cmbParam::offACSat &&
[6157]666 pp->AC == corrs()[maxResIndex-1]->_acName &&
[6962]667 pp->prn == corrs()[maxResIndex-1]->_prn.mid(0,3)) {
[3432]668 QQ_sav.Row(iPar) = 0.0;
669 QQ_sav.Column(iPar) = 0.0;
[3455]670 QQ_sav(iPar,iPar) = pp->sig0 * pp->sig0;
[3432]671 }
672 }
673
674 out << " Outlier" << endl;
675 _QQ = QQ_sav;
[3455]676 corrs().remove(maxResIndex-1);
[3432]677 }
678 else {
679 out << " OK" << endl;
[6330]680 out.setRealNumberNotation(QTextStream::FixedNotation);
681 out.setRealNumberPrecision(4);
682 for (int ii = 0; ii < corrs().size(); ii++) {
[8066]683 const cmbCorr* corr = corrs()[ii];
[6330]684 out << _resTime.datestr().c_str() << ' '
685 << _resTime.timestr().c_str() << " "
[6962]686 << corr->_acName << ' ' << corr->_prn.mid(0,3);
[6330]687 out.setFieldWidth(10);
688 out << " res = " << vv[ii] << endl;
689 out.setFieldWidth(0);
690 }
[3432]691 break;
692 }
693 }
694
[3472]695 return success;
[2918]696}
[3011]697
[3201]698// Print results
[3011]699////////////////////////////////////////////////////////////////////////////
[3429]700void bncComb::printResults(QTextStream& out,
[6157]701 const QMap<QString, cmbCorr*>& resCorr) {
[3011]702
[6157]703 QMapIterator<QString, cmbCorr*> it(resCorr);
[3011]704 while (it.hasNext()) {
705 it.next();
[6157]706 cmbCorr* corr = it.value();
707 const t_eph* eph = corr->_eph;
[3015]708 if (eph) {
[8541]709 ColumnVector xc(6);
[6109]710 ColumnVector vv(3);
711 eph->getCrd(_resTime, xc, vv, false);
[3015]712
[7297]713 out << _resTime.datestr().c_str() << " "
[3429]714 << _resTime.timestr().c_str() << " ";
[3015]715 out.setFieldWidth(3);
[6962]716 out << "Full Clock " << corr->_prn.mid(0,3) << " " << corr->_iod << " ";
[3015]717 out.setFieldWidth(14);
[6160]718 out << (xc(4) + corr->_dClkResult) * t_CST::c << endl;
[3370]719 out.setFieldWidth(0);
[3015]720 }
721 else {
722 out << "bncComb::printResuls bug" << endl;
723 }
[3011]724 }
725}
[3202]726
727// Send results to RTNet Decoder and directly to PPP Client
728////////////////////////////////////////////////////////////////////////////
[6157]729void bncComb::dumpResults(const QMap<QString, cmbCorr*>& resCorr) {
[3202]730
[6161]731 QList<t_orbCorr> orbCorrections;
732 QList<t_clkCorr> clkCorrections;
733
[5337]734 QString outLines;
[3214]735 unsigned year, month, day, hour, minute;
736 double sec;
[3429]737 _resTime.civil_date(year, month, day);
738 _resTime.civil_time(hour, minute, sec);
[3214]739
[7297]740 outLines.sprintf("* %4d %2d %2d %d %d %12.8f\n",
[5337]741 year, month, day, hour, minute, sec);
[3214]742
[6157]743 QMapIterator<QString, cmbCorr*> it(resCorr);
[3202]744 while (it.hasNext()) {
745 it.next();
[6157]746 cmbCorr* corr = it.value();
[3202]747
[7013]748 t_orbCorr orbCorr(corr->_orbCorr);
749 orbCorr._staID = "INTERNAL";
750 orbCorrections.push_back(orbCorr);
751
752 t_clkCorr clkCorr(corr->_clkCorr);
753 clkCorr._staID = "INTERNAL";
754 clkCorr._dClk = corr->_dClkResult;
755 clkCorr._dotDClk = 0.0;
756 clkCorr._dotDotDClk = 0.0;
757 clkCorrections.push_back(clkCorr);
758
[8541]759 ColumnVector xc(6);
[4978]760 ColumnVector vv(3);
[7013]761 corr->_eph->setClkCorr(dynamic_cast<const t_clkCorr*>(&clkCorr));
762 corr->_eph->setOrbCorr(dynamic_cast<const t_orbCorr*>(&orbCorr));
[7012]763 corr->_eph->getCrd(_resTime, xc, vv, true);
764
[4978]765 // Correction Phase Center --> CoM
766 // -------------------------------
767 ColumnVector dx(3); dx = 0.0;
768 if (_antex) {
769 double Mjd = _resTime.mjd() + _resTime.daysec()/86400.0;
[6157]770 if (_antex->satCoMcorrection(corr->_prn, Mjd, xc.Rows(1,3), dx) != success) {
[4992]771 dx = 0;
[6970]772 _log += "antenna not found " + corr->_prn.mid(0,3).toAscii() + '\n';
[3214]773 }
774 }
[7012]775
776 outLines += corr->_prn.mid(0,3);
[5337]777 QString hlp;
778 hlp.sprintf(" APC 3 %15.4f %15.4f %15.4f"
779 " Clk 1 %15.4f"
780 " Vel 3 %15.4f %15.4f %15.4f"
781 " CoM 3 %15.4f %15.4f %15.4f\n",
[7012]782 xc(1), xc(2), xc(3),
783 xc(4) * t_CST::c,
[5337]784 vv(1), vv(2), vv(3),
785 xc(1)-dx(1), xc(2)-dx(2), xc(3)-dx(3));
786 outLines += hlp;
787
[4978]788 QString line;
[9036]789 int messageType = _ssrCorr->COTYPE_GPSCOMBINED;
[5564]790 int updateInt = 0;
[4978]791 line.sprintf("%d %d %d %.1f %s"
[7055]792 " %lu"
[4978]793 " %8.3f %8.3f %8.3f %8.3f"
794 " %10.5f %10.5f %10.5f %10.5f"
[5576]795 " %10.5f INTERNAL",
[4978]796 messageType, updateInt, _resTime.gpsw(), _resTime.gpssec(),
[7012]797 corr->_prn.mid(0,3).toAscii().data(),
[6157]798 corr->_iod,
[6160]799 corr->_dClkResult * t_CST::c,
[6159]800 corr->_orbCorr._xr[0],
801 corr->_orbCorr._xr[1],
802 corr->_orbCorr._xr[2],
[6157]803 0.0,
[6159]804 corr->_orbCorr._dotXr[0],
805 corr->_orbCorr._dotXr[1],
806 corr->_orbCorr._dotXr[2],
[6157]807 0.0);
[3214]808 delete corr;
809 }
810
[5337]811 outLines += "EOE\n"; // End Of Epoch flag
812
[3215]813 if (!_rtnetDecoder) {
814 _rtnetDecoder = new bncRtnetDecoder();
815 }
[3221]816
[3215]817 vector<string> errmsg;
[5337]818 _rtnetDecoder->Decode(outLines.toAscii().data(), outLines.length(), errmsg);
[3215]819
[5861]820 // Send new Corrections to PPP etc.
821 // --------------------------------
[6161]822 if (orbCorrections.size() > 0 && clkCorrections.size() > 0) {
823 emit newOrbCorrections(orbCorrections);
824 emit newClkCorrections(clkCorrections);
825 }
[3202]826}
[3455]827
828// Create First Design Matrix and Vector of Measurements
829////////////////////////////////////////////////////////////////////////////
830t_irc bncComb::createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
[7297]831 const ColumnVector& x0,
[6157]832 QMap<QString, cmbCorr*>& resCorr) {
[3455]833
834 unsigned nPar = _params.size();
[7297]835 unsigned nObs = corrs().size();
[3455]836
837 if (nObs == 0) {
838 return failure;
839 }
840
[5742]841 int maxSat = t_prn::MAXPRN_GPS;
[3486]842// if (_useGlonass) {
[5742]843// maxSat = t_prn::MAXPRN_GPS + t_prn::MAXPRN_GLONASS;
[3486]844// }
[3455]845
[5742]846 const int nCon = (_method == filter) ? 1 + maxSat : 0;
[3483]847
[3455]848 AA.ReSize(nObs+nCon, nPar); AA = 0.0;
849 ll.ReSize(nObs+nCon); ll = 0.0;
850 PP.ReSize(nObs+nCon); PP = 1.0 / (sigObs * sigObs);
851
852 int iObs = 0;
853 QVectorIterator<cmbCorr*> itCorr(corrs());
854 while (itCorr.hasNext()) {
855 cmbCorr* corr = itCorr.next();
[6157]856 QString prn = corr->_prn;
[3487]857
[3455]858 ++iObs;
859
[6157]860 if (corr->_acName == _masterOrbitAC && resCorr.find(prn) == resCorr.end()) {
861 resCorr[prn] = new cmbCorr(*corr);
[3455]862 }
863
864 for (int iPar = 1; iPar <= _params.size(); iPar++) {
865 cmbParam* pp = _params[iPar-1];
[6157]866 AA(iObs, iPar) = pp->partial(corr->_acName, prn);
[3455]867 }
868
[6160]869 ll(iObs) = corr->_clkCorr._dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
[3455]870 }
871
872 // Regularization
873 // --------------
[3474]874 if (_method == filter) {
875 const double Ph = 1.e6;
876 PP(nObs+1) = Ph;
[3461]877 for (int iPar = 1; iPar <= _params.size(); iPar++) {
878 cmbParam* pp = _params[iPar-1];
[3465]879 if ( AA.Column(iPar).maximum_absolute_value() > 0.0 &&
[3474]880 pp->type == cmbParam::clkSat ) {
881 AA(nObs+1, iPar) = 1.0;
[3455]882 }
883 }
[3474]884 int iCond = 1;
[5808]885 for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) {
[7132]886 QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0'));
[3474]887 ++iCond;
888 PP(nObs+iCond) = Ph;
889 for (int iPar = 1; iPar <= _params.size(); iPar++) {
890 cmbParam* pp = _params[iPar-1];
[7299]891 if ( pp &&
892 AA.Column(iPar).maximum_absolute_value() > 0.0 &&
[7297]893 pp->type == cmbParam::offACSat &&
[3474]894 pp->prn == prn) {
895 AA(nObs+iCond, iPar) = 1.0;
896 }
897 }
898 }
[3486]899// if (_useGlonass) {
[9036]900// for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {
[7132]901// QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));
[3486]902// ++iCond;
903// PP(nObs+iCond) = Ph;
904// for (int iPar = 1; iPar <= _params.size(); iPar++) {
905// cmbParam* pp = _params[iPar-1];
[7299]906// if ( pp &&
907// AA.Column(iPar).maximum_absolute_value() > 0.0 &&
[7297]908// pp->type == cmbParam::offACSat &&
[3486]909// pp->prn == prn) {
910// AA(nObs+iCond, iPar) = 1.0;
911// }
912// }
913// }
914// }
[3455]915 }
916
917 return success;
918}
[3470]919
920// Process Epoch - Single-Epoch Method
921////////////////////////////////////////////////////////////////////////////
[3472]922t_irc bncComb::processEpoch_singleEpoch(QTextStream& out,
[6157]923 QMap<QString, cmbCorr*>& resCorr,
[3475]924 ColumnVector& dx) {
[3470]925
[3487]926 // Check Satellite Positions for Outliers
927 // --------------------------------------
[3497]928 if (checkOrbits(out) != success) {
[3487]929 return failure;
930 }
931
[3482]932 // Outlier Detection Loop
933 // ----------------------
934 while (true) {
[7297]935
[3482]936 // Remove Satellites that are not in Master
937 // ----------------------------------------
938 QMutableVectorIterator<cmbCorr*> it(corrs());
939 while (it.hasNext()) {
940 cmbCorr* corr = it.next();
[6157]941 QString prn = corr->_prn;
[3482]942 bool foundMaster = false;
943 QVectorIterator<cmbCorr*> itHlp(corrs());
944 while (itHlp.hasNext()) {
945 cmbCorr* corrHlp = itHlp.next();
[6157]946 QString prnHlp = corrHlp->_prn;
947 QString ACHlp = corrHlp->_acName;
[3482]948 if (ACHlp == _masterOrbitAC && prn == prnHlp) {
949 foundMaster = true;
950 break;
951 }
[3476]952 }
[3482]953 if (!foundMaster) {
[3556]954 delete corr;
[3482]955 it.remove();
956 }
[3473]957 }
[7297]958
[3482]959 // Count Number of Observations per Satellite and per AC
960 // -----------------------------------------------------
961 QMap<QString, int> numObsPrn;
962 QMap<QString, int> numObsAC;
963 QVectorIterator<cmbCorr*> itCorr(corrs());
964 while (itCorr.hasNext()) {
965 cmbCorr* corr = itCorr.next();
[6157]966 QString prn = corr->_prn;
967 QString AC = corr->_acName;
[3482]968 if (numObsPrn.find(prn) == numObsPrn.end()) {
969 numObsPrn[prn] = 1;
970 }
971 else {
972 numObsPrn[prn] += 1;
973 }
974 if (numObsAC.find(AC) == numObsAC.end()) {
975 numObsAC[AC] = 1;
976 }
977 else {
978 numObsAC[AC] += 1;
979 }
[3476]980 }
[7297]981
[3482]982 // Clean-Up the Paramters
983 // ----------------------
984 for (int iPar = 1; iPar <= _params.size(); iPar++) {
985 delete _params[iPar-1];
[3474]986 }
[3482]987 _params.clear();
[7297]988
[3482]989 // Set new Parameters
990 // ------------------
991 int nextPar = 0;
[7297]992
[3482]993 QMapIterator<QString, int> itAC(numObsAC);
994 while (itAC.hasNext()) {
995 itAC.next();
996 const QString& AC = itAC.key();
997 int numObs = itAC.value();
998 if (AC != _masterOrbitAC && numObs > 0) {
[3485]999 _params.push_back(new cmbParam(cmbParam::offACgps, ++nextPar, AC, ""));
1000 if (_useGlonass) {
1001 _params.push_back(new cmbParam(cmbParam::offACglo, ++nextPar, AC, ""));
1002 }
[3482]1003 }
[7297]1004 }
1005
[3482]1006 QMapIterator<QString, int> itPrn(numObsPrn);
1007 while (itPrn.hasNext()) {
1008 itPrn.next();
1009 const QString& prn = itPrn.key();
1010 int numObs = itPrn.value();
1011 if (numObs > 0) {
1012 _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
1013 }
[7297]1014 }
1015
[3482]1016 int nPar = _params.size();
[7297]1017 ColumnVector x0(nPar);
[3482]1018 x0 = 0.0;
[7297]1019
[3482]1020 // Create First-Design Matrix
1021 // --------------------------
1022 Matrix AA;
1023 ColumnVector ll;
1024 DiagonalMatrix PP;
1025 if (createAmat(AA, ll, PP, x0, resCorr) != success) {
1026 return failure;
[3476]1027 }
[7297]1028
[3482]1029 ColumnVector vv;
1030 try {
1031 Matrix ATP = AA.t() * PP;
1032 SymmetricMatrix NN; NN << ATP * AA;
1033 ColumnVector bb = ATP * ll;
1034 _QQ = NN.i();
1035 dx = _QQ * bb;
1036 vv = ll - AA * dx;
[3476]1037 }
[3482]1038 catch (Exception& exc) {
1039 out << exc.what() << endl;
1040 return failure;
[3476]1041 }
[3474]1042
[3482]1043 int maxResIndex;
[7297]1044 double maxRes = vv.maximum_absolute_value1(maxResIndex);
[3482]1045 out.setRealNumberNotation(QTextStream::FixedNotation);
[7297]1046 out.setRealNumberPrecision(3);
[3482]1047 out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
1048 << " Maximum Residuum " << maxRes << ' '
[7715]1049 << corrs()[maxResIndex-1]->_acName << ' ' << corrs()[maxResIndex-1]->_prn.mid(0,3);
[3474]1050
[3482]1051 if (maxRes > _MAXRES) {
1052 out << " Outlier" << endl;
[3556]1053 delete corrs()[maxResIndex-1];
[3482]1054 corrs().remove(maxResIndex-1);
[3474]1055 }
[3482]1056 else {
1057 out << " OK" << endl;
1058 out.setRealNumberNotation(QTextStream::FixedNotation);
[7297]1059 out.setRealNumberPrecision(3);
[3482]1060 for (int ii = 0; ii < vv.Nrows(); ii++) {
1061 const cmbCorr* corr = corrs()[ii];
[7297]1062 out << _resTime.datestr().c_str() << ' '
[3482]1063 << _resTime.timestr().c_str() << " "
[6962]1064 << corr->_acName << ' ' << corr->_prn.mid(0,3);
[3482]1065 out.setFieldWidth(6);
[6330]1066 out << " res = " << vv[ii] << endl;
[3482]1067 out.setFieldWidth(0);
1068 }
1069 return success;
[3474]1070 }
1071
[3473]1072 }
[3474]1073
[3482]1074 return failure;
[3470]1075}
[3487]1076
1077// Check Satellite Positions for Outliers
1078////////////////////////////////////////////////////////////////////////////
[3497]1079t_irc bncComb::checkOrbits(QTextStream& out) {
[3487]1080
[3489]1081 const double MAX_DISPLACEMENT = 0.20;
[3488]1082
[3502]1083 // Switch to last ephemeris (if possible)
1084 // --------------------------------------
[3501]1085 QMutableVectorIterator<cmbCorr*> im(corrs());
1086 while (im.hasNext()) {
1087 cmbCorr* corr = im.next();
[6157]1088 QString prn = corr->_prn;
[6443]1089
[7012]1090 t_eph* ephLast = _ephUser.ephLast(prn);
1091 t_eph* ephPrev = _ephUser.ephPrev(prn);
[6443]1092
1093 if (ephLast == 0) {
[6962]1094 out << "checkOrbit: missing eph (not found) " << corr->_prn.mid(0,3) << endl;
[3556]1095 delete corr;
[3501]1096 im.remove();
1097 }
[6157]1098 else if (corr->_eph == 0) {
[6962]1099 out << "checkOrbit: missing eph (zero) " << corr->_prn.mid(0,3) << endl;
[3556]1100 delete corr;
[3503]1101 im.remove();
1102 }
[3502]1103 else {
[6443]1104 if ( corr->_eph == ephLast || corr->_eph == ephPrev ) {
1105 switchToLastEph(ephLast, corr);
[3502]1106 }
1107 else {
[6962]1108 out << "checkOrbit: missing eph (deleted) " << corr->_prn.mid(0,3) << endl;
[3556]1109 delete corr;
[3502]1110 im.remove();
1111 }
1112 }
[3501]1113 }
1114
[3488]1115 while (true) {
1116
1117 // Compute Mean Corrections for all Satellites
1118 // -------------------------------------------
[3489]1119 QMap<QString, int> numCorr;
[3488]1120 QMap<QString, ColumnVector> meanRao;
1121 QVectorIterator<cmbCorr*> it(corrs());
1122 while (it.hasNext()) {
1123 cmbCorr* corr = it.next();
[6157]1124 QString prn = corr->_prn;
[3488]1125 if (meanRao.find(prn) == meanRao.end()) {
1126 meanRao[prn].ReSize(4);
[6159]1127 meanRao[prn].Rows(1,3) = corr->_orbCorr._xr;
[7297]1128 meanRao[prn](4) = 1;
[3488]1129 }
1130 else {
[6159]1131 meanRao[prn].Rows(1,3) += corr->_orbCorr._xr;
[7297]1132 meanRao[prn](4) += 1;
[3488]1133 }
[3489]1134 if (numCorr.find(prn) == numCorr.end()) {
1135 numCorr[prn] = 1;
1136 }
1137 else {
1138 numCorr[prn] += 1;
1139 }
[3487]1140 }
[7297]1141
[3488]1142 // Compute Differences wrt Mean, find Maximum
1143 // ------------------------------------------
1144 QMap<QString, cmbCorr*> maxDiff;
1145 it.toFront();
1146 while (it.hasNext()) {
1147 cmbCorr* corr = it.next();
[6157]1148 QString prn = corr->_prn;
[3488]1149 if (meanRao[prn](4) != 0) {
1150 meanRao[prn] /= meanRao[prn](4);
1151 meanRao[prn](4) = 0;
1152 }
[6159]1153 corr->_diffRao = corr->_orbCorr._xr - meanRao[prn].Rows(1,3);
[3488]1154 if (maxDiff.find(prn) == maxDiff.end()) {
1155 maxDiff[prn] = corr;
1156 }
1157 else {
[6157]1158 double normMax = maxDiff[prn]->_diffRao.norm_Frobenius();
1159 double norm = corr->_diffRao.norm_Frobenius();
[3488]1160 if (norm > normMax) {
1161 maxDiff[prn] = corr;
1162 }
[7297]1163 }
[3487]1164 }
[7297]1165
[3655]1166 if (_ACs.size() == 1) {
1167 break;
1168 }
1169
[3488]1170 // Remove Outliers
1171 // ---------------
1172 bool removed = false;
1173 QMutableVectorIterator<cmbCorr*> im(corrs());
1174 while (im.hasNext()) {
1175 cmbCorr* corr = im.next();
[6157]1176 QString prn = corr->_prn;
[3489]1177 if (numCorr[prn] < 2) {
[3556]1178 delete corr;
[3489]1179 im.remove();
1180 }
1181 else if (corr == maxDiff[prn]) {
[6157]1182 double norm = corr->_diffRao.norm_Frobenius();
[3488]1183 if (norm > MAX_DISPLACEMENT) {
[3497]1184 out << _resTime.datestr().c_str() << " "
1185 << _resTime.timestr().c_str() << " "
[7297]1186 << "Orbit Outlier: "
1187 << corr->_acName.toAscii().data() << " "
[6963]1188 << prn.mid(0,3).toAscii().data() << " "
[7297]1189 << corr->_iod << " "
[6157]1190 << norm << endl;
[3556]1191 delete corr;
[3488]1192 im.remove();
1193 removed = true;
1194 }
1195 }
[3487]1196 }
[7297]1197
[3488]1198 if (!removed) {
1199 break;
1200 }
[3487]1201 }
1202
1203 return success;
1204}
[3588]1205
[7297]1206//
[3588]1207////////////////////////////////////////////////////////////////////////////
[5583]1208void bncComb::slotProviderIDChanged(QString mountPoint) {
1209 QMutexLocker locker(&_mutex);
1210
[8066]1211 QTextStream out(&_log, QIODevice::WriteOnly);
1212
[5583]1213 // Find the AC Name
1214 // ----------------
1215 QString acName;
1216 QListIterator<cmbAC*> icAC(_ACs);
1217 while (icAC.hasNext()) {
1218 cmbAC* AC = icAC.next();
1219 if (AC->mountPoint == mountPoint) {
1220 acName = AC->name;
[8066]1221 out << "Provider ID changed: AC " << AC->name.toAscii().data() << " "
1222 << _resTime.datestr().c_str() << " "
1223 << _resTime.timestr().c_str() << endl;
[5583]1224 break;
1225 }
1226 }
1227 if (acName.isEmpty()) {
1228 return;
1229 }
1230
1231 // Remove all corrections of the corresponding AC
1232 // ----------------------------------------------
1233 QListIterator<bncTime> itTime(_buffer.keys());
1234 while (itTime.hasNext()) {
1235 bncTime epoTime = itTime.next();
1236 QVector<cmbCorr*>& corrVec = _buffer[epoTime].corrs;
[5584]1237 QMutableVectorIterator<cmbCorr*> it(corrVec);
[5583]1238 while (it.hasNext()) {
1239 cmbCorr* corr = it.next();
[6157]1240 if (acName == corr->_acName) {
[5584]1241 delete corr;
1242 it.remove();
[5583]1243 }
1244 }
1245 }
[5585]1246
1247 // Reset Satellite Offsets
1248 // -----------------------
1249 if (_method == filter) {
1250 for (int iPar = 1; iPar <= _params.size(); iPar++) {
1251 cmbParam* pp = _params[iPar-1];
1252 if (pp->AC == acName && pp->type == cmbParam::offACSat) {
1253 pp->xx = 0.0;
1254 _QQ.Row(iPar) = 0.0;
1255 _QQ.Column(iPar) = 0.0;
1256 _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
1257 }
1258 }
1259 }
[5583]1260}
Note: See TracBrowser for help on using the repository browser.