[3899] | 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 | *
|
---|
[6255] | 37 | * Changes:
|
---|
[3899] | 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
| 41 | #include <iostream>
|
---|
[4361] | 42 | #include <iomanip>
|
---|
[4579] | 43 | #include <qwt_plot_renderer.h>
|
---|
[4574] | 44 |
|
---|
[3899] | 45 | #include "reqcanalyze.h"
|
---|
[5070] | 46 | #include "bnccore.h"
|
---|
[3899] | 47 | #include "bncsettings.h"
|
---|
[4254] | 48 | #include "reqcedit.h"
|
---|
[4255] | 49 | #include "bncutils.h"
|
---|
[4300] | 50 | #include "graphwin.h"
|
---|
[4307] | 51 | #include "polarplot.h"
|
---|
[4577] | 52 | #include "availplot.h"
|
---|
[4662] | 53 | #include "eleplot.h"
|
---|
[4672] | 54 | #include "dopplot.h"
|
---|
[3899] | 55 |
|
---|
| 56 | using namespace std;
|
---|
| 57 |
|
---|
| 58 | // Constructor
|
---|
| 59 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 60 | t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
|
---|
| 61 |
|
---|
| 62 | bncSettings settings;
|
---|
[4254] | 63 |
|
---|
[4257] | 64 | _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
|
---|
| 65 | _logFile = 0;
|
---|
| 66 | _log = 0;
|
---|
[6271] | 67 | _currEpo = 0;
|
---|
[4254] | 68 | _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
|
---|
[4257] | 69 | _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
|
---|
[6275] | 70 |
|
---|
[6322] | 71 | connect(this, SIGNAL(dspSkyPlot(const QString&, const QString&, QVector<t_polarPoint*>*,
|
---|
| 72 | const QString&, QVector<t_polarPoint*>*,
|
---|
[6275] | 73 | const QByteArray&, double)),
|
---|
[6322] | 74 | this, SLOT(slotDspSkyPlot(const QString&, const QString&, QVector<t_polarPoint*>*,
|
---|
| 75 | const QString&, QVector<t_polarPoint*>*,
|
---|
[6275] | 76 | const QByteArray&, double)));
|
---|
| 77 |
|
---|
| 78 | connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
|
---|
| 79 | this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
|
---|
[3899] | 80 | }
|
---|
| 81 |
|
---|
| 82 | // Destructor
|
---|
| 83 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 84 | t_reqcAnalyze::~t_reqcAnalyze() {
|
---|
[4255] | 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;
|
---|
[5072] | 93 | if (BNC_CORE->mode() != t_bncCore::interactive) {
|
---|
[5066] | 94 | qApp->exit(0);
|
---|
[4452] | 95 | }
|
---|
[3899] | 96 | }
|
---|
| 97 |
|
---|
[6255] | 98 | //
|
---|
[3899] | 99 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 100 | void t_reqcAnalyze::run() {
|
---|
| 101 |
|
---|
[4255] | 102 | // Open Log File
|
---|
| 103 | // -------------
|
---|
| 104 | _logFile = new QFile(_logFileName);
|
---|
[4517] | 105 | if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
---|
| 106 | _log = new QTextStream();
|
---|
| 107 | _log->setDevice(_logFile);
|
---|
| 108 | }
|
---|
[4255] | 109 |
|
---|
| 110 | // Initialize RINEX Observation Files
|
---|
| 111 | // ----------------------------------
|
---|
[4525] | 112 | t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
|
---|
[3899] | 113 |
|
---|
[4257] | 114 | // Read Ephemerides
|
---|
| 115 | // ----------------
|
---|
| 116 | t_reqcEdit::readEphemerides(_navFileNames, _ephs);
|
---|
| 117 |
|
---|
[4255] | 118 | // Loop over all RINEX Files
|
---|
| 119 | // -------------------------
|
---|
[4254] | 120 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
---|
| 121 | analyzeFile(_rnxObsFiles[ii]);
|
---|
| 122 | }
|
---|
| 123 |
|
---|
[4255] | 124 | // Exit
|
---|
| 125 | // ----
|
---|
[4452] | 126 | emit finished();
|
---|
| 127 | deleteLater();
|
---|
[3899] | 128 | }
|
---|
[4254] | 129 |
|
---|
[6255] | 130 | //
|
---|
[4254] | 131 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4260] | 132 | void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
|
---|
[4259] | 133 |
|
---|
[6271] | 134 | _qcFile.clear();
|
---|
[4343] | 135 |
|
---|
[4342] | 136 | // A priori Coordinates
|
---|
| 137 | // --------------------
|
---|
[4679] | 138 | ColumnVector xyzSta = obsFile->xyz();
|
---|
[4342] | 139 |
|
---|
[4262] | 140 | // Loop over all Epochs
|
---|
| 141 | // --------------------
|
---|
[4541] | 142 | try {
|
---|
[6296] | 143 | QMap<QString, bncTime> lastObsTime;
|
---|
[6271] | 144 | bool firstEpo = true;
|
---|
[4541] | 145 | while ( (_currEpo = obsFile->nextEpoch()) != 0) {
|
---|
[6271] | 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();
|
---|
[4688] | 153 | }
|
---|
[6271] | 154 | _qcFile._endTime = _currEpo->tt;
|
---|
[6255] | 155 |
|
---|
[6271] | 156 | t_qcEpo qcEpo;
|
---|
| 157 | qcEpo._epoTime = _currEpo->tt;
|
---|
| 158 | qcEpo._PDOP = cmpDOP(xyzSta);
|
---|
| 159 |
|
---|
[4541] | 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];
|
---|
[6271] | 164 | t_satObs satObs;
|
---|
| 165 | t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, satObs);
|
---|
[6288] | 166 | t_qcSat& qcSat = qcEpo._qcSat[satObs._prn];
|
---|
[6296] | 167 | setQcObs(qcEpo._epoTime, xyzSta, satObs, lastObsTime, qcSat);
|
---|
[6288] | 168 | updateQcSat(qcSat, _qcFile._qcSatSum[satObs._prn]);
|
---|
[4262] | 169 | }
|
---|
[6271] | 170 | _qcFile._qcEpo.push_back(qcEpo);
|
---|
| 171 | }
|
---|
[6255] | 172 |
|
---|
[6281] | 173 | analyzeMultipath();
|
---|
| 174 |
|
---|
[6271] | 175 | preparePlotData(obsFile);
|
---|
[4678] | 176 |
|
---|
[6284] | 177 | printReport(obsFile);
|
---|
[4541] | 178 | }
|
---|
| 179 | catch (QString str) {
|
---|
| 180 | if (_log) {
|
---|
| 181 | *_log << "Exception " << str << endl;
|
---|
[4262] | 182 | }
|
---|
[4541] | 183 | else {
|
---|
[6255] | 184 | qDebug() << str;
|
---|
[4541] | 185 | }
|
---|
| 186 | }
|
---|
[6271] | 187 | }
|
---|
[4262] | 188 |
|
---|
[6271] | 189 | // Compute Dilution of Precision
|
---|
| 190 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 191 | double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
|
---|
[4268] | 192 |
|
---|
[6398] | 193 | if ( xyzSta.size() != 3 || (xyzSta[0] == 0.0 && xyzSta[1] == 0.0 && xyzSta[2] == 0.0) ) {
|
---|
[6271] | 194 | return 0.0;
|
---|
[4268] | 195 | }
|
---|
| 196 |
|
---|
[6271] | 197 | unsigned nSat = _currEpo->rnxSat.size();
|
---|
[4706] | 198 |
|
---|
[6271] | 199 | if (nSat < 4) {
|
---|
| 200 | return 0.0;
|
---|
[4718] | 201 | }
|
---|
[6271] | 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 | }
|
---|
[4718] | 217 | }
|
---|
[6271] | 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 | }
|
---|
[4718] | 230 | }
|
---|
| 231 | }
|
---|
[6271] | 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());
|
---|
[4254] | 244 | }
|
---|
[4263] | 245 |
|
---|
[6255] | 246 | //
|
---|
[4263] | 247 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6288] | 248 | void t_reqcAnalyze::updateQcSat(const t_qcSat& qcSat, t_qcSatSum& qcSatSum) {
|
---|
[6285] | 249 |
|
---|
[6288] | 250 | for (int ii = 0; ii < qcSat._qcFrq.size(); ii++) {
|
---|
| 251 | const t_qcFrq& qcFrq = qcSat._qcFrq[ii];
|
---|
[6285] | 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 | }
|
---|
[6312] | 260 | if (qcFrq._SNR > 0.0) {
|
---|
| 261 | qcFrqSum._numSNR += 1;
|
---|
| 262 | qcFrqSum._sumSNR += qcFrq._SNR;
|
---|
| 263 | }
|
---|
[6271] | 264 | }
|
---|
| 265 | }
|
---|
[4265] | 266 |
|
---|
[6271] | 267 | //
|
---|
| 268 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6281] | 269 | void t_reqcAnalyze::setQcObs(const bncTime& epoTime, const ColumnVector& xyzSta,
|
---|
[6296] | 270 | const t_satObs& satObs, QMap<QString, bncTime>& lastObsTime,
|
---|
| 271 | t_qcSat& qcSat) {
|
---|
[4338] | 272 |
|
---|
[6281] | 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;
|
---|
[6271] | 278 | }
|
---|
[6281] | 279 | }
|
---|
| 280 | if (eph) {
|
---|
| 281 | ColumnVector xc(4);
|
---|
| 282 | ColumnVector vv(3);
|
---|
[6398] | 283 | if ( xyzSta.size() == 3 && (xyzSta[0] != 0.0 || xyzSta[1] != 0.0 || xyzSta[2] != 0.0) &&
|
---|
| 284 | eph->getCrd(epoTime, xc, vv, false) == success) {
|
---|
[6281] | 285 | double rho, eleSat, azSat;
|
---|
| 286 | topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
|
---|
[6288] | 287 | qcSat._eleSet = true;
|
---|
| 288 | qcSat._azDeg = azSat * 180.0/M_PI;
|
---|
| 289 | qcSat._eleDeg = eleSat * 180.0/M_PI;
|
---|
[6281] | 290 | }
|
---|
| 291 | if (satObs._prn.system() == 'R') {
|
---|
[6288] | 292 | qcSat._slotSet = true;
|
---|
| 293 | qcSat._slotNum = eph->slotNum();
|
---|
[6271] | 294 | }
|
---|
| 295 | }
|
---|
| 296 |
|
---|
[4608] | 297 | // Availability and Slip Flags
|
---|
| 298 | // ---------------------------
|
---|
[6285] | 299 | for (unsigned ii = 0; ii < satObs._obs.size(); ii++) {
|
---|
| 300 | const t_frqObs* frqObs = satObs._obs[ii];
|
---|
| 301 |
|
---|
[6288] | 302 | qcSat._qcFrq.push_back(t_qcFrq());
|
---|
| 303 | t_qcFrq& qcFrq = qcSat._qcFrq.back();
|
---|
[6285] | 304 |
|
---|
| 305 | qcFrq._rnxType2ch = QString(frqObs->_rnxType2ch.c_str());
|
---|
| 306 | qcFrq._SNR = frqObs->_snr;
|
---|
| 307 | qcFrq._slip = frqObs->_slip;
|
---|
[6293] | 308 | qcFrq._phaseValid = frqObs->_phaseValid;
|
---|
| 309 | qcFrq._codeValid = frqObs->_codeValid;
|
---|
[6285] | 310 | // Check Gaps
|
---|
| 311 | // ----------
|
---|
[6296] | 312 | QString key = QString(satObs._prn.toString().c_str()) + qcFrq._rnxType2ch;
|
---|
| 313 | if (lastObsTime[key].valid()) {
|
---|
| 314 | double dt = epoTime - lastObsTime[key];
|
---|
[6285] | 315 | if (dt > 1.5 * _qcFile._interval) {
|
---|
| 316 | qcFrq._gap = true;
|
---|
[6137] | 317 | }
|
---|
| 318 | }
|
---|
[6296] | 319 | lastObsTime[key] = epoTime;
|
---|
[6285] | 320 |
|
---|
| 321 | // Compute the Multipath Linear Combination
|
---|
| 322 | // ----------------------------------------
|
---|
[6292] | 323 | if (frqObs->_codeValid) {
|
---|
[6285] | 324 | t_frequency::type fA;
|
---|
| 325 | t_frequency::type fB;
|
---|
| 326 | if (satObs._prn.system() == 'G') {
|
---|
| 327 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
| 328 | fA = t_frequency::G1;
|
---|
| 329 | fB = t_frequency::G2;
|
---|
| 330 | }
|
---|
| 331 | else if (frqObs->_rnxType2ch[0] == '2') {
|
---|
| 332 | fA = t_frequency::G2;
|
---|
| 333 | fB = t_frequency::G1;
|
---|
| 334 | }
|
---|
[6137] | 335 | }
|
---|
[6285] | 336 | else if (satObs._prn.system() == 'R') {
|
---|
| 337 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
| 338 | fA = t_frequency::R1;
|
---|
| 339 | fB = t_frequency::R2;
|
---|
| 340 | }
|
---|
| 341 | else if (frqObs->_rnxType2ch[0] == '2') {
|
---|
| 342 | fA = t_frequency::R2;
|
---|
| 343 | fB = t_frequency::R1;
|
---|
| 344 | }
|
---|
[6137] | 345 | }
|
---|
[6285] | 346 | else if (satObs._prn.system() == 'E') {
|
---|
| 347 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
| 348 | fA = t_frequency::E1;
|
---|
| 349 | fB = t_frequency::E5;
|
---|
| 350 | }
|
---|
| 351 | else if (frqObs->_rnxType2ch[0] == '5') {
|
---|
| 352 | fA = t_frequency::E5;
|
---|
| 353 | fB = t_frequency::E1;
|
---|
| 354 | }
|
---|
[6137] | 355 | }
|
---|
[6322] | 356 | else if (satObs._prn.system() == 'J') {
|
---|
| 357 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
| 358 | fA = t_frequency::J1;
|
---|
| 359 | fB = t_frequency::J2;
|
---|
| 360 | }
|
---|
| 361 | else if (frqObs->_rnxType2ch[0] == '2') {
|
---|
| 362 | fA = t_frequency::J2;
|
---|
| 363 | fB = t_frequency::J1;
|
---|
| 364 | }
|
---|
| 365 | }
|
---|
| 366 | else if (satObs._prn.system() == 'S') {
|
---|
| 367 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
| 368 | fA = t_frequency::S1;
|
---|
| 369 | fB = t_frequency::S5;
|
---|
| 370 | }
|
---|
| 371 | else if (frqObs->_rnxType2ch[0] == '5') {
|
---|
| 372 | fA = t_frequency::S5;
|
---|
| 373 | fB = t_frequency::S1;
|
---|
| 374 | }
|
---|
| 375 | }
|
---|
| 376 | else if (satObs._prn.system() == 'C') {
|
---|
| 377 | if (frqObs->_rnxType2ch[0] == '1') {
|
---|
| 378 | fA = t_frequency::C1;
|
---|
| 379 | fB = t_frequency::C7;
|
---|
| 380 | }
|
---|
| 381 | else if (frqObs->_rnxType2ch[0] == '7') {
|
---|
| 382 | fA = t_frequency::C7;
|
---|
| 383 | fB = t_frequency::C1;
|
---|
| 384 | }
|
---|
| 385 | }
|
---|
[6285] | 386 | if (fA != t_frequency::dummy && fB != t_frequency::dummy) {
|
---|
[6292] | 387 | double f_a = t_CST::freq(fA, qcSat._slotNum);
|
---|
| 388 | double f_b = t_CST::freq(fB, qcSat._slotNum);
|
---|
| 389 | double C_a = frqObs->_code;
|
---|
| 390 |
|
---|
| 391 | bool foundA = false;
|
---|
| 392 | double L_a = 0.0;
|
---|
| 393 | bool foundB = false;
|
---|
| 394 | double L_b = 0.0;
|
---|
[6285] | 395 | for (unsigned jj = 0; jj < satObs._obs.size(); jj++) {
|
---|
[6292] | 396 | const t_frqObs* frqObsHlp = satObs._obs[jj];
|
---|
| 397 | if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fA)[1] &&
|
---|
| 398 | frqObsHlp->_phaseValid) {
|
---|
| 399 | foundA = true;
|
---|
| 400 | L_a = frqObsHlp->_phase * t_CST::c / f_a;
|
---|
[6285] | 401 | }
|
---|
[6292] | 402 | else if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fB)[1] &&
|
---|
| 403 | frqObsHlp->_phaseValid) {
|
---|
| 404 | foundB = true;
|
---|
| 405 | L_b = frqObsHlp->_phase * t_CST::c / f_b;
|
---|
| 406 | }
|
---|
[6285] | 407 | }
|
---|
[6292] | 408 | if (foundA && foundB) {
|
---|
| 409 | qcFrq._setMP = true;
|
---|
| 410 | qcFrq._rawMP = C_a - L_a - 2.0*f_b*f_b/(f_a*f_a-f_b*f_b) * (L_a - L_b);
|
---|
| 411 | }
|
---|
[6285] | 412 | }
|
---|
| 413 | }
|
---|
[6291] | 414 | } // satObs loop
|
---|
[4263] | 415 | }
|
---|
[4350] | 416 |
|
---|
[6255] | 417 | //
|
---|
[4350] | 418 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6281] | 419 | void t_reqcAnalyze::analyzeMultipath() {
|
---|
[4675] | 420 |
|
---|
[6271] | 421 | const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
|
---|
| 422 | const double chunkStep = 600.0; // 10 minutes
|
---|
[4584] | 423 |
|
---|
[6271] | 424 | // Loop over all satellites available
|
---|
| 425 | // ----------------------------------
|
---|
[6285] | 426 | QMutableMapIterator<t_prn, t_qcSatSum> itSat(_qcFile._qcSatSum);
|
---|
| 427 | while (itSat.hasNext()) {
|
---|
| 428 | itSat.next();
|
---|
| 429 | const t_prn& prn = itSat.key();
|
---|
| 430 | t_qcSatSum& qcSatSum = itSat.value();
|
---|
[4351] | 431 |
|
---|
[6285] | 432 | // Loop over all frequencies available
|
---|
| 433 | // -----------------------------------
|
---|
| 434 | QMutableMapIterator<QString, t_qcFrqSum> itFrq(qcSatSum._qcFrqSum);
|
---|
| 435 | while (itFrq.hasNext()) {
|
---|
| 436 | itFrq.next();
|
---|
| 437 | const QString& frqType = itFrq.key();
|
---|
| 438 | t_qcFrqSum& qcFrqSum = itFrq.value();
|
---|
[4702] | 439 |
|
---|
[6285] | 440 | // Loop over all Chunks of Data
|
---|
| 441 | // ----------------------------
|
---|
| 442 | for (bncTime chunkStart = _qcFile._startTime;
|
---|
| 443 | chunkStart < _qcFile._endTime; chunkStart += chunkStep) {
|
---|
| 444 |
|
---|
| 445 | bncTime chunkEnd = chunkStart + chunkStep;
|
---|
| 446 |
|
---|
| 447 | QVector<t_qcFrq*> frqVec;
|
---|
| 448 | QVector<double> MP;
|
---|
[6271] | 449 |
|
---|
[6285] | 450 | // Loop over all Epochs within one Chunk of Data
|
---|
| 451 | // ---------------------------------------------
|
---|
| 452 | for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
|
---|
| 453 | t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
|
---|
| 454 | if (chunkStart <= qcEpo._epoTime && qcEpo._epoTime < chunkEnd) {
|
---|
[6288] | 455 | if (qcEpo._qcSat.contains(prn)) {
|
---|
| 456 | t_qcSat& qcSat = qcEpo._qcSat[prn];
|
---|
| 457 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
---|
| 458 | t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
---|
[6285] | 459 | if (qcFrq._rnxType2ch == frqType) {
|
---|
| 460 | frqVec << &qcFrq;
|
---|
| 461 | if (qcFrq._setMP) {
|
---|
| 462 | MP << qcFrq._rawMP;
|
---|
| 463 | }
|
---|
| 464 | }
|
---|
| 465 | }
|
---|
[6213] | 466 | }
|
---|
[4590] | 467 | }
|
---|
| 468 | }
|
---|
[4563] | 469 |
|
---|
[6285] | 470 | // Compute the multipath mean and standard deviation
|
---|
| 471 | // -------------------------------------------------
|
---|
| 472 | if (MP.size() > 1) {
|
---|
| 473 | double meanMP = 0.0;
|
---|
| 474 | for (int ii = 0; ii < MP.size(); ii++) {
|
---|
| 475 | meanMP += MP[ii];
|
---|
[6271] | 476 | }
|
---|
[6285] | 477 | meanMP /= MP.size();
|
---|
| 478 |
|
---|
| 479 | bool slipMP = false;
|
---|
| 480 |
|
---|
| 481 | double stdMP = 0.0;
|
---|
| 482 | for (int ii = 0; ii < MP.size(); ii++) {
|
---|
| 483 | double diff = MP[ii] - meanMP;
|
---|
| 484 | if (fabs(diff) > SLIPTRESH) {
|
---|
| 485 | slipMP = true;
|
---|
| 486 | break;
|
---|
| 487 | }
|
---|
| 488 | stdMP += diff * diff;
|
---|
| 489 | }
|
---|
| 490 |
|
---|
[6281] | 491 | if (slipMP) {
|
---|
[6285] | 492 | stdMP = 0.0;
|
---|
| 493 | stdMP = 0.0;
|
---|
| 494 | qcFrqSum._numSlipsFound += 1;
|
---|
[6281] | 495 | }
|
---|
| 496 | else {
|
---|
[6285] | 497 | stdMP = sqrt(stdMP / (MP.size()-1));
|
---|
[6312] | 498 | qcFrqSum._numMP += 1;
|
---|
| 499 | qcFrqSum._sumMP += stdMP;
|
---|
[6281] | 500 | }
|
---|
[6285] | 501 |
|
---|
| 502 | for (int ii = 0; ii < frqVec.size(); ii++) {
|
---|
| 503 | t_qcFrq* qcFrq = frqVec[ii];
|
---|
| 504 | if (slipMP) {
|
---|
| 505 | qcFrq->_slip = true;
|
---|
| 506 | }
|
---|
| 507 | else {
|
---|
| 508 | qcFrq->_stdMP = stdMP;
|
---|
| 509 | }
|
---|
| 510 | }
|
---|
[6281] | 511 | }
|
---|
[6285] | 512 | } // chunk loop
|
---|
| 513 | } // frq loop
|
---|
| 514 | } // sat loop
|
---|
[6281] | 515 | }
|
---|
| 516 |
|
---|
| 517 | //
|
---|
| 518 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 519 | void t_reqcAnalyze::preparePlotData(const t_rnxObsFile* obsFile) {
|
---|
| 520 |
|
---|
| 521 | bncSettings settings;
|
---|
[6413] | 522 |
|
---|
| 523 | QStringList signalsOpt = settings.value("reqcSkyPlotSignals").toString().split(" ", QString::SkipEmptyParts);
|
---|
| 524 | QMap<char, QVector<QString> > signalsMap;
|
---|
| 525 | for (int ii = 0; ii < signalsOpt.size(); ii++) {
|
---|
| 526 | QStringList hlp = signalsOpt.at(ii).split(QRegExp("[:&]"), QString::SkipEmptyParts);
|
---|
[6415] | 527 | if (hlp.size() > 1 && hlp[0].length() == 1) {
|
---|
| 528 | for (int jj = 1; jj < hlp.size(); jj++) {
|
---|
| 529 | signalsMap[hlp[0].toAscii().constData()[0]] << hlp[jj];
|
---|
| 530 | }
|
---|
| 531 | }
|
---|
[6413] | 532 | }
|
---|
| 533 |
|
---|
[6415] | 534 | qDebug() << signalsMap;
|
---|
[6413] | 535 |
|
---|
[6415] | 536 |
|
---|
[6322] | 537 | bool plotGPS = false;
|
---|
| 538 | bool plotGlo = false;
|
---|
| 539 | bool plotGal = false;
|
---|
| 540 | bool plotQZSS = false;
|
---|
| 541 | bool plotSBAS = false;
|
---|
| 542 | bool plotBDS = false;
|
---|
[6413] | 543 | QString mp1Title = ": MP";
|
---|
| 544 | QString mp2Title = ": MP";
|
---|
| 545 | QString snr1Title = ": SNR";
|
---|
| 546 | QString snr2Title = ": SNR";
|
---|
[6322] | 547 | char freq1 = '1';
|
---|
| 548 | char freq2 = '2';
|
---|
[6413] | 549 |
|
---|
| 550 | QString reqSkyPlotSystems = "ALL";
|
---|
[6281] | 551 | if (reqSkyPlotSystems == "GPS") {
|
---|
| 552 | plotGPS = true;
|
---|
| 553 | }
|
---|
| 554 | else if (reqSkyPlotSystems == "GLONASS") {
|
---|
| 555 | plotGlo = true;
|
---|
| 556 | }
|
---|
| 557 | else if (reqSkyPlotSystems == "Galileo") {
|
---|
| 558 | plotGal = true;
|
---|
[6322] | 559 | freq2 = '5';
|
---|
[6281] | 560 | }
|
---|
[6322] | 561 | else if (reqSkyPlotSystems == "QZSS") {
|
---|
| 562 | plotQZSS = true;
|
---|
| 563 | }
|
---|
| 564 | else if (reqSkyPlotSystems == "SBAS") {
|
---|
| 565 | plotSBAS = true;
|
---|
| 566 | freq2 = '5';
|
---|
| 567 | }
|
---|
| 568 | else if (reqSkyPlotSystems == "BDS") {
|
---|
| 569 | plotBDS = true;
|
---|
| 570 | freq2 = '7';
|
---|
| 571 | }
|
---|
[6318] | 572 | else if (reqSkyPlotSystems == "ALL") {
|
---|
[6281] | 573 | plotGPS = true;
|
---|
| 574 | plotGlo = true;
|
---|
| 575 | plotGal = true;
|
---|
[6322] | 576 | plotQZSS = true;
|
---|
| 577 | plotSBAS = true;
|
---|
| 578 | plotBDS = true;
|
---|
[6281] | 579 | }
|
---|
[6318] | 580 | else {
|
---|
| 581 | return;
|
---|
| 582 | }
|
---|
[6322] | 583 | mp1Title += freq1;
|
---|
| 584 | mp2Title += freq2;
|
---|
| 585 | snr1Title += freq1;
|
---|
| 586 | snr2Title += freq2;
|
---|
[6281] | 587 |
|
---|
[6318] | 588 | QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
|
---|
| 589 | QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
|
---|
| 590 | QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
|
---|
| 591 | QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
|
---|
| 592 |
|
---|
[6281] | 593 | // Loop over all observations
|
---|
| 594 | // --------------------------
|
---|
| 595 | for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
|
---|
| 596 | t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
|
---|
[6288] | 597 | QMapIterator<t_prn, t_qcSat> it(qcEpo._qcSat);
|
---|
[6281] | 598 | while (it.hasNext()) {
|
---|
| 599 | it.next();
|
---|
| 600 | const t_prn& prn = it.key();
|
---|
[6288] | 601 | const t_qcSat& qcSat = it.value();
|
---|
[6271] | 602 | if ( (prn.system() == 'G' && plotGPS) ||
|
---|
| 603 | (prn.system() == 'R' && plotGlo) ||
|
---|
[6322] | 604 | (prn.system() == 'E' && plotGal) ||
|
---|
| 605 | (prn.system() == 'J' && plotQZSS) ||
|
---|
| 606 | (prn.system() == 'S' && plotSBAS) ||
|
---|
| 607 | (prn.system() == 'C' && plotBDS) ) {
|
---|
[6281] | 608 |
|
---|
[6288] | 609 | if (qcSat._eleSet) {
|
---|
[6286] | 610 | QString frqType1;
|
---|
| 611 | QString frqType2;
|
---|
[6288] | 612 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
---|
| 613 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
---|
[6322] | 614 | if (qcFrq._rnxType2ch[0] == freq1 && frqType1.isEmpty()) {
|
---|
[6286] | 615 | frqType1 = qcFrq._rnxType2ch;
|
---|
| 616 | }
|
---|
[6322] | 617 | if (qcFrq._rnxType2ch[0] == freq2 && frqType2.isEmpty()) {
|
---|
[6286] | 618 | frqType2 = qcFrq._rnxType2ch;
|
---|
| 619 | }
|
---|
| 620 | if (qcFrq._rnxType2ch == frqType1) {
|
---|
[6288] | 621 | (*dataSNR1) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._SNR));
|
---|
| 622 | (*dataMP1) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._stdMP));
|
---|
[6286] | 623 | }
|
---|
| 624 | else if (qcFrq._rnxType2ch == frqType2) {
|
---|
[6288] | 625 | (*dataSNR2) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._SNR));
|
---|
| 626 | (*dataMP2) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._stdMP));
|
---|
[6286] | 627 | }
|
---|
| 628 | }
|
---|
[6284] | 629 | }
|
---|
[4700] | 630 | }
|
---|
[4353] | 631 | }
|
---|
[6271] | 632 | }
|
---|
[4353] | 633 |
|
---|
[6271] | 634 | // Show the plots
|
---|
| 635 | // --------------
|
---|
| 636 | if (BNC_CORE->GUIenabled()) {
|
---|
| 637 | QFileInfo fileInfo(obsFile->fileName());
|
---|
| 638 | QByteArray title = fileInfo.fileName().toAscii();
|
---|
[6322] | 639 | emit dspSkyPlot(obsFile->fileName(), mp1Title, dataMP1, mp2Title, dataMP2, "Meters", 2.0);
|
---|
[6323] | 640 | emit dspSkyPlot(obsFile->fileName(), snr1Title, dataSNR1, snr2Title, dataSNR2, "dbHz", 54.0);
|
---|
[6275] | 641 | emit dspAvailPlot(obsFile->fileName(), title);
|
---|
[6271] | 642 | }
|
---|
| 643 | else {
|
---|
| 644 | for (int ii = 0; ii < dataMP1->size(); ii++) {
|
---|
| 645 | delete dataMP1->at(ii);
|
---|
[4351] | 646 | }
|
---|
[6271] | 647 | delete dataMP1;
|
---|
| 648 | for (int ii = 0; ii < dataMP2->size(); ii++) {
|
---|
| 649 | delete dataMP2->at(ii);
|
---|
[4591] | 650 | }
|
---|
[6271] | 651 | delete dataMP2;
|
---|
| 652 | for (int ii = 0; ii < dataSNR1->size(); ii++) {
|
---|
| 653 | delete dataSNR1->at(ii);
|
---|
[4659] | 654 | }
|
---|
[6271] | 655 | delete dataSNR1;
|
---|
| 656 | for (int ii = 0; ii < dataSNR2->size(); ii++) {
|
---|
| 657 | delete dataSNR2->at(ii);
|
---|
[5141] | 658 | }
|
---|
[6271] | 659 | delete dataSNR2;
|
---|
[4350] | 660 | }
|
---|
| 661 | }
|
---|
[4572] | 662 |
|
---|
[6255] | 663 | //
|
---|
[4572] | 664 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6322] | 665 | void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName, const QString& title1,
|
---|
| 666 | QVector<t_polarPoint*>* data1, const QString& title2,
|
---|
[6275] | 667 | QVector<t_polarPoint*>* data2, const QByteArray& scaleTitle,
|
---|
| 668 | double maxValue) {
|
---|
[4572] | 669 |
|
---|
[5068] | 670 | if (BNC_CORE->GUIenabled()) {
|
---|
[4573] | 671 |
|
---|
[6271] | 672 | if (maxValue == 0.0) {
|
---|
| 673 | if (data1) {
|
---|
| 674 | for (int ii = 0; ii < data1->size(); ii++) {
|
---|
| 675 | double val = data1->at(ii)->_value;
|
---|
| 676 | if (maxValue < val) {
|
---|
| 677 | maxValue = val;
|
---|
| 678 | }
|
---|
| 679 | }
|
---|
| 680 | }
|
---|
| 681 | if (data2) {
|
---|
| 682 | for (int ii = 0; ii < data2->size(); ii++) {
|
---|
| 683 | double val = data2->at(ii)->_value;
|
---|
| 684 | if (maxValue < val) {
|
---|
| 685 | maxValue = val;
|
---|
| 686 | }
|
---|
| 687 | }
|
---|
| 688 | }
|
---|
| 689 | }
|
---|
[4659] | 690 |
|
---|
[6271] | 691 | QwtInterval scaleInterval(0.0, maxValue);
|
---|
[4671] | 692 |
|
---|
[4573] | 693 | QVector<QWidget*> plots;
|
---|
[6271] | 694 | if (data1) {
|
---|
| 695 | t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
|
---|
| 696 | BNC_CORE->mainWindow());
|
---|
| 697 | plot1->addCurve(data1);
|
---|
| 698 | plots << plot1;
|
---|
| 699 | }
|
---|
| 700 | if (data2) {
|
---|
| 701 | t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
|
---|
| 702 | BNC_CORE->mainWindow());
|
---|
| 703 | plot2->addCurve(data2);
|
---|
| 704 | plots << plot2;
|
---|
| 705 | }
|
---|
[4666] | 706 |
|
---|
[6271] | 707 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
|
---|
| 708 | &scaleTitle, &scaleInterval);
|
---|
[4666] | 709 |
|
---|
[4573] | 710 | graphWin->show();
|
---|
| 711 |
|
---|
| 712 | bncSettings settings;
|
---|
| 713 | QString dirName = settings.value("reqcPlotDir").toString();
|
---|
| 714 | if (!dirName.isEmpty()) {
|
---|
[6271] | 715 | QByteArray ext = (scaleTitle == "Meters") ? "_M.png" : "_S.png";
|
---|
[4579] | 716 | graphWin->savePNG(dirName, ext);
|
---|
[4573] | 717 | }
|
---|
| 718 | }
|
---|
[4572] | 719 | }
|
---|
[4679] | 720 |
|
---|
[6271] | 721 | //
|
---|
[4679] | 722 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6275] | 723 | void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName, const QByteArray& title) {
|
---|
[4679] | 724 |
|
---|
[6280] | 725 | t_plotData plotData;
|
---|
[6278] | 726 | QMap<t_prn, t_plotData> plotDataMap;
|
---|
[6272] | 727 |
|
---|
[6278] | 728 | for (int ii = 0; ii < _qcFile._qcEpo.size(); ii++) {
|
---|
| 729 | const t_qcEpo& qcEpo = _qcFile._qcEpo[ii];
|
---|
[6280] | 730 | double mjdX24 = qcEpo._epoTime.mjddec() * 24.0;
|
---|
| 731 |
|
---|
| 732 | plotData._mjdX24 << mjdX24;
|
---|
| 733 | plotData._PDOP << qcEpo._PDOP;
|
---|
[6288] | 734 | plotData._numSat << qcEpo._qcSat.size();
|
---|
[6280] | 735 |
|
---|
[6288] | 736 | QMapIterator<t_prn, t_qcSat> it(qcEpo._qcSat);
|
---|
[6278] | 737 | while (it.hasNext()) {
|
---|
| 738 | it.next();
|
---|
| 739 | const t_prn& prn = it.key();
|
---|
[6288] | 740 | const t_qcSat& qcSat = it.value();
|
---|
[6280] | 741 | t_plotData& data = plotDataMap[prn];
|
---|
[6286] | 742 |
|
---|
[6297] | 743 | if (qcSat._eleSet) {
|
---|
| 744 | data._mjdX24 << mjdX24;
|
---|
| 745 | data._eleDeg << qcSat._eleDeg;
|
---|
| 746 | }
|
---|
[6286] | 747 |
|
---|
[6404] | 748 | char frqChar1 = '1';
|
---|
| 749 | char frqChar2 = '2';
|
---|
| 750 | if (prn.system() == 'E' || prn.system() == 'S') {
|
---|
| 751 | frqChar2 = '5';
|
---|
| 752 | }
|
---|
| 753 | else if (prn.system() == 'C') {
|
---|
| 754 | frqChar2 = '7';
|
---|
| 755 | }
|
---|
[6286] | 756 | QString frqType1;
|
---|
| 757 | QString frqType2;
|
---|
[6288] | 758 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
---|
| 759 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
---|
[6404] | 760 | if (qcFrq._rnxType2ch[0] == frqChar1 && frqType1.isEmpty()) {
|
---|
[6286] | 761 | frqType1 = qcFrq._rnxType2ch;
|
---|
[6284] | 762 | }
|
---|
[6404] | 763 | if (qcFrq._rnxType2ch[0] == frqChar2 && frqType2.isEmpty()) {
|
---|
[6286] | 764 | frqType2 = qcFrq._rnxType2ch;
|
---|
[6284] | 765 | }
|
---|
[6286] | 766 | if (qcFrq._rnxType2ch == frqType1) {
|
---|
| 767 | if (qcFrq._slip) {
|
---|
| 768 | data._L1slip << mjdX24;
|
---|
| 769 | }
|
---|
| 770 | else if (qcFrq._gap) {
|
---|
| 771 | data._L1gap << mjdX24;
|
---|
| 772 | }
|
---|
| 773 | else {
|
---|
| 774 | data._L1ok << mjdX24;
|
---|
| 775 | }
|
---|
[6284] | 776 | }
|
---|
[6286] | 777 | else if (qcFrq._rnxType2ch == frqType2) {
|
---|
| 778 | if (qcFrq._slip) {
|
---|
| 779 | data._L2slip << mjdX24;
|
---|
| 780 | }
|
---|
| 781 | else if (qcFrq._gap) {
|
---|
| 782 | data._L2gap << mjdX24;
|
---|
| 783 | }
|
---|
| 784 | else {
|
---|
| 785 | data._L2ok << mjdX24;
|
---|
| 786 | }
|
---|
[6284] | 787 | }
|
---|
| 788 | }
|
---|
[6278] | 789 | }
|
---|
| 790 | }
|
---|
| 791 |
|
---|
[6271] | 792 | if (BNC_CORE->GUIenabled()) {
|
---|
[6278] | 793 | t_availPlot* plotA = new t_availPlot(0, plotDataMap);
|
---|
[6271] | 794 | plotA->setTitle(title);
|
---|
[4679] | 795 |
|
---|
[6278] | 796 | t_elePlot* plotZ = new t_elePlot(0, plotDataMap);
|
---|
[4679] | 797 |
|
---|
[6279] | 798 | t_dopPlot* plotD = new t_dopPlot(0, plotData);
|
---|
[4679] | 799 |
|
---|
[6271] | 800 | QVector<QWidget*> plots;
|
---|
| 801 | plots << plotA << plotZ << plotD;
|
---|
| 802 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
|
---|
[4679] | 803 |
|
---|
[6271] | 804 | int ww = QFontMetrics(graphWin->font()).width('w');
|
---|
| 805 | graphWin->setMinimumSize(120*ww, 40*ww);
|
---|
[4679] | 806 |
|
---|
[6271] | 807 | graphWin->show();
|
---|
[4679] | 808 |
|
---|
[6271] | 809 | bncSettings settings;
|
---|
| 810 | QString dirName = settings.value("reqcPlotDir").toString();
|
---|
| 811 | if (!dirName.isEmpty()) {
|
---|
| 812 | QByteArray ext = "_A.png";
|
---|
| 813 | graphWin->savePNG(dirName, ext);
|
---|
[4679] | 814 | }
|
---|
[4681] | 815 | }
|
---|
[4679] | 816 | }
|
---|
[4689] | 817 |
|
---|
| 818 | // Finish the report
|
---|
| 819 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6284] | 820 | void t_reqcAnalyze::printReport(const t_rnxObsFile* obsFile) {
|
---|
[5368] | 821 |
|
---|
[6301] | 822 | static const double QC_FORMAT_VERSION = 1.0;
|
---|
| 823 |
|
---|
[4689] | 824 | if (!_log) {
|
---|
| 825 | return;
|
---|
| 826 | }
|
---|
| 827 |
|
---|
[6317] | 828 | QFileInfo obsFi(obsFile->fileName());
|
---|
| 829 | QString obsFileName = obsFi.fileName();
|
---|
| 830 |
|
---|
| 831 | QString navFileName;
|
---|
| 832 | QStringListIterator namIt(_navFileNames);
|
---|
| 833 | bool firstName = true;
|
---|
| 834 | while (namIt.hasNext()) {
|
---|
| 835 | QFileInfo navFi(namIt.next());
|
---|
| 836 | if (firstName) {
|
---|
| 837 | firstName = false;
|
---|
| 838 | navFileName += navFi.fileName();
|
---|
| 839 | }
|
---|
| 840 | else {
|
---|
| 841 | navFileName += ", " + navFi.fileName();
|
---|
| 842 | }
|
---|
| 843 | }
|
---|
| 844 |
|
---|
[6300] | 845 | // Summary
|
---|
| 846 | // -------
|
---|
[6317] | 847 | *_log << "QC Format Version : " << QString("%1").arg(QC_FORMAT_VERSION,3,'f',1) << endl << endl
|
---|
| 848 | << "Observation File : " << obsFileName << endl
|
---|
| 849 | << "Navigation File(s): " << navFileName << endl
|
---|
[6301] | 850 | << "RINEX Version : " << QString("%1").arg(obsFile->version(),4,'f',2) << endl
|
---|
[6317] | 851 | << "Marker Name : " << _qcFile._markerName << endl
|
---|
| 852 | << "Marker Number : " << obsFile->markerNumber() << endl
|
---|
| 853 | << "Receiver : " << _qcFile._receiverType << endl
|
---|
| 854 | << "Antenna : " << _qcFile._antennaName << endl
|
---|
[6316] | 855 | << "Position XYZ : " << QString("%1 %2 %3").arg(obsFile->xyz()(1), 14, 'f', 4)
|
---|
[6303] | 856 | .arg(obsFile->xyz()(2), 14, 'f', 4)
|
---|
| 857 | .arg(obsFile->xyz()(3), 14, 'f', 4) << endl
|
---|
| 858 | << "Antenna dH/dE/dN : " << QString("%1 %2 %3").arg(obsFile->antNEU()(3), 8, 'f', 4)
|
---|
| 859 | .arg(obsFile->antNEU()(2), 8, 'f', 4)
|
---|
| 860 | .arg(obsFile->antNEU()(1), 8, 'f', 4) << endl
|
---|
[6317] | 861 | << "Start Time : " << _qcFile._startTime.datestr().c_str() << ' '
|
---|
| 862 | << _qcFile._startTime.timestr(1,'.').c_str() << endl
|
---|
| 863 | << "End Time : " << _qcFile._endTime.datestr().c_str() << ' '
|
---|
| 864 | << _qcFile._endTime.timestr(1,'.').c_str() << endl
|
---|
| 865 | << "Interval : " << _qcFile._interval << endl;
|
---|
[4689] | 866 |
|
---|
[6303] | 867 | // Number of systems
|
---|
| 868 | // -----------------
|
---|
| 869 | QMap<QChar, QVector<const t_qcSatSum*> > systemMap;
|
---|
[6286] | 870 | QMapIterator<t_prn, t_qcSatSum> itSat(_qcFile._qcSatSum);
|
---|
| 871 | while (itSat.hasNext()) {
|
---|
| 872 | itSat.next();
|
---|
[6303] | 873 | const t_prn& prn = itSat.key();
|
---|
[6286] | 874 | const t_qcSatSum& qcSatSum = itSat.value();
|
---|
[6303] | 875 | systemMap[prn.system()].push_back(&qcSatSum);
|
---|
| 876 | }
|
---|
[6286] | 877 |
|
---|
[6309] | 878 | *_log << "Navigation Systems: " << systemMap.size() << " ";
|
---|
[6303] | 879 | QMapIterator<QChar, QVector<const t_qcSatSum*> > itSys(systemMap);
|
---|
| 880 | while (itSys.hasNext()) {
|
---|
| 881 | itSys.next();
|
---|
| 882 | *_log << ' ' << itSys.key();
|
---|
[4693] | 883 | }
|
---|
[6303] | 884 | *_log << endl;
|
---|
[4693] | 885 |
|
---|
[6304] | 886 | itSys.toFront();
|
---|
| 887 | while (itSys.hasNext()) {
|
---|
| 888 | itSys.next();
|
---|
| 889 | const QChar& sys = itSys.key();
|
---|
| 890 | const QVector<const t_qcSatSum*>& qcSatVec = itSys.value();
|
---|
| 891 | QString prefixSys = QString(" ") + sys + QString(": ");
|
---|
[6306] | 892 | QMap<QString, QVector<const t_qcFrqSum*> > frqMap;
|
---|
[6305] | 893 | for (int ii = 0; ii < qcSatVec.size(); ii++) {
|
---|
| 894 | const t_qcSatSum* qcSatSum = qcSatVec[ii];
|
---|
| 895 | QMapIterator<QString, t_qcFrqSum> itFrq(qcSatSum->_qcFrqSum);
|
---|
| 896 | while (itFrq.hasNext()) {
|
---|
| 897 | itFrq.next();
|
---|
[6315] | 898 | QString frqType = itFrq.key(); if (frqType.length() < 2) frqType += '?';
|
---|
[6305] | 899 | const t_qcFrqSum& qcFrqSum = itFrq.value();
|
---|
[6306] | 900 | frqMap[frqType].push_back(&qcFrqSum);
|
---|
[6305] | 901 | }
|
---|
| 902 | }
|
---|
[6309] | 903 | *_log << endl
|
---|
[6310] | 904 | << prefixSys << "Satellites: " << qcSatVec.size() << endl
|
---|
| 905 | << prefixSys << "Signals : " << frqMap.size() << " ";
|
---|
[6307] | 906 | QMapIterator<QString, QVector<const t_qcFrqSum*> > itFrq(frqMap);
|
---|
| 907 | while (itFrq.hasNext()) {
|
---|
| 908 | itFrq.next();
|
---|
[6315] | 909 | QString frqType = itFrq.key(); if (frqType.length() < 2) frqType += '?';
|
---|
[6308] | 910 | *_log << ' ' << frqType;
|
---|
| 911 | }
|
---|
| 912 | *_log << endl;
|
---|
[6316] | 913 | QString prefixSys2 = " " + prefixSys;
|
---|
[6308] | 914 | itFrq.toFront();
|
---|
| 915 | while (itFrq.hasNext()) {
|
---|
| 916 | itFrq.next();
|
---|
[6315] | 917 | QString frqType = itFrq.key(); if (frqType.length() < 2) frqType += '?';
|
---|
[6307] | 918 | const QVector<const t_qcFrqSum*> qcFrqVec = itFrq.value();
|
---|
| 919 | QString prefixFrq = QString(" ") + frqType + QString(": ");
|
---|
[6308] | 920 |
|
---|
[6313] | 921 | int numObs = 0;
|
---|
| 922 | int numSlipsFlagged = 0;
|
---|
| 923 | int numSlipsFound = 0;
|
---|
| 924 | int numGaps = 0;
|
---|
| 925 | int numSNR = 0;
|
---|
| 926 | int numMP = 0;
|
---|
| 927 | double sumSNR = 0.0;
|
---|
| 928 | double sumMP = 0.0;
|
---|
[6308] | 929 | for (int ii = 0; ii < qcFrqVec.size(); ii++) {
|
---|
| 930 | const t_qcFrqSum* qcFrqSum = qcFrqVec[ii];
|
---|
| 931 | numObs += qcFrqSum->_numObs ;
|
---|
| 932 | numSlipsFlagged += qcFrqSum->_numSlipsFlagged;
|
---|
| 933 | numSlipsFound += qcFrqSum->_numSlipsFound ;
|
---|
| 934 | numGaps += qcFrqSum->_numGaps ;
|
---|
[6313] | 935 | numSNR += qcFrqSum->_numSNR;
|
---|
| 936 | numMP += qcFrqSum->_numMP;
|
---|
[6314] | 937 | sumSNR += qcFrqSum->_sumSNR;
|
---|
| 938 | sumMP += qcFrqSum->_sumMP;
|
---|
[6308] | 939 | }
|
---|
[6313] | 940 | if (numSNR > 0) {
|
---|
| 941 | sumSNR /= numSNR;
|
---|
| 942 | }
|
---|
| 943 | if (numMP > 0) {
|
---|
| 944 | sumMP /= numMP;
|
---|
| 945 | }
|
---|
[6309] | 946 | *_log << endl
|
---|
[6316] | 947 | << prefixSys2 << prefixFrq << "Observations : " << QString("%1\n").arg(numObs, 6)
|
---|
| 948 | << prefixSys2 << prefixFrq << "Slips (file+found): " << QString("%1 +").arg(numSlipsFlagged, 6)
|
---|
| 949 | << QString("%1\n").arg(numSlipsFound, 6)
|
---|
| 950 | << prefixSys2 << prefixFrq << "Gaps : " << QString("%1\n").arg(numGaps, 6)
|
---|
| 951 | << prefixSys2 << prefixFrq << "Mean SNR : " << QString("%1\n").arg(sumSNR, 6, 'f', 1)
|
---|
| 952 | << prefixSys2 << prefixFrq << "Mean Multipath : " << QString("%1\n").arg(sumMP, 6, 'f', 2);
|
---|
[6307] | 953 | }
|
---|
[6304] | 954 | }
|
---|
| 955 |
|
---|
[6300] | 956 | // Epoch-Specific Output
|
---|
| 957 | // ---------------------
|
---|
| 958 | bncSettings settings;
|
---|
| 959 | if (Qt::CheckState(settings.value("reqcLogSummaryOnly").toInt()) == Qt::Checked) {
|
---|
| 960 | return;
|
---|
| 961 | }
|
---|
[6309] | 962 | *_log << endl;
|
---|
[6289] | 963 | for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
|
---|
| 964 | const t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
|
---|
| 965 |
|
---|
| 966 | unsigned year, month, day, hour, min;
|
---|
| 967 | double sec;
|
---|
| 968 | qcEpo._epoTime.civil_date(year, month, day);
|
---|
| 969 | qcEpo._epoTime.civil_time(hour, min, sec);
|
---|
| 970 |
|
---|
| 971 | QString dateStr;
|
---|
| 972 | QTextStream(&dateStr) << QString("> %1 %2 %3 %4 %5%6")
|
---|
| 973 | .arg(year, 4)
|
---|
| 974 | .arg(month, 2, 10, QChar('0'))
|
---|
| 975 | .arg(day, 2, 10, QChar('0'))
|
---|
| 976 | .arg(hour, 2, 10, QChar('0'))
|
---|
| 977 | .arg(min, 2, 10, QChar('0'))
|
---|
| 978 | .arg(sec, 11, 'f', 7);
|
---|
| 979 |
|
---|
[6290] | 980 | *_log << dateStr << QString(" %1").arg(qcEpo._qcSat.size(), 2)
|
---|
| 981 | << QString(" %1").arg(qcEpo._PDOP, 4, 'f', 1)
|
---|
| 982 | << endl;
|
---|
[6289] | 983 |
|
---|
| 984 | QMapIterator<t_prn, t_qcSat> itSat(qcEpo._qcSat);
|
---|
| 985 | while (itSat.hasNext()) {
|
---|
| 986 | itSat.next();
|
---|
| 987 | const t_prn& prn = itSat.key();
|
---|
| 988 | const t_qcSat& qcSat = itSat.value();
|
---|
| 989 |
|
---|
[6290] | 990 | *_log << prn.toString().c_str()
|
---|
[6295] | 991 | << QString(" %1 %2").arg(qcSat._eleDeg, 6, 'f', 2).arg(qcSat._azDeg, 7, 'f', 2);
|
---|
| 992 |
|
---|
| 993 | int numObsTypes = 0;
|
---|
[6290] | 994 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
---|
| 995 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
---|
[6294] | 996 | if (qcFrq._phaseValid) {
|
---|
[6295] | 997 | numObsTypes += 1;
|
---|
[6294] | 998 | }
|
---|
| 999 | if (qcFrq._codeValid) {
|
---|
[6295] | 1000 | numObsTypes += 1;
|
---|
[6294] | 1001 | }
|
---|
[6295] | 1002 | }
|
---|
[6298] | 1003 | *_log << QString(" %1").arg(numObsTypes, 2);
|
---|
[6295] | 1004 |
|
---|
| 1005 | for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
|
---|
| 1006 | const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
|
---|
| 1007 | if (qcFrq._phaseValid) {
|
---|
| 1008 | *_log << " L" << qcFrq._rnxType2ch << ' ';
|
---|
| 1009 | if (qcFrq._slip) {
|
---|
| 1010 | *_log << 's';
|
---|
| 1011 | }
|
---|
| 1012 | else {
|
---|
| 1013 | *_log << '.';
|
---|
| 1014 | }
|
---|
| 1015 | if (qcFrq._gap) {
|
---|
| 1016 | *_log << 'g';
|
---|
| 1017 | }
|
---|
| 1018 | else {
|
---|
| 1019 | *_log << '.';
|
---|
| 1020 | }
|
---|
| 1021 | *_log << QString(" %1").arg(qcFrq._SNR, 4, 'f', 1);
|
---|
[6294] | 1022 | }
|
---|
[6295] | 1023 | if (qcFrq._codeValid) {
|
---|
| 1024 | *_log << " C" << qcFrq._rnxType2ch << ' ';
|
---|
| 1025 | if (qcFrq._gap) {
|
---|
[6298] | 1026 | *_log << " g";
|
---|
[6295] | 1027 | }
|
---|
| 1028 | else {
|
---|
[6298] | 1029 | *_log << " .";
|
---|
[6295] | 1030 | }
|
---|
| 1031 | *_log << QString(" %1").arg(qcFrq._stdMP, 3, 'f', 2);
|
---|
[6290] | 1032 | }
|
---|
| 1033 | }
|
---|
| 1034 | *_log << endl;
|
---|
[6289] | 1035 | }
|
---|
| 1036 | }
|
---|
[4689] | 1037 | _log->flush();
|
---|
| 1038 | }
|
---|