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