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