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

Last change on this file since 3181 was 3181, checked in by mervart, 13 years ago
File size: 20.8 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 prep = "BNC";
183 QString ext = ".sp3";
184 QString path = settings.value("cmbSP3Path").toString();
185 QString interval = "";
186 int sampl = 0;
187 _sp3 = new bncSP3(prep, ext, path, interval, sampl);
188 }
189
190 _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked;
191
192 // ANTEX File
193 // ----------
194 _antex = 0;
195 QString antexFileName = settings.value("pppAntex").toString();
196 if (!antexFileName.isEmpty()) {
197 _antex = new bncAntex();
198 if (_antex->readFile(antexFileName) != success) {
199 emit newMessage("wrong ANTEX file", true);
200 delete _antex;
201 _antex = 0;
202 }
203 }
204
205 // Not yet regularized
206 // -------------------
207 _firstReg = false;
208}
209
210// Destructor
211////////////////////////////////////////////////////////////////////////////
212bncComb::~bncComb() {
213 QMapIterator<QString, cmbAC*> it(_ACs);
214 while (it.hasNext()) {
215 it.next();
216 delete it.value();
217 }
218 delete _caster;
219 delete _out;
220 delete _sp3;
221 delete _antex;
222}
223
224// Read and store one correction line
225////////////////////////////////////////////////////////////////////////////
226void bncComb::processCorrLine(const QString& staID, const QString& line) {
227 QMutexLocker locker(&_mutex);
228
229 // Find the relevant instance of cmbAC class
230 // -----------------------------------------
231 if (_ACs.find(staID) == _ACs.end()) {
232 return;
233 }
234 cmbAC* AC = _ACs[staID];
235
236 // Read the Correction
237 // -------------------
238 t_corr* newCorr = new t_corr();
239 if (!newCorr->readLine(line) == success) {
240 delete newCorr;
241 return;
242 }
243
244 // Reject delayed corrections
245 // --------------------------
246 if (_processedBeforeTime.valid() && newCorr->tt < _processedBeforeTime) {
247 delete newCorr;
248 return;
249 }
250
251 // Check the Ephemeris
252 //--------------------
253 if (_eph.find(newCorr->prn) == _eph.end()) {
254 delete newCorr;
255 return;
256 }
257 else {
258 t_eph* lastEph = _eph[newCorr->prn]->last;
259 t_eph* prevEph = _eph[newCorr->prn]->prev;
260 if (lastEph && lastEph->IOD() == newCorr->iod) {
261 newCorr->eph = lastEph;
262 }
263 else if (prevEph && prevEph->IOD() == newCorr->iod) {
264 newCorr->eph = prevEph;
265 }
266 else {
267 delete newCorr;
268 return;
269 }
270 }
271
272 // Process all older Epochs (if there are any)
273 // -------------------------------------------
274 const double waitTime = 5.0; // wait 5 sec
275 _processedBeforeTime = newCorr->tt - waitTime;
276
277 QList<cmbEpoch*> epochsToProcess;
278
279 QMapIterator<QString, cmbAC*> itAC(_ACs);
280 while (itAC.hasNext()) {
281 itAC.next();
282 cmbAC* AC = itAC.value();
283
284 QMutableListIterator<cmbEpoch*> itEpo(AC->epochs);
285 while (itEpo.hasNext()) {
286 cmbEpoch* epoch = itEpo.next();
287 if (epoch->time < _processedBeforeTime) {
288 epochsToProcess.append(epoch);
289 itEpo.remove();
290 }
291 }
292 }
293
294 if (epochsToProcess.size()) {
295 processEpochs(epochsToProcess);
296 }
297
298 // Check Modulo Time
299 // -----------------
300 const int moduloTime = 10;
301 if (int(newCorr->tt.gpssec()) % moduloTime != 0.0) {
302 delete newCorr;
303 return;
304 }
305
306 // Find/Create the instance of cmbEpoch class
307 // ------------------------------------------
308 cmbEpoch* newEpoch = 0;
309 QListIterator<cmbEpoch*> it(AC->epochs);
310 while (it.hasNext()) {
311 cmbEpoch* hlpEpoch = it.next();
312 if (hlpEpoch->time == newCorr->tt) {
313 newEpoch = hlpEpoch;
314 break;
315 }
316 }
317 if (newEpoch == 0) {
318 newEpoch = new cmbEpoch(AC->name);
319 newEpoch->time = newCorr->tt;
320 AC->epochs.append(newEpoch);
321 }
322
323 // Merge or add the correction
324 // ---------------------------
325 if (newEpoch->corr.find(newCorr->prn) != newEpoch->corr.end()) {
326 newEpoch->corr[newCorr->prn]->readLine(line); // merge (multiple messages)
327 }
328 else {
329 newEpoch->corr[newCorr->prn] = newCorr;
330 }
331}
332
333// Send results to caster
334////////////////////////////////////////////////////////////////////////////
335void bncComb::dumpResults(const bncTime& resTime,
336 const QMap<QString, t_corr*>& resCorr) {
337
338 _caster->open();
339
340 unsigned year, month, day;
341 resTime.civil_date (year, month, day);
342 double GPSweeks = resTime.gpssec();
343
344 struct ClockOrbit co;
345 memset(&co, 0, sizeof(co));
346 co.GPSEpochTime = (int)GPSweeks;
347 co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)
348 + 3 * 3600 - gnumleap(year, month, day);
349 co.ClockDataSupplied = 1;
350 co.OrbitDataSupplied = 1;
351 co.SatRefDatum = DATUM_ITRF;
352
353 struct Bias bias;
354 memset(&bias, 0, sizeof(bias));
355 bias.GPSEpochTime = (int)GPSweeks;
356 bias.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)
357 + 3 * 3600 - gnumleap(year, month, day);
358
359 QMapIterator<QString, t_corr*> it(resCorr);
360 while (it.hasNext()) {
361 it.next();
362 t_corr* corr = it.value();
363
364 struct ClockOrbit::SatData* sd = 0;
365 if (corr->prn[0] == 'G') {
366 sd = co.Sat + co.NumberOfGPSSat;
367 ++co.NumberOfGPSSat;
368 }
369 else if (corr->prn[0] == 'R') {
370 sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
371 ++co.NumberOfGLONASSSat;
372 }
373
374 if (sd != 0) {
375 sd->ID = corr->prn.mid(1).toInt();
376 sd->IOD = corr->iod;
377 sd->Clock.DeltaA0 = corr->dClk * t_CST::c;
378 sd->Orbit.DeltaRadial = corr->rao(1);
379 sd->Orbit.DeltaAlongTrack = corr->rao(2);
380 sd->Orbit.DeltaCrossTrack = corr->rao(3);
381 sd->Orbit.DotDeltaRadial = corr->dotRao(1);
382 sd->Orbit.DotDeltaAlongTrack = corr->dotRao(2);
383 sd->Orbit.DotDeltaCrossTrack = corr->dotRao(3);
384 }
385
386 struct Bias::BiasSat* biasSat = 0;
387 if (corr->prn[0] == 'G') {
388 biasSat = bias.Sat + bias.NumberOfGPSSat;
389 ++bias.NumberOfGPSSat;
390 }
391 else if (corr->prn[0] == 'R') {
392 biasSat = bias.Sat + CLOCKORBIT_NUMGPS + bias.NumberOfGLONASSSat;
393 ++bias.NumberOfGLONASSSat;
394 }
395
396 // Coefficient of Ionosphere-Free LC
397 // ---------------------------------
398 const static double a_L1_GPS = 2.54572778;
399 const static double a_L2_GPS = -1.54572778;
400 const static double a_L1_Glo = 2.53125000;
401 const static double a_L2_Glo = -1.53125000;
402
403 if (biasSat) {
404 biasSat->ID = corr->prn.mid(1).toInt();
405 biasSat->NumberOfCodeBiases = 3;
406 if (corr->prn[0] == 'G') {
407 biasSat->Biases[0].Type = CODETYPEGPS_L1_Z;
408 biasSat->Biases[0].Bias = - a_L2_GPS * 0.0; // xx(10);
409 biasSat->Biases[1].Type = CODETYPEGPS_L1_CA;
410 biasSat->Biases[1].Bias = - a_L2_GPS * 0.0; // xx(10) + xx(9);
411 biasSat->Biases[2].Type = CODETYPEGPS_L2_Z;
412 biasSat->Biases[2].Bias = a_L1_GPS * 0.0; // xx(10);
413 }
414 else if (corr->prn[0] == 'R') {
415 biasSat->Biases[0].Type = CODETYPEGLONASS_L1_P;
416 biasSat->Biases[0].Bias = - a_L2_Glo * 0.0; // xx(10);
417 biasSat->Biases[1].Type = CODETYPEGLONASS_L1_CA;
418 biasSat->Biases[1].Bias = - a_L2_Glo * 0.0; // xx(10) + xx(9);
419 biasSat->Biases[2].Type = CODETYPEGLONASS_L2_P;
420 biasSat->Biases[2].Bias = a_L1_Glo * 0.0; // xx(10);
421 }
422 }
423
424 // SP3 Output
425 // ----------
426 if (_sp3) {
427 ColumnVector xc(4);
428 ColumnVector vv(3);
429 corr->eph->position(resTime.gpsw(), resTime.gpssec(),
430 xc.data(), vv.data());
431 bncPPPclient::applyCorr(resTime, corr, xc, vv);
432
433 // Relativistic Correction
434 // -----------------------
435 xc(4) += 2.0 * DotProduct(xc.Rows(1,3),vv) / t_CST::c / t_CST::c;
436
437 // Correction Phase Center --> CoM
438 // -------------------------------
439 if (_antex) {
440 ColumnVector dx(3); dx = 0.0;
441 double Mjd = resTime.mjd() + resTime.daysec()/86400.0;
442 if (_antex->satCoMcorrection(corr->prn, Mjd, xc.Rows(1,3), dx) == success) {
443 xc(1) -= dx(1);
444 xc(2) -= dx(2);
445 xc(3) -= dx(3);
446 }
447 else {
448 cout << "antenna not found" << endl;
449 }
450 }
451 _sp3->write(resTime.gpsw(), resTime.gpssec(), corr->prn, xc, _append);
452 }
453
454 delete corr;
455 }
456
457 // Send Corrections to Caster
458 // --------------------------
459 if ( _caster->usedSocket() &&
460 (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
461 char obuffer[CLOCKORBIT_BUFFERSIZE];
462 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
463 if (len > 0) {
464 _caster->write(obuffer, len);
465 }
466 }
467
468 if ( _caster->usedSocket() &&
469 (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0) ) {
470 char obuffer[CLOCKORBIT_BUFFERSIZE];
471 int len = MakeBias(&bias, BTYPE_AUTO, 0, obuffer, sizeof(obuffer));
472 if (len > 0) {
473 _caster->write(obuffer, len);
474 }
475 }
476
477 // Optionall send new Corrections to PPP client and/or write into file
478 // -------------------------------------------------------------------
479 RTCM3coDecoder::reopen(_outNameSkl, _outName, _out);
480 bncApp* app = (bncApp*) qApp;
481 if (app->_bncPPPclient || _out) {
482 QStringList corrLines;
483 co.messageType = COTYPE_GPSCOMBINED;
484 QStringListIterator il(RTCM3coDecoder::corrsToASCIIlines(resTime.gpsw(),
485 resTime.gpssec(), co, 0));
486 while (il.hasNext()) {
487 QString line = il.next();
488 if (_out) {
489 *_out << line.toAscii().data() << endl;
490 _out->flush();
491 }
492 line += " " + _caster->mountpoint();
493 corrLines << line;
494 }
495
496 if (app->_bncPPPclient) {
497 app->_bncPPPclient->slotNewCorrections(corrLines);
498 }
499 }
500}
501
502// Change the correction so that it refers to last received ephemeris
503////////////////////////////////////////////////////////////////////////////
504void bncComb::switchToLastEph(const t_eph* lastEph, t_corr* corr) {
505
506 ColumnVector oldXC(4);
507 ColumnVector oldVV(3);
508 corr->eph->position(corr->tt.gpsw(), corr->tt.gpssec(),
509 oldXC.data(), oldVV.data());
510
511 ColumnVector newXC(4);
512 ColumnVector newVV(3);
513 lastEph->position(corr->tt.gpsw(), corr->tt.gpssec(),
514 newXC.data(), newVV.data());
515
516 ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
517 ColumnVector dV = newVV - oldVV;
518 double dC = newXC(4) - oldXC(4);
519
520 ColumnVector dRAO(3);
521 XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
522
523 ColumnVector dDotRAO(3);
524 XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
525
526 QString msg = "switch " + corr->prn
527 + QString(" %1 -> %2 %3").arg(corr->iod,3)
528 .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
529
530 emit newMessage(msg.toAscii(), false);
531
532 corr->iod = lastEph->IOD();
533 corr->eph = lastEph;
534 corr->rao += dRAO;
535 corr->dotRao += dDotRAO;
536 corr->dClk -= dC;
537}
538
539// Process Epochs
540////////////////////////////////////////////////////////////////////////////
541void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) {
542
543 _log.clear();
544
545 QTextStream out(&_log, QIODevice::WriteOnly);
546
547 out << "Combination:" << endl
548 << "------------------------------" << endl;
549
550 // Predict Parameters Values, Add White Noise
551 // ------------------------------------------
552 for (int iPar = 1; iPar <= _params.size(); iPar++) {
553 cmbParam* pp = _params[iPar-1];
554 if (pp->sig_P != 0.0) {
555 pp->xx = 0.0;
556 for (int jj = 1; jj <= _params.size(); jj++) {
557 _QQ(iPar, jj) = 0.0;
558 }
559 _QQ(iPar,iPar) = pp->sig_P * pp->sig_P;
560 }
561 }
562
563 bncTime resTime = epochs.first()->time;
564 QMap<QString, t_corr*> resCorr;
565
566 int nPar = _params.size();
567 int nObs = 0;
568
569 ColumnVector x0(nPar);
570 for (int iPar = 1; iPar <= _params.size(); iPar++) {
571 cmbParam* pp = _params[iPar-1];
572 x0(iPar) = pp->xx;
573 }
574
575 // Count Observations
576 // ------------------
577 QListIterator<cmbEpoch*> itEpo(epochs);
578 while (itEpo.hasNext()) {
579 cmbEpoch* epo = itEpo.next();
580 QMutableMapIterator<QString, t_corr*> itCorr(epo->corr);
581 while (itCorr.hasNext()) {
582 itCorr.next();
583 t_corr* corr = itCorr.value();
584
585 // Switch to last ephemeris
586 // ------------------------
587 t_eph* lastEph = _eph[corr->prn]->last;
588 if (lastEph == corr->eph) {
589 ++nObs;
590 }
591 else {
592 if (corr->eph == _eph[corr->prn]->prev) {
593 switchToLastEph(lastEph, corr);
594 ++nObs;
595 }
596 else {
597 itCorr.remove();
598 }
599 }
600 }
601 }
602
603 if (nObs > 0) {
604 const double Pl = 1.0 / (0.05 * 0.05);
605
606 const int nCon = (_firstReg == false) ? 1 + MAXPRN_GPS : 1;
607 Matrix AA(nObs+nCon, nPar); AA = 0.0;
608 ColumnVector ll(nObs+nCon); ll = 0.0;
609 DiagonalMatrix PP(nObs+nCon); PP = Pl;
610
611 int iObs = 0;
612 QListIterator<cmbEpoch*> itEpo(epochs);
613 while (itEpo.hasNext()) {
614 cmbEpoch* epo = itEpo.next();
615 QMapIterator<QString, t_corr*> itCorr(epo->corr);
616
617 while (itCorr.hasNext()) {
618 itCorr.next();
619 ++iObs;
620 t_corr* corr = itCorr.value();
621
622 if (epo->acName == _masterAC) {
623 resCorr[corr->prn] = new t_corr(*corr);
624 }
625
626 for (int iPar = 1; iPar <= _params.size(); iPar++) {
627 cmbParam* pp = _params[iPar-1];
628 AA(iObs, iPar) = pp->partial(epo->acName, corr);
629 }
630
631 ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
632 }
633
634 delete epo;
635 }
636
637 // Regularization
638 // --------------
639 const double Ph = 1.e6;
640 int iCond = 1;
641 PP(nObs+iCond) = Ph;
642 for (int iPar = 1; iPar <= _params.size(); iPar++) {
643 cmbParam* pp = _params[iPar-1];
644 if (pp->type == cmbParam::clk &&
645 AA.Column(iPar).maximum_absolute_value() > 0.0) {
646 AA(nObs+iCond, iPar) = 1.0;
647 }
648 }
649
650 if (!_firstReg) {
651 _firstReg = true;
652 for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
653 ++iCond;
654 QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
655 PP(nObs+1+iGps) = Ph;
656 for (int iPar = 1; iPar <= _params.size(); iPar++) {
657 cmbParam* pp = _params[iPar-1];
658 if (pp->type == cmbParam::Sat_offset && pp->prn == prn) {
659 AA(nObs+iCond, iPar) = 1.0;
660 }
661 }
662 }
663 }
664
665 const double MAXRES = 999.10; // TODO: make it an option
666
667 ColumnVector dx;
668 SymmetricMatrix QQ_sav = _QQ;
669
670 for (int ii = 1; ii < 10; ii++) {
671 bncModel::kalman(AA, ll, PP, _QQ, dx);
672 ColumnVector vv = ll - AA * dx;
673
674 int maxResIndex;
675 double maxRes = vv.maximum_absolute_value1(maxResIndex);
676 out.setRealNumberNotation(QTextStream::FixedNotation);
677 out.setRealNumberPrecision(3);
678 out << "Maximum Residuum " << maxRes << " (index " << maxResIndex << ")\n";
679
680 if (maxRes > MAXRES) {
681 out << "Outlier Detected" << endl;
682 _QQ = QQ_sav;
683 AA.Row(maxResIndex) = 0.0;
684 ll.Row(maxResIndex) = 0.0;
685 }
686 else {
687 break;
688 }
689 }
690
691 for (int iPar = 1; iPar <= _params.size(); iPar++) {
692 cmbParam* pp = _params[iPar-1];
693 pp->xx += dx(iPar);
694 if (pp->type == cmbParam::clk) {
695 if (resCorr.find(pp->prn) != resCorr.end()) {
696 resCorr[pp->prn]->dClk = pp->xx / t_CST::c;
697 }
698 }
699 out << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
700 out.setRealNumberNotation(QTextStream::FixedNotation);
701 out.setFieldWidth(8);
702 out.setRealNumberPrecision(4);
703 out << pp->toString() << " "
704 << pp->xx << " +- " << sqrt(_QQ(pp->index,pp->index)) << endl;
705 }
706 }
707
708 printResults(out, resTime, resCorr);
709 dumpResults(resTime, resCorr);
710
711 emit newMessage(_log, false);
712}
713
714// Print results to caster
715////////////////////////////////////////////////////////////////////////////
716void bncComb::printResults(QTextStream& out, const bncTime& resTime,
717 const QMap<QString, t_corr*>& resCorr) {
718
719 QMapIterator<QString, t_corr*> it(resCorr);
720 while (it.hasNext()) {
721 it.next();
722 t_corr* corr = it.value();
723 const t_eph* eph = corr->eph;
724 if (eph) {
725 double xx, yy, zz, cc;
726 eph->position(resTime.gpsw(), resTime.gpssec(), xx, yy, zz, cc);
727
728 out << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
729 out.setFieldWidth(3);
730 out << "Full Clock " << corr->prn << " " << corr->iod << " ";
731 out.setFieldWidth(14);
732 out << (cc + corr->dClk) * t_CST::c << endl;
733 }
734 else {
735 out << "bncComb::printResuls bug" << endl;
736 }
737 }
738}
Note: See TracBrowser for help on using the repository browser.