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

Last change on this file since 10792 was 10770, checked in by stuerze, 6 weeks ago

FIXED: Bug in Clock Combination

File size: 51.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>
[9635]20#include <map>
[2898]21
22#include "bnccomb.h"
[9676]23#include <combination/bncbiassnx.h>
[5070]24#include "bnccore.h"
[3201]25#include "upload/bncrtnetdecoder.h"
[2910]26#include "bncsettings.h"
[2988]27#include "bncutils.h"
[3052]28#include "bncantex.h"
[5742]29#include "t_prn.h"
[2898]30
[3455]31const double sig0_offAC = 1000.0;
32const double sig0_offACSat = 100.0;
[3468]33const double sigP_offACSat = 0.01;
[3455]34const double sig0_clkSat = 100.0;
35
36const double sigObs = 0.05;
37
38using namespace std;
39
[2898]40// Constructor
41////////////////////////////////////////////////////////////////////////////
[6155]42bncComb::cmbParam::cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_) {
[3032]43
[3433]44 type = type_;
45 index = index_;
46 AC = ac_;
47 prn = prn_;
48 xx = 0.0;
[3455]49 eph = 0;
[3429]50
[9258]51 if (type == offACgnss) {
[3455]52 epoSpec = true;
53 sig0 = sig0_offAC;
54 sigP = sig0;
[3429]55 }
56 else if (type == offACSat) {
[3455]57 epoSpec = false;
58 sig0 = sig0_offACSat;
59 sigP = sigP_offACSat;
[3429]60 }
61 else if (type == clkSat) {
[3455]62 epoSpec = true;
63 sig0 = sig0_clkSat;
64 sigP = sig0;
[3429]65 }
[2933]66}
67
68// Destructor
69////////////////////////////////////////////////////////////////////////////
[6155]70bncComb::cmbParam::~cmbParam() {
[2933]71}
72
73// Partial
74////////////////////////////////////////////////////////////////////////////
[9258]75double bncComb::cmbParam::partial(char sys, const QString& AC_, const QString& prn_) {
[7297]76
[9258]77 if (type == offACgnss) {
78 if (AC == AC_ && prn_[0].toLatin1() == sys) {
[2934]79 return 1.0;
80 }
81 }
[3429]82 else if (type == offACSat) {
83 if (AC == AC_ && prn == prn_) {
[2933]84 return 1.0;
85 }
86 }
[3429]87 else if (type == clkSat) {
88 if (prn == prn_) {
[2933]89 return 1.0;
90 }
91 }
92
93 return 0.0;
94}
95
[7297]96//
[2990]97////////////////////////////////////////////////////////////////////////////
[9258]98QString bncComb::cmbParam::toString(char sys) const {
[2933]99
[2990]100 QString outStr;
[7297]101
[9258]102 if (type == offACgnss) {
[9262]103 outStr = "AC Offset " + AC + " " + sys + " ";
[2990]104 }
[3429]105 else if (type == offACSat) {
[7008]106 outStr = "Sat Offset " + AC + " " + prn.mid(0,3);
[2990]107 }
[3429]108 else if (type == clkSat) {
[7008]109 outStr = "Clk Corr " + prn.mid(0,3);
[2990]110 }
[2933]111
[2990]112 return outStr;
113}
114
[10040]115// Singleton: definition class variable
[7299]116////////////////////////////////////////////////////////////////////////////
[10042]117bncComb* bncComb::instance = nullptr;
[7299]118
[10040]119
[2933]120// Constructor
121////////////////////////////////////////////////////////////////////////////
[10040]122bncComb::bncComb() : _ephUser(true) {
[2910]123
124 bncSettings settings;
125
[10227]126 _running = true;
127
[7297]128 QStringList cmbStreams = settings.value("cmbStreams").toStringList();
[2918]129
[10669]130 _cmbSampl = settings.value("cmbSampl").toString().split("sec").first().toInt();
[4183]131 if (_cmbSampl <= 0) {
[9676]132 _cmbSampl = 5;
[4183]133 }
[9292]134 _useGps = (Qt::CheckState(settings.value("cmbGps").toInt()) == Qt::Checked) ? true : false;
135 if (_useGps) {
136 _cmbSysPrn['G'] = t_prn::MAXPRN_GPS;
137 _masterMissingEpochs['G'] = 0;
138 }
139 _useGlo = (Qt::CheckState(settings.value("cmbGlo").toInt()) == Qt::Checked) ? true : false;
140 if (_useGlo) {
141 _cmbSysPrn['R'] = t_prn::MAXPRN_GLONASS;
142 _masterMissingEpochs['R'] = 0;
143 }
144 _useGal = (Qt::CheckState(settings.value("cmbGal").toInt()) == Qt::Checked) ? true : false;
145 if (_useGal) {
146 _cmbSysPrn['E'] = t_prn::MAXPRN_GALILEO;
147 _masterMissingEpochs['E'] = 0;
148 }
149 _useBds = (Qt::CheckState(settings.value("cmbBds").toInt()) == Qt::Checked) ? true : false;
150 if (_useBds) {
151 _cmbSysPrn['C'] = t_prn::MAXPRN_BDS;
152 _masterMissingEpochs['C'] = 0;
153 }
154 _useQzss = (Qt::CheckState(settings.value("cmbQzss").toInt()) == Qt::Checked) ? true : false;
155 if (_useQzss) {
156 _cmbSysPrn['J'] = t_prn::MAXPRN_QZSS;
157 _masterMissingEpochs['J'] = 0;
158 }
159 _useSbas = (Qt::CheckState(settings.value("cmbSbas").toInt()) == Qt::Checked) ? true : false;
160 if (_useSbas) {
161 _cmbSysPrn['S'] = t_prn::MAXPRN_SBAS;
162 _masterMissingEpochs['S'] = 0;
163 }
[10619]164 _useNavic = (Qt::CheckState(settings.value("cmbNavic").toInt()) == Qt::Checked) ? true : false;
165 if (_useNavic) {
166 _cmbSysPrn['I'] = t_prn::MAXPRN_NavIC;
[9292]167 _masterMissingEpochs['I'] = 0;
168 }
[4183]169
[7297]170 if (cmbStreams.size() >= 1 && !cmbStreams[0].isEmpty()) {
171 QListIterator<QString> it(cmbStreams);
[2910]172 while (it.hasNext()) {
173 QStringList hlp = it.next().split(" ");
[2918]174 cmbAC* newAC = new cmbAC();
[9821]175 newAC->mountPoint = hlp[0];
176 newAC->name = hlp[1];
177 newAC->weightFactor = hlp[2].toDouble();
[10548]178 newAC->excludeSats = hlp[3].split(QRegExp("[ ,]"), Qt::SkipEmptyParts);
[10451]179 newAC->isAPC = bool(newAC->mountPoint.mid(0,4) == "SSRA");
[9258]180 QMapIterator<char, unsigned> itSys(_cmbSysPrn);
181 // init
182 while (itSys.hasNext()) {
183 itSys.next();
184 char sys = itSys.key();
[10451]185 if (!_masterOrbitAC.contains(sys) &&
186 !newAC->excludeSats.contains(QString(sys), Qt::CaseSensitive)) {
[9258]187 _masterOrbitAC[sys] = newAC->name;
[10116]188 _masterIsAPC[sys] = newAC->isAPC;
[9258]189 }
[3453]190 }
[3429]191 _ACs.append(newAC);
[2910]192 }
193 }
[2927]194
[9025]195 QString ssrFormat;
[9258]196 _ssrCorr = 0;
[9025]197 QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList());
198 while (it.hasNext()) {
199 QStringList hlp = it.next().split(",");
200 if (hlp.size() > 7) {
201 ssrFormat = hlp[7];
202 }
203 }
204 if (ssrFormat == "IGS-SSR") {
205 _ssrCorr = new SsrCorrIgs();
206 }
207 else if (ssrFormat == "RTCM-SSR") {
208 _ssrCorr = new SsrCorrRtcm();
209 }
[10754]210 else if (ssrFormat == "RTCM-NEW-SSR") {
211 _ssrCorr = new SsrCorrRtcmNew();
212 }
[9258]213 else { // default
214 _ssrCorr = new SsrCorrIgs();
215 }
[9025]216
[10311]217 _rtnetDecoder = new bncRtnetDecoder();
[3201]218
[9819]219 connect(this, SIGNAL(newMessage(QByteArray,bool)), BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
220 connect(BNC_CORE, SIGNAL(providerIDChanged(QString)), this, SLOT(slotProviderIDChanged(QString)));
221 connect(BNC_CORE, SIGNAL(newOrbCorrections(QList<t_orbCorr>)), this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)));
222 connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)), this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)));
223 connect(BNC_CORE, SIGNAL(newCodeBiases(QList<t_satCodeBias>)), this, SLOT(slotNewCodeBiases(QList<t_satCodeBias>)));
[10694]224 connect(BNC_CORE, SIGNAL(newPhaseBiases(QList<t_satPhaseBias>)), this, SLOT(slotNewPhaseBiases(QList<t_satPhaseBias>)));
[2933]225
[3470]226 // Combination Method
227 // ------------------
[3481]228 if (settings.value("cmbMethod").toString() == "Single-Epoch") {
229 _method = singleEpoch;
[3470]230 }
231 else {
[3481]232 _method = filter;
[3470]233 }
[3032]234
235 // Initialize Parameters (model: Clk_Corr = AC_Offset + Sat_Offset + Clk)
236 // ----------------------------------------------------------------------
[3470]237 if (_method == filter) {
[9258]238 // SYSTEM
239 QMapIterator<char, unsigned> itSys(_cmbSysPrn);
240 while (itSys.hasNext()) {
241 itSys.next();
242 int nextPar = 0;
243 char sys = itSys.key();
[10599]244 int maxPrn = itSys.value();
[9258]245 // AC
246 QListIterator<cmbAC*> itAc(_ACs);
247 while (itAc.hasNext()) {
248 cmbAC* AC = itAc.next();
249 _params[sys].push_back(new cmbParam(cmbParam::offACgnss, ++nextPar, AC->name, ""));
[10599]250 for (int iGnss = 1; iGnss <= maxPrn; iGnss++) {
251 int flag = t_corrSSR::getSsrNavTypeFlag(sys, iGnss);
[9258]252 QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag);
253 _params[sys].push_back(new cmbParam(cmbParam::offACSat, ++nextPar, AC->name, prn));
[3483]254 }
255 }
[10599]256 for (int iGnss = 1; iGnss <= maxPrn; iGnss++) {
257 int flag = t_corrSSR::getSsrNavTypeFlag(sys, iGnss);
[9258]258 QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag);
259 _params[sys].push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
[3483]260 }
[9258]261 // Initialize Variance-Covariance Matrix
262 // -------------------------------------
263 _QQ[sys].ReSize(_params[sys].size());
264 _QQ[sys] = 0.0;
265 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
266 cmbParam* pp = _params[sys][iPar-1];
267 _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
268 }
[3483]269 }
[2991]270 }
[2933]271
[3052]272 // ANTEX File
273 // ----------
274 _antex = 0;
[6667]275 QString antexFileName = settings.value("uploadAntexFile").toString();
[3052]276 if (!antexFileName.isEmpty()) {
277 _antex = new bncAntex();
278 if (_antex->readFile(antexFileName) != success) {
[10519]279 emit newMessage("bncComb: wrong ANTEX file", true);
[3052]280 delete _antex;
281 _antex = 0;
282 }
283 }
[3138]284
[9676]285
286 // Bias SINEX File
287 // ---------------
288 _bsx = 0;
289 QString bsxFileName = settings.value("cmbBsxFile").toString();
290 if (!bsxFileName.isEmpty()) {
291 _bsx = new bncBiasSnx();
292 if (_bsx->readFile(bsxFileName) != success) {
[9695]293 emit newMessage("bncComb: wrong Bias SINEX file", true);
[9676]294 delete _bsx;
295 _bsx = 0;
296 }
297 }
298 if (_bsx) {
[10227]299 _ms = 3.0 * 3600 * 1000.0;
[9695]300 QTimer::singleShot(_ms, this, SLOT(slotReadBiasSnxFile()));
[9676]301 }
302
[3329]303 // Maximal Residuum
304 // ----------------
[10451]305 _MAX_RES = settings.value("cmbMaxres").toDouble();
306 if (_MAX_RES <= 0.0) {
307 _MAX_RES = 999.0;
[3329]308 }
[10451]309
310 // Maximal Displacement
311 // --------------------
312 _MAX_DISPLACEMENT = settings.value("cmbMaxdisplacement").toDouble();
313 if (_MAX_DISPLACEMENT <= 0.0) {
314 _MAX_DISPLACEMENT = 2.0;
315 }
316
[10479]317 // Logfile
318 // -------
319 QString intr = "1 day";
320 QString logFileCmb = settings.value("cmbLogpath").toString();
321 int l = logFileCmb.length();
322 if (logFileCmb.isEmpty()) {
323 _logFile = 0;
324 }
325 else {
326 if (l && logFileCmb[l-1] != QDir::separator() ) {
327 logFileCmb += QDir::separator();
328 }
329
330 logFileCmb = logFileCmb + "COMB00BNC" + "${V3PROD}" + ".CMB";
331
332 _logFile = new bncoutf(logFileCmb, intr, _cmbSampl);
333 }
334
[10227]335 _newCorr = 0;
[2898]336}
337
338// Destructor
339////////////////////////////////////////////////////////////////////////////
340bncComb::~bncComb() {
[10221]341
[10227]342 _running = false;
[10275]343#ifndef WIN32
[10227]344 sleep(2);
[10275]345#else
346 Sleep(2000);
347#endif
[10227]348
[3429]349 QListIterator<cmbAC*> icAC(_ACs);
350 while (icAC.hasNext()) {
351 delete icAC.next();
[2918]352 }
[10235]353 _ACs.clear();
[10216]354
[3201]355 delete _rtnetDecoder;
[10216]356
[9025]357 if (_ssrCorr) {
358 delete _ssrCorr;
[10221]359 }
[10216]360
[10227]361 if (_newCorr) {
362 delete _newCorr;
363 }
364
[3052]365 delete _antex;
[9676]366 delete _bsx;
[10479]367 delete _logFile;
[10038]368
[9258]369 QMapIterator<char, unsigned> itSys(_cmbSysPrn);
370 while (itSys.hasNext()) {
371 itSys.next();
372 char sys = itSys.key();
373 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
374 delete _params[sys][iPar-1];
375 }
[10038]376 _buffer.remove(sys);
[3296]377 }
[10229]378 _params.clear();
379 _buffer.clear();
[10227]380 _cmbSysPrn.clear();
[10216]381
[10038]382 while (!_epoClkData.empty()) {
383 delete _epoClkData.front();
384 _epoClkData.pop_front();
385 }
[2898]386}
387
[9676]388void bncComb::slotReadBiasSnxFile() {
389 bncSettings settings;
390 QString bsxFileName = settings.value("cmbBsxFile").toString();
[9695]391
392 if (bsxFileName.isEmpty()) {
393 emit newMessage("bncComb: no Bias SINEX file specified", true);
394 return;
395 }
396 if (!_bsx) {
[9676]397 _bsx = new bncBiasSnx();
398 }
399 if (_bsx->readFile(bsxFileName) != success) {
[9695]400 emit newMessage("bncComb: wrong Bias SINEX file", true);
[9676]401 delete _bsx;
402 _bsx = 0;
403 }
404 else {
[9695]405 emit newMessage("bncComb: successfully read Bias SINEX file", true);
[9676]406 }
[9710]407
[9695]408 QTimer::singleShot(_ms, this, SLOT(slotReadBiasSnxFile()));
[9676]409}
410
411
[6155]412// Remember orbit corrections
[2898]413////////////////////////////////////////////////////////////////////////////
[6155]414void bncComb::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) {
[2906]415 QMutexLocker locker(&_mutex);
[6155]416 for (int ii = 0; ii < orbCorrections.size(); ii++) {
417 t_orbCorr& orbCorr = orbCorrections[ii];
418 QString staID(orbCorr._staID.c_str());
[9296]419 char sys = orbCorr._prn.system();
[6155]420
[9296]421 if (!_cmbSysPrn.contains(sys)){
422 continue;
423 }
424
[6155]425 // Find/Check the AC Name
426 // ----------------------
427 QString acName;
[10451]428 QStringList excludeSats;
[6155]429 QListIterator<cmbAC*> icAC(_ACs);
430 while (icAC.hasNext()) {
431 cmbAC* AC = icAC.next();
432 if (AC->mountPoint == staID) {
[10611]433 acName = AC->name;
[10451]434 excludeSats = AC->excludeSats;
[6155]435 break;
436 }
[3431]437 }
[10451]438 if (acName.isEmpty() || excludeSat(orbCorr._prn, excludeSats)) {
[6155]439 continue;
440 }
[3431]441
[6155]442 // Store the correction
443 // --------------------
[10216]444 QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
445 storage[orbCorr._prn] = orbCorr;
[2913]446 }
[6155]447}
[2913]448
[9676]449// Remember Satellite Code Biases
[9529]450////////////////////////////////////////////////////////////////////////////
[9530]451void bncComb::slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases) {
[9529]452 QMutexLocker locker(&_mutex);
453
[9530]454 for (int ii = 0; ii < satCodeBiases.size(); ii++) {
455 t_satCodeBias& satCodeBias = satCodeBiases[ii];
456 QString staID(satCodeBias._staID.c_str());
457 char sys = satCodeBias._prn.system();
[9529]458
459 if (!_cmbSysPrn.contains(sys)){
460 continue;
461 }
462
463 // Find/Check the AC Name
464 // ----------------------
465 QString acName;
[10451]466 QStringList excludeSats;
[9529]467 QListIterator<cmbAC*> icAC(_ACs);
468 while (icAC.hasNext()) {
469 cmbAC* AC = icAC.next();
470 if (AC->mountPoint == staID) {
[10611]471 acName = AC->name;
[10451]472 excludeSats = AC->excludeSats;
[9529]473 break;
474 }
475 }
[10451]476 if (acName.isEmpty() || excludeSat(satCodeBias._prn, excludeSats)) {
[9529]477 continue;
478 }
479
480 // Store the correction
481 // --------------------
[10216]482 QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
483 storage[satCodeBias._prn] = satCodeBias;
[9529]484 }
[10694]485 return;
486}
[10229]487
[10694]488// Remember Satellite Phase Biases
489////////////////////////////////////////////////////////////////////////////
490void bncComb::slotNewPhaseBiases(QList<t_satPhaseBias> satPhaseBiases) {
491 QMutexLocker locker(&_mutex);
492
493 for (int ii = 0; ii < satPhaseBiases.size(); ii++) {
494 t_satPhaseBias& satPhaseBias = satPhaseBiases[ii];
495 QString staID(satPhaseBias._staID.c_str());
496 char sys = satPhaseBias._prn.system();
497
498 if (!_cmbSysPrn.contains(sys)){
499 continue;
500 }
501
502 // Find/Check the AC Name
503 // ----------------------
504 QString acName;
505 QStringList excludeSats;
506 QListIterator<cmbAC*> icAC(_ACs);
507 while (icAC.hasNext()) {
508 cmbAC* AC = icAC.next();
509 if (AC->mountPoint == staID) {
510 acName = AC->name;
511 excludeSats = AC->excludeSats;
512 break;
513 }
514 }
515 if (acName.isEmpty() || excludeSat(satPhaseBias._prn, excludeSats)) {
516 continue;
517 }
518
519 // Store the correction
520 // --------------------
521 QMap<t_prn, t_satPhaseBias>& storage = _satPhaseBiases[acName];
522 storage[satPhaseBias._prn] = satPhaseBias;
523 }
524 return;
[9529]525}
526
[10694]527
[6155]528// Process clock corrections
529////////////////////////////////////////////////////////////////////////////
530void bncComb::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) {
531 QMutexLocker locker(&_mutex);
[10243]532 const double outWait = 1.0 * _cmbSampl;
[10081]533 int currentWeek = 0;
534 double currentSec = 0.0;
535 currentGPSWeeks(currentWeek, currentSec);
536 bncTime currentTime(currentWeek, currentSec);
[6155]537
[10038]538 // Loop over all observations (possible different epochs)
539 // -----------------------------------------------------
[6155]540 for (int ii = 0; ii < clkCorrections.size(); ii++) {
[10225]541 t_clkCorr& newClk = clkCorrections[ii];
542 char sys = newClk._prn.system();
[9296]543 if (!_cmbSysPrn.contains(sys)){
544 continue;
545 }
546
[10038]547 // Check Modulo Time
[6155]548 // -----------------
[10225]549 int sec = int(nint(newClk._time.gpssec()*10));
[10038]550 if (sec % (_cmbSampl*10) != 0.0) {
551 continue;
[3483]552 }
553
[6155]554 // Find/Check the AC Name
555 // ----------------------
556 QString acName;
[10451]557 QStringList excludeSats;
[10116]558 bool isAPC;
[10225]559 QString staID(newClk._staID.c_str());
[6155]560 QListIterator<cmbAC*> icAC(_ACs);
561 while (icAC.hasNext()) {
562 cmbAC* AC = icAC.next();
563 if (AC->mountPoint == staID) {
[10611]564 acName = AC->name;
565 excludeSats = AC->excludeSats;
566 isAPC = AC->isAPC;
[6155]567 break;
568 }
[3588]569 }
[10451]570 if (acName.isEmpty() ||
571 isAPC != _masterIsAPC[sys] ||
572 excludeSat(newClk._prn, excludeSats)) {
[6155]573 continue;
574 }
[3588]575
[10098]576 // Check regarding current time
577 // ----------------------------
[10192]578 if (BNC_CORE->mode() != t_bncCore::batchPostProcessing) {
[10610]579 if (fabs(currentTime - newClk._time) > 60.0) { // future or very old data sets
[10482]580 #ifdef BNC_DEBUG_CMB
[10225]581 emit newMessage("bncComb: future or very old data sets: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
582 QString(" %1 ").arg(newClk._time.timestr().c_str()).toLatin1() + "vs. current time" +
[10192]583 QString(" %1 ").arg(currentTime.timestr().c_str()).toLatin1(), true);
[10482]584 #endif
[10192]585 continue;
586 }
[10098]587 }
588
[6155]589 // Check Correction Age
590 // --------------------
[10225]591 if (_resTime.valid() && newClk._time <= _resTime) {
[10482]592#ifdef BNC_DEBUG_CMB
[10225]593 emit newMessage("bncComb: old correction: " + acName.toLatin1() + " " + newClk._prn.toString().c_str() +
594 QString(" %1 ").arg(newClk._time.timestr().c_str()).toLatin1() + "vs. last processing Epoch" +
[10042]595 QString(" %1 ").arg(_resTime.timestr().c_str()).toLatin1(), true);
[10482]596#endif
[6155]597 continue;
598 }
[7297]599
[10153]600 // Set the last time
601 // -----------------
[10225]602 if (_lastClkCorrTime.undef() || newClk._time > _lastClkCorrTime) {
603 _lastClkCorrTime = newClk._time;
[10153]604 }
605
[10038]606 // Find the corresponding data epoch or create a new one
607 // -----------------------------------------------------
608 epoClkData* epoch = 0;
609 deque<epoClkData*>::const_iterator it;
610 for (it = _epoClkData.begin(); it != _epoClkData.end(); it++) {
[10225]611 if (newClk._time == (*it)->_time) {
[10038]612 epoch = *it;
613 break;
614 }
615 }
616 if (epoch == 0) {
[10225]617 if (_epoClkData.empty() || newClk._time > _epoClkData.back()->_time) {
[10038]618 epoch = new epoClkData;
[10225]619 epoch->_time = newClk._time;
[10038]620 _epoClkData.push_back(epoch);
621 }
622 }
623
624 // Put data into the epoch
625 // -----------------------
626 if (epoch != 0) {
627 epoch->_clkCorr.push_back(newClk);
628 }
629 }
630
631 // Make sure the buffer does not grow beyond any limit
632 // ---------------------------------------------------
[10200]633 const unsigned MAX_EPODATA_SIZE = 60.0 / _cmbSampl;
[10038]634 if (_epoClkData.size() > MAX_EPODATA_SIZE) {
635 delete _epoClkData.front();
636 _epoClkData.pop_front();
637 }
638
639 // Process the oldest epochs
640 // ------------------------
641 while (_epoClkData.size()) {
642
[10042]643 if (!_lastClkCorrTime.valid()) {
[10038]644 return;
645 }
646
[10225]647 const vector<t_clkCorr>& clkCorrVec = _epoClkData.front()->_clkCorr;
[10038]648
649 bncTime epoTime = _epoClkData.front()->_time;
650
[10200]651 if (BNC_CORE->mode() != t_bncCore::batchPostProcessing) {
[10245]652 if ((currentTime - epoTime) > 60.0) {
[10200]653 delete _epoClkData.front();
654 _epoClkData.pop_front();
655 continue;
656 }
[10043]657 }
[10038]658 // Process the front epoch
659 // -----------------------
[10243]660 if (epoTime < (_lastClkCorrTime - outWait)) {
[10042]661 _resTime = epoTime;
662 processEpoch(_resTime, clkCorrVec);
[10038]663 delete _epoClkData.front();
664 _epoClkData.pop_front();
665 }
666 else {
667 return;
668 }
669 }
670}
671
672// Change the correction so that it refers to last received ephemeris
673////////////////////////////////////////////////////////////////////////////
674void bncComb::switchToLastEph(t_eph* lastEph, cmbCorr* corr) {
675
676 if (corr->_eph == lastEph) {
677 return;
678 }
679
680 ColumnVector oldXC(6);
681 ColumnVector oldVV(3);
682 if (corr->_eph->getCrd(corr->_time, oldXC, oldVV, false) != success) {
683 return;
684 }
685
686 ColumnVector newXC(6);
687 ColumnVector newVV(3);
688 if (lastEph->getCrd(corr->_time, newXC, newVV, false) != success) {
689 return;
690 }
691
692 ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
693 ColumnVector dV = newVV - oldVV;
694 double dC = newXC(4) - oldXC(4);
695
696 ColumnVector dRAO(3);
697 XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
698
699 ColumnVector dDotRAO(3);
700 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
701
[10519]702 QString msg = "bncComb: switch corr " + corr->_prn.mid(0,3)
[10038]703 + QString(" %1 -> %2 %3").arg(corr->_iod,3).arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
704
705 emit newMessage(msg.toLatin1(), false);
706
707 corr->_iod = lastEph->IOD();
708 corr->_eph = lastEph;
709
[10216]710 corr->_orbCorr._xr += dRAO;
711 corr->_orbCorr._dotXr += dDotRAO;
[10225]712 corr->_clkCorr._dClk -= dC;
[10038]713}
714
715// Process Epoch
716////////////////////////////////////////////////////////////////////////////
[10225]717void bncComb::processEpoch(bncTime epoTime, const vector<t_clkCorr>& clkCorrVec) {
[10330]718 QDateTime now = currentDateAndTimeGPS();
719 bncTime currentTime(now.toString(Qt::ISODate).toStdString());
[10038]720 for (unsigned ii = 0; ii < clkCorrVec.size(); ii++) {
[10225]721 const t_clkCorr& clkCorr = clkCorrVec[ii];
722 QString staID(clkCorr._staID.c_str());
[10599]723 QString prnStr(clkCorr._prn.toInternalString().c_str());
[10225]724 char sys = clkCorr._prn.system();
[10038]725
726 // Find/Check the AC Name
727 // ----------------------
728 QString acName;
729 double weigthFactor;
730 QListIterator<cmbAC*> icAC(_ACs);
731 while (icAC.hasNext()) {
732 cmbAC* AC = icAC.next();
733 if (AC->mountPoint == staID) {
[10611]734 acName = AC->name;
[10038]735 weigthFactor = AC->weightFactor;
736 break;
737 }
738 }
739
[6155]740 // Create new correction
741 // ---------------------
[10229]742 _newCorr = new cmbCorr();
[10599]743 _newCorr->_prn = prnStr;
[10227]744 _newCorr->_time = clkCorr._time;
745 _newCorr->_iod = clkCorr._iod;
746 _newCorr->_acName = acName;
747 _newCorr->_weightFactor = weigthFactor;
748 _newCorr->_clkCorr = clkCorr;
[6155]749
[6156]750 // Check orbit correction
751 // ----------------------
752 if (!_orbCorrections.contains(acName)) {
[10227]753 delete _newCorr; _newCorr = 0;
[6156]754 continue;
755 }
756 else {
[10216]757 QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
[10225]758 if (!storage.contains(clkCorr._prn) ||
[10227]759 storage[clkCorr._prn]._iod != _newCorr->_iod) {
760 delete _newCorr; _newCorr = 0;
[6156]761 continue;
762 }
763 else {
[10227]764 _newCorr->_orbCorr = storage[clkCorr._prn];
[6156]765 }
766 }
767
[6155]768 // Check the Ephemeris
769 //--------------------
[10599]770 t_eph* ephLast = _ephUser.ephLast(prnStr);
771 t_eph* ephPrev = _ephUser.ephPrev(prnStr);
[6443]772 if (ephLast == 0) {
[10481]773#ifdef BNC_DEBUG_CMB
[10599]774 emit newMessage("bncComb: eph not found for " + prnStr.mid(0,3).toLatin1(), true);
[10481]775#endif
[10227]776 delete _newCorr; _newCorr = 0;
[6155]777 continue;
[2986]778 }
[10330]779 else if (outDatedBcep(ephLast, currentTime) ||
780 ephLast->checkState() == t_eph::bad ||
[9268]781 ephLast->checkState() == t_eph::outdated ||
782 ephLast->checkState() == t_eph::unhealthy) {
[10482]783#ifdef BNC_DEBUG_CMB
[10599]784 emit newMessage("bncComb: ephLast not ok (checkState: " + ephLast->checkStateToString().toLatin1() + ") for " + prnStr.mid(0,3).toLatin1(), true);
[10482]785#endif
[10227]786 delete _newCorr; _newCorr = 0;
[9266]787 continue;
788 }
[3029]789 else {
[10227]790 if (ephLast->IOD() == _newCorr->_iod) {
791 _newCorr->_eph = ephLast;
[6155]792 }
[10330]793 else if (ephPrev &&
794 !outDatedBcep(ephPrev, currentTime) && // if not updated in storage
795 ephPrev->checkState() == t_eph::ok && // received
[10227]796 ephPrev->IOD() == _newCorr->_iod) {
797 _newCorr->_eph = ephPrev;
798 switchToLastEph(ephLast, _newCorr);
[6155]799 }
800 else {
[10481]801#ifdef BNC_DEBUG_CMB
[10599]802 emit newMessage("bncComb: eph not found for " + prnStr.mid(0,3).toLatin1() +
[10227]803 QString(" with IOD %1").arg(_newCorr->_iod).toLatin1(), true);
[10481]804#endif
[10227]805 delete _newCorr; _newCorr = 0;
[6155]806 continue;
807 }
[2986]808 }
[6155]809
[9635]810 // Check satellite code biases
811 // ----------------------------
[9819]812 if (_satCodeBiases.contains(acName)) {
[10216]813 QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
[10225]814 if (storage.contains(clkCorr._prn)) {
[10227]815 _newCorr->_satCodeBias = storage[clkCorr._prn];
[9676]816 QMap<t_frequency::type, double> codeBiasesRefSig;
817 for (unsigned ii = 1; ii < cmbRefSig::cIF; ii++) {
[10038]818 t_frequency::type frqType = cmbRefSig::toFreq(sys, static_cast<cmbRefSig::type>(ii));
[9635]819 char frqNum = t_frequency::toString(frqType)[1];
[10038]820 char attrib = cmbRefSig::toAttrib(sys, static_cast<cmbRefSig::type>(ii));
[9676]821 QString rnxType2ch = QString("%1%2").arg(frqNum).arg(attrib);
[10227]822 for (unsigned ii = 0; ii < _newCorr->_satCodeBias._bias.size(); ii++) {
823 const t_frqCodeBias& bias = _newCorr->_satCodeBias._bias[ii];
[9676]824 if (rnxType2ch.toStdString() == bias._rnxType2ch) {
825 codeBiasesRefSig[frqType] = bias._value;
[9635]826 }
827 }
828 }
[10694]829 map<t_frequency::type, double> codeCoeff;
830 double channel = double(_newCorr->_eph->slotNum());
831 cmbRefSig::coeff(sys, cmbRefSig::cIF, channel, codeCoeff);
832 map<t_frequency::type, double>::const_iterator it;
833 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
834 t_frequency::type frqType = it->first;
835 double codeCoeff = it->second;
836 _newCorr->_satCodeBiasIF += codeCoeff * codeBiasesRefSig[frqType];
[9676]837 }
[10227]838 _newCorr->_satCodeBias._bias.clear();
[9635]839 }
840 }
841
[10694]842 // Check satellite phase biases
843 // ----------------------------
844 if (_satPhaseBiases.contains(acName)) {
845 QMap<t_prn, t_satPhaseBias>& storage = _satPhaseBiases[acName];
846 if (storage.contains(clkCorr._prn)) {
847 // Yaw angle
848 t_satPhaseBias& pb = storage[clkCorr._prn];
849 double dt = _newCorr->_time - pb._time;
850 if (pb._updateInt) {
851 dt -= (0.5 * ssrUpdateInt[pb._updateInt]);
852 }
853 _newCorr->_satYawAngle = pb._yaw + pb._yawRate * dt;
854
855 // _lambdaIF
856 map<t_frequency::type, double> codeCoeff;
857 double channel = double(_newCorr->_eph->slotNum());
858 cmbRefSig::coeff(sys, cmbRefSig::cIF, channel, codeCoeff);
859 map<t_frequency::type, double>::const_iterator it;
860 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
861 t_frequency::type frqType = it->first;
862 double codeCoeff = it->second;
863 _newCorr->_lambdaIF += codeCoeff * t_CST::c / t_CST::freq(frqType, channel);
864 }
865 }
866 }
867
[6155]868 // Store correction into the buffer
869 // --------------------------------
[10038]870 QVector<cmbCorr*>& corrs = _buffer[sys].corrs;
871 QVectorIterator<cmbCorr*> itCorr(corrs);
872 bool available = false;
873 while (itCorr.hasNext()) {
[10599]874 cmbCorr* corr = itCorr.next();
875 QString prnStr = corr->_prn;
[10038]876 QString acName = corr->_acName;
[10229]877 if (_newCorr->_acName == acName &&
[10599]878 _newCorr->_prn == prnStr) {
[10038]879 available = true;
880 }
881 }
[10227]882
[10038]883 if (!available) {
[10227]884 corrs.push_back(_newCorr); _newCorr = 0;
[10038]885 }
886 else {
[10227]887 delete _newCorr; _newCorr = 0;
[10038]888 continue;
889 }
[2986]890 }
891
[10038]892 // Process Systems of this Epoch
893 // ------------------------------
[9258]894 QMapIterator<char, unsigned> itSys(_cmbSysPrn);
895 while (itSys.hasNext()) {
896 itSys.next();
897 char sys = itSys.key();
[10038]898 _log.clear();
899 QTextStream out(&_log, QIODevice::WriteOnly);
900 processSystem(epoTime, sys, out);
[10224]901 _buffer.remove(sys);
[10479]902 if (_logFile) {
903 _logFile->write(epoTime.gpsw(),epoTime.gpssec(), QString(_log));
904 }
[2927]905 }
[2898]906}
907
[10038]908void bncComb::processSystem(bncTime epoTime, char sys, QTextStream& out) {
[3028]909
[10481]910 out << "\n"
911 << epoTime.datestr().c_str() << " "
912 << epoTime.timestr().c_str() << " "
913 << "Combination: " << sys << "\n"
914 << "--------------------------------------" << "\n";
[2990]915
[3433]916 // Observation Statistics
917 // ----------------------
[3455]918 bool masterPresent = false;
[3433]919 QListIterator<cmbAC*> icAC(_ACs);
920 while (icAC.hasNext()) {
921 cmbAC* AC = icAC.next();
[9258]922 AC->numObs[sys] = 0;
923 QVectorIterator<cmbCorr*> itCorr(corrs(sys));
[3433]924 while (itCorr.hasNext()) {
925 cmbCorr* corr = itCorr.next();
[6157]926 if (corr->_acName == AC->name) {
[9258]927 AC->numObs[sys] += 1;
928 if (AC->name == _masterOrbitAC[sys]) {
[3453]929 masterPresent = true;
930 }
[3433]931 }
932 }
[10481]933 out << epoTime.datestr().c_str() << " "
934 << epoTime.timestr().c_str() << " "
[10486]935 << "Sat Num " << sys << " "
[10481]936 << AC->name.toLatin1().data() << ": " << AC->numObs[sys] << "\n";
[3433]937 }
938
[3453]939 // If Master not present, switch to another one
940 // --------------------------------------------
[4889]941 const unsigned switchMasterAfterGap = 1;
[3456]942 if (masterPresent) {
[9258]943 _masterMissingEpochs[sys] = 0;
[3456]944 }
945 else {
[9258]946 ++_masterMissingEpochs[sys];
947 if (_masterMissingEpochs[sys] < switchMasterAfterGap) {
[9635]948 out << "Missing Master, Epoch skipped" << "\n";
[10038]949 _buffer.remove(sys);
[3455]950 emit newMessage(_log, false);
951 return;
[3453]952 }
[3455]953 else {
[9258]954 _masterMissingEpochs[sys] = 0;
[3455]955 QListIterator<cmbAC*> icAC(_ACs);
956 while (icAC.hasNext()) {
957 cmbAC* AC = icAC.next();
[9258]958 if (AC->numObs[sys] > 0) {
[10486]959 out << epoTime.datestr().c_str() << " "
960 << epoTime.timestr().c_str() << " "
961 << "Switching Master " << sys << " "
[9258]962 << _masterOrbitAC[sys].toLatin1().data() << " --> "
[10481]963 << AC->name.toLatin1().data() << "\n";
[9258]964 _masterOrbitAC[sys] = AC->name;
[10116]965 _masterIsAPC[sys] = AC->isAPC;
[3455]966 break;
967 }
[3452]968 }
969 }
970 }
971
[10694]972 QMap<QString, cmbCorr*> masterCorr;
[3472]973
974 // Perform the actual Combination using selected Method
975 // ----------------------------------------------------
976 t_irc irc;
[3475]977 ColumnVector dx;
[3472]978 if (_method == filter) {
[10694]979 irc = processEpoch_filter(epoTime, sys, out, masterCorr, dx);
[3472]980 }
981 else {
[10694]982 irc = processEpoch_singleEpoch(epoTime, sys, out, masterCorr, dx);
[3472]983 }
[10230]984
[3475]985 // Update Parameter Values, Print Results
986 // --------------------------------------
[3472]987 if (irc == success) {
[9258]988 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
989 cmbParam* pp = _params[sys][iPar-1];
[3475]990 pp->xx += dx(iPar);
991 if (pp->type == cmbParam::clkSat) {
[10694]992 if (masterCorr.find(pp->prn) != masterCorr.end()) {
[9676]993 // set clock result
[10694]994 masterCorr[pp->prn]->_dClkResult = pp->xx / t_CST::c;
[9676]995 // Add Code Biases from SINEX File
996 if (_bsx) {
997 map<t_frequency::type, double> codeCoeff;
[10694]998 double channel = double(masterCorr[pp->prn]->_eph->slotNum());
[9676]999 cmbRefSig::coeff(sys, cmbRefSig::cIF, channel, codeCoeff);
1000 t_frequency::type fType1 = cmbRefSig::toFreq(sys, cmbRefSig::c1);
1001 t_frequency::type fType2 = cmbRefSig::toFreq(sys, cmbRefSig::c2);
[10694]1002 _bsx->determineSsrSatCodeBiases(pp->prn.mid(0,3), codeCoeff[fType1], codeCoeff[fType2], masterCorr[pp->prn]->_satCodeBias);
[9676]1003 }
[3475]1004 }
1005 }
[10038]1006 out << epoTime.datestr().c_str() << " "
1007 << epoTime.timestr().c_str() << " ";
[3475]1008 out.setRealNumberNotation(QTextStream::FixedNotation);
1009 out.setFieldWidth(8);
1010 out.setRealNumberPrecision(4);
[9258]1011 out << pp->toString(sys) << " "
[9635]1012 << pp->xx << " +- " << sqrt(_QQ[sys](pp->index,pp->index)) << "\n";
[3475]1013 out.setFieldWidth(0);
[10490]1014 out.flush();
[3475]1015 }
[10694]1016 printResults(epoTime, out, masterCorr);
1017 dumpResults(epoTime, masterCorr);
[3472]1018 }
1019}
1020
1021// Process Epoch - Filter Method
1022////////////////////////////////////////////////////////////////////////////
[10038]1023t_irc bncComb::processEpoch_filter(bncTime epoTime, char sys, QTextStream& out,
[10694]1024 QMap<QString, cmbCorr*>& masterCorr,
[3475]1025 ColumnVector& dx) {
[10494]1026
[3429]1027 // Prediction Step
1028 // ---------------
[9258]1029 int nPar = _params[sys].size();
[2933]1030 ColumnVector x0(nPar);
[9258]1031 for (int iPar = 1; iPar <= nPar; iPar++) {
1032 cmbParam* pp = _params[sys][iPar-1];
[3455]1033 if (pp->epoSpec) {
[3451]1034 pp->xx = 0.0;
[9258]1035 _QQ[sys].Row(iPar) = 0.0;
1036 _QQ[sys].Column(iPar) = 0.0;
1037 _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
[3451]1038 }
[3455]1039 else {
[9258]1040 _QQ[sys](iPar,iPar) += pp->sigP * pp->sigP;
[3455]1041 }
[2933]1042 x0(iPar) = pp->xx;
1043 }
1044
[3487]1045 // Check Satellite Positions for Outliers
1046 // --------------------------------------
[10694]1047 if (checkOrbits(epoTime, sys, out, masterCorr) != success) {
[3487]1048 return failure;
1049 }
[3441]1050
[3455]1051 // Update and outlier detection loop
1052 // ---------------------------------
[9258]1053 SymmetricMatrix QQ_sav = _QQ[sys];
[10227]1054 while (_running) {
[3135]1055
[3455]1056 Matrix AA;
1057 ColumnVector ll;
1058 DiagonalMatrix PP;
[3429]1059
[10694]1060 if (createAmat(sys, AA, ll, PP, x0) != success) {
[3472]1061 return failure;
[3441]1062 }
[2933]1063
[6169]1064 dx.ReSize(nPar); dx = 0.0;
[9258]1065 kalman(AA, ll, PP, _QQ[sys], dx);
[6164]1066
[3429]1067 ColumnVector vv = ll - AA * dx;
[3080]1068
[3429]1069 int maxResIndex;
[7297]1070 double maxRes = vv.maximum_absolute_value1(maxResIndex);
[3429]1071 out.setRealNumberNotation(QTextStream::FixedNotation);
[7297]1072 out.setRealNumberPrecision(3);
[10038]1073 out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
[3432]1074 << " Maximum Residuum " << maxRes << ' '
[9258]1075 << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
[10497]1076 if (maxRes > _MAX_RES) {
[9258]1077 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
1078 cmbParam* pp = _params[sys][iPar-1];
[7297]1079 if (pp->type == cmbParam::offACSat &&
[9258]1080 pp->AC == corrs(sys)[maxResIndex-1]->_acName &&
1081 pp->prn == corrs(sys)[maxResIndex-1]->_prn.mid(0,3)) {
[3432]1082 QQ_sav.Row(iPar) = 0.0;
1083 QQ_sav.Column(iPar) = 0.0;
[3455]1084 QQ_sav(iPar,iPar) = pp->sig0 * pp->sig0;
[3432]1085 }
1086 }
1087
[9635]1088 out << " Outlier" << "\n";
[9258]1089 _QQ[sys] = QQ_sav;
[10230]1090 delete corrs(sys)[maxResIndex-1];
[9258]1091 corrs(sys).remove(maxResIndex-1);
[3432]1092 }
1093 else {
[9635]1094 out << " OK" << "\n";
[6330]1095 out.setRealNumberNotation(QTextStream::FixedNotation);
1096 out.setRealNumberPrecision(4);
[9258]1097 for (int ii = 0; ii < corrs(sys).size(); ii++) {
1098 const cmbCorr* corr = corrs(sys)[ii];
[10038]1099 out << epoTime.datestr().c_str() << ' '
1100 << epoTime.timestr().c_str() << " "
[6962]1101 << corr->_acName << ' ' << corr->_prn.mid(0,3);
[6330]1102 out.setFieldWidth(10);
[9635]1103 out << " res = " << vv[ii] << "\n";
[6330]1104 out.setFieldWidth(0);
1105 }
[3432]1106 break;
1107 }
1108 }
1109
[3472]1110 return success;
[2918]1111}
[3011]1112
[3201]1113// Print results
[3011]1114////////////////////////////////////////////////////////////////////////////
[10038]1115void bncComb::printResults(bncTime epoTime, QTextStream& out,
[10694]1116 const QMap<QString, cmbCorr*>& masterCorr) {
[3011]1117
[10694]1118 QMapIterator<QString, cmbCorr*> it(masterCorr);
[3011]1119 while (it.hasNext()) {
1120 it.next();
[6157]1121 cmbCorr* corr = it.value();
1122 const t_eph* eph = corr->_eph;
[3015]1123 if (eph) {
[8542]1124 ColumnVector xc(6);
[6109]1125 ColumnVector vv(3);
[10038]1126 if (eph->getCrd(epoTime, xc, vv, false) != success) {
[9268]1127 continue;
1128 }
[10038]1129 out << epoTime.datestr().c_str() << " "
1130 << epoTime.timestr().c_str() << " ";
[3015]1131 out.setFieldWidth(3);
[6962]1132 out << "Full Clock " << corr->_prn.mid(0,3) << " " << corr->_iod << " ";
[3015]1133 out.setFieldWidth(14);
[9635]1134 out << (xc(4) + corr->_dClkResult) * t_CST::c << "\n";
[3370]1135 out.setFieldWidth(0);
[10490]1136 out.flush();
[3015]1137 }
1138 else {
[9691]1139 out << "bncComb::printResults bug" << "\n";
[3015]1140 }
[3011]1141 }
1142}
[3202]1143
1144// Send results to RTNet Decoder and directly to PPP Client
1145////////////////////////////////////////////////////////////////////////////
[10694]1146void bncComb::dumpResults(bncTime epoTime, QMap<QString, cmbCorr*>& masterCorr) {
[3202]1147
[6161]1148 QList<t_orbCorr> orbCorrections;
1149 QList<t_clkCorr> clkCorrections;
[9676]1150 QList<t_satCodeBias> satCodeBiasList;
[10694]1151 QList<t_satPhaseBias> satPhaseBiasList;
[6161]1152
[3214]1153 unsigned year, month, day, hour, minute;
1154 double sec;
[10038]1155 epoTime.civil_date(year, month, day);
1156 epoTime.civil_time(hour, minute, sec);
[3214]1157
[9676]1158 QString outLines = QString().asprintf("* %4d %2d %2d %d %d %12.8f\n",
1159 year, month, day, hour, minute, sec);
[3214]1160
[10694]1161 QMutableMapIterator<QString, cmbCorr*> it(masterCorr);
[3202]1162 while (it.hasNext()) {
1163 it.next();
[6157]1164 cmbCorr* corr = it.value();
[10038]1165
[9676]1166 // ORBIT
[10216]1167 t_orbCorr orbCorr(corr->_orbCorr);
[7013]1168 orbCorr._staID = "INTERNAL";
1169 orbCorrections.push_back(orbCorr);
[10038]1170
[9676]1171 // CLOCK
[10225]1172 t_clkCorr clkCorr(corr->_clkCorr);
[7013]1173 clkCorr._staID = "INTERNAL";
1174 clkCorr._dClk = corr->_dClkResult;
1175 clkCorr._dotDClk = 0.0;
1176 clkCorr._dotDotDClk = 0.0;
1177 clkCorrections.push_back(clkCorr);
[10038]1178
[8542]1179 ColumnVector xc(6);
[4978]1180 ColumnVector vv(3);
[7013]1181 corr->_eph->setClkCorr(dynamic_cast<const t_clkCorr*>(&clkCorr));
1182 corr->_eph->setOrbCorr(dynamic_cast<const t_orbCorr*>(&orbCorr));
[10038]1183 if (corr->_eph->getCrd(epoTime, xc, vv, true) != success) {
[9268]1184 delete corr;
[10229]1185 it.remove();
[9268]1186 continue;
1187 }
[7012]1188
[4978]1189 // Correction Phase Center --> CoM
1190 // -------------------------------
[10153]1191 ColumnVector dx(3); dx = 0.0;
[10116]1192 ColumnVector apc(3); apc = 0.0;
1193 ColumnVector com(3); com = 0.0;
1194 bool masterIsAPC = true;
[4978]1195 if (_antex) {
[10038]1196 double Mjd = epoTime.mjd() + epoTime.daysec()/86400.0;
[10116]1197 char sys = corr->_eph->prn().system();
1198 masterIsAPC = _masterIsAPC[sys];
[6157]1199 if (_antex->satCoMcorrection(corr->_prn, Mjd, xc.Rows(1,3), dx) != success) {
[4992]1200 dx = 0;
[8204]1201 _log += "antenna not found " + corr->_prn.mid(0,3).toLatin1() + '\n';
[3214]1202 }
1203 }
[10116]1204 if (masterIsAPC) {
1205 apc(1) = xc(1);
1206 apc(2) = xc(2);
1207 apc(3) = xc(3);
1208 com(1) = xc(1)-dx(1);
1209 com(2) = xc(2)-dx(2);
1210 com(3) = xc(3)-dx(3);
1211 }
1212 else {
1213 com(1) = xc(1);
1214 com(2) = xc(2);
1215 com(3) = xc(3);
1216 apc(1) = xc(1)+dx(1);
1217 apc(2) = xc(2)+dx(2);
1218 apc(3) = xc(3)+dx(3);
1219 }
[7012]1220
1221 outLines += corr->_prn.mid(0,3);
[10109]1222 QString hlp = QString().asprintf(
1223 " APC 3 %15.4f %15.4f %15.4f"
[9676]1224 " Clk 1 %15.4f"
1225 " Vel 3 %15.4f %15.4f %15.4f"
[10694]1226 " CoM 3 %15.4f %15.4f %15.4f"
1227 " YawAngle %1.4f",
[10116]1228 apc(1), apc(2), apc(3),
[9676]1229 xc(4) * t_CST::c,
1230 vv(1), vv(2), vv(3),
[10694]1231 com(1), com(2), com(3),
1232 corr->_satYawAngle);
[5337]1233 outLines += hlp;
[9676]1234 hlp.clear();
[5337]1235
[10101]1236 // CODE BIASES
[10216]1237 if (corr->_satCodeBias._bias.size()) {
1238 t_satCodeBias satCodeBias(corr->_satCodeBias);
[10101]1239 satCodeBias._staID = "INTERNAL";
1240 satCodeBiasList.push_back(satCodeBias);
[9676]1241 hlp = QString().asprintf(" CodeBias %2lu", satCodeBias._bias.size());
1242 outLines += hlp;
1243 hlp.clear();
1244 for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
1245 const t_frqCodeBias& frqCodeBias = satCodeBias._bias[ii];
1246 if (!frqCodeBias._rnxType2ch.empty()) {
1247 hlp = QString().asprintf(" %s%10.6f", frqCodeBias._rnxType2ch.c_str(), frqCodeBias._value);
1248 outLines += hlp;
1249 hlp.clear();
1250 }
1251 }
1252 }
[10694]1253
[9676]1254 outLines += "\n";
[3214]1255 delete corr;
[10229]1256 it.remove();
[3214]1257 }
1258
[5337]1259 outLines += "EOE\n"; // End Of Epoch flag
[9710]1260 //cout << outLines.toStdString();
[5337]1261
[3215]1262 vector<string> errmsg;
[8204]1263 _rtnetDecoder->Decode(outLines.toLatin1().data(), outLines.length(), errmsg);
[3215]1264
[5861]1265 // Send new Corrections to PPP etc.
1266 // --------------------------------
[6161]1267 if (orbCorrections.size() > 0 && clkCorrections.size() > 0) {
1268 emit newOrbCorrections(orbCorrections);
1269 emit newClkCorrections(clkCorrections);
1270 }
[9676]1271 if (satCodeBiasList.size()) {
1272 emit newCodeBiases(satCodeBiasList);
1273 }
[3202]1274}
[3455]1275
1276// Create First Design Matrix and Vector of Measurements
1277////////////////////////////////////////////////////////////////////////////
[10694]1278t_irc bncComb::createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP, const ColumnVector& x0) {
[3455]1279
[9258]1280 unsigned nPar = _params[sys].size();
1281 unsigned nObs = corrs(sys).size();
[3455]1282
1283 if (nObs == 0) {
1284 return failure;
1285 }
1286
[9258]1287 int maxSat = _cmbSysPrn[sys];
[3455]1288
[9259]1289 const int nCon = (_method == filter) ? 1 + maxSat : 0;
[3483]1290
[3455]1291 AA.ReSize(nObs+nCon, nPar); AA = 0.0;
1292 ll.ReSize(nObs+nCon); ll = 0.0;
1293 PP.ReSize(nObs+nCon); PP = 1.0 / (sigObs * sigObs);
1294
1295 int iObs = 0;
[9258]1296 QVectorIterator<cmbCorr*> itCorr(corrs(sys));
[3455]1297 while (itCorr.hasNext()) {
1298 cmbCorr* corr = itCorr.next();
[6157]1299 QString prn = corr->_prn;
[3487]1300
[3455]1301 ++iObs;
1302
[9258]1303 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
1304 cmbParam* pp = _params[sys][iPar-1];
1305 AA(iObs, iPar) = pp->partial(sys, corr->_acName, prn);
[3455]1306 }
[10694]1307 // Consistency corrections to keep the combined clock consistent to masterOrbit
1308 // ----------------------------------------------------------------------------
1309 double dC_orb = dotproduct(corr->_orbCorr._xr, corr->_diffRao) / corr->_orbCorr._xr.NormFrobenius();
1310 double dC_att = corr->_diffYaw / (2 * M_PI);
1311 dC_att *= corr->_lambdaIF;
[10770]1312 double dC_apriori_corr = dC_orb + dC_att;
[3455]1313
[10770]1314 ll(iObs) = ((corr->_clkCorr._dClk * t_CST::c) + dC_apriori_corr - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
[9819]1315
[9821]1316 PP(iObs, iObs) *= 1.0 / (corr->_weightFactor * corr->_weightFactor);
[3455]1317 }
1318
1319 // Regularization
1320 // --------------
[3474]1321 if (_method == filter) {
1322 const double Ph = 1.e6;
1323 PP(nObs+1) = Ph;
[9258]1324 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
1325 cmbParam* pp = _params[sys][iPar-1];
[3465]1326 if ( AA.Column(iPar).maximum_absolute_value() > 0.0 &&
[3474]1327 pp->type == cmbParam::clkSat ) {
1328 AA(nObs+1, iPar) = 1.0;
[3455]1329 }
1330 }
[10441]1331// if (sys == 'R') {
1332// return success;
1333// }
[9259]1334 int iCond = 1;
1335 // GNSS
[9258]1336 for (unsigned iGnss = 1; iGnss <= _cmbSysPrn[sys]; iGnss++) {
[10599]1337 int flag = t_corrSSR::getSsrNavTypeFlag(sys, iGnss);
[9258]1338 QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag);
[3474]1339 ++iCond;
1340 PP(nObs+iCond) = Ph;
[9258]1341 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
1342 cmbParam* pp = _params[sys][iPar-1];
[7299]1343 if ( pp &&
1344 AA.Column(iPar).maximum_absolute_value() > 0.0 &&
[7297]1345 pp->type == cmbParam::offACSat &&
[3474]1346 pp->prn == prn) {
1347 AA(nObs+iCond, iPar) = 1.0;
1348 }
1349 }
1350 }
[3455]1351 }
1352
1353 return success;
1354}
[3470]1355
1356// Process Epoch - Single-Epoch Method
1357////////////////////////////////////////////////////////////////////////////
[10038]1358t_irc bncComb::processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out,
[10694]1359 QMap<QString, cmbCorr*>& masterCorr,
[3475]1360 ColumnVector& dx) {
[3470]1361
[3487]1362 // Check Satellite Positions for Outliers
1363 // --------------------------------------
[10694]1364 if (checkOrbits(epoTime, sys, out, masterCorr) != success) {
[3487]1365 return failure;
1366 }
1367
[3482]1368 // Outlier Detection Loop
1369 // ----------------------
[10227]1370 while (_running) {
[3482]1371 // Count Number of Observations per Satellite and per AC
1372 // -----------------------------------------------------
1373 QMap<QString, int> numObsPrn;
1374 QMap<QString, int> numObsAC;
[9258]1375 QVectorIterator<cmbCorr*> itCorr(corrs(sys));
[3482]1376 while (itCorr.hasNext()) {
1377 cmbCorr* corr = itCorr.next();
[6157]1378 QString prn = corr->_prn;
1379 QString AC = corr->_acName;
[3482]1380 if (numObsPrn.find(prn) == numObsPrn.end()) {
1381 numObsPrn[prn] = 1;
1382 }
1383 else {
1384 numObsPrn[prn] += 1;
1385 }
1386 if (numObsAC.find(AC) == numObsAC.end()) {
1387 numObsAC[AC] = 1;
1388 }
1389 else {
1390 numObsAC[AC] += 1;
1391 }
[3476]1392 }
[7297]1393
[9258]1394 // Clean-Up the Parameters
1395 // -----------------------
1396 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
1397 delete _params[sys][iPar-1];
[3474]1398 }
[9258]1399 _params[sys].clear();
[7297]1400
[3482]1401 // Set new Parameters
1402 // ------------------
1403 int nextPar = 0;
[7297]1404
[3482]1405 QMapIterator<QString, int> itAC(numObsAC);
1406 while (itAC.hasNext()) {
1407 itAC.next();
1408 const QString& AC = itAC.key();
1409 int numObs = itAC.value();
[9258]1410 if (AC != _masterOrbitAC[sys] && numObs > 0) {
1411 _params[sys].push_back(new cmbParam(cmbParam::offACgnss, ++nextPar, AC, ""));
[3482]1412 }
[7297]1413 }
1414
[3482]1415 QMapIterator<QString, int> itPrn(numObsPrn);
1416 while (itPrn.hasNext()) {
1417 itPrn.next();
1418 const QString& prn = itPrn.key();
1419 int numObs = itPrn.value();
1420 if (numObs > 0) {
[9258]1421 _params[sys].push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
[3482]1422 }
[7297]1423 }
1424
[9258]1425 int nPar = _params[sys].size();
[7297]1426 ColumnVector x0(nPar);
[3482]1427 x0 = 0.0;
[7297]1428
[3482]1429 // Create First-Design Matrix
1430 // --------------------------
1431 Matrix AA;
1432 ColumnVector ll;
1433 DiagonalMatrix PP;
[10694]1434 if (createAmat(sys, AA, ll, PP, x0) != success) {
[3482]1435 return failure;
[3476]1436 }
[7297]1437
[3482]1438 ColumnVector vv;
1439 try {
1440 Matrix ATP = AA.t() * PP;
1441 SymmetricMatrix NN; NN << ATP * AA;
1442 ColumnVector bb = ATP * ll;
[9258]1443 _QQ[sys] = NN.i();
1444 dx = _QQ[sys] * bb;
[3482]1445 vv = ll - AA * dx;
[3476]1446 }
[3482]1447 catch (Exception& exc) {
[9635]1448 out << exc.what() << "\n";
[3482]1449 return failure;
[3476]1450 }
[3474]1451
[3482]1452 int maxResIndex;
[7297]1453 double maxRes = vv.maximum_absolute_value1(maxResIndex);
[3482]1454 out.setRealNumberNotation(QTextStream::FixedNotation);
[7297]1455 out.setRealNumberPrecision(3);
[10038]1456 out << epoTime.datestr().c_str() << " " << epoTime.timestr().c_str()
[3482]1457 << " Maximum Residuum " << maxRes << ' '
[9258]1458 << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
[3474]1459
[10451]1460 if (maxRes > _MAX_RES) {
[9635]1461 out << " Outlier" << "\n";
[9258]1462 delete corrs(sys)[maxResIndex-1];
1463 corrs(sys).remove(maxResIndex-1);
[3474]1464 }
[3482]1465 else {
[9635]1466 out << " OK" << "\n";
[3482]1467 out.setRealNumberNotation(QTextStream::FixedNotation);
[7297]1468 out.setRealNumberPrecision(3);
[3482]1469 for (int ii = 0; ii < vv.Nrows(); ii++) {
[9258]1470 const cmbCorr* corr = corrs(sys)[ii];
[10038]1471 out << epoTime.datestr().c_str() << ' '
1472 << epoTime.timestr().c_str() << " "
[6962]1473 << corr->_acName << ' ' << corr->_prn.mid(0,3);
[3482]1474 out.setFieldWidth(6);
[9635]1475 out << " res = " << vv[ii] << "\n";
[3482]1476 out.setFieldWidth(0);
1477 }
1478 return success;
[3474]1479 }
1480
[3473]1481 }
[3474]1482
[3482]1483 return failure;
[3470]1484}
[3487]1485
1486// Check Satellite Positions for Outliers
1487////////////////////////////////////////////////////////////////////////////
[10694]1488t_irc bncComb::checkOrbits(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& masterCorr) {
[3487]1489
[3502]1490 // Switch to last ephemeris (if possible)
1491 // --------------------------------------
[9258]1492 QMutableVectorIterator<cmbCorr*> im(corrs(sys));
[3501]1493 while (im.hasNext()) {
1494 cmbCorr* corr = im.next();
[6157]1495 QString prn = corr->_prn;
[6443]1496
[7012]1497 t_eph* ephLast = _ephUser.ephLast(prn);
1498 t_eph* ephPrev = _ephUser.ephPrev(prn);
[6443]1499
1500 if (ephLast == 0) {
[9635]1501 out << "checkOrbit: missing eph (not found) " << corr->_prn.mid(0,3) << "\n";
[3556]1502 delete corr;
[3501]1503 im.remove();
1504 }
[6157]1505 else if (corr->_eph == 0) {
[9635]1506 out << "checkOrbit: missing eph (zero) " << corr->_prn.mid(0,3) << "\n";
[3556]1507 delete corr;
[3503]1508 im.remove();
1509 }
[3502]1510 else {
[10612]1511 if ( corr->_eph == ephLast ||
1512 corr->_eph == ephPrev ) {
[6443]1513 switchToLastEph(ephLast, corr);
[3502]1514 }
1515 else {
[9635]1516 out << "checkOrbit: missing eph (deleted) " << corr->_prn.mid(0,3) << "\n";
[3556]1517 delete corr;
[3502]1518 im.remove();
1519 }
1520 }
[3501]1521 }
1522
[10227]1523 while (_running) {
[3488]1524
1525 // Compute Mean Corrections for all Satellites
1526 // -------------------------------------------
[3489]1527 QMap<QString, int> numCorr;
[3488]1528 QMap<QString, ColumnVector> meanRao;
[9258]1529 QVectorIterator<cmbCorr*> it(corrs(sys));
[3488]1530 while (it.hasNext()) {
1531 cmbCorr* corr = it.next();
[6157]1532 QString prn = corr->_prn;
[3488]1533 if (meanRao.find(prn) == meanRao.end()) {
1534 meanRao[prn].ReSize(4);
[10216]1535 meanRao[prn].Rows(1,3) = corr->_orbCorr._xr;
[7297]1536 meanRao[prn](4) = 1;
[3488]1537 }
1538 else {
[10216]1539 meanRao[prn].Rows(1,3) += corr->_orbCorr._xr;
[7297]1540 meanRao[prn](4) += 1;
[3488]1541 }
[3489]1542 if (numCorr.find(prn) == numCorr.end()) {
1543 numCorr[prn] = 1;
1544 }
1545 else {
1546 numCorr[prn] += 1;
1547 }
[3487]1548 }
[7297]1549
[9258]1550 // Compute Differences wrt. Mean, find Maximum
1551 // -------------------------------------------
[3488]1552 QMap<QString, cmbCorr*> maxDiff;
1553 it.toFront();
1554 while (it.hasNext()) {
1555 cmbCorr* corr = it.next();
[6157]1556 QString prn = corr->_prn;
[3488]1557 if (meanRao[prn](4) != 0) {
1558 meanRao[prn] /= meanRao[prn](4);
1559 meanRao[prn](4) = 0;
1560 }
[10216]1561 corr->_diffRao = corr->_orbCorr._xr - meanRao[prn].Rows(1,3);
[10665]1562
[3488]1563 if (maxDiff.find(prn) == maxDiff.end()) {
1564 maxDiff[prn] = corr;
1565 }
1566 else {
[8901]1567 double normMax = maxDiff[prn]->_diffRao.NormFrobenius();
1568 double norm = corr->_diffRao.NormFrobenius();
[3488]1569 if (norm > normMax) {
1570 maxDiff[prn] = corr;
1571 }
[7297]1572 }
[3487]1573 }
[7297]1574
[3655]1575 if (_ACs.size() == 1) {
[10665]1576 QVectorIterator<cmbCorr*> it(corrs(sys));
1577 while (it.hasNext()) {
1578 cmbCorr* corr = it.next();
1579 QString prn = corr->_prn;
1580 if (corr->_acName == _masterOrbitAC[sys] &&
[10694]1581 masterCorr.find(prn) == masterCorr.end()) {
1582 masterCorr[prn] = new cmbCorr(*corr);
1583 masterCorr[prn]->_diffRao = 0.0;
1584 masterCorr[prn]->_diffYaw = 0.0;
[10665]1585 }
1586 }
[3655]1587 break;
1588 }
1589
[3488]1590 // Remove Outliers
1591 // ---------------
1592 bool removed = false;
[9258]1593 QMutableVectorIterator<cmbCorr*> im(corrs(sys));
[3488]1594 while (im.hasNext()) {
1595 cmbCorr* corr = im.next();
[6157]1596 QString prn = corr->_prn;
[3489]1597 if (numCorr[prn] < 2) {
[3556]1598 delete corr;
[3489]1599 im.remove();
1600 }
1601 else if (corr == maxDiff[prn]) {
[8901]1602 double norm = corr->_diffRao.NormFrobenius();
[10665]1603 double facSys = 1.0;
1604 if (sys == 'C' && prn.mid(1,2).toInt() <= 16) { // BDS-2
1605 facSys *= 5.0;
1606 }
1607 if (norm > (_MAX_DISPLACEMENT * facSys)) {
[10038]1608 out << epoTime.datestr().c_str() << " "
1609 << epoTime.timestr().c_str() << " "
[7297]1610 << "Orbit Outlier: "
[8204]1611 << corr->_acName.toLatin1().data() << " "
1612 << prn.mid(0,3).toLatin1().data() << " "
[7297]1613 << corr->_iod << " "
[9635]1614 << norm << "\n";
[3556]1615 delete corr;
[3488]1616 im.remove();
1617 removed = true;
1618 }
1619 }
[3487]1620 }
[10665]1621 // Set master orbit
1622 // -----------------------------------------
[3488]1623 if (!removed) {
[10665]1624 QVectorIterator<cmbCorr*> it(corrs(sys));
1625 while (it.hasNext()) {
1626 cmbCorr* corr = it.next();
1627 QString prn = corr->_prn;
1628 if (corr->_acName == _masterOrbitAC[sys] &&
[10694]1629 masterCorr.find(prn) == masterCorr.end()) {
1630 masterCorr[prn] = new cmbCorr(*corr);
[10665]1631 }
1632 }
1633 // Remove satellites that are not in masterOrbit
1634 // and compute differences wrt. masterOrbit
1635 // ----------------------------------------------
1636 QMutableVectorIterator<cmbCorr*> im(corrs(sys));
1637 while (im.hasNext()) {
1638 cmbCorr* corr = im.next();
1639 QString prn = corr->_prn;
[10694]1640 if (masterCorr.find(prn) == masterCorr.end()) {
[10665]1641 delete corr;
1642 im.remove();
1643 }
1644 else {
[10694]1645 corr->_diffRao = corr->_orbCorr._xr - masterCorr[prn]->_orbCorr._xr;
1646 corr->_diffYaw = corr->_satYawAngle - masterCorr[prn]->_satYawAngle;
[10665]1647 }
1648 }
[3488]1649 break;
1650 }
[3487]1651 }
1652
1653 return success;
1654}
[3588]1655
[7297]1656//
[3588]1657////////////////////////////////////////////////////////////////////////////
[5583]1658void bncComb::slotProviderIDChanged(QString mountPoint) {
1659 QMutexLocker locker(&_mutex);
1660
[8065]1661 QTextStream out(&_log, QIODevice::WriteOnly);
1662
[5583]1663 // Find the AC Name
1664 // ----------------
1665 QString acName;
1666 QListIterator<cmbAC*> icAC(_ACs);
1667 while (icAC.hasNext()) {
[10038]1668 cmbAC *AC = icAC.next();
[5583]1669 if (AC->mountPoint == mountPoint) {
1670 acName = AC->name;
[10764]1671 out << "SSR Provider or Service changed: AC " << AC->name.toLatin1().data() << " "
[10081]1672 << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
[10038]1673 << "\n";
[5583]1674 break;
1675 }
1676 }
1677 if (acName.isEmpty()) {
1678 return;
1679 }
[9258]1680 QMapIterator<char, unsigned> itSys(_cmbSysPrn);
1681 while (itSys.hasNext()) {
1682 itSys.next();
1683 char sys = itSys.key();
1684 // Remove all corrections of the corresponding AC
1685 // ----------------------------------------------
[10038]1686 QVector<cmbCorr*> &corrVec = _buffer[sys].corrs;
1687 QMutableVectorIterator<cmbCorr*> it(corrVec);
1688 while (it.hasNext()) {
1689 cmbCorr *corr = it.next();
1690 if (acName == corr->_acName) {
1691 delete corr;
1692 it.remove();
[5583]1693 }
1694 }
[9258]1695 // Reset Satellite Offsets
1696 // -----------------------
1697 if (_method == filter) {
1698 for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
[10038]1699 cmbParam *pp = _params[sys][iPar - 1];
[9258]1700 if (pp->AC == acName && pp->type == cmbParam::offACSat) {
1701 pp->xx = 0.0;
[10038]1702 _QQ[sys].Row(iPar) = 0.0;
[9258]1703 _QQ[sys].Column(iPar) = 0.0;
[10038]1704 _QQ[sys](iPar, iPar) = pp->sig0 * pp->sig0;
[9258]1705 }
[5585]1706 }
1707 }
1708 }
[5583]1709}
[10451]1710
1711//
1712////////////////////////////////////////////////////////////////////////////
1713bool bncComb::excludeSat(const t_prn& prn, const QStringList excludeSats) const {
1714 QStringListIterator it(excludeSats);
1715 while (it.hasNext()) {
1716 string prnStr = it.next().toLatin1().data();
[10599]1717 if (prnStr == prn.toString() || // prn
1718 prnStr == prn.toString().substr(0,1)) { // sys
[10451]1719 return true;
1720 }
1721 }
1722 return false;
1723}
Note: See TracBrowser for help on using the repository browser.