source: ntrip/trunk/BNC/src/combination/bnccomb.cpp@ 9025

Last change on this file since 9025 was 9025, checked in by stuerze, 4 years ago

some modification to allow encoding and decoding of SSR corrections in RTCM-SSR and IGS-SSR formats

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