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