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