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

Last change on this file since 9270 was 9270, checked in by stuerze, 3 years ago

minor changes

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