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

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

minor changes to prevent erroneous epehemeris data sets from usage in combination

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