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

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