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

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