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

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