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