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

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