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