source: ntrip/trunk/BNC/src/rinex/reqcanalyze.cpp@ 6275

Last change on this file since 6275 was 6275, checked in by mervart, 9 years ago
File size: 20.8 KB
RevLine 
[3899]1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: t_reqcAnalyze
30 *
31 * Purpose: Analyze RINEX Files
32 *
33 * Author: L. Mervart
34 *
35 * Created: 11-Apr-2012
36 *
[6255]37 * Changes:
[3899]38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
[4361]42#include <iomanip>
[4579]43#include <qwt_plot_renderer.h>
[4574]44
[3899]45#include "reqcanalyze.h"
[5070]46#include "bnccore.h"
[3899]47#include "bncsettings.h"
[4254]48#include "reqcedit.h"
[4255]49#include "bncutils.h"
[4300]50#include "graphwin.h"
[4307]51#include "polarplot.h"
[4577]52#include "availplot.h"
[4662]53#include "eleplot.h"
[4672]54#include "dopplot.h"
[3899]55
56using namespace std;
57
58// Constructor
59////////////////////////////////////////////////////////////////////////////
60t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
61
62 bncSettings settings;
[4254]63
[4257]64 _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
65 _logFile = 0;
66 _log = 0;
[6271]67 _currEpo = 0;
[4254]68 _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
[4257]69 _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
[6275]70
71 connect(this, SIGNAL(dspSkyPlot(const QString&, const QByteArray&, QVector<t_polarPoint*>*,
72 const QByteArray&, QVector<t_polarPoint*>*,
73 const QByteArray&, double)),
74 this, SLOT(slotDspSkyPlot(const QString&, const QByteArray&, QVector<t_polarPoint*>*,
75 const QByteArray&, QVector<t_polarPoint*>*,
76 const QByteArray&, double)));
77
78 connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
79 this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
[3899]80}
81
82// Destructor
83////////////////////////////////////////////////////////////////////////////
84t_reqcAnalyze::~t_reqcAnalyze() {
[4255]85 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
86 delete _rnxObsFiles[ii];
87 }
88 for (int ii = 0; ii < _ephs.size(); ii++) {
89 delete _ephs[ii];
90 }
91 delete _log; _log = 0;
92 delete _logFile; _logFile = 0;
[5072]93 if (BNC_CORE->mode() != t_bncCore::interactive) {
[5066]94 qApp->exit(0);
[4452]95 }
[3899]96}
97
[6255]98//
[3899]99////////////////////////////////////////////////////////////////////////////
100void t_reqcAnalyze::run() {
101
[4255]102 // Open Log File
103 // -------------
104 _logFile = new QFile(_logFileName);
[4517]105 if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
106 _log = new QTextStream();
107 _log->setDevice(_logFile);
108 }
[4255]109
110 // Initialize RINEX Observation Files
111 // ----------------------------------
[4525]112 t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
[3899]113
[4257]114 // Read Ephemerides
115 // ----------------
116 t_reqcEdit::readEphemerides(_navFileNames, _ephs);
117
[4255]118 // Loop over all RINEX Files
119 // -------------------------
[4254]120 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
121 analyzeFile(_rnxObsFiles[ii]);
122 }
123
[4255]124 // Exit
125 // ----
[4452]126 emit finished();
127 deleteLater();
[3899]128}
[4254]129
[6255]130//
[4254]131////////////////////////////////////////////////////////////////////////////
[4260]132void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
[4259]133
[6271]134 QMutexLocker lock(&_mutex);
[4704]135
[4517]136 if (_log) {
137 *_log << "\nAnalyze File\n"
138 << "------------\n"
[4701]139 << "File: " << obsFile->fileName().toAscii().data() << endl;
[4517]140 }
[4260]141
[6271]142 _qcFile.clear();
[4343]143
[4342]144 // A priori Coordinates
145 // --------------------
[4679]146 ColumnVector xyzSta = obsFile->xyz();
[4342]147
[4262]148 // Loop over all Epochs
149 // --------------------
[4541]150 try {
[6271]151 bool firstEpo = true;
[4541]152 while ( (_currEpo = obsFile->nextEpoch()) != 0) {
[6271]153 if (firstEpo) {
154 firstEpo = false;
155 _qcFile._startTime = _currEpo->tt;
156 _qcFile._antennaName = obsFile->antennaName();
157 _qcFile._markerName = obsFile->markerName();
158 _qcFile._receiverType = obsFile->receiverType();
159 _qcFile._interval = obsFile->interval();
[4688]160 }
[6271]161 _qcFile._endTime = _currEpo->tt;
[6255]162
[6271]163 t_qcEpo qcEpo;
164 qcEpo._epoTime = _currEpo->tt;
165 qcEpo._PDOP = cmpDOP(xyzSta);
166
[4541]167 // Loop over all satellites
168 // ------------------------
169 for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
170 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
[6271]171 t_satObs satObs;
172 t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, satObs);
173 t_qcObs qcObs;
174 if (setQcObs(satObs, qcObs) == success) {
175 qcEpo._qcObs[satObs._prn] = qcObs;
176 updateQcSat(qcObs, _qcFile._qcSat[satObs._prn]);
[4541]177 }
[4262]178 }
[6271]179 _qcFile._qcEpo.push_back(qcEpo);
180 }
[6255]181
[6271]182 preparePlotData(obsFile);
[4678]183
[6271]184 printReport();
[4541]185 }
186 catch (QString str) {
187 if (_log) {
188 *_log << "Exception " << str << endl;
[4262]189 }
[4541]190 else {
[6255]191 qDebug() << str;
[4541]192 }
193 }
[6271]194}
[4262]195
[6271]196// Compute Dilution of Precision
197////////////////////////////////////////////////////////////////////////////
198double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
[4268]199
[6271]200 if (xyzSta.size() != 3) {
201 return 0.0;
[4268]202 }
203
[6271]204 unsigned nSat = _currEpo->rnxSat.size();
[4706]205
[6271]206 if (nSat < 4) {
207 return 0.0;
[4718]208 }
[6271]209
210 Matrix AA(nSat, 4);
211
212 unsigned nSatUsed = 0;
213 for (unsigned iSat = 0; iSat < nSat; iSat++) {
214
215 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iSat];
216 const t_prn& prn = rnxSat.prn;
217
218 t_eph* eph = 0;
219 for (int ie = 0; ie < _ephs.size(); ie++) {
220 if (_ephs[ie]->prn() == prn) {
221 eph = _ephs[ie];
222 break;
223 }
[4718]224 }
[6271]225 if (eph) {
226 ColumnVector xSat(4);
227 ColumnVector vv(3);
228 if (eph->getCrd(_currEpo->tt, xSat, vv, false) == success) {
229 ++nSatUsed;
230 ColumnVector dx = xSat.Rows(1,3) - xyzSta;
231 double rho = dx.norm_Frobenius();
232 AA(nSatUsed,1) = dx(1) / rho;
233 AA(nSatUsed,2) = dx(2) / rho;
234 AA(nSatUsed,3) = dx(3) / rho;
235 AA(nSatUsed,4) = 1.0;
236 }
[4718]237 }
238 }
[6271]239
240 if (nSatUsed < 4) {
241 return 0.0;
242 }
243
244 AA = AA.Rows(1, nSatUsed);
245
246 SymmetricMatrix QQ;
247 QQ << AA.t() * AA;
248 QQ = QQ.i();
249
250 return sqrt(QQ.trace());
[4254]251}
[4263]252
[6255]253//
[4263]254////////////////////////////////////////////////////////////////////////////
[6271]255void t_reqcAnalyze::updateQcSat(const t_qcObs& qcObs, t_qcSat& qcSat) {
256 if (qcObs._hasL1 && qcObs._hasL2) {
257 qcSat._numObs += 1;
258 }
259 if (qcObs._slipL1 && qcObs._slipL2) {
260 qcSat._numSlipsFlagged += 1;
261 }
262}
[4265]263
[6271]264//
265////////////////////////////////////////////////////////////////////////////
266t_irc t_reqcAnalyze::setQcObs(const t_satObs& satObs, t_qcObs& qcObs) {
[4338]267
[6271]268 if (satObs._prn.system() == 'R') {
269 t_ephGlo* ephGlo = 0;
270 for (int ie = 0; ie < _ephs.size(); ie++) {
271 if (_ephs[ie]->prn() == satObs._prn) {
272 ephGlo = dynamic_cast<t_ephGlo*>(_ephs[ie]);
273 break;
274 }
275 }
276 if (ephGlo) {
277 qcObs._slotSet = true;
278 qcObs._slotNum = ephGlo->slotNum();
279 }
280 }
281
282 bool okFlag = false;
283
[4608]284 // Availability and Slip Flags
285 // ---------------------------
[6137]286 double L1 = 0.0;
287 double L2 = 0.0;
288 double P1 = 0.0;
289 double P2 = 0.0;
290
[6271]291 for (unsigned iFrq = 0; iFrq < satObs._obs.size(); iFrq++) {
292 const t_frqObs* frqObs = satObs._obs[iFrq];
[6137]293 if (frqObs->_rnxType2ch[0] == '1') {
294 if (frqObs->_phaseValid) {
295 L1 = frqObs->_phase;
[6271]296 qcObs._hasL1 = true;
297 qcObs._slipL1 = frqObs->_slip;
[6137]298 }
299 if (frqObs->_codeValid) {
[6255]300 P1 = frqObs->_code;
[6137]301 }
302 if (frqObs->_snrValid) {
[6271]303 qcObs._SNR1 = frqObs->_snr;
[6137]304 }
305 }
[6271]306 else if ( (satObs._prn.system() != 'E' && frqObs->_rnxType2ch[0] == '2') ||
307 (satObs._prn.system() == 'E' && frqObs->_rnxType2ch[0] == '5') ) {
[6137]308 if (frqObs->_phaseValid) {
309 L2 = frqObs->_phase;
[6271]310 qcObs._hasL2 = true;
311 qcObs._slipL2 = frqObs->_slip;
[6137]312 }
313 if (frqObs->_codeValid) {
[6255]314 P2 = frqObs->_code;
[6137]315 }
316 if (frqObs->_snrValid) {
[6271]317 qcObs._SNR2 = frqObs->_snr;
[6137]318 }
319 }
[4571]320 }
[4608]321
322 // Compute the Multipath
323 // ----------------------
[4391]324 if (L1 != 0.0 && L2 != 0.0) {
[6017]325 double f1 = 0.0;
326 double f2 = 0.0;
[6271]327 if (satObs._prn.system() == 'G') {
[6017]328 f1 = t_CST::freq(t_frequency::G1, 0);
329 f2 = t_CST::freq(t_frequency::G2, 0);
330 }
[6271]331 else if (satObs._prn.system() == 'R') {
332 f1 = t_CST::freq(t_frequency::R1, qcObs._slotNum);
333 f2 = t_CST::freq(t_frequency::R2, qcObs._slotNum);
[6017]334 }
[6271]335 else if (satObs._prn.system() == 'E') {
[6017]336 f1 = t_CST::freq(t_frequency::E1, 0);
337 f2 = t_CST::freq(t_frequency::E5, 0);
338 }
[4266]339
[4391]340 L1 = L1 * t_CST::c / f1;
341 L2 = L2 * t_CST::c / f2;
[4266]342
[4391]343 if (P1 != 0.0) {
[6271]344 qcObs._MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
[4354]345 okFlag = true;
[4268]346 }
[4391]347 if (P2 != 0.0) {
[6271]348 qcObs._MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
[4354]349 okFlag = true;
[4268]350 }
[4265]351 }
[4338]352
[4354]353 if (okFlag) {
[4694]354 return success;
[4354]355 }
356 else {
[4694]357 return failure;
[4354]358 }
[4263]359}
[4350]360
[6255]361//
[4350]362////////////////////////////////////////////////////////////////////////////
[6271]363void t_reqcAnalyze::preparePlotData(const t_rnxObsFile* obsFile) {
[4675]364
[6271]365 ColumnVector xyzSta = obsFile->xyz();
[4350]366
[6271]367 QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
368 QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
369 QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
370 QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
[4350]371
[6271]372 const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
373 const double chunkStep = 600.0; // 10 minutes
[4584]374
[5141]375 bncSettings settings;
376 QString reqSkyPlotSystems = settings.value("reqcSkyPlotSystems").toString();
377 bool plotGPS = false;
378 bool plotGlo = false;
379 bool plotGal = false;
380 if (reqSkyPlotSystems == "GPS") {
381 plotGPS = true;
382 }
383 else if (reqSkyPlotSystems == "GLONASS") {
384 plotGlo = true;
385 }
386 else if (reqSkyPlotSystems == "Galileo") {
387 plotGal = true;
388 }
389 else {
390 plotGPS = true;
391 plotGlo = true;
392 plotGal = true;
393 }
394
[6271]395 // Loop over all satellites available
396 // ----------------------------------
397 QMutableMapIterator<t_prn, t_qcSat> it(_qcFile._qcSat);
398 while (it.hasNext()) {
399 it.next();
400 const t_prn& prn = it.key();
401 t_qcSat& qcSat = it.value();
[4351]402
[6271]403 // Loop over all Chunks of Data
404 // ----------------------------
405 for (bncTime chunkStart = _qcFile._startTime;
406 chunkStart < _qcFile._endTime; chunkStart += chunkStep) {
[4702]407
[6271]408 // Chunk (sampled) Epoch
409 // ---------------------
410 _qcFile._qcEpoSampled.push_back(t_qcEpo());
411 t_qcEpo& qcEpoSampled = _qcFile._qcEpoSampled.back();
412 t_qcObs& qcObsSampled = qcEpoSampled._qcObs[prn];
[4353]413
[6271]414 QVector<double> MP1;
415 QVector<double> MP2;
416
417 // Loop over all Epochs within one Chunk of Data
418 // ---------------------------------------------
419 bncTime prevTime;
420 for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
421 const t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
422 if (qcEpo._epoTime < chunkStart) {
423 continue;
424 }
425 if (!qcEpo._qcObs.contains(prn)) {
426 continue;
427 }
428
429 const t_qcObs& qcObs = qcEpo._qcObs[prn];
430
431 // Compute the Azimuth and Zenith Distance
432 // ---------------------------------------
433 if (chunkStart == qcEpo._epoTime) {
434 qcEpoSampled._epoTime = qcEpo._epoTime;
435 qcEpoSampled._PDOP = qcEpo._PDOP;
[4572]436
[6271]437 if (qcObs._slotSet) {
438 qcObsSampled._slotSet = true;
439 qcObsSampled._slotNum = qcObs._slotNum;
[4590]440 }
[6271]441 if (xyzSta.size()) {
442 t_eph* eph = 0;
443 for (int ie = 0; ie < _ephs.size(); ie++) {
444 if (_ephs[ie]->prn() == prn) {
445 eph = _ephs[ie];
446 break;
447 }
[6213]448 }
[6271]449 if (eph) {
450 ColumnVector xc(4);
451 ColumnVector vv(3);
452 if (eph->getCrd(qcEpo._epoTime, xc, vv, false) == success) {
453 double rho, eleSat, azSat;
454 topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
455 qcObsSampled._azDeg = azSat * 180.0/M_PI;
456 qcObsSampled._eleDeg = eleSat * 180.0/M_PI;
457 }
458 }
[4590]459 }
460 }
[6271]461
462 // Check Interval
463 // --------------
464 if (prevTime.valid()) {
465 double dt = qcEpo._epoTime - prevTime;
466 if (dt > 1.5 * _qcFile._interval) {
467 qcObsSampled._gapL1 = true;
468 qcObsSampled._gapL2 = true;
469 }
[4591]470 }
[6271]471 prevTime = qcEpo._epoTime;
472
473 // Check L1 and L2 availability
474 // ----------------------------
475 if (qcObs._hasL1) {
476 qcObsSampled._hasL1 = true;
477 }
478 if (qcObs._hasL2) {
479 qcObsSampled._hasL2 = true;
480 }
481
482 // Check Minimal Signal-to-Noise Ratio
483 // -----------------------------------
484 if ( qcObs._SNR1 > 0 && (qcObsSampled._SNR1 == 0 || qcObsSampled._SNR1 > qcObs._SNR1) ) {
485 qcObsSampled._SNR1 = qcObs._SNR1;
486 }
487 if ( qcObs._SNR2 > 0 && (qcObsSampled._SNR2 == 0 || qcObsSampled._SNR2 > qcObs._SNR2) ) {
488 qcObsSampled._SNR2 = qcObs._SNR2;
489 }
490
491 // Check Slip Flags
492 // ----------------
493 if (qcObs._slipL1) {
494 qcObsSampled._slipL1 = true;
495 }
496 if (qcObs._slipL2) {
497 qcObsSampled._slipL2 = true;
498 }
499
500 MP1 << qcObs._MP1;
501 MP2 << qcObs._MP2;
[4590]502 }
[4563]503
[6271]504 // Compute the Multipath
505 // ---------------------
506 if ( MP1.size() > 0 && MP2.size() > 0 &&
507 ( (prn.system() == 'G' && plotGPS ) ||
508 (prn.system() == 'R' && plotGlo && qcObsSampled._slotSet) ||
509 (prn.system() == 'E' && plotGal ) ) ) {
[4590]510
[6271]511 double meanMP1 = 0.0;
512 double meanMP2 = 0.0;
513 for (int ii = 0; ii < MP1.size(); ii++) {
514 meanMP1 += MP1[ii];
515 meanMP2 += MP2[ii];
516 }
517 meanMP1 /= MP1.size();
518 meanMP2 /= MP2.size();
[4590]519
[6271]520 bool slipMP = false;
521 double stdMP1 = 0.0;
522 double stdMP2 = 0.0;
523 for (int ii = 0; ii < MP1.size(); ii++) {
524 double diff1 = MP1[ii] - meanMP1;
525 double diff2 = MP2[ii] - meanMP2;
526 if (fabs(diff1) > SLIPTRESH || fabs(diff2) > SLIPTRESH) {
527 slipMP = true;
528 break;
529 }
530 stdMP1 += diff1 * diff1;
531 stdMP1 += diff2 * diff2;
[4700]532 }
[6255]533
[6271]534 if (slipMP) {
535 qcObsSampled._slipL1 = true;
536 qcObsSampled._slipL2 = true;
537 qcSat._numSlipsFound += 1;
[4702]538 }
[6271]539 else {
540 stdMP1 = sqrt(stdMP1 / MP1.size());
541 stdMP2 = sqrt(stdMP2 / MP2.size());
542 (*dataMP1) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, stdMP1));
543 (*dataMP2) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, stdMP2));
544 }
[6255]545 }
[6271]546
547 // Signal-to-Noise Ratio Plot Data
548 // -------------------------------
549 if ( (prn.system() == 'G' && plotGPS) ||
550 (prn.system() == 'R' && plotGlo) ||
551 (prn.system() == 'E' && plotGal) ) {
552 (*dataSNR1) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, qcObsSampled._SNR1));
553 (*dataSNR2) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, qcObsSampled._SNR2));
[4700]554 }
[4353]555 }
[6271]556 }
[4353]557
[6271]558 // Show the plots
559 // --------------
560 if (BNC_CORE->GUIenabled()) {
561 QFileInfo fileInfo(obsFile->fileName());
562 QByteArray title = fileInfo.fileName().toAscii();
[6275]563 emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2, "Meters", 2.0);
564 emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2, "dbHz", 54.0);
565 emit dspAvailPlot(obsFile->fileName(), title);
[6271]566 }
567 else {
568 for (int ii = 0; ii < dataMP1->size(); ii++) {
569 delete dataMP1->at(ii);
[4351]570 }
[6271]571 delete dataMP1;
572 for (int ii = 0; ii < dataMP2->size(); ii++) {
573 delete dataMP2->at(ii);
[4591]574 }
[6271]575 delete dataMP2;
576 for (int ii = 0; ii < dataSNR1->size(); ii++) {
577 delete dataSNR1->at(ii);
[4659]578 }
[6271]579 delete dataSNR1;
580 for (int ii = 0; ii < dataSNR2->size(); ii++) {
581 delete dataSNR2->at(ii);
[5141]582 }
[6271]583 delete dataSNR2;
[4350]584 }
585}
[4572]586
[6255]587//
[4572]588////////////////////////////////////////////////////////////////////////////
[6275]589void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName, const QByteArray& title1,
590 QVector<t_polarPoint*>* data1, const QByteArray& title2,
591 QVector<t_polarPoint*>* data2, const QByteArray& scaleTitle,
592 double maxValue) {
[4572]593
[5068]594 if (BNC_CORE->GUIenabled()) {
[4573]595
[6271]596 if (maxValue == 0.0) {
597 if (data1) {
598 for (int ii = 0; ii < data1->size(); ii++) {
599 double val = data1->at(ii)->_value;
600 if (maxValue < val) {
601 maxValue = val;
602 }
603 }
604 }
605 if (data2) {
606 for (int ii = 0; ii < data2->size(); ii++) {
607 double val = data2->at(ii)->_value;
608 if (maxValue < val) {
609 maxValue = val;
610 }
611 }
612 }
613 }
[4659]614
[6271]615 QwtInterval scaleInterval(0.0, maxValue);
[4671]616
[4573]617 QVector<QWidget*> plots;
[6271]618 if (data1) {
619 t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
620 BNC_CORE->mainWindow());
621 plot1->addCurve(data1);
622 plots << plot1;
623 }
624 if (data2) {
625 t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
626 BNC_CORE->mainWindow());
627 plot2->addCurve(data2);
628 plots << plot2;
629 }
[4666]630
[6271]631 t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
632 &scaleTitle, &scaleInterval);
[4666]633
[4573]634 graphWin->show();
635
636 bncSettings settings;
637 QString dirName = settings.value("reqcPlotDir").toString();
638 if (!dirName.isEmpty()) {
[6271]639 QByteArray ext = (scaleTitle == "Meters") ? "_M.png" : "_S.png";
[4579]640 graphWin->savePNG(dirName, ext);
[4573]641 }
642 }
[4572]643}
[4679]644
[6271]645//
[4679]646////////////////////////////////////////////////////////////////////////////
[6275]647void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName, const QByteArray& title) {
[4679]648
[6272]649 QMap<t_prn, t_plotData> plotData;
650
[6271]651 if (BNC_CORE->GUIenabled()) {
[6272]652 t_availPlot* plotA = new t_availPlot(0, plotData);
[6271]653 plotA->setTitle(title);
[4679]654
[6272]655 t_elePlot* plotZ = new t_elePlot(0, plotData);
[4679]656
[6272]657 t_dopPlot* plotD = new t_dopPlot(0, plotData);
[4679]658
[6271]659 QVector<QWidget*> plots;
660 plots << plotA << plotZ << plotD;
661 t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
[4679]662
[6271]663 int ww = QFontMetrics(graphWin->font()).width('w');
664 graphWin->setMinimumSize(120*ww, 40*ww);
[4679]665
[6271]666 graphWin->show();
[4679]667
[6271]668 bncSettings settings;
669 QString dirName = settings.value("reqcPlotDir").toString();
670 if (!dirName.isEmpty()) {
671 QByteArray ext = "_A.png";
672 graphWin->savePNG(dirName, ext);
[4679]673 }
[4681]674 }
[4679]675}
[4689]676
677// Finish the report
678////////////////////////////////////////////////////////////////////////////
[6271]679void t_reqcAnalyze::printReport() {
[5368]680
[4689]681 if (!_log) {
682 return;
683 }
684
[6271]685 *_log << "Marker name: " << _qcFile._markerName << endl
686 << "Receiver: " << _qcFile._receiverType << endl
687 << "Antenna: " << _qcFile._antennaName << endl
688 << "Start time: " << _qcFile._startTime.datestr().c_str() << ' '
689 << _qcFile._startTime.timestr().c_str() << endl
690 << "End time: " << _qcFile._endTime.datestr().c_str() << ' '
691 << _qcFile._endTime.timestr().c_str() << endl
692 << "Interval: " << _qcFile._interval << endl
693 << "# Sat.: " << _qcFile._qcSat.size() << endl;
[4689]694
[4701]695 int numObs = 0;
696 int numSlipsFlagged = 0;
697 int numSlipsFound = 0;
[6271]698 QMapIterator<t_prn, t_qcSat> it(_qcFile._qcSat);
[4693]699 while (it.hasNext()) {
700 it.next();
[6271]701 const t_qcSat& qcSat = it.value();
702 numObs += qcSat._numObs;
703 numSlipsFlagged += qcSat._numSlipsFlagged;
704 numSlipsFound += qcSat._numSlipsFound;
[4693]705 }
[4701]706 *_log << "# Obs.: " << numObs << endl
707 << "# Slips (file): " << numSlipsFlagged << endl
708 << "# Slips (found): " << numSlipsFound << endl;
[4693]709
[4689]710 _log->flush();
711}
Note: See TracBrowser for help on using the repository browser.