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 |
|
---|
28 | using namespace std;
|
---|
29 |
|
---|
30 | // Constructor
|
---|
31 | ////////////////////////////////////////////////////////////////////////////
|
---|
32 | cmbParam::cmbParam(cmbParam::parType typeIn, int indexIn,
|
---|
33 | const QString& acIn, const QString& prnIn) {
|
---|
34 | type = typeIn;
|
---|
35 | index = indexIn;
|
---|
36 | AC = acIn;
|
---|
37 | prn = prnIn;
|
---|
38 | xx = 0.0;
|
---|
39 | iod = -1;
|
---|
40 | }
|
---|
41 |
|
---|
42 | // Destructor
|
---|
43 | ////////////////////////////////////////////////////////////////////////////
|
---|
44 | cmbParam::~cmbParam() {
|
---|
45 | }
|
---|
46 |
|
---|
47 | // Partial
|
---|
48 | ////////////////////////////////////////////////////////////////////////////
|
---|
49 | double cmbParam::partial(const QString& acIn, t_corr* corr) {
|
---|
50 |
|
---|
51 | if (type == AC_offset) {
|
---|
52 | if (AC == acIn) {
|
---|
53 | return 1.0;
|
---|
54 | }
|
---|
55 | }
|
---|
56 | else if (type == Sat_offset) {
|
---|
57 | if (AC == acIn && prn == corr->prn) {
|
---|
58 | return 1.0;
|
---|
59 | }
|
---|
60 | }
|
---|
61 | else if (type == clk) {
|
---|
62 | if (prn == corr->prn) {
|
---|
63 | return 1.0;
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | return 0.0;
|
---|
68 | }
|
---|
69 |
|
---|
70 | //
|
---|
71 | ////////////////////////////////////////////////////////////////////////////
|
---|
72 | QString cmbParam::toString() const {
|
---|
73 |
|
---|
74 | QString outStr;
|
---|
75 |
|
---|
76 | if (type == AC_offset) {
|
---|
77 | outStr = "AC offset " + AC;
|
---|
78 | }
|
---|
79 | else if (type == Sat_offset) {
|
---|
80 | outStr = "Sat Offset " + AC + " " + prn;
|
---|
81 | }
|
---|
82 | else if (type == clk) {
|
---|
83 | outStr = "Clk Corr " + prn;
|
---|
84 | }
|
---|
85 |
|
---|
86 | return outStr;
|
---|
87 | }
|
---|
88 |
|
---|
89 | // Constructor
|
---|
90 | ////////////////////////////////////////////////////////////////////////////
|
---|
91 | bncComb::bncComb() {
|
---|
92 |
|
---|
93 | bncSettings settings;
|
---|
94 |
|
---|
95 | QStringList combineStreams = settings.value("combineStreams").toStringList();
|
---|
96 |
|
---|
97 | if (combineStreams.size() >= 2) {
|
---|
98 | QListIterator<QString> it(combineStreams);
|
---|
99 | while (it.hasNext()) {
|
---|
100 | QStringList hlp = it.next().split(" ");
|
---|
101 | cmbAC* newAC = new cmbAC();
|
---|
102 | newAC->mountPoint = hlp[0];
|
---|
103 | newAC->name = hlp[1];
|
---|
104 | newAC->weight = hlp[2].toDouble();
|
---|
105 |
|
---|
106 | _ACs[newAC->mountPoint] = newAC;
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | _caster = new cmbCaster();
|
---|
111 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
112 | ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
|
---|
113 |
|
---|
114 | // Initialize Parameters
|
---|
115 | // ---------------------
|
---|
116 | int nextPar = 0;
|
---|
117 | QMapIterator<QString, cmbAC*> it(_ACs);
|
---|
118 | while (it.hasNext()) {
|
---|
119 | it.next();
|
---|
120 | cmbAC* AC = it.value();
|
---|
121 | _params.push_back(new cmbParam(cmbParam::AC_offset, ++nextPar, AC->name, ""));
|
---|
122 | }
|
---|
123 | it.toFront();
|
---|
124 | while (it.hasNext()) {
|
---|
125 | it.next();
|
---|
126 | cmbAC* AC = it.value();
|
---|
127 | for (int iGps = 1; iGps <= 32; iGps++) {
|
---|
128 | QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
|
---|
129 | _params.push_back(new cmbParam(cmbParam::Sat_offset, ++nextPar, AC->name, prn));
|
---|
130 | }
|
---|
131 | }
|
---|
132 | for (int iGps = 1; iGps <= 32; iGps++) {
|
---|
133 | QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
|
---|
134 | _params.push_back(new cmbParam(cmbParam::clk, ++nextPar, "", prn));
|
---|
135 | }
|
---|
136 |
|
---|
137 | unsigned nPar = _params.size();
|
---|
138 | _QQ.ReSize(nPar);
|
---|
139 | _QQ = 0.0;
|
---|
140 |
|
---|
141 | // Clk_Corr = AC_Offset + Sat_Offset + Clk
|
---|
142 | // ---------------------------------------
|
---|
143 | _sigACOff = 100.0; // per analysis center stream and epoch, sigma in meters
|
---|
144 | _sigSatOff = 100.0; // per analysis center stream and satellite, sigma in meters
|
---|
145 | _sigClk = 100.0; // per satellite and epoch, sigma in meters
|
---|
146 |
|
---|
147 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
148 | cmbParam* pp = _params[iPar-1];
|
---|
149 | if (pp->type == cmbParam::AC_offset) {
|
---|
150 | _QQ(iPar,iPar) = _sigACOff * _sigACOff;
|
---|
151 | }
|
---|
152 | else if (pp->type == cmbParam::Sat_offset) {
|
---|
153 | _QQ(iPar,iPar) = _sigSatOff * _sigSatOff;
|
---|
154 | }
|
---|
155 | else if (pp->type == cmbParam::clk) {
|
---|
156 | _QQ(iPar,iPar) = _sigClk * _sigClk;
|
---|
157 | }
|
---|
158 | }
|
---|
159 | }
|
---|
160 |
|
---|
161 | // Destructor
|
---|
162 | ////////////////////////////////////////////////////////////////////////////
|
---|
163 | bncComb::~bncComb() {
|
---|
164 | QMapIterator<QString, cmbAC*> it(_ACs);
|
---|
165 | while (it.hasNext()) {
|
---|
166 | it.next();
|
---|
167 | delete it.value();
|
---|
168 | }
|
---|
169 | delete _caster;
|
---|
170 | }
|
---|
171 |
|
---|
172 | // Read and store one correction line
|
---|
173 | ////////////////////////////////////////////////////////////////////////////
|
---|
174 | void bncComb::processCorrLine(const QString& staID, const QString& line) {
|
---|
175 | QMutexLocker locker(&_mutex);
|
---|
176 |
|
---|
177 | // Find the relevant instance of cmbAC class
|
---|
178 | // -----------------------------------------
|
---|
179 | if (_ACs.find(staID) == _ACs.end()) {
|
---|
180 | return;
|
---|
181 | }
|
---|
182 | cmbAC* AC = _ACs[staID];
|
---|
183 |
|
---|
184 | // Read the Correction
|
---|
185 | // -------------------
|
---|
186 | t_corr* newCorr = new t_corr();
|
---|
187 | if (!newCorr->readLine(line) == success) {
|
---|
188 | delete newCorr;
|
---|
189 | return;
|
---|
190 | }
|
---|
191 |
|
---|
192 | // Reject delayed corrections
|
---|
193 | // --------------------------
|
---|
194 | if (_processedBeforeTime.valid() && newCorr->tt < _processedBeforeTime) {
|
---|
195 | delete newCorr;
|
---|
196 | return;
|
---|
197 | }
|
---|
198 |
|
---|
199 | // Check the IOD
|
---|
200 | //--------------
|
---|
201 | if (_eph.find(newCorr->prn) == _eph.end()) {
|
---|
202 | delete newCorr;
|
---|
203 | return;
|
---|
204 | }
|
---|
205 | else {
|
---|
206 | t_eph* lastEph = _eph[newCorr->prn]->last;
|
---|
207 | t_eph* prevEph = _eph[newCorr->prn]->prev;
|
---|
208 | if (prevEph && prevEph->IOD() == newCorr->iod) {
|
---|
209 | switchToLastEph(AC->name, lastEph, prevEph, newCorr);
|
---|
210 | }
|
---|
211 | else if (!lastEph || lastEph->IOD() != newCorr->iod) {
|
---|
212 | delete newCorr;
|
---|
213 | return;
|
---|
214 | }
|
---|
215 | newCorr->eph = lastEph;
|
---|
216 | }
|
---|
217 |
|
---|
218 | // Process all older Epochs (if there are any)
|
---|
219 | // -------------------------------------------
|
---|
220 | const double waitTime = 5.0; // wait 5 sec
|
---|
221 | _processedBeforeTime = newCorr->tt - waitTime;
|
---|
222 |
|
---|
223 | QList<cmbEpoch*> epochsToProcess;
|
---|
224 |
|
---|
225 | QMapIterator<QString, cmbAC*> itAC(_ACs);
|
---|
226 | while (itAC.hasNext()) {
|
---|
227 | itAC.next();
|
---|
228 | cmbAC* AC = itAC.value();
|
---|
229 |
|
---|
230 | QMutableListIterator<cmbEpoch*> itEpo(AC->epochs);
|
---|
231 | while (itEpo.hasNext()) {
|
---|
232 | cmbEpoch* epoch = itEpo.next();
|
---|
233 | if (epoch->time < _processedBeforeTime) {
|
---|
234 | epochsToProcess.append(epoch);
|
---|
235 | itEpo.remove();
|
---|
236 | }
|
---|
237 | }
|
---|
238 | }
|
---|
239 |
|
---|
240 | if (epochsToProcess.size()) {
|
---|
241 | processEpochs(epochsToProcess);
|
---|
242 | }
|
---|
243 |
|
---|
244 | // Check Modulo Time
|
---|
245 | // -----------------
|
---|
246 | const int moduloTime = 10;
|
---|
247 | if (int(newCorr->tt.gpssec()) % moduloTime != 0.0) {
|
---|
248 | delete newCorr;
|
---|
249 | return;
|
---|
250 | }
|
---|
251 |
|
---|
252 | // Find/Create the instance of cmbEpoch class
|
---|
253 | // ------------------------------------------
|
---|
254 | cmbEpoch* newEpoch = 0;
|
---|
255 | QListIterator<cmbEpoch*> it(AC->epochs);
|
---|
256 | while (it.hasNext()) {
|
---|
257 | cmbEpoch* hlpEpoch = it.next();
|
---|
258 | if (hlpEpoch->time == newCorr->tt) {
|
---|
259 | newEpoch = hlpEpoch;
|
---|
260 | break;
|
---|
261 | }
|
---|
262 | }
|
---|
263 | if (newEpoch == 0) {
|
---|
264 | newEpoch = new cmbEpoch(AC->name);
|
---|
265 | newEpoch->time = newCorr->tt;
|
---|
266 | AC->epochs.append(newEpoch);
|
---|
267 | }
|
---|
268 |
|
---|
269 | // Merge or add the correction
|
---|
270 | // ---------------------------
|
---|
271 | if (newEpoch->corr.find(newCorr->prn) != newEpoch->corr.end()) {
|
---|
272 | newEpoch->corr[newCorr->prn]->readLine(line); // merge (multiple messages)
|
---|
273 | }
|
---|
274 | else {
|
---|
275 | newEpoch->corr[newCorr->prn] = newCorr;
|
---|
276 | }
|
---|
277 | }
|
---|
278 |
|
---|
279 | // Send results to caster
|
---|
280 | ////////////////////////////////////////////////////////////////////////////
|
---|
281 | void bncComb::dumpResults(const bncTime& resTime,
|
---|
282 | const QMap<QString, t_corr*>& resCorr) {
|
---|
283 |
|
---|
284 | _caster->open();
|
---|
285 |
|
---|
286 | unsigned year, month, day;
|
---|
287 | resTime.civil_date (year, month, day);
|
---|
288 | double GPSweeks = resTime.gpssec();
|
---|
289 |
|
---|
290 | struct ClockOrbit co;
|
---|
291 | memset(&co, 0, sizeof(co));
|
---|
292 | co.GPSEpochTime = (int)GPSweeks;
|
---|
293 | co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)
|
---|
294 | + 3 * 3600 - gnumleap(year, month, day);
|
---|
295 | co.ClockDataSupplied = 1;
|
---|
296 | co.OrbitDataSupplied = 1;
|
---|
297 | co.SatRefDatum = DATUM_ITRF;
|
---|
298 |
|
---|
299 | QMapIterator<QString, t_corr*> it(resCorr);
|
---|
300 | while (it.hasNext()) {
|
---|
301 | it.next();
|
---|
302 | t_corr* corr = it.value();
|
---|
303 |
|
---|
304 | struct ClockOrbit::SatData* sd = 0;
|
---|
305 | if (corr->prn[0] == 'G') {
|
---|
306 | sd = co.Sat + co.NumberOfGPSSat;
|
---|
307 | ++co.NumberOfGPSSat;
|
---|
308 | }
|
---|
309 | else if (corr->prn[0] == 'R') {
|
---|
310 | sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
|
---|
311 | ++co.NumberOfGLONASSSat;
|
---|
312 | }
|
---|
313 |
|
---|
314 | if (sd != 0) {
|
---|
315 | sd->ID = corr->prn.mid(1).toInt();
|
---|
316 | sd->IOD = corr->iod;
|
---|
317 | sd->Clock.DeltaA0 = corr->dClk * t_CST::c;
|
---|
318 | sd->Orbit.DeltaRadial = corr->rao(1);
|
---|
319 | sd->Orbit.DeltaAlongTrack = corr->rao(2);
|
---|
320 | sd->Orbit.DeltaCrossTrack = corr->rao(3);
|
---|
321 | sd->Orbit.DotDeltaRadial = corr->dotRao(1);
|
---|
322 | sd->Orbit.DotDeltaAlongTrack = corr->dotRao(2);
|
---|
323 | sd->Orbit.DotDeltaCrossTrack = corr->dotRao(3);
|
---|
324 | }
|
---|
325 |
|
---|
326 | delete corr;
|
---|
327 | }
|
---|
328 |
|
---|
329 | // Send Corrections to Caster
|
---|
330 | // --------------------------
|
---|
331 | if ( _caster->usedSocket() &&
|
---|
332 | (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
|
---|
333 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
334 | int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
335 | if (len > 0) {
|
---|
336 | _caster->write(obuffer, len);
|
---|
337 | }
|
---|
338 | }
|
---|
339 |
|
---|
340 | // Optionall send new Corrections to PPP client
|
---|
341 | // --------------------------------------------
|
---|
342 | bncApp* app = (bncApp*) qApp;
|
---|
343 | if (app->_bncPPPclient) {
|
---|
344 | QStringList corrLines;
|
---|
345 | co.messageType = COTYPE_GPSCOMBINED;
|
---|
346 | QStringListIterator il(RTCM3coDecoder::corrsToASCIIlines(resTime.gpsw(),
|
---|
347 | resTime.gpssec(), co, 0));
|
---|
348 | while (il.hasNext()) {
|
---|
349 | QString line = il.next() + " " + _caster->mountpoint();
|
---|
350 | corrLines << line;
|
---|
351 | }
|
---|
352 |
|
---|
353 | app->_bncPPPclient->slotNewCorrections(corrLines);
|
---|
354 | }
|
---|
355 | }
|
---|
356 |
|
---|
357 | // Change the correction so that it refers to last received ephemeris
|
---|
358 | ////////////////////////////////////////////////////////////////////////////
|
---|
359 | void bncComb::switchToLastEph(const QString& ACname, const t_eph* lastEph,
|
---|
360 | const t_eph* prevEph, t_corr* newCorr) {
|
---|
361 |
|
---|
362 | ColumnVector oldXC(4);
|
---|
363 | ColumnVector oldVV(3);
|
---|
364 | prevEph->position(newCorr->tt.gpsw(), newCorr->tt.gpssec(),
|
---|
365 | oldXC.data(), oldVV.data());
|
---|
366 |
|
---|
367 | ColumnVector newXC(4);
|
---|
368 | ColumnVector newVV(3);
|
---|
369 | lastEph->position(newCorr->tt.gpsw(), newCorr->tt.gpssec(),
|
---|
370 | newXC.data(), newVV.data());
|
---|
371 |
|
---|
372 | ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
|
---|
373 | ColumnVector dV = newVV - oldVV;
|
---|
374 | double dC = newXC(4) - oldXC(4);
|
---|
375 |
|
---|
376 | ColumnVector dRAO(3);
|
---|
377 | XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
|
---|
378 |
|
---|
379 | ColumnVector dDotRAO(3);
|
---|
380 | XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
|
---|
381 |
|
---|
382 | newCorr->iod = lastEph->IOD();
|
---|
383 | newCorr->rao -= dRAO;
|
---|
384 | newCorr->dotRao -= dDotRAO;
|
---|
385 | newCorr->dClk -= dC;
|
---|
386 |
|
---|
387 | QString msg = "switch " + newCorr->prn
|
---|
388 | + QString(" %1 -> %2 %3").arg(prevEph->IOD(),3)
|
---|
389 | .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
|
---|
390 |
|
---|
391 | // Check/change the static offset parameters
|
---|
392 | // -----------------------------------------
|
---|
393 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
394 | cmbParam* pp = _params[iPar-1];
|
---|
395 | if (pp->type == cmbParam::Sat_offset &&
|
---|
396 | pp->prn == newCorr->prn &&
|
---|
397 | pp->AC == ACname) {
|
---|
398 | if (pp->iod != lastEph->IOD()) {
|
---|
399 | pp->iod = lastEph->IOD();
|
---|
400 | msg += " need corr ";
|
---|
401 | }
|
---|
402 | }
|
---|
403 | }
|
---|
404 |
|
---|
405 | emit newMessage(msg.toAscii(), false);
|
---|
406 | }
|
---|
407 |
|
---|
408 | // Process Epochs
|
---|
409 | ////////////////////////////////////////////////////////////////////////////
|
---|
410 | void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) {
|
---|
411 |
|
---|
412 | _log.clear();
|
---|
413 |
|
---|
414 | QTextStream out(&_log, QIODevice::WriteOnly);
|
---|
415 |
|
---|
416 | out << "Combination:" << endl
|
---|
417 | << "------------------------------" << endl;
|
---|
418 |
|
---|
419 | // Predict Parameters Values, Add White Noise
|
---|
420 | // ------------------------------------------
|
---|
421 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
422 | cmbParam* pp = _params[iPar-1];
|
---|
423 | if (pp->type == cmbParam::AC_offset || pp->type == cmbParam::clk) {
|
---|
424 | pp->xx = 0.0;
|
---|
425 | for (int jj = 1; jj <= _params.size(); jj++) {
|
---|
426 | _QQ(iPar, jj) = 0.0;
|
---|
427 | }
|
---|
428 | }
|
---|
429 | if (pp->type == cmbParam::AC_offset) {
|
---|
430 | _QQ(iPar,iPar) = _sigACOff * _sigACOff;
|
---|
431 | }
|
---|
432 | else if (pp->type == cmbParam::clk) {
|
---|
433 | _QQ(iPar,iPar) = _sigClk * _sigClk;
|
---|
434 | }
|
---|
435 | }
|
---|
436 |
|
---|
437 | bncTime resTime = epochs.first()->time;
|
---|
438 | QMap<QString, t_corr*> resCorr;
|
---|
439 |
|
---|
440 | int nPar = _params.size();
|
---|
441 | int nObs = 0;
|
---|
442 |
|
---|
443 | ColumnVector x0(nPar);
|
---|
444 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
445 | cmbParam* pp = _params[iPar-1];
|
---|
446 | x0(iPar) = pp->xx;
|
---|
447 | }
|
---|
448 |
|
---|
449 | // Count Observations
|
---|
450 | // ------------------
|
---|
451 | QListIterator<cmbEpoch*> itEpo(epochs);
|
---|
452 | while (itEpo.hasNext()) {
|
---|
453 | cmbEpoch* epo = itEpo.next();
|
---|
454 | QMapIterator<QString, t_corr*> itCorr(epo->corr);
|
---|
455 | while (itCorr.hasNext()) {
|
---|
456 | itCorr.next();
|
---|
457 | ++nObs;
|
---|
458 | }
|
---|
459 | }
|
---|
460 |
|
---|
461 | if (nObs > 0) {
|
---|
462 | Matrix AA(nObs, nPar);
|
---|
463 | ColumnVector ll(nObs);
|
---|
464 | DiagonalMatrix PP(nObs); PP = 1.0;
|
---|
465 |
|
---|
466 | int iObs = 0;
|
---|
467 | QListIterator<cmbEpoch*> itEpo(epochs);
|
---|
468 | while (itEpo.hasNext()) {
|
---|
469 | cmbEpoch* epo = itEpo.next();
|
---|
470 | QMapIterator<QString, t_corr*> itCorr(epo->corr);
|
---|
471 |
|
---|
472 | while (itCorr.hasNext()) {
|
---|
473 | itCorr.next();
|
---|
474 | ++iObs;
|
---|
475 | t_corr* corr = itCorr.value();
|
---|
476 |
|
---|
477 | //// beg test
|
---|
478 | if (epo->acName == "BKG") {
|
---|
479 | resCorr[corr->prn] = new t_corr(*corr);
|
---|
480 | }
|
---|
481 | //// end test
|
---|
482 |
|
---|
483 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
484 | cmbParam* pp = _params[iPar-1];
|
---|
485 | AA(iObs, iPar) = pp->partial(epo->acName, corr);
|
---|
486 | }
|
---|
487 |
|
---|
488 | ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
|
---|
489 |
|
---|
490 | delete corr;
|
---|
491 | }
|
---|
492 | }
|
---|
493 |
|
---|
494 | ColumnVector dx;
|
---|
495 | bncModel::kalman(AA, ll, PP, _QQ, dx);
|
---|
496 | ColumnVector vv = ll - AA * dx;
|
---|
497 |
|
---|
498 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
499 | cmbParam* pp = _params[iPar-1];
|
---|
500 | pp->xx += dx(iPar);
|
---|
501 | if (pp->type == cmbParam::clk) {
|
---|
502 | if (resCorr.find(pp->prn) != resCorr.end()) {
|
---|
503 | resCorr[pp->prn]->dClk = pp->xx / t_CST::c;
|
---|
504 | }
|
---|
505 | }
|
---|
506 | out << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
|
---|
507 | out.setRealNumberNotation(QTextStream::FixedNotation);
|
---|
508 | out.setFieldWidth(8);
|
---|
509 | out.setRealNumberPrecision(4);
|
---|
510 | out << pp->toString() << " "
|
---|
511 | << pp->xx << " +- " << sqrt(_QQ(pp->index,pp->index)) << endl;
|
---|
512 | }
|
---|
513 | }
|
---|
514 |
|
---|
515 | printResults(out, resTime, resCorr);
|
---|
516 | dumpResults(resTime, resCorr);
|
---|
517 |
|
---|
518 | emit newMessage(_log, false);
|
---|
519 | }
|
---|
520 |
|
---|
521 | // Print results to caster
|
---|
522 | ////////////////////////////////////////////////////////////////////////////
|
---|
523 | void bncComb::printResults(QTextStream& out, const bncTime& resTime,
|
---|
524 | const QMap<QString, t_corr*>& resCorr) {
|
---|
525 |
|
---|
526 | QMapIterator<QString, t_corr*> it(resCorr);
|
---|
527 | while (it.hasNext()) {
|
---|
528 | it.next();
|
---|
529 | t_corr* corr = it.value();
|
---|
530 | t_eph* eph = corr->eph;
|
---|
531 | if (eph) {
|
---|
532 | double xx, yy, zz, cc;
|
---|
533 | eph->position(resTime.gpsw(), resTime.gpssec(), xx, yy, zz, cc);
|
---|
534 |
|
---|
535 | out << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
|
---|
536 | out.setFieldWidth(3);
|
---|
537 | out << "Full Clock " << corr->prn << " " << corr->iod << " ";
|
---|
538 | out.setFieldWidth(14);
|
---|
539 | out << (cc + corr->dClk) * t_CST::c << endl;
|
---|
540 | }
|
---|
541 | else {
|
---|
542 | out << "bncComb::printResuls bug" << endl;
|
---|
543 | }
|
---|
544 | }
|
---|
545 | }
|
---|