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