source: ntrip/trunk/BNC/combination/bnccomb.cpp@ 3184

Last change on this file since 3184 was 3184, checked in by mervart, 13 years ago
File size: 20.7 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: bncComb
6 *
7 * Purpose: Combinations of Orbit/Clock Corrections
8 *
9 * Author: L. Mervart
10 *
11 * Created: 22-Jan-2011
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include <newmatio.h>
18#include <iomanip>
19
20#include "bnccomb.h"
21#include "bncapp.h"
22#include "cmbcaster.h"
23#include "bncsettings.h"
24#include "bncmodel.h"
25#include "bncutils.h"
26#include "bncpppclient.h"
27#include "bncsp3.h"
28#include "bncantex.h"
29#include "bnctides.h"
30
31using namespace std;
32
33const int MAXPRN_GPS = 32;
34
35// Constructor
36////////////////////////////////////////////////////////////////////////////
37cmbParam::cmbParam(cmbParam::parType type_, int index_,
38 const QString& ac_, const QString& prn_,
39 double sig_0_, double sig_P_) {
40
41 type = type_;
42 index = index_;
43 AC = ac_;
44 prn = prn_;
45 sig_0 = sig_0_;
46 sig_P = sig_P_;
47 xx = 0.0;
48}
49
50// Destructor
51////////////////////////////////////////////////////////////////////////////
52cmbParam::~cmbParam() {
53}
54
55// Partial
56////////////////////////////////////////////////////////////////////////////
57double cmbParam::partial(const QString& AC_, t_corr* corr) {
58
59 if (type == AC_offset) {
60 if (AC == AC_) {
61 return 1.0;
62 }
63 }
64 else if (type == Sat_offset) {
65 if (AC == AC_ && prn == corr->prn) {
66 return 1.0;
67 }
68 }
69 else if (type == clk) {
70 if (prn == corr->prn) {
71 return 1.0;
72 }
73 }
74
75 return 0.0;
76}
77
78//
79////////////////////////////////////////////////////////////////////////////
80QString cmbParam::toString() const {
81
82 QString outStr;
83
84 if (type == AC_offset) {
85 outStr = "AC offset " + AC;
86 }
87 else if (type == Sat_offset) {
88 outStr = "Sat Offset " + AC + " " + prn;
89 }
90 else if (type == clk) {
91 outStr = "Clk Corr " + prn;
92 }
93
94 return outStr;
95}
96
97// Constructor
98////////////////////////////////////////////////////////////////////////////
99bncComb::bncComb() {
100
101 bncSettings settings;
102
103 QStringList combineStreams = settings.value("combineStreams").toStringList();
104
105 if (combineStreams.size() >= 1 && !combineStreams[0].isEmpty()) {
106 QListIterator<QString> it(combineStreams);
107 while (it.hasNext()) {
108 QStringList hlp = it.next().split(" ");
109 cmbAC* newAC = new cmbAC();
110 newAC->mountPoint = hlp[0];
111 newAC->name = hlp[1];
112 newAC->weight = hlp[2].toDouble();
113 if (_masterAC.isEmpty()) {
114 _masterAC = newAC->name;
115 }
116 _ACs[newAC->mountPoint] = newAC;
117 }
118 }
119
120 _caster = new cmbCaster();
121 connect(this, SIGNAL(newMessage(QByteArray,bool)),
122 ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
123
124
125 // A Priori Sigmas (in Meters)
126 // ---------------------------
127 double sigAC_0 = 100.0;
128 double sigAC_P = 100.0;
129 double sigSat_0 = 100.0;
130 double sigSat_P = 0.0;
131 double sigClk_0 = 100.0;
132 double sigClk_P = 100.0;
133
134 // Initialize Parameters (model: Clk_Corr = AC_Offset + Sat_Offset + Clk)
135 // ----------------------------------------------------------------------
136 int nextPar = 0;
137 QMapIterator<QString, cmbAC*> it(_ACs);
138 while (it.hasNext()) {
139 it.next();
140 cmbAC* AC = it.value();
141 _params.push_back(new cmbParam(cmbParam::AC_offset, ++nextPar,
142 AC->name, "", sigAC_0, sigAC_P));
143 for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
144 QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
145 _params.push_back(new cmbParam(cmbParam::Sat_offset, ++nextPar,
146 AC->name, prn, sigSat_0, sigSat_P));
147 }
148 }
149 for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
150 QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
151 _params.push_back(new cmbParam(cmbParam::clk, ++nextPar, "", prn,
152 sigClk_0, sigClk_P));
153 }
154
155 // Initialize Variance-Covariance Matrix
156 // -------------------------------------
157 _QQ.ReSize(_params.size());
158 _QQ = 0.0;
159 for (int iPar = 1; iPar <= _params.size(); iPar++) {
160 cmbParam* pp = _params[iPar-1];
161 _QQ(iPar,iPar) = pp->sig_0 * pp->sig_0;
162 }
163
164 // Output File (skeleton name)
165 // ---------------------------
166 QString path = settings.value("cmbOutPath").toString();
167 if (!path.isEmpty() && !_caster->mountpoint().isEmpty()) {
168 expandEnvVar(path);
169 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
170 path += QDir::separator();
171 }
172 _outNameSkl = path + _caster->mountpoint();
173 }
174 _out = 0;
175
176 // SP3 writer
177 // ----------
178 if ( settings.value("cmbSP3Path").toString().isEmpty() ) {
179 _sp3 = 0;
180 }
181 else {
182 QString sklFileName = settings.value("cmbSP3Path").toString()
183 + QDir::separator() + "BNC.sp3";
184 QString interval = "";
185 int sampl = 0;
186 _sp3 = new bncSP3(sklFileName, interval, sampl);
187 }
188
189 // ANTEX File
190 // ----------
191 _antex = 0;
192 QString antexFileName = settings.value("pppAntex").toString();
193 if (!antexFileName.isEmpty()) {
194 _antex = new bncAntex();
195 if (_antex->readFile(antexFileName) != success) {
196 emit newMessage("wrong ANTEX file", true);
197 delete _antex;
198 _antex = 0;
199 }
200 }
201
202 // Not yet regularized
203 // -------------------
204 _firstReg = false;
205}
206
207// Destructor
208////////////////////////////////////////////////////////////////////////////
209bncComb::~bncComb() {
210 QMapIterator<QString, cmbAC*> it(_ACs);
211 while (it.hasNext()) {
212 it.next();
213 delete it.value();
214 }
215 delete _caster;
216 delete _out;
217 delete _sp3;
218 delete _antex;
219}
220
221// Read and store one correction line
222////////////////////////////////////////////////////////////////////////////
223void bncComb::processCorrLine(const QString& staID, const QString& line) {
224 QMutexLocker locker(&_mutex);
225
226 // Find the relevant instance of cmbAC class
227 // -----------------------------------------
228 if (_ACs.find(staID) == _ACs.end()) {
229 return;
230 }
231 cmbAC* AC = _ACs[staID];
232
233 // Read the Correction
234 // -------------------
235 t_corr* newCorr = new t_corr();
236 if (!newCorr->readLine(line) == success) {
237 delete newCorr;
238 return;
239 }
240
241 // Reject delayed corrections
242 // --------------------------
243 if (_processedBeforeTime.valid() && newCorr->tt < _processedBeforeTime) {
244 delete newCorr;
245 return;
246 }
247
248 // Check the Ephemeris
249 //--------------------
250 if (_eph.find(newCorr->prn) == _eph.end()) {
251 delete newCorr;
252 return;
253 }
254 else {
255 t_eph* lastEph = _eph[newCorr->prn]->last;
256 t_eph* prevEph = _eph[newCorr->prn]->prev;
257 if (lastEph && lastEph->IOD() == newCorr->iod) {
258 newCorr->eph = lastEph;
259 }
260 else if (prevEph && prevEph->IOD() == newCorr->iod) {
261 newCorr->eph = prevEph;
262 }
263 else {
264 delete newCorr;
265 return;
266 }
267 }
268
269 // Process all older Epochs (if there are any)
270 // -------------------------------------------
271 const double waitTime = 5.0; // wait 5 sec
272 _processedBeforeTime = newCorr->tt - waitTime;
273
274 QList<cmbEpoch*> epochsToProcess;
275
276 QMapIterator<QString, cmbAC*> itAC(_ACs);
277 while (itAC.hasNext()) {
278 itAC.next();
279 cmbAC* AC = itAC.value();
280
281 QMutableListIterator<cmbEpoch*> itEpo(AC->epochs);
282 while (itEpo.hasNext()) {
283 cmbEpoch* epoch = itEpo.next();
284 if (epoch->time < _processedBeforeTime) {
285 epochsToProcess.append(epoch);
286 itEpo.remove();
287 }
288 }
289 }
290
291 if (epochsToProcess.size()) {
292 processEpochs(epochsToProcess);
293 }
294
295 // Check Modulo Time
296 // -----------------
297 const int moduloTime = 10;
298 if (int(newCorr->tt.gpssec()) % moduloTime != 0.0) {
299 delete newCorr;
300 return;
301 }
302
303 // Find/Create the instance of cmbEpoch class
304 // ------------------------------------------
305 cmbEpoch* newEpoch = 0;
306 QListIterator<cmbEpoch*> it(AC->epochs);
307 while (it.hasNext()) {
308 cmbEpoch* hlpEpoch = it.next();
309 if (hlpEpoch->time == newCorr->tt) {
310 newEpoch = hlpEpoch;
311 break;
312 }
313 }
314 if (newEpoch == 0) {
315 newEpoch = new cmbEpoch(AC->name);
316 newEpoch->time = newCorr->tt;
317 AC->epochs.append(newEpoch);
318 }
319
320 // Merge or add the correction
321 // ---------------------------
322 if (newEpoch->corr.find(newCorr->prn) != newEpoch->corr.end()) {
323 newEpoch->corr[newCorr->prn]->readLine(line); // merge (multiple messages)
324 }
325 else {
326 newEpoch->corr[newCorr->prn] = newCorr;
327 }
328}
329
330// Send results to caster
331////////////////////////////////////////////////////////////////////////////
332void bncComb::dumpResults(const bncTime& resTime,
333 const QMap<QString, t_corr*>& resCorr) {
334
335 _caster->open();
336
337 unsigned year, month, day;
338 resTime.civil_date (year, month, day);
339 double GPSweeks = resTime.gpssec();
340
341 struct ClockOrbit co;
342 memset(&co, 0, sizeof(co));
343 co.GPSEpochTime = (int)GPSweeks;
344 co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)
345 + 3 * 3600 - gnumleap(year, month, day);
346 co.ClockDataSupplied = 1;
347 co.OrbitDataSupplied = 1;
348 co.SatRefDatum = DATUM_ITRF;
349
350 struct Bias bias;
351 memset(&bias, 0, sizeof(bias));
352 bias.GPSEpochTime = (int)GPSweeks;
353 bias.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)
354 + 3 * 3600 - gnumleap(year, month, day);
355
356 QMapIterator<QString, t_corr*> it(resCorr);
357 while (it.hasNext()) {
358 it.next();
359 t_corr* corr = it.value();
360
361 struct ClockOrbit::SatData* sd = 0;
362 if (corr->prn[0] == 'G') {
363 sd = co.Sat + co.NumberOfGPSSat;
364 ++co.NumberOfGPSSat;
365 }
366 else if (corr->prn[0] == 'R') {
367 sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
368 ++co.NumberOfGLONASSSat;
369 }
370
371 if (sd != 0) {
372 sd->ID = corr->prn.mid(1).toInt();
373 sd->IOD = corr->iod;
374 sd->Clock.DeltaA0 = corr->dClk * t_CST::c;
375 sd->Orbit.DeltaRadial = corr->rao(1);
376 sd->Orbit.DeltaAlongTrack = corr->rao(2);
377 sd->Orbit.DeltaCrossTrack = corr->rao(3);
378 sd->Orbit.DotDeltaRadial = corr->dotRao(1);
379 sd->Orbit.DotDeltaAlongTrack = corr->dotRao(2);
380 sd->Orbit.DotDeltaCrossTrack = corr->dotRao(3);
381 }
382
383 struct Bias::BiasSat* biasSat = 0;
384 if (corr->prn[0] == 'G') {
385 biasSat = bias.Sat + bias.NumberOfGPSSat;
386 ++bias.NumberOfGPSSat;
387 }
388 else if (corr->prn[0] == 'R') {
389 biasSat = bias.Sat + CLOCKORBIT_NUMGPS + bias.NumberOfGLONASSSat;
390 ++bias.NumberOfGLONASSSat;
391 }
392
393 // Coefficient of Ionosphere-Free LC
394 // ---------------------------------
395 const static double a_L1_GPS = 2.54572778;
396 const static double a_L2_GPS = -1.54572778;
397 const static double a_L1_Glo = 2.53125000;
398 const static double a_L2_Glo = -1.53125000;
399
400 if (biasSat) {
401 biasSat->ID = corr->prn.mid(1).toInt();
402 biasSat->NumberOfCodeBiases = 3;
403 if (corr->prn[0] == 'G') {
404 biasSat->Biases[0].Type = CODETYPEGPS_L1_Z;
405 biasSat->Biases[0].Bias = - a_L2_GPS * 0.0; // xx(10);
406 biasSat->Biases[1].Type = CODETYPEGPS_L1_CA;
407 biasSat->Biases[1].Bias = - a_L2_GPS * 0.0; // xx(10) + xx(9);
408 biasSat->Biases[2].Type = CODETYPEGPS_L2_Z;
409 biasSat->Biases[2].Bias = a_L1_GPS * 0.0; // xx(10);
410 }
411 else if (corr->prn[0] == 'R') {
412 biasSat->Biases[0].Type = CODETYPEGLONASS_L1_P;
413 biasSat->Biases[0].Bias = - a_L2_Glo * 0.0; // xx(10);
414 biasSat->Biases[1].Type = CODETYPEGLONASS_L1_CA;
415 biasSat->Biases[1].Bias = - a_L2_Glo * 0.0; // xx(10) + xx(9);
416 biasSat->Biases[2].Type = CODETYPEGLONASS_L2_P;
417 biasSat->Biases[2].Bias = a_L1_Glo * 0.0; // xx(10);
418 }
419 }
420
421 // SP3 Output
422 // ----------
423 if (_sp3) {
424 ColumnVector xc(4);
425 ColumnVector vv(3);
426 corr->eph->position(resTime.gpsw(), resTime.gpssec(),
427 xc.data(), vv.data());
428 bncPPPclient::applyCorr(resTime, corr, xc, vv);
429
430 // Relativistic Correction
431 // -----------------------
432 xc(4) += 2.0 * DotProduct(xc.Rows(1,3),vv) / t_CST::c / t_CST::c;
433
434 // Correction Phase Center --> CoM
435 // -------------------------------
436 if (_antex) {
437 ColumnVector dx(3); dx = 0.0;
438 double Mjd = resTime.mjd() + resTime.daysec()/86400.0;
439 if (_antex->satCoMcorrection(corr->prn, Mjd, xc.Rows(1,3), dx) == success) {
440 xc(1) -= dx(1);
441 xc(2) -= dx(2);
442 xc(3) -= dx(3);
443 }
444 else {
445 cout << "antenna not found" << endl;
446 }
447 }
448 _sp3->write(resTime.gpsw(), resTime.gpssec(), corr->prn, xc);
449 }
450
451 delete corr;
452 }
453
454 // Send Corrections to Caster
455 // --------------------------
456 if ( _caster->usedSocket() &&
457 (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
458 char obuffer[CLOCKORBIT_BUFFERSIZE];
459 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
460 if (len > 0) {
461 _caster->write(obuffer, len);
462 }
463 }
464
465 if ( _caster->usedSocket() &&
466 (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0) ) {
467 char obuffer[CLOCKORBIT_BUFFERSIZE];
468 int len = MakeBias(&bias, BTYPE_AUTO, 0, obuffer, sizeof(obuffer));
469 if (len > 0) {
470 _caster->write(obuffer, len);
471 }
472 }
473
474 // Optionall send new Corrections to PPP client and/or write into file
475 // -------------------------------------------------------------------
476 RTCM3coDecoder::reopen(_outNameSkl, _outName, _out);
477 bncApp* app = (bncApp*) qApp;
478 if (app->_bncPPPclient || _out) {
479 QStringList corrLines;
480 co.messageType = COTYPE_GPSCOMBINED;
481 QStringListIterator il(RTCM3coDecoder::corrsToASCIIlines(resTime.gpsw(),
482 resTime.gpssec(), co, 0));
483 while (il.hasNext()) {
484 QString line = il.next();
485 if (_out) {
486 *_out << line.toAscii().data() << endl;
487 _out->flush();
488 }
489 line += " " + _caster->mountpoint();
490 corrLines << line;
491 }
492
493 if (app->_bncPPPclient) {
494 app->_bncPPPclient->slotNewCorrections(corrLines);
495 }
496 }
497}
498
499// Change the correction so that it refers to last received ephemeris
500////////////////////////////////////////////////////////////////////////////
501void bncComb::switchToLastEph(const t_eph* lastEph, t_corr* corr) {
502
503 ColumnVector oldXC(4);
504 ColumnVector oldVV(3);
505 corr->eph->position(corr->tt.gpsw(), corr->tt.gpssec(),
506 oldXC.data(), oldVV.data());
507
508 ColumnVector newXC(4);
509 ColumnVector newVV(3);
510 lastEph->position(corr->tt.gpsw(), corr->tt.gpssec(),
511 newXC.data(), newVV.data());
512
513 ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
514 ColumnVector dV = newVV - oldVV;
515 double dC = newXC(4) - oldXC(4);
516
517 ColumnVector dRAO(3);
518 XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
519
520 ColumnVector dDotRAO(3);
521 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
522
523 QString msg = "switch " + corr->prn
524 + QString(" %1 -> %2 %3").arg(corr->iod,3)
525 .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
526
527 emit newMessage(msg.toAscii(), false);
528
529 corr->iod = lastEph->IOD();
530 corr->eph = lastEph;
531 corr->rao += dRAO;
532 corr->dotRao += dDotRAO;
533 corr->dClk -= dC;
534}
535
536// Process Epochs
537////////////////////////////////////////////////////////////////////////////
538void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) {
539
540 _log.clear();
541
542 QTextStream out(&_log, QIODevice::WriteOnly);
543
544 out << "Combination:" << endl
545 << "------------------------------" << endl;
546
547 // Predict Parameters Values, Add White Noise
548 // ------------------------------------------
549 for (int iPar = 1; iPar <= _params.size(); iPar++) {
550 cmbParam* pp = _params[iPar-1];
551 if (pp->sig_P != 0.0) {
552 pp->xx = 0.0;
553 for (int jj = 1; jj <= _params.size(); jj++) {
554 _QQ(iPar, jj) = 0.0;
555 }
556 _QQ(iPar,iPar) = pp->sig_P * pp->sig_P;
557 }
558 }
559
560 bncTime resTime = epochs.first()->time;
561 QMap<QString, t_corr*> resCorr;
562
563 int nPar = _params.size();
564 int nObs = 0;
565
566 ColumnVector x0(nPar);
567 for (int iPar = 1; iPar <= _params.size(); iPar++) {
568 cmbParam* pp = _params[iPar-1];
569 x0(iPar) = pp->xx;
570 }
571
572 // Count Observations
573 // ------------------
574 QListIterator<cmbEpoch*> itEpo(epochs);
575 while (itEpo.hasNext()) {
576 cmbEpoch* epo = itEpo.next();
577 QMutableMapIterator<QString, t_corr*> itCorr(epo->corr);
578 while (itCorr.hasNext()) {
579 itCorr.next();
580 t_corr* corr = itCorr.value();
581
582 // Switch to last ephemeris
583 // ------------------------
584 t_eph* lastEph = _eph[corr->prn]->last;
585 if (lastEph == corr->eph) {
586 ++nObs;
587 }
588 else {
589 if (corr->eph == _eph[corr->prn]->prev) {
590 switchToLastEph(lastEph, corr);
591 ++nObs;
592 }
593 else {
594 itCorr.remove();
595 }
596 }
597 }
598 }
599
600 if (nObs > 0) {
601 const double Pl = 1.0 / (0.05 * 0.05);
602
603 const int nCon = (_firstReg == false) ? 1 + MAXPRN_GPS : 1;
604 Matrix AA(nObs+nCon, nPar); AA = 0.0;
605 ColumnVector ll(nObs+nCon); ll = 0.0;
606 DiagonalMatrix PP(nObs+nCon); PP = Pl;
607
608 int iObs = 0;
609 QListIterator<cmbEpoch*> itEpo(epochs);
610 while (itEpo.hasNext()) {
611 cmbEpoch* epo = itEpo.next();
612 QMapIterator<QString, t_corr*> itCorr(epo->corr);
613
614 while (itCorr.hasNext()) {
615 itCorr.next();
616 ++iObs;
617 t_corr* corr = itCorr.value();
618
619 if (epo->acName == _masterAC) {
620 resCorr[corr->prn] = new t_corr(*corr);
621 }
622
623 for (int iPar = 1; iPar <= _params.size(); iPar++) {
624 cmbParam* pp = _params[iPar-1];
625 AA(iObs, iPar) = pp->partial(epo->acName, corr);
626 }
627
628 ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
629 }
630
631 delete epo;
632 }
633
634 // Regularization
635 // --------------
636 const double Ph = 1.e6;
637 int iCond = 1;
638 PP(nObs+iCond) = Ph;
639 for (int iPar = 1; iPar <= _params.size(); iPar++) {
640 cmbParam* pp = _params[iPar-1];
641 if (pp->type == cmbParam::clk &&
642 AA.Column(iPar).maximum_absolute_value() > 0.0) {
643 AA(nObs+iCond, iPar) = 1.0;
644 }
645 }
646
647 if (!_firstReg) {
648 _firstReg = true;
649 for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
650 ++iCond;
651 QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
652 PP(nObs+1+iGps) = Ph;
653 for (int iPar = 1; iPar <= _params.size(); iPar++) {
654 cmbParam* pp = _params[iPar-1];
655 if (pp->type == cmbParam::Sat_offset && pp->prn == prn) {
656 AA(nObs+iCond, iPar) = 1.0;
657 }
658 }
659 }
660 }
661
662 const double MAXRES = 999.10; // TODO: make it an option
663
664 ColumnVector dx;
665 SymmetricMatrix QQ_sav = _QQ;
666
667 for (int ii = 1; ii < 10; ii++) {
668 bncModel::kalman(AA, ll, PP, _QQ, dx);
669 ColumnVector vv = ll - AA * dx;
670
671 int maxResIndex;
672 double maxRes = vv.maximum_absolute_value1(maxResIndex);
673 out.setRealNumberNotation(QTextStream::FixedNotation);
674 out.setRealNumberPrecision(3);
675 out << "Maximum Residuum " << maxRes << " (index " << maxResIndex << ")\n";
676
677 if (maxRes > MAXRES) {
678 out << "Outlier Detected" << endl;
679 _QQ = QQ_sav;
680 AA.Row(maxResIndex) = 0.0;
681 ll.Row(maxResIndex) = 0.0;
682 }
683 else {
684 break;
685 }
686 }
687
688 for (int iPar = 1; iPar <= _params.size(); iPar++) {
689 cmbParam* pp = _params[iPar-1];
690 pp->xx += dx(iPar);
691 if (pp->type == cmbParam::clk) {
692 if (resCorr.find(pp->prn) != resCorr.end()) {
693 resCorr[pp->prn]->dClk = pp->xx / t_CST::c;
694 }
695 }
696 out << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
697 out.setRealNumberNotation(QTextStream::FixedNotation);
698 out.setFieldWidth(8);
699 out.setRealNumberPrecision(4);
700 out << pp->toString() << " "
701 << pp->xx << " +- " << sqrt(_QQ(pp->index,pp->index)) << endl;
702 }
703 }
704
705 printResults(out, resTime, resCorr);
706 dumpResults(resTime, resCorr);
707
708 emit newMessage(_log, false);
709}
710
711// Print results to caster
712////////////////////////////////////////////////////////////////////////////
713void bncComb::printResults(QTextStream& out, const bncTime& resTime,
714 const QMap<QString, t_corr*>& resCorr) {
715
716 QMapIterator<QString, t_corr*> it(resCorr);
717 while (it.hasNext()) {
718 it.next();
719 t_corr* corr = it.value();
720 const t_eph* eph = corr->eph;
721 if (eph) {
722 double xx, yy, zz, cc;
723 eph->position(resTime.gpsw(), resTime.gpssec(), xx, yy, zz, cc);
724
725 out << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
726 out.setFieldWidth(3);
727 out << "Full Clock " << corr->prn << " " << corr->iod << " ";
728 out.setFieldWidth(14);
729 out << (cc + corr->dClk) * t_CST::c << endl;
730 }
731 else {
732 out << "bncComb::printResuls bug" << endl;
733 }
734 }
735}
Note: See TracBrowser for help on using the repository browser.