[2035] | 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: bncPPPclient
|
---|
| 30 | *
|
---|
| 31 | * Purpose: Precise Point Positioning
|
---|
| 32 | *
|
---|
| 33 | * Author: L. Mervart
|
---|
| 34 | *
|
---|
| 35 | * Created: 21-Nov-2009
|
---|
| 36 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
[2249] | 41 | #include <newmatio.h>
|
---|
[2238] | 42 | #include <iomanip>
|
---|
[2549] | 43 | #include <sstream>
|
---|
[2238] | 44 |
|
---|
[2035] | 45 | #include "bncpppclient.h"
|
---|
[2113] | 46 | #include "bncapp.h"
|
---|
[2043] | 47 | #include "bncutils.h"
|
---|
[2044] | 48 | #include "bncconst.h"
|
---|
[2058] | 49 | #include "bncmodel.h"
|
---|
[3635] | 50 | #include "pppopt.h"
|
---|
[2035] | 51 |
|
---|
| 52 | using namespace std;
|
---|
| 53 |
|
---|
| 54 | // Constructor
|
---|
| 55 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3640] | 56 | bncPPPclient::bncPPPclient(QByteArray staID, t_pppOpt* opt, bool connectSlots) :
|
---|
| 57 | bncEphUser(connectSlots) {
|
---|
[2113] | 58 |
|
---|
[3635] | 59 | if (opt) {
|
---|
| 60 | _opt = opt;
|
---|
| 61 | _optOwner = false;
|
---|
[2226] | 62 | }
|
---|
| 63 | else {
|
---|
[3635] | 64 | _opt = new t_pppOpt();
|
---|
| 65 | _optOwner = true;
|
---|
[2226] | 66 | }
|
---|
| 67 |
|
---|
[3635] | 68 | _staID = staID;
|
---|
[2776] | 69 |
|
---|
[3638] | 70 | _model = new bncModel(this);
|
---|
| 71 |
|
---|
[3640] | 72 | if (connectSlots) {
|
---|
| 73 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
| 74 | ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
|
---|
[2548] | 75 |
|
---|
[3640] | 76 | connect(((bncApp*)qApp), SIGNAL(newCorrections(QList<QString>)),
|
---|
| 77 | this, SLOT(slotNewCorrections(QList<QString>)));
|
---|
| 78 | }
|
---|
[2035] | 79 | }
|
---|
| 80 |
|
---|
| 81 | // Destructor
|
---|
| 82 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 83 | bncPPPclient::~bncPPPclient() {
|
---|
[2058] | 84 | delete _model;
|
---|
[2808] | 85 | while (!_epoData.empty()) {
|
---|
| 86 | delete _epoData.front();
|
---|
| 87 | _epoData.pop();
|
---|
| 88 | }
|
---|
[2035] | 89 | QMapIterator<QString, t_corr*> ic(_corr);
|
---|
| 90 | while (ic.hasNext()) {
|
---|
| 91 | ic.next();
|
---|
| 92 | delete ic.value();
|
---|
| 93 | }
|
---|
[2274] | 94 | QMapIterator<QString, t_bias*> ib(_bias);
|
---|
| 95 | while (ib.hasNext()) {
|
---|
| 96 | ib.next();
|
---|
| 97 | delete ib.value();
|
---|
| 98 | }
|
---|
[3635] | 99 | if (_optOwner) {
|
---|
| 100 | delete _opt;
|
---|
| 101 | }
|
---|
[2035] | 102 | }
|
---|
| 103 |
|
---|
| 104 | //
|
---|
| 105 | ////////////////////////////////////////////////////////////////////////////
|
---|
[2711] | 106 | void bncPPPclient::putNewObs(const t_obs& obs) {
|
---|
[2037] | 107 | QMutexLocker locker(&_mutex);
|
---|
[2051] | 108 |
|
---|
[2777] | 109 | if (obs.satSys == 'R') {
|
---|
[3635] | 110 | if (!_opt->useGlonass) return;
|
---|
[2225] | 111 | }
|
---|
[2777] | 112 | else if (obs.satSys == 'E') {
|
---|
[3635] | 113 | if (!_opt->useGalileo) return;
|
---|
[2776] | 114 | }
|
---|
| 115 | else if (obs.satSys != 'G') {
|
---|
| 116 | return;
|
---|
| 117 | }
|
---|
[2225] | 118 |
|
---|
[2051] | 119 | t_satData* satData = new t_satData();
|
---|
[2808] | 120 | satData->tt = bncTime(obs.GPSWeek, obs.GPSWeeks);
|
---|
[2051] | 121 |
|
---|
[2274] | 122 | // Satellite Number
|
---|
| 123 | // ----------------
|
---|
[2777] | 124 | satData->prn = QString("%1%2").arg(obs.satSys).arg(obs.satNum,2,10,QChar('0'));
|
---|
[2274] | 125 |
|
---|
[2505] | 126 | // Check Slips
|
---|
| 127 | // -----------
|
---|
| 128 | slipInfo& sInfo = _slips[satData->prn];
|
---|
[2711] | 129 | if ( sInfo.slipCntL1 == obs.slip_cnt_L1 &&
|
---|
[2778] | 130 | sInfo.slipCntL2 == obs.slip_cnt_L2 &&
|
---|
| 131 | sInfo.slipCntL5 == obs.slip_cnt_L5 ) {
|
---|
[2505] | 132 | satData->slipFlag = false;
|
---|
| 133 | }
|
---|
| 134 | else {
|
---|
| 135 | satData->slipFlag = true;
|
---|
| 136 | }
|
---|
[2711] | 137 | sInfo.slipCntL1 = obs.slip_cnt_L1;
|
---|
| 138 | sInfo.slipCntL2 = obs.slip_cnt_L2;
|
---|
[2505] | 139 |
|
---|
[2274] | 140 | // Handle Code Biases
|
---|
| 141 | // ------------------
|
---|
| 142 | t_bias* bb = 0;
|
---|
| 143 | if (_bias.contains(satData->prn)) {
|
---|
| 144 | bb = _bias.value(satData->prn);
|
---|
| 145 | }
|
---|
| 146 |
|
---|
[2808] | 147 | // Add new epoch, process the older ones
|
---|
| 148 | // -------------------------------------
|
---|
| 149 | if (_epoData.size() == 0) {
|
---|
| 150 | _epoData.push(new t_epoData());
|
---|
| 151 | _epoData.back()->tt = satData->tt;
|
---|
[2037] | 152 | }
|
---|
[2808] | 153 | else if (satData->tt != _epoData.back()->tt) {
|
---|
| 154 | processEpochs();
|
---|
| 155 | _epoData.push(new t_epoData());
|
---|
| 156 | _epoData.back()->tt = satData->tt;
|
---|
[2037] | 157 | }
|
---|
[2039] | 158 |
|
---|
[4784] | 159 | // Set Observations GPS and Glonass
|
---|
| 160 | // --------------------------------
|
---|
| 161 | if (obs.satSys == 'G' || obs.satSys == 'R') {
|
---|
[4799] | 162 | const QByteArray preferredTypes("WPC");
|
---|
| 163 | for (int ii = preferredTypes.length()-1; ii >= 0; ii--) {
|
---|
[4787] | 164 | for (int iPhase = 0; iPhase <= 1; iPhase++) {
|
---|
| 165 | for (int iFreq = 1; iFreq <= 2; iFreq++) {
|
---|
| 166 |
|
---|
| 167 | char rnxStr[3];
|
---|
| 168 | double* p_value = 0;
|
---|
| 169 | if (iPhase == 0 && iFreq == 1) {
|
---|
| 170 | rnxStr[0] = 'C';
|
---|
| 171 | rnxStr[1] = '1';
|
---|
| 172 | p_value = &satData->P1;
|
---|
| 173 | }
|
---|
| 174 | else if (iPhase == 0 && iFreq == 2) {
|
---|
| 175 | rnxStr[0] = 'C';
|
---|
| 176 | rnxStr[1] = '2';
|
---|
| 177 | p_value = &satData->P2;
|
---|
| 178 | }
|
---|
| 179 | else if (iPhase == 1 && iFreq == 1) {
|
---|
| 180 | rnxStr[0] = 'L';
|
---|
| 181 | rnxStr[1] = '1';
|
---|
| 182 | p_value = &satData->L1;
|
---|
| 183 | }
|
---|
| 184 | else if (iPhase == 1 && iFreq == 2) {
|
---|
| 185 | rnxStr[0] = 'L';
|
---|
| 186 | rnxStr[1] = '2';
|
---|
| 187 | p_value = &satData->L2;
|
---|
| 188 | }
|
---|
| 189 |
|
---|
[4799] | 190 | rnxStr[2] = preferredTypes[ii];
|
---|
[4787] | 191 |
|
---|
| 192 | double measdata = obs.measdata(rnxStr, 3.0);
|
---|
| 193 | if (measdata != 0.0) {
|
---|
| 194 | *p_value = measdata;
|
---|
| 195 | if (rnxStr[0] == 'C' && bb) {
|
---|
| 196 | char biasStr[2];
|
---|
| 197 | biasStr[0] = rnxStr[1];
|
---|
| 198 | biasStr[1] = rnxStr[2];
|
---|
| 199 | *p_value += bb->value(biasStr);
|
---|
| 200 | }
|
---|
| 201 | }
|
---|
[4784] | 202 | }
|
---|
[4787] | 203 | }
|
---|
[2778] | 204 | }
|
---|
[4787] | 205 |
|
---|
[4784] | 206 | if (satData->P1 != 0.0 && satData->P2 != 0.0 &&
|
---|
| 207 | satData->L1 != 0.0 && satData->L2 != 0.0 ) {
|
---|
| 208 | double f1 = t_CST::f1(obs.satSys, obs.slotNum);
|
---|
| 209 | double f2 = t_CST::f2(obs.satSys, obs.slotNum);
|
---|
| 210 | double a1 = f1 * f1 / (f1 * f1 - f2 * f2);
|
---|
| 211 | double a2 = - f2 * f2 / (f1 * f1 - f2 * f2);
|
---|
| 212 | satData->L1 = satData->L1 * t_CST::c / f1;
|
---|
| 213 | satData->L2 = satData->L2 * t_CST::c / f2;
|
---|
| 214 | satData->P3 = a1 * satData->P1 + a2 * satData->P2;
|
---|
| 215 | satData->L3 = a1 * satData->L1 + a2 * satData->L2;
|
---|
| 216 | satData->lambda3 = a1 * t_CST::c / f1 + a2 * t_CST::c / f2;
|
---|
[3408] | 217 | _epoData.back()->satData[satData->prn] = satData;
|
---|
[2778] | 218 | }
|
---|
| 219 | else {
|
---|
| 220 | delete satData;
|
---|
| 221 | }
|
---|
[2786] | 222 | }
|
---|
[2778] | 223 |
|
---|
[2786] | 224 | // Set Observations Galileo
|
---|
| 225 | // ------------------------
|
---|
[2778] | 226 | else if (obs.satSys == 'E') {
|
---|
[4784] | 227 | satData->P1 = obs.measdata("C1", 3.0);
|
---|
| 228 | satData->L1 = obs.measdata("L1", 3.0);
|
---|
| 229 | satData->P5 = obs.measdata("C5", 3.0);
|
---|
| 230 | satData->L5 = obs.measdata("L5", 3.0);
|
---|
| 231 | if (satData->P1 != 0.0 && satData->P5 != 0.0 &&
|
---|
| 232 | satData->L1 != 0.0 && satData->L5 != 0.0 ) {
|
---|
[2786] | 233 | double f1 = t_CST::freq1;
|
---|
| 234 | double f5 = t_CST::freq5;
|
---|
[4784] | 235 | double a1 = f1 * f1 / (f1 * f1 - f5 * f5);
|
---|
| 236 | double a5 = - f5 * f5 / (f1 * f1 - f5 * f5);
|
---|
| 237 | satData->L1 = satData->L1 * t_CST::c / f1;
|
---|
| 238 | satData->L5 = satData->L5 * t_CST::c / f5;
|
---|
| 239 | satData->P3 = a1 * satData->P1 + a5 * satData->P5;
|
---|
| 240 | satData->L3 = a1 * satData->L1 + a5 * satData->L5;
|
---|
| 241 | satData->lambda3 = a1 * t_CST::c / f1 + a5 * t_CST::c / f5;
|
---|
[3408] | 242 | _epoData.back()->satData[satData->prn] = satData;
|
---|
[2778] | 243 | }
|
---|
| 244 | else {
|
---|
| 245 | delete satData;
|
---|
| 246 | }
|
---|
| 247 | }
|
---|
[2035] | 248 | }
|
---|
| 249 |
|
---|
| 250 | //
|
---|
| 251 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 252 | void bncPPPclient::slotNewCorrections(QList<QString> corrList) {
|
---|
| 253 | QMutexLocker locker(&_mutex);
|
---|
[2069] | 254 |
|
---|
[2966] | 255 | // Check the Mountpoint (source of corrections)
|
---|
| 256 | // --------------------------------------------
|
---|
[3635] | 257 | if (!_opt->pppCorrMount.isEmpty()) {
|
---|
[2966] | 258 | QMutableListIterator<QString> itm(corrList);
|
---|
| 259 | while (itm.hasNext()) {
|
---|
| 260 | QStringList hlp = itm.next().split(" ");
|
---|
| 261 | if (hlp.size() > 0) {
|
---|
| 262 | QString mountpoint = hlp[hlp.size()-1];
|
---|
[3635] | 263 | if (mountpoint != _opt->pppCorrMount) {
|
---|
[2966] | 264 | itm.remove();
|
---|
| 265 | }
|
---|
| 266 | }
|
---|
| 267 | }
|
---|
| 268 | }
|
---|
| 269 |
|
---|
[2069] | 270 | if (corrList.size() == 0) {
|
---|
| 271 | return;
|
---|
| 272 | }
|
---|
| 273 |
|
---|
[2035] | 274 | QListIterator<QString> it(corrList);
|
---|
| 275 | while (it.hasNext()) {
|
---|
[2911] | 276 | QString line = it.next();
|
---|
| 277 |
|
---|
| 278 | QTextStream in(&line);
|
---|
[2035] | 279 | int messageType;
|
---|
| 280 | int updateInterval;
|
---|
| 281 | int GPSweek;
|
---|
| 282 | double GPSweeks;
|
---|
| 283 | QString prn;
|
---|
| 284 | in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn;
|
---|
[2809] | 285 |
|
---|
[2911] | 286 | if ( t_corr::relevantMessageType(messageType) ) {
|
---|
[2035] | 287 | t_corr* cc = 0;
|
---|
| 288 | if (_corr.contains(prn)) {
|
---|
| 289 | cc = _corr.value(prn);
|
---|
| 290 | }
|
---|
| 291 | else {
|
---|
| 292 | cc = new t_corr();
|
---|
| 293 | _corr[prn] = cc;
|
---|
| 294 | }
|
---|
[2911] | 295 | cc->readLine(line);
|
---|
[3751] | 296 | _corr_tt = cc->tClk;
|
---|
[2035] | 297 | }
|
---|
[4784] | 298 | else if ( messageType == BTYPE_GPS || messageType == BTYPE_GLONASS ) {
|
---|
[2274] | 299 | t_bias* bb = 0;
|
---|
| 300 | if (_bias.contains(prn)) {
|
---|
[2341] | 301 | bb = _bias.value(prn);
|
---|
[2274] | 302 | }
|
---|
| 303 | else {
|
---|
| 304 | bb = new t_bias();
|
---|
| 305 | _bias[prn] = bb;
|
---|
| 306 | }
|
---|
[4784] | 307 | bb->readLine(line);
|
---|
[2274] | 308 | }
|
---|
[2035] | 309 | }
|
---|
| 310 | }
|
---|
| 311 |
|
---|
| 312 | // Satellite Position
|
---|
| 313 | ////////////////////////////////////////////////////////////////////////////
|
---|
[2123] | 314 | t_irc bncPPPclient::getSatPos(const bncTime& tt, const QString& prn,
|
---|
[2357] | 315 | ColumnVector& xc, ColumnVector& vv) {
|
---|
[2035] | 316 |
|
---|
[2576] | 317 | const double MAXAGE = 120.0;
|
---|
[2041] | 318 |
|
---|
[2035] | 319 | if (_eph.contains(prn)) {
|
---|
[2040] | 320 |
|
---|
[3635] | 321 | if (_opt->pppMode) {
|
---|
[2068] | 322 | if (_corr.contains(prn)) {
|
---|
| 323 | t_corr* cc = _corr.value(prn);
|
---|
[3751] | 324 | if (cc->ready() && tt - cc->tClk < MAXAGE) {
|
---|
[2576] | 325 | t_eph* eLast = _eph.value(prn)->last;
|
---|
| 326 | t_eph* ePrev = _eph.value(prn)->prev;
|
---|
| 327 | if (eLast && eLast->IOD() == cc->iod) {
|
---|
| 328 | eLast->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
|
---|
[3521] | 329 | return applyCorr(tt, cc, xc, vv);
|
---|
[2576] | 330 | }
|
---|
| 331 | else if (ePrev && ePrev->IOD() == cc->iod) {
|
---|
| 332 | ePrev->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
|
---|
[3521] | 333 | return applyCorr(tt, cc, xc, vv);
|
---|
[2576] | 334 | }
|
---|
| 335 | }
|
---|
[2041] | 336 | }
|
---|
[2040] | 337 | }
|
---|
[2576] | 338 |
|
---|
| 339 | else {
|
---|
| 340 | t_eph* ee = _eph.value(prn)->last;
|
---|
| 341 | ee->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
|
---|
| 342 | return success;
|
---|
| 343 | }
|
---|
[2035] | 344 | }
|
---|
| 345 |
|
---|
| 346 | return failure;
|
---|
| 347 | }
|
---|
| 348 |
|
---|
| 349 | //
|
---|
| 350 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3319] | 351 | t_irc bncPPPclient::applyCorr(const bncTime& tt, const t_corr* cc,
|
---|
[3521] | 352 | ColumnVector& xc, ColumnVector& vv) {
|
---|
[2041] | 353 |
|
---|
[3751] | 354 | double dtRao = tt - cc->tRao;
|
---|
| 355 | ColumnVector raoHlp = cc->rao + cc->dotRao * dtRao
|
---|
[4148] | 356 | + 0.5 * cc->dotDotRao * dtRao * dtRao;
|
---|
[2296] | 357 |
|
---|
[3319] | 358 | if (raoHlp.norm_Frobenius() > 20.0) {
|
---|
| 359 | return failure;
|
---|
| 360 | }
|
---|
| 361 |
|
---|
[3521] | 362 | ColumnVector dx(3);
|
---|
| 363 | RSW_to_XYZ(xc.Rows(1,3), vv, raoHlp, dx);
|
---|
| 364 | xc[0] -= dx[0];
|
---|
| 365 | xc[1] -= dx[1];
|
---|
| 366 | xc[2] -= dx[2];
|
---|
[3751] | 367 |
|
---|
| 368 | double dtClk = tt - cc->tClk;
|
---|
| 369 |
|
---|
| 370 | xc[3] += cc->dClk + cc->dotDClk * dtClk + cc->dotDotDClk * dtClk * dtClk
|
---|
[3521] | 371 | + cc->hrClk;
|
---|
[2296] | 372 |
|
---|
[3319] | 373 | return success;
|
---|
[2041] | 374 | }
|
---|
| 375 |
|
---|
[2049] | 376 | // Correct Time of Transmission
|
---|
| 377 | ////////////////////////////////////////////////////////////////////////////
|
---|
[2240] | 378 | t_irc bncPPPclient::cmpToT(t_satData* satData) {
|
---|
[2049] | 379 |
|
---|
[2051] | 380 | double prange = satData->P3;
|
---|
[2049] | 381 | if (prange == 0.0) {
|
---|
| 382 | return failure;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | double clkSat = 0.0;
|
---|
| 386 | for (int ii = 1; ii <= 10; ii++) {
|
---|
| 387 |
|
---|
[2808] | 388 | bncTime ToT = satData->tt - prange / t_CST::c - clkSat;
|
---|
[2049] | 389 |
|
---|
| 390 | ColumnVector xc(4);
|
---|
| 391 | ColumnVector vv(3);
|
---|
[2357] | 392 | if (getSatPos(ToT, satData->prn, xc, vv) != success) {
|
---|
[2049] | 393 | return failure;
|
---|
| 394 | }
|
---|
| 395 |
|
---|
| 396 | double clkSatOld = clkSat;
|
---|
[2050] | 397 | clkSat = xc(4);
|
---|
[2049] | 398 |
|
---|
| 399 | if ( fabs(clkSat-clkSatOld) * t_CST::c < 1.e-4 ) {
|
---|
| 400 | satData->xx = xc.Rows(1,3);
|
---|
| 401 | satData->vv = vv;
|
---|
[2050] | 402 | satData->clk = clkSat * t_CST::c;
|
---|
[2049] | 403 | return success;
|
---|
| 404 | }
|
---|
| 405 | }
|
---|
| 406 |
|
---|
| 407 | return failure;
|
---|
| 408 | }
|
---|
| 409 |
|
---|
[2041] | 410 | //
|
---|
| 411 | ////////////////////////////////////////////////////////////////////////////
|
---|
[2808] | 412 | void bncPPPclient::processFrontEpoch() {
|
---|
[2035] | 413 |
|
---|
[4149] | 414 | #ifdef BNC_DEBUG
|
---|
| 415 | QString msg = "List of Corrections\n";
|
---|
| 416 | QMapIterator<QString, t_corr*> itC(_corr);
|
---|
| 417 | while (itC.hasNext()) {
|
---|
| 418 | itC.next();
|
---|
| 419 | QString src = itC.key();
|
---|
| 420 | const t_corr* corr = itC.value();
|
---|
| 421 | msg += QString("%1 %2 %3 %4\n")
|
---|
| 422 | .arg(corr->prn)
|
---|
| 423 | .arg(corr->iod)
|
---|
| 424 | .arg(QString(corr->tClk.datestr().c_str()) + "_" + QString(corr->tClk.timestr().c_str()))
|
---|
| 425 | .arg(QString(corr->tRao.datestr().c_str()) + "_" + QString(corr->tRao.timestr().c_str()));
|
---|
| 426 | }
|
---|
| 427 |
|
---|
| 428 | msg += "List of Ephemeris\n";
|
---|
| 429 | QMapIterator<QString, t_ephPair*> itE(_eph);
|
---|
| 430 | while (itE.hasNext()) {
|
---|
| 431 | itE.next();
|
---|
| 432 | QString prn = itE.key();
|
---|
| 433 | const t_ephPair* ephPair = itE.value();
|
---|
| 434 | if (ephPair->prev) {
|
---|
| 435 | msg += QString("%1 %2 %3 %4 %5\n")
|
---|
| 436 | .arg(prn)
|
---|
| 437 | .arg(ephPair->last->IOD())
|
---|
| 438 | .arg(QString(ephPair->last->TOC().datestr().c_str()) + "_" +
|
---|
| 439 | QString(ephPair->last->TOC().timestr().c_str()))
|
---|
| 440 | .arg(ephPair->prev->IOD())
|
---|
| 441 | .arg(QString(ephPair->prev->TOC().datestr().c_str()) + "_" +
|
---|
| 442 | QString(ephPair->prev->TOC().timestr().c_str()));
|
---|
| 443 | }
|
---|
| 444 | else {
|
---|
| 445 | msg += QString("%1 %2 %3\n")
|
---|
| 446 | .arg(prn)
|
---|
| 447 | .arg(ephPair->last->IOD())
|
---|
| 448 | .arg(QString(ephPair->last->TOC().datestr().c_str()) + "_" +
|
---|
| 449 | QString(ephPair->last->TOC().timestr().c_str()));
|
---|
| 450 | }
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | emit newMessage(msg.toAscii(), false);
|
---|
| 454 | #endif // BNC_DEBUG
|
---|
| 455 |
|
---|
[2053] | 456 | // Data Pre-Processing
|
---|
| 457 | // -------------------
|
---|
[3408] | 458 | QMutableMapIterator<QString, t_satData*> it(_epoData.front()->satData);
|
---|
| 459 | while (it.hasNext()) {
|
---|
| 460 | it.next();
|
---|
| 461 | QString prn = it.key();
|
---|
| 462 | t_satData* satData = it.value();
|
---|
[2049] | 463 |
|
---|
[2240] | 464 | if (cmpToT(satData) != success) {
|
---|
[2049] | 465 | delete satData;
|
---|
[3408] | 466 | it.remove();
|
---|
[2049] | 467 | continue;
|
---|
| 468 | }
|
---|
[2053] | 469 | }
|
---|
[2035] | 470 |
|
---|
[2060] | 471 | // Filter Solution
|
---|
| 472 | // ---------------
|
---|
[2808] | 473 | if (_model->update(_epoData.front()) == success) {
|
---|
[2145] | 474 | emit newPosition(_model->time(), _model->x(), _model->y(), _model->z());
|
---|
[2060] | 475 | }
|
---|
[2035] | 476 | }
|
---|
[2808] | 477 |
|
---|
| 478 | //
|
---|
| 479 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 480 | void bncPPPclient::processEpochs() {
|
---|
[2809] | 481 |
|
---|
[2810] | 482 | // Make sure the buffer does not grow beyond any limit
|
---|
| 483 | // ---------------------------------------------------
|
---|
| 484 | const unsigned MAX_EPODATA_SIZE = 120;
|
---|
| 485 | if (_epoData.size() > MAX_EPODATA_SIZE) {
|
---|
| 486 | delete _epoData.front();
|
---|
| 487 | _epoData.pop();
|
---|
| 488 | }
|
---|
| 489 |
|
---|
| 490 | // Loop over all unprocessed epochs
|
---|
| 491 | // --------------------------------
|
---|
[2809] | 492 | while (!_epoData.empty()) {
|
---|
[2810] | 493 |
|
---|
[2809] | 494 | t_epoData* frontEpoData = _epoData.front();
|
---|
| 495 |
|
---|
| 496 | // No corrections yet, skip the epoch
|
---|
| 497 | // ----------------------------------
|
---|
[3635] | 498 | if (_opt->corrSync != 0.0 && !_corr_tt.valid()) {
|
---|
[2810] | 499 | return;
|
---|
[2809] | 500 | }
|
---|
| 501 |
|
---|
[2810] | 502 | // Process the front epoch
|
---|
| 503 | // -----------------------
|
---|
[3635] | 504 | if (_opt->corrSync == 0 || frontEpoData->tt - _corr_tt < _opt->corrSync) {
|
---|
[2809] | 505 | processFrontEpoch();
|
---|
| 506 | delete _epoData.front();
|
---|
| 507 | _epoData.pop();
|
---|
| 508 | }
|
---|
| 509 | else {
|
---|
| 510 | return;
|
---|
| 511 | }
|
---|
| 512 | }
|
---|
[2808] | 513 | }
|
---|