[2898] | 1 | /* -------------------------------------------------------------------------
|
---|
| 2 | * BKG NTRIP Client
|
---|
| 3 | * -------------------------------------------------------------------------
|
---|
| 4 | *
|
---|
| 5 | * Class: bncComb
|
---|
| 6 | *
|
---|
| 7 | * Purpose: Combinations of Orbit/Clock Corrections
|
---|
| 8 | *
|
---|
| 9 | * Author: L. Mervart
|
---|
| 10 | *
|
---|
| 11 | * Created: 22-Jan-2011
|
---|
| 12 | *
|
---|
| 13 | * Changes:
|
---|
| 14 | *
|
---|
| 15 | * -----------------------------------------------------------------------*/
|
---|
| 16 |
|
---|
[2933] | 17 | #include <newmatio.h>
|
---|
[2921] | 18 | #include <iomanip>
|
---|
[3214] | 19 | #include <sstream>
|
---|
[2898] | 20 |
|
---|
| 21 | #include "bnccomb.h"
|
---|
| 22 | #include "bncapp.h"
|
---|
[3201] | 23 | #include "upload/bncrtnetdecoder.h"
|
---|
[2910] | 24 | #include "bncsettings.h"
|
---|
[2933] | 25 | #include "bncmodel.h"
|
---|
[2988] | 26 | #include "bncutils.h"
|
---|
[3027] | 27 | #include "bncpppclient.h"
|
---|
[3181] | 28 | #include "bncsp3.h"
|
---|
[3052] | 29 | #include "bncantex.h"
|
---|
[3055] | 30 | #include "bnctides.h"
|
---|
[2898] | 31 |
|
---|
[3455] | 32 | const int moduloTime = 10;
|
---|
[2898] | 33 |
|
---|
[3455] | 34 | const double sig0_offAC = 1000.0;
|
---|
| 35 | const double sig0_offACSat = 100.0;
|
---|
[3468] | 36 | const double sigP_offACSat = 0.01;
|
---|
[3455] | 37 | const double sig0_clkSat = 100.0;
|
---|
| 38 |
|
---|
| 39 | const double sigObs = 0.05;
|
---|
| 40 |
|
---|
[3134] | 41 | const int MAXPRN_GPS = 32;
|
---|
| 42 |
|
---|
[3455] | 43 | using namespace std;
|
---|
| 44 |
|
---|
[3474] | 45 | // Auxiliary Class for Single-Differences
|
---|
| 46 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 47 | class t_sDiff {
|
---|
| 48 | public:
|
---|
| 49 | QMap<QString, double> diff;
|
---|
| 50 | };
|
---|
| 51 |
|
---|
[2898] | 52 | // Constructor
|
---|
| 53 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3429] | 54 | cmbParam::cmbParam(parType type_, int index_,
|
---|
| 55 | const QString& ac_, const QString& prn_) {
|
---|
[3032] | 56 |
|
---|
[3433] | 57 | type = type_;
|
---|
| 58 | index = index_;
|
---|
| 59 | AC = ac_;
|
---|
| 60 | prn = prn_;
|
---|
| 61 | xx = 0.0;
|
---|
[3455] | 62 | eph = 0;
|
---|
[3429] | 63 |
|
---|
| 64 | if (type == offAC) {
|
---|
[3455] | 65 | epoSpec = true;
|
---|
| 66 | sig0 = sig0_offAC;
|
---|
| 67 | sigP = sig0;
|
---|
[3429] | 68 | }
|
---|
| 69 | else if (type == offACSat) {
|
---|
[3455] | 70 | epoSpec = false;
|
---|
| 71 | sig0 = sig0_offACSat;
|
---|
| 72 | sigP = sigP_offACSat;
|
---|
[3429] | 73 | }
|
---|
| 74 | else if (type == clkSat) {
|
---|
[3455] | 75 | epoSpec = true;
|
---|
| 76 | sig0 = sig0_clkSat;
|
---|
| 77 | sigP = sig0;
|
---|
[3429] | 78 | }
|
---|
[2933] | 79 | }
|
---|
| 80 |
|
---|
| 81 | // Destructor
|
---|
| 82 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 83 | cmbParam::~cmbParam() {
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | // Partial
|
---|
| 87 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3429] | 88 | double cmbParam::partial(const QString& AC_, const QString& prn_) {
|
---|
[2933] | 89 |
|
---|
[3429] | 90 | if (type == offAC) {
|
---|
[3032] | 91 | if (AC == AC_) {
|
---|
[2934] | 92 | return 1.0;
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
[3429] | 95 | else if (type == offACSat) {
|
---|
| 96 | if (AC == AC_ && prn == prn_) {
|
---|
[2933] | 97 | return 1.0;
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
[3429] | 100 | else if (type == clkSat) {
|
---|
| 101 | if (prn == prn_) {
|
---|
[2933] | 102 | return 1.0;
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | return 0.0;
|
---|
| 107 | }
|
---|
| 108 |
|
---|
[2990] | 109 | //
|
---|
| 110 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 111 | QString cmbParam::toString() const {
|
---|
[2933] | 112 |
|
---|
[2990] | 113 | QString outStr;
|
---|
| 114 |
|
---|
[3429] | 115 | if (type == offAC) {
|
---|
[2992] | 116 | outStr = "AC offset " + AC;
|
---|
[2990] | 117 | }
|
---|
[3429] | 118 | else if (type == offACSat) {
|
---|
[2992] | 119 | outStr = "Sat Offset " + AC + " " + prn;
|
---|
[2990] | 120 | }
|
---|
[3429] | 121 | else if (type == clkSat) {
|
---|
[2992] | 122 | outStr = "Clk Corr " + prn;
|
---|
[2990] | 123 | }
|
---|
[2933] | 124 |
|
---|
[2990] | 125 | return outStr;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
[2933] | 128 | // Constructor
|
---|
| 129 | ////////////////////////////////////////////////////////////////////////////
|
---|
[2898] | 130 | bncComb::bncComb() {
|
---|
[2910] | 131 |
|
---|
| 132 | bncSettings settings;
|
---|
| 133 |
|
---|
| 134 | QStringList combineStreams = settings.value("combineStreams").toStringList();
|
---|
[2918] | 135 |
|
---|
[3455] | 136 | _masterMissingEpochs = 0;
|
---|
| 137 |
|
---|
[3143] | 138 | if (combineStreams.size() >= 1 && !combineStreams[0].isEmpty()) {
|
---|
[2910] | 139 | QListIterator<QString> it(combineStreams);
|
---|
| 140 | while (it.hasNext()) {
|
---|
| 141 | QStringList hlp = it.next().split(" ");
|
---|
[2918] | 142 | cmbAC* newAC = new cmbAC();
|
---|
| 143 | newAC->mountPoint = hlp[0];
|
---|
| 144 | newAC->name = hlp[1];
|
---|
| 145 | newAC->weight = hlp[2].toDouble();
|
---|
[3453] | 146 | if (_masterOrbitAC.isEmpty()) {
|
---|
| 147 | _masterOrbitAC = newAC->name;
|
---|
| 148 | }
|
---|
[3429] | 149 | _ACs.append(newAC);
|
---|
[2910] | 150 | }
|
---|
| 151 | }
|
---|
[2927] | 152 |
|
---|
[3211] | 153 | _rtnetDecoder = 0;
|
---|
[3201] | 154 |
|
---|
[2990] | 155 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
| 156 | ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool)));
|
---|
[2933] | 157 |
|
---|
[3470] | 158 | // Combination Method
|
---|
| 159 | // ------------------
|
---|
[3481] | 160 | if (settings.value("cmbMethod").toString() == "Single-Epoch") {
|
---|
| 161 | _method = singleEpoch;
|
---|
[3470] | 162 | }
|
---|
| 163 | else {
|
---|
[3481] | 164 | _method = filter;
|
---|
[3470] | 165 | }
|
---|
[3032] | 166 |
|
---|
| 167 | // Initialize Parameters (model: Clk_Corr = AC_Offset + Sat_Offset + Clk)
|
---|
| 168 | // ----------------------------------------------------------------------
|
---|
[3470] | 169 | if (_method == filter) {
|
---|
| 170 | int nextPar = 0;
|
---|
| 171 | QListIterator<cmbAC*> it(_ACs);
|
---|
| 172 | while (it.hasNext()) {
|
---|
| 173 | cmbAC* AC = it.next();
|
---|
| 174 | _params.push_back(new cmbParam(cmbParam::offAC, ++nextPar, AC->name, ""));
|
---|
| 175 | for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
|
---|
| 176 | QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
|
---|
| 177 | _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar,
|
---|
| 178 | AC->name, prn));
|
---|
| 179 | }
|
---|
| 180 | }
|
---|
[3134] | 181 | for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
|
---|
| 182 | QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
|
---|
[3470] | 183 | _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
|
---|
[2991] | 184 | }
|
---|
[3470] | 185 |
|
---|
| 186 | // Initialize Variance-Covariance Matrix
|
---|
| 187 | // -------------------------------------
|
---|
| 188 | _QQ.ReSize(_params.size());
|
---|
| 189 | _QQ = 0.0;
|
---|
| 190 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 191 | cmbParam* pp = _params[iPar-1];
|
---|
| 192 | _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
|
---|
| 193 | }
|
---|
[2991] | 194 | }
|
---|
[2933] | 195 |
|
---|
[3052] | 196 | // ANTEX File
|
---|
| 197 | // ----------
|
---|
| 198 | _antex = 0;
|
---|
| 199 | QString antexFileName = settings.value("pppAntex").toString();
|
---|
| 200 | if (!antexFileName.isEmpty()) {
|
---|
| 201 | _antex = new bncAntex();
|
---|
| 202 | if (_antex->readFile(antexFileName) != success) {
|
---|
| 203 | emit newMessage("wrong ANTEX file", true);
|
---|
| 204 | delete _antex;
|
---|
| 205 | _antex = 0;
|
---|
| 206 | }
|
---|
| 207 | }
|
---|
[3138] | 208 |
|
---|
[3329] | 209 | // Maximal Residuum
|
---|
| 210 | // ----------------
|
---|
| 211 | _MAXRES = settings.value("cmbMaxres").toDouble();
|
---|
| 212 | if (_MAXRES <= 0.0) {
|
---|
| 213 | _MAXRES = 999.0;
|
---|
| 214 | }
|
---|
[2898] | 215 | }
|
---|
| 216 |
|
---|
| 217 | // Destructor
|
---|
| 218 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 219 | bncComb::~bncComb() {
|
---|
[3429] | 220 | QListIterator<cmbAC*> icAC(_ACs);
|
---|
| 221 | while (icAC.hasNext()) {
|
---|
| 222 | delete icAC.next();
|
---|
[2918] | 223 | }
|
---|
[3201] | 224 | delete _rtnetDecoder;
|
---|
[3052] | 225 | delete _antex;
|
---|
[3296] | 226 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 227 | delete _params[iPar-1];
|
---|
| 228 | }
|
---|
[3434] | 229 | QVectorIterator<cmbCorr*> itCorr(corrs());
|
---|
[3429] | 230 | while (itCorr.hasNext()) {
|
---|
| 231 | delete itCorr.next();
|
---|
| 232 | }
|
---|
[2898] | 233 | }
|
---|
| 234 |
|
---|
[2928] | 235 | // Read and store one correction line
|
---|
[2898] | 236 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 237 | void bncComb::processCorrLine(const QString& staID, const QString& line) {
|
---|
[2906] | 238 | QMutexLocker locker(&_mutex);
|
---|
[2913] | 239 |
|
---|
[3431] | 240 | // Find the AC Name
|
---|
| 241 | // ----------------
|
---|
| 242 | QString acName;
|
---|
| 243 | QListIterator<cmbAC*> icAC(_ACs);
|
---|
| 244 | while (icAC.hasNext()) {
|
---|
| 245 | cmbAC* AC = icAC.next();
|
---|
| 246 | if (AC->mountPoint == staID) {
|
---|
| 247 | acName = AC->name;
|
---|
| 248 | break;
|
---|
| 249 | }
|
---|
| 250 | }
|
---|
| 251 | if (acName.isEmpty()) {
|
---|
| 252 | return;
|
---|
| 253 | }
|
---|
| 254 |
|
---|
[2918] | 255 | // Read the Correction
|
---|
| 256 | // -------------------
|
---|
[3429] | 257 | cmbCorr* newCorr = new cmbCorr();
|
---|
[3431] | 258 | newCorr->acName = acName;
|
---|
[2913] | 259 | if (!newCorr->readLine(line) == success) {
|
---|
| 260 | delete newCorr;
|
---|
| 261 | return;
|
---|
| 262 | }
|
---|
| 263 |
|
---|
[3274] | 264 | // Check Modulo Time
|
---|
| 265 | // -----------------
|
---|
| 266 | if (int(newCorr->tt.gpssec()) % moduloTime != 0.0) {
|
---|
| 267 | delete newCorr;
|
---|
| 268 | return;
|
---|
| 269 | }
|
---|
| 270 |
|
---|
[3299] | 271 | // Delete old corrections
|
---|
| 272 | // ----------------------
|
---|
[3437] | 273 | if (_resTime.valid() && newCorr->tt <= _resTime) {
|
---|
[2924] | 274 | delete newCorr;
|
---|
| 275 | return;
|
---|
| 276 | }
|
---|
| 277 |
|
---|
[3029] | 278 | // Check the Ephemeris
|
---|
| 279 | //--------------------
|
---|
[2986] | 280 | if (_eph.find(newCorr->prn) == _eph.end()) {
|
---|
| 281 | delete newCorr;
|
---|
| 282 | return;
|
---|
| 283 | }
|
---|
| 284 | else {
|
---|
| 285 | t_eph* lastEph = _eph[newCorr->prn]->last;
|
---|
| 286 | t_eph* prevEph = _eph[newCorr->prn]->prev;
|
---|
[3029] | 287 | if (lastEph && lastEph->IOD() == newCorr->iod) {
|
---|
| 288 | newCorr->eph = lastEph;
|
---|
[2986] | 289 | }
|
---|
[3029] | 290 | else if (prevEph && prevEph->IOD() == newCorr->iod) {
|
---|
| 291 | newCorr->eph = prevEph;
|
---|
[3429] | 292 | switchToLastEph(lastEph, newCorr);
|
---|
[3029] | 293 | }
|
---|
| 294 | else {
|
---|
[2986] | 295 | delete newCorr;
|
---|
| 296 | return;
|
---|
| 297 | }
|
---|
| 298 | }
|
---|
| 299 |
|
---|
[3435] | 300 | // Process previous Epoch(s)
|
---|
| 301 | // -------------------------
|
---|
| 302 | QListIterator<bncTime> itTime(_buffer.keys());
|
---|
| 303 | while (itTime.hasNext()) {
|
---|
| 304 | bncTime epoTime = itTime.next();
|
---|
[3438] | 305 | if (epoTime < newCorr->tt - moduloTime) {
|
---|
[3435] | 306 | _resTime = epoTime;
|
---|
| 307 | processEpoch();
|
---|
| 308 | }
|
---|
[2927] | 309 | }
|
---|
| 310 |
|
---|
[3429] | 311 | // Merge or add the correction
|
---|
| 312 | // ---------------------------
|
---|
[3435] | 313 | QVector<cmbCorr*>& corrs = _buffer[newCorr->tt].corrs;
|
---|
[3429] | 314 | cmbCorr* existingCorr = 0;
|
---|
[3435] | 315 | QVectorIterator<cmbCorr*> itCorr(corrs);
|
---|
[3429] | 316 | while (itCorr.hasNext()) {
|
---|
| 317 | cmbCorr* hlp = itCorr.next();
|
---|
| 318 | if (hlp->prn == newCorr->prn && hlp->acName == newCorr->prn) {
|
---|
| 319 | existingCorr = hlp;
|
---|
[2918] | 320 | break;
|
---|
| 321 | }
|
---|
| 322 | }
|
---|
[3429] | 323 | if (existingCorr) {
|
---|
[3298] | 324 | delete newCorr;
|
---|
[3429] | 325 | existingCorr->readLine(line); // merge (multiple messages)
|
---|
[2918] | 326 | }
|
---|
[2919] | 327 | else {
|
---|
[3435] | 328 | corrs.append(newCorr);
|
---|
[2919] | 329 | }
|
---|
[2898] | 330 | }
|
---|
| 331 |
|
---|
[2986] | 332 | // Change the correction so that it refers to last received ephemeris
|
---|
| 333 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3029] | 334 | void bncComb::switchToLastEph(const t_eph* lastEph, t_corr* corr) {
|
---|
[3028] | 335 |
|
---|
[3429] | 336 | if (corr->eph == lastEph) {
|
---|
| 337 | return;
|
---|
| 338 | }
|
---|
| 339 |
|
---|
[2987] | 340 | ColumnVector oldXC(4);
|
---|
| 341 | ColumnVector oldVV(3);
|
---|
[3029] | 342 | corr->eph->position(corr->tt.gpsw(), corr->tt.gpssec(),
|
---|
| 343 | oldXC.data(), oldVV.data());
|
---|
[2988] | 344 |
|
---|
[2987] | 345 | ColumnVector newXC(4);
|
---|
| 346 | ColumnVector newVV(3);
|
---|
[3029] | 347 | lastEph->position(corr->tt.gpsw(), corr->tt.gpssec(),
|
---|
[2987] | 348 | newXC.data(), newVV.data());
|
---|
[2988] | 349 |
|
---|
| 350 | ColumnVector dX = newXC.Rows(1,3) - oldXC.Rows(1,3);
|
---|
[2989] | 351 | ColumnVector dV = newVV - oldVV;
|
---|
| 352 | double dC = newXC(4) - oldXC(4);
|
---|
| 353 |
|
---|
[2988] | 354 | ColumnVector dRAO(3);
|
---|
| 355 | XYZ_to_RSW(newXC.Rows(1,3), newVV, dX, dRAO);
|
---|
[2989] | 356 |
|
---|
| 357 | ColumnVector dDotRAO(3);
|
---|
| 358 | XYZ_to_RSW(newXC.Rows(1,3), newVV, dV, dDotRAO);
|
---|
| 359 |
|
---|
[3455] | 360 | QString msg = "switch corr " + corr->prn
|
---|
[3029] | 361 | + QString(" %1 -> %2 %3").arg(corr->iod,3)
|
---|
[3013] | 362 | .arg(lastEph->IOD(),3).arg(dC*t_CST::c, 8, 'f', 4);
|
---|
| 363 |
|
---|
[3029] | 364 | emit newMessage(msg.toAscii(), false);
|
---|
[3028] | 365 |
|
---|
[3029] | 366 | corr->iod = lastEph->IOD();
|
---|
| 367 | corr->eph = lastEph;
|
---|
[3031] | 368 | corr->rao += dRAO;
|
---|
| 369 | corr->dotRao += dDotRAO;
|
---|
[3029] | 370 | corr->dClk -= dC;
|
---|
[2986] | 371 | }
|
---|
| 372 |
|
---|
[3429] | 373 | // Process Epoch
|
---|
[2928] | 374 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3429] | 375 | void bncComb::processEpoch() {
|
---|
[2918] | 376 |
|
---|
[2990] | 377 | _log.clear();
|
---|
| 378 |
|
---|
| 379 | QTextStream out(&_log, QIODevice::WriteOnly);
|
---|
| 380 |
|
---|
[3472] | 381 | out << endl << "Combination:" << endl
|
---|
| 382 | << "------------------------------" << endl;
|
---|
[2990] | 383 |
|
---|
[3433] | 384 | // Observation Statistics
|
---|
| 385 | // ----------------------
|
---|
[3455] | 386 | bool masterPresent = false;
|
---|
[3433] | 387 | QListIterator<cmbAC*> icAC(_ACs);
|
---|
| 388 | while (icAC.hasNext()) {
|
---|
| 389 | cmbAC* AC = icAC.next();
|
---|
| 390 | AC->numObs = 0;
|
---|
[3434] | 391 | QVectorIterator<cmbCorr*> itCorr(corrs());
|
---|
[3433] | 392 | while (itCorr.hasNext()) {
|
---|
| 393 | cmbCorr* corr = itCorr.next();
|
---|
| 394 | if (corr->acName == AC->name) {
|
---|
| 395 | AC->numObs += 1;
|
---|
[3453] | 396 | if (AC->name == _masterOrbitAC) {
|
---|
| 397 | masterPresent = true;
|
---|
| 398 | }
|
---|
[3433] | 399 | }
|
---|
| 400 | }
|
---|
| 401 | out << AC->name.toAscii().data() << ": " << AC->numObs << endl;
|
---|
| 402 | }
|
---|
| 403 |
|
---|
[3453] | 404 | // If Master not present, switch to another one
|
---|
| 405 | // --------------------------------------------
|
---|
[3456] | 406 | if (masterPresent) {
|
---|
| 407 | _masterMissingEpochs = 0;
|
---|
| 408 | }
|
---|
| 409 | else {
|
---|
[3455] | 410 | ++_masterMissingEpochs;
|
---|
[3459] | 411 | if (_masterMissingEpochs < 10) {
|
---|
[3457] | 412 | out << "Missing Master, Epoch skipped" << endl;
|
---|
[3455] | 413 | _buffer.remove(_resTime);
|
---|
| 414 | emit newMessage(_log, false);
|
---|
| 415 | return;
|
---|
[3453] | 416 | }
|
---|
[3455] | 417 | else {
|
---|
| 418 | _masterMissingEpochs = 0;
|
---|
| 419 | QListIterator<cmbAC*> icAC(_ACs);
|
---|
| 420 | while (icAC.hasNext()) {
|
---|
| 421 | cmbAC* AC = icAC.next();
|
---|
| 422 | if (AC->numObs > 0) {
|
---|
| 423 | out << "Switching Master AC "
|
---|
| 424 | << _masterOrbitAC.toAscii().data() << " --> "
|
---|
| 425 | << AC->name.toAscii().data() << " "
|
---|
| 426 | << _resTime.datestr().c_str() << " "
|
---|
| 427 | << _resTime.timestr().c_str() << endl;
|
---|
| 428 | _masterOrbitAC = AC->name;
|
---|
| 429 | break;
|
---|
| 430 | }
|
---|
[3452] | 431 | }
|
---|
| 432 | }
|
---|
| 433 | }
|
---|
| 434 |
|
---|
[3472] | 435 | QMap<QString, t_corr*> resCorr;
|
---|
| 436 |
|
---|
| 437 | // Perform the actual Combination using selected Method
|
---|
| 438 | // ----------------------------------------------------
|
---|
| 439 | t_irc irc;
|
---|
[3475] | 440 | ColumnVector dx;
|
---|
[3472] | 441 | if (_method == filter) {
|
---|
[3475] | 442 | irc = processEpoch_filter(out, resCorr, dx);
|
---|
[3472] | 443 | }
|
---|
| 444 | else {
|
---|
[3475] | 445 | irc = processEpoch_singleEpoch(out, resCorr, dx);
|
---|
[3472] | 446 | }
|
---|
| 447 |
|
---|
[3475] | 448 | // Update Parameter Values, Print Results
|
---|
| 449 | // --------------------------------------
|
---|
[3472] | 450 | if (irc == success) {
|
---|
[3475] | 451 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 452 | cmbParam* pp = _params[iPar-1];
|
---|
| 453 | pp->xx += dx(iPar);
|
---|
| 454 | if (pp->type == cmbParam::clkSat) {
|
---|
| 455 | if (resCorr.find(pp->prn) != resCorr.end()) {
|
---|
| 456 | resCorr[pp->prn]->dClk = pp->xx / t_CST::c;
|
---|
| 457 | }
|
---|
| 458 | }
|
---|
| 459 | out << _resTime.datestr().c_str() << " "
|
---|
| 460 | << _resTime.timestr().c_str() << " ";
|
---|
| 461 | out.setRealNumberNotation(QTextStream::FixedNotation);
|
---|
| 462 | out.setFieldWidth(8);
|
---|
| 463 | out.setRealNumberPrecision(4);
|
---|
| 464 | out << pp->toString() << " "
|
---|
| 465 | << pp->xx << " +- " << sqrt(_QQ(pp->index,pp->index)) << endl;
|
---|
| 466 | out.setFieldWidth(0);
|
---|
| 467 | }
|
---|
[3472] | 468 | printResults(out, resCorr);
|
---|
| 469 | dumpResults(resCorr);
|
---|
| 470 | }
|
---|
| 471 |
|
---|
| 472 | // Delete Data, emit Message
|
---|
| 473 | // -------------------------
|
---|
| 474 | _buffer.remove(_resTime);
|
---|
| 475 | emit newMessage(_log, false);
|
---|
| 476 | }
|
---|
| 477 |
|
---|
| 478 | // Process Epoch - Filter Method
|
---|
| 479 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 480 | t_irc bncComb::processEpoch_filter(QTextStream& out,
|
---|
[3475] | 481 | QMap<QString, t_corr*>& resCorr,
|
---|
| 482 | ColumnVector& dx) {
|
---|
[3472] | 483 |
|
---|
[3429] | 484 | // Prediction Step
|
---|
| 485 | // ---------------
|
---|
[3472] | 486 | int nPar = _params.size();
|
---|
[2933] | 487 | ColumnVector x0(nPar);
|
---|
| 488 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
[3455] | 489 | cmbParam* pp = _params[iPar-1];
|
---|
| 490 | if (pp->epoSpec) {
|
---|
[3451] | 491 | pp->xx = 0.0;
|
---|
[3455] | 492 | _QQ.Row(iPar) = 0.0;
|
---|
| 493 | _QQ.Column(iPar) = 0.0;
|
---|
| 494 | _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
|
---|
[3451] | 495 | }
|
---|
[3455] | 496 | else {
|
---|
| 497 | _QQ(iPar,iPar) += pp->sigP * pp->sigP;
|
---|
| 498 | }
|
---|
[2933] | 499 | x0(iPar) = pp->xx;
|
---|
| 500 | }
|
---|
| 501 |
|
---|
[3455] | 502 | SymmetricMatrix QQ_sav = _QQ;
|
---|
[3441] | 503 |
|
---|
[3455] | 504 | // Update and outlier detection loop
|
---|
| 505 | // ---------------------------------
|
---|
| 506 | while (true) {
|
---|
[3135] | 507 |
|
---|
[3455] | 508 | Matrix AA;
|
---|
| 509 | ColumnVector ll;
|
---|
| 510 | DiagonalMatrix PP;
|
---|
[3429] | 511 |
|
---|
[3455] | 512 | if (createAmat(AA, ll, PP, x0, resCorr) != success) {
|
---|
[3472] | 513 | return failure;
|
---|
[3441] | 514 | }
|
---|
[2933] | 515 |
|
---|
[3429] | 516 | bncModel::kalman(AA, ll, PP, _QQ, dx);
|
---|
| 517 | ColumnVector vv = ll - AA * dx;
|
---|
[3080] | 518 |
|
---|
[3429] | 519 | int maxResIndex;
|
---|
| 520 | double maxRes = vv.maximum_absolute_value1(maxResIndex);
|
---|
| 521 | out.setRealNumberNotation(QTextStream::FixedNotation);
|
---|
| 522 | out.setRealNumberPrecision(3);
|
---|
| 523 | out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
|
---|
[3432] | 524 | << " Maximum Residuum " << maxRes << ' '
|
---|
[3434] | 525 | << corrs()[maxResIndex-1]->acName << ' ' << corrs()[maxResIndex-1]->prn;
|
---|
[3080] | 526 |
|
---|
[3432] | 527 | if (maxRes > _MAXRES) {
|
---|
| 528 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 529 | cmbParam* pp = _params[iPar-1];
|
---|
| 530 | if (pp->type == cmbParam::offACSat &&
|
---|
[3434] | 531 | pp->AC == corrs()[maxResIndex-1]->acName &&
|
---|
| 532 | pp->prn == corrs()[maxResIndex-1]->prn) {
|
---|
[3432] | 533 | QQ_sav.Row(iPar) = 0.0;
|
---|
| 534 | QQ_sav.Column(iPar) = 0.0;
|
---|
[3455] | 535 | QQ_sav(iPar,iPar) = pp->sig0 * pp->sig0;
|
---|
[3432] | 536 | }
|
---|
| 537 | }
|
---|
| 538 |
|
---|
| 539 | out << " Outlier" << endl;
|
---|
| 540 | _QQ = QQ_sav;
|
---|
[3455] | 541 | corrs().remove(maxResIndex-1);
|
---|
[3432] | 542 | }
|
---|
| 543 | else {
|
---|
| 544 | out << " OK" << endl;
|
---|
| 545 | break;
|
---|
| 546 | }
|
---|
| 547 | }
|
---|
| 548 |
|
---|
[3472] | 549 | return success;
|
---|
[2918] | 550 | }
|
---|
[3011] | 551 |
|
---|
[3201] | 552 | // Print results
|
---|
[3011] | 553 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3429] | 554 | void bncComb::printResults(QTextStream& out,
|
---|
[3011] | 555 | const QMap<QString, t_corr*>& resCorr) {
|
---|
| 556 |
|
---|
| 557 | QMapIterator<QString, t_corr*> it(resCorr);
|
---|
| 558 | while (it.hasNext()) {
|
---|
| 559 | it.next();
|
---|
| 560 | t_corr* corr = it.value();
|
---|
[3029] | 561 | const t_eph* eph = corr->eph;
|
---|
[3015] | 562 | if (eph) {
|
---|
| 563 | double xx, yy, zz, cc;
|
---|
[3429] | 564 | eph->position(_resTime.gpsw(), _resTime.gpssec(), xx, yy, zz, cc);
|
---|
[3015] | 565 |
|
---|
[3429] | 566 | out << _resTime.datestr().c_str() << " "
|
---|
| 567 | << _resTime.timestr().c_str() << " ";
|
---|
[3015] | 568 | out.setFieldWidth(3);
|
---|
| 569 | out << "Full Clock " << corr->prn << " " << corr->iod << " ";
|
---|
| 570 | out.setFieldWidth(14);
|
---|
| 571 | out << (cc + corr->dClk) * t_CST::c << endl;
|
---|
[3370] | 572 | out.setFieldWidth(0);
|
---|
[3015] | 573 | }
|
---|
| 574 | else {
|
---|
| 575 | out << "bncComb::printResuls bug" << endl;
|
---|
| 576 | }
|
---|
[3011] | 577 | }
|
---|
| 578 | }
|
---|
[3202] | 579 |
|
---|
| 580 | // Send results to RTNet Decoder and directly to PPP Client
|
---|
| 581 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3429] | 582 | void bncComb::dumpResults(const QMap<QString, t_corr*>& resCorr) {
|
---|
[3202] | 583 |
|
---|
[3214] | 584 | ostringstream out; out.setf(std::ios::fixed);
|
---|
[3216] | 585 | QStringList corrLines;
|
---|
[3214] | 586 |
|
---|
| 587 | unsigned year, month, day, hour, minute;
|
---|
| 588 | double sec;
|
---|
[3429] | 589 | _resTime.civil_date(year, month, day);
|
---|
| 590 | _resTime.civil_time(hour, minute, sec);
|
---|
[3214] | 591 |
|
---|
| 592 | out << "* "
|
---|
| 593 | << setw(4) << year << " "
|
---|
| 594 | << setw(2) << month << " "
|
---|
| 595 | << setw(2) << day << " "
|
---|
| 596 | << setw(2) << hour << " "
|
---|
| 597 | << setw(2) << minute << " "
|
---|
| 598 | << setw(12) << setprecision(8) << sec << " "
|
---|
| 599 | << endl;
|
---|
| 600 |
|
---|
[3202] | 601 | QMapIterator<QString, t_corr*> it(resCorr);
|
---|
| 602 | while (it.hasNext()) {
|
---|
| 603 | it.next();
|
---|
| 604 | t_corr* corr = it.value();
|
---|
| 605 |
|
---|
[3214] | 606 | double dT = 60.0;
|
---|
[3202] | 607 |
|
---|
[3214] | 608 | for (int iTime = 1; iTime <= 2; iTime++) {
|
---|
| 609 |
|
---|
[3429] | 610 | bncTime time12 = (iTime == 1) ? _resTime : _resTime + dT;
|
---|
[3214] | 611 |
|
---|
| 612 | ColumnVector xc(4);
|
---|
| 613 | ColumnVector vv(3);
|
---|
| 614 | corr->eph->position(time12.gpsw(), time12.gpssec(),
|
---|
| 615 | xc.data(), vv.data());
|
---|
| 616 | bncPPPclient::applyCorr(time12, corr, xc, vv);
|
---|
| 617 |
|
---|
| 618 | // Relativistic Correction
|
---|
| 619 | // -----------------------
|
---|
| 620 | double relCorr = - 2.0 * DotProduct(xc.Rows(1,3),vv) / t_CST::c / t_CST::c;
|
---|
| 621 | xc(4) -= relCorr;
|
---|
| 622 |
|
---|
| 623 | // Code Biases
|
---|
| 624 | // -----------
|
---|
| 625 | double dcbP1C1 = 0.0;
|
---|
| 626 | double dcbP1P2 = 0.0;
|
---|
| 627 |
|
---|
| 628 | // Correction Phase Center --> CoM
|
---|
| 629 | // -------------------------------
|
---|
| 630 | ColumnVector dx(3); dx = 0.0;
|
---|
| 631 | if (_antex) {
|
---|
| 632 | double Mjd = time12.mjd() + time12.daysec()/86400.0;
|
---|
| 633 | if (_antex->satCoMcorrection(corr->prn, Mjd, xc.Rows(1,3), dx) == success) {
|
---|
| 634 | xc(1) -= dx(1);
|
---|
| 635 | xc(2) -= dx(2);
|
---|
| 636 | xc(3) -= dx(3);
|
---|
| 637 | }
|
---|
| 638 | else {
|
---|
| 639 | cout << "antenna not found" << endl;
|
---|
| 640 | }
|
---|
| 641 | }
|
---|
| 642 |
|
---|
| 643 | if (iTime == 1) {
|
---|
| 644 | out << 'P' << corr->prn.toAscii().data()
|
---|
| 645 | << setw(14) << setprecision(6) << xc(1) / 1000.0
|
---|
| 646 | << setw(14) << setprecision(6) << xc(2) / 1000.0
|
---|
| 647 | << setw(14) << setprecision(6) << xc(3) / 1000.0
|
---|
| 648 | << setw(14) << setprecision(6) << xc(4) * 1e6
|
---|
| 649 | << setw(14) << setprecision(6) << relCorr * 1e6
|
---|
| 650 | << setw(8) << setprecision(3) << dx(1)
|
---|
| 651 | << setw(8) << setprecision(3) << dx(2)
|
---|
| 652 | << setw(8) << setprecision(3) << dx(3)
|
---|
| 653 | << setw(8) << setprecision(3) << dcbP1C1
|
---|
| 654 | << setw(8) << setprecision(3) << dcbP1P2
|
---|
| 655 | << setw(6) << setprecision(1) << dT;
|
---|
[3216] | 656 |
|
---|
[3218] | 657 | QString line;
|
---|
[3217] | 658 | int messageType = COTYPE_GPSCOMBINED;
|
---|
[3218] | 659 | int updateInt = 0;
|
---|
| 660 | line.sprintf("%d %d %d %.1f %s"
|
---|
| 661 | " %3d"
|
---|
| 662 | " %8.3f %8.3f %8.3f %8.3f"
|
---|
| 663 | " %10.5f %10.5f %10.5f %10.5f"
|
---|
[3262] | 664 | " %10.5f %10.5f %10.5f %10.5f INTERNAL",
|
---|
[3218] | 665 | messageType, updateInt, time12.gpsw(), time12.gpssec(),
|
---|
| 666 | corr->prn.toAscii().data(),
|
---|
| 667 | corr->iod,
|
---|
[3219] | 668 | corr->dClk * t_CST::c,
|
---|
[3218] | 669 | corr->rao[0],
|
---|
| 670 | corr->rao[1],
|
---|
| 671 | corr->rao[2],
|
---|
[3219] | 672 | corr->dotDClk * t_CST::c,
|
---|
[3218] | 673 | corr->dotRao[0],
|
---|
| 674 | corr->dotRao[1],
|
---|
| 675 | corr->dotRao[2],
|
---|
[3262] | 676 | corr->dotDotDClk * t_CST::c,
|
---|
| 677 | corr->dotDotRao[0],
|
---|
| 678 | corr->dotDotRao[1],
|
---|
| 679 | corr->dotDotRao[2]);
|
---|
[3220] | 680 | corrLines << line;
|
---|
[3214] | 681 | }
|
---|
| 682 | else {
|
---|
| 683 | out << setw(14) << setprecision(6) << xc(1) / 1000.0
|
---|
| 684 | << setw(14) << setprecision(6) << xc(2) / 1000.0
|
---|
| 685 | << setw(14) << setprecision(6) << xc(3) / 1000.0 << endl;
|
---|
| 686 | }
|
---|
| 687 | }
|
---|
| 688 |
|
---|
| 689 | delete corr;
|
---|
| 690 | }
|
---|
[3228] | 691 | out << "EOE" << endl; // End Of Epoch flag
|
---|
[3214] | 692 |
|
---|
[3215] | 693 | if (!_rtnetDecoder) {
|
---|
| 694 | _rtnetDecoder = new bncRtnetDecoder();
|
---|
| 695 | }
|
---|
[3221] | 696 |
|
---|
[3215] | 697 | vector<string> errmsg;
|
---|
[3221] | 698 | _rtnetDecoder->Decode((char*) out.str().data(), out.str().size(), errmsg);
|
---|
[3215] | 699 |
|
---|
[3216] | 700 | // Optionally send new Corrections to PPP
|
---|
| 701 | // --------------------------------------
|
---|
| 702 | bncApp* app = (bncApp*) qApp;
|
---|
| 703 | if (app->_bncPPPclient) {
|
---|
| 704 | app->_bncPPPclient->slotNewCorrections(corrLines);
|
---|
| 705 | }
|
---|
[3202] | 706 | }
|
---|
[3455] | 707 |
|
---|
| 708 | // Create First Design Matrix and Vector of Measurements
|
---|
| 709 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 710 | t_irc bncComb::createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
|
---|
| 711 | const ColumnVector& x0,
|
---|
| 712 | QMap<QString, t_corr*>& resCorr) {
|
---|
| 713 |
|
---|
| 714 | unsigned nPar = _params.size();
|
---|
| 715 | unsigned nObs = corrs().size();
|
---|
| 716 |
|
---|
| 717 | if (nObs == 0) {
|
---|
| 718 | return failure;
|
---|
| 719 | }
|
---|
| 720 |
|
---|
[3474] | 721 | const int nCon = (_method == filter) ? 1 + MAXPRN_GPS : 0;
|
---|
[3455] | 722 |
|
---|
| 723 | AA.ReSize(nObs+nCon, nPar); AA = 0.0;
|
---|
| 724 | ll.ReSize(nObs+nCon); ll = 0.0;
|
---|
| 725 | PP.ReSize(nObs+nCon); PP = 1.0 / (sigObs * sigObs);
|
---|
| 726 |
|
---|
| 727 | int iObs = 0;
|
---|
| 728 |
|
---|
| 729 | QVectorIterator<cmbCorr*> itCorr(corrs());
|
---|
| 730 | while (itCorr.hasNext()) {
|
---|
| 731 | cmbCorr* corr = itCorr.next();
|
---|
| 732 | QString prn = corr->prn;
|
---|
| 733 | switchToLastEph(_eph[prn]->last, corr);
|
---|
| 734 | ++iObs;
|
---|
| 735 |
|
---|
[3476] | 736 | if (corr->acName == _masterOrbitAC && resCorr.find(prn) == resCorr.end()) {
|
---|
| 737 | resCorr[prn] = new t_corr(*corr);
|
---|
[3455] | 738 | }
|
---|
| 739 |
|
---|
| 740 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 741 | cmbParam* pp = _params[iPar-1];
|
---|
| 742 | AA(iObs, iPar) = pp->partial(corr->acName, prn);
|
---|
| 743 | }
|
---|
| 744 |
|
---|
| 745 | ll(iObs) = corr->dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
|
---|
| 746 | }
|
---|
| 747 |
|
---|
| 748 | // Regularization
|
---|
| 749 | // --------------
|
---|
[3474] | 750 | if (_method == filter) {
|
---|
| 751 | const double Ph = 1.e6;
|
---|
| 752 | PP(nObs+1) = Ph;
|
---|
[3461] | 753 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 754 | cmbParam* pp = _params[iPar-1];
|
---|
[3465] | 755 | if ( AA.Column(iPar).maximum_absolute_value() > 0.0 &&
|
---|
[3474] | 756 | pp->type == cmbParam::clkSat ) {
|
---|
| 757 | AA(nObs+1, iPar) = 1.0;
|
---|
[3455] | 758 | }
|
---|
| 759 | }
|
---|
[3474] | 760 | int iCond = 1;
|
---|
| 761 | for (int iGps = 1; iGps <= MAXPRN_GPS; iGps++) {
|
---|
| 762 | QString prn = QString("G%1").arg(iGps, 2, 10, QChar('0'));
|
---|
| 763 | ++iCond;
|
---|
| 764 | PP(nObs+iCond) = Ph;
|
---|
| 765 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 766 | cmbParam* pp = _params[iPar-1];
|
---|
| 767 | if ( AA.Column(iPar).maximum_absolute_value() > 0.0 &&
|
---|
| 768 | pp->type == cmbParam::offACSat &&
|
---|
| 769 | pp->prn == prn) {
|
---|
| 770 | AA(nObs+iCond, iPar) = 1.0;
|
---|
| 771 | }
|
---|
| 772 | }
|
---|
| 773 | }
|
---|
[3455] | 774 | }
|
---|
| 775 |
|
---|
| 776 | return success;
|
---|
| 777 | }
|
---|
[3470] | 778 |
|
---|
| 779 | // Process Epoch - Single-Epoch Method
|
---|
| 780 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3472] | 781 | t_irc bncComb::processEpoch_singleEpoch(QTextStream& out,
|
---|
[3475] | 782 | QMap<QString, t_corr*>& resCorr,
|
---|
| 783 | ColumnVector& dx) {
|
---|
[3470] | 784 |
|
---|
[3476] | 785 | // Remove Satellites that are not in Master
|
---|
| 786 | // ----------------------------------------
|
---|
[3478] | 787 | QMutableVectorIterator<cmbCorr*> it(corrs());
|
---|
| 788 | while (it.hasNext()) {
|
---|
| 789 | cmbCorr* corr = it.next();
|
---|
[3473] | 790 | QString prn = corr->prn;
|
---|
[3476] | 791 | bool foundMaster = false;
|
---|
[3478] | 792 | QVectorIterator<cmbCorr*> itHlp(corrs());
|
---|
| 793 | while (itHlp.hasNext()) {
|
---|
| 794 | cmbCorr* corrHlp = itHlp.next();
|
---|
| 795 | QString prnHlp = corrHlp->prn;
|
---|
| 796 | QString ACHlp = corrHlp->acName;
|
---|
| 797 | if (ACHlp == _masterOrbitAC && prn == prnHlp) {
|
---|
[3476] | 798 | foundMaster = true;
|
---|
| 799 | break;
|
---|
| 800 | }
|
---|
[3473] | 801 | }
|
---|
[3476] | 802 | if (!foundMaster) {
|
---|
[3478] | 803 | it.remove();
|
---|
[3476] | 804 | }
|
---|
[3473] | 805 | }
|
---|
| 806 |
|
---|
[3474] | 807 | // Count Number of Observations per Satellite and per AC
|
---|
| 808 | // -----------------------------------------------------
|
---|
| 809 | QMap<QString, int> numObsPrn;
|
---|
| 810 | QMap<QString, int> numObsAC;
|
---|
[3476] | 811 | QVectorIterator<cmbCorr*> itCorr(corrs());
|
---|
| 812 | while (itCorr.hasNext()) {
|
---|
| 813 | cmbCorr* corr = itCorr.next();
|
---|
| 814 | QString prn = corr->prn;
|
---|
| 815 | QString AC = corr->acName;
|
---|
| 816 | if (numObsPrn.find(prn) == numObsPrn.end()) {
|
---|
| 817 | numObsPrn[prn] = 1;
|
---|
[3474] | 818 | }
|
---|
[3476] | 819 | else {
|
---|
| 820 | numObsPrn[prn] += 1;
|
---|
| 821 | }
|
---|
| 822 | if (numObsAC.find(AC) == numObsAC.end()) {
|
---|
| 823 | numObsAC[AC] = 1;
|
---|
| 824 | }
|
---|
| 825 | else {
|
---|
| 826 | numObsAC[AC] += 1;
|
---|
| 827 | }
|
---|
[3474] | 828 | }
|
---|
| 829 |
|
---|
| 830 | // Clean-Up the Paramters
|
---|
| 831 | // ----------------------
|
---|
| 832 | for (int iPar = 1; iPar <= _params.size(); iPar++) {
|
---|
| 833 | delete _params[iPar-1];
|
---|
| 834 | }
|
---|
| 835 | _params.clear();
|
---|
| 836 |
|
---|
| 837 | // Set new Parameters
|
---|
| 838 | // ------------------
|
---|
| 839 | int nextPar = 0;
|
---|
| 840 |
|
---|
| 841 | QMapIterator<QString, int> itAC(numObsAC);
|
---|
| 842 | while (itAC.hasNext()) {
|
---|
| 843 | itAC.next();
|
---|
| 844 | const QString& AC = itAC.key();
|
---|
| 845 | int numObs = itAC.value();
|
---|
[3476] | 846 | if (AC != _masterOrbitAC && numObs > 0) {
|
---|
[3474] | 847 | _params.push_back(new cmbParam(cmbParam::offAC, ++nextPar, AC, ""));
|
---|
| 848 | }
|
---|
| 849 | }
|
---|
| 850 |
|
---|
| 851 | QMapIterator<QString, int> itPrn(numObsPrn);
|
---|
| 852 | while (itPrn.hasNext()) {
|
---|
| 853 | itPrn.next();
|
---|
| 854 | const QString& prn = itPrn.key();
|
---|
| 855 | int numObs = itPrn.value();
|
---|
| 856 | if (numObs > 0) {
|
---|
| 857 | _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
|
---|
| 858 | }
|
---|
| 859 | }
|
---|
| 860 |
|
---|
| 861 | int nPar = _params.size();
|
---|
| 862 | ColumnVector x0(nPar);
|
---|
| 863 | x0 = 0.0;
|
---|
| 864 |
|
---|
| 865 | // Create First-Design Matrix
|
---|
| 866 | // --------------------------
|
---|
| 867 | Matrix AA;
|
---|
| 868 | ColumnVector ll;
|
---|
| 869 | DiagonalMatrix PP;
|
---|
| 870 | if (createAmat(AA, ll, PP, x0, resCorr) != success) {
|
---|
[3473] | 871 | return failure;
|
---|
| 872 | }
|
---|
[3474] | 873 |
|
---|
[3478] | 874 | ColumnVector vv;
|
---|
| 875 | try {
|
---|
| 876 | Matrix ATP = AA.t() * PP;
|
---|
| 877 | SymmetricMatrix NN; NN << ATP * AA;
|
---|
| 878 | ColumnVector bb = ATP * ll;
|
---|
| 879 | _QQ = NN.i();
|
---|
| 880 | dx = _QQ * bb;
|
---|
| 881 | vv = ll - AA * dx;
|
---|
| 882 | }
|
---|
| 883 | catch (Exception& exc) {
|
---|
| 884 | out << exc.what() << endl;
|
---|
| 885 | return failure;
|
---|
| 886 | }
|
---|
[3474] | 887 |
|
---|
[3477] | 888 | out.setRealNumberNotation(QTextStream::FixedNotation);
|
---|
| 889 | out.setRealNumberPrecision(3);
|
---|
[3478] | 890 | for (int ii = 0; ii < vv.Nrows(); ii++) {
|
---|
| 891 | const cmbCorr* corr = corrs()[ii];
|
---|
| 892 | out << _resTime.datestr().c_str() << ' '
|
---|
| 893 | << _resTime.timestr().c_str() << " "
|
---|
[3479] | 894 | << corr->acName << ' ' << corr->prn;
|
---|
| 895 | out.setFieldWidth(6);
|
---|
| 896 | out << " dClk = " << corr->dClk * t_CST::c << " res = " << vv[ii] << endl;
|
---|
| 897 | out.setFieldWidth(0);
|
---|
[3478] | 898 | }
|
---|
[3477] | 899 |
|
---|
[3474] | 900 | return success;
|
---|
[3470] | 901 | }
|
---|