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

Last change on this file since 6293 was 6293, checked in by mervart, 9 years ago
File size: 24.6 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 "bnccore.h"
47#include "bncsettings.h"
48#include "reqcedit.h"
49#include "bncutils.h"
50#include "graphwin.h"
51#include "polarplot.h"
52#include "availplot.h"
53#include "eleplot.h"
54#include "dopplot.h"
55
56using namespace std;
57
58// Constructor
59////////////////////////////////////////////////////////////////////////////
60t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
61
62 bncSettings settings;
63
64 _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
65 _logFile = 0;
66 _log = 0;
67 _currEpo = 0;
68 _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
69 _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
70
71 connect(this, SIGNAL(dspSkyPlot(const QString&, const QByteArray&, QVector<t_polarPoint*>*,
72 const QByteArray&, QVector<t_polarPoint*>*,
73 const QByteArray&, double)),
74 this, SLOT(slotDspSkyPlot(const QString&, const QByteArray&, QVector<t_polarPoint*>*,
75 const QByteArray&, QVector<t_polarPoint*>*,
76 const QByteArray&, double)));
77
78 connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
79 this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
80}
81
82// Destructor
83////////////////////////////////////////////////////////////////////////////
84t_reqcAnalyze::~t_reqcAnalyze() {
85 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
86 delete _rnxObsFiles[ii];
87 }
88 for (int ii = 0; ii < _ephs.size(); ii++) {
89 delete _ephs[ii];
90 }
91 delete _log; _log = 0;
92 delete _logFile; _logFile = 0;
93 if (BNC_CORE->mode() != t_bncCore::interactive) {
94 qApp->exit(0);
95 }
96}
97
98//
99////////////////////////////////////////////////////////////////////////////
100void t_reqcAnalyze::run() {
101
102 // Open Log File
103 // -------------
104 _logFile = new QFile(_logFileName);
105 if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
106 _log = new QTextStream();
107 _log->setDevice(_logFile);
108 }
109
110 // Initialize RINEX Observation Files
111 // ----------------------------------
112 t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
113
114 // Read Ephemerides
115 // ----------------
116 t_reqcEdit::readEphemerides(_navFileNames, _ephs);
117
118 // Loop over all RINEX Files
119 // -------------------------
120 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
121 analyzeFile(_rnxObsFiles[ii]);
122 }
123
124 // Exit
125 // ----
126 emit finished();
127 deleteLater();
128}
129
130//
131////////////////////////////////////////////////////////////////////////////
132void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
133
134 _qcFile.clear();
135
136 // A priori Coordinates
137 // --------------------
138 ColumnVector xyzSta = obsFile->xyz();
139
140 // Loop over all Epochs
141 // --------------------
142 try {
143 bool firstEpo = true;
144 while ( (_currEpo = obsFile->nextEpoch()) != 0) {
145 if (firstEpo) {
146 firstEpo = false;
147 _qcFile._startTime = _currEpo->tt;
148 _qcFile._antennaName = obsFile->antennaName();
149 _qcFile._markerName = obsFile->markerName();
150 _qcFile._receiverType = obsFile->receiverType();
151 _qcFile._interval = obsFile->interval();
152 }
153 _qcFile._endTime = _currEpo->tt;
154
155 t_qcEpo qcEpo;
156 qcEpo._epoTime = _currEpo->tt;
157 qcEpo._PDOP = cmpDOP(xyzSta);
158
159 // Loop over all satellites
160 // ------------------------
161 for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
162 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
163 t_satObs satObs;
164 t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, satObs);
165 t_qcSat& qcSat = qcEpo._qcSat[satObs._prn];
166 setQcObs(qcEpo._epoTime, xyzSta, satObs, qcSat);
167 updateQcSat(qcSat, _qcFile._qcSatSum[satObs._prn]);
168 }
169 _qcFile._qcEpo.push_back(qcEpo);
170 }
171
172 analyzeMultipath();
173
174 preparePlotData(obsFile);
175
176 printReport(obsFile);
177 }
178 catch (QString str) {
179 if (_log) {
180 *_log << "Exception " << str << endl;
181 }
182 else {
183 qDebug() << str;
184 }
185 }
186}
187
188// Compute Dilution of Precision
189////////////////////////////////////////////////////////////////////////////
190double t_reqcAnalyze::cmpDOP(const ColumnVector& xyzSta) const {
191
192 if (xyzSta.size() != 3) {
193 return 0.0;
194 }
195
196 unsigned nSat = _currEpo->rnxSat.size();
197
198 if (nSat < 4) {
199 return 0.0;
200 }
201
202 Matrix AA(nSat, 4);
203
204 unsigned nSatUsed = 0;
205 for (unsigned iSat = 0; iSat < nSat; iSat++) {
206
207 const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iSat];
208 const t_prn& prn = rnxSat.prn;
209
210 t_eph* eph = 0;
211 for (int ie = 0; ie < _ephs.size(); ie++) {
212 if (_ephs[ie]->prn() == prn) {
213 eph = _ephs[ie];
214 break;
215 }
216 }
217 if (eph) {
218 ColumnVector xSat(4);
219 ColumnVector vv(3);
220 if (eph->getCrd(_currEpo->tt, xSat, vv, false) == success) {
221 ++nSatUsed;
222 ColumnVector dx = xSat.Rows(1,3) - xyzSta;
223 double rho = dx.norm_Frobenius();
224 AA(nSatUsed,1) = dx(1) / rho;
225 AA(nSatUsed,2) = dx(2) / rho;
226 AA(nSatUsed,3) = dx(3) / rho;
227 AA(nSatUsed,4) = 1.0;
228 }
229 }
230 }
231
232 if (nSatUsed < 4) {
233 return 0.0;
234 }
235
236 AA = AA.Rows(1, nSatUsed);
237
238 SymmetricMatrix QQ;
239 QQ << AA.t() * AA;
240 QQ = QQ.i();
241
242 return sqrt(QQ.trace());
243}
244
245//
246////////////////////////////////////////////////////////////////////////////
247void t_reqcAnalyze::updateQcSat(const t_qcSat& qcSat, t_qcSatSum& qcSatSum) {
248
249 for (int ii = 0; ii < qcSat._qcFrq.size(); ii++) {
250 const t_qcFrq& qcFrq = qcSat._qcFrq[ii];
251 t_qcFrqSum& qcFrqSum = qcSatSum._qcFrqSum[qcFrq._rnxType2ch];
252 qcFrqSum._numObs += 1;
253 if (qcFrq._slip) {
254 qcFrqSum._numSlipsFlagged += 1;
255 }
256 if (qcFrq._gap) {
257 qcFrqSum._numGaps += 1;
258 }
259 }
260}
261
262//
263////////////////////////////////////////////////////////////////////////////
264void t_reqcAnalyze::setQcObs(const bncTime& epoTime, const ColumnVector& xyzSta,
265 const t_satObs& satObs, t_qcSat& qcSat) {
266
267 t_eph* eph = 0;
268 for (int ie = 0; ie < _ephs.size(); ie++) {
269 if (_ephs[ie]->prn() == satObs._prn) {
270 eph = _ephs[ie];
271 break;
272 }
273 }
274 if (eph) {
275 ColumnVector xc(4);
276 ColumnVector vv(3);
277 if (xyzSta.size() && eph->getCrd(epoTime, xc, vv, false) == success) {
278 double rho, eleSat, azSat;
279 topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
280 qcSat._eleSet = true;
281 qcSat._azDeg = azSat * 180.0/M_PI;
282 qcSat._eleDeg = eleSat * 180.0/M_PI;
283 }
284 if (satObs._prn.system() == 'R') {
285 qcSat._slotSet = true;
286 qcSat._slotNum = eph->slotNum();
287 }
288 }
289
290 // Availability and Slip Flags
291 // ---------------------------
292 for (unsigned ii = 0; ii < satObs._obs.size(); ii++) {
293
294 const t_frqObs* frqObs = satObs._obs[ii];
295
296 qcSat._qcFrq.push_back(t_qcFrq());
297 t_qcFrq& qcFrq = qcSat._qcFrq.back();
298
299 qcFrq._rnxType2ch = QString(frqObs->_rnxType2ch.c_str());
300 qcFrq._SNR = frqObs->_snr;
301 qcFrq._slip = frqObs->_slip;
302 qcFrq._phaseValid = frqObs->_phaseValid;
303 qcFrq._codeValid = frqObs->_codeValid;
304
305 // Check Gaps
306 // ----------
307 if (qcFrq._lastObsTime.valid()) {
308 double dt = epoTime - qcFrq._lastObsTime;
309 if (dt > 1.5 * _qcFile._interval) {
310 qcFrq._gap = true;
311 }
312 }
313 qcFrq._lastObsTime = epoTime;
314
315 // Compute the Multipath Linear Combination
316 // ----------------------------------------
317 if (frqObs->_codeValid) {
318 t_frequency::type fA;
319 t_frequency::type fB;
320 if (satObs._prn.system() == 'G') {
321 if (frqObs->_rnxType2ch[0] == '1') {
322 fA = t_frequency::G1;
323 fB = t_frequency::G2;
324 }
325 else if (frqObs->_rnxType2ch[0] == '2') {
326 fA = t_frequency::G2;
327 fB = t_frequency::G1;
328 }
329 }
330 else if (satObs._prn.system() == 'R') {
331 if (frqObs->_rnxType2ch[0] == '1') {
332 fA = t_frequency::R1;
333 fB = t_frequency::R2;
334 }
335 else if (frqObs->_rnxType2ch[0] == '2') {
336 fA = t_frequency::R2;
337 fB = t_frequency::R1;
338 }
339 }
340 else if (satObs._prn.system() == 'E') {
341 if (frqObs->_rnxType2ch[0] == '1') {
342 fA = t_frequency::E1;
343 fB = t_frequency::E5;
344 }
345 else if (frqObs->_rnxType2ch[0] == '5') {
346 fA = t_frequency::E5;
347 fB = t_frequency::E1;
348 }
349 }
350
351 if (fA != t_frequency::dummy && fB != t_frequency::dummy) {
352 double f_a = t_CST::freq(fA, qcSat._slotNum);
353 double f_b = t_CST::freq(fB, qcSat._slotNum);
354 double C_a = frqObs->_code;
355
356 bool foundA = false;
357 double L_a = 0.0;
358 bool foundB = false;
359 double L_b = 0.0;
360 for (unsigned jj = 0; jj < satObs._obs.size(); jj++) {
361 const t_frqObs* frqObsHlp = satObs._obs[jj];
362 if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fA)[1] &&
363 frqObsHlp->_phaseValid) {
364 foundA = true;
365 L_a = frqObsHlp->_phase * t_CST::c / f_a;
366 }
367 else if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fB)[1] &&
368 frqObsHlp->_phaseValid) {
369 foundB = true;
370 L_b = frqObsHlp->_phase * t_CST::c / f_b;
371 }
372 }
373 if (foundA && foundB) {
374 qcFrq._setMP = true;
375 qcFrq._rawMP = C_a - L_a - 2.0*f_b*f_b/(f_a*f_a-f_b*f_b) * (L_a - L_b);
376 }
377 }
378 }
379 } // satObs loop
380}
381
382//
383////////////////////////////////////////////////////////////////////////////
384void t_reqcAnalyze::analyzeMultipath() {
385
386 const double SLIPTRESH = 10.0; // cycle-slip threshold (meters)
387 const double chunkStep = 600.0; // 10 minutes
388
389 // Loop over all satellites available
390 // ----------------------------------
391 QMutableMapIterator<t_prn, t_qcSatSum> itSat(_qcFile._qcSatSum);
392 while (itSat.hasNext()) {
393 itSat.next();
394 const t_prn& prn = itSat.key();
395 t_qcSatSum& qcSatSum = itSat.value();
396
397 // Loop over all frequencies available
398 // -----------------------------------
399 QMutableMapIterator<QString, t_qcFrqSum> itFrq(qcSatSum._qcFrqSum);
400 while (itFrq.hasNext()) {
401 itFrq.next();
402 const QString& frqType = itFrq.key();
403 t_qcFrqSum& qcFrqSum = itFrq.value();
404
405
406 // Loop over all Chunks of Data
407 // ----------------------------
408 for (bncTime chunkStart = _qcFile._startTime;
409 chunkStart < _qcFile._endTime; chunkStart += chunkStep) {
410
411 bncTime chunkEnd = chunkStart + chunkStep;
412
413 QVector<t_qcFrq*> frqVec;
414 QVector<double> MP;
415
416 // Loop over all Epochs within one Chunk of Data
417 // ---------------------------------------------
418 for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
419 t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
420 if (chunkStart <= qcEpo._epoTime && qcEpo._epoTime < chunkEnd) {
421 if (qcEpo._qcSat.contains(prn)) {
422 t_qcSat& qcSat = qcEpo._qcSat[prn];
423 for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
424 t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
425 if (qcFrq._rnxType2ch == frqType) {
426 frqVec << &qcFrq;
427 if (qcFrq._setMP) {
428 MP << qcFrq._rawMP;
429 }
430 }
431 }
432 }
433 }
434 }
435
436 // Compute the multipath mean and standard deviation
437 // -------------------------------------------------
438 if (MP.size() > 1) {
439 double meanMP = 0.0;
440 for (int ii = 0; ii < MP.size(); ii++) {
441 meanMP += MP[ii];
442 }
443 meanMP /= MP.size();
444
445 bool slipMP = false;
446
447 double stdMP = 0.0;
448 for (int ii = 0; ii < MP.size(); ii++) {
449 double diff = MP[ii] - meanMP;
450 if (fabs(diff) > SLIPTRESH) {
451 slipMP = true;
452 break;
453 }
454 stdMP += diff * diff;
455 }
456
457 if (slipMP) {
458 stdMP = 0.0;
459 stdMP = 0.0;
460 qcFrqSum._numSlipsFound += 1;
461 }
462 else {
463 stdMP = sqrt(stdMP / (MP.size()-1));
464 }
465
466 for (int ii = 0; ii < frqVec.size(); ii++) {
467 t_qcFrq* qcFrq = frqVec[ii];
468 if (slipMP) {
469 qcFrq->_slip = true;
470 }
471 else {
472 qcFrq->_stdMP = stdMP;
473 }
474 }
475 }
476 } // chunk loop
477 } // frq loop
478 } // sat loop
479}
480
481//
482////////////////////////////////////////////////////////////////////////////
483void t_reqcAnalyze::preparePlotData(const t_rnxObsFile* obsFile) {
484
485 QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
486 QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
487 QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
488 QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
489
490 bncSettings settings;
491 QString reqSkyPlotSystems = settings.value("reqcSkyPlotSystems").toString();
492 bool plotGPS = false;
493 bool plotGlo = false;
494 bool plotGal = false;
495 if (reqSkyPlotSystems == "GPS") {
496 plotGPS = true;
497 }
498 else if (reqSkyPlotSystems == "GLONASS") {
499 plotGlo = true;
500 }
501 else if (reqSkyPlotSystems == "Galileo") {
502 plotGal = true;
503 }
504 else {
505 plotGPS = true;
506 plotGlo = true;
507 plotGal = true;
508 }
509
510 // Loop over all observations
511 // --------------------------
512 for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
513 t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
514 QMapIterator<t_prn, t_qcSat> it(qcEpo._qcSat);
515 while (it.hasNext()) {
516 it.next();
517 const t_prn& prn = it.key();
518 const t_qcSat& qcSat = it.value();
519 if ( (prn.system() == 'G' && plotGPS) ||
520 (prn.system() == 'R' && plotGlo) ||
521 (prn.system() == 'E' && plotGal) ) {
522
523 if (qcSat._eleSet) {
524 QString frqType1;
525 QString frqType2;
526 for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
527 const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
528 if (qcFrq._rnxType2ch[0] == '1' && frqType1.isEmpty()) {
529 frqType1 = qcFrq._rnxType2ch;
530 }
531 if (qcFrq._rnxType2ch[0] == '2' && frqType2.isEmpty()) {
532 frqType2 = qcFrq._rnxType2ch;
533 }
534 if (qcFrq._rnxType2ch == frqType1) {
535 (*dataSNR1) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._SNR));
536 (*dataMP1) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._stdMP));
537 }
538 else if (qcFrq._rnxType2ch == frqType2) {
539 (*dataSNR2) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._SNR));
540 (*dataMP2) << (new t_polarPoint(qcSat._azDeg, 90.0 - qcSat._eleDeg, qcFrq._stdMP));
541 }
542 }
543 }
544 }
545 }
546 }
547
548 // Show the plots
549 // --------------
550 if (BNC_CORE->GUIenabled()) {
551 QFileInfo fileInfo(obsFile->fileName());
552 QByteArray title = fileInfo.fileName().toAscii();
553 emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2, "Meters", 2.0);
554 emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2, "dbHz", 54.0);
555 emit dspAvailPlot(obsFile->fileName(), title);
556 }
557 else {
558 for (int ii = 0; ii < dataMP1->size(); ii++) {
559 delete dataMP1->at(ii);
560 }
561 delete dataMP1;
562 for (int ii = 0; ii < dataMP2->size(); ii++) {
563 delete dataMP2->at(ii);
564 }
565 delete dataMP2;
566 for (int ii = 0; ii < dataSNR1->size(); ii++) {
567 delete dataSNR1->at(ii);
568 }
569 delete dataSNR1;
570 for (int ii = 0; ii < dataSNR2->size(); ii++) {
571 delete dataSNR2->at(ii);
572 }
573 delete dataSNR2;
574 }
575}
576
577//
578////////////////////////////////////////////////////////////////////////////
579void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName, const QByteArray& title1,
580 QVector<t_polarPoint*>* data1, const QByteArray& title2,
581 QVector<t_polarPoint*>* data2, const QByteArray& scaleTitle,
582 double maxValue) {
583
584 if (BNC_CORE->GUIenabled()) {
585
586 if (maxValue == 0.0) {
587 if (data1) {
588 for (int ii = 0; ii < data1->size(); ii++) {
589 double val = data1->at(ii)->_value;
590 if (maxValue < val) {
591 maxValue = val;
592 }
593 }
594 }
595 if (data2) {
596 for (int ii = 0; ii < data2->size(); ii++) {
597 double val = data2->at(ii)->_value;
598 if (maxValue < val) {
599 maxValue = val;
600 }
601 }
602 }
603 }
604
605 QwtInterval scaleInterval(0.0, maxValue);
606
607 QVector<QWidget*> plots;
608 if (data1) {
609 t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
610 BNC_CORE->mainWindow());
611 plot1->addCurve(data1);
612 plots << plot1;
613 }
614 if (data2) {
615 t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
616 BNC_CORE->mainWindow());
617 plot2->addCurve(data2);
618 plots << plot2;
619 }
620
621 t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
622 &scaleTitle, &scaleInterval);
623
624 graphWin->show();
625
626 bncSettings settings;
627 QString dirName = settings.value("reqcPlotDir").toString();
628 if (!dirName.isEmpty()) {
629 QByteArray ext = (scaleTitle == "Meters") ? "_M.png" : "_S.png";
630 graphWin->savePNG(dirName, ext);
631 }
632 }
633}
634
635//
636////////////////////////////////////////////////////////////////////////////
637void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName, const QByteArray& title) {
638
639 t_plotData plotData;
640 QMap<t_prn, t_plotData> plotDataMap;
641
642 for (int ii = 0; ii < _qcFile._qcEpo.size(); ii++) {
643 const t_qcEpo& qcEpo = _qcFile._qcEpo[ii];
644 double mjdX24 = qcEpo._epoTime.mjddec() * 24.0;
645
646 plotData._mjdX24 << mjdX24;
647 plotData._PDOP << qcEpo._PDOP;
648 plotData._numSat << qcEpo._qcSat.size();
649
650 QMapIterator<t_prn, t_qcSat> it(qcEpo._qcSat);
651 while (it.hasNext()) {
652 it.next();
653 const t_prn& prn = it.key();
654 const t_qcSat& qcSat = it.value();
655 t_plotData& data = plotDataMap[prn];
656
657 data._mjdX24 << mjdX24;
658 data._eleDeg << qcSat._eleDeg;
659
660 QString frqType1;
661 QString frqType2;
662 for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
663 const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
664 if (qcFrq._rnxType2ch[0] == '1' && frqType1.isEmpty()) {
665 frqType1 = qcFrq._rnxType2ch;
666 }
667 if (qcFrq._rnxType2ch[0] == '2' && frqType2.isEmpty()) {
668 frqType2 = qcFrq._rnxType2ch;
669 }
670 if (qcFrq._rnxType2ch == frqType1) {
671 if (qcFrq._slip) {
672 data._L1slip << mjdX24;
673 }
674 else if (qcFrq._gap) {
675 data._L1gap << mjdX24;
676 }
677 else {
678 data._L1ok << mjdX24;
679 }
680 }
681 else if (qcFrq._rnxType2ch == frqType2) {
682 if (qcFrq._slip) {
683 data._L2slip << mjdX24;
684 }
685 else if (qcFrq._gap) {
686 data._L2gap << mjdX24;
687 }
688 else {
689 data._L2ok << mjdX24;
690 }
691 }
692 }
693 }
694 }
695
696 if (BNC_CORE->GUIenabled()) {
697 t_availPlot* plotA = new t_availPlot(0, plotDataMap);
698 plotA->setTitle(title);
699
700 t_elePlot* plotZ = new t_elePlot(0, plotDataMap);
701
702 t_dopPlot* plotD = new t_dopPlot(0, plotData);
703
704 QVector<QWidget*> plots;
705 plots << plotA << plotZ << plotD;
706 t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
707
708 int ww = QFontMetrics(graphWin->font()).width('w');
709 graphWin->setMinimumSize(120*ww, 40*ww);
710
711 graphWin->show();
712
713 bncSettings settings;
714 QString dirName = settings.value("reqcPlotDir").toString();
715 if (!dirName.isEmpty()) {
716 QByteArray ext = "_A.png";
717 graphWin->savePNG(dirName, ext);
718 }
719 }
720}
721
722// Finish the report
723////////////////////////////////////////////////////////////////////////////
724void t_reqcAnalyze::printReport(const t_rnxObsFile* obsFile) {
725
726 if (!_log) {
727 return;
728 }
729
730 *_log << "File: " << obsFile->fileName().toAscii().data() << endl
731 << "Marker name: " << _qcFile._markerName << endl
732 << "Receiver: " << _qcFile._receiverType << endl
733 << "Antenna: " << _qcFile._antennaName << endl
734 << "Start time: " << _qcFile._startTime.datestr().c_str() << ' '
735 << _qcFile._startTime.timestr().c_str() << endl
736 << "End time: " << _qcFile._endTime.datestr().c_str() << ' '
737 << _qcFile._endTime.timestr().c_str() << endl
738 << "Interval: " << _qcFile._interval << endl
739 << "# Sat.: " << _qcFile._qcSatSum.size() << endl;
740
741 int numObs = 0;
742 int numSlipsFlagged = 0;
743 int numSlipsFound = 0;
744 QMapIterator<t_prn, t_qcSatSum> itSat(_qcFile._qcSatSum);
745 while (itSat.hasNext()) {
746 itSat.next();
747 const t_qcSatSum& qcSatSum = itSat.value();
748
749 QMapIterator<QString, t_qcFrqSum> itFrq(qcSatSum._qcFrqSum);
750 while (itFrq.hasNext()) {
751 itFrq.next();
752 const t_qcFrqSum& qcFrqSum = itFrq.value();
753 numObs += qcFrqSum._numObs;
754 numSlipsFlagged += qcFrqSum._numSlipsFlagged;
755 numSlipsFound += qcFrqSum._numSlipsFound;
756 }
757 }
758 *_log << "# Obs.: " << numObs << endl
759 << "# Slips (file): " << numSlipsFlagged << endl
760 << "# Slips (found): " << numSlipsFound << endl;
761
762 for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
763 const t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
764
765 unsigned year, month, day, hour, min;
766 double sec;
767 qcEpo._epoTime.civil_date(year, month, day);
768 qcEpo._epoTime.civil_time(hour, min, sec);
769
770 QString dateStr;
771 QTextStream(&dateStr) << QString("> %1 %2 %3 %4 %5%6")
772 .arg(year, 4)
773 .arg(month, 2, 10, QChar('0'))
774 .arg(day, 2, 10, QChar('0'))
775 .arg(hour, 2, 10, QChar('0'))
776 .arg(min, 2, 10, QChar('0'))
777 .arg(sec, 11, 'f', 7);
778
779 *_log << dateStr << QString(" %1").arg(qcEpo._qcSat.size(), 2)
780 << QString(" %1").arg(qcEpo._PDOP, 4, 'f', 1)
781 << endl;
782
783 QMapIterator<t_prn, t_qcSat> itSat(qcEpo._qcSat);
784 while (itSat.hasNext()) {
785 itSat.next();
786 const t_prn& prn = itSat.key();
787 const t_qcSat& qcSat = itSat.value();
788
789 *_log << prn.toString().c_str()
790 << QString(" %1 %2").arg(qcSat._eleDeg, 6, 'f', 2).arg(qcSat._azDeg, 7, 'f', 2)
791 << QString(" %1").arg(qcSat._qcFrq.size());
792 for (int iFrq = 0; iFrq < qcSat._qcFrq.size(); iFrq++) {
793 const t_qcFrq& qcFrq = qcSat._qcFrq[iFrq];
794 *_log << " " << qcFrq._rnxType2ch << ' ';
795 if (qcFrq._slip) {
796 *_log << 'S';
797 }
798 else {
799 *_log << '.';
800 }
801 if (qcFrq._slip) {
802 *_log << 'G';
803 }
804 else {
805 *_log << '.';
806 }
807 *_log << QString(" %1").arg(qcFrq._SNR, 4, 'f', 1)
808 << QString(" %1").arg(qcFrq._stdMP, 2, 'f', 1);
809 }
810 *_log << endl;
811 }
812 }
813 _log->flush();
814}
Note: See TracBrowser for help on using the repository browser.