source: ntrip/trunk/BNC/src/PPP_SSR_I/pppFilter.cpp@ 9280

Last change on this file since 9280 was 9280, checked in by stuerze, 3 years ago

small bug fixed

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