source: ntrip/trunk/BNC/bncmodel.cpp@ 3387

Last change on this file since 3387 was 3387, checked in by mervart, 13 years ago
File size: 39.8 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: bncParam, bncModel
30 *
31 * Purpose: Model for PPP
32 *
33 * Author: L. Mervart
34 *
35 * Created: 01-Dec-2009
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iomanip>
42#include <cmath>
43#include <newmatio.h>
44#include <sstream>
45
46#include "bncmodel.h"
47#include "bncapp.h"
48#include "bncpppclient.h"
49#include "bancroft.h"
50#include "bncutils.h"
51#include "bncsettings.h"
52#include "bnctides.h"
53#include "bncantex.h"
54#include "bnccomb.h"
55
56using namespace std;
57
58const unsigned MINOBS = 5;
59const double MINELE = 10.0 * M_PI / 180.0;
60const double MAXRES_CODE = 10.0;
61const double MAXRES_PHASE = 0.04;
62
63// Constructor
64////////////////////////////////////////////////////////////////////////////
65bncParam::bncParam(bncParam::parType typeIn, int indexIn,
66 const QString& prnIn) {
67 type = typeIn;
68 index = indexIn;
69 prn = prnIn;
70 index_old = 0;
71 xx = 0.0;
72 numEpo = 0;
73}
74
75// Destructor
76////////////////////////////////////////////////////////////////////////////
77bncParam::~bncParam() {
78}
79
80// Partial
81////////////////////////////////////////////////////////////////////////////
82double bncParam::partial(t_satData* satData, bool phase) {
83
84 Tracer tracer("bncParam::partial");
85
86 // Coordinates
87 // -----------
88 if (type == CRD_X) {
89 return (xx - satData->xx(1)) / satData->rho;
90 }
91 else if (type == CRD_Y) {
92 return (xx - satData->xx(2)) / satData->rho;
93 }
94 else if (type == CRD_Z) {
95 return (xx - satData->xx(3)) / satData->rho;
96 }
97
98 // Receiver Clocks
99 // ---------------
100 else if (type == RECCLK) {
101 return 1.0;
102 }
103
104 // Troposphere
105 // -----------
106 else if (type == TROPO) {
107 return 1.0 / sin(satData->eleSat);
108 }
109
110 // Galileo Offset
111 // --------------
112 else if (type == GALILEO_OFFSET) {
113 if (satData->prn[0] == 'E') {
114 return 1.0;
115 }
116 else {
117 return 0.0;
118 }
119 }
120
121 // Ambiguities
122 // -----------
123 else if (type == AMB_L3) {
124 if (phase && satData->prn == prn) {
125 return 1.0;
126 }
127 else {
128 return 0.0;
129 }
130 }
131
132 // Default return
133 // --------------
134 return 0.0;
135}
136
137// Constructor
138////////////////////////////////////////////////////////////////////////////
139bncModel::bncModel(QByteArray staID) {
140
141 _staID = staID;
142
143 connect(this, SIGNAL(newMessage(QByteArray,bool)),
144 ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
145
146 bncSettings settings;
147
148 // Observation Sigmas
149 // ------------------
150 _sigP3 = 5.0;
151 if (!settings.value("pppSigmaCode").toString().isEmpty()) {
152 _sigP3 = settings.value("pppSigmaCode").toDouble();
153 }
154 _sigL3 = 0.02;
155 if (!settings.value("pppSigmaPhase").toString().isEmpty()) {
156 _sigL3 = settings.value("pppSigmaPhase").toDouble();
157 }
158
159 // Parameter Sigmas
160 // ----------------
161 _sigCrd0 = 100.0;
162 if (!settings.value("pppSigCrd0").toString().isEmpty()) {
163 _sigCrd0 = settings.value("pppSigCrd0").toDouble();
164 }
165 _sigCrdP = 100.0;
166 if (!settings.value("pppSigCrdP").toString().isEmpty()) {
167 _sigCrdP = settings.value("pppSigCrdP").toDouble();
168 }
169 _sigTrp0 = 0.1;
170 if (!settings.value("pppSigTrp0").toString().isEmpty()) {
171 _sigTrp0 = settings.value("pppSigTrp0").toDouble();
172 }
173 _sigTrpP = 1e-6;
174 if (!settings.value("pppSigTrpP").toString().isEmpty()) {
175 _sigTrpP = settings.value("pppSigTrpP").toDouble();
176 }
177 _sigClk0 = 1000.0;
178 _sigAmb0 = 1000.0;
179 _sigGalileoOffset0 = 1000.0;
180 _sigGalileoOffsetP = 0.0;
181
182 // Quick-Start Mode
183 // ----------------
184 _quickStart = 0;
185 if (settings.value("pppRefCrdX").toString() != "" &&
186 settings.value("pppRefCrdY").toString() != "" &&
187 settings.value("pppRefCrdZ").toString() != "" &&
188 !settings.value("pppQuickStart").toString().isEmpty()) {
189 _quickStart = settings.value("pppQuickStart").toDouble();
190 }
191
192 // Several options
193 // ---------------
194 _usePhase = false;
195 if ( Qt::CheckState(settings.value("pppUsePhase").toInt()) == Qt::Checked) {
196 _usePhase = true;
197 }
198
199 _estTropo = false;
200 if ( Qt::CheckState(settings.value("pppEstTropo").toInt()) == Qt::Checked) {
201 _estTropo = true;
202 }
203
204 _useGalileo = false;
205 if ( Qt::CheckState(settings.value("pppGalileo").toInt()) == Qt::Checked) {
206 _useGalileo = true;
207 }
208
209 // NMEA Output
210 // -----------
211 QString nmeaFileName = settings.value("nmeaFile").toString();
212 if (nmeaFileName.isEmpty()) {
213 _nmeaFile = 0;
214 _nmeaStream = 0;
215 }
216 else {
217 expandEnvVar(nmeaFileName);
218 _nmeaFile = new QFile(nmeaFileName);
219 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
220 _nmeaFile->open(QIODevice::WriteOnly | QIODevice::Append);
221 }
222 else {
223 _nmeaFile->open(QIODevice::WriteOnly);
224 }
225 _nmeaStream = new QTextStream();
226 _nmeaStream->setDevice(_nmeaFile);
227 }
228
229 // Antenna Name, ANTEX File
230 // ------------------------
231 _antex = 0;
232 QString antexFileName = settings.value("pppAntex").toString();
233 if (!antexFileName.isEmpty()) {
234 _antex = new bncAntex();
235 if (_antex->readFile(antexFileName) != success) {
236 emit newMessage("wrong ANTEX file", true);
237 delete _antex;
238 _antex = 0;
239 }
240 else {
241 _antennaName = settings.value("pppAntenna").toString();
242 }
243 }
244
245 // Antenna Eccentricities
246 // ----------------------
247 _dN = settings.value("pppRefdN").toDouble();
248 _dE = settings.value("pppRefdE").toDouble();
249 _dU = settings.value("pppRefdU").toDouble();
250
251 // Bancroft Coordinates
252 // --------------------
253 _xcBanc.ReSize(4); _xcBanc = 0.0;
254 _ellBanc.ReSize(3); _ellBanc = 0.0;
255
256 // Save copy of data (used in outlier detection)
257 // ---------------------------------------------
258 _epoData_sav = new t_epoData();
259}
260
261// Destructor
262////////////////////////////////////////////////////////////////////////////
263bncModel::~bncModel() {
264 delete _nmeaStream;
265 delete _nmeaFile;
266 for (int ii = 0; ii < _posAverage.size(); ++ii) {
267 delete _posAverage[ii];
268 }
269 delete _antex;
270 for (int iPar = 1; iPar <= _params.size(); iPar++) {
271 delete _params[iPar-1];
272 }
273 delete _epoData_sav;
274}
275
276// Reset Parameters and Variance-Covariance Matrix
277////////////////////////////////////////////////////////////////////////////
278void bncModel::reset() {
279
280 Tracer tracer("bncModel::reset");
281
282 for (int iPar = 1; iPar <= _params.size(); iPar++) {
283 delete _params[iPar-1];
284 }
285 _params.clear();
286
287 int nextPar = 0;
288 _params.push_back(new bncParam(bncParam::CRD_X, ++nextPar, ""));
289 _params.push_back(new bncParam(bncParam::CRD_Y, ++nextPar, ""));
290 _params.push_back(new bncParam(bncParam::CRD_Z, ++nextPar, ""));
291 _params.push_back(new bncParam(bncParam::RECCLK, ++nextPar, ""));
292 if (_estTropo) {
293 _params.push_back(new bncParam(bncParam::TROPO, ++nextPar, ""));
294 }
295 if (_useGalileo) {
296 _params.push_back(new bncParam(bncParam::GALILEO_OFFSET, ++nextPar, ""));
297 }
298
299 _QQ.ReSize(_params.size());
300 _QQ = 0.0;
301 for (int iPar = 1; iPar <= _params.size(); iPar++) {
302 bncParam* pp = _params[iPar-1];
303 pp->xx = 0.0;
304 if (pp->isCrd()) {
305 _QQ(iPar,iPar) = _sigCrd0 * _sigCrd0;
306 }
307 else if (pp->type == bncParam::RECCLK) {
308 _QQ(iPar,iPar) = _sigClk0 * _sigClk0;
309 }
310 else if (pp->type == bncParam::TROPO) {
311 _QQ(iPar,iPar) = _sigTrp0 * _sigTrp0;
312 }
313 else if (pp->type == bncParam::GALILEO_OFFSET) {
314 _QQ(iPar,iPar) = _sigGalileoOffset0 * _sigGalileoOffset0;
315 }
316 }
317}
318
319// Bancroft Solution
320////////////////////////////////////////////////////////////////////////////
321t_irc bncModel::cmpBancroft(t_epoData* epoData) {
322
323 Tracer tracer("bncModel::cmpBancroft");
324
325 if (epoData->sizeSys('G') < MINOBS) {
326 _log += "bncModel::cmpBancroft: not enough data\n";
327 return failure;
328 }
329
330 Matrix BB(epoData->sizeSys('G'), 4);
331
332 QMapIterator<QString, t_satData*> it(epoData->satData);
333 int iObsBanc = 0;
334 while (it.hasNext()) {
335 it.next();
336 t_satData* satData = it.value();
337 if (satData->system() == 'G') {
338 ++iObsBanc;
339 QString prn = it.key();
340 BB(iObsBanc, 1) = satData->xx(1);
341 BB(iObsBanc, 2) = satData->xx(2);
342 BB(iObsBanc, 3) = satData->xx(3);
343 BB(iObsBanc, 4) = satData->P3 + satData->clk;
344 }
345 }
346
347 bancroft(BB, _xcBanc);
348
349 // Ellipsoidal Coordinates
350 // ------------------------
351 xyz2ell(_xcBanc.data(), _ellBanc.data());
352
353 // Compute Satellite Elevations
354 // ----------------------------
355 QMutableMapIterator<QString, t_satData*> im(epoData->satData);
356 while (im.hasNext()) {
357 im.next();
358 t_satData* satData = im.value();
359 cmpEle(satData);
360 if (satData->eleSat < MINELE) {
361 delete satData;
362 im.remove();
363 }
364 }
365
366 return success;
367}
368
369// Computed Value
370////////////////////////////////////////////////////////////////////////////
371double bncModel::cmpValue(t_satData* satData, bool phase) {
372
373 Tracer tracer("bncModel::cmpValue");
374
375 ColumnVector xRec(3);
376 xRec(1) = x();
377 xRec(2) = y();
378 xRec(3) = z();
379
380 double rho0 = (satData->xx - xRec).norm_Frobenius();
381 double dPhi = t_CST::omega * rho0 / t_CST::c;
382
383 xRec(1) = x() * cos(dPhi) - y() * sin(dPhi);
384 xRec(2) = y() * cos(dPhi) + x() * sin(dPhi);
385 xRec(3) = z();
386
387 tides(_time, xRec);
388
389 satData->rho = (satData->xx - xRec).norm_Frobenius();
390
391 double tropDelay = delay_saast(satData->eleSat) +
392 trp() / sin(satData->eleSat);
393
394 double wind = 0.0;
395 if (phase) {
396 wind = windUp(satData->prn, satData->xx, xRec) * satData->lambda3;
397 }
398
399 double offset = 0.0;
400 if (satData->prn[0] == 'E') {
401 offset = Galileo_offset();
402 }
403
404 double phaseCenter = 0.0;
405 if (_antex) {
406 bool found;
407 phaseCenter = _antex->pco(_antennaName, satData->eleSat, found);
408 if (!found) {
409 emit newMessage("ANTEX: antenna >"
410 + _antennaName.toAscii() + "< not found", true);
411 }
412 }
413
414 double antennaOffset = 0.0;
415 if (_dN != 0.0 || _dE != 0.0 || _dU != 0.0) {
416 double cosa = cos(satData->azSat);
417 double sina = sin(satData->azSat);
418 double cose = cos(satData->eleSat);
419 double sine = sin(satData->eleSat);
420 antennaOffset = -_dN * cosa*cose - _dE * sina*cose - _dU * sine;
421 }
422
423 return satData->rho + phaseCenter + antennaOffset + clk()
424 + offset - satData->clk + tropDelay + wind;
425}
426
427// Tropospheric Model (Saastamoinen)
428////////////////////////////////////////////////////////////////////////////
429double bncModel::delay_saast(double Ele) {
430
431 Tracer tracer("bncModel::delay_saast");
432
433 double xyz[3];
434 xyz[0] = x();
435 xyz[1] = y();
436 xyz[2] = z();
437 double ell[3];
438 xyz2ell(xyz, ell);
439 double height = ell[2];
440
441 double pp = 1013.25 * pow(1.0 - 2.26e-5 * height, 5.225);
442 double TT = 18.0 - height * 0.0065 + 273.15;
443 double hh = 50.0 * exp(-6.396e-4 * height);
444 double ee = hh / 100.0 * exp(-37.2465 + 0.213166*TT - 0.000256908*TT*TT);
445
446 double h_km = height / 1000.0;
447
448 if (h_km < 0.0) h_km = 0.0;
449 if (h_km > 5.0) h_km = 5.0;
450 int ii = int(h_km + 1);
451 double href = ii - 1;
452
453 double bCor[6];
454 bCor[0] = 1.156;
455 bCor[1] = 1.006;
456 bCor[2] = 0.874;
457 bCor[3] = 0.757;
458 bCor[4] = 0.654;
459 bCor[5] = 0.563;
460
461 double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href);
462
463 double zen = M_PI/2.0 - Ele;
464
465 return (0.002277/cos(zen)) * (pp + ((1255.0/TT)+0.05)*ee - BB*(tan(zen)*tan(zen)));
466}
467
468// Prediction Step of the Filter
469////////////////////////////////////////////////////////////////////////////
470void bncModel::predict(int iPhase, t_epoData* epoData) {
471
472 Tracer tracer("bncModel::predict");
473
474 if (iPhase == 0) {
475
476 bncSettings settings;
477
478 _time = epoData->tt; // current epoch time
479
480 _maxSolGap = settings.value("pppMaxSolGap").toDouble();
481
482 bool firstCrd = false;
483 if (!_lastTimeOK.valid() || (_maxSolGap > 0 && _time - _lastTimeOK > _maxSolGap)) {
484 firstCrd = true;
485 _startTime = epoData->tt;
486 reset();
487 }
488
489 // Use different white noise for Quick-Start mode
490 // ----------------------------------------------
491 double sigCrdP_used = _sigCrdP;
492 if ( _quickStart > 0.0 && _quickStart > (epoData->tt - _startTime) ) {
493 sigCrdP_used = 0.0;
494 }
495
496 // Predict Parameter values, add white noise
497 // -----------------------------------------
498 for (int iPar = 1; iPar <= _params.size(); iPar++) {
499 bncParam* pp = _params[iPar-1];
500
501 // Coordinates
502 // -----------
503 if (pp->type == bncParam::CRD_X) {
504 if (firstCrd) {
505 if (settings.value("pppRefCrdX").toString() != "" &&
506 settings.value("pppRefCrdY").toString() != "" &&
507 settings.value("pppRefCrdZ").toString() != "") {
508 pp->xx = settings.value("pppRefCrdX").toDouble();
509 }
510 else {
511 pp->xx = _xcBanc(1);
512 }
513 }
514 _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used;
515 }
516 else if (pp->type == bncParam::CRD_Y) {
517 if (firstCrd) {
518 if (settings.value("pppRefCrdX").toString() != "" &&
519 settings.value("pppRefCrdY").toString() != "" &&
520 settings.value("pppRefCrdZ").toString() != "") {
521 pp->xx = settings.value("pppRefCrdY").toDouble();
522 }
523 else {
524 pp->xx = _xcBanc(2);
525 }
526 }
527 _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used;
528 }
529 else if (pp->type == bncParam::CRD_Z) {
530 if (firstCrd) {
531 if (settings.value("pppRefCrdX").toString() != "" &&
532 settings.value("pppRefCrdY").toString() != "" &&
533 settings.value("pppRefCrdZ").toString() != "") {
534 pp->xx = settings.value("pppRefCrdZ").toDouble();
535 }
536 else {
537 pp->xx = _xcBanc(3);
538 }
539 }
540 _QQ(iPar,iPar) += sigCrdP_used * sigCrdP_used;
541 }
542
543 // Receiver Clocks
544 // ---------------
545 else if (pp->type == bncParam::RECCLK) {
546 pp->xx = _xcBanc(4);
547 for (int jj = 1; jj <= _params.size(); jj++) {
548 _QQ(iPar, jj) = 0.0;
549 }
550 _QQ(iPar,iPar) = _sigClk0 * _sigClk0;
551 }
552
553 // Tropospheric Delay
554 // ------------------
555 else if (pp->type == bncParam::TROPO) {
556 _QQ(iPar,iPar) += _sigTrpP * _sigTrpP;
557 }
558
559 // Galileo Offset
560 // --------------
561 else if (pp->type == bncParam::GALILEO_OFFSET) {
562 _QQ(iPar,iPar) += _sigGalileoOffsetP * _sigGalileoOffsetP;
563 }
564 }
565 }
566
567 // Add New Ambiguities if necessary
568 // --------------------------------
569 if (_usePhase) {
570
571 // Make a copy of QQ and xx, set parameter indices
572 // -----------------------------------------------
573 SymmetricMatrix QQ_old = _QQ;
574
575 for (int iPar = 1; iPar <= _params.size(); iPar++) {
576 _params[iPar-1]->index_old = _params[iPar-1]->index;
577 _params[iPar-1]->index = 0;
578 }
579
580 // Remove Ambiguity Parameters without observations
581 // ------------------------------------------------
582 int iPar = 0;
583 QMutableVectorIterator<bncParam*> im(_params);
584 while (im.hasNext()) {
585 bncParam* par = im.next();
586 bool removed = false;
587 if (par->type == bncParam::AMB_L3) {
588 if (epoData->satData.find(par->prn) == epoData->satData.end()) {
589 removed = true;
590 delete par;
591 im.remove();
592 }
593 }
594 if (! removed) {
595 ++iPar;
596 par->index = iPar;
597 }
598 }
599
600 // Add new ambiguity parameters
601 // ----------------------------
602 QMapIterator<QString, t_satData*> it(epoData->satData);
603 while (it.hasNext()) {
604 it.next();
605 t_satData* satData = it.value();
606 addAmb(satData);
607 }
608
609 int nPar = _params.size();
610 _QQ.ReSize(nPar); _QQ = 0.0;
611 for (int i1 = 1; i1 <= nPar; i1++) {
612 bncParam* p1 = _params[i1-1];
613 if (p1->index_old != 0) {
614 _QQ(p1->index, p1->index) = QQ_old(p1->index_old, p1->index_old);
615 for (int i2 = 1; i2 <= nPar; i2++) {
616 bncParam* p2 = _params[i2-1];
617 if (p2->index_old != 0) {
618 _QQ(p1->index, p2->index) = QQ_old(p1->index_old, p2->index_old);
619 }
620 }
621 }
622 }
623
624 for (int ii = 1; ii <= nPar; ii++) {
625 bncParam* par = _params[ii-1];
626 if (par->index_old == 0) {
627 _QQ(par->index, par->index) = _sigAmb0 * _sigAmb0;
628 }
629 par->index_old = par->index;
630 }
631 }
632}
633
634// Update Step of the Filter (currently just a single-epoch solution)
635////////////////////////////////////////////////////////////////////////////
636t_irc bncModel::update(t_epoData* epoData) {
637
638 Tracer tracer("bncModel::update");
639
640 bncSettings settings;
641
642 _log.clear();
643
644 if (settings.value("pppSPP").toString() == "PPP") {
645 _log += "Precise Point Positioning of Epoch "
646 + QByteArray(_time.timestr(1).c_str()) +
647 "\n---------------------------------------------------------------\n";
648 }
649 else {
650 _log += "Single Point Positioning of Epoch "
651 + QByteArray(_time.timestr(1).c_str()) +
652 "\n--------------------------------------------------------------\n";
653 }
654
655 // Outlier Detection Loop
656 // ----------------------
657 if (update_p(epoData) != success) {
658 emit newMessage(_log, false);
659 return failure;
660 }
661
662 // Remember the Epoch-specific Results for the computation of means
663 // ----------------------------------------------------------------
664 pppPos* newPos = new pppPos;
665 newPos->time = epoData->tt;
666
667 // Set Solution Vector
668 // -------------------
669 ostringstream strB;
670 strB.setf(ios::fixed);
671 QVectorIterator<bncParam*> itPar(_params);
672 while (itPar.hasNext()) {
673 bncParam* par = itPar.next();
674
675 if (par->type == bncParam::RECCLK) {
676 strB << "\n clk = " << setw(10) << setprecision(3) << par->xx
677 << " +- " << setw(6) << setprecision(3)
678 << sqrt(_QQ(par->index,par->index));
679 }
680 else if (par->type == bncParam::AMB_L3) {
681 ++par->numEpo;
682 strB << "\n amb " << par->prn.toAscii().data() << " = "
683 << setw(10) << setprecision(3) << par->xx
684 << " +- " << setw(6) << setprecision(3)
685 << sqrt(_QQ(par->index,par->index))
686 << " nEpo = " << par->numEpo;
687 }
688 else if (par->type == bncParam::TROPO) {
689 double aprTrp = delay_saast(M_PI/2.0);
690 strB << "\n trp = " << par->prn.toAscii().data()
691 << setw(7) << setprecision(3) << aprTrp << " "
692 << setw(6) << setprecision(3) << showpos << par->xx << noshowpos
693 << " +- " << setw(6) << setprecision(3)
694 << sqrt(_QQ(par->index,par->index));
695 newPos->xnt[6] = aprTrp + par->xx;
696 }
697 else if (par->type == bncParam::GALILEO_OFFSET) {
698 strB << "\n offset = " << setw(10) << setprecision(3) << par->xx
699 << " +- " << setw(6) << setprecision(3)
700 << sqrt(_QQ(par->index,par->index));
701 }
702 }
703 strB << '\n';
704 _log += strB.str().c_str();
705 emit newMessage(_log, false);
706
707 // Final Message (both log file and screen)
708 // ----------------------------------------
709 ostringstream strC;
710 strC.setf(ios::fixed);
711 strC << _staID.data() << " PPP "
712 << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " "
713 << setw(14) << setprecision(3) << x() << " +- "
714 << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " "
715 << setw(14) << setprecision(3) << y() << " +- "
716 << setw(6) << setprecision(3) << sqrt(_QQ(2,2)) << " "
717 << setw(14) << setprecision(3) << z() << " +- "
718 << setw(6) << setprecision(3) << sqrt(_QQ(3,3));
719
720 // NEU Output
721 // ----------
722 double xyzRef[3];
723
724 if (settings.value("pppRefCrdX").toString() != "" &&
725 settings.value("pppRefCrdY").toString() != "" &&
726 settings.value("pppRefCrdZ").toString() != "") {
727
728 xyzRef[0] = settings.value("pppRefCrdX").toDouble();
729 xyzRef[1] = settings.value("pppRefCrdY").toDouble();
730 xyzRef[2] = settings.value("pppRefCrdZ").toDouble();
731
732 newPos->xnt[0] = x() - xyzRef[0];
733 newPos->xnt[1] = y() - xyzRef[1];
734 newPos->xnt[2] = z() - xyzRef[2];
735
736 double ellRef[3];
737 xyz2ell(xyzRef, ellRef);
738 xyz2neu(ellRef, newPos->xnt, &newPos->xnt[3]);
739
740 strC << " NEU "
741 << setw(8) << setprecision(3) << newPos->xnt[3] << " "
742 << setw(8) << setprecision(3) << newPos->xnt[4] << " "
743 << setw(8) << setprecision(3) << newPos->xnt[5] << endl;
744
745 }
746
747 emit newMessage(QByteArray(strC.str().c_str()), true);
748
749 if (settings.value("pppAverage").toString() == "") {
750 delete newPos;
751 }
752 else {
753
754 _posAverage.push_back(newPos);
755
756 // Time Span for Average Computation
757 // ---------------------------------
758 double tRangeAverage = settings.value("pppAverage").toDouble() * 60.;
759 if (tRangeAverage < 0) {
760 tRangeAverage = 0;
761 }
762 if (tRangeAverage > 86400) {
763 tRangeAverage = 86400;
764 }
765
766 // Compute the Mean
767 // ----------------
768 ColumnVector mean(7); mean = 0.0;
769
770 QMutableVectorIterator<pppPos*> it(_posAverage);
771 while (it.hasNext()) {
772 pppPos* pp = it.next();
773 if ( (epoData->tt - pp->time) >= tRangeAverage ) {
774 delete pp;
775 it.remove();
776 }
777 else {
778 for (int ii = 0; ii < 7; ++ii) {
779 mean[ii] += pp->xnt[ii];
780 }
781 }
782 }
783
784 int nn = _posAverage.size();
785
786 if (nn > 0) {
787
788 mean /= nn;
789
790 // Compute the Deviation
791 // ---------------------
792 ColumnVector std(7); std = 0.0;
793 QVectorIterator<pppPos*> it2(_posAverage);
794 while (it2.hasNext()) {
795 pppPos* pp = it2.next();
796 for (int ii = 0; ii < 7; ++ii) {
797 std[ii] += (pp->xnt[ii] - mean[ii]) * (pp->xnt[ii] - mean[ii]);
798 }
799 }
800 for (int ii = 0; ii < 7; ++ii) {
801 std[ii] = sqrt(std[ii] / nn);
802 }
803
804 if (settings.value("pppRefCrdX").toString() != "" &&
805 settings.value("pppRefCrdY").toString() != "" &&
806 settings.value("pppRefCrdZ").toString() != "") {
807
808 ostringstream strD; strD.setf(ios::fixed);
809 strD << _staID.data() << " AVE-XYZ "
810 << epoData->tt.timestr(1) << " "
811 << setw(13) << setprecision(3) << mean[0] + xyzRef[0] << " +- "
812 << setw(6) << setprecision(3) << std[0] << " "
813 << setw(14) << setprecision(3) << mean[1] + xyzRef[1] << " +- "
814 << setw(6) << setprecision(3) << std[1] << " "
815 << setw(14) << setprecision(3) << mean[2] + xyzRef[2] << " +- "
816 << setw(6) << setprecision(3) << std[2];
817 emit newMessage(QByteArray(strD.str().c_str()), true);
818
819 ostringstream strE; strE.setf(ios::fixed);
820 strE << _staID.data() << " AVE-NEU "
821 << epoData->tt.timestr(1) << " "
822 << setw(13) << setprecision(3) << mean[3] << " +- "
823 << setw(6) << setprecision(3) << std[3] << " "
824 << setw(14) << setprecision(3) << mean[4] << " +- "
825 << setw(6) << setprecision(3) << std[4] << " "
826 << setw(14) << setprecision(3) << mean[5] << " +- "
827 << setw(6) << setprecision(3) << std[5];
828 emit newMessage(QByteArray(strE.str().c_str()), true);
829
830 if ( Qt::CheckState(settings.value("pppEstTropo").toInt()) == Qt::Checked) {
831 ostringstream strF; strF.setf(ios::fixed);
832 strF << _staID.data() << " AVE-TRP "
833 << epoData->tt.timestr(1) << " "
834 << setw(13) << setprecision(3) << mean[6] << " +- "
835 << setw(6) << setprecision(3) << std[6] << endl;
836 emit newMessage(QByteArray(strF.str().c_str()), true);
837 }
838 }
839 }
840 }
841
842 // NMEA Output
843 // -----------
844 double xyz[3];
845 xyz[0] = x();
846 xyz[1] = y();
847 xyz[2] = z();
848 double ell[3];
849 xyz2ell(xyz, ell);
850 double phiDeg = ell[0] * 180 / M_PI;
851 double lamDeg = ell[1] * 180 / M_PI;
852
853 char phiCh = 'N';
854 if (phiDeg < 0) {
855 phiDeg = -phiDeg;
856 phiCh = 'S';
857 }
858 char lamCh = 'E';
859 if (lamDeg < 0) {
860 lamDeg = -lamDeg;
861 lamCh = 'W';
862 }
863
864 string datestr = epoData->tt.datestr(0); // yyyymmdd
865 ostringstream strRMC;
866 strRMC.setf(ios::fixed);
867 strRMC << "GPRMC,"
868 << epoData->tt.timestr(0,0) << ",A,"
869 << setw(2) << setfill('0') << int(phiDeg)
870 << setw(6) << setprecision(3) << setfill('0')
871 << fmod(60*phiDeg,60) << ',' << phiCh << ','
872 << setw(3) << setfill('0') << int(lamDeg)
873 << setw(6) << setprecision(3) << setfill('0')
874 << fmod(60*lamDeg,60) << ',' << lamCh << ",,,"
875 << datestr[6] << datestr[7] << datestr[4] << datestr[5]
876 << datestr[2] << datestr[3] << ",,";
877
878 writeNMEAstr(QString(strRMC.str().c_str()));
879
880 double dop = 2.0; // TODO
881
882 ostringstream strGGA;
883 strGGA.setf(ios::fixed);
884 strGGA << "GPGGA,"
885 << epoData->tt.timestr(0,0) << ','
886 << setw(2) << setfill('0') << int(phiDeg)
887 << setw(10) << setprecision(7) << setfill('0')
888 << fmod(60*phiDeg,60) << ',' << phiCh << ','
889 << setw(3) << setfill('0') << int(lamDeg)
890 << setw(10) << setprecision(7) << setfill('0')
891 << fmod(60*lamDeg,60) << ',' << lamCh
892 << ",1," << setw(2) << setfill('0') << epoData->sizeAll() << ','
893 << setw(3) << setprecision(1) << dop << ','
894 << setprecision(3) << ell[2] << ",M,0.0,M,,";
895
896 writeNMEAstr(QString(strGGA.str().c_str()));
897
898 _lastTimeOK = _time; // remember time of last successful update
899 return success;
900}
901
902// Outlier Detection
903////////////////////////////////////////////////////////////////////////////
904bool bncModel::outlierDetection(int iPhase, const ColumnVector& vv,
905 QMap<QString, t_satData*>& satData) {
906
907 Tracer tracer("bncModel::outlierDetection");
908
909 QString prn;
910 double maxRes = 0.0;
911 findMaxRes(vv, satData, prn, maxRes);
912
913 if ( maxRes > (iPhase == 1 ? MAXRES_PHASE : MAXRES_CODE) ) {
914 _log += "Outlier " + prn + " "
915 + QByteArray::number(maxRes, 'f', 3) + "\n";
916 return true;
917 }
918 else {
919 return false;
920 }
921}
922
923//
924////////////////////////////////////////////////////////////////////////////
925void bncModel::writeNMEAstr(const QString& nmStr) {
926
927 Tracer tracer("bncModel::writeNMEAstr");
928
929 unsigned char XOR = 0;
930 for (int ii = 0; ii < nmStr.length(); ii++) {
931 XOR ^= (unsigned char) nmStr[ii].toAscii();
932 }
933
934 QString outStr = '$' + nmStr
935 + QString("*%1\n").arg(int(XOR), 0, 16).toUpper();
936
937 if (_nmeaStream) {
938 *_nmeaStream << outStr;
939 _nmeaStream->flush();
940 }
941
942 emit newNMEAstr(outStr.toAscii());
943}
944
945//
946//////////////////////////////////////////////////////////////////////////////
947void bncModel::kalman(const Matrix& AA, const ColumnVector& ll,
948 const DiagonalMatrix& PP,
949 SymmetricMatrix& QQ, ColumnVector& dx) {
950
951 Tracer tracer("bncModel::kalman");
952
953 int nObs = AA.Nrows();
954 int nPar = AA.Ncols();
955
956 UpperTriangularMatrix SS = Cholesky(QQ).t();
957
958 Matrix SA = SS*AA.t();
959 Matrix SRF(nObs+nPar, nObs+nPar); SRF = 0;
960 for (int ii = 1; ii <= nObs; ++ii) {
961 SRF(ii,ii) = 1.0 / sqrt(PP(ii,ii));
962 }
963
964 SRF.SubMatrix (nObs+1, nObs+nPar, 1, nObs) = SA;
965 SRF.SymSubMatrix(nObs+1, nObs+nPar) = SS;
966
967 UpperTriangularMatrix UU;
968 QRZ(SRF, UU);
969
970 SS = UU.SymSubMatrix(nObs+1, nObs+nPar);
971 UpperTriangularMatrix SH_rt = UU.SymSubMatrix(1, nObs);
972 Matrix YY = UU.SubMatrix(1, nObs, nObs+1, nObs+nPar);
973
974 UpperTriangularMatrix SHi = SH_rt.i();
975
976 Matrix KT = SHi * YY;
977 SymmetricMatrix Hi; Hi << SHi * SHi.t();
978
979 dx = KT.t() * ll;
980 QQ << (SS.t() * SS);
981}
982
983// Phase Wind-Up Correction
984///////////////////////////////////////////////////////////////////////////
985double bncModel::windUp(const QString& prn, const ColumnVector& rSat,
986 const ColumnVector& rRec) {
987
988 Tracer tracer("bncModel::windUp");
989
990 double Mjd = _time.mjd() + _time.daysec() / 86400.0;
991
992 // First time - initialize to zero
993 // -------------------------------
994 if (!_windUpTime.contains(prn)) {
995 _windUpSum[prn] = 0.0;
996 }
997
998 // Compute the correction for new time
999 // -----------------------------------
1000 if (!_windUpTime.contains(prn) || _windUpTime[prn] != Mjd) {
1001 _windUpTime[prn] = Mjd;
1002
1003 // Unit Vector GPS Satellite --> Receiver
1004 // --------------------------------------
1005 ColumnVector rho = rRec - rSat;
1006 rho /= rho.norm_Frobenius();
1007
1008 // GPS Satellite unit Vectors sz, sy, sx
1009 // -------------------------------------
1010 ColumnVector sz = -rSat / rSat.norm_Frobenius();
1011
1012 ColumnVector xSun = Sun(Mjd);
1013 xSun /= xSun.norm_Frobenius();
1014
1015 ColumnVector sy = crossproduct(sz, xSun);
1016 ColumnVector sx = crossproduct(sy, sz);
1017
1018 // Effective Dipole of the GPS Satellite Antenna
1019 // ---------------------------------------------
1020 ColumnVector dipSat = sx - rho * DotProduct(rho,sx)
1021 - crossproduct(rho, sy);
1022
1023 // Receiver unit Vectors rx, ry
1024 // ----------------------------
1025 ColumnVector rx(3);
1026 ColumnVector ry(3);
1027
1028 double recEll[3]; xyz2ell(rRec.data(), recEll) ;
1029 double neu[3];
1030
1031 neu[0] = 1.0;
1032 neu[1] = 0.0;
1033 neu[2] = 0.0;
1034 neu2xyz(recEll, neu, rx.data());
1035
1036 neu[0] = 0.0;
1037 neu[1] = -1.0;
1038 neu[2] = 0.0;
1039 neu2xyz(recEll, neu, ry.data());
1040
1041 // Effective Dipole of the Receiver Antenna
1042 // ----------------------------------------
1043 ColumnVector dipRec = rx - rho * DotProduct(rho,rx)
1044 + crossproduct(rho, ry);
1045
1046 // Resulting Effect
1047 // ----------------
1048 double alpha = DotProduct(dipSat,dipRec) /
1049 (dipSat.norm_Frobenius() * dipRec.norm_Frobenius());
1050
1051 if (alpha > 1.0) alpha = 1.0;
1052 if (alpha < -1.0) alpha = -1.0;
1053
1054 double dphi = acos(alpha) / 2.0 / M_PI; // in cycles
1055
1056 if ( DotProduct(rho, crossproduct(dipSat, dipRec)) < 0.0 ) {
1057 dphi = -dphi;
1058 }
1059
1060 _windUpSum[prn] = floor(_windUpSum[prn] - dphi + 0.5) + dphi;
1061 }
1062
1063 return _windUpSum[prn];
1064}
1065
1066//
1067///////////////////////////////////////////////////////////////////////////
1068void bncModel::cmpEle(t_satData* satData) {
1069 Tracer tracer("bncModel::cmpEle");
1070 ColumnVector rr = satData->xx - _xcBanc.Rows(1,3);
1071 double rho = rr.norm_Frobenius();
1072
1073 double neu[3];
1074 xyz2neu(_ellBanc.data(), rr.data(), neu);
1075
1076 satData->eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho );
1077 if (neu[2] < 0) {
1078 satData->eleSat *= -1.0;
1079 }
1080 satData->azSat = atan2(neu[1], neu[0]);
1081}
1082
1083//
1084///////////////////////////////////////////////////////////////////////////
1085void bncModel::addAmb(t_satData* satData) {
1086 Tracer tracer("bncModel::addAmb");
1087 bool found = false;
1088 for (int iPar = 1; iPar <= _params.size(); iPar++) {
1089 if (_params[iPar-1]->type == bncParam::AMB_L3 &&
1090 _params[iPar-1]->prn == satData->prn) {
1091 found = true;
1092 break;
1093 }
1094 }
1095 if (!found) {
1096 bncParam* par = new bncParam(bncParam::AMB_L3,
1097 _params.size()+1, satData->prn);
1098 _params.push_back(par);
1099 par->xx = satData->L3 - cmpValue(satData, true);
1100 }
1101}
1102
1103//
1104///////////////////////////////////////////////////////////////////////////
1105void bncModel::addObs(int iPhase, unsigned& iObs, t_satData* satData,
1106 Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP) {
1107
1108 Tracer tracer("bncModel::addObs");
1109
1110 const double ELEWGHT = 20.0;
1111 double ellWgtCoef = 1.0;
1112 double eleD = satData->eleSat * 180.0 / M_PI;
1113 if (eleD < ELEWGHT) {
1114 ellWgtCoef = 1.5 - 0.5 / (ELEWGHT - 10.0) * (eleD - 10.0);
1115 }
1116
1117 // Remember Observation Index
1118 // --------------------------
1119 ++iObs;
1120 satData->index = iObs;
1121
1122 // Phase Observations
1123 // ------------------
1124 if (iPhase == 1) {
1125 ll(iObs) = satData->L3 - cmpValue(satData, true);
1126 PP(iObs,iObs) = 1.0 / (_sigL3 * _sigL3) / (ellWgtCoef * ellWgtCoef);
1127 if (satData->system() == 'R') {
1128 PP(iObs,iObs) /= 25.0;
1129 }
1130 for (int iPar = 1; iPar <= _params.size(); iPar++) {
1131 if (_params[iPar-1]->type == bncParam::AMB_L3 &&
1132 _params[iPar-1]->prn == satData->prn) {
1133 ll(iObs) -= _params[iPar-1]->xx;
1134 }
1135 AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
1136 }
1137 }
1138
1139 // Code Observations
1140 // -----------------
1141 else {
1142 ll(iObs) = satData->P3 - cmpValue(satData, false);
1143 PP(iObs,iObs) = 1.0 / (_sigP3 * _sigP3) / (ellWgtCoef * ellWgtCoef);
1144 for (int iPar = 1; iPar <= _params.size(); iPar++) {
1145 AA(iObs, iPar) = _params[iPar-1]->partial(satData, false);
1146 }
1147 }
1148}
1149
1150//
1151///////////////////////////////////////////////////////////////////////////
1152void bncModel::printRes(int iPhase, const ColumnVector& vv,
1153 ostringstream& str, t_satData* satData) {
1154 Tracer tracer("bncModel::printRes");
1155
1156 if (satData->index != 0) {
1157 str << _time.timestr(1)
1158 << " RES " << satData->prn.toAscii().data()
1159 << (iPhase ? " L3 " : " P3 ")
1160 << setw(9) << setprecision(4) << vv(satData->index) << endl;
1161 }
1162}
1163
1164//
1165///////////////////////////////////////////////////////////////////////////
1166void bncModel::findMaxRes(const ColumnVector& vv,
1167 const QMap<QString, t_satData*>& satData,
1168 QString& prn, double& maxRes) {
1169
1170 Tracer tracer("bncModel::findMaxRes");
1171
1172 maxRes = 0.0;
1173
1174 QMapIterator<QString, t_satData*> it(satData);
1175 while (it.hasNext()) {
1176 it.next();
1177 t_satData* satData = it.value();
1178 if (satData->index != 0 && fabs(vv(satData->index)) > maxRes) {
1179 maxRes = fabs(vv(satData->index));
1180 prn = satData->prn;
1181 }
1182 }
1183}
1184
1185bool findInVector(const std::vector<QString>& vv, const QString& str) {
1186 std::vector<QString>::const_iterator it;
1187 for (it = vv.begin(); it != vv.end(); ++it) {
1188 if ( (*it) == str) {
1189 return true;
1190 }
1191 }
1192 return false;
1193}
1194
1195// Update Step (private - loop over outliers)
1196////////////////////////////////////////////////////////////////////////////
1197t_irc bncModel::update_p(t_epoData* epoData) {
1198
1199 Tracer tracer("bncModel::update_p");
1200
1201 // Bancroft Solution
1202 // -----------------
1203 if (cmpBancroft(epoData) != success) {
1204 return failure;
1205 }
1206
1207 rememberState(epoData);
1208
1209 ColumnVector dx;
1210
1211 std::vector<QString> allPrns;
1212 QMapIterator<QString, t_satData*> it(epoData->satData);
1213 while (it.hasNext()) {
1214 it.next();
1215 t_satData* satData = it.value();
1216 allPrns.push_back(satData->prn);
1217 }
1218 std::vector<QString> usedPrns;
1219
1220 // Try with all satellites, then with all minus one, etc.
1221 // ------------------------------------------------------
1222 for (unsigned nNeglected = 0; nNeglected <= allPrns.size() - MINOBS; nNeglected++) {
1223 usedPrns = allPrns;
1224
1225 for (unsigned ii = 0; ii < nNeglected && usedPrns.size() > 0; ii++) {
1226 usedPrns.pop_back();
1227 }
1228
1229 bool outlierDetected = false;
1230
1231 // Loop over all Combinations of "nUsed" Satellites
1232 // ------------------------------------------------
1233 do {
1234
1235 if (outlierDetected) {
1236 _log += "TRY WITH PRNs: ";
1237 for (unsigned ip = 0; ip < usedPrns.size(); ip++) {
1238 _log += usedPrns[ip] + ' ';
1239 }
1240 _log += '\n';
1241 }
1242
1243 // Remove Neglected Satellites from epoData
1244 // ----------------------------------------
1245 for (unsigned ip = 0; ip < allPrns.size(); ip++) {
1246 QString prn = allPrns[ip];
1247 if ( !findInVector(usedPrns, prn) ) {
1248 epoData->satData.remove(prn);
1249 }
1250 }
1251 if (epoData->sizeSys('G') < MINOBS) {
1252 continue;
1253 }
1254
1255 // First update using code observations, then phase observations
1256 // -------------------------------------------------------------
1257 for (int iPhase = 0; iPhase <= (_usePhase ? 1 : 0); iPhase++) {
1258
1259 // Status Prediction
1260 // -----------------
1261 predict(iPhase, epoData);
1262
1263 // Create First-Design Matrix
1264 // --------------------------
1265 unsigned nPar = _params.size();
1266 unsigned nObs = 0;
1267 if (iPhase == 0) {
1268 nObs = epoData->sizeAll() - epoData->sizeSys('R'); // Glonass code not used
1269 }
1270 else {
1271 nObs = epoData->sizeAll();
1272 }
1273
1274 Matrix AA(nObs, nPar); // first design matrix
1275 ColumnVector ll(nObs); // tems observed-computed
1276 DiagonalMatrix PP(nObs); PP = 0.0;
1277
1278 unsigned iObs = 0;
1279
1280 // GPS
1281 // ---
1282 QMapIterator<QString, t_satData*> it(epoData->satData);
1283 while (it.hasNext()) {
1284 it.next();
1285 t_satData* satData = it.value();
1286 if (iPhase == 1 || satData->system() != 'R') {
1287 QString prn = satData->prn;
1288 addObs(iPhase, iObs, satData, AA, ll, PP);
1289 }
1290 }
1291
1292 // Compute Filter Update
1293 // ---------------------
1294 kalman(AA, ll, PP, _QQ, dx);
1295
1296 ColumnVector vv = ll - AA * dx;
1297
1298 // Print Residuals
1299 // ---------------
1300 if (true) {
1301 ostringstream str;
1302 str.setf(ios::fixed);
1303
1304 QMapIterator<QString, t_satData*> it(epoData->satData);
1305 while (it.hasNext()) {
1306 it.next();
1307 t_satData* satData = it.value();
1308 if (iPhase == 1 || satData->system() != 'R') {
1309 printRes(iPhase, vv, str, satData);
1310 }
1311 }
1312 _log += str.str().c_str();
1313 }
1314
1315 // Check the residuals
1316 // -------------------
1317 outlierDetected = outlierDetection(iPhase, vv, epoData->satData);
1318
1319 if (outlierDetected) {
1320 restoreState(epoData);
1321 break;
1322 }
1323
1324 } // for (int iPhase = 0; iPhase <= (_usePhase ? 1 : 0); iPhase++)
1325
1326 // Update Parameters
1327 // -----------------
1328 if (!outlierDetected) {
1329 QVectorIterator<bncParam*> itPar(_params);
1330 while (itPar.hasNext()) {
1331 bncParam* par = itPar.next();
1332 par->xx += dx(par->index);
1333 }
1334 return success;
1335 }
1336
1337 } while ( next_combination(allPrns.begin(), allPrns.end(),
1338 usedPrns.begin(), usedPrns.end()) );
1339
1340 } // for (unsigned nUsed = allPrns.size(); nUsed >= MINOBS; nUsed--)
1341
1342 return failure;
1343}
1344
1345// Remeber Original State Vector and Variance-Covariance Matrix
1346////////////////////////////////////////////////////////////////////////////
1347void bncModel::rememberState(t_epoData* epoData) {
1348
1349 _QQ_sav = _QQ;
1350
1351 QVectorIterator<bncParam*> itSav(_params_sav);
1352 while (itSav.hasNext()) {
1353 bncParam* par = itSav.next();
1354 delete par;
1355 }
1356 _params_sav.clear();
1357
1358 QVectorIterator<bncParam*> it(_params);
1359 while (it.hasNext()) {
1360 bncParam* par = it.next();
1361 _params_sav.push_back(new bncParam(*par));
1362 }
1363
1364 _epoData_sav->deepCopy(epoData);
1365}
1366
1367// Restore Original State Vector and Variance-Covariance Matrix
1368////////////////////////////////////////////////////////////////////////////
1369void bncModel::restoreState(t_epoData* epoData) {
1370
1371 _QQ = _QQ_sav;
1372
1373 QVectorIterator<bncParam*> it(_params);
1374 while (it.hasNext()) {
1375 bncParam* par = it.next();
1376 delete par;
1377 }
1378 _params.clear();
1379
1380 QVectorIterator<bncParam*> itSav(_params_sav);
1381 while (itSav.hasNext()) {
1382 bncParam* par = itSav.next();
1383 _params.push_back(new bncParam(*par));
1384 }
1385
1386 epoData->deepCopy(_epoData_sav);
1387}
Note: See TracBrowser for help on using the repository browser.