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