| 1 | // Part of BNC, a utility for retrieving decoding and
|
|---|
| 2 | // converting GNSS data streams from NTRIP broadcasters.
|
|---|
| 3 | //
|
|---|
| 4 | // Copyright (C) 2007
|
|---|
| 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
|---|
| 6 | // http://www.bkg.bund.de
|
|---|
| 7 | // Czech Technical University Prague, Department of Geodesy
|
|---|
| 8 | // http://www.fsv.cvut.cz
|
|---|
| 9 | //
|
|---|
| 10 | // Email: euref-ip@bkg.bund.de
|
|---|
| 11 | //
|
|---|
| 12 | // This program is free software; you can redistribute it and/or
|
|---|
| 13 | // modify it under the terms of the GNU General Public License
|
|---|
| 14 | // as published by the Free Software Foundation, version 2.
|
|---|
| 15 | //
|
|---|
| 16 | // This program is distributed in the hope that it will be useful,
|
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | // GNU General Public License for more details.
|
|---|
| 20 | //
|
|---|
| 21 | // You should have received a copy of the GNU General Public License
|
|---|
| 22 | // along with this program; if not, write to the Free Software
|
|---|
| 23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 24 |
|
|---|
| 25 | /* -------------------------------------------------------------------------
|
|---|
| 26 | * BKG NTRIP Client
|
|---|
| 27 | * -------------------------------------------------------------------------
|
|---|
| 28 | *
|
|---|
| 29 | * Class: t_reqcAnalyze
|
|---|
| 30 | *
|
|---|
| 31 | * Purpose: Analyze RINEX Files
|
|---|
| 32 | *
|
|---|
| 33 | * Author: L. Mervart
|
|---|
| 34 | *
|
|---|
| 35 | * Created: 11-Apr-2012
|
|---|
| 36 | *
|
|---|
| 37 | * Changes:
|
|---|
| 38 | *
|
|---|
| 39 | * -----------------------------------------------------------------------*/
|
|---|
| 40 |
|
|---|
| 41 | #include <iostream>
|
|---|
| 42 | #include <iomanip>
|
|---|
| 43 | #include <qwt_plot_renderer.h>
|
|---|
| 44 |
|
|---|
| 45 | #include "reqcanalyze.h"
|
|---|
| 46 | #include "bnccore.h"
|
|---|
| 47 | #include "bncsettings.h"
|
|---|
| 48 | #include "reqcedit.h"
|
|---|
| 49 | #include "bncutils.h"
|
|---|
| 50 | #include "graphwin.h"
|
|---|
| 51 | #include "polarplot.h"
|
|---|
| 52 | #include "availplot.h"
|
|---|
| 53 | #include "eleplot.h"
|
|---|
| 54 | #include "dopplot.h"
|
|---|
| 55 |
|
|---|
| 56 | using namespace std;
|
|---|
| 57 |
|
|---|
| 58 | // Constructor
|
|---|
| 59 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 60 | t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
|
|---|
| 61 |
|
|---|
| 62 | bncSettings settings;
|
|---|
| 63 |
|
|---|
| 64 | _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
|
|---|
| 65 | _logFile = 0;
|
|---|
| 66 | _log = 0;
|
|---|
| 67 | _currEpo = 0;
|
|---|
| 68 | _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
|
|---|
| 69 | _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
|
|---|
| 70 |
|
|---|
| 71 | connect(this, SIGNAL(dspSkyPlot(const QString&, const QString&, QVector<t_polarPoint*>*,
|
|---|
| 72 | const QString&, QVector<t_polarPoint*>*,
|
|---|
| 73 | const QByteArray&, double)),
|
|---|
| 74 | this, SLOT(slotDspSkyPlot(const QString&, const QString&, QVector<t_polarPoint*>*,
|
|---|
| 75 | const QString&, QVector<t_polarPoint*>*,
|
|---|
| 76 | const QByteArray&, double)));
|
|---|
| 77 |
|
|---|
| 78 | connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
|
|---|
| 79 | this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | // Destructor
|
|---|
| 83 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 84 | t_reqcAnalyze::~t_reqcAnalyze() {
|
|---|
| 85 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
|---|
| 86 | delete _rnxObsFiles[ii];
|
|---|
| 87 | }
|
|---|
| 88 | for (int ii = 0; ii < _ephs.size(); ii++) {
|
|---|
| 89 | delete _ephs[ii];
|
|---|
| 90 | }
|
|---|
| 91 | delete _log; _log = 0;
|
|---|
| 92 | delete _logFile; _logFile = 0;
|
|---|
| 93 | if (BNC_CORE->mode() != t_bncCore::interactive) {
|
|---|
| 94 | qApp->exit(0);
|
|---|
| 95 | }
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | //
|
|---|
| 99 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 100 | void t_reqcAnalyze::run() {
|
|---|
| 101 |
|
|---|
| 102 | // Open Log File
|
|---|
| 103 | // -------------
|
|---|
| 104 | _logFile = new QFile(_logFileName);
|
|---|
| 105 | if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|---|
| 106 | _log = new QTextStream();
|
|---|
| 107 | _log->setDevice(_logFile);
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | // Initialize RINEX Observation Files
|
|---|
| 111 | // ----------------------------------
|
|---|
| 112 | t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
|
|---|
| 113 |
|
|---|
| 114 | // Read Ephemerides
|
|---|
| 115 | // ----------------
|
|---|
| 116 | t_reqcEdit::readEphemerides(_navFileNames, _ephs);
|
|---|
| 117 |
|
|---|
| 118 | // Loop over all RINEX Files
|
|---|
| 119 | // -------------------------
|
|---|
| 120 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
|---|
| 121 | analyzeFile(_rnxObsFiles[ii]);
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | // Exit
|
|---|
| 125 | // ----
|
|---|
| 126 | emit finished();
|
|---|
| 127 | deleteLater();
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | //
|
|---|
| 131 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 132 | void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
|
|---|
| 133 |
|
|---|
| 134 | _qcFile.clear();
|
|---|
| 135 |
|
|---|
| 136 | // A priori Coordinates
|
|---|
| 137 | // --------------------
|
|---|
| 138 | ColumnVector xyzSta = obsFile->xyz();
|
|---|
| 139 |
|
|---|
| 140 | // Loop over all Epochs
|
|---|
| 141 | // --------------------
|
|---|
| 142 | try {
|
|---|
| 143 | QMap<QString, bncTime> lastObsTime;
|
|---|
| 144 | bool firstEpo = true;
|
|---|
| 145 | while ( (_currEpo = obsFile->nextEpoch()) != 0) {
|
|---|
| 146 | if (firstEpo) {
|
|---|
| 147 | firstEpo = false;
|
|---|
| 148 | _qcFile._startTime = _currEpo->tt;
|
|---|
| 149 | _qcFile._antennaName = obsFile->antennaName();
|
|---|
| 150 | _qcFile._markerName = obsFile->markerName();
|
|---|
| 151 | _qcFile._receiverType = obsFile->receiverType();
|
|---|
| 152 | _qcFile._interval = obsFile->interval();
|
|---|
| 153 | }
|
|---|
| 154 | _qcFile._endTime = _currEpo->tt;
|
|---|
| 155 |
|
|---|
| 156 | t_qcEpo qcEpo;
|
|---|
| 157 | qcEpo._epoTime = _currEpo->tt;
|
|---|
| 158 | qcEpo._PDOP = cmpDOP(xyzSta);
|
|---|
| 159 |
|
|---|
| 160 | // Loop over all satellites
|
|---|
| 161 | // ------------------------
|
|---|
| 162 | for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
|
|---|
| 163 | const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
|
|---|
| 164 | t_satObs satObs;
|
|---|
| 165 | t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, satObs);
|
|---|
| 166 | t_qcSat& qcSat = qcEpo._qcSat[satObs._prn];
|
|---|
| 167 | setQcObs(qcEpo._epoTime, xyzSta, satObs, lastObsTime, qcSat);
|
|---|
| 168 | updateQcSat(qcSat, _qcFile._qcSatSum[satObs._prn]);
|
|---|
| 169 | }
|
|---|
| 170 | _qcFile._qcEpo.push_back(qcEpo);
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | analyzeMultipath();
|
|---|
| 174 |
|
|---|
| 175 | preparePlotData(obsFile);
|
|---|
| 176 |
|
|---|
| 177 | printReport(obsFile);
|
|---|
| 178 | }
|
|---|
| 179 | catch (QString str) {
|
|---|
| 180 | if (_log) {
|
|---|
| 181 | *_log << "Exception " << str << endl;
|
|---|
| 182 | }
|
|---|
| 183 | else {
|
|---|
| 184 | qDebug() << str;
|
|---|
| 185 | }
|
|---|
| 186 | }
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | // Compute Dilution of Precision
|
|---|
| 190 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 191 | double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
|
|---|
| 192 |
|
|---|
| 193 | if (xyzSta.size() != 3) {
|
|---|
| 194 | return 0.0;
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | unsigned nSat = _currEpo->rnxSat.size();
|
|---|
| 198 |
|
|---|
| 199 | if (nSat < 4) {
|
|---|
| 200 | return 0.0;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | Matrix AA(nSat, 4);
|
|---|
| 204 |
|
|---|
| 205 | unsigned nSatUsed = 0;
|
|---|
| 206 | for (unsigned iSat = 0; iSat < nSat; iSat++) {
|
|---|
| 207 |
|
|---|
| 208 | const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iSat];
|
|---|
| 209 | const t_prn& prn = rnxSat.prn;
|
|---|
| 210 |
|
|---|
| 211 | t_eph* eph = 0;
|
|---|
| 212 | for (int ie = 0; ie < _ephs.size(); ie++) {
|
|---|
| 213 | if (_ephs[ie]->prn() == prn) {
|
|---|
| 214 | eph = _ephs[ie];
|
|---|
| 215 | break;
|
|---|
| 216 | }
|
|---|
| 217 | }
|
|---|
| 218 | if (eph) {
|
|---|
| 219 | ColumnVector xSat(4);
|
|---|
| 220 | ColumnVector vv(3);
|
|---|
| 221 | if (eph->getCrd(_currEpo->tt, xSat, vv, false) == success) {
|
|---|
| 222 | ++nSatUsed;
|
|---|
| 223 | ColumnVector dx = xSat.Rows(1,3) - xyzSta;
|
|---|
| 224 | double rho = dx.norm_Frobenius();
|
|---|
| 225 | AA(nSatUsed,1) = dx(1) / rho;
|
|---|
| 226 | AA(nSatUsed,2) = dx(2) / rho;
|
|---|
| 227 | AA(nSatUsed,3) = dx(3) / rho;
|
|---|
| 228 | AA(nSatUsed,4) = 1.0;
|
|---|
| 229 | }
|
|---|
| 230 | }
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | if (nSatUsed < 4) {
|
|---|
| 234 | return 0.0;
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | AA = AA.Rows(1, nSatUsed);
|
|---|
| 238 |
|
|---|
| 239 | SymmetricMatrix QQ;
|
|---|
| 240 | QQ << AA.t() * AA;
|
|---|
| 241 | QQ = QQ.i();
|
|---|
| 242 |
|
|---|
| 243 | return sqrt(QQ.trace());
|
|---|
| 244 | }
|
|---|
| 245 |
|
|---|
| 246 | //
|
|---|
| 247 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 248 | void t_reqcAnalyze::updateQcSat(const t_qcSat& qcSat, t_qcSatSum& qcSatSum) {
|
|---|
| 249 |
|
|---|
| 250 | for (int ii = 0; ii < qcSat._qcFrq.size(); ii++) {
|
|---|
| 251 | const t_qcFrq& qcFrq = qcSat._qcFrq[ii];
|
|---|
| 252 | t_qcFrqSum& qcFrqSum = qcSatSum._qcFrqSum[qcFrq._rnxType2ch];
|
|---|
| 253 | qcFrqSum._numObs += 1;
|
|---|
| 254 | if (qcFrq._slip) {
|
|---|
| 255 | qcFrqSum._numSlipsFlagged += 1;
|
|---|
| 256 | }
|
|---|
| 257 | if (qcFrq._gap) {
|
|---|
| 258 | qcFrqSum._numGaps += 1;
|
|---|
| 259 | }
|
|---|
| 260 | if (qcFrq._SNR > 0.0) {
|
|---|
| 261 | qcFrqSum._numSNR += 1;
|
|---|
| 262 | qcFrqSum._sumSNR += qcFrq._SNR;
|
|---|
| 263 | }
|
|---|
| 264 | }
|
|---|
| 265 | }
|
|---|
| 266 |
|
|---|
| 267 | //
|
|---|
| 268 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 269 | void t_reqcAnalyze::setQcObs(const bncTime& epoTime, const ColumnVector& xyzSta,
|
|---|
| 270 | const t_satObs& satObs, QMap<QString, bncTime>& lastObsTime,
|
|---|
| 271 | t_qcSat& qcSat) {
|
|---|
| 272 |
|
|---|
| 273 | t_eph* eph = 0;
|
|---|
| 274 | for (int ie = 0; ie < _ephs.size(); ie++) {
|
|---|
| 275 | if (_ephs[ie]->prn() == satObs._prn) {
|
|---|
| 276 | eph = _ephs[ie];
|
|---|
| 277 | break;
|
|---|
| 278 | }
|
|---|
| 279 | }
|
|---|
| 280 | if (eph) {
|
|---|
| 281 | ColumnVector xc(4);
|
|---|
| 282 | ColumnVector vv(3);
|
|---|
| 283 | if (xyzSta.size() && eph->getCrd(epoTime, xc, vv, false) == success) {
|
|---|
| 284 | double rho, eleSat, azSat;
|
|---|
| 285 | topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
|
|---|
| 286 | qcSat._eleSet = true;
|
|---|
| 287 | qcSat._azDeg = azSat * 180.0/M_PI;
|
|---|
| 288 | qcSat._eleDeg = eleSat * 180.0/M_PI;
|
|---|
| 289 | }
|
|---|
| 290 | if (satObs._prn.system() == 'R') {
|
|---|
| 291 | qcSat._slotSet = true;
|
|---|
| 292 | qcSat._slotNum = eph->slotNum();
|
|---|
| 293 | }
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | // Availability and Slip Flags
|
|---|
| 297 | // ---------------------------
|
|---|
| 298 | for (unsigned ii = 0; ii < satObs._obs.size(); ii++) {
|
|---|
| 299 | const t_frqObs* frqObs = satObs._obs[ii];
|
|---|
| 300 |
|
|---|
| 301 | qcSat._qcFrq.push_back(t_qcFrq());
|
|---|
| 302 | t_qcFrq& qcFrq = qcSat._qcFrq.back();
|
|---|
| 303 |
|
|---|
| 304 | qcFrq._rnxType2ch = QString(frqObs->_rnxType2ch.c_str());
|
|---|
| 305 | qcFrq._SNR = frqObs->_snr;
|
|---|
| 306 | qcFrq._slip = frqObs->_slip;
|
|---|
| 307 | qcFrq._phaseValid = frqObs->_phaseValid;
|
|---|
| 308 | qcFrq._codeValid = frqObs->_codeValid;
|
|---|
| 309 | // Check Gaps
|
|---|
| 310 | // ----------
|
|---|
| 311 | QString key = QString(satObs._prn.toString().c_str()) + qcFrq._rnxType2ch;
|
|---|
| 312 | if (lastObsTime[key].valid()) {
|
|---|
| 313 | double dt = epoTime - lastObsTime[key];
|
|---|
| 314 | if (dt > 1.5 * _qcFile._interval) {
|
|---|
| 315 | qcFrq._gap = true;
|
|---|
| 316 | }
|
|---|
| 317 | }
|
|---|
| 318 | lastObsTime[key] = epoTime;
|
|---|
| 319 |
|
|---|
| 320 | // Compute the Multipath Linear Combination
|
|---|
| 321 | // ----------------------------------------
|
|---|
| 322 | if (frqObs->_codeValid) {
|
|---|
| 323 | t_frequency::type fA;
|
|---|
| 324 | t_frequency::type fB;
|
|---|
| 325 | if (satObs._prn.system() == 'G') {
|
|---|
| 326 | if (frqObs->_rnxType2ch[0] == '1') {
|
|---|
| 327 | fA = t_frequency::G1;
|
|---|
| 328 | fB = t_frequency::G2;
|
|---|
| 329 | }
|
|---|
| 330 | else if (frqObs->_rnxType2ch[0] == '2') {
|
|---|
| 331 | fA = t_frequency::G2;
|
|---|
| 332 | fB = t_frequency::G1;
|
|---|
| 333 | }
|
|---|
| 334 | }
|
|---|
| 335 | else if (satObs._prn.system() == 'R') {
|
|---|
| 336 | if (frqObs->_rnxType2ch[0] == '1') {
|
|---|
| 337 | fA = t_frequency::R1;
|
|---|
| 338 | fB = t_frequency::R2;
|
|---|
| 339 | }
|
|---|
| 340 | else if (frqObs->_rnxType2ch[0] == '2') {
|
|---|
| 341 | fA = t_frequency::R2;
|
|---|
| 342 | fB = t_frequency::R1;
|
|---|
| 343 | }
|
|---|
| 344 | }
|
|---|
| 345 | else if (satObs._prn.system() == 'E') {
|
|---|
| 346 | if (frqObs->_rnxType2ch[0] == '1') {
|
|---|
| 347 | fA = t_frequency::E1;
|
|---|
| 348 | fB = t_frequency::E5;
|
|---|
| 349 | }
|
|---|
| 350 | else if (frqObs->_rnxType2ch[0] == '5') {
|
|---|
| 351 | fA = t_frequency::E5;
|
|---|
| 352 | fB = t_frequency::E1;
|
|---|
| 353 | }
|
|---|
| 354 | }
|
|---|
| 355 | else if (satObs._prn.system() == 'J') {
|
|---|
| 356 | if (frqObs->_rnxType2ch[0] == '1') {
|
|---|
| 357 | fA = t_frequency::J1;
|
|---|
| 358 | fB = t_frequency::J2;
|
|---|
| 359 | }
|
|---|
| 360 | else if (frqObs->_rnxType2ch[0] == '2') {
|
|---|
| 361 | fA = t_frequency::J2;
|
|---|
| 362 | fB = t_frequency::J1;
|
|---|
| 363 | }
|
|---|
| 364 | }
|
|---|
| 365 | else if (satObs._prn.system() == 'S') {
|
|---|
| 366 | if (frqObs->_rnxType2ch[0] == '1') {
|
|---|
| 367 | fA = t_frequency::S1;
|
|---|
| 368 | fB = t_frequency::S5;
|
|---|
| 369 | }
|
|---|
| 370 | else if (frqObs->_rnxType2ch[0] == '5') {
|
|---|
| 371 | fA = t_frequency::S5;
|
|---|
| 372 | fB = t_frequency::S1;
|
|---|
| 373 | }
|
|---|
| 374 | }
|
|---|
| 375 | else if (satObs._prn.system() == 'C') {
|
|---|
| 376 | if (frqObs->_rnxType2ch[0] == '1') {
|
|---|
| 377 | fA = t_frequency::C1;
|
|---|
| 378 | fB = t_frequency::C7;
|
|---|
| 379 | }
|
|---|
| 380 | else if (frqObs->_rnxType2ch[0] == '7') {
|
|---|
| 381 | fA = t_frequency::C7;
|
|---|
| 382 | fB = t_frequency::C1;
|
|---|
| 383 | }
|
|---|
| 384 | }
|
|---|
| 385 | if (fA != t_frequency::dummy && fB != t_frequency::dummy) {
|
|---|
| 386 | double f_a = t_CST::freq(fA, qcSat._slotNum);
|
|---|
| 387 | double f_b = t_CST::freq(fB, qcSat._slotNum);
|
|---|
| 388 | double C_a = frqObs->_code;
|
|---|
| 389 |
|
|---|
| 390 | bool foundA = false;
|
|---|
| 391 | double L_a = 0.0;
|
|---|
| 392 | bool foundB = false;
|
|---|
| 393 | double L_b = 0.0;
|
|---|
| 394 | for (unsigned jj = 0; jj < satObs._obs.size(); jj++) {
|
|---|
| 395 | const t_frqObs* frqObsHlp = satObs._obs[jj];
|
|---|
| 396 | if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fA)[1] &&
|
|---|
| 397 | frqObsHlp->_phaseValid) {
|
|---|
| 398 | foundA = true;
|
|---|
| 399 | L_a = frqObsHlp->_phase * t_CST::c / f_a;
|
|---|
| 400 | }
|
|---|
| 401 | else if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fB)[1] &&
|
|---|
| 402 | frqObsHlp->_phaseValid) {
|
|---|
| 403 | foundB = true;
|
|---|
| 404 | L_b = frqObsHlp->_phase * t_CST::c / f_b;
|
|---|
| 405 | }
|
|---|
| 406 | }
|
|---|
| 407 | if (foundA && foundB) {
|
|---|
| 408 | qcFrq._setMP = true;
|
|---|
| 409 | qcFrq._rawMP = C_a - L_a - 2.0*f_b*f_b/(f_a*f_a-f_b*f_b) * (L_a - L_b);
|
|---|
| 410 | }
|
|---|
| 411 | }
|
|---|
| 412 | }
|
|---|
| 413 | } // satObs loop
|
|---|
| 414 | }
|
|---|
| 415 |
|
|---|
| 416 | //
|
|---|
| 417 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 418 | void t_reqcAnalyze::analyzeMultipath() {
|
|---|
| 419 |
|
|---|
| 420 | const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
|
|---|
| 421 | const double chunkStep = 600.0; // 10 minutes
|
|---|
| 422 |
|
|---|
| 423 | // Loop over all satellites available
|
|---|
| 424 | // ----------------------------------
|
|---|
| 425 | QMutableMapIterator<t_prn, t_qcSatSum> itSat(_qcFile._qcSatSum);
|
|---|
| 426 | while (itSat.hasNext()) {
|
|---|
| 427 | itSat.next();
|
|---|
| 428 | const t_prn& prn = itSat.key();
|
|---|
| 429 | t_qcSatSum& qcSatSum = itSat.value();
|
|---|
| 430 |
|
|---|
| 431 | // Loop over all frequencies available
|
|---|
| 432 | // -----------------------------------
|
|---|
| 433 | QMutableMapIterator<QString, t_qcFrqSum> itFrq(qcSatSum._qcFrqSum);
|
|---|
| 434 | while (itFrq.hasNext()) {
|
|---|
| 435 | itFrq.next();
|
|---|
| 436 | const QString& frqType = itFrq.key();
|
|---|
| 437 | t_qcFrqSum& qcFrqSum = itFrq.value();
|
|---|
| 438 |
|
|---|
| 439 | // Loop over all Chunks of Data
|
|---|
| 440 | // ----------------------------
|
|---|
| 441 | for (bncTime chunkStart = _qcFile._startTime;
|
|---|
| 442 | chunkStart < _qcFile._endTime; chunkStart += chunkStep) {
|
|---|
| 443 |
|
|---|
| 444 | bncTime chunkEnd = chunkStart + chunkStep;
|
|---|
| 445 |
|
|---|
| 446 | QVector<t_qcFrq*> frqVec;
|
|---|
| 447 | QVector<double> MP;
|
|---|
| 448 |
|
|---|
| 449 | // Loop over all Epochs within one Chunk of Data
|
|---|
| 450 | // ---------------------------------------------
|
|---|
| 451 | for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
|
|---|
| 452 | t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
|
|---|
| 453 | if (chunkStart <= qcEpo._epoTime && qcEpo._epoTime < chunkEnd) {
|
|---|
| 454 | if (qcEpo._qcSat.contains(prn)) {
|
|---|
| 455 | t_qcSat& qcSat = qcEpo._qcSat[prn];
|
|---|
| 456 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
|---|
| 457 | t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
|---|
| 458 | if (qcFrq._rnxType2ch == frqType) {
|
|---|
| 459 | frqVec << &qcFrq;
|
|---|
| 460 | if (qcFrq._setMP) {
|
|---|
| 461 | MP << qcFrq._rawMP;
|
|---|
| 462 | }
|
|---|
| 463 | }
|
|---|
| 464 | }
|
|---|
| 465 | }
|
|---|
| 466 | }
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | // Compute the multipath mean and standard deviation
|
|---|
| 470 | // -------------------------------------------------
|
|---|
| 471 | if (MP.size() > 1) {
|
|---|
| 472 | double meanMP = 0.0;
|
|---|
| 473 | for (int ii = 0; ii < MP.size(); ii++) {
|
|---|
| 474 | meanMP += MP[ii];
|
|---|
| 475 | }
|
|---|
| 476 | meanMP /= MP.size();
|
|---|
| 477 |
|
|---|
| 478 | bool slipMP = false;
|
|---|
| 479 |
|
|---|
| 480 | double stdMP = 0.0;
|
|---|
| 481 | for (int ii = 0; ii < MP.size(); ii++) {
|
|---|
| 482 | double diff = MP[ii] - meanMP;
|
|---|
| 483 | if (fabs(diff) > SLIPTRESH) {
|
|---|
| 484 | slipMP = true;
|
|---|
| 485 | break;
|
|---|
| 486 | }
|
|---|
| 487 | stdMP += diff * diff;
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | if (slipMP) {
|
|---|
| 491 | stdMP = 0.0;
|
|---|
| 492 | stdMP = 0.0;
|
|---|
| 493 | qcFrqSum._numSlipsFound += 1;
|
|---|
| 494 | }
|
|---|
| 495 | else {
|
|---|
| 496 | stdMP = sqrt(stdMP / (MP.size()-1));
|
|---|
| 497 | qcFrqSum._numMP += 1;
|
|---|
| 498 | qcFrqSum._sumMP += stdMP;
|
|---|
| 499 | }
|
|---|
| 500 |
|
|---|
| 501 | for (int ii = 0; ii < frqVec.size(); ii++) {
|
|---|
| 502 | t_qcFrq* qcFrq = frqVec[ii];
|
|---|
| 503 | if (slipMP) {
|
|---|
| 504 | qcFrq->_slip = true;
|
|---|
| 505 | }
|
|---|
| 506 | else {
|
|---|
| 507 | qcFrq->_stdMP = stdMP;
|
|---|
| 508 | }
|
|---|
| 509 | }
|
|---|
| 510 | }
|
|---|
| 511 | } // chunk loop
|
|---|
| 512 | } // frq loop
|
|---|
| 513 | } // sat loop
|
|---|
| 514 | }
|
|---|
| 515 |
|
|---|
| 516 | //
|
|---|
| 517 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 518 | void t_reqcAnalyze::preparePlotData(const t_rnxObsFile* obsFile) {
|
|---|
| 519 |
|
|---|
| 520 | bncSettings settings;
|
|---|
| 521 | QString reqSkyPlotSystems = settings.value("reqcSkyPlotSystems").toString();
|
|---|
| 522 | bool plotGPS = false;
|
|---|
| 523 | bool plotGlo = false;
|
|---|
| 524 | bool plotGal = false;
|
|---|
| 525 | bool plotQZSS = false;
|
|---|
| 526 | bool plotSBAS = false;
|
|---|
| 527 | bool plotBDS = false;
|
|---|
| 528 | QString mp1Title = reqSkyPlotSystems + ": MP";
|
|---|
| 529 | QString mp2Title = reqSkyPlotSystems + ": MP";
|
|---|
| 530 | QString snr1Title = reqSkyPlotSystems + ": SNR";
|
|---|
| 531 | QString snr2Title = reqSkyPlotSystems + ": SNR";
|
|---|
| 532 | char freq1 = '1';
|
|---|
| 533 | char freq2 = '2';
|
|---|
| 534 | if (reqSkyPlotSystems == "GPS") {
|
|---|
| 535 | plotGPS = true;
|
|---|
| 536 | }
|
|---|
| 537 | else if (reqSkyPlotSystems == "GLONASS") {
|
|---|
| 538 | plotGlo = true;
|
|---|
| 539 | }
|
|---|
| 540 | else if (reqSkyPlotSystems == "Galileo") {
|
|---|
| 541 | plotGal = true;
|
|---|
| 542 | freq2 = '5';
|
|---|
| 543 | }
|
|---|
| 544 | else if (reqSkyPlotSystems == "QZSS") {
|
|---|
| 545 | plotQZSS = true;
|
|---|
| 546 | }
|
|---|
| 547 | else if (reqSkyPlotSystems == "SBAS") {
|
|---|
| 548 | plotSBAS = true;
|
|---|
| 549 | freq2 = '5';
|
|---|
| 550 | }
|
|---|
| 551 | else if (reqSkyPlotSystems == "BDS") {
|
|---|
| 552 | plotBDS = true;
|
|---|
| 553 | freq2 = '7';
|
|---|
| 554 | }
|
|---|
| 555 | else if (reqSkyPlotSystems == "ALL") {
|
|---|
| 556 | plotGPS = true;
|
|---|
| 557 | plotGlo = true;
|
|---|
| 558 | plotGal = true;
|
|---|
| 559 | plotQZSS = true;
|
|---|
| 560 | plotSBAS = true;
|
|---|
| 561 | plotBDS = true;
|
|---|
| 562 | }
|
|---|
| 563 | else {
|
|---|
| 564 | return;
|
|---|
| 565 | }
|
|---|
| 566 | mp1Title += freq1;
|
|---|
| 567 | mp2Title += freq2;
|
|---|
| 568 | snr1Title += freq1;
|
|---|
| 569 | snr2Title += freq2;
|
|---|
| 570 |
|
|---|
| 571 | QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
|
|---|
| 572 | QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
|
|---|
| 573 | QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
|
|---|
| 574 | QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
|
|---|
| 575 |
|
|---|
| 576 | // Loop over all observations
|
|---|
| 577 | // --------------------------
|
|---|
| 578 | for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
|
|---|
| 579 | t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
|
|---|
| 580 | QMapIterator<t_prn, t_qcSat> it(qcEpo._qcSat);
|
|---|
| 581 | while (it.hasNext()) {
|
|---|
| 582 | it.next();
|
|---|
| 583 | const t_prn& prn = it.key();
|
|---|
| 584 | const t_qcSat& qcSat = it.value();
|
|---|
| 585 | if ( (prn.system() == 'G' && plotGPS) ||
|
|---|
| 586 | (prn.system() == 'R' && plotGlo) ||
|
|---|
| 587 | (prn.system() == 'E' && plotGal) ||
|
|---|
| 588 | (prn.system() == 'J' && plotQZSS) ||
|
|---|
| 589 | (prn.system() == 'S' && plotSBAS) ||
|
|---|
| 590 | (prn.system() == 'C' && plotBDS) ) {
|
|---|
| 591 |
|
|---|
| 592 | if (qcSat._eleSet) {
|
|---|
| 593 | QString frqType1;
|
|---|
| 594 | QString frqType2;
|
|---|
| 595 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
|---|
| 596 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
|---|
| 597 | if (qcFrq._rnxType2ch[0] == freq1 && frqType1.isEmpty()) {
|
|---|
| 598 | frqType1 = qcFrq._rnxType2ch;
|
|---|
| 599 | }
|
|---|
| 600 | if (qcFrq._rnxType2ch[0] == freq2 && frqType2.isEmpty()) {
|
|---|
| 601 | frqType2 = qcFrq._rnxType2ch;
|
|---|
| 602 | }
|
|---|
| 603 | if (qcFrq._rnxType2ch == frqType1) {
|
|---|
| 604 | (*dataSNR1) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._SNR));
|
|---|
| 605 | (*dataMP1) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._stdMP));
|
|---|
| 606 | }
|
|---|
| 607 | else if (qcFrq._rnxType2ch == frqType2) {
|
|---|
| 608 | (*dataSNR2) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._SNR));
|
|---|
| 609 | (*dataMP2) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._stdMP));
|
|---|
| 610 | }
|
|---|
| 611 | }
|
|---|
| 612 | }
|
|---|
| 613 | }
|
|---|
| 614 | }
|
|---|
| 615 | }
|
|---|
| 616 |
|
|---|
| 617 | // Show the plots
|
|---|
| 618 | // --------------
|
|---|
| 619 | if (BNC_CORE->GUIenabled()) {
|
|---|
| 620 | QFileInfo fileInfo(obsFile->fileName());
|
|---|
| 621 | QByteArray title = fileInfo.fileName().toAscii();
|
|---|
| 622 | emit dspSkyPlot(obsFile->fileName(), mp1Title, dataMP1, mp2Title, dataMP2, "Meters", 2.0);
|
|---|
| 623 | emit dspSkyPlot(obsFile->fileName(), snr1Title, dataSNR1, snr2Title, dataSNR2, "dbHz", 54.0);
|
|---|
| 624 | emit dspAvailPlot(obsFile->fileName(), title);
|
|---|
| 625 | }
|
|---|
| 626 | else {
|
|---|
| 627 | for (int ii = 0; ii < dataMP1->size(); ii++) {
|
|---|
| 628 | delete dataMP1->at(ii);
|
|---|
| 629 | }
|
|---|
| 630 | delete dataMP1;
|
|---|
| 631 | for (int ii = 0; ii < dataMP2->size(); ii++) {
|
|---|
| 632 | delete dataMP2->at(ii);
|
|---|
| 633 | }
|
|---|
| 634 | delete dataMP2;
|
|---|
| 635 | for (int ii = 0; ii < dataSNR1->size(); ii++) {
|
|---|
| 636 | delete dataSNR1->at(ii);
|
|---|
| 637 | }
|
|---|
| 638 | delete dataSNR1;
|
|---|
| 639 | for (int ii = 0; ii < dataSNR2->size(); ii++) {
|
|---|
| 640 | delete dataSNR2->at(ii);
|
|---|
| 641 | }
|
|---|
| 642 | delete dataSNR2;
|
|---|
| 643 | }
|
|---|
| 644 | }
|
|---|
| 645 |
|
|---|
| 646 | //
|
|---|
| 647 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 648 | void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName, const QString& title1,
|
|---|
| 649 | QVector<t_polarPoint*>* data1, const QString& title2,
|
|---|
| 650 | QVector<t_polarPoint*>* data2, const QByteArray& scaleTitle,
|
|---|
| 651 | double maxValue) {
|
|---|
| 652 |
|
|---|
| 653 | if (BNC_CORE->GUIenabled()) {
|
|---|
| 654 |
|
|---|
| 655 | if (maxValue == 0.0) {
|
|---|
| 656 | if (data1) {
|
|---|
| 657 | for (int ii = 0; ii < data1->size(); ii++) {
|
|---|
| 658 | double val = data1->at(ii)->_value;
|
|---|
| 659 | if (maxValue < val) {
|
|---|
| 660 | maxValue = val;
|
|---|
| 661 | }
|
|---|
| 662 | }
|
|---|
| 663 | }
|
|---|
| 664 | if (data2) {
|
|---|
| 665 | for (int ii = 0; ii < data2->size(); ii++) {
|
|---|
| 666 | double val = data2->at(ii)->_value;
|
|---|
| 667 | if (maxValue < val) {
|
|---|
| 668 | maxValue = val;
|
|---|
| 669 | }
|
|---|
| 670 | }
|
|---|
| 671 | }
|
|---|
| 672 | }
|
|---|
| 673 |
|
|---|
| 674 | QwtInterval scaleInterval(0.0, maxValue);
|
|---|
| 675 |
|
|---|
| 676 | QVector<QWidget*> plots;
|
|---|
| 677 | if (data1) {
|
|---|
| 678 | t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
|
|---|
| 679 | BNC_CORE->mainWindow());
|
|---|
| 680 | plot1->addCurve(data1);
|
|---|
| 681 | plots << plot1;
|
|---|
| 682 | }
|
|---|
| 683 | if (data2) {
|
|---|
| 684 | t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
|
|---|
| 685 | BNC_CORE->mainWindow());
|
|---|
| 686 | plot2->addCurve(data2);
|
|---|
| 687 | plots << plot2;
|
|---|
| 688 | }
|
|---|
| 689 |
|
|---|
| 690 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
|
|---|
| 691 | &scaleTitle, &scaleInterval);
|
|---|
| 692 |
|
|---|
| 693 | graphWin->show();
|
|---|
| 694 |
|
|---|
| 695 | bncSettings settings;
|
|---|
| 696 | QString dirName = settings.value("reqcPlotDir").toString();
|
|---|
| 697 | if (!dirName.isEmpty()) {
|
|---|
| 698 | QByteArray ext = (scaleTitle == "Meters") ? "_M.png" : "_S.png";
|
|---|
| 699 | graphWin->savePNG(dirName, ext);
|
|---|
| 700 | }
|
|---|
| 701 | }
|
|---|
| 702 | }
|
|---|
| 703 |
|
|---|
| 704 | //
|
|---|
| 705 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 706 | void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName, const QByteArray& title) {
|
|---|
| 707 |
|
|---|
| 708 | t_plotData plotData;
|
|---|
| 709 | QMap<t_prn, t_plotData> plotDataMap;
|
|---|
| 710 |
|
|---|
| 711 | for (int ii = 0; ii < _qcFile._qcEpo.size(); ii++) {
|
|---|
| 712 | const t_qcEpo& qcEpo = _qcFile._qcEpo[ii];
|
|---|
| 713 | double mjdX24 = qcEpo._epoTime.mjddec() * 24.0;
|
|---|
| 714 |
|
|---|
| 715 | plotData._mjdX24 << mjdX24;
|
|---|
| 716 | plotData._PDOP << qcEpo._PDOP;
|
|---|
| 717 | plotData._numSat << qcEpo._qcSat.size();
|
|---|
| 718 |
|
|---|
| 719 | QMapIterator<t_prn, t_qcSat> it(qcEpo._qcSat);
|
|---|
| 720 | while (it.hasNext()) {
|
|---|
| 721 | it.next();
|
|---|
| 722 | const t_prn& prn = it.key();
|
|---|
| 723 | const t_qcSat& qcSat = it.value();
|
|---|
| 724 | t_plotData& data = plotDataMap[prn];
|
|---|
| 725 |
|
|---|
| 726 | if (qcSat._eleSet) {
|
|---|
| 727 | data._mjdX24 << mjdX24;
|
|---|
| 728 | data._eleDeg << qcSat._eleDeg;
|
|---|
| 729 | }
|
|---|
| 730 |
|
|---|
| 731 | QString frqType1;
|
|---|
| 732 | QString frqType2;
|
|---|
| 733 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
|---|
| 734 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
|---|
| 735 | if (qcFrq._rnxType2ch[0] == '1' && frqType1.isEmpty()) {
|
|---|
| 736 | frqType1 = qcFrq._rnxType2ch;
|
|---|
| 737 | }
|
|---|
| 738 | if (qcFrq._rnxType2ch[0] == '2' && frqType2.isEmpty()) {
|
|---|
| 739 | frqType2 = qcFrq._rnxType2ch;
|
|---|
| 740 | }
|
|---|
| 741 | if (qcFrq._rnxType2ch == frqType1) {
|
|---|
| 742 | if (qcFrq._slip) {
|
|---|
| 743 | data._L1slip << mjdX24;
|
|---|
| 744 | }
|
|---|
| 745 | else if (qcFrq._gap) {
|
|---|
| 746 | data._L1gap << mjdX24;
|
|---|
| 747 | }
|
|---|
| 748 | else {
|
|---|
| 749 | data._L1ok << mjdX24;
|
|---|
| 750 | }
|
|---|
| 751 | }
|
|---|
| 752 | else if (qcFrq._rnxType2ch == frqType2) {
|
|---|
| 753 | if (qcFrq._slip) {
|
|---|
| 754 | data._L2slip << mjdX24;
|
|---|
| 755 | }
|
|---|
| 756 | else if (qcFrq._gap) {
|
|---|
| 757 | data._L2gap << mjdX24;
|
|---|
| 758 | }
|
|---|
| 759 | else {
|
|---|
| 760 | data._L2ok << mjdX24;
|
|---|
| 761 | }
|
|---|
| 762 | }
|
|---|
| 763 | }
|
|---|
| 764 | }
|
|---|
| 765 | }
|
|---|
| 766 |
|
|---|
| 767 | if (BNC_CORE->GUIenabled()) {
|
|---|
| 768 | t_availPlot* plotA = new t_availPlot(0, plotDataMap);
|
|---|
| 769 | plotA->setTitle(title);
|
|---|
| 770 |
|
|---|
| 771 | t_elePlot* plotZ = new t_elePlot(0, plotDataMap);
|
|---|
| 772 |
|
|---|
| 773 | t_dopPlot* plotD = new t_dopPlot(0, plotData);
|
|---|
| 774 |
|
|---|
| 775 | QVector<QWidget*> plots;
|
|---|
| 776 | plots << plotA << plotZ << plotD;
|
|---|
| 777 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
|
|---|
| 778 |
|
|---|
| 779 | int ww = QFontMetrics(graphWin->font()).width('w');
|
|---|
| 780 | graphWin->setMinimumSize(120*ww, 40*ww);
|
|---|
| 781 |
|
|---|
| 782 | graphWin->show();
|
|---|
| 783 |
|
|---|
| 784 | bncSettings settings;
|
|---|
| 785 | QString dirName = settings.value("reqcPlotDir").toString();
|
|---|
| 786 | if (!dirName.isEmpty()) {
|
|---|
| 787 | QByteArray ext = "_A.png";
|
|---|
| 788 | graphWin->savePNG(dirName, ext);
|
|---|
| 789 | }
|
|---|
| 790 | }
|
|---|
| 791 | }
|
|---|
| 792 |
|
|---|
| 793 | // Finish the report
|
|---|
| 794 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 795 | void t_reqcAnalyze::printReport(const t_rnxObsFile* obsFile) {
|
|---|
| 796 |
|
|---|
| 797 | static const double QC_FORMAT_VERSION = 1.0;
|
|---|
| 798 |
|
|---|
| 799 | if (!_log) {
|
|---|
| 800 | return;
|
|---|
| 801 | }
|
|---|
| 802 |
|
|---|
| 803 | QFileInfo obsFi(obsFile->fileName());
|
|---|
| 804 | QString obsFileName = obsFi.fileName();
|
|---|
| 805 |
|
|---|
| 806 | QString navFileName;
|
|---|
| 807 | QStringListIterator namIt(_navFileNames);
|
|---|
| 808 | bool firstName = true;
|
|---|
| 809 | while (namIt.hasNext()) {
|
|---|
| 810 | QFileInfo navFi(namIt.next());
|
|---|
| 811 | if (firstName) {
|
|---|
| 812 | firstName = false;
|
|---|
| 813 | navFileName += navFi.fileName();
|
|---|
| 814 | }
|
|---|
| 815 | else {
|
|---|
| 816 | navFileName += ", " + navFi.fileName();
|
|---|
| 817 | }
|
|---|
| 818 | }
|
|---|
| 819 |
|
|---|
| 820 | // Summary
|
|---|
| 821 | // -------
|
|---|
| 822 | *_log << "QC Format Version : " << QString("%1").arg(QC_FORMAT_VERSION,3,'f',1) << endl << endl
|
|---|
| 823 | << "Observation File : " << obsFileName << endl
|
|---|
| 824 | << "Navigation File(s): " << navFileName << endl
|
|---|
| 825 | << "RINEX Version : " << QString("%1").arg(obsFile->version(),4,'f',2) << endl
|
|---|
| 826 | << "Marker Name : " << _qcFile._markerName << endl
|
|---|
| 827 | << "Marker Number : " << obsFile->markerNumber() << endl
|
|---|
| 828 | << "Receiver : " << _qcFile._receiverType << endl
|
|---|
| 829 | << "Antenna : " << _qcFile._antennaName << endl
|
|---|
| 830 | << "Position XYZ : " << QString("%1 %2 %3").arg(obsFile->xyz()(1), 14, 'f', 4)
|
|---|
| 831 | .arg(obsFile->xyz()(2), 14, 'f', 4)
|
|---|
| 832 | .arg(obsFile->xyz()(3), 14, 'f', 4) << endl
|
|---|
| 833 | << "Antenna dH/dE/dN : " << QString("%1 %2 %3").arg(obsFile->antNEU()(3), 8, 'f', 4)
|
|---|
| 834 | .arg(obsFile->antNEU()(2), 8, 'f', 4)
|
|---|
| 835 | .arg(obsFile->antNEU()(1), 8, 'f', 4) << endl
|
|---|
| 836 | << "Start Time : " << _qcFile._startTime.datestr().c_str() << ' '
|
|---|
| 837 | << _qcFile._startTime.timestr(1,'.').c_str() << endl
|
|---|
| 838 | << "End Time : " << _qcFile._endTime.datestr().c_str() << ' '
|
|---|
| 839 | << _qcFile._endTime.timestr(1,'.').c_str() << endl
|
|---|
| 840 | << "Interval : " << _qcFile._interval << endl;
|
|---|
| 841 |
|
|---|
| 842 | // Number of systems
|
|---|
| 843 | // -----------------
|
|---|
| 844 | QMap<QChar, QVector<const t_qcSatSum*> > systemMap;
|
|---|
| 845 | QMapIterator<t_prn, t_qcSatSum> itSat(_qcFile._qcSatSum);
|
|---|
| 846 | while (itSat.hasNext()) {
|
|---|
| 847 | itSat.next();
|
|---|
| 848 | const t_prn& prn = itSat.key();
|
|---|
| 849 | const t_qcSatSum& qcSatSum = itSat.value();
|
|---|
| 850 | systemMap[prn.system()].push_back(&qcSatSum);
|
|---|
| 851 | }
|
|---|
| 852 |
|
|---|
| 853 | *_log << "Navigation Systems: " << systemMap.size() << " ";
|
|---|
| 854 | QMapIterator<QChar, QVector<const t_qcSatSum*> > itSys(systemMap);
|
|---|
| 855 | while (itSys.hasNext()) {
|
|---|
| 856 | itSys.next();
|
|---|
| 857 | *_log << ' ' << itSys.key();
|
|---|
| 858 | }
|
|---|
| 859 | *_log << endl;
|
|---|
| 860 |
|
|---|
| 861 | itSys.toFront();
|
|---|
| 862 | while (itSys.hasNext()) {
|
|---|
| 863 | itSys.next();
|
|---|
| 864 | const QChar& sys = itSys.key();
|
|---|
| 865 | const QVector<const t_qcSatSum*>& qcSatVec = itSys.value();
|
|---|
| 866 | QString prefixSys = QString(" ") + sys + QString(": ");
|
|---|
| 867 | QMap<QString, QVector<const t_qcFrqSum*> > frqMap;
|
|---|
| 868 | for (int ii = 0; ii < qcSatVec.size(); ii++) {
|
|---|
| 869 | const t_qcSatSum* qcSatSum = qcSatVec[ii];
|
|---|
| 870 | QMapIterator<QString, t_qcFrqSum> itFrq(qcSatSum->_qcFrqSum);
|
|---|
| 871 | while (itFrq.hasNext()) {
|
|---|
| 872 | itFrq.next();
|
|---|
| 873 | QString frqType = itFrq.key(); if (frqType.length() < 2) frqType += '?';
|
|---|
| 874 | const t_qcFrqSum& qcFrqSum = itFrq.value();
|
|---|
| 875 | frqMap[frqType].push_back(&qcFrqSum);
|
|---|
| 876 | }
|
|---|
| 877 | }
|
|---|
| 878 | *_log << endl
|
|---|
| 879 | << prefixSys << "Satellites: " << qcSatVec.size() << endl
|
|---|
| 880 | << prefixSys << "Signals : " << frqMap.size() << " ";
|
|---|
| 881 | QMapIterator<QString, QVector<const t_qcFrqSum*> > itFrq(frqMap);
|
|---|
| 882 | while (itFrq.hasNext()) {
|
|---|
| 883 | itFrq.next();
|
|---|
| 884 | QString frqType = itFrq.key(); if (frqType.length() < 2) frqType += '?';
|
|---|
| 885 | *_log << ' ' << frqType;
|
|---|
| 886 | }
|
|---|
| 887 | *_log << endl;
|
|---|
| 888 | QString prefixSys2 = " " + prefixSys;
|
|---|
| 889 | itFrq.toFront();
|
|---|
| 890 | while (itFrq.hasNext()) {
|
|---|
| 891 | itFrq.next();
|
|---|
| 892 | QString frqType = itFrq.key(); if (frqType.length() < 2) frqType += '?';
|
|---|
| 893 | const QVector<const t_qcFrqSum*> qcFrqVec = itFrq.value();
|
|---|
| 894 | QString prefixFrq = QString(" ") + frqType + QString(": ");
|
|---|
| 895 |
|
|---|
| 896 | int numObs = 0;
|
|---|
| 897 | int numSlipsFlagged = 0;
|
|---|
| 898 | int numSlipsFound = 0;
|
|---|
| 899 | int numGaps = 0;
|
|---|
| 900 | int numSNR = 0;
|
|---|
| 901 | int numMP = 0;
|
|---|
| 902 | double sumSNR = 0.0;
|
|---|
| 903 | double sumMP = 0.0;
|
|---|
| 904 | for (int ii = 0; ii < qcFrqVec.size(); ii++) {
|
|---|
| 905 | const t_qcFrqSum* qcFrqSum = qcFrqVec[ii];
|
|---|
| 906 | numObs += qcFrqSum->_numObs ;
|
|---|
| 907 | numSlipsFlagged += qcFrqSum->_numSlipsFlagged;
|
|---|
| 908 | numSlipsFound += qcFrqSum->_numSlipsFound ;
|
|---|
| 909 | numGaps += qcFrqSum->_numGaps ;
|
|---|
| 910 | numSNR += qcFrqSum->_numSNR;
|
|---|
| 911 | numMP += qcFrqSum->_numMP;
|
|---|
| 912 | sumSNR += qcFrqSum->_sumSNR;
|
|---|
| 913 | sumMP += qcFrqSum->_sumMP;
|
|---|
| 914 | }
|
|---|
| 915 | if (numSNR > 0) {
|
|---|
| 916 | sumSNR /= numSNR;
|
|---|
| 917 | }
|
|---|
| 918 | if (numMP > 0) {
|
|---|
| 919 | sumMP /= numMP;
|
|---|
| 920 | }
|
|---|
| 921 | *_log << endl
|
|---|
| 922 | << prefixSys2 << prefixFrq << "Observations : " << QString("%1\n").arg(numObs, 6)
|
|---|
| 923 | << prefixSys2 << prefixFrq << "Slips (file+found): " << QString("%1 +").arg(numSlipsFlagged, 6)
|
|---|
| 924 | << QString("%1\n").arg(numSlipsFound, 6)
|
|---|
| 925 | << prefixSys2 << prefixFrq << "Gaps : " << QString("%1\n").arg(numGaps, 6)
|
|---|
| 926 | << prefixSys2 << prefixFrq << "Mean SNR : " << QString("%1\n").arg(sumSNR, 6, 'f', 1)
|
|---|
| 927 | << prefixSys2 << prefixFrq << "Mean Multipath : " << QString("%1\n").arg(sumMP, 6, 'f', 2);
|
|---|
| 928 | }
|
|---|
| 929 | }
|
|---|
| 930 |
|
|---|
| 931 | // Epoch-Specific Output
|
|---|
| 932 | // ---------------------
|
|---|
| 933 | bncSettings settings;
|
|---|
| 934 | if (Qt::CheckState(settings.value("reqcLogSummaryOnly").toInt()) == Qt::Checked) {
|
|---|
| 935 | return;
|
|---|
| 936 | }
|
|---|
| 937 | *_log << endl;
|
|---|
| 938 | for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
|
|---|
| 939 | const t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
|
|---|
| 940 |
|
|---|
| 941 | unsigned year, month, day, hour, min;
|
|---|
| 942 | double sec;
|
|---|
| 943 | qcEpo._epoTime.civil_date(year, month, day);
|
|---|
| 944 | qcEpo._epoTime.civil_time(hour, min, sec);
|
|---|
| 945 |
|
|---|
| 946 | QString dateStr;
|
|---|
| 947 | QTextStream(&dateStr) << QString("> %1 %2 %3 %4 %5%6")
|
|---|
| 948 | .arg(year, 4)
|
|---|
| 949 | .arg(month, 2, 10, QChar('0'))
|
|---|
| 950 | .arg(day, 2, 10, QChar('0'))
|
|---|
| 951 | .arg(hour, 2, 10, QChar('0'))
|
|---|
| 952 | .arg(min, 2, 10, QChar('0'))
|
|---|
| 953 | .arg(sec, 11, 'f', 7);
|
|---|
| 954 |
|
|---|
| 955 | *_log << dateStr << QString(" %1").arg(qcEpo._qcSat.size(), 2)
|
|---|
| 956 | << QString(" %1").arg(qcEpo._PDOP, 4, 'f', 1)
|
|---|
| 957 | << endl;
|
|---|
| 958 |
|
|---|
| 959 | QMapIterator<t_prn, t_qcSat> itSat(qcEpo._qcSat);
|
|---|
| 960 | while (itSat.hasNext()) {
|
|---|
| 961 | itSat.next();
|
|---|
| 962 | const t_prn& prn = itSat.key();
|
|---|
| 963 | const t_qcSat& qcSat = itSat.value();
|
|---|
| 964 |
|
|---|
| 965 | *_log << prn.toString().c_str()
|
|---|
| 966 | << QString(" %1 %2").arg(qcSat._eleDeg, 6, 'f', 2).arg(qcSat._azDeg, 7, 'f', 2);
|
|---|
| 967 |
|
|---|
| 968 | int numObsTypes = 0;
|
|---|
| 969 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
|---|
| 970 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
|---|
| 971 | if (qcFrq._phaseValid) {
|
|---|
| 972 | numObsTypes += 1;
|
|---|
| 973 | }
|
|---|
| 974 | if (qcFrq._codeValid) {
|
|---|
| 975 | numObsTypes += 1;
|
|---|
| 976 | }
|
|---|
| 977 | }
|
|---|
| 978 | *_log << QString(" %1").arg(numObsTypes, 2);
|
|---|
| 979 |
|
|---|
| 980 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
|---|
| 981 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
|---|
| 982 | if (qcFrq._phaseValid) {
|
|---|
| 983 | *_log << " L" << qcFrq._rnxType2ch << ' ';
|
|---|
| 984 | if (qcFrq._slip) {
|
|---|
| 985 | *_log << 's';
|
|---|
| 986 | }
|
|---|
| 987 | else {
|
|---|
| 988 | *_log << '.';
|
|---|
| 989 | }
|
|---|
| 990 | if (qcFrq._gap) {
|
|---|
| 991 | *_log << 'g';
|
|---|
| 992 | }
|
|---|
| 993 | else {
|
|---|
| 994 | *_log << '.';
|
|---|
| 995 | }
|
|---|
| 996 | *_log << QString(" %1").arg(qcFrq._SNR, 4, 'f', 1);
|
|---|
| 997 | }
|
|---|
| 998 | if (qcFrq._codeValid) {
|
|---|
| 999 | *_log << " C" << qcFrq._rnxType2ch << ' ';
|
|---|
| 1000 | if (qcFrq._gap) {
|
|---|
| 1001 | *_log << " g";
|
|---|
| 1002 | }
|
|---|
| 1003 | else {
|
|---|
| 1004 | *_log << " .";
|
|---|
| 1005 | }
|
|---|
| 1006 | *_log << QString(" %1").arg(qcFrq._stdMP, 3, 'f', 2);
|
|---|
| 1007 | }
|
|---|
| 1008 | }
|
|---|
| 1009 | *_log << endl;
|
|---|
| 1010 | }
|
|---|
| 1011 | }
|
|---|
| 1012 | _log->flush();
|
|---|
| 1013 | }
|
|---|