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

Last change on this file since 4717 was 4717, checked in by mervart, 12 years ago
File size: 22.1 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 "bncapp.h"
47#include "bncsettings.h"
48#include "reqcedit.h"
49#include "bncutils.h"
50#include "bncpostprocess.h"
51#include "graphwin.h"
52#include "polarplot.h"
53#include "availplot.h"
54#include "eleplot.h"
55#include "dopplot.h"
56
57using namespace std;
58
59const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
60
61// Constructor
62////////////////////////////////////////////////////////////////////////////
63t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
64
65 bncSettings settings;
66
67 _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
68 _logFile = 0;
69 _log = 0;
70 _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
71 _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
72
73 _currEpo = 0;
74
75 connect(this, SIGNAL(dspSkyPlot(const QString&,
76 const QByteArray&,
77 QVector<t_polarPoint*>*,
78 const QByteArray&,
79 QVector<t_polarPoint*>*,
80 const QByteArray&, double)),
81 this, SLOT(slotDspSkyPlot(const QString&,
82 const QByteArray&,
83 QVector<t_polarPoint*>*,
84 const QByteArray&,
85 QVector<t_polarPoint*>*,
86 const QByteArray&, double)));
87
88 connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
89 this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
90}
91
92// Destructor
93////////////////////////////////////////////////////////////////////////////
94t_reqcAnalyze::~t_reqcAnalyze() {
95 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
96 delete _rnxObsFiles[ii];
97 }
98 for (int ii = 0; ii < _ephs.size(); ii++) {
99 delete _ephs[ii];
100 }
101 delete _log; _log = 0;
102 delete _logFile; _logFile = 0;
103 bncApp* app = (bncApp*) qApp;
104 if ( app->mode() != bncApp::interactive) {
105 app->exit(0);
106 }
107}
108
109//
110////////////////////////////////////////////////////////////////////////////
111void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName,
112 const QByteArray& title1,
113 QVector<t_polarPoint*>* data1,
114 const QByteArray& title2,
115 QVector<t_polarPoint*>* data2,
116 const QByteArray& scaleTitle,
117 double maxValue) {
118
119 bncApp* app = dynamic_cast<bncApp*>(qApp);
120 if (app->GUIenabled()) {
121
122 if (maxValue == 0.0) {
123 if (data1) {
124 for (int ii = 0; ii < data1->size(); ii++) {
125 double val = data1->at(ii)->_value;
126 if (maxValue < val) {
127 maxValue = val;
128 }
129 }
130 }
131 if (data2) {
132 for (int ii = 0; ii < data2->size(); ii++) {
133 double val = data2->at(ii)->_value;
134 if (maxValue < val) {
135 maxValue = val;
136 }
137 }
138 }
139 }
140
141 QwtInterval scaleInterval(0.0, maxValue);
142
143 QVector<QWidget*> plots;
144 if (data1) {
145 t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
146 app->mainWindow());
147 plot1->addCurve(data1);
148 plots << plot1;
149 }
150 if (data2) {
151 t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
152 app->mainWindow());
153 plot2->addCurve(data2);
154 plots << plot2;
155 }
156
157 t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
158 &scaleTitle, &scaleInterval);
159
160 graphWin->show();
161
162 bncSettings settings;
163 QString dirName = settings.value("reqcPlotDir").toString();
164 if (!dirName.isEmpty()) {
165 QByteArray ext = scaleTitle.isEmpty() ? "_S.png" : "_M.png";
166 graphWin->savePNG(dirName, ext);
167 }
168 }
169}
170
171//
172////////////////////////////////////////////////////////////////////////////
173void t_reqcAnalyze::run() {
174
175 // Open Log File
176 // -------------
177 _logFile = new QFile(_logFileName);
178 if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
179 _log = new QTextStream();
180 _log->setDevice(_logFile);
181 }
182
183 // Initialize RINEX Observation Files
184 // ----------------------------------
185 t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
186
187 // Read Ephemerides
188 // ----------------
189 t_reqcEdit::readEphemerides(_navFileNames, _ephs);
190
191 // Loop over all RINEX Files
192 // -------------------------
193 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
194 analyzeFile(_rnxObsFiles[ii]);
195 }
196
197 // Exit
198 // ----
199 emit finished();
200 deleteLater();
201}
202
203//
204////////////////////////////////////////////////////////////////////////////
205void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
206
207 _mutex.lock();
208
209 if (_log) {
210 *_log << "\nAnalyze File\n"
211 << "------------\n"
212 << "File: " << obsFile->fileName().toAscii().data() << endl;
213 }
214
215 _allObsMap.clear();
216 _availDataMap.clear();
217 _obsStat.reset();
218
219 // A priori Coordinates
220 // --------------------
221 ColumnVector xyzSta = obsFile->xyz();
222
223 // Loop over all Epochs
224 // --------------------
225 try {
226 unsigned iEpo = 0;
227 while ( (_currEpo = obsFile->nextEpoch()) != 0) {
228
229 if (iEpo == 0) {
230 _obsStat._startTime = _currEpo->tt;
231 _obsStat._antennaName = obsFile->antennaName();
232 _obsStat._markerName = obsFile->markerName();
233 _obsStat._receiverType = obsFile->receiverType();
234 _obsStat._interval = obsFile->interval();
235 }
236 _obsStat._endTime = _currEpo->tt;
237
238 // Loop over all satellites
239 // ------------------------
240 for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
241 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
242 t_obs obs;
243 t_postProcessing::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
244
245 if (obs.satSys == 'R') {
246 // TODO: set channel number
247 }
248
249 QString prn = QString("%1%2").arg(obs.satSys)
250 .arg(obs.satNum, 2, 10, QChar('0'));
251
252 t_irc irc = _allObsMap[prn].addObs(obs);
253
254 if (irc == success) {
255 const t_oneObs* newObs = _allObsMap[prn]._oneObsVec.last();
256 if (newObs->_hasL1 && newObs->_hasL2) {
257 _obsStat._prnStat[prn]._numObs += 1;
258 }
259 if (newObs->_slipL1 && newObs->_slipL2) {
260 _obsStat._prnStat[prn]._numSlipsFlagged += 1;
261 }
262 }
263 }
264
265 prepareObsStat(iEpo, obsFile->interval(), xyzSta);
266 iEpo++;
267
268 } // while (_currEpo)
269 }
270 catch (QString str) {
271 if (_log) {
272 *_log << "Exception " << str << endl;
273 }
274 else {
275 qDebug() << str;
276 }
277 _mutex.unlock();
278 return;
279 }
280
281 // Analyze the Multipath
282 // ---------------------
283 QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
284 QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
285 QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
286 QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
287
288 QMutableMapIterator<QString, t_allObs> it(_allObsMap);
289 while (it.hasNext()) {
290 it.next();
291 QString prn = it.key();
292 preparePlotData(prn, xyzSta, obsFile->interval(),
293 dataMP1, dataMP2, dataSNR1, dataSNR2);
294 }
295
296 printReport(dataMP1, dataMP2, dataSNR1, dataSNR2);
297
298 QFileInfo fileInfo(obsFile->fileName());
299 QByteArray title = fileInfo.fileName().toAscii();
300
301 emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2,
302 "Meters", 2.0);
303 emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2,
304 "", 9.0);
305 emit dspAvailPlot(obsFile->fileName(), title);
306}
307
308//
309////////////////////////////////////////////////////////////////////////////
310t_irc t_reqcAnalyze::t_allObs::addObs(const t_obs& obs) {
311
312 t_oneObs* newObs = new t_oneObs(obs.GPSWeek, obs.GPSWeeks);
313 bool okFlag = false;
314
315 // Availability and Slip Flags
316 // ---------------------------
317 double L1 = obs.measdata("L1", 3.0);
318 if (L1 != 0) {
319 newObs->_hasL1 = true;
320 }
321 double L2 = obs.measdata("L2", 3.0);
322 if (L2 != 0) {
323 newObs->_hasL2 = true;
324 }
325 if (obs.slipL1) {
326 newObs->_slipL1 = true;
327 }
328 if (obs.slipL2) {
329 newObs->_slipL2 = true;
330 }
331
332 // Compute the Multipath
333 // ----------------------
334 if (L1 != 0.0 && L2 != 0.0) {
335 double f1 = t_CST::f1(obs.satSys, obs.slotNum);
336 double f2 = t_CST::f2(obs.satSys, obs.slotNum);
337
338 L1 = L1 * t_CST::c / f1;
339 L2 = L2 * t_CST::c / f2;
340
341 double P1 = obs.measdata("C1", 3.0);
342 if (P1 != 0.0) {
343 newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
344 okFlag = true;
345 }
346 double P2 = obs.measdata("C2", 3.0);
347 if (P2 != 0.0) {
348 newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
349 okFlag = true;
350 }
351 }
352
353 // Signal-to-Noise
354 // ---------------
355 double S1 = obs.measdata("S1", 3.0);
356 if (S1 != 0.0) {
357 newObs->_SNR1 = floor(S1/6);
358 if (newObs->_SNR1 > 9.0) {
359 newObs->_SNR1 = 9.0;
360 }
361 if (newObs->_SNR1 < 1.0) {
362 newObs->_SNR1 = 1.0;
363 }
364 okFlag = true;
365 }
366 else {
367 if (obs.snrL1 > 0) {
368 newObs->_SNR1 = obs.snrL1;
369 okFlag = true;
370 }
371 }
372 double S2 = obs.measdata("S2", 3.0);
373 if (S2 != 0.0) {
374 newObs->_SNR2 = floor(S2/6);
375 if (newObs->_SNR2 > 9.0) {
376 newObs->_SNR2 = 9.0;
377 }
378 if (newObs->_SNR2 < 1.0) {
379 newObs->_SNR2 = 1.0;
380 }
381 okFlag = true;
382 }
383 else {
384 if (obs.snrL2 > 0) {
385 newObs->_SNR2 = obs.snrL2;
386 okFlag = true;
387 }
388 }
389
390 // Remember the Observation
391 // ------------------------
392 if (okFlag) {
393 _oneObsVec << newObs;
394 return success;
395 }
396 else {
397 delete newObs;
398 return failure;
399 }
400}
401
402//
403////////////////////////////////////////////////////////////////////////////
404void t_reqcAnalyze::prepareObsStat(unsigned iEpo, double obsInterval,
405 const ColumnVector& xyzSta) {
406 const int sampl = int(30.0 / obsInterval);
407 if (iEpo % sampl == 0) {
408 double mjdX24 = _currEpo->tt.mjddec() * 24.0;
409 if (iEpo != 0) {
410 _obsStat._mjdX24 << mjdX24;
411 _obsStat._numSat << _obsStat._numSat.last();
412 _obsStat._PDOP << _obsStat._PDOP.last();
413 }
414 _obsStat._mjdX24 << mjdX24;
415 _obsStat._numSat << _currEpo->rnxSat.size();
416 _obsStat._PDOP << cmpDOP(xyzSta);
417 }
418}
419
420//
421////////////////////////////////////////////////////////////////////////////
422void t_reqcAnalyze::preparePlotData(const QString& prn,
423 const ColumnVector& xyzSta,
424 double obsInterval,
425 QVector<t_polarPoint*>* dataMP1,
426 QVector<t_polarPoint*>* dataMP2,
427 QVector<t_polarPoint*>* dataSNR1,
428 QVector<t_polarPoint*>* dataSNR2) {
429
430 const int chunkStep = int( 30.0 / obsInterval); // chunk step (30 sec)
431 const int numEpo = int(600.0 / obsInterval); // # epochs in one chunk (10 min)
432
433 t_allObs& allObs = _allObsMap[prn];
434
435 // Loop over all Chunks of Data
436 // ----------------------------
437 bool slipFound = false;
438 for (int chunkStart = 0; chunkStart + numEpo < allObs._oneObsVec.size();
439 chunkStart += chunkStep) {
440
441 if (chunkStart * chunkStep == numEpo) {
442 slipFound = false;
443 }
444
445 // Chunk-Specific Variables
446 // ------------------------
447 bncTime currTime;
448 bncTime prevTime;
449 bncTime chunkStartTime;
450 double mjdX24 = 0.0;
451 bool availL1 = false;
452 bool availL2 = false;
453 bool gapL1 = false;
454 bool gapL2 = false;
455 bool slipL1 = false;
456 bool slipL2 = false;
457 double meanMP1 = 0.0;
458 double meanMP2 = 0.0;
459 double minSNR1 = 0.0;
460 double minSNR2 = 0.0;
461 double aziDeg = 0.0;
462 double zenDeg = 0.0;
463 bool zenFlag = false;
464
465 // Loop over all Epochs within one Chunk of Data
466 // ---------------------------------------------
467 for (int ii = 0; ii < numEpo; ii++) {
468 int iEpo = chunkStart + ii;
469 const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
470
471 currTime.set(oneObs->_GPSWeek, oneObs->_GPSWeeks);
472
473 // Compute the Azimuth and Zenith Distance
474 // ---------------------------------------
475 if (ii == 0) {
476 chunkStartTime = currTime;
477 mjdX24 = chunkStartTime.mjddec() * 24.0;
478
479 if (xyzSta.size()) {
480 t_eph* eph = 0;
481 for (int ie = 0; ie < _ephs.size(); ie++) {
482 if (_ephs[ie]->prn() == prn) {
483 eph = _ephs[ie];
484 break;
485 }
486 }
487
488 if (eph) {
489 double xSat, ySat, zSat, clkSat;
490 eph->position(oneObs->_GPSWeek, oneObs->_GPSWeeks,
491 xSat, ySat, zSat, clkSat);
492
493 double rho, eleSat, azSat;
494 topos(xyzSta(1), xyzSta(2), xyzSta(3),
495 xSat, ySat, zSat, rho, eleSat, azSat);
496
497 aziDeg = azSat * 180.0/M_PI;
498 zenDeg = 90.0 - eleSat * 180.0/M_PI;
499 zenFlag = true;
500 }
501 }
502 }
503
504 // Check Interval
505 // --------------
506 if (prevTime.valid()) {
507 double dt = currTime - prevTime;
508 if (dt != obsInterval) {
509 gapL1 = true;
510 gapL2 = true;
511 }
512 }
513 prevTime = currTime;
514
515 // Check L1 and L2 availability
516 // ----------------------------
517 if (oneObs->_hasL1) {
518 availL1 = true;
519 }
520 else {
521 gapL1 = true;
522 }
523 if (oneObs->_hasL2) {
524 availL2 = true;
525 }
526 else {
527 gapL2 = true;
528 }
529
530 // Check Minimal Signal-to-Noise Ratio
531 // -----------------------------------
532 if ( oneObs->_SNR1 > 0 && (minSNR1 == 0 || minSNR1 > oneObs->_SNR1) ) {
533 minSNR1 = oneObs->_SNR1;
534 }
535 if ( oneObs->_SNR2 > 0 && (minSNR2 == 0 || minSNR2 > oneObs->_SNR2) ) {
536 minSNR2 = oneObs->_SNR2;
537 }
538
539 // Check Slip Flags
540 // ----------------
541 if (oneObs->_slipL1) {
542 slipL1 = true;
543 }
544 if (oneObs->_slipL2) {
545 slipL2 = true;
546 }
547
548 meanMP1 += oneObs->_MP1;
549 meanMP2 += oneObs->_MP2;
550 }
551
552 // Compute the Multipath
553 // ---------------------
554 if (prn[0] != 'R') { // TODO
555 bool slipMP = false;
556 meanMP1 /= numEpo;
557 meanMP2 /= numEpo;
558 double MP1 = 0.0;
559 double MP2 = 0.0;
560 for (int ii = 0; ii < numEpo; ii++) {
561 int iEpo = chunkStart + ii;
562 const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
563 double diff1 = oneObs->_MP1 - meanMP1;
564 double diff2 = oneObs->_MP2 - meanMP2;
565
566 // Check Slip Threshold
567 // --------------------
568 if (fabs(diff1) > SLIPTRESH || fabs(diff2) > SLIPTRESH) {
569 slipMP = true;
570 break;
571 }
572
573 MP1 += diff1 * diff1;
574 MP2 += diff2 * diff2;
575 }
576 if (slipMP) {
577 slipL1 = true;
578 slipL2 = true;
579 if (!slipFound) {
580 slipFound = true;
581 _obsStat._prnStat[prn]._numSlipsFound += 1;
582 }
583 }
584 else {
585 MP1 = sqrt(MP1 / (numEpo-1));
586 MP2 = sqrt(MP2 / (numEpo-1));
587 (*dataMP1) << (new t_polarPoint(aziDeg, zenDeg, MP1));
588 (*dataMP2) << (new t_polarPoint(aziDeg, zenDeg, MP2));
589 }
590 }
591
592 // Availability Plot Data
593 // ----------------------
594 if (availL1) {
595 if (slipL1) {
596 _availDataMap[prn]._L1slip << mjdX24;
597 }
598 else if (gapL1) {
599 _availDataMap[prn]._L1gap << mjdX24;
600 }
601 else {
602 _availDataMap[prn]._L1ok << mjdX24;
603 }
604 }
605 if (availL2) {
606 if (slipL2) {
607 _availDataMap[prn]._L2slip << mjdX24;
608 }
609 else if (gapL2) {
610 _availDataMap[prn]._L2gap << mjdX24;
611 }
612 else {
613 _availDataMap[prn]._L2ok << mjdX24;
614 }
615 }
616 if (zenFlag) {
617 _availDataMap[prn]._eleTim << mjdX24;
618 _availDataMap[prn]._eleDeg << 90.0 - zenDeg;
619 }
620
621 // Signal-to-Noise Ration Plot Data
622 // --------------------------------
623 (*dataSNR1) << (new t_polarPoint(aziDeg, zenDeg, minSNR1));
624 (*dataSNR2) << (new t_polarPoint(aziDeg, zenDeg, minSNR2));
625 }
626}
627
628//
629////////////////////////////////////////////////////////////////////////////
630void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName,
631 const QByteArray& title) {
632
633 if (dynamic_cast<bncApp*>(qApp)->GUIenabled()) {
634 t_availPlot* plotA = new t_availPlot(0, &_availDataMap);
635 plotA->setTitle(title);
636
637 t_elePlot* plotZ = new t_elePlot(0, &_availDataMap);
638
639 t_dopPlot* plotD = new t_dopPlot(0, &_obsStat);
640
641 QVector<QWidget*> plots;
642 plots << plotA << plotZ << plotD;
643 t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
644
645 int ww = QFontMetrics(graphWin->font()).width('w');
646 graphWin->setMinimumSize(120*ww, 40*ww);
647
648 graphWin->show();
649
650 bncSettings settings;
651 QString dirName = settings.value("reqcPlotDir").toString();
652 if (!dirName.isEmpty()) {
653 QByteArray ext = "_A.png";
654 graphWin->savePNG(dirName, ext);
655 }
656 }
657 _mutex.unlock();
658}
659
660// Compute Dilution of Precision
661////////////////////////////////////////////////////////////////////////////
662double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
663
664 if (xyzSta.size() != 3) {
665 return 0.0;
666 }
667
668 unsigned nSat = _currEpo->rnxSat.size();
669
670 if (nSat < 4) {
671 return 0.0;
672 }
673
674 Matrix AA(nSat, 4);
675
676 unsigned nSatUsed = 0;
677 for (unsigned iSat = 0; iSat < nSat; iSat++) {
678
679 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iSat];
680
681 QString prn = QString("%1%2").arg(rnxSat.satSys)
682 .arg(rnxSat.satNum, 2, 10, QChar('0'));
683
684 t_eph* eph = 0;
685 for (int ie = 0; ie < _ephs.size(); ie++) {
686 if (_ephs[ie]->prn() == prn) {
687 eph = _ephs[ie];
688 break;
689 }
690 }
691 if (eph) {
692 ++nSatUsed;
693 ColumnVector xSat(3);
694 double clkSat;
695 eph->position(_currEpo->tt.gpsw(), _currEpo->tt.gpssec(),
696 xSat(1), xSat(2), xSat(3), clkSat);
697 ColumnVector dx = xSat - xyzSta;
698 double rho = dx.norm_Frobenius();
699 AA(nSatUsed,1) = dx(1) / rho;
700 AA(nSatUsed,2) = dx(2) / rho;
701 AA(nSatUsed,3) = dx(3) / rho;
702 AA(nSatUsed,4) = 1.0;
703 }
704 }
705
706 if (nSatUsed < 4) {
707 return 0.0;
708 }
709
710 AA = AA.Rows(1, nSatUsed);
711
712 SymmetricMatrix QQ;
713 QQ << AA.t() * AA;
714 QQ = QQ.i();
715
716 return sqrt(QQ.trace());
717}
718
719// Finish the report
720////////////////////////////////////////////////////////////////////////////
721void t_reqcAnalyze::printReport(QVector<t_polarPoint*>* dataMP1,
722 QVector<t_polarPoint*>* dataMP2,
723 QVector<t_polarPoint*>* dataSNR1,
724 QVector<t_polarPoint*>* dataSNR2) {
725 if (!_log) {
726 return;
727 }
728
729 *_log << "Marker name: " << _obsStat._markerName << endl
730 << "Receiver: " << _obsStat._receiverType << endl
731 << "Antenna: " << _obsStat._antennaName << endl
732 << "Start time: " << _obsStat._startTime.datestr().c_str() << ' '
733 << _obsStat._startTime.timestr().c_str() << endl
734 << "End time: " << _obsStat._endTime.datestr().c_str() << ' '
735 << _obsStat._endTime.timestr().c_str() << endl
736 << "Interval: " << _obsStat._interval << endl
737 << "# Sat.: " << _obsStat._prnStat.size() << endl;
738
739 int numObs = 0;
740 int numSlipsFlagged = 0;
741 int numSlipsFound = 0;
742 QMapIterator<QString, t_prnStat> it(_obsStat._prnStat);
743 while (it.hasNext()) {
744 it.next();
745 const t_prnStat& prnStat = it.value();
746 numObs += prnStat._numObs;
747 numSlipsFlagged += prnStat._numSlipsFlagged;
748 numSlipsFound += prnStat._numSlipsFound;
749 }
750 *_log << "# Obs.: " << numObs << endl
751 << "# Slips (file): " << numSlipsFlagged << endl
752 << "# Slips (found): " << numSlipsFound << endl;
753
754 for (int kk = 1; kk <= 4; kk++) {
755 QVector<t_polarPoint*>* data = 0;
756 QString text;
757 if (kk == 1) {
758 data = dataMP1;
759 text = "Mean MP1: ";
760 }
761 else if (kk == 2) {
762 data = dataMP2;
763 text = "Mean MP2: ";
764 }
765 else if (kk == 3) {
766 data = dataSNR1;
767 text = "Mean SNR1: ";
768 }
769 else if (kk == 4) {
770 data = dataSNR2;
771 text = "Mean SNR2: ";
772 }
773 double mean = 0.0;
774 for (int ii = 0; ii < data->size(); ii++) {
775 const t_polarPoint* point = data->at(ii);
776 mean += point->_value;
777 }
778 mean /= data->size();
779 *_log << text << mean << endl;
780 }
781
782 _log->flush();
783}
Note: See TracBrowser for help on using the repository browser.