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