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

Last change on this file since 4707 was 4707, checked in by mervart, 12 years ago
File size: 22.2 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
218 // A priori Coordinates
219 // --------------------
220 ColumnVector xyzSta = obsFile->xyz();
221
222 // Loop over all Epochs
223 // --------------------
224 try {
225 unsigned iEpo = 0;
226 while ( (_currEpo = obsFile->nextEpoch()) != 0) {
227
228 if (iEpo == 0) {
229 _obsStat._startTime = _currEpo->tt;
230 _obsStat._antennaName = obsFile->antennaName();
231 _obsStat._markerName = obsFile->markerName();
232 _obsStat._receiverType = obsFile->receiverType();
233 _obsStat._interval = obsFile->interval();
234 }
235 _obsStat._endTime = _currEpo->tt;
236
237 // Loop over all satellites
238 // ------------------------
239 for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
240 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
241 t_obs obs;
242 t_postProcessing::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
243
244 if (obs.satSys == 'R') {
245 // TODO: set channel number
246 }
247
248 QString prn = QString("%1%2").arg(obs.satSys)
249 .arg(obs.satNum, 2, 10, QChar('0'));
250
251 t_irc irc = _allObsMap[prn].addObs(obs);
252
253 if (irc == success) {
254 const t_oneObs* newObs = _allObsMap[prn]._oneObsVec.last();
255 if (newObs->_hasL1 && newObs->_hasL2) {
256 _obsStat._prnStat[prn]._numObs += 1;
257 }
258 if (newObs->_slipL1 && newObs->_slipL2) {
259 _obsStat._prnStat[prn]._numSlipsFlagged += 1;
260 }
261 }
262 }
263
264 prepareObsStat(iEpo, obsFile->interval(), xyzSta);
265 iEpo++;
266
267 } // while (_currEpo)
268 }
269 catch (QString str) {
270 if (_log) {
271 *_log << "Exception " << str << endl;
272 }
273 else {
274 qDebug() << str;
275 }
276 _mutex.unlock();
277 return;
278 }
279
280 // Analyze the Multipath
281 // ---------------------
282 QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
283 QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
284 QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
285 QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
286
287 QMutableMapIterator<QString, t_allObs> it(_allObsMap);
288 while (it.hasNext()) {
289 it.next();
290 QString prn = it.key();
291 preparePlotData(prn, xyzSta, obsFile->interval(),
292 dataMP1, dataMP2, dataSNR1, dataSNR2);
293 }
294
295 printReport(dataMP1, dataMP2, dataSNR1, dataSNR2);
296
297 QFileInfo fileInfo(obsFile->fileName());
298 QByteArray title = fileInfo.fileName().toAscii();
299
300 emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2,
301 "Meters", 2.0);
302 emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2,
303 "", 9.0);
304 emit dspAvailPlot(obsFile->fileName(), title);
305}
306
307//
308////////////////////////////////////////////////////////////////////////////
309t_irc t_reqcAnalyze::t_allObs::addObs(const t_obs& obs) {
310
311 t_oneObs* newObs = new t_oneObs(obs.GPSWeek, obs.GPSWeeks);
312 bool okFlag = false;
313
314 // Availability and Slip Flags
315 // ---------------------------
316 double L1 = obs.measdata("L1", 3.0);
317 if (L1 != 0) {
318 newObs->_hasL1 = true;
319 }
320 double L2 = obs.measdata("L2", 3.0);
321 if (L2 != 0) {
322 newObs->_hasL2 = true;
323 }
324 if (obs.slipL1) {
325 newObs->_slipL1 = true;
326 }
327 if (obs.slipL2) {
328 newObs->_slipL2 = true;
329 }
330
331 // Compute the Multipath
332 // ----------------------
333 if (L1 != 0.0 && L2 != 0.0) {
334 double f1 = t_CST::f1(obs.satSys, obs.slotNum);
335 double f2 = t_CST::f2(obs.satSys, obs.slotNum);
336
337 L1 = L1 * t_CST::c / f1;
338 L2 = L2 * t_CST::c / f2;
339
340 double P1 = obs.measdata("C1", 3.0);
341 if (P1 != 0.0) {
342 newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
343 okFlag = true;
344 }
345 double P2 = obs.measdata("C2", 3.0);
346 if (P2 != 0.0) {
347 newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
348 okFlag = true;
349 }
350 }
351
352 // Signal-to-Noise
353 // ---------------
354 double S1 = obs.measdata("S1", 3.0);
355 if (S1 != 0.0) {
356 newObs->_SNR1 = floor(S1/6);
357 if (newObs->_SNR1 > 9.0) {
358 newObs->_SNR1 = 9.0;
359 }
360 if (newObs->_SNR1 < 1.0) {
361 newObs->_SNR1 = 1.0;
362 }
363 okFlag = true;
364 }
365 else {
366 if (obs.snrL1 > 0) {
367 newObs->_SNR1 = obs.snrL1;
368 okFlag = true;
369 }
370 }
371 double S2 = obs.measdata("S2", 3.0);
372 if (S2 != 0.0) {
373 newObs->_SNR2 = floor(S2/6);
374 if (newObs->_SNR2 > 9.0) {
375 newObs->_SNR2 = 9.0;
376 }
377 if (newObs->_SNR2 < 1.0) {
378 newObs->_SNR2 = 1.0;
379 }
380 okFlag = true;
381 }
382 else {
383 if (obs.snrL2 > 0) {
384 newObs->_SNR2 = obs.snrL2;
385 okFlag = true;
386 }
387 }
388
389 // Remember the Observation
390 // ------------------------
391 if (okFlag) {
392 _oneObsVec << newObs;
393 return success;
394 }
395 else {
396 delete newObs;
397 return failure;
398 }
399}
400
401//
402////////////////////////////////////////////////////////////////////////////
403void t_reqcAnalyze::prepareObsStat(unsigned iEpo, double obsInterval,
404 const ColumnVector& xyzSta) {
405 const int sampl = int(30.0 / obsInterval);
406 if (iEpo % sampl == 0) {
407 double mjdX24 = _currEpo->tt.mjddec() * 24.0;
408 if (iEpo != 0) {
409 _obsStat._mjdX24 << mjdX24;
410 _obsStat._numSat << _obsStat._numSat.last();
411 _obsStat._PDOP << _obsStat._PDOP.last();
412 }
413 _obsStat._mjdX24 << mjdX24;
414 _obsStat._numSat << _currEpo->rnxSat.size();
415 _obsStat._PDOP << cmpDOP(xyzSta);
416 }
417}
418
419//
420////////////////////////////////////////////////////////////////////////////
421void t_reqcAnalyze::preparePlotData(const QString& prn,
422 const ColumnVector& xyzSta,
423 double obsInterval,
424 QVector<t_polarPoint*>* dataMP1,
425 QVector<t_polarPoint*>* dataMP2,
426 QVector<t_polarPoint*>* dataSNR1,
427 QVector<t_polarPoint*>* dataSNR2) {
428
429 const int chunkStep = int( 30.0 / obsInterval); // chunk step (30 sec)
430 const int numEpo = int(600.0 / obsInterval); // # epochs in one chunk (10 min)
431
432 t_allObs& allObs = _allObsMap[prn];
433
434 // Loop over all Chunks of Data
435 // ----------------------------
436 bool slipFound = false;
437 for (int chunkStart = 0; chunkStart + numEpo < allObs._oneObsVec.size();
438 chunkStart += chunkStep) {
439
440 if (chunkStart * chunkStep == numEpo) {
441 slipFound = false;
442 }
443
444 // Chunk-Specific Variables
445 // ------------------------
446 bncTime currTime;
447 bncTime prevTime;
448 bncTime chunkStartTime;
449 double mjdX24 = 0.0;
450 bool availL1 = false;
451 bool availL2 = false;
452 bool gapL1 = false;
453 bool gapL2 = false;
454 bool slipL1 = false;
455 bool slipL2 = false;
456 double meanMP1 = 0.0;
457 double meanMP2 = 0.0;
458 double minSNR1 = 0.0;
459 double minSNR2 = 0.0;
460 double aziDeg = 0.0;
461 double zenDeg = 0.0;
462 bool zenFlag = false;
463
464 // Loop over all Epochs within one Chunk of Data
465 // ---------------------------------------------
466 for (int ii = 0; ii < numEpo; ii++) {
467 int iEpo = chunkStart + ii;
468 const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
469
470 currTime.set(oneObs->_GPSWeek, oneObs->_GPSWeeks);
471
472 // Compute the Azimuth and Zenith Distance
473 // ---------------------------------------
474 if (ii == 0) {
475 chunkStartTime = currTime;
476 mjdX24 = chunkStartTime.mjddec() * 24.0;
477
478 if (xyzSta.size()) {
479 t_eph* eph = 0;
480 for (int ie = 0; ie < _ephs.size(); ie++) {
481 if (_ephs[ie]->prn() == prn) {
482 eph = _ephs[ie];
483 break;
484 }
485 }
486
487 if (eph) {
488 double xSat, ySat, zSat, clkSat;
489 eph->position(oneObs->_GPSWeek, oneObs->_GPSWeeks,
490 xSat, ySat, zSat, clkSat);
491
492 double rho, eleSat, azSat;
493 topos(xyzSta(1), xyzSta(2), xyzSta(3),
494 xSat, ySat, zSat, rho, eleSat, azSat);
495
496 aziDeg = azSat * 180.0/M_PI;
497 zenDeg = 90.0 - eleSat * 180.0/M_PI;
498 zenFlag = true;
499 }
500 }
501 }
502
503 // Check Interval
504 // --------------
505 if (prevTime.valid()) {
506 double dt = currTime - prevTime;
507 if (dt != obsInterval) {
508 gapL1 = true;
509 gapL2 = true;
510 }
511 }
512 prevTime = currTime;
513
514 // Check L1 and L2 availability
515 // ----------------------------
516 if (oneObs->_hasL1) {
517 availL1 = true;
518 }
519 else {
520 gapL1 = true;
521 }
522 if (oneObs->_hasL2) {
523 availL2 = true;
524 }
525 else {
526 gapL2 = true;
527 }
528
529 // Check Minimal Signal-to-Noise Ratio
530 // -----------------------------------
531 if ( oneObs->_SNR1 > 0 && (minSNR1 == 0 || minSNR1 > oneObs->_SNR1) ) {
532 minSNR1 = oneObs->_SNR1;
533 }
534 if ( oneObs->_SNR2 > 0 && (minSNR2 == 0 || minSNR2 > oneObs->_SNR2) ) {
535 minSNR2 = oneObs->_SNR2;
536 }
537
538 // Check Slip Flags
539 // ----------------
540 if (oneObs->_slipL1) {
541 slipL1 = true;
542 }
543 if (oneObs->_slipL2) {
544 slipL2 = true;
545 }
546
547 meanMP1 += oneObs->_MP1;
548 meanMP2 += oneObs->_MP2;
549 }
550
551 // Compute the Multipath
552 // ---------------------
553 if (prn[0] != 'R') { // TODO
554 bool slipMP = false;
555 meanMP1 /= numEpo;
556 meanMP2 /= numEpo;
557 double MP1 = 0.0;
558 double MP2 = 0.0;
559 for (int ii = 0; ii < numEpo; ii++) {
560 int iEpo = chunkStart + ii;
561 const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
562 double diff1 = oneObs->_MP1 - meanMP1;
563 double diff2 = oneObs->_MP2 - meanMP2;
564
565 // Check Slip Threshold
566 // --------------------
567 if (fabs(diff1) > SLIPTRESH || fabs(diff2) > SLIPTRESH) {
568 slipMP = true;
569 break;
570 }
571
572 MP1 += diff1 * diff1;
573 MP2 += diff2 * diff2;
574 }
575 if (slipMP) {
576 slipL1 = true;
577 slipL2 = true;
578 if (!slipFound) {
579 slipFound = true;
580 _obsStat._prnStat[prn]._numSlipsFound += 1;
581 }
582 }
583 else {
584 MP1 = sqrt(MP1 / (numEpo-1));
585 MP2 = sqrt(MP2 / (numEpo-1));
586 (*dataMP1) << (new t_polarPoint(aziDeg, zenDeg, MP1));
587 (*dataMP2) << (new t_polarPoint(aziDeg, zenDeg, MP2));
588 }
589 }
590
591 // Availability Plot Data
592 // ----------------------
593 if (availL1) {
594 if (slipL1) {
595 _availDataMap[prn]._L1slip << mjdX24;
596 }
597 else if (gapL1) {
598 _availDataMap[prn]._L1gap << mjdX24;
599 }
600 else {
601 _availDataMap[prn]._L1ok << mjdX24;
602 }
603 }
604 if (availL2) {
605 if (slipL2) {
606 _availDataMap[prn]._L2slip << mjdX24;
607 }
608 else if (gapL2) {
609 _availDataMap[prn]._L2gap << mjdX24;
610 }
611 else {
612 _availDataMap[prn]._L2ok << mjdX24;
613 }
614 }
615 if (zenFlag) {
616 _availDataMap[prn]._eleTim << mjdX24;
617 _availDataMap[prn]._eleDeg << 90.0 - zenDeg;
618 }
619
620 // Signal-to-Noise Ration Plot Data
621 // --------------------------------
622 (*dataSNR1) << (new t_polarPoint(aziDeg, zenDeg, minSNR1));
623 (*dataSNR2) << (new t_polarPoint(aziDeg, zenDeg, minSNR2));
624 }
625}
626
627//
628////////////////////////////////////////////////////////////////////////////
629void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName,
630 const QByteArray& title) {
631
632 _mutex.unlock();
633 QMutexLocker locker(&_mutex);
634
635 if (dynamic_cast<bncApp*>(qApp)->GUIenabled()) {
636
637 t_availPlot* plotA = new t_availPlot(0, &_availDataMap);
638 plotA->setTitle(title);
639
640 t_elePlot* plotZ = new t_elePlot(0, &_availDataMap);
641
642 t_dopPlot* plotD = new t_dopPlot(0, &_obsStat);
643
644 QVector<QWidget*> plots;
645 plots << plotA << plotZ << plotD;
646 t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
647
648 int ww = QFontMetrics(graphWin->font()).width('w');
649 graphWin->setMinimumSize(120*ww, 40*ww);
650
651 graphWin->show();
652
653 bncSettings settings;
654 QString dirName = settings.value("reqcPlotDir").toString();
655 if (!dirName.isEmpty()) {
656 QByteArray ext = "_A.png";
657 graphWin->savePNG(dirName, ext);
658 }
659 }
660}
661
662// Compute Dilution of Precision
663////////////////////////////////////////////////////////////////////////////
664double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
665
666 if (xyzSta.size() != 3) {
667 return 0.0;
668 }
669
670 unsigned nSat = _currEpo->rnxSat.size();
671
672 if (nSat < 4) {
673 return 0.0;
674 }
675
676 Matrix AA(nSat, 4);
677
678 unsigned nSatUsed = 0;
679 for (unsigned iSat = 0; iSat < nSat; iSat++) {
680
681 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iSat];
682
683 QString prn = QString("%1%2").arg(rnxSat.satSys)
684 .arg(rnxSat.satNum, 2, 10, QChar('0'));
685
686 t_eph* eph = 0;
687 for (int ie = 0; ie < _ephs.size(); ie++) {
688 if (_ephs[ie]->prn() == prn) {
689 eph = _ephs[ie];
690 break;
691 }
692 }
693 if (eph) {
694 ++nSatUsed;
695 ColumnVector xSat(3);
696 double clkSat;
697 eph->position(_currEpo->tt.gpsw(), _currEpo->tt.gpssec(),
698 xSat(1), xSat(2), xSat(3), clkSat);
699 ColumnVector dx = xSat - xyzSta;
700 double rho = dx.norm_Frobenius();
701 AA(nSatUsed,1) = dx(1) / rho;
702 AA(nSatUsed,2) = dx(2) / rho;
703 AA(nSatUsed,3) = dx(3) / rho;
704 AA(nSatUsed,4) = 1.0;
705 }
706 }
707
708 if (nSatUsed < 4) {
709 return 0.0;
710 }
711
712 AA = AA.Rows(1, nSatUsed);
713
714 SymmetricMatrix QQ;
715 QQ << AA.t() * AA;
716 QQ = QQ.i();
717
718 return sqrt(QQ.trace());
719}
720
721// Finish the report
722////////////////////////////////////////////////////////////////////////////
723void t_reqcAnalyze::printReport(QVector<t_polarPoint*>* dataMP1,
724 QVector<t_polarPoint*>* dataMP2,
725 QVector<t_polarPoint*>* dataSNR1,
726 QVector<t_polarPoint*>* dataSNR2) {
727 if (!_log) {
728 return;
729 }
730
731 *_log << "Marker name: " << _obsStat._markerName << endl
732 << "Receiver: " << _obsStat._receiverType << endl
733 << "Antenna: " << _obsStat._antennaName << endl
734 << "Start time: " << _obsStat._startTime.datestr().c_str() << ' '
735 << _obsStat._startTime.timestr().c_str() << endl
736 << "End time: " << _obsStat._endTime.datestr().c_str() << ' '
737 << _obsStat._endTime.timestr().c_str() << endl
738 << "Interval: " << _obsStat._interval << endl
739 << "# Sat.: " << _obsStat._prnStat.size() << endl;
740
741 int numObs = 0;
742 int numSlipsFlagged = 0;
743 int numSlipsFound = 0;
744 QMapIterator<QString, t_prnStat> it(_obsStat._prnStat);
745 while (it.hasNext()) {
746 it.next();
747 const t_prnStat& prnStat = it.value();
748 numObs += prnStat._numObs;
749 numSlipsFlagged += prnStat._numSlipsFlagged;
750 numSlipsFound += prnStat._numSlipsFound;
751 }
752 *_log << "# Obs.: " << numObs << endl
753 << "# Slips (file): " << numSlipsFlagged << endl
754 << "# Slips (found): " << numSlipsFound << endl;
755
756 for (int kk = 1; kk <= 4; kk++) {
757 QVector<t_polarPoint*>* data = 0;
758 QString text;
759 if (kk == 1) {
760 data = dataMP1;
761 text = "Mean MP1: ";
762 }
763 else if (kk == 2) {
764 data = dataMP2;
765 text = "Mean MP2: ";
766 }
767 else if (kk == 3) {
768 data = dataSNR1;
769 text = "Mean SNR1: ";
770 }
771 else if (kk == 4) {
772 data = dataSNR2;
773 text = "Mean SNR2: ";
774 }
775 double mean = 0.0;
776 for (int ii = 0; ii < data->size(); ii++) {
777 const t_polarPoint* point = data->at(ii);
778 mean += point->_value;
779 }
780 mean /= data->size();
781 *_log << text << mean << endl;
782 }
783
784 _log->flush();
785}
Note: See TracBrowser for help on using the repository browser.