| 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>
|
|---|
| 42 | #include <cmath>
|
|---|
| 43 | #include <newmatio.h>
|
|---|
| 44 | #include <sstream>
|
|---|
| 45 |
|
|---|
| 46 | #include "bncmodel.h"
|
|---|
| 47 | #include "bncapp.h"
|
|---|
| 48 | #include "bncpppclient.h"
|
|---|
| 49 | #include "bancroft.h"
|
|---|
| 50 | #include "bncutils.h"
|
|---|
| 51 | #include "bncsettings.h"
|
|---|
| 52 |
|
|---|
| 53 | using namespace std;
|
|---|
| 54 |
|
|---|
| 55 | const unsigned MINOBS = 4;
|
|---|
| 56 | const double MINELE = 10.0 * M_PI / 180.0;
|
|---|
| 57 | const double MAXRES_CODE_GPS = 10.0;
|
|---|
| 58 | const double MAXRES_PHASE_GPS = 0.10;
|
|---|
| 59 | const double MAXRES_PHASE_GLO = 0.50;
|
|---|
| 60 | const double sig_crd_0 = 100.0;
|
|---|
| 61 | const double sig_crd_p = 100.0;
|
|---|
| 62 | const double sig_clk_0 = 1000.0;
|
|---|
| 63 | const double sig_trp_0 = 0.01;
|
|---|
| 64 | const double sig_trp_p = 1e-6;
|
|---|
| 65 | const double sig_amb_0 = 1000.0;
|
|---|
| 66 | const double sig_P3 = 1.0;
|
|---|
| 67 | const double sig_L3_GPS = 0.01;
|
|---|
| 68 | const double sig_L3_GLO = 0.10;
|
|---|
| 69 |
|
|---|
| 70 | // Constructor
|
|---|
| 71 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 72 | bncParam::bncParam(bncParam::parType typeIn, int indexIn,
|
|---|
| 73 | const QString& prnIn) {
|
|---|
| 74 | type = typeIn;
|
|---|
| 75 | index = indexIn;
|
|---|
| 76 | prn = prnIn;
|
|---|
| 77 | index_old = 0;
|
|---|
| 78 | xx = 0.0;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | // Destructor
|
|---|
| 82 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 83 | bncParam::~bncParam() {
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | // Partial
|
|---|
| 87 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 88 | double bncParam::partial(t_satData* satData, bool phase) {
|
|---|
| 89 |
|
|---|
| 90 | // Coordinates
|
|---|
| 91 | // -----------
|
|---|
| 92 | if (type == CRD_X) {
|
|---|
| 93 | return (xx - satData->xx(1)) / satData->rho;
|
|---|
| 94 | }
|
|---|
| 95 | else if (type == CRD_Y) {
|
|---|
| 96 | return (xx - satData->xx(2)) / satData->rho;
|
|---|
| 97 | }
|
|---|
| 98 | else if (type == CRD_Z) {
|
|---|
| 99 | return (xx - satData->xx(3)) / satData->rho;
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | // Receiver Clocks
|
|---|
| 103 | // ---------------
|
|---|
| 104 | else if (type == RECCLK_GPS) {
|
|---|
| 105 | return 1.0;
|
|---|
| 106 | }
|
|---|
| 107 | else if (type == RECCLK_GLO) {
|
|---|
| 108 | if (satData->prn[0] == 'R') {
|
|---|
| 109 | return 1.0;
|
|---|
| 110 | }
|
|---|
| 111 | else {
|
|---|
| 112 | return 0.0;
|
|---|
| 113 | }
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | // Troposphere
|
|---|
| 117 | // -----------
|
|---|
| 118 | else if (type == TROPO) {
|
|---|
| 119 | return 1.0 / sin(satData->eleSat);
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | // Ambiguities
|
|---|
| 123 | // -----------
|
|---|
| 124 | else if (type == AMB_L3) {
|
|---|
| 125 | if (phase && satData->prn == prn) {
|
|---|
| 126 | return 1.0;
|
|---|
| 127 | }
|
|---|
| 128 | else {
|
|---|
| 129 | return 0.0;
|
|---|
| 130 | }
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | // Default return
|
|---|
| 134 | // --------------
|
|---|
| 135 | return 0.0;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | // Constructor
|
|---|
| 139 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 140 | bncModel::bncModel(QByteArray staID) {
|
|---|
| 141 |
|
|---|
| 142 | _staID = staID;
|
|---|
| 143 |
|
|---|
| 144 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
|---|
| 145 | ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
|
|---|
| 146 |
|
|---|
| 147 | bncSettings settings;
|
|---|
| 148 |
|
|---|
| 149 | _static = false;
|
|---|
| 150 | if ( Qt::CheckState(settings.value("pppStatic").toInt()) == Qt::Checked) {
|
|---|
| 151 | _static = true;
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | _usePhase = false;
|
|---|
| 155 | if ( Qt::CheckState(settings.value("pppUsePhase").toInt()) == Qt::Checked) {
|
|---|
| 156 | _usePhase = true;
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 | _estTropo = false;
|
|---|
| 160 | if ( Qt::CheckState(settings.value("pppEstTropo").toInt()) == Qt::Checked) {
|
|---|
| 161 | _estTropo = true;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | _xcBanc.ReSize(4); _xcBanc = 0.0;
|
|---|
| 165 | _ellBanc.ReSize(3); _ellBanc = 0.0;
|
|---|
| 166 |
|
|---|
| 167 | if ( Qt::CheckState(settings.value("pppGLONASS").toInt()) == Qt::Checked) {
|
|---|
| 168 | _useGlonass = true;
|
|---|
| 169 | }
|
|---|
| 170 | else {
|
|---|
| 171 | _useGlonass = false;
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | int nextPar = 0;
|
|---|
| 175 | _params.push_back(new bncParam(bncParam::CRD_X, ++nextPar, ""));
|
|---|
| 176 | _params.push_back(new bncParam(bncParam::CRD_Y, ++nextPar, ""));
|
|---|
| 177 | _params.push_back(new bncParam(bncParam::CRD_Z, ++nextPar, ""));
|
|---|
| 178 | _params.push_back(new bncParam(bncParam::RECCLK_GPS, ++nextPar, ""));
|
|---|
| 179 | if (_useGlonass) {
|
|---|
| 180 | _params.push_back(new bncParam(bncParam::RECCLK_GLO, ++nextPar, ""));
|
|---|
| 181 | }
|
|---|
| 182 | if (_estTropo) {
|
|---|
| 183 | _params.push_back(new bncParam(bncParam::TROPO, ++nextPar, ""));
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | unsigned nPar = _params.size();
|
|---|
| 187 |
|
|---|
| 188 | _QQ.ReSize(nPar);
|
|---|
| 189 |
|
|---|
| 190 | _QQ = 0.0;
|
|---|
| 191 |
|
|---|
| 192 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 193 | bncParam* pp = _params[iPar-1];
|
|---|
| 194 | if (pp->isCrd()) {
|
|---|
| 195 | _QQ(iPar,iPar) = sig_crd_0 * sig_crd_0;
|
|---|
| 196 | }
|
|---|
| 197 | else if (pp->isClk()) {
|
|---|
| 198 | _QQ(iPar,iPar) = sig_clk_0 * sig_clk_0;
|
|---|
| 199 | }
|
|---|
| 200 | else if (pp->type == bncParam::TROPO) {
|
|---|
| 201 | _QQ(iPar,iPar) = sig_trp_0 * sig_trp_0;
|
|---|
| 202 | }
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | // NMEA Output
|
|---|
| 206 | // -----------
|
|---|
| 207 | QString nmeaFileName = settings.value("nmeaFile").toString();
|
|---|
| 208 | if (nmeaFileName.isEmpty()) {
|
|---|
| 209 | _nmeaFile = 0;
|
|---|
| 210 | _nmeaStream = 0;
|
|---|
| 211 | }
|
|---|
| 212 | else {
|
|---|
| 213 | expandEnvVar(nmeaFileName);
|
|---|
| 214 | _nmeaFile = new QFile(nmeaFileName);
|
|---|
| 215 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
|
|---|
| 216 | _nmeaFile->open(QIODevice::WriteOnly | QIODevice::Append);
|
|---|
| 217 | }
|
|---|
| 218 | else {
|
|---|
| 219 | _nmeaFile->open(QIODevice::WriteOnly);
|
|---|
| 220 | }
|
|---|
| 221 | _nmeaStream = new QTextStream();
|
|---|
| 222 | _nmeaStream->setDevice(_nmeaFile);
|
|---|
| 223 | QDateTime dateTime = QDateTime::currentDateTime().toUTC();
|
|---|
| 224 | QString nmStr = "GPRMC," + dateTime.time().toString("hhmmss")
|
|---|
| 225 | + ",A,,,,,,,"
|
|---|
| 226 | + dateTime.date().toString("ddMMyy")
|
|---|
| 227 | + ",,";
|
|---|
| 228 |
|
|---|
| 229 | writeNMEAstr(nmStr);
|
|---|
| 230 | }
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | // Destructor
|
|---|
| 234 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 235 | bncModel::~bncModel() {
|
|---|
| 236 | delete _nmeaStream;
|
|---|
| 237 | delete _nmeaFile;
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| 240 | // Bancroft Solution
|
|---|
| 241 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 242 | t_irc bncModel::cmpBancroft(t_epoData* epoData) {
|
|---|
| 243 |
|
|---|
| 244 | if (epoData->sizeGPS() < MINOBS) {
|
|---|
| 245 | _log += "\nNot enough data";
|
|---|
| 246 | return failure;
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | Matrix BB(epoData->sizeGPS(), 4);
|
|---|
| 250 |
|
|---|
| 251 | QMapIterator<QString, t_satData*> it(epoData->satDataGPS);
|
|---|
| 252 | int iObs = 0;
|
|---|
| 253 | while (it.hasNext()) {
|
|---|
| 254 | ++iObs;
|
|---|
| 255 | it.next();
|
|---|
| 256 | QString prn = it.key();
|
|---|
| 257 | t_satData* satData = it.value();
|
|---|
| 258 | BB(iObs, 1) = satData->xx(1);
|
|---|
| 259 | BB(iObs, 2) = satData->xx(2);
|
|---|
| 260 | BB(iObs, 3) = satData->xx(3);
|
|---|
| 261 | BB(iObs, 4) = satData->P3 + satData->clk;
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | bancroft(BB, _xcBanc);
|
|---|
| 265 |
|
|---|
| 266 | // Ellipsoidal Coordinates
|
|---|
| 267 | // ------------------------
|
|---|
| 268 | xyz2ell(_xcBanc.data(), _ellBanc.data());
|
|---|
| 269 |
|
|---|
| 270 | // Compute Satellite Elevations
|
|---|
| 271 | // ----------------------------
|
|---|
| 272 | QMutableMapIterator<QString, t_satData*> iGPS(epoData->satDataGPS);
|
|---|
| 273 | while (iGPS.hasNext()) {
|
|---|
| 274 | iGPS.next();
|
|---|
| 275 | QString prn = iGPS.key();
|
|---|
| 276 | t_satData* satData = iGPS.value();
|
|---|
| 277 |
|
|---|
| 278 | ColumnVector rr = satData->xx - _xcBanc.Rows(1,3);
|
|---|
| 279 | double rho = rr.norm_Frobenius();
|
|---|
| 280 |
|
|---|
| 281 | double neu[3];
|
|---|
| 282 | xyz2neu(_ellBanc.data(), rr.data(), neu);
|
|---|
| 283 |
|
|---|
| 284 | satData->eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho );
|
|---|
| 285 | if (neu[2] < 0) {
|
|---|
| 286 | satData->eleSat *= -1.0;
|
|---|
| 287 | }
|
|---|
| 288 | satData->azSat = atan2(neu[1], neu[0]);
|
|---|
| 289 |
|
|---|
| 290 | if (satData->eleSat < MINELE) {
|
|---|
| 291 | delete satData;
|
|---|
| 292 | iGPS.remove();
|
|---|
| 293 | }
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | QMutableMapIterator<QString, t_satData*> iGlo(epoData->satDataGlo);
|
|---|
| 297 | while (iGlo.hasNext()) {
|
|---|
| 298 | iGlo.next();
|
|---|
| 299 | QString prn = iGlo.key();
|
|---|
| 300 | t_satData* satData = iGlo.value();
|
|---|
| 301 |
|
|---|
| 302 | ColumnVector rr = satData->xx - _xcBanc.Rows(1,3);
|
|---|
| 303 | double rho = rr.norm_Frobenius();
|
|---|
| 304 |
|
|---|
| 305 | double neu[3];
|
|---|
| 306 | xyz2neu(_ellBanc.data(), rr.data(), neu);
|
|---|
| 307 |
|
|---|
| 308 | satData->eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho );
|
|---|
| 309 | if (neu[2] < 0) {
|
|---|
| 310 | satData->eleSat *= -1.0;
|
|---|
| 311 | }
|
|---|
| 312 | satData->azSat = atan2(neu[1], neu[0]);
|
|---|
| 313 |
|
|---|
| 314 | if (satData->eleSat < MINELE) {
|
|---|
| 315 | delete satData;
|
|---|
| 316 | iGlo.remove();
|
|---|
| 317 | }
|
|---|
| 318 | }
|
|---|
| 319 |
|
|---|
| 320 | return success;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | // Computed Value
|
|---|
| 324 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 325 | double bncModel::cmpValue(t_satData* satData) {
|
|---|
| 326 |
|
|---|
| 327 | ColumnVector xRec(3);
|
|---|
| 328 | xRec(1) = x();
|
|---|
| 329 | xRec(2) = y();
|
|---|
| 330 | xRec(3) = z();
|
|---|
| 331 |
|
|---|
| 332 | double rho0 = (satData->xx - xRec).norm_Frobenius();
|
|---|
| 333 | double dPhi = t_CST::omega * rho0 / t_CST::c;
|
|---|
| 334 |
|
|---|
| 335 | xRec(1) = x() * cos(dPhi) - y() * sin(dPhi);
|
|---|
| 336 | xRec(2) = y() * cos(dPhi) + x() * sin(dPhi);
|
|---|
| 337 | xRec(3) = z();
|
|---|
| 338 |
|
|---|
| 339 | satData->rho = (satData->xx - xRec).norm_Frobenius();
|
|---|
| 340 |
|
|---|
| 341 | double tropDelay = delay_saast(satData->eleSat) +
|
|---|
| 342 | trp() / sin(satData->eleSat);
|
|---|
| 343 |
|
|---|
| 344 | double clk = 0.0;
|
|---|
| 345 | if (satData->prn[0] == 'G') {
|
|---|
| 346 | clk = clkGPS();
|
|---|
| 347 | }
|
|---|
| 348 | else if (satData->prn[0] == 'R') {
|
|---|
| 349 | clk = clkGlo();
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | return satData->rho + clk - satData->clk + tropDelay;
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | // Tropospheric Model (Saastamoinen)
|
|---|
| 356 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 357 | double bncModel::delay_saast(double Ele) {
|
|---|
| 358 |
|
|---|
| 359 | double height = _ellBanc(3);
|
|---|
| 360 |
|
|---|
| 361 | double pp = 1013.25 * pow(1.0 - 2.26e-5 * height, 5.225);
|
|---|
| 362 | double TT = 18.0 - height * 0.0065 + 273.15;
|
|---|
| 363 | double hh = 50.0 * exp(-6.396e-4 * height);
|
|---|
| 364 | double ee = hh / 100.0 * exp(-37.2465 + 0.213166*TT - 0.000256908*TT*TT);
|
|---|
| 365 |
|
|---|
| 366 | double h_km = height / 1000.0;
|
|---|
| 367 |
|
|---|
| 368 | if (h_km < 0.0) h_km = 0.0;
|
|---|
| 369 | if (h_km > 5.0) h_km = 5.0;
|
|---|
| 370 | int ii = int(h_km + 1);
|
|---|
| 371 | double href = ii - 1;
|
|---|
| 372 |
|
|---|
| 373 | double bCor[6];
|
|---|
| 374 | bCor[0] = 1.156;
|
|---|
| 375 | bCor[1] = 1.006;
|
|---|
| 376 | bCor[2] = 0.874;
|
|---|
| 377 | bCor[3] = 0.757;
|
|---|
| 378 | bCor[4] = 0.654;
|
|---|
| 379 | bCor[5] = 0.563;
|
|---|
| 380 |
|
|---|
| 381 | double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href);
|
|---|
| 382 |
|
|---|
| 383 | double zen = M_PI/2.0 - Ele;
|
|---|
| 384 |
|
|---|
| 385 | return (0.002277/cos(zen)) * (pp + ((1255.0/TT)+0.05)*ee - BB*(tan(zen)*tan(zen)));
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 | // Prediction Step of the Filter
|
|---|
| 389 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 390 | void bncModel::predict(t_epoData* epoData) {
|
|---|
| 391 |
|
|---|
| 392 | bool firstCrd = x() == 0.0 && y() == 0.0 && z() == 0.0;
|
|---|
| 393 |
|
|---|
| 394 | // Predict Parameter values, add white noise
|
|---|
| 395 | // -----------------------------------------
|
|---|
| 396 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 397 | bncParam* pp = _params[iPar-1];
|
|---|
| 398 |
|
|---|
| 399 | // Coordinates
|
|---|
| 400 | // -----------
|
|---|
| 401 | if (pp->type == bncParam::CRD_X) {
|
|---|
| 402 | if (firstCrd || !_static) {
|
|---|
| 403 | pp->xx = _xcBanc(1);
|
|---|
| 404 | }
|
|---|
| 405 | _QQ(iPar,iPar) += sig_crd_p * sig_crd_p;
|
|---|
| 406 | }
|
|---|
| 407 | else if (pp->type == bncParam::CRD_Y) {
|
|---|
| 408 | if (firstCrd || !_static) {
|
|---|
| 409 | pp->xx = _xcBanc(2);
|
|---|
| 410 | }
|
|---|
| 411 | _QQ(iPar,iPar) += sig_crd_p * sig_crd_p;
|
|---|
| 412 | }
|
|---|
| 413 | else if (pp->type == bncParam::CRD_Z) {
|
|---|
| 414 | if (firstCrd || !_static) {
|
|---|
| 415 | pp->xx = _xcBanc(3);
|
|---|
| 416 | }
|
|---|
| 417 | _QQ(iPar,iPar) += sig_crd_p * sig_crd_p;
|
|---|
| 418 | }
|
|---|
| 419 |
|
|---|
| 420 | // Receiver Clocks
|
|---|
| 421 | // ---------------
|
|---|
| 422 | else if (pp->isClk()) {
|
|---|
| 423 | pp->xx = _xcBanc(4);
|
|---|
| 424 | for (int jj = 1; jj <= _params.size(); jj++) {
|
|---|
| 425 | _QQ(iPar, jj) = 0.0;
|
|---|
| 426 | }
|
|---|
| 427 | _QQ(iPar,iPar) = sig_clk_0 * sig_clk_0;
|
|---|
| 428 | }
|
|---|
| 429 |
|
|---|
| 430 | // Tropospheric Delay
|
|---|
| 431 | // ------------------
|
|---|
| 432 | else if (pp->type == bncParam::TROPO) {
|
|---|
| 433 | _QQ(iPar,iPar) += sig_trp_p * sig_trp_p;
|
|---|
| 434 | }
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 | // Add New Ambiguities if necessary
|
|---|
| 438 | // --------------------------------
|
|---|
| 439 | if (_usePhase) {
|
|---|
| 440 |
|
|---|
| 441 | // Make a copy of QQ and xx, set parameter indices
|
|---|
| 442 | // -----------------------------------------------
|
|---|
| 443 | SymmetricMatrix QQ_old = _QQ;
|
|---|
| 444 |
|
|---|
| 445 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 446 | _params[iPar-1]->index_old = _params[iPar-1]->index;
|
|---|
| 447 | _params[iPar-1]->index = 0;
|
|---|
| 448 | }
|
|---|
| 449 |
|
|---|
| 450 | // Remove Ambiguity Parameters without observations
|
|---|
| 451 | // ------------------------------------------------
|
|---|
| 452 | int iPar = 0;
|
|---|
| 453 | QMutableVectorIterator<bncParam*> it(_params);
|
|---|
| 454 | while (it.hasNext()) {
|
|---|
| 455 | bncParam* par = it.next();
|
|---|
| 456 | bool removed = false;
|
|---|
| 457 | if (par->type == bncParam::AMB_L3) {
|
|---|
| 458 | if (epoData->satDataGPS.find(par->prn) == epoData->satDataGPS.end() &&
|
|---|
| 459 | epoData->satDataGlo.find(par->prn) == epoData->satDataGlo.end() ) {
|
|---|
| 460 | removed = true;
|
|---|
| 461 | delete par;
|
|---|
| 462 | it.remove();
|
|---|
| 463 | }
|
|---|
| 464 | }
|
|---|
| 465 | if (! removed) {
|
|---|
| 466 | ++iPar;
|
|---|
| 467 | par->index = iPar;
|
|---|
| 468 | }
|
|---|
| 469 | }
|
|---|
| 470 |
|
|---|
| 471 | // Add new ambiguity parameters
|
|---|
| 472 | // ----------------------------
|
|---|
| 473 | QMapIterator<QString, t_satData*> iGPS(epoData->satDataGPS);
|
|---|
| 474 | while (iGPS.hasNext()) {
|
|---|
| 475 | iGPS.next();
|
|---|
| 476 | QString prn = iGPS.key();
|
|---|
| 477 | t_satData* satData = iGPS.value();
|
|---|
| 478 | bool found = false;
|
|---|
| 479 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 480 | if (_params[iPar-1]->type == bncParam::AMB_L3 &&
|
|---|
| 481 | _params[iPar-1]->prn == prn) {
|
|---|
| 482 | found = true;
|
|---|
| 483 | break;
|
|---|
| 484 | }
|
|---|
| 485 | }
|
|---|
| 486 | if (!found) {
|
|---|
| 487 | bncParam* par = new bncParam(bncParam::AMB_L3, _params.size()+1, prn);
|
|---|
| 488 | _params.push_back(par);
|
|---|
| 489 | par->xx = satData->L3 - cmpValue(satData);
|
|---|
| 490 | }
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| 493 | QMapIterator<QString, t_satData*> iGlo(epoData->satDataGlo);
|
|---|
| 494 | while (iGlo.hasNext()) {
|
|---|
| 495 | iGlo.next();
|
|---|
| 496 | QString prn = iGlo.key();
|
|---|
| 497 | t_satData* satData = iGlo.value();
|
|---|
| 498 | bool found = false;
|
|---|
| 499 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 500 | if (_params[iPar-1]->type == bncParam::AMB_L3 &&
|
|---|
| 501 | _params[iPar-1]->prn == prn) {
|
|---|
| 502 | found = true;
|
|---|
| 503 | break;
|
|---|
| 504 | }
|
|---|
| 505 | }
|
|---|
| 506 | if (!found) {
|
|---|
| 507 | bncParam* par = new bncParam(bncParam::AMB_L3, _params.size()+1, prn);
|
|---|
| 508 | _params.push_back(par);
|
|---|
| 509 | par->xx = satData->L3 - cmpValue(satData);
|
|---|
| 510 | }
|
|---|
| 511 | }
|
|---|
| 512 |
|
|---|
| 513 | int nPar = _params.size();
|
|---|
| 514 | _QQ.ReSize(nPar); _QQ = 0.0;
|
|---|
| 515 | for (int i1 = 1; i1 <= nPar; i1++) {
|
|---|
| 516 | bncParam* p1 = _params[i1-1];
|
|---|
| 517 | if (p1->index_old != 0) {
|
|---|
| 518 | _QQ(p1->index, p1->index) = QQ_old(p1->index_old, p1->index_old);
|
|---|
| 519 | for (int i2 = 1; i2 <= nPar; i2++) {
|
|---|
| 520 | bncParam* p2 = _params[i2-1];
|
|---|
| 521 | if (p2->index_old != 0) {
|
|---|
| 522 | _QQ(p1->index, p2->index) = QQ_old(p1->index_old, p2->index_old);
|
|---|
| 523 | }
|
|---|
| 524 | }
|
|---|
| 525 | }
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 | for (int ii = 1; ii <= nPar; ii++) {
|
|---|
| 529 | bncParam* par = _params[ii-1];
|
|---|
| 530 | if (par->index_old == 0) {
|
|---|
| 531 | _QQ(par->index, par->index) = sig_amb_0 * sig_amb_0;
|
|---|
| 532 | }
|
|---|
| 533 | par->index_old = par->index;
|
|---|
| 534 | }
|
|---|
| 535 | }
|
|---|
| 536 |
|
|---|
| 537 | }
|
|---|
| 538 |
|
|---|
| 539 | // Update Step of the Filter (currently just a single-epoch solution)
|
|---|
| 540 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 541 | t_irc bncModel::update(t_epoData* epoData) {
|
|---|
| 542 |
|
|---|
| 543 | _log = "Precise Point Positioning";
|
|---|
| 544 |
|
|---|
| 545 | _time = epoData->tt;
|
|---|
| 546 |
|
|---|
| 547 | SymmetricMatrix QQsav;
|
|---|
| 548 | ColumnVector dx;
|
|---|
| 549 | ColumnVector vv;
|
|---|
| 550 |
|
|---|
| 551 | // Loop over all outliers
|
|---|
| 552 | // ----------------------
|
|---|
| 553 | do {
|
|---|
| 554 |
|
|---|
| 555 | // Bancroft Solution
|
|---|
| 556 | // -----------------
|
|---|
| 557 | if (cmpBancroft(epoData) != success) {
|
|---|
| 558 | _log += "\nBancroft failed";
|
|---|
| 559 | emit newMessage(_log, false);
|
|---|
| 560 | return failure;
|
|---|
| 561 | }
|
|---|
| 562 |
|
|---|
| 563 | if (epoData->sizeGPS() < MINOBS) {
|
|---|
| 564 | _log += "\nNot enough data";
|
|---|
| 565 | emit newMessage(_log, false);
|
|---|
| 566 | return failure;
|
|---|
| 567 | }
|
|---|
| 568 |
|
|---|
| 569 | // Status Prediction
|
|---|
| 570 | // -----------------
|
|---|
| 571 | predict(epoData);
|
|---|
| 572 |
|
|---|
| 573 | // Create First-Design Matrix
|
|---|
| 574 | // --------------------------
|
|---|
| 575 | unsigned nPar = _params.size();
|
|---|
| 576 | unsigned nObs = 0;
|
|---|
| 577 | if (_usePhase) {
|
|---|
| 578 | nObs = 2 * epoData->sizeGPS() + epoData->sizeGlo();
|
|---|
| 579 | }
|
|---|
| 580 | else {
|
|---|
| 581 | nObs = epoData->sizeGPS(); // Glonass pseudoranges are not used
|
|---|
| 582 | }
|
|---|
| 583 |
|
|---|
| 584 | Matrix AA(nObs, nPar); // first design matrix
|
|---|
| 585 | ColumnVector ll(nObs); // tems observed-computed
|
|---|
| 586 | SymmetricMatrix PP(nObs); PP = 0.0;
|
|---|
| 587 |
|
|---|
| 588 | unsigned iObs = 0;
|
|---|
| 589 |
|
|---|
| 590 | // GPS code and (optionally) phase observations
|
|---|
| 591 | // --------------------------------------------
|
|---|
| 592 | QMapIterator<QString, t_satData*> itGPS(epoData->satDataGPS);
|
|---|
| 593 | while (itGPS.hasNext()) {
|
|---|
| 594 | ++iObs;
|
|---|
| 595 | itGPS.next();
|
|---|
| 596 | QString prn = itGPS.key();
|
|---|
| 597 | t_satData* satData = itGPS.value();
|
|---|
| 598 |
|
|---|
| 599 | double rhoCmp = cmpValue(satData);
|
|---|
| 600 |
|
|---|
| 601 | ll(iObs) = satData->P3 - rhoCmp;
|
|---|
| 602 | PP(iObs,iObs) = 1.0 / (sig_P3 * sig_P3);
|
|---|
| 603 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 604 | AA(iObs, iPar) = _params[iPar-1]->partial(satData, false);
|
|---|
| 605 | }
|
|---|
| 606 |
|
|---|
| 607 | if (_usePhase) {
|
|---|
| 608 | ++iObs;
|
|---|
| 609 | ll(iObs) = satData->L3 - rhoCmp;
|
|---|
| 610 | PP(iObs,iObs) = 1.0 / (sig_L3_GPS * sig_L3_GPS);
|
|---|
| 611 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 612 | if (_params[iPar-1]->type == bncParam::AMB_L3 &&
|
|---|
| 613 | _params[iPar-1]->prn == prn) {
|
|---|
| 614 | ll(iObs) -= _params[iPar-1]->xx;
|
|---|
| 615 | }
|
|---|
| 616 | AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
|
|---|
| 617 | }
|
|---|
| 618 | }
|
|---|
| 619 | }
|
|---|
| 620 |
|
|---|
| 621 | // Glonass phase observations
|
|---|
| 622 | // --------------------------
|
|---|
| 623 | if (_usePhase) {
|
|---|
| 624 | QMapIterator<QString, t_satData*> itGlo(epoData->satDataGlo);
|
|---|
| 625 | while (itGlo.hasNext()) {
|
|---|
| 626 | ++iObs;
|
|---|
| 627 | itGlo.next();
|
|---|
| 628 | QString prn = itGlo.key();
|
|---|
| 629 | t_satData* satData = itGlo.value();
|
|---|
| 630 |
|
|---|
| 631 | double rhoCmp = cmpValue(satData);
|
|---|
| 632 |
|
|---|
| 633 | ll(iObs) = satData->L3 - rhoCmp;
|
|---|
| 634 |
|
|---|
| 635 | PP(iObs,iObs) = 1.0 / (sig_L3_GLO * sig_L3_GLO);
|
|---|
| 636 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
|---|
| 637 | if (_params[iPar-1]->type == bncParam::AMB_L3 &&
|
|---|
| 638 | _params[iPar-1]->prn == prn) {
|
|---|
| 639 | ll(iObs) -= _params[iPar-1]->xx;
|
|---|
| 640 | }
|
|---|
| 641 | AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
|
|---|
| 642 | }
|
|---|
| 643 |
|
|---|
| 644 | cout.setf(ios::fixed);
|
|---|
| 645 | cout << "iObs = " << iObs << " " << prn.toAscii().data() << " "
|
|---|
| 646 | << setprecision(3) << rhoCmp << " "
|
|---|
| 647 | << setprecision(3) << satData->P3 << " "
|
|---|
| 648 | << setprecision(3) << satData->L3 << " "
|
|---|
| 649 | << ll(iObs) << endl;
|
|---|
| 650 | }
|
|---|
| 651 | }
|
|---|
| 652 |
|
|---|
| 653 | // Compute Filter Update
|
|---|
| 654 | // ---------------------
|
|---|
| 655 | QQsav = _QQ;
|
|---|
| 656 |
|
|---|
| 657 | Matrix ATP = AA.t() * PP;
|
|---|
| 658 | SymmetricMatrix NN = _QQ.i();
|
|---|
| 659 | NN << NN + ATP * AA;
|
|---|
| 660 | _QQ = NN.i();
|
|---|
| 661 | dx = _QQ * ATP * ll;
|
|---|
| 662 | vv = ll - AA * dx;
|
|---|
| 663 |
|
|---|
| 664 | // //// beg test
|
|---|
| 665 | // {
|
|---|
| 666 | // cout.setf(ios::fixed);
|
|---|
| 667 | // ColumnVector vv_code(epoData->sizeGPS());
|
|---|
| 668 | // ColumnVector vv_phase(epoData->sizeGPS());
|
|---|
| 669 | // ColumnVector vv_glo(epoData->sizeGlo());
|
|---|
| 670 | //
|
|---|
| 671 | // for (int iobs = 1; iobs <= epoData->sizeGPS(); ++iobs) {
|
|---|
| 672 | // vv_code(iobs) = vv(2*iobs-1);
|
|---|
| 673 | // vv_phase(iobs) = vv(2*iobs);
|
|---|
| 674 | // }
|
|---|
| 675 | // for (int iobs = 1; iobs <= epoData->sizeGlo(); ++iobs) {
|
|---|
| 676 | // vv_glo(iobs) = vv(2*epoData->sizeGPS()+iobs);
|
|---|
| 677 | // }
|
|---|
| 678 | //
|
|---|
| 679 | // cout << "residuals code " << setprecision(3) << vv_code.t();
|
|---|
| 680 | // cout << "residuals phase " << setprecision(3) << vv_phase.t();
|
|---|
| 681 | // cout << "residuals glo " << setprecision(3) << vv_glo.t();
|
|---|
| 682 | // }
|
|---|
| 683 | // //// end test
|
|---|
| 684 |
|
|---|
| 685 | } while (outlierDetection(QQsav, vv, epoData->satDataGPS,
|
|---|
| 686 | epoData->satDataGlo) != 0);
|
|---|
| 687 |
|
|---|
| 688 | // Set Solution Vector
|
|---|
| 689 | // -------------------
|
|---|
| 690 | ostringstream str1;
|
|---|
| 691 | str1.setf(ios::fixed);
|
|---|
| 692 | QVectorIterator<bncParam*> itPar(_params);
|
|---|
| 693 | while (itPar.hasNext()) {
|
|---|
| 694 | bncParam* par = itPar.next();
|
|---|
| 695 | par->xx += dx(par->index);
|
|---|
| 696 | if (par->type == bncParam::RECCLK_GPS) {
|
|---|
| 697 | str1 << "\n clk GPS = " << setw(6) << setprecision(3) << par->xx
|
|---|
| 698 | << " +- " << setw(6) << setprecision(3)
|
|---|
| 699 | << sqrt(_QQ(par->index,par->index));
|
|---|
| 700 | }
|
|---|
| 701 | if (par->type == bncParam::RECCLK_GLO) {
|
|---|
| 702 | str1 << "\n clk GLO = " << setw(6) << setprecision(3) << par->xx
|
|---|
| 703 | << " +- " << setw(6) << setprecision(3)
|
|---|
| 704 | << sqrt(_QQ(par->index,par->index));
|
|---|
| 705 | }
|
|---|
| 706 | else if (par->type == bncParam::AMB_L3) {
|
|---|
| 707 | str1 << "\n amb " << par->prn.toAscii().data() << " = "
|
|---|
| 708 | << setw(6) << setprecision(3) << par->xx
|
|---|
| 709 | << " +- " << setw(6) << setprecision(3)
|
|---|
| 710 | << sqrt(_QQ(par->index,par->index));
|
|---|
| 711 | }
|
|---|
| 712 | else if (par->type == bncParam::TROPO) {
|
|---|
| 713 | str1 << "\n trp = " << par->prn.toAscii().data()
|
|---|
| 714 | << setw(7) << setprecision(3) << delay_saast(M_PI/2.0) << " "
|
|---|
| 715 | << setw(6) << setprecision(3) << showpos << par->xx << noshowpos
|
|---|
| 716 | << " +- " << setw(6) << setprecision(3)
|
|---|
| 717 | << sqrt(_QQ(par->index,par->index));
|
|---|
| 718 | }
|
|---|
| 719 | }
|
|---|
| 720 | _log += str1.str().c_str();
|
|---|
| 721 |
|
|---|
| 722 | // Message (both log file and screen)
|
|---|
| 723 | // ----------------------------------
|
|---|
| 724 | ostringstream str2;
|
|---|
| 725 | str2.setf(ios::fixed);
|
|---|
| 726 | str2 << _staID.data() << ": PPP "
|
|---|
| 727 | << epoData->tt.timestr(1) << " " << epoData->sizeAll() << " "
|
|---|
| 728 | << setw(14) << setprecision(3) << x() << " +- "
|
|---|
| 729 | << setw(6) << setprecision(3) << sqrt(_QQ(1,1)) << " "
|
|---|
| 730 | << setw(14) << setprecision(3) << y() << " +- "
|
|---|
| 731 | << setw(6) << setprecision(3) << sqrt(_QQ(2,2)) << " "
|
|---|
| 732 | << setw(14) << setprecision(3) << z() << " +- "
|
|---|
| 733 | << setw(6) << setprecision(3) << sqrt(_QQ(3,3));
|
|---|
| 734 |
|
|---|
| 735 | emit newMessage(_log, false);
|
|---|
| 736 | emit newMessage(QByteArray(str2.str().c_str()), true);
|
|---|
| 737 |
|
|---|
| 738 | // NMEA Output
|
|---|
| 739 | // -----------
|
|---|
| 740 | double xyz[3];
|
|---|
| 741 | xyz[0] = x();
|
|---|
| 742 | xyz[1] = y();
|
|---|
| 743 | xyz[2] = z();
|
|---|
| 744 | double ell[3];
|
|---|
| 745 | xyz2ell(xyz, ell);
|
|---|
| 746 | double phiDeg = ell[0] * 180 / M_PI;
|
|---|
| 747 | double lamDeg = ell[1] * 180 / M_PI;
|
|---|
| 748 |
|
|---|
| 749 | char phiCh = 'N';
|
|---|
| 750 | if (phiDeg < 0) {
|
|---|
| 751 | phiDeg = -phiDeg;
|
|---|
| 752 | phiCh = 'S';
|
|---|
| 753 | }
|
|---|
| 754 | char lamCh = 'E';
|
|---|
| 755 | if (lamDeg < 0) {
|
|---|
| 756 | lamDeg = -lamDeg;
|
|---|
| 757 | lamCh = 'W';
|
|---|
| 758 | }
|
|---|
| 759 |
|
|---|
| 760 | double dop = 2.0; // TODO
|
|---|
| 761 |
|
|---|
| 762 | ostringstream str3;
|
|---|
| 763 | str3.setf(ios::fixed);
|
|---|
| 764 | str3 << "GPGGA,"
|
|---|
| 765 | << epoData->tt.timestr(0,0) << ','
|
|---|
| 766 | << setw(2) << setfill('0') << int(phiDeg)
|
|---|
| 767 | << setw(10) << setprecision(7) << setfill('0')
|
|---|
| 768 | << fmod(60*phiDeg,60) << ',' << phiCh << ','
|
|---|
| 769 | << setw(2) << setfill('0') << int(lamDeg)
|
|---|
| 770 | << setw(10) << setprecision(7) << setfill('0')
|
|---|
| 771 | << fmod(60*lamDeg,60) << ',' << lamCh
|
|---|
| 772 | << ",1," << setw(2) << setfill('0') << epoData->sizeAll() << ','
|
|---|
| 773 | << setw(3) << setprecision(1) << dop << ','
|
|---|
| 774 | << setprecision(3) << ell[2] << ",M,0.0,M,,,";
|
|---|
| 775 |
|
|---|
| 776 | writeNMEAstr(QString(str3.str().c_str()));
|
|---|
| 777 |
|
|---|
| 778 | return success;
|
|---|
| 779 | }
|
|---|
| 780 |
|
|---|
| 781 | // Outlier Detection
|
|---|
| 782 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 783 | int bncModel::outlierDetection(const SymmetricMatrix& QQsav,
|
|---|
| 784 | const ColumnVector& vv,
|
|---|
| 785 | QMap<QString, t_satData*>& satDataGPS,
|
|---|
| 786 | QMap<QString, t_satData*>& satDataGlo) {
|
|---|
| 787 |
|
|---|
| 788 | double vvMaxCodeGPS = 0.0;
|
|---|
| 789 | double vvMaxPhaseGPS = 0.0;
|
|---|
| 790 | double vvMaxPhaseGlo = 0.0;
|
|---|
| 791 | QMutableMapIterator<QString, t_satData*> itMaxCodeGPS(satDataGPS);
|
|---|
| 792 | QMutableMapIterator<QString, t_satData*> itMaxPhaseGPS(satDataGPS);
|
|---|
| 793 | QMutableMapIterator<QString, t_satData*> itMaxPhaseGlo(satDataGlo);
|
|---|
| 794 |
|
|---|
| 795 | int ii = 0;
|
|---|
| 796 |
|
|---|
| 797 | // GPS code and (optionally) phase residuals
|
|---|
| 798 | // -----------------------------------------
|
|---|
| 799 | QMutableMapIterator<QString, t_satData*> itGPS(satDataGPS);
|
|---|
| 800 | while (itGPS.hasNext()) {
|
|---|
| 801 | itGPS.next();
|
|---|
| 802 | ++ii;
|
|---|
| 803 |
|
|---|
| 804 | if (vvMaxCodeGPS == 0.0 || fabs(vv(ii)) > vvMaxCodeGPS) {
|
|---|
| 805 | vvMaxCodeGPS = fabs(vv(ii));
|
|---|
| 806 | itMaxCodeGPS = itGPS;
|
|---|
| 807 | }
|
|---|
| 808 |
|
|---|
| 809 | if (_usePhase) {
|
|---|
| 810 | ++ii;
|
|---|
| 811 | if (vvMaxPhaseGPS == 0.0 || fabs(vv(ii)) > vvMaxPhaseGPS) {
|
|---|
| 812 | vvMaxPhaseGPS = fabs(vv(ii));
|
|---|
| 813 | itMaxPhaseGPS = itGPS;
|
|---|
| 814 | }
|
|---|
| 815 | }
|
|---|
| 816 | }
|
|---|
| 817 |
|
|---|
| 818 | // Glonass phase residuals
|
|---|
| 819 | // -----------------------
|
|---|
| 820 | if (_usePhase) {
|
|---|
| 821 | QMutableMapIterator<QString, t_satData*> itGlo(satDataGlo);
|
|---|
| 822 | while (itGlo.hasNext()) {
|
|---|
| 823 | itGlo.next();
|
|---|
| 824 | ++ii;
|
|---|
| 825 | if (vvMaxPhaseGlo == 0.0 || fabs(vv(ii)) > vvMaxPhaseGlo) {
|
|---|
| 826 | vvMaxPhaseGlo = fabs(vv(ii));
|
|---|
| 827 | itMaxPhaseGlo = itGlo;
|
|---|
| 828 | }
|
|---|
| 829 | }
|
|---|
| 830 | }
|
|---|
| 831 |
|
|---|
| 832 | if (vvMaxCodeGPS > MAXRES_CODE_GPS) {
|
|---|
| 833 | QString prn = itMaxCodeGPS.key();
|
|---|
| 834 | t_satData* satData = itMaxCodeGPS.value();
|
|---|
| 835 | delete satData;
|
|---|
| 836 | itMaxCodeGPS.remove();
|
|---|
| 837 | _QQ = QQsav;
|
|---|
| 838 |
|
|---|
| 839 | _log += "\nOutlier Code " + prn.toAscii() + " "
|
|---|
| 840 | + QByteArray::number(vvMaxCodeGPS, 'f', 3);
|
|---|
| 841 |
|
|---|
| 842 | return 1;
|
|---|
| 843 | }
|
|---|
| 844 | else if (vvMaxPhaseGPS > MAXRES_PHASE_GPS) {
|
|---|
| 845 | QString prn = itMaxPhaseGPS.key();
|
|---|
| 846 | t_satData* satData = itMaxPhaseGPS.value();
|
|---|
| 847 | delete satData;
|
|---|
| 848 | itMaxPhaseGPS.remove();
|
|---|
| 849 | _QQ = QQsav;
|
|---|
| 850 |
|
|---|
| 851 | _log += "\nOutlier Phase " + prn.toAscii() + " "
|
|---|
| 852 | + QByteArray::number(vvMaxPhaseGPS, 'f', 3);
|
|---|
| 853 |
|
|---|
| 854 | return 1;
|
|---|
| 855 | }
|
|---|
| 856 | else if (vvMaxPhaseGlo > MAXRES_PHASE_GLO) {
|
|---|
| 857 | QString prn = itMaxPhaseGlo.key();
|
|---|
| 858 | t_satData* satData = itMaxPhaseGlo.value();
|
|---|
| 859 | delete satData;
|
|---|
| 860 | itMaxPhaseGlo.remove();
|
|---|
| 861 | _QQ = QQsav;
|
|---|
| 862 |
|
|---|
| 863 | _log += "\nOutlier Phase " + prn.toAscii() + " "
|
|---|
| 864 | + QByteArray::number(vvMaxPhaseGlo, 'f', 3);
|
|---|
| 865 |
|
|---|
| 866 | return 1;
|
|---|
| 867 | }
|
|---|
| 868 |
|
|---|
| 869 | return 0;
|
|---|
| 870 | }
|
|---|
| 871 |
|
|---|
| 872 | //
|
|---|
| 873 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 874 | void bncModel::writeNMEAstr(const QString& nmStr) {
|
|---|
| 875 |
|
|---|
| 876 | unsigned char XOR = 0;
|
|---|
| 877 | for (int ii = 0; ii < nmStr.length(); ii++) {
|
|---|
| 878 | XOR ^= (unsigned char) nmStr[ii].toAscii();
|
|---|
| 879 | }
|
|---|
| 880 |
|
|---|
| 881 | QString outStr = '$' + nmStr
|
|---|
| 882 | + QString("*%1\n").arg(int(XOR), 0, 16).toUpper();
|
|---|
| 883 |
|
|---|
| 884 | if (_nmeaStream) {
|
|---|
| 885 | *_nmeaStream << outStr;
|
|---|
| 886 | _nmeaStream->flush();
|
|---|
| 887 | }
|
|---|
| 888 |
|
|---|
| 889 | emit newNMEAstr(outStr.toAscii());
|
|---|
| 890 | }
|
|---|