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 |
|
---|
56 | using namespace std;
|
---|
57 |
|
---|
58 | const double SLIPTRESH = 5.0; // cycle-slip threshold (meters)
|
---|
59 |
|
---|
60 | // Constructor
|
---|
61 | ////////////////////////////////////////////////////////////////////////////
|
---|
62 | t_reqcAnalyze::t_reqcAnalyze(QObject* parent) : QThread(parent) {
|
---|
63 |
|
---|
64 | bncSettings settings;
|
---|
65 |
|
---|
66 | _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
|
---|
67 | _logFile = 0;
|
---|
68 | _log = 0;
|
---|
69 | _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
|
---|
70 | _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
|
---|
71 |
|
---|
72 | _currEpo = 0;
|
---|
73 |
|
---|
74 | connect(this, SIGNAL(dspSkyPlot(const QString&,
|
---|
75 | const QByteArray&,
|
---|
76 | QVector<t_polarPoint*>*,
|
---|
77 | const QByteArray&,
|
---|
78 | QVector<t_polarPoint*>*,
|
---|
79 | const QByteArray&, double)),
|
---|
80 | this, SLOT(slotDspSkyPlot(const QString&,
|
---|
81 | const QByteArray&,
|
---|
82 | QVector<t_polarPoint*>*,
|
---|
83 | const QByteArray&,
|
---|
84 | QVector<t_polarPoint*>*,
|
---|
85 | const QByteArray&, double)));
|
---|
86 |
|
---|
87 | connect(this, SIGNAL(dspAvailPlot(const QString&, const QByteArray&)),
|
---|
88 | this, SLOT(slotDspAvailPlot(const QString&, const QByteArray&)));
|
---|
89 | }
|
---|
90 |
|
---|
91 | // Destructor
|
---|
92 | ////////////////////////////////////////////////////////////////////////////
|
---|
93 | t_reqcAnalyze::~t_reqcAnalyze() {
|
---|
94 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
---|
95 | delete _rnxObsFiles[ii];
|
---|
96 | }
|
---|
97 | for (int ii = 0; ii < _ephs.size(); ii++) {
|
---|
98 | delete _ephs[ii];
|
---|
99 | }
|
---|
100 | delete _log; _log = 0;
|
---|
101 | delete _logFile; _logFile = 0;
|
---|
102 | bncApp* app = (bncApp*) qApp;
|
---|
103 | if ( app->mode() != bncApp::interactive) {
|
---|
104 | app->exit(0);
|
---|
105 | }
|
---|
106 | }
|
---|
107 |
|
---|
108 | //
|
---|
109 | ////////////////////////////////////////////////////////////////////////////
|
---|
110 | void t_reqcAnalyze::slotDspSkyPlot(const QString& fileName,
|
---|
111 | const QByteArray& title1,
|
---|
112 | QVector<t_polarPoint*>* data1,
|
---|
113 | const QByteArray& title2,
|
---|
114 | QVector<t_polarPoint*>* data2,
|
---|
115 | const QByteArray& scaleTitle,
|
---|
116 | double maxValue) {
|
---|
117 |
|
---|
118 | bncApp* app = dynamic_cast<bncApp*>(qApp);
|
---|
119 | if (app->GUIenabled()) {
|
---|
120 |
|
---|
121 | if (maxValue == 0.0) {
|
---|
122 | if (data1) {
|
---|
123 | for (int ii = 0; ii < data1->size(); ii++) {
|
---|
124 | double val = data1->at(ii)->_value;
|
---|
125 | if (maxValue < val) {
|
---|
126 | maxValue = val;
|
---|
127 | }
|
---|
128 | }
|
---|
129 | }
|
---|
130 | if (data2) {
|
---|
131 | for (int ii = 0; ii < data2->size(); ii++) {
|
---|
132 | double val = data2->at(ii)->_value;
|
---|
133 | if (maxValue < val) {
|
---|
134 | maxValue = val;
|
---|
135 | }
|
---|
136 | }
|
---|
137 | }
|
---|
138 | }
|
---|
139 |
|
---|
140 | QwtInterval scaleInterval(0.0, maxValue);
|
---|
141 |
|
---|
142 | QVector<QWidget*> plots;
|
---|
143 | if (data1) {
|
---|
144 | t_polarPlot* plot1 = new t_polarPlot(QwtText(title1), scaleInterval,
|
---|
145 | app->mainWindow());
|
---|
146 | plot1->addCurve(data1);
|
---|
147 | plots << plot1;
|
---|
148 | }
|
---|
149 | if (data2) {
|
---|
150 | t_polarPlot* plot2 = new t_polarPlot(QwtText(title2), scaleInterval,
|
---|
151 | app->mainWindow());
|
---|
152 | plot2->addCurve(data2);
|
---|
153 | plots << plot2;
|
---|
154 | }
|
---|
155 |
|
---|
156 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots,
|
---|
157 | &scaleTitle, &scaleInterval);
|
---|
158 |
|
---|
159 | graphWin->show();
|
---|
160 |
|
---|
161 | bncSettings settings;
|
---|
162 | QString dirName = settings.value("reqcPlotDir").toString();
|
---|
163 | if (!dirName.isEmpty()) {
|
---|
164 | QByteArray ext = scaleTitle.isEmpty() ? "_S.png" : "_M.png";
|
---|
165 | graphWin->savePNG(dirName, ext);
|
---|
166 | }
|
---|
167 | }
|
---|
168 | }
|
---|
169 |
|
---|
170 | //
|
---|
171 | ////////////////////////////////////////////////////////////////////////////
|
---|
172 | void t_reqcAnalyze::run() {
|
---|
173 |
|
---|
174 | // Open Log File
|
---|
175 | // -------------
|
---|
176 | _logFile = new QFile(_logFileName);
|
---|
177 | if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
---|
178 | _log = new QTextStream();
|
---|
179 | _log->setDevice(_logFile);
|
---|
180 | }
|
---|
181 |
|
---|
182 | // Initialize RINEX Observation Files
|
---|
183 | // ----------------------------------
|
---|
184 | t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
|
---|
185 |
|
---|
186 | // Read Ephemerides
|
---|
187 | // ----------------
|
---|
188 | t_reqcEdit::readEphemerides(_navFileNames, _ephs);
|
---|
189 |
|
---|
190 | // Loop over all RINEX Files
|
---|
191 | // -------------------------
|
---|
192 | for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
|
---|
193 | analyzeFile(_rnxObsFiles[ii]);
|
---|
194 | }
|
---|
195 |
|
---|
196 | // Exit
|
---|
197 | // ----
|
---|
198 | emit finished();
|
---|
199 | deleteLater();
|
---|
200 | }
|
---|
201 |
|
---|
202 | //
|
---|
203 | ////////////////////////////////////////////////////////////////////////////
|
---|
204 | void t_reqcAnalyze::analyzeFile(t_rnxObsFile* obsFile) {
|
---|
205 |
|
---|
206 | if (_log) {
|
---|
207 | *_log << "\nAnalyze File\n"
|
---|
208 | << "------------\n"
|
---|
209 | << obsFile->fileName().toAscii().data() << endl << endl;
|
---|
210 | }
|
---|
211 |
|
---|
212 | _allObsMap.clear();
|
---|
213 | _availDataMap.clear();
|
---|
214 |
|
---|
215 | // A priori Coordinates
|
---|
216 | // --------------------
|
---|
217 | ColumnVector xyz = obsFile->xyz();
|
---|
218 |
|
---|
219 | // Loop over all Epochs
|
---|
220 | // --------------------
|
---|
221 | try {
|
---|
222 | while ( (_currEpo = obsFile->nextEpoch()) != 0) {
|
---|
223 |
|
---|
224 | // Loop over all satellites
|
---|
225 | // ------------------------
|
---|
226 | for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
|
---|
227 | const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
|
---|
228 | t_obs obs;
|
---|
229 | t_postProcessing::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
|
---|
230 |
|
---|
231 | if (obs.satSys == 'R') {
|
---|
232 | // TODO: set channel number
|
---|
233 | }
|
---|
234 |
|
---|
235 | QString prn = QString("%1%2").arg(obs.satSys)
|
---|
236 | .arg(obs.satNum, 2, 10, QChar('0'));
|
---|
237 |
|
---|
238 | _allObsMap[prn].addObs(obs);
|
---|
239 | }
|
---|
240 |
|
---|
241 | } // while (_currEpo)
|
---|
242 | }
|
---|
243 | catch (QString str) {
|
---|
244 | if (_log) {
|
---|
245 | *_log << "Exception " << str << endl;
|
---|
246 | }
|
---|
247 | else {
|
---|
248 | qDebug() << str;
|
---|
249 | }
|
---|
250 | return;
|
---|
251 | }
|
---|
252 |
|
---|
253 | // Analyze the Multipath
|
---|
254 | // ---------------------
|
---|
255 | QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
|
---|
256 | QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
|
---|
257 | QVector<t_polarPoint*>* dataSNR1 = new QVector<t_polarPoint*>;
|
---|
258 | QVector<t_polarPoint*>* dataSNR2 = new QVector<t_polarPoint*>;
|
---|
259 |
|
---|
260 | QMutableMapIterator<QString, t_allObs> it(_allObsMap);
|
---|
261 | while (it.hasNext()) {
|
---|
262 | it.next();
|
---|
263 | QString prn = it.key();
|
---|
264 | preparePlotData(prn, xyz, obsFile->interval(),
|
---|
265 | dataMP1, dataMP2, dataSNR1, dataSNR2);
|
---|
266 | }
|
---|
267 |
|
---|
268 | emit dspSkyPlot(obsFile->fileName(), "MP1", dataMP1, "MP2", dataMP2,
|
---|
269 | "Meters", 2.0);
|
---|
270 |
|
---|
271 | emit dspSkyPlot(obsFile->fileName(), "SNR1", dataSNR1, "SNR2", dataSNR2,
|
---|
272 | "", 9.0);
|
---|
273 |
|
---|
274 | QFileInfo fileInfo(obsFile->fileName());
|
---|
275 | QByteArray title = fileInfo.fileName().toAscii();
|
---|
276 |
|
---|
277 | emit dspAvailPlot(obsFile->fileName(), title);
|
---|
278 |
|
---|
279 | if (_log) {
|
---|
280 | _log->flush();
|
---|
281 | }
|
---|
282 | }
|
---|
283 |
|
---|
284 | //
|
---|
285 | ////////////////////////////////////////////////////////////////////////////
|
---|
286 | void t_reqcAnalyze::t_allObs::addObs(const t_obs& obs) {
|
---|
287 |
|
---|
288 | t_oneObs* newObs = new t_oneObs(obs.GPSWeek, obs.GPSWeeks);
|
---|
289 | bool okFlag = false;
|
---|
290 |
|
---|
291 | // Availability and Slip Flags
|
---|
292 | // ---------------------------
|
---|
293 | double L1 = obs.measdata("L1", 3.0);
|
---|
294 | if (L1 != 0) {
|
---|
295 | newObs->_hasL1 = true;
|
---|
296 | }
|
---|
297 | double L2 = obs.measdata("L2", 3.0);
|
---|
298 | if (L2 != 0) {
|
---|
299 | newObs->_hasL2 = true;
|
---|
300 | }
|
---|
301 | if (obs.slipL1) {
|
---|
302 | newObs->_slipL1 = true;
|
---|
303 | }
|
---|
304 | if (obs.slipL2) {
|
---|
305 | newObs->_slipL2 = true;
|
---|
306 | }
|
---|
307 |
|
---|
308 | // Compute the Multipath
|
---|
309 | // ----------------------
|
---|
310 | if (L1 != 0.0 && L2 != 0.0) {
|
---|
311 | double f1 = t_CST::f1(obs.satSys, obs.slotNum);
|
---|
312 | double f2 = t_CST::f2(obs.satSys, obs.slotNum);
|
---|
313 |
|
---|
314 | L1 = L1 * t_CST::c / f1;
|
---|
315 | L2 = L2 * t_CST::c / f2;
|
---|
316 |
|
---|
317 | double P1 = obs.measdata("C1", 3.0);
|
---|
318 | if (P1 != 0.0) {
|
---|
319 | newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
|
---|
320 | okFlag = true;
|
---|
321 | }
|
---|
322 | double P2 = obs.measdata("C2", 3.0);
|
---|
323 | if (P2 != 0.0) {
|
---|
324 | newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
|
---|
325 | okFlag = true;
|
---|
326 | }
|
---|
327 | }
|
---|
328 |
|
---|
329 | // Signal-to-Noise
|
---|
330 | // ---------------
|
---|
331 | double S1 = obs.measdata("S1", 3.0);
|
---|
332 | if (S1 != 0.0) {
|
---|
333 | newObs->_SNR1 = floor(S1/6);
|
---|
334 | if (newObs->_SNR1 > 9.0) {
|
---|
335 | newObs->_SNR1 = 9.0;
|
---|
336 | }
|
---|
337 | if (newObs->_SNR1 < 1.0) {
|
---|
338 | newObs->_SNR1 = 1.0;
|
---|
339 | }
|
---|
340 | okFlag = true;
|
---|
341 | }
|
---|
342 | else {
|
---|
343 | if (obs.snrL1 > 0) {
|
---|
344 | newObs->_SNR1 = obs.snrL1;
|
---|
345 | okFlag = true;
|
---|
346 | }
|
---|
347 | }
|
---|
348 | double S2 = obs.measdata("S2", 3.0);
|
---|
349 | if (S2 != 0.0) {
|
---|
350 | newObs->_SNR2 = floor(S2/6);
|
---|
351 | if (newObs->_SNR2 > 9.0) {
|
---|
352 | newObs->_SNR2 = 9.0;
|
---|
353 | }
|
---|
354 | if (newObs->_SNR2 < 1.0) {
|
---|
355 | newObs->_SNR2 = 1.0;
|
---|
356 | }
|
---|
357 | okFlag = true;
|
---|
358 | }
|
---|
359 | else {
|
---|
360 | if (obs.snrL2 > 0) {
|
---|
361 | newObs->_SNR2 = obs.snrL2;
|
---|
362 | okFlag = true;
|
---|
363 | }
|
---|
364 | }
|
---|
365 |
|
---|
366 | // Remember the Observation
|
---|
367 | // ------------------------
|
---|
368 | if (okFlag) {
|
---|
369 | _oneObsVec << newObs;
|
---|
370 | }
|
---|
371 | else {
|
---|
372 | delete newObs;
|
---|
373 | }
|
---|
374 | }
|
---|
375 |
|
---|
376 | //
|
---|
377 | ////////////////////////////////////////////////////////////////////////////
|
---|
378 | void t_reqcAnalyze::preparePlotData(const QString& prn, const ColumnVector& xyz,
|
---|
379 | double obsInterval,
|
---|
380 | QVector<t_polarPoint*>* dataMP1,
|
---|
381 | QVector<t_polarPoint*>* dataMP2,
|
---|
382 | QVector<t_polarPoint*>* dataSNR1,
|
---|
383 | QVector<t_polarPoint*>* dataSNR2) {
|
---|
384 |
|
---|
385 | const int chunkStep = int( 30.0 / obsInterval); // chunk step (30 sec)
|
---|
386 | const int numEpo = int(600.0 / obsInterval); // # epochs in one chunk (10 min)
|
---|
387 |
|
---|
388 | t_allObs& allObs = _allObsMap[prn];
|
---|
389 |
|
---|
390 | // Loop over all Chunks of Data
|
---|
391 | // ----------------------------
|
---|
392 | for (int chunkStart = 0; chunkStart + numEpo < allObs._oneObsVec.size();
|
---|
393 | chunkStart += chunkStep) {
|
---|
394 |
|
---|
395 | // Chunk-Speicific Variables
|
---|
396 | // -------------------------
|
---|
397 | bncTime currTime;
|
---|
398 | bncTime prevTime;
|
---|
399 | bncTime chunkStartTime;
|
---|
400 | bool availL1 = false;
|
---|
401 | bool availL2 = false;
|
---|
402 | bool gapL1 = false;
|
---|
403 | bool gapL2 = false;
|
---|
404 | bool slipL1 = false;
|
---|
405 | bool slipL2 = false;
|
---|
406 | bool slipMP = false;
|
---|
407 | double meanMP1 = 0.0;
|
---|
408 | double meanMP2 = 0.0;
|
---|
409 | double minSNR1 = 0.0;
|
---|
410 | double minSNR2 = 0.0;
|
---|
411 | double aziDeg = 0.0;
|
---|
412 | double zenDeg = 0.0;
|
---|
413 | bool zenFlag = false;
|
---|
414 |
|
---|
415 | // Loop over all Epochs within one Chunk of Data
|
---|
416 | // ---------------------------------------------
|
---|
417 | for (int ii = 0; ii < numEpo; ii++) {
|
---|
418 | int iEpo = chunkStart + ii;
|
---|
419 | const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
|
---|
420 |
|
---|
421 | currTime.set(oneObs->_GPSWeek, oneObs->_GPSWeeks);
|
---|
422 |
|
---|
423 | // Compute the Azimuth and Zenith Distance
|
---|
424 | // ---------------------------------------
|
---|
425 | if (ii == 0) {
|
---|
426 | chunkStartTime = currTime;
|
---|
427 |
|
---|
428 | if (xyz.size()) {
|
---|
429 | t_eph* eph = 0;
|
---|
430 | for (int ie = 0; ie < _ephs.size(); ie++) {
|
---|
431 | if (_ephs[ie]->prn() == prn) {
|
---|
432 | eph = _ephs[ie];
|
---|
433 | break;
|
---|
434 | }
|
---|
435 | }
|
---|
436 |
|
---|
437 | if (eph) {
|
---|
438 | double xSat, ySat, zSat, clkSat;
|
---|
439 | eph->position(oneObs->_GPSWeek, oneObs->_GPSWeeks,
|
---|
440 | xSat, ySat, zSat, clkSat);
|
---|
441 |
|
---|
442 | double rho, eleSat, azSat;
|
---|
443 | topos(xyz(1), xyz(2), xyz(3), xSat, ySat, zSat, rho, eleSat, azSat);
|
---|
444 |
|
---|
445 | aziDeg = azSat * 180.0/M_PI;
|
---|
446 | zenDeg = 90.0 - eleSat * 180.0/M_PI;
|
---|
447 | zenFlag = true;
|
---|
448 | }
|
---|
449 | }
|
---|
450 | }
|
---|
451 |
|
---|
452 | // Check Interval
|
---|
453 | // --------------
|
---|
454 | if (prevTime.valid()) {
|
---|
455 | double dt = currTime - prevTime;
|
---|
456 | if (dt != obsInterval) {
|
---|
457 | gapL1 = true;
|
---|
458 | gapL2 = true;
|
---|
459 | }
|
---|
460 | }
|
---|
461 | prevTime = currTime;
|
---|
462 |
|
---|
463 | // Check L1 and L2 availability
|
---|
464 | // ----------------------------
|
---|
465 | if (oneObs->_hasL1) {
|
---|
466 | availL1 = true;
|
---|
467 | }
|
---|
468 | else {
|
---|
469 | gapL1 = true;
|
---|
470 | }
|
---|
471 | if (oneObs->_hasL2) {
|
---|
472 | availL2 = true;
|
---|
473 | }
|
---|
474 | else {
|
---|
475 | gapL2 = true;
|
---|
476 | }
|
---|
477 |
|
---|
478 | // Check Minimal Signal-to-Noise Ratio
|
---|
479 | // -----------------------------------
|
---|
480 | if ( oneObs->_SNR1 > 0 && (minSNR1 == 0 || minSNR1 > oneObs->_SNR1) ) {
|
---|
481 | minSNR1 = oneObs->_SNR1;
|
---|
482 | }
|
---|
483 | if ( oneObs->_SNR2 > 0 && (minSNR2 == 0 || minSNR2 > oneObs->_SNR2) ) {
|
---|
484 | minSNR2 = oneObs->_SNR2;
|
---|
485 | }
|
---|
486 |
|
---|
487 | // Check Slip Flags
|
---|
488 | // ----------------
|
---|
489 | if (oneObs->_slipL1) {
|
---|
490 | slipL1 = true;
|
---|
491 | }
|
---|
492 | if (oneObs->_slipL2) {
|
---|
493 | slipL2 = true;
|
---|
494 | }
|
---|
495 |
|
---|
496 | // Check Slip Threshold
|
---|
497 | // --------------------
|
---|
498 | if (ii > 0) {
|
---|
499 | double diff1 = oneObs->_MP1 - allObs._oneObsVec[iEpo-1]->_MP1;
|
---|
500 | double diff2 = oneObs->_MP2 - allObs._oneObsVec[iEpo-1]->_MP2;
|
---|
501 | if (fabs(diff1) > SLIPTRESH || fabs(diff2) > SLIPTRESH) {
|
---|
502 | slipMP = true;
|
---|
503 | }
|
---|
504 | }
|
---|
505 |
|
---|
506 | meanMP1 += oneObs->_MP1;
|
---|
507 | meanMP2 += oneObs->_MP2;
|
---|
508 | }
|
---|
509 |
|
---|
510 | // Availability Plot Data
|
---|
511 | // ----------------------
|
---|
512 | double mjdX24 = chunkStartTime.mjddec() * 24.0;
|
---|
513 | if (availL1) {
|
---|
514 | if (slipL1) {
|
---|
515 | _availDataMap[prn]._L1slip << mjdX24;
|
---|
516 | }
|
---|
517 | else if (gapL1) {
|
---|
518 | _availDataMap[prn]._L1gap << mjdX24;
|
---|
519 | }
|
---|
520 | else {
|
---|
521 | _availDataMap[prn]._L1ok << mjdX24;
|
---|
522 | }
|
---|
523 | }
|
---|
524 | if (availL2) {
|
---|
525 | if (slipL2) {
|
---|
526 | _availDataMap[prn]._L2slip << mjdX24;
|
---|
527 | }
|
---|
528 | else if (gapL2) {
|
---|
529 | _availDataMap[prn]._L2gap << mjdX24;
|
---|
530 | }
|
---|
531 | else {
|
---|
532 | _availDataMap[prn]._L2ok << mjdX24;
|
---|
533 | }
|
---|
534 | }
|
---|
535 | if (zenFlag) {
|
---|
536 | _availDataMap[prn]._eleTim << mjdX24;
|
---|
537 | _availDataMap[prn]._eleDeg << 90.0 - zenDeg;
|
---|
538 | }
|
---|
539 |
|
---|
540 | // Signal-to-Noise Ration Plot Data
|
---|
541 | // --------------------------------
|
---|
542 | (*dataSNR1) << (new t_polarPoint(aziDeg, zenDeg, minSNR1));
|
---|
543 | (*dataSNR2) << (new t_polarPoint(aziDeg, zenDeg, minSNR2));
|
---|
544 |
|
---|
545 | // Compute the Multipath
|
---|
546 | // ---------------------
|
---|
547 | if (!slipMP) {
|
---|
548 | meanMP1 /= numEpo;
|
---|
549 | meanMP2 /= numEpo;
|
---|
550 | double MP1 = 0.0;
|
---|
551 | double MP2 = 0.0;
|
---|
552 | for (int ii = 0; ii < numEpo; ii++) {
|
---|
553 | int iEpo = chunkStart + ii;
|
---|
554 | const t_oneObs* oneObs = allObs._oneObsVec[iEpo];
|
---|
555 | double diff1 = oneObs->_MP1 - meanMP1;
|
---|
556 | double diff2 = oneObs->_MP2 - meanMP2;
|
---|
557 | MP1 += diff1 * diff1;
|
---|
558 | MP2 += diff2 * diff2;
|
---|
559 | }
|
---|
560 | MP1 = sqrt(MP1 / (numEpo-1));
|
---|
561 | MP2 = sqrt(MP2 / (numEpo-1));
|
---|
562 | (*dataMP1) << (new t_polarPoint(aziDeg, zenDeg, MP1));
|
---|
563 | (*dataMP2) << (new t_polarPoint(aziDeg, zenDeg, MP2));
|
---|
564 | }
|
---|
565 | }
|
---|
566 | }
|
---|
567 |
|
---|
568 | //
|
---|
569 | ////////////////////////////////////////////////////////////////////////////
|
---|
570 | void t_reqcAnalyze::slotDspAvailPlot(const QString& fileName,
|
---|
571 | const QByteArray& title) {
|
---|
572 |
|
---|
573 | if (dynamic_cast<bncApp*>(qApp)->GUIenabled()) {
|
---|
574 |
|
---|
575 | t_availPlot* plotA = new t_availPlot(0, &_availDataMap);
|
---|
576 | plotA->setTitle(title);
|
---|
577 |
|
---|
578 | t_elePlot* plotZ = new t_elePlot(0, &_availDataMap);
|
---|
579 | plotZ->setTitle(title);
|
---|
580 |
|
---|
581 | QVector<QWidget*> plots;
|
---|
582 | plots << plotA << plotZ;
|
---|
583 | t_graphWin* graphWin = new t_graphWin(0, fileName, plots, 0, 0);
|
---|
584 | graphWin->show();
|
---|
585 |
|
---|
586 | bncSettings settings;
|
---|
587 | QString dirName = settings.value("reqcPlotDir").toString();
|
---|
588 | if (!dirName.isEmpty()) {
|
---|
589 | QByteArray ext = "_A.png";
|
---|
590 | graphWin->savePNG(dirName, ext);
|
---|
591 | }
|
---|
592 | }
|
---|
593 | }
|
---|