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