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

Last change on this file since 6280 was 6280, checked in by mervart, 9 years ago
File size: 21.8 KB
Line 
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>
42#include <iomanip>
43#include <qwt_plot_renderer.h>
44
45#include "reqcanalyze.h"
46#include "bnccore.h"
47#include "bncsettings.h"
48#include "reqcedit.h"
49#include "bncutils.h"
50#include "graphwin.h"
51#include "polarplot.h"
52#include "availplot.h"
53#include "eleplot.h"
54#include "dopplot.h"
55
56using namespace std;
57
58// Constructor
59////////////////////////////////////////////////////////////////////////////
60t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
61
62 bncSettings settings;
63
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
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&)));
80}
81
82// Destructor
83////////////////////////////////////////////////////////////////////////////
84t_reqcAnalyze::~t_reqcAnalyze() {
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;
93 if (BNC_CORE->mode() != t_bncCore::interactive) {
94 qApp->exit(0);
95 }
96}
97
98//
99////////////////////////////////////////////////////////////////////////////
100void t_reqcAnalyze::run() {
101
102 // Open Log File
103 // -------------
104 _logFile = new QFile(_logFileName);
105 if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
106 _log = new QTextStream();
107 _log->setDevice(_logFile);
108 }
109
110 // Initialize RINEX Observation Files
111 // ----------------------------------
112 t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
113
114 // Read Ephemerides
115 // ----------------
116 t_reqcEdit::readEphemerides(_navFileNames, _ephs);
117
118 // Loop over all RINEX Files
119 // -------------------------
120 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
121 analyzeFile(_rnxObsFiles[ii]);
122 }
123
124 // Exit
125 // ----
126 emit finished();
127 deleteLater();
128}
129
130//
131////////////////////////////////////////////////////////////////////////////
132void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
133
134 QMutexLocker lock(&_mutex);
135
136 if (_log) {
137 *_log << "\nAnalyze File\n"
138 << "------------\n"
139 << "File: " << obsFile->fileName().toAscii().data() << endl;
140 }
141
142 _qcFile.clear();
143
144 // A priori Coordinates
145 // --------------------
146 ColumnVector xyzSta = obsFile->xyz();
147
148 // Loop over all Epochs
149 // --------------------
150 try {
151 bool firstEpo = true;
152 while ( (_currEpo = obsFile->nextEpoch()) != 0) {
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();
160 }
161 _qcFile._endTime = _currEpo->tt;
162
163 t_qcEpo qcEpo;
164 qcEpo._epoTime = _currEpo->tt;
165 qcEpo._PDOP = cmpDOP(xyzSta);
166
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];
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]);
177 }
178 }
179 _qcFile._qcEpo.push_back(qcEpo);
180 }
181
182 preparePlotData(obsFile);
183
184 printReport();
185 }
186 catch (QString str) {
187 if (_log) {
188 *_log << "Exception " << str << endl;
189 }
190 else {
191 qDebug() << str;
192 }
193 }
194}
195
196// Compute Dilution of Precision
197////////////////////////////////////////////////////////////////////////////
198double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
199
200 if (xyzSta.size() != 3) {
201 return 0.0;
202 }
203
204 unsigned nSat = _currEpo->rnxSat.size();
205
206 if (nSat < 4) {
207 return 0.0;
208 }
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 }
224 }
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 }
237 }
238 }
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());
251}
252
253//
254////////////////////////////////////////////////////////////////////////////
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}
263
264//
265////////////////////////////////////////////////////////////////////////////
266t_irc t_reqcAnalyze::setQcObs(const t_satObs& satObs, t_qcObs& qcObs) {
267
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
284 // Availability and Slip Flags
285 // ---------------------------
286 double L1 = 0.0;
287 double L2 = 0.0;
288 double P1 = 0.0;
289 double P2 = 0.0;
290
291 for (unsigned iFrq = 0; iFrq < satObs._obs.size(); iFrq++) {
292 const t_frqObs* frqObs = satObs._obs[iFrq];
293 if (frqObs->_rnxType2ch[0] == '1') {
294 if (frqObs->_phaseValid) {
295 L1 = frqObs->_phase;
296 qcObs._hasL1 = true;
297 qcObs._slipL1 = frqObs->_slip;
298 }
299 if (frqObs->_codeValid) {
300 P1 = frqObs->_code;
301 }
302 if (frqObs->_snrValid) {
303 qcObs._SNR1 = frqObs->_snr;
304 }
305 }
306 else if ( (satObs._prn.system() != 'E' && frqObs->_rnxType2ch[0] == '2') ||
307 (satObs._prn.system() == 'E' && frqObs->_rnxType2ch[0] == '5') ) {
308 if (frqObs->_phaseValid) {
309 L2 = frqObs->_phase;
310 qcObs._hasL2 = true;
311 qcObs._slipL2 = frqObs->_slip;
312 }
313 if (frqObs->_codeValid) {
314 P2 = frqObs->_code;
315 }
316 if (frqObs->_snrValid) {
317 qcObs._SNR2 = frqObs->_snr;
318 }
319 }
320 }
321
322 // Compute the Multipath
323 // ----------------------
324 if (L1 != 0.0 && L2 != 0.0) {
325 double f1 = 0.0;
326 double f2 = 0.0;
327 if (satObs._prn.system() == 'G') {
328 f1 = t_CST::freq(t_frequency::G1, 0);
329 f2 = t_CST::freq(t_frequency::G2, 0);
330 }
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);
334 }
335 else if (satObs._prn.system() == 'E') {
336 f1 = t_CST::freq(t_frequency::E1, 0);
337 f2 = t_CST::freq(t_frequency::E5, 0);
338 }
339
340 L1 = L1 * t_CST::c / f1;
341 L2 = L2 * t_CST::c / f2;
342
343 if (P1 != 0.0) {
344 qcObs._MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
345 okFlag = true;
346 }
347 if (P2 != 0.0) {
348 qcObs._MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
349 okFlag = true;
350 }
351 }
352
353 if (okFlag) {
354 return success;
355 }
356 else {
357 return failure;
358 }
359}
360
361//
362////////////////////////////////////////////////////////////////////////////
363void t_reqcAnalyze::preparePlotData(const t_rnxObsFile* obsFile) {
364
365 ColumnVector xyzSta = obsFile->xyz();
366
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*>;
371
372 const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
373 const double chunkStep = 600.0; // 10 minutes
374
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
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();
402
403 // Loop over all Chunks of Data
404 // ----------------------------
405 for (bncTime chunkStart = _qcFile._startTime;
406 chunkStart < _qcFile._endTime; chunkStart += chunkStep) {
407
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];
413
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 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 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;
436
437 if (qcObs._slotSet) {
438 qcObsSampled._slotSet = true;
439 qcObsSampled._slotNum = qcObs._slotNum;
440 }
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 }
448 }
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 qcObs._azDeg = azSat * 180.0/M_PI;
458 qcObs._eleDeg = eleSat * 180.0/M_PI;
459 }
460 }
461 }
462 }
463
464 // Check Interval
465 // --------------
466 if (prevTime.valid()) {
467 double dt = qcEpo._epoTime - prevTime;
468 if (dt > 1.5 * _qcFile._interval) {
469 qcObsSampled._gapL1 = true;
470 qcObsSampled._gapL2 = true;
471 }
472 }
473 prevTime = qcEpo._epoTime;
474
475 // Check L1 and L2 availability
476 // ----------------------------
477 if (qcObs._hasL1) {
478 qcObsSampled._hasL1 = true;
479 }
480 if (qcObs._hasL2) {
481 qcObsSampled._hasL2 = true;
482 }
483
484 // Check Minimal Signal-to-Noise Ratio
485 // -----------------------------------
486 if ( qcObs._SNR1 > 0 && (qcObsSampled._SNR1 == 0 || qcObsSampled._SNR1 > qcObs._SNR1) ) {
487 qcObsSampled._SNR1 = qcObs._SNR1;
488 }
489 if ( qcObs._SNR2 > 0 && (qcObsSampled._SNR2 == 0 || qcObsSampled._SNR2 > qcObs._SNR2) ) {
490 qcObsSampled._SNR2 = qcObs._SNR2;
491 }
492
493 // Check Slip Flags
494 // ----------------
495 if (qcObs._slipL1) {
496 qcObsSampled._slipL1 = true;
497 }
498 if (qcObs._slipL2) {
499 qcObsSampled._slipL2 = true;
500 }
501
502 MP1 << qcObs._MP1;
503 MP2 << qcObs._MP2;
504 }
505
506 // Compute the Multipath
507 // ---------------------
508 if ( MP1.size() > 0 && MP2.size() > 0 &&
509 ( (prn.system() == 'G' && plotGPS ) ||
510 (prn.system() == 'R' && plotGlo && qcObsSampled._slotSet) ||
511 (prn.system() == 'E' && plotGal ) ) ) {
512
513 double meanMP1 = 0.0;
514 double meanMP2 = 0.0;
515 for (int ii = 0; ii < MP1.size(); ii++) {
516 meanMP1 += MP1[ii];
517 meanMP2 += MP2[ii];
518 }
519 meanMP1 /= MP1.size();
520 meanMP2 /= MP2.size();
521
522 bool slipMP = false;
523 double stdMP1 = 0.0;
524 double stdMP2 = 0.0;
525 for (int ii = 0; ii < MP1.size(); ii++) {
526 double diff1 = MP1[ii] - meanMP1;
527 double diff2 = MP2[ii] - meanMP2;
528 if (fabs(diff1) > SLIPTRESH || fabs(diff2) > SLIPTRESH) {
529 slipMP = true;
530 break;
531 }
532 stdMP1 += diff1 * diff1;
533 stdMP2 += diff2 * diff2;
534 }
535
536 if (slipMP) {
537 qcObsSampled._slipL1 = true;
538 qcObsSampled._slipL2 = true;
539 qcSat._numSlipsFound += 1;
540 }
541 else {
542 stdMP1 = sqrt(stdMP1 / MP1.size());
543 stdMP2 = sqrt(stdMP2 / MP2.size());
544 (*dataMP1) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, stdMP1));
545 (*dataMP2) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, stdMP2));
546 }
547 }
548
549 // Signal-to-Noise Ratio Plot Data
550 // -------------------------------
551 if ( (prn.system() == 'G' && plotGPS) ||
552 (prn.system() == 'R' && plotGlo) ||
553 (prn.system() == 'E' && plotGal) ) {
554 (*dataSNR1) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, qcObsSampled._SNR1));
555 (*dataSNR2) << (new t_polarPoint(qcObsSampled._azDeg, 90.0 - qcObsSampled._eleDeg, qcObsSampled._SNR2));
556 }
557 }
558 }
559
560 // Show the plots
561 // --------------
562 if (BNC_CORE->GUIenabled()) {
563 QFileInfo fileInfo(obsFile->fileName());
564 QByteArray title = fileInfo.fileName().toAscii();
565 emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2, "Meters", 2.0);
566 emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2, "dbHz", 54.0);
567 emit dspAvailPlot(obsFile->fileName(), title);
568 }
569 else {
570 for (int ii = 0; ii < dataMP1->size(); ii++) {
571 delete dataMP1->at(ii);
572 }
573 delete dataMP1;
574 for (int ii = 0; ii < dataMP2->size(); ii++) {
575 delete dataMP2->at(ii);
576 }
577 delete dataMP2;
578 for (int ii = 0; ii < dataSNR1->size(); ii++) {
579 delete dataSNR1->at(ii);
580 }
581 delete dataSNR1;
582 for (int ii = 0; ii < dataSNR2->size(); ii++) {
583 delete dataSNR2->at(ii);
584 }
585 delete dataSNR2;
586 }
587}
588
589//
590////////////////////////////////////////////////////////////////////////////
591void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName, const QByteArray& title1,
592 QVector<t_polarPoint*>* data1, const QByteArray& title2,
593 QVector<t_polarPoint*>* data2, const QByteArray& scaleTitle,
594 double maxValue) {
595
596 if (BNC_CORE->GUIenabled()) {
597
598 if (maxValue == 0.0) {
599 if (data1) {
600 for (int ii = 0; ii < data1->size(); ii++) {
601 double val = data1->at(ii)->_value;
602 if (maxValue < val) {
603 maxValue = val;
604 }
605 }
606 }
607 if (data2) {
608 for (int ii = 0; ii < data2->size(); ii++) {
609 double val = data2->at(ii)->_value;
610 if (maxValue < val) {
611 maxValue = val;
612 }
613 }
614 }
615 }
616
617 QwtInterval scaleInterval(0.0, maxValue);
618
619 QVector<QWidget*> plots;
620 if (data1) {
621 t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
622 BNC_CORE->mainWindow());
623 plot1->addCurve(data1);
624 plots << plot1;
625 }
626 if (data2) {
627 t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
628 BNC_CORE->mainWindow());
629 plot2->addCurve(data2);
630 plots << plot2;
631 }
632
633 t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
634 &scaleTitle, &scaleInterval);
635
636 graphWin->show();
637
638 bncSettings settings;
639 QString dirName = settings.value("reqcPlotDir").toString();
640 if (!dirName.isEmpty()) {
641 QByteArray ext = (scaleTitle == "Meters") ? "_M.png" : "_S.png";
642 graphWin->savePNG(dirName, ext);
643 }
644 }
645}
646
647//
648////////////////////////////////////////////////////////////////////////////
649void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName, const QByteArray& title) {
650
651 t_plotData plotData;
652 QMap<t_prn, t_plotData> plotDataMap;
653
654 for (int ii = 0; ii < _qcFile._qcEpo.size(); ii++) {
655 const t_qcEpo& qcEpo = _qcFile._qcEpo[ii];
656 double mjdX24 = qcEpo._epoTime.mjddec() * 24.0;
657
658 plotData._mjdX24 << mjdX24;
659 plotData._PDOP << qcEpo._PDOP;
660 plotData._numSat << qcEpo._qcObs.size();
661
662 QMapIterator<t_prn, t_qcObs> it(qcEpo._qcObs);
663 while (it.hasNext()) {
664 it.next();
665 const t_prn& prn = it.key();
666 const t_qcObs& qcObs = it.value();
667 t_plotData& data = plotDataMap[prn];
668 if (qcObs._hasL1) data._L1ok << mjdX24;
669 if (qcObs._hasL2) data._L2ok << mjdX24;
670 if (qcObs._slipL1) data._L1slip << mjdX24;
671 if (qcObs._slipL2) data._L2slip << mjdX24;
672 if (qcObs._gapL1) data._L1gap << mjdX24;
673 if (qcObs._gapL2) data._L2gap << mjdX24;
674 data._eleDeg << qcObs._eleDeg;
675 }
676 }
677
678
679 if (BNC_CORE->GUIenabled()) {
680 t_availPlot* plotA = new t_availPlot(0, plotDataMap);
681 plotA->setTitle(title);
682
683 t_elePlot* plotZ = new t_elePlot(0, plotDataMap);
684
685 t_dopPlot* plotD = new t_dopPlot(0, plotData);
686
687 QVector<QWidget*> plots;
688 plots << plotA << plotZ << plotD;
689 t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
690
691 int ww = QFontMetrics(graphWin->font()).width('w');
692 graphWin->setMinimumSize(120*ww, 40*ww);
693
694 graphWin->show();
695
696 bncSettings settings;
697 QString dirName = settings.value("reqcPlotDir").toString();
698 if (!dirName.isEmpty()) {
699 QByteArray ext = "_A.png";
700 graphWin->savePNG(dirName, ext);
701 }
702 }
703}
704
705// Finish the report
706////////////////////////////////////////////////////////////////////////////
707void t_reqcAnalyze::printReport() {
708
709 if (!_log) {
710 return;
711 }
712
713 *_log << "Marker name: " << _qcFile._markerName << endl
714 << "Receiver: " << _qcFile._receiverType << endl
715 << "Antenna: " << _qcFile._antennaName << endl
716 << "Start time: " << _qcFile._startTime.datestr().c_str() << ' '
717 << _qcFile._startTime.timestr().c_str() << endl
718 << "End time: " << _qcFile._endTime.datestr().c_str() << ' '
719 << _qcFile._endTime.timestr().c_str() << endl
720 << "Interval: " << _qcFile._interval << endl
721 << "# Sat.: " << _qcFile._qcSat.size() << endl;
722
723 int numObs = 0;
724 int numSlipsFlagged = 0;
725 int numSlipsFound = 0;
726 QMapIterator<t_prn, t_qcSat> it(_qcFile._qcSat);
727 while (it.hasNext()) {
728 it.next();
729 const t_qcSat& qcSat = it.value();
730 numObs += qcSat._numObs;
731 numSlipsFlagged += qcSat._numSlipsFlagged;
732 numSlipsFound += qcSat._numSlipsFound;
733 }
734 *_log << "# Obs.: " << numObs << endl
735 << "# Slips (file): " << numSlipsFlagged << endl
736 << "# Slips (found): " << numSlipsFound << endl;
737
738 _log->flush();
739}
Note: See TracBrowser for help on using the repository browser.