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