[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 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
| 41 | #include <iostream>
|
---|
[4361] | 42 | #include <iomanip>
|
---|
[4579] | 43 | #include <qwt_plot_renderer.h>
|
---|
[4574] | 44 |
|
---|
[3899] | 45 | #include "reqcanalyze.h"
|
---|
[3973] | 46 | #include "bncapp.h"
|
---|
[3899] | 47 | #include "bncsettings.h"
|
---|
[4254] | 48 | #include "reqcedit.h"
|
---|
[4255] | 49 | #include "bncutils.h"
|
---|
[4262] | 50 | #include "bncpostprocess.h"
|
---|
[4300] | 51 | #include "graphwin.h"
|
---|
[4307] | 52 | #include "polarplot.h"
|
---|
[4577] | 53 | #include "availplot.h"
|
---|
[3899] | 54 |
|
---|
| 55 | using namespace std;
|
---|
| 56 |
|
---|
[4357] | 57 | const double SLIPTRESH = 5.0; // cycle-slip threshold (meters)
|
---|
| 58 |
|
---|
[3899] | 59 | // Constructor
|
---|
| 60 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 61 | t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
|
---|
| 62 |
|
---|
| 63 | bncSettings settings;
|
---|
[4254] | 64 |
|
---|
[4257] | 65 | _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
|
---|
| 66 | _logFile = 0;
|
---|
| 67 | _log = 0;
|
---|
[4254] | 68 | _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
|
---|
[4257] | 69 | _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
|
---|
[4266] | 70 |
|
---|
| 71 | _currEpo = 0;
|
---|
[4300] | 72 |
|
---|
[4572] | 73 | connect(this, SIGNAL(dspSkyPlot(const QString&,
|
---|
| 74 | const QByteArray&,
|
---|
| 75 | QVector<t_polarPoint*>*,
|
---|
| 76 | const QByteArray&,
|
---|
| 77 | QVector<t_polarPoint*>*,
|
---|
| 78 | const QByteArray&, double)),
|
---|
| 79 | this, SLOT(slotDspSkyPlot(const QString&,
|
---|
[4556] | 80 | const QByteArray&,
|
---|
| 81 | QVector<t_polarPoint*>*,
|
---|
| 82 | const QByteArray&,
|
---|
| 83 | QVector<t_polarPoint*>*,
|
---|
[4572] | 84 | const QByteArray&, double)));
|
---|
| 85 |
|
---|
[4584] | 86 | connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
|
---|
| 87 | this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
|
---|
[3899] | 88 | }
|
---|
| 89 |
|
---|
| 90 | // Destructor
|
---|
| 91 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 92 | t_reqcAnalyze::~t_reqcAnalyze() {
|
---|
[4255] | 93 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
---|
| 94 | delete _rnxObsFiles[ii];
|
---|
| 95 | }
|
---|
| 96 | for (int ii = 0; ii < _ephs.size(); ii++) {
|
---|
| 97 | delete _ephs[ii];
|
---|
| 98 | }
|
---|
| 99 | delete _log; _log = 0;
|
---|
| 100 | delete _logFile; _logFile = 0;
|
---|
[4452] | 101 | bncApp* app = (bncApp*) qApp;
|
---|
| 102 | if ( app->mode() != bncApp::interactive) {
|
---|
| 103 | app->exit(0);
|
---|
| 104 | }
|
---|
[3899] | 105 | }
|
---|
| 106 |
|
---|
| 107 | //
|
---|
| 108 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4572] | 109 | void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName,
|
---|
| 110 | const QByteArray& title1,
|
---|
| 111 | QVector<t_polarPoint*>* data1,
|
---|
| 112 | const QByteArray& title2,
|
---|
| 113 | QVector<t_polarPoint*>* data2,
|
---|
| 114 | const QByteArray& scaleTitle,
|
---|
| 115 | double maxValue) {
|
---|
[4342] | 116 |
|
---|
[4346] | 117 | bncApp* app = dynamic_cast<bncApp*>(qApp);
|
---|
[4448] | 118 | if (app->GUIenabled()) {
|
---|
[4334] | 119 |
|
---|
[4556] | 120 | if (maxValue == 0.0) {
|
---|
| 121 | if (data1) {
|
---|
| 122 | for (int ii = 0; ii < data1->size(); ii++) {
|
---|
[4566] | 123 | double val = data1->at(ii)->_value;
|
---|
| 124 | if (maxValue < val) {
|
---|
| 125 | maxValue = val;
|
---|
[4556] | 126 | }
|
---|
| 127 | }
|
---|
[4356] | 128 | }
|
---|
[4557] | 129 | if (data2) {
|
---|
[4556] | 130 | for (int ii = 0; ii < data2->size(); ii++) {
|
---|
[4566] | 131 | double val = data2->at(ii)->_value;
|
---|
| 132 | if (maxValue < val) {
|
---|
| 133 | maxValue = val;
|
---|
[4556] | 134 | }
|
---|
| 135 | }
|
---|
[4356] | 136 | }
|
---|
| 137 | }
|
---|
[4357] | 138 |
|
---|
[4556] | 139 | QwtInterval scaleInterval(0.0, maxValue);
|
---|
[4356] | 140 |
|
---|
[4556] | 141 | QVector<QWidget*> plots;
|
---|
| 142 | if (data1) {
|
---|
| 143 | t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
|
---|
| 144 | app->mainWindow());
|
---|
| 145 | plot1->addCurve(data1);
|
---|
| 146 | plots << plot1;
|
---|
| 147 | }
|
---|
[4557] | 148 | if (data2) {
|
---|
[4556] | 149 | t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
|
---|
[4356] | 150 | app->mainWindow());
|
---|
[4556] | 151 | plot2->addCurve(data2);
|
---|
| 152 | plots << plot2;
|
---|
| 153 | }
|
---|
[4334] | 154 |
|
---|
[4564] | 155 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
|
---|
[4573] | 156 | &scaleTitle, &scaleInterval);
|
---|
[4334] | 157 |
|
---|
[4445] | 158 | graphWin->show();
|
---|
| 159 |
|
---|
[4451] | 160 | bncSettings settings;
|
---|
| 161 | QString dirName = settings.value("reqcPlotDir").toString();
|
---|
| 162 | if (!dirName.isEmpty()) {
|
---|
[4606] | 163 | QByteArray ext = scaleTitle.isEmpty() ? "_S.png" : "_M.png";
|
---|
[4579] | 164 | graphWin->savePNG(dirName, ext);
|
---|
[4451] | 165 | }
|
---|
[4308] | 166 | }
|
---|
[4300] | 167 | }
|
---|
| 168 |
|
---|
| 169 | //
|
---|
| 170 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3899] | 171 | void t_reqcAnalyze::run() {
|
---|
| 172 |
|
---|
[4255] | 173 | // Open Log File
|
---|
| 174 | // -------------
|
---|
| 175 | _logFile = new QFile(_logFileName);
|
---|
[4517] | 176 | if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
---|
| 177 | _log = new QTextStream();
|
---|
| 178 | _log->setDevice(_logFile);
|
---|
| 179 | }
|
---|
[4255] | 180 |
|
---|
| 181 | // Initialize RINEX Observation Files
|
---|
| 182 | // ----------------------------------
|
---|
[4525] | 183 | t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
|
---|
[3899] | 184 |
|
---|
[4257] | 185 | // Read Ephemerides
|
---|
| 186 | // ----------------
|
---|
| 187 | t_reqcEdit::readEphemerides(_navFileNames, _ephs);
|
---|
| 188 |
|
---|
[4255] | 189 | // Loop over all RINEX Files
|
---|
| 190 | // -------------------------
|
---|
[4254] | 191 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
---|
| 192 | analyzeFile(_rnxObsFiles[ii]);
|
---|
| 193 | }
|
---|
| 194 |
|
---|
[4255] | 195 | // Exit
|
---|
| 196 | // ----
|
---|
[4452] | 197 | emit finished();
|
---|
| 198 | deleteLater();
|
---|
[3899] | 199 | }
|
---|
[4254] | 200 |
|
---|
| 201 | //
|
---|
| 202 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4260] | 203 | void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
|
---|
[4259] | 204 |
|
---|
[4517] | 205 | if (_log) {
|
---|
| 206 | *_log << "\nAnalyze File\n"
|
---|
| 207 | << "------------\n"
|
---|
| 208 | << obsFile->fileName().toAscii().data() << endl << endl;
|
---|
| 209 | }
|
---|
[4260] | 210 |
|
---|
[4584] | 211 | _allObsMap.clear();
|
---|
| 212 | _availDataMap.clear();
|
---|
[4343] | 213 |
|
---|
[4342] | 214 | // A priori Coordinates
|
---|
| 215 | // --------------------
|
---|
| 216 | ColumnVector xyz = obsFile->xyz();
|
---|
| 217 |
|
---|
[4262] | 218 | // Loop over all Epochs
|
---|
| 219 | // --------------------
|
---|
[4541] | 220 | try {
|
---|
| 221 | while ( (_currEpo = obsFile->nextEpoch()) != 0) {
|
---|
| 222 |
|
---|
| 223 | // Loop over all satellites
|
---|
| 224 | // ------------------------
|
---|
| 225 | for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
|
---|
| 226 | const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
|
---|
| 227 | t_obs obs;
|
---|
| 228 | t_postProcessing::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
|
---|
| 229 |
|
---|
| 230 | if (obs.satSys == 'R') {
|
---|
[4590] | 231 | // TODO: set channel number
|
---|
[4541] | 232 | }
|
---|
| 233 |
|
---|
| 234 | QString prn = QString("%1%2").arg(obs.satSys)
|
---|
| 235 | .arg(obs.satNum, 2, 10, QChar('0'));
|
---|
| 236 |
|
---|
[4584] | 237 | _allObsMap[prn].addObs(obs);
|
---|
[4262] | 238 | }
|
---|
[4541] | 239 |
|
---|
| 240 | } // while (_currEpo)
|
---|
| 241 | }
|
---|
| 242 | catch (QString str) {
|
---|
| 243 | if (_log) {
|
---|
| 244 | *_log << "Exception " << str << endl;
|
---|
[4262] | 245 | }
|
---|
[4541] | 246 | else {
|
---|
| 247 | qDebug() << str;
|
---|
| 248 | }
|
---|
| 249 | return;
|
---|
| 250 | }
|
---|
[4262] | 251 |
|
---|
[4268] | 252 | // Analyze the Multipath
|
---|
| 253 | // ---------------------
|
---|
[4572] | 254 | QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
|
---|
| 255 | QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
|
---|
| 256 | QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
|
---|
| 257 | QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
|
---|
[4268] | 258 |
|
---|
[4584] | 259 | QMutableMapIterator<QString, t_allObs> it(_allObsMap);
|
---|
[4268] | 260 | while (it.hasNext()) {
|
---|
| 261 | it.next();
|
---|
[4584] | 262 | QString prn = it.key();
|
---|
| 263 | preparePlotData(prn, xyz, obsFile->interval(),
|
---|
| 264 | dataMP1, dataMP2, dataSNR1, dataSNR2);
|
---|
[4268] | 265 | }
|
---|
| 266 |
|
---|
[4572] | 267 | emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2,
|
---|
| 268 | "Meters", 2.0);
|
---|
[4300] | 269 |
|
---|
[4572] | 270 | emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2,
|
---|
| 271 | "", 9.0);
|
---|
| 272 |
|
---|
[4605] | 273 | QFileInfo fileInfo(obsFile->fileName());
|
---|
| 274 | QByteArray title = fileInfo.fileName().toAscii();
|
---|
[4572] | 275 |
|
---|
[4605] | 276 | emit dspAvailPlot(obsFile->fileName(), title);
|
---|
| 277 |
|
---|
[4517] | 278 | if (_log) {
|
---|
| 279 | _log->flush();
|
---|
| 280 | }
|
---|
[4254] | 281 | }
|
---|
[4263] | 282 |
|
---|
| 283 | //
|
---|
| 284 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4584] | 285 | void t_reqcAnalyze::t_allObs::addObs(const t_obs& obs) {
|
---|
[4265] | 286 |
|
---|
[4584] | 287 | t_oneObs* newObs = new t_oneObs(obs.GPSWeek, obs.GPSWeeks);
|
---|
[4354] | 288 | bool okFlag = false;
|
---|
[4338] | 289 |
|
---|
[4268] | 290 | // Compute the Multipath
|
---|
| 291 | // ----------------------
|
---|
[4424] | 292 | double L1 = obs.measdata("L1", 3.0);
|
---|
[4571] | 293 | if (L1 != 0) {
|
---|
| 294 | newObs->_hasL1 = true;
|
---|
| 295 | }
|
---|
[4424] | 296 | double L2 = obs.measdata("L2", 3.0);
|
---|
[4571] | 297 | if (L2 != 0) {
|
---|
| 298 | newObs->_hasL2 = true;
|
---|
| 299 | }
|
---|
[4391] | 300 | if (L1 != 0.0 && L2 != 0.0) {
|
---|
[4266] | 301 | double f1 = t_CST::f1(obs.satSys, obs.slotNum);
|
---|
| 302 | double f2 = t_CST::f2(obs.satSys, obs.slotNum);
|
---|
| 303 |
|
---|
[4391] | 304 | L1 = L1 * t_CST::c / f1;
|
---|
| 305 | L2 = L2 * t_CST::c / f2;
|
---|
[4266] | 306 |
|
---|
[4424] | 307 | double P1 = obs.measdata("C1", 3.0);
|
---|
[4391] | 308 | if (P1 != 0.0) {
|
---|
| 309 | newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
|
---|
[4354] | 310 | okFlag = true;
|
---|
[4268] | 311 | }
|
---|
[4424] | 312 | double P2 = obs.measdata("C2", 3.0);
|
---|
[4391] | 313 | if (P2 != 0.0) {
|
---|
| 314 | newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
|
---|
[4354] | 315 | okFlag = true;
|
---|
[4268] | 316 | }
|
---|
[4265] | 317 | }
|
---|
[4338] | 318 |
|
---|
[4559] | 319 | // Signal-to-Noise
|
---|
| 320 | // ---------------
|
---|
| 321 | double S1 = obs.measdata("S1", 3.0);
|
---|
| 322 | if (S1 != 0.0) {
|
---|
[4562] | 323 | newObs->_SNR1 = floor(S1/6);
|
---|
| 324 | if (newObs->_SNR1 > 9.0) {
|
---|
| 325 | newObs->_SNR1 = 9.0;
|
---|
| 326 | }
|
---|
| 327 | if (newObs->_SNR1 < 1.0) {
|
---|
| 328 | newObs->_SNR1 = 1.0;
|
---|
| 329 | }
|
---|
[4559] | 330 | okFlag = true;
|
---|
| 331 | }
|
---|
[4562] | 332 | else {
|
---|
| 333 | if (obs.snrL1 > 0) {
|
---|
| 334 | newObs->_SNR1 = obs.snrL1;
|
---|
| 335 | okFlag = true;
|
---|
| 336 | }
|
---|
| 337 | }
|
---|
[4559] | 338 | double S2 = obs.measdata("S2", 3.0);
|
---|
| 339 | if (S2 != 0.0) {
|
---|
[4562] | 340 | newObs->_SNR2 = floor(S2/6);
|
---|
| 341 | if (newObs->_SNR2 > 9.0) {
|
---|
| 342 | newObs->_SNR2 = 9.0;
|
---|
| 343 | }
|
---|
| 344 | if (newObs->_SNR2 < 1.0) {
|
---|
| 345 | newObs->_SNR2 = 1.0;
|
---|
| 346 | }
|
---|
[4559] | 347 | okFlag = true;
|
---|
| 348 | }
|
---|
[4562] | 349 | else {
|
---|
| 350 | if (obs.snrL2 > 0) {
|
---|
| 351 | newObs->_SNR2 = obs.snrL2;
|
---|
| 352 | okFlag = true;
|
---|
| 353 | }
|
---|
| 354 | }
|
---|
[4559] | 355 |
|
---|
[4354] | 356 | // Remember the Observation
|
---|
| 357 | // ------------------------
|
---|
| 358 | if (okFlag) {
|
---|
[4584] | 359 | _oneObsVec << newObs;
|
---|
[4354] | 360 | }
|
---|
| 361 | else {
|
---|
| 362 | delete newObs;
|
---|
| 363 | }
|
---|
[4263] | 364 | }
|
---|
[4350] | 365 |
|
---|
| 366 | //
|
---|
| 367 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4584] | 368 | void t_reqcAnalyze::preparePlotData(const QString& prn, const ColumnVector& xyz,
|
---|
[4572] | 369 | double obsInterval,
|
---|
| 370 | QVector<t_polarPoint*>* dataMP1,
|
---|
| 371 | QVector<t_polarPoint*>* dataMP2,
|
---|
| 372 | QVector<t_polarPoint*>* dataSNR1,
|
---|
[4584] | 373 | QVector<t_polarPoint*>* dataSNR2) {
|
---|
[4350] | 374 |
|
---|
[4544] | 375 | const int chunkStep = int( 30.0 / obsInterval); // chunk step (30 sec)
|
---|
| 376 | const int numEpo = int(600.0 / obsInterval); // # epochs in one chunk (10 min)
|
---|
[4350] | 377 |
|
---|
[4584] | 378 | t_allObs& allObs = _allObsMap[prn];
|
---|
| 379 |
|
---|
[4591] | 380 | // Loop over all Chunks of Data
|
---|
| 381 | // ----------------------------
|
---|
[4584] | 382 | for (int chunkStart = 0; chunkStart + numEpo < allObs._oneObsVec.size();
|
---|
[4361] | 383 | chunkStart += chunkStep) {
|
---|
[4351] | 384 |
|
---|
[4591] | 385 | // Chunk-Speicific Variables
|
---|
| 386 | // -------------------------
|
---|
| 387 | bncTime currTime;
|
---|
| 388 | bncTime prevTime;
|
---|
[4590] | 389 | bncTime chunkStartTime;
|
---|
| 390 | bool availL1 = false;
|
---|
| 391 | bool availL2 = false;
|
---|
[4591] | 392 | bool gapL1 = false;
|
---|
| 393 | bool gapL2 = false;
|
---|
[4590] | 394 | bool slipFlag = false;
|
---|
| 395 | double meanMP1 = 0.0;
|
---|
| 396 | double meanMP2 = 0.0;
|
---|
| 397 | double minSNR1 = 0.0;
|
---|
| 398 | double minSNR2 = 0.0;
|
---|
| 399 | double aziDeg = 0.0;
|
---|
| 400 | double zenDeg = 0.0;
|
---|
[4353] | 401 |
|
---|
[4591] | 402 | // Loop over all Epochs within one Chunk of Data
|
---|
| 403 | // ---------------------------------------------
|
---|
[4361] | 404 | for (int ii = 0; ii < numEpo; ii++) {
|
---|
[4351] | 405 | int iEpo = chunkStart + ii;
|
---|
[4584] | 406 | const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
|
---|
[4572] | 407 |
|
---|
[4590] | 408 | currTime.set(oneObs->_GPSWeek, oneObs->_GPSWeeks);
|
---|
| 409 |
|
---|
| 410 | // Compute the Azimuth and Zenith Distance
|
---|
| 411 | // ---------------------------------------
|
---|
[4572] | 412 | if (ii == 0) {
|
---|
[4590] | 413 | chunkStartTime = currTime;
|
---|
| 414 |
|
---|
| 415 | if (xyz.size()) {
|
---|
| 416 | t_eph* eph = 0;
|
---|
| 417 | for (int ie = 0; ie < _ephs.size(); ie++) {
|
---|
| 418 | if (_ephs[ie]->prn() == prn) {
|
---|
| 419 | eph = _ephs[ie];
|
---|
| 420 | break;
|
---|
| 421 | }
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | if (eph) {
|
---|
| 425 | double xSat, ySat, zSat, clkSat;
|
---|
| 426 | eph->position(oneObs->_GPSWeek, oneObs->_GPSWeeks,
|
---|
| 427 | xSat, ySat, zSat, clkSat);
|
---|
| 428 |
|
---|
| 429 | double rho, eleSat, azSat;
|
---|
| 430 | topos(xyz(1), xyz(2), xyz(3), xSat, ySat, zSat, rho, eleSat, azSat);
|
---|
| 431 |
|
---|
| 432 | aziDeg = azSat * 180.0/M_PI;
|
---|
| 433 | zenDeg = 90.0 - eleSat * 180.0/M_PI;
|
---|
| 434 | }
|
---|
| 435 | }
|
---|
[4572] | 436 | }
|
---|
| 437 |
|
---|
[4590] | 438 | // Check Interval
|
---|
| 439 | // --------------
|
---|
| 440 | if (prevTime.valid()) {
|
---|
[4591] | 441 | double dt = currTime - prevTime;
|
---|
| 442 | if (dt != obsInterval) {
|
---|
| 443 | gapL1 = true;
|
---|
| 444 | gapL2 = true;
|
---|
| 445 | }
|
---|
[4590] | 446 | }
|
---|
| 447 | prevTime = currTime;
|
---|
[4563] | 448 |
|
---|
[4590] | 449 | // Check L1 and L2 availability
|
---|
| 450 | // ----------------------------
|
---|
| 451 | if (oneObs->_hasL1) {
|
---|
| 452 | availL1 = true;
|
---|
[4566] | 453 | }
|
---|
[4590] | 454 | else {
|
---|
[4591] | 455 | gapL1 = true;
|
---|
[4566] | 456 | }
|
---|
[4590] | 457 | if (oneObs->_hasL2) {
|
---|
| 458 | availL2 = true;
|
---|
| 459 | }
|
---|
| 460 | else {
|
---|
[4591] | 461 | gapL2 = true;
|
---|
[4590] | 462 | }
|
---|
| 463 |
|
---|
| 464 | // Check Minimal Signal-to-Noise Ratio
|
---|
| 465 | // -----------------------------------
|
---|
| 466 | if ( oneObs->_SNR1 > 0 && (minSNR1 == 0 || minSNR1 > oneObs->_SNR1) ) {
|
---|
| 467 | minSNR1 = oneObs->_SNR1;
|
---|
| 468 | }
|
---|
| 469 | if ( oneObs->_SNR2 > 0 && (minSNR2 == 0 || minSNR2 > oneObs->_SNR2) ) {
|
---|
| 470 | minSNR2 = oneObs->_SNR2;
|
---|
| 471 | }
|
---|
| 472 |
|
---|
[4353] | 473 | // Check Slip
|
---|
| 474 | // ----------
|
---|
| 475 | if (ii > 0) {
|
---|
[4584] | 476 | double diff1 = oneObs->_MP1 - allObs._oneObsVec[iEpo-1]->_MP1;
|
---|
| 477 | double diff2 = oneObs->_MP2 - allObs._oneObsVec[iEpo-1]->_MP2;
|
---|
[4357] | 478 | if (fabs(diff1) > SLIPTRESH || fabs(diff2) > SLIPTRESH) {
|
---|
[4353] | 479 | slipFlag = true;
|
---|
| 480 | }
|
---|
| 481 | }
|
---|
| 482 |
|
---|
[4590] | 483 | meanMP1 += oneObs->_MP1;
|
---|
| 484 | meanMP2 += oneObs->_MP2;
|
---|
[4353] | 485 | }
|
---|
| 486 |
|
---|
[4590] | 487 | // Availability Plot Data
|
---|
| 488 | // ----------------------
|
---|
[4591] | 489 | double mjd = chunkStartTime.mjddec();
|
---|
[4590] | 490 | if (availL1) {
|
---|
[4591] | 491 | if (slipFlag) {
|
---|
| 492 | _availDataMap[prn]._L1slip << mjd;
|
---|
| 493 | }
|
---|
| 494 | else if (gapL1) {
|
---|
| 495 | _availDataMap[prn]._L1gap << mjd;
|
---|
| 496 | }
|
---|
| 497 | else {
|
---|
| 498 | _availDataMap[prn]._L1ok << mjd;
|
---|
| 499 | }
|
---|
[4351] | 500 | }
|
---|
[4591] | 501 | if (availL2) {
|
---|
| 502 | if (slipFlag) {
|
---|
| 503 | _availDataMap[prn]._L2slip << mjd;
|
---|
| 504 | }
|
---|
| 505 | else if (gapL2) {
|
---|
| 506 | _availDataMap[prn]._L2gap << mjd;
|
---|
| 507 | }
|
---|
| 508 | else {
|
---|
| 509 | _availDataMap[prn]._L2ok << mjd;
|
---|
| 510 | }
|
---|
| 511 | }
|
---|
[4351] | 512 |
|
---|
[4590] | 513 | // Signal-to-Noise Ration Plot Data
|
---|
| 514 | // --------------------------------
|
---|
| 515 | (*dataSNR1) << (new t_polarPoint(aziDeg, zenDeg, minSNR1));
|
---|
| 516 | (*dataSNR2) << (new t_polarPoint(aziDeg, zenDeg, minSNR2));
|
---|
[4355] | 517 |
|
---|
[4590] | 518 | // Compute the Multipath
|
---|
| 519 | // ---------------------
|
---|
| 520 | if (!slipFlag) {
|
---|
| 521 | meanMP1 /= numEpo;
|
---|
| 522 | meanMP2 /= numEpo;
|
---|
| 523 | double MP1 = 0.0;
|
---|
| 524 | double MP2 = 0.0;
|
---|
| 525 | for (int ii = 0; ii < numEpo; ii++) {
|
---|
| 526 | int iEpo = chunkStart + ii;
|
---|
| 527 | const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
|
---|
| 528 | double diff1 = oneObs->_MP1 - meanMP1;
|
---|
| 529 | double diff2 = oneObs->_MP2 - meanMP2;
|
---|
| 530 | MP1 += diff1 * diff1;
|
---|
| 531 | MP2 += diff2 * diff2;
|
---|
[4355] | 532 | }
|
---|
[4590] | 533 | MP1 = sqrt(MP1 / (numEpo-1));
|
---|
| 534 | MP2 = sqrt(MP2 / (numEpo-1));
|
---|
| 535 | (*dataMP1) << (new t_polarPoint(aziDeg, zenDeg, MP1));
|
---|
| 536 | (*dataMP2) << (new t_polarPoint(aziDeg, zenDeg, MP2));
|
---|
[4355] | 537 | }
|
---|
[4350] | 538 | }
|
---|
| 539 | }
|
---|
[4572] | 540 |
|
---|
| 541 | //
|
---|
| 542 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 543 | void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName,
|
---|
[4584] | 544 | const QByteArray& title) {
|
---|
[4572] | 545 |
|
---|
[4574] | 546 | if (dynamic_cast<bncApp*>(qApp)->GUIenabled()) {
|
---|
[4573] | 547 |
|
---|
[4584] | 548 | t_availPlot* plot = new t_availPlot(0, &_availDataMap);
|
---|
| 549 | plot->setTitle(title);
|
---|
[4573] | 550 |
|
---|
| 551 | QVector<QWidget*> plots;
|
---|
[4574] | 552 | plots << plot;
|
---|
[4573] | 553 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
|
---|
| 554 | graphWin->show();
|
---|
| 555 |
|
---|
| 556 | bncSettings settings;
|
---|
| 557 | QString dirName = settings.value("reqcPlotDir").toString();
|
---|
| 558 | if (!dirName.isEmpty()) {
|
---|
[4606] | 559 | QByteArray ext = "_A.png";
|
---|
[4579] | 560 | graphWin->savePNG(dirName, ext);
|
---|
[4573] | 561 | }
|
---|
| 562 | }
|
---|
[4572] | 563 | }
|
---|