| [6333] | 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: t_sp3Comp
|
|---|
| 30 | *
|
|---|
| 31 | * Purpose: Compare SP3 Files
|
|---|
| 32 | *
|
|---|
| 33 | * Author: L. Mervart
|
|---|
| 34 | *
|
|---|
| 35 | * Created: 24-Nov-2014
|
|---|
| 36 | *
|
|---|
| [7942] | 37 | * Changes:
|
|---|
| [6333] | 38 | *
|
|---|
| 39 | * -----------------------------------------------------------------------*/
|
|---|
| 40 |
|
|---|
| 41 | #include <iostream>
|
|---|
| [6348] | 42 | #include <iomanip>
|
|---|
| [6333] | 43 | #include "sp3Comp.h"
|
|---|
| 44 | #include "bnccore.h"
|
|---|
| 45 | #include "bncsettings.h"
|
|---|
| 46 | #include "bncutils.h"
|
|---|
| [6348] | 47 | #include "bncsp3.h"
|
|---|
| [6333] | 48 |
|
|---|
| 49 | using namespace std;
|
|---|
| 50 |
|
|---|
| 51 | // Constructor
|
|---|
| 52 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 53 | t_sp3Comp::t_sp3Comp(QObject* parent) : QThread(parent) {
|
|---|
| 54 |
|
|---|
| [6338] | 55 | bncSettings settings;
|
|---|
| [10548] | 56 | _sp3FileNames = settings.value("sp3CompFile").toString().split(QRegExp("[ ,]"), Qt::SkipEmptyParts);
|
|---|
| [6338] | 57 | for (int ii = 0; ii < _sp3FileNames.size(); ii++) {
|
|---|
| 58 | expandEnvVar(_sp3FileNames[ii]);
|
|---|
| 59 | }
|
|---|
| [6339] | 60 | _logFileName = settings.value("sp3CompOutLogFile").toString(); expandEnvVar(_logFileName);
|
|---|
| 61 | _logFile = 0;
|
|---|
| 62 | _log = 0;
|
|---|
| [6429] | 63 |
|
|---|
| [10548] | 64 | _excludeSats = settings.value("sp3CompExclude").toString().split(QRegExp("[ ,]"), Qt::SkipEmptyParts);
|
|---|
| [10106] | 65 |
|
|---|
| 66 | _summaryOnly = (Qt::CheckState(settings.value("sp3CompSummaryOnly").toInt()) == Qt::Checked);
|
|---|
| [6333] | 67 | }
|
|---|
| 68 |
|
|---|
| 69 | // Destructor
|
|---|
| 70 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 71 | t_sp3Comp::~t_sp3Comp() {
|
|---|
| [6339] | 72 | delete _log;
|
|---|
| 73 | delete _logFile;
|
|---|
| [6333] | 74 | }
|
|---|
| 75 |
|
|---|
| [7942] | 76 | //
|
|---|
| [6333] | 77 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 78 | void t_sp3Comp::run() {
|
|---|
| [7942] | 79 |
|
|---|
| [6333] | 80 | // Open Log File
|
|---|
| 81 | // -------------
|
|---|
| [6339] | 82 | _logFile = new QFile(_logFileName);
|
|---|
| 83 | if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|---|
| 84 | _log = new QTextStream();
|
|---|
| 85 | _log->setDevice(_logFile);
|
|---|
| 86 | }
|
|---|
| [6340] | 87 | if (!_log) {
|
|---|
| [9865] | 88 | *_log << "ERROR: SP3Comp requires logfile specification" << "\n";
|
|---|
| [9023] | 89 | goto exit;
|
|---|
| [6339] | 90 | }
|
|---|
| [6333] | 91 |
|
|---|
| [6339] | 92 | for (int ii = 0; ii < _sp3FileNames.size(); ii++) {
|
|---|
| [9865] | 93 | *_log << "! SP3 File " << ii+1 << ": " << _sp3FileNames[ii] << "\n";
|
|---|
| [6339] | 94 | }
|
|---|
| 95 | if (_sp3FileNames.size() != 2) {
|
|---|
| [9865] | 96 | *_log << "ERROR: sp3Comp requires two input SP3 files" << "\n";
|
|---|
| [6355] | 97 | goto end;
|
|---|
| [6339] | 98 | }
|
|---|
| [6335] | 99 |
|
|---|
| [6349] | 100 | try {
|
|---|
| [6352] | 101 | ostringstream msg;
|
|---|
| 102 | compare(msg);
|
|---|
| 103 | *_log << msg.str().c_str();
|
|---|
| [6349] | 104 | }
|
|---|
| 105 | catch (const string& error) {
|
|---|
| [9865] | 106 | *_log << "ERROR: " << error.c_str() << "\n";
|
|---|
| [6349] | 107 | }
|
|---|
| 108 | catch (const char* error) {
|
|---|
| [9865] | 109 | *_log << "ERROR: " << error << "\n";
|
|---|
| [6349] | 110 | }
|
|---|
| [6359] | 111 | catch (Exception& exc) {
|
|---|
| [9865] | 112 | *_log << "ERROR: " << exc.what() << "\n";
|
|---|
| [6359] | 113 | }
|
|---|
| [6439] | 114 | catch (std::exception& exc) {
|
|---|
| [9865] | 115 | *_log << "ERROR: " << exc.what() << "\n";
|
|---|
| [6439] | 116 | }
|
|---|
| [6437] | 117 | catch (QString error) {
|
|---|
| [9865] | 118 | *_log << "ERROR: " << error << "\n";
|
|---|
| [6437] | 119 | }
|
|---|
| [6359] | 120 | catch (...) {
|
|---|
| [9865] | 121 | *_log << "ERROR: " << "unknown exception" << "\n";
|
|---|
| [6359] | 122 | }
|
|---|
| [6339] | 123 |
|
|---|
| [6333] | 124 | // Exit (thread)
|
|---|
| 125 | // -------------
|
|---|
| [6355] | 126 | end:
|
|---|
| [6545] | 127 | _log->flush();
|
|---|
| [9023] | 128 | exit:
|
|---|
| 129 | // do nothing if no logfile available
|
|---|
| 130 |
|
|---|
| [9175] | 131 | if (BNC_CORE->mode() != t_bncCore::interactive) {
|
|---|
| [9854] | 132 | qApp->exit(7);
|
|---|
| [7942] | 133 | msleep(100); //sleep 0.1 sec
|
|---|
| [6333] | 134 | }
|
|---|
| [9175] | 135 | else {
|
|---|
| [6333] | 136 | emit finished();
|
|---|
| 137 | deleteLater();
|
|---|
| 138 | }
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| [6345] | 141 | // Satellite Index in clkSats set
|
|---|
| 142 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| 143 | int t_sp3Comp::satIndex(const set<t_prn>& clkSats, const t_prn& prn) const {
|
|---|
| 144 | int ret = 0;
|
|---|
| 145 | for (set<t_prn>::const_iterator it = clkSats.begin(); it != clkSats.end(); it++) {
|
|---|
| 146 | if ( *it == prn) {
|
|---|
| 147 | return ret;
|
|---|
| 148 | }
|
|---|
| 149 | ++ret;
|
|---|
| 150 | }
|
|---|
| [6425] | 151 | return -1;
|
|---|
| [6345] | 152 | }
|
|---|
| 153 |
|
|---|
| 154 | // Estimate Clock Offsets
|
|---|
| 155 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| [6360] | 156 | void t_sp3Comp::processClocks(const set<t_prn>& clkSats, const vector<t_epoch*>& epochsIn,
|
|---|
| [6345] | 157 | map<string, t_stat>& stat) const {
|
|---|
| 158 |
|
|---|
| 159 | if (clkSats.size() == 0) {
|
|---|
| 160 | return;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| [6360] | 163 | vector<t_epoch*> epochs;
|
|---|
| 164 | for (unsigned ii = 0; ii < epochsIn.size(); ii++) {
|
|---|
| [6517] | 165 | unsigned numSatOK = 0;
|
|---|
| 166 | std::map<t_prn, double>::const_iterator it;
|
|---|
| 167 | for (it = epochsIn[ii]->_dc.begin(); it != epochsIn[ii]->_dc.end(); it++) {
|
|---|
| 168 | if (satIndex(clkSats, it->first) != -1) {
|
|---|
| 169 | numSatOK += 1;
|
|---|
| 170 | }
|
|---|
| 171 | }
|
|---|
| 172 | if (numSatOK > 0) {
|
|---|
| [6360] | 173 | epochs.push_back(epochsIn[ii]);
|
|---|
| 174 | }
|
|---|
| 175 | }
|
|---|
| 176 | if (epochs.size() == 0) {
|
|---|
| 177 | return;
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| [6345] | 180 | int nPar = epochs.size() + clkSats.size();
|
|---|
| 181 | SymmetricMatrix NN(nPar); NN = 0.0;
|
|---|
| 182 | ColumnVector bb(nPar); bb = 0.0;
|
|---|
| 183 |
|
|---|
| 184 | // Create Matrix A'A and vector b
|
|---|
| 185 | // ------------------------------
|
|---|
| 186 | for (unsigned ie = 0; ie < epochs.size(); ie++) {
|
|---|
| 187 | const map<t_prn, double>& dc = epochs[ie]->_dc;
|
|---|
| 188 | Matrix AA(dc.size(), nPar); AA = 0.0;
|
|---|
| 189 | ColumnVector ll(dc.size()); ll = 0.0;
|
|---|
| [7942] | 190 | map<t_prn, double>::const_iterator it;
|
|---|
| [6425] | 191 | int ii = -1;
|
|---|
| 192 | for (it = dc.begin(); it != dc.end(); it++) {
|
|---|
| [6345] | 193 | const t_prn& prn = it->first;
|
|---|
| [6425] | 194 | if (satIndex(clkSats, prn) != -1) {
|
|---|
| 195 | ++ii;
|
|---|
| 196 | int index = epochs.size() + satIndex(clkSats, prn);
|
|---|
| 197 | AA[ii][ie] = 1.0; // epoch-specfic offset (common for all satellites)
|
|---|
| 198 | AA[ii][index] = 1.0; // satellite-specific offset (common for all epochs)
|
|---|
| 199 | ll[ii] = it->second;
|
|---|
| 200 | }
|
|---|
| [6345] | 201 | }
|
|---|
| 202 | SymmetricMatrix dN; dN << AA.t() * AA;
|
|---|
| 203 | NN += dN;
|
|---|
| 204 | bb += AA.t() * ll;
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | // Regularize NN
|
|---|
| 208 | // -------------
|
|---|
| [7942] | 209 | RowVector HH(nPar);
|
|---|
| [6345] | 210 | HH.columns(1, epochs.size()) = 0.0;
|
|---|
| 211 | HH.columns(epochs.size()+1, nPar) = 1.0;
|
|---|
| 212 | SymmetricMatrix dN; dN << HH.t() * HH;
|
|---|
| 213 | NN += dN;
|
|---|
| [7942] | 214 |
|
|---|
| [6345] | 215 | // Estimate Parameters
|
|---|
| 216 | // -------------------
|
|---|
| [6364] | 217 | ColumnVector xx = NN.i() * bb;
|
|---|
| [6345] | 218 |
|
|---|
| 219 | // Compute clock residuals
|
|---|
| 220 | // -----------------------
|
|---|
| 221 | for (unsigned ie = 0; ie < epochs.size(); ie++) {
|
|---|
| [10092] | 222 | map<t_prn, double>& dc = epochs[ie]->_dc;
|
|---|
| 223 | map<t_prn, double>& dcRed = epochs[ie]->_dcRed;
|
|---|
| 224 | const map<t_prn, ColumnVector>& dr = epochs[ie]->_dr;
|
|---|
| [6345] | 225 | for (map<t_prn, double>::iterator it = dc.begin(); it != dc.end(); it++) {
|
|---|
| 226 | const t_prn& prn = it->first;
|
|---|
| [10814] | 227 | stringstream all;
|
|---|
| 228 | if (prn.system() == 'C') {
|
|---|
| 229 | if (prn.number() <= 16) {
|
|---|
| 230 | all << "C-2";
|
|---|
| 231 | }
|
|---|
| 232 | else {
|
|---|
| 233 | all << "C-3";
|
|---|
| 234 | }
|
|---|
| 235 | } else {
|
|---|
| 236 | all << prn.system();
|
|---|
| 237 | }
|
|---|
| [6425] | 238 | if (satIndex(clkSats, prn) != -1) {
|
|---|
| 239 | int index = epochs.size() + satIndex(clkSats, prn);
|
|---|
| [10092] | 240 | dc[prn] = it->second - xx[ie] - xx[index];
|
|---|
| [6425] | 241 | stat[prn.toString()]._offset = xx[index];
|
|---|
| [10092] | 242 | if (dr.find(prn) != dr.end()){
|
|---|
| 243 | dcRed[prn] = dc[prn] - dr.find(prn)->second[0]; // clock minus radial component
|
|---|
| 244 | stat[prn.toString()]._dcRedMean += dcRed[prn];
|
|---|
| [10127] | 245 | stat[all.str() ]._dcRedMean += dcRed[prn];
|
|---|
| [10092] | 246 | stat[prn.toString()]._nc += 1;
|
|---|
| [10127] | 247 | stat[all.str() ]._nc += 1;
|
|---|
| [10092] | 248 | }
|
|---|
| [6425] | 249 | }
|
|---|
| [6345] | 250 | }
|
|---|
| 251 | }
|
|---|
| [10092] | 252 |
|
|---|
| 253 | // Compute Clock Mean
|
|---|
| 254 | // ------------------
|
|---|
| 255 | for (map<string, t_stat>::iterator it = stat.begin(); it != stat.end(); it++) {
|
|---|
| 256 | t_stat& stat = it->second;
|
|---|
| 257 | if (stat._nc > 0) {
|
|---|
| 258 | stat._dcRedMean = stat._dcRedMean / stat._nc;
|
|---|
| 259 | }
|
|---|
| 260 | }
|
|---|
| [6345] | 261 | }
|
|---|
| 262 |
|
|---|
| [6348] | 263 | // Main Routine
|
|---|
| 264 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| [6352] | 265 | void t_sp3Comp::compare(ostringstream& out) const {
|
|---|
| [6348] | 266 |
|
|---|
| 267 | // Synchronize reading of two sp3 files
|
|---|
| 268 | // ------------------------------------
|
|---|
| [6362] | 269 | bncSP3 in1(_sp3FileNames[0]); in1.nextEpoch();
|
|---|
| 270 | bncSP3 in2(_sp3FileNames[1]); in2.nextEpoch();
|
|---|
| [6348] | 271 |
|
|---|
| 272 | vector<t_epoch*> epochs;
|
|---|
| [6362] | 273 | while (in1.currEpoch() && in2.currEpoch()) {
|
|---|
| 274 | bncTime t1 = in1.currEpoch()->_tt;
|
|---|
| 275 | bncTime t2 = in2.currEpoch()->_tt;
|
|---|
| 276 | if (t1 < t2) {
|
|---|
| 277 | in1.nextEpoch();
|
|---|
| 278 | }
|
|---|
| 279 | else if (t1 > t2) {
|
|---|
| 280 | in2.nextEpoch();
|
|---|
| 281 | }
|
|---|
| 282 | else if (t1 == t2) {
|
|---|
| 283 | t_epoch* epo = new t_epoch; epo->_tt = t1;
|
|---|
| 284 | bool epochOK = false;
|
|---|
| 285 | for (int i1 = 0; i1 < in1.currEpoch()->_sp3Sat.size(); i1++) {
|
|---|
| 286 | bncSP3::t_sp3Sat* sat1 = in1.currEpoch()->_sp3Sat[i1];
|
|---|
| 287 | for (int i2 = 0; i2 < in2.currEpoch()->_sp3Sat.size(); i2++) {
|
|---|
| 288 | bncSP3::t_sp3Sat* sat2 = in2.currEpoch()->_sp3Sat[i2];
|
|---|
| [10125] | 289 | if (sat1->_prn == sat2->_prn &&
|
|---|
| 290 | sat1->_clkValid && sat2->_clkValid) {
|
|---|
| [10673] | 291 | epochOK = true;
|
|---|
| [6362] | 292 | epo->_dr[sat1->_prn] = sat1->_xyz - sat2->_xyz;
|
|---|
| 293 | epo->_xyz[sat1->_prn] = sat1->_xyz;
|
|---|
| [10673] | 294 | epo->_dc[sat1->_prn] = sat1->_clk - sat2->_clk;
|
|---|
| [6348] | 295 | }
|
|---|
| 296 | }
|
|---|
| 297 | }
|
|---|
| [6362] | 298 | if (epochOK) {
|
|---|
| 299 | epochs.push_back(epo);
|
|---|
| 300 | }
|
|---|
| 301 | else {
|
|---|
| 302 | delete epo;
|
|---|
| 303 | }
|
|---|
| 304 | in1.nextEpoch();
|
|---|
| 305 | in2.nextEpoch();
|
|---|
| [6348] | 306 | }
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | // Transform xyz into radial, along-track, and out-of-plane
|
|---|
| 310 | // --------------------------------------------------------
|
|---|
| [6361] | 311 | if (epochs.size() < 2) {
|
|---|
| [6366] | 312 | throw "t_sp3Comp: not enough common epochs";
|
|---|
| [6361] | 313 | }
|
|---|
| [6364] | 314 |
|
|---|
| [6425] | 315 | set<t_prn> clkSatsAll;
|
|---|
| [6364] | 316 |
|
|---|
| [6348] | 317 | for (unsigned ie = 0; ie < epochs.size(); ie++) {
|
|---|
| 318 | t_epoch* epoch = epochs[ie];
|
|---|
| 319 | t_epoch* epoch2 = 0;
|
|---|
| [6361] | 320 | if (ie == 0) {
|
|---|
| [6348] | 321 | epoch2 = epochs[ie+1];
|
|---|
| 322 | }
|
|---|
| 323 | else {
|
|---|
| 324 | epoch2 = epochs[ie-1];
|
|---|
| 325 | }
|
|---|
| 326 | double dt = epoch->_tt - epoch2->_tt;
|
|---|
| 327 | map<t_prn, ColumnVector>& dr = epoch->_dr;
|
|---|
| 328 | map<t_prn, ColumnVector>& xyz = epoch->_xyz;
|
|---|
| 329 | map<t_prn, ColumnVector>& xyz2 = epoch2->_xyz;
|
|---|
| [9178] | 330 | QList<t_prn> satEraseList;
|
|---|
| [6348] | 331 | for (map<t_prn, ColumnVector>::const_iterator it = dr.begin(); it != dr.end(); it++) {
|
|---|
| 332 | const t_prn& prn = it->first;
|
|---|
| 333 | if (xyz2.find(prn) != xyz2.end()) {
|
|---|
| 334 | const ColumnVector dx = dr[prn];
|
|---|
| 335 | const ColumnVector& x1 = xyz[prn];
|
|---|
| 336 | const ColumnVector& x2 = xyz2[prn];
|
|---|
| 337 | ColumnVector vel = (x1 - x2) / dt;
|
|---|
| 338 | XYZ_to_RSW(x1, vel, dx, dr[prn]);
|
|---|
| [6364] | 339 | if (epoch->_dc.find(prn) != epoch->_dc.end()) {
|
|---|
| [6425] | 340 | clkSatsAll.insert(prn);
|
|---|
| [6364] | 341 | }
|
|---|
| [6348] | 342 | }
|
|---|
| 343 | else {
|
|---|
| [9178] | 344 | satEraseList << it->first;
|
|---|
| [6348] | 345 | }
|
|---|
| 346 | }
|
|---|
| [9178] | 347 | for (QList<t_prn>::const_iterator it = satEraseList.begin(); it != satEraseList.end(); it++) {
|
|---|
| 348 | epoch->_dc.erase(*it);
|
|---|
| 349 | epoch->_dr.erase(*it);
|
|---|
| 350 | }
|
|---|
| [6348] | 351 | }
|
|---|
| 352 |
|
|---|
| 353 | map<string, t_stat> stat;
|
|---|
| 354 |
|
|---|
| 355 | // Estimate Clock Offsets
|
|---|
| 356 | // ----------------------
|
|---|
| [6426] | 357 | string systems;
|
|---|
| 358 | for (set<t_prn>::const_iterator it = clkSatsAll.begin(); it != clkSatsAll.end(); it++) {
|
|---|
| 359 | if (systems.find(it->system()) == string::npos) {
|
|---|
| 360 | systems += it->system();
|
|---|
| 361 | }
|
|---|
| 362 | }
|
|---|
| [6425] | 363 | for (unsigned iSys = 0; iSys < systems.size(); iSys++) {
|
|---|
| 364 | char system = systems[iSys];
|
|---|
| 365 | set<t_prn> clkSats;
|
|---|
| [6426] | 366 | for (set<t_prn>::const_iterator it = clkSatsAll.begin(); it != clkSatsAll.end(); it++) {
|
|---|
| [6427] | 367 | if (it->system() == system && !excludeSat(*it)) {
|
|---|
| [6425] | 368 | clkSats.insert(*it);
|
|---|
| 369 | }
|
|---|
| 370 | }
|
|---|
| 371 | processClocks(clkSats, epochs, stat);
|
|---|
| 372 | }
|
|---|
| [6348] | 373 |
|
|---|
| [10092] | 374 | // Print epoch-wise Clock Residuals
|
|---|
| 375 | // --------------------------------
|
|---|
| [6352] | 376 | out.setf(ios::fixed);
|
|---|
| [10106] | 377 | if (!_summaryOnly) {
|
|---|
| 378 | out << "!\n! Clock residuals and orbit differences in [m]\n"
|
|---|
| 379 | "! ----------------------------------------------------------------------------\n";
|
|---|
| 380 | out << "!\n! Epoch PRN radial along out clk clkRed iPRN"
|
|---|
| 381 | "\n! ----------------------------------------------------------------------------\n";
|
|---|
| 382 | }
|
|---|
| [6348] | 383 | for (unsigned ii = 0; ii < epochs.size(); ii++) {
|
|---|
| 384 | const t_epoch* epo = epochs[ii];
|
|---|
| 385 | const map<t_prn, ColumnVector>& dr = epochs[ii]->_dr;
|
|---|
| 386 | const map<t_prn, double>& dc = epochs[ii]->_dc;
|
|---|
| [10092] | 387 | const map<t_prn, double>& dcRed = epochs[ii]->_dcRed;
|
|---|
| [6348] | 388 | for (map<t_prn, ColumnVector>::const_iterator it = dr.begin(); it != dr.end(); it++) {
|
|---|
| 389 | const t_prn& prn = it->first;
|
|---|
| [10814] | 390 | stringstream all;
|
|---|
| 391 | if (prn.system() == 'C') {
|
|---|
| 392 | if (prn.number() <= 16) {
|
|---|
| 393 | all << "C-2";
|
|---|
| 394 | }
|
|---|
| 395 | else {
|
|---|
| 396 | all << "C-3";
|
|---|
| 397 | }
|
|---|
| 398 | } else {
|
|---|
| 399 | all << prn.system();
|
|---|
| 400 | }
|
|---|
| 401 |
|
|---|
| [6427] | 402 | if (!excludeSat(prn)) {
|
|---|
| 403 | const ColumnVector& rao = it->second;
|
|---|
| [10106] | 404 | if (!_summaryOnly) {
|
|---|
| 405 | out << setprecision(6) << string(epo->_tt) << ' ' << prn.toString() << ' '
|
|---|
| 406 | << setw(7) << setprecision(4) << rao[0] << ' '
|
|---|
| 407 | << setw(7) << setprecision(4) << rao[1] << ' '
|
|---|
| 408 | << setw(7) << setprecision(4) << rao[2] << " ";
|
|---|
| 409 | }
|
|---|
| [6427] | 410 | stat[prn.toString()]._rao += SP(rao, rao); // Schur product
|
|---|
| [10127] | 411 | stat[all.str() ]._rao += SP(rao, rao);
|
|---|
| [6427] | 412 | stat[prn.toString()]._nr += 1;
|
|---|
| [10127] | 413 | stat[all.str() ]._nr += 1;
|
|---|
| [10092] | 414 | if (dc.find(prn) != dc.end() && dcRed.find(prn) != dc.end()) {
|
|---|
| [6427] | 415 | double clkRes = dc.find(prn)->second;
|
|---|
| [10092] | 416 | double clkResRed = dcRed.find(prn)->second;
|
|---|
| [10106] | 417 | if (!_summaryOnly) {
|
|---|
| 418 | out << setw(7) << setprecision(4) << clkRes << ' '
|
|---|
| 419 | << setw(7) << setprecision(4) << clkResRed;
|
|---|
| 420 | }
|
|---|
| [10092] | 421 | stat[prn.toString()]._dcRMS += clkRes * clkRes;
|
|---|
| [10127] | 422 | stat[all.str() ]._dcRMS += clkRes * clkRes;
|
|---|
| [10092] | 423 | stat[prn.toString()]._dcRedRMS += clkResRed * clkResRed;
|
|---|
| [10127] | 424 | stat[all.str() ]._dcRedRMS += clkResRed * clkResRed;
|
|---|
| [10092] | 425 | stat[prn.toString()]._dcRedSig += (clkResRed - stat[prn.toString()]._dcRedMean) *
|
|---|
| 426 | (clkResRed - stat[prn.toString()]._dcRedMean);
|
|---|
| [10127] | 427 | stat[all.str() ]._dcRedSig += (clkResRed - stat[all.str() ]._dcRedMean) *
|
|---|
| 428 | (clkResRed - stat[all.str() ]._dcRedMean);
|
|---|
| [6427] | 429 | }
|
|---|
| 430 | else {
|
|---|
| [10106] | 431 | if (!_summaryOnly) {
|
|---|
| 432 | out << " . . ";
|
|---|
| 433 | }
|
|---|
| [6427] | 434 | }
|
|---|
| [10106] | 435 | if (!_summaryOnly) {
|
|---|
| 436 | out << " " << setw(2) << int(prn) << "\n";
|
|---|
| 437 | }
|
|---|
| [6348] | 438 | }
|
|---|
| 439 | }
|
|---|
| 440 | delete epo;
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | // Print Summary
|
|---|
| 444 | // -------------
|
|---|
| [10092] | 445 | out << "!\n! Summary";
|
|---|
| 446 | out << "\n! -----------------------------------------------------------------------------------------------------------------\n";
|
|---|
| 447 | out << "!\n! PRN radialRMS alongRMS outRMS 3DRMS nOrb clkRMS clkRedRMS clkRedSig nClk Offset "
|
|---|
| 448 | "\n! [mm] [mm] [mm] [mm] [-] [ns] [ns] [ns] [-] [ns] "
|
|---|
| 449 | "\n! -----------------------------------------------------------------------------------------------------------------\n";
|
|---|
| [6348] | 450 | for (map<string, t_stat>::iterator it = stat.begin(); it != stat.end(); it++) {
|
|---|
| 451 | const string& prn = it->first;
|
|---|
| 452 | t_stat& stat = it->second;
|
|---|
| [10814] | 453 | stringstream all;
|
|---|
| 454 | if (prn[0] == 'C') {
|
|---|
| 455 | int num = stoi(prn.substr(1,2));
|
|---|
| 456 | if (num <= 16) {
|
|---|
| 457 | all << "C-2";
|
|---|
| 458 | }
|
|---|
| 459 | else {
|
|---|
| 460 | all << "C-3";
|
|---|
| 461 | }
|
|---|
| 462 | } else {
|
|---|
| 463 | all << prn[0];
|
|---|
| 464 | }
|
|---|
| [6348] | 465 | if (stat._nr > 0) {
|
|---|
| 466 | stat._rao[0] = sqrt(stat._rao[0] / stat._nr);
|
|---|
| 467 | stat._rao[1] = sqrt(stat._rao[1] / stat._nr);
|
|---|
| 468 | stat._rao[2] = sqrt(stat._rao[2] / stat._nr);
|
|---|
| [10092] | 469 | stat._rao3DRMS = stat._rao.NormFrobenius();
|
|---|
| [10127] | 470 | // orbit values in millimeter
|
|---|
| 471 | if (prn != all.str()) {
|
|---|
| 472 | (_summaryOnly) ? out << " " << prn << ' ':
|
|---|
| [10120] | 473 | out << "! " << prn << ' ';
|
|---|
| [6348] | 474 | }
|
|---|
| [10127] | 475 | else {
|
|---|
| [10814] | 476 | (_summaryOnly) ? out << " " << QString("%1").arg(all.str().c_str(),3,' ').toStdString().c_str() << " ":
|
|---|
| 477 | out << "! " << QString("%1").arg(all.str().c_str(),3,' ').toStdString().c_str() << " ";
|
|---|
| [6348] | 478 | }
|
|---|
| [10127] | 479 | out << setw(10) << setprecision(1) << stat._rao[0] * 1e3 << ' '
|
|---|
| 480 | << setw(10) << setprecision(1) << stat._rao[1] * 1e3 << ' '
|
|---|
| 481 | << setw(10) << setprecision(1) << stat._rao[2] * 1e3 << ' '
|
|---|
| 482 | << setw(10) << setprecision(1) << stat._rao3DRMS * 1e3 << ' '
|
|---|
| 483 | << setw( 7) << stat._nr << " ";
|
|---|
| 484 | // clock values in nano seconds
|
|---|
| [6348] | 485 | if (stat._nc > 0) {
|
|---|
| [10092] | 486 | stat._dcRMS = sqrt(stat._dcRMS / stat._nc);
|
|---|
| 487 | stat._dcRedRMS = sqrt(stat._dcRedRMS / stat._nc);
|
|---|
| 488 | stat._dcRedSig = sqrt(stat._dcRedSig / stat._nc);
|
|---|
| [10127] | 489 | out << setw(10) << setprecision(2) << stat._dcRMS / t_CST::c * 1e9 << ' '
|
|---|
| 490 | << setw(10) << setprecision(2) << stat._dcRedRMS / t_CST::c * 1e9 << ' '
|
|---|
| 491 | << setw(10) << setprecision(2) << stat._dcRedSig / t_CST::c * 1e9 << ' '
|
|---|
| 492 | << setw( 9) << stat._nc << " ";
|
|---|
| [10814] | 493 | if (prn != "G" && prn != "R" && prn != "E" && prn != "C-2" && prn != "C-3") {
|
|---|
| [10127] | 494 | out << setw( 9) << setprecision(2) << stat._offset / t_CST::c * 1e9;
|
|---|
| [6348] | 495 | }
|
|---|
| 496 | }
|
|---|
| [10127] | 497 | out << "\n";
|
|---|
| [6348] | 498 | }
|
|---|
| 499 | }
|
|---|
| 500 | }
|
|---|
| [6428] | 501 |
|
|---|
| [7942] | 502 | //
|
|---|
| [6428] | 503 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 504 | bool t_sp3Comp::excludeSat(const t_prn& prn) const {
|
|---|
| [6431] | 505 | QStringListIterator it(_excludeSats);
|
|---|
| 506 | while (it.hasNext()) {
|
|---|
| [8204] | 507 | string prnStr = it.next().toLatin1().data();
|
|---|
| [10596] | 508 | if (prnStr == prn.toString() || // prn
|
|---|
| 509 | prnStr == prn.toString().substr(0,1)) { // sys
|
|---|
| [6431] | 510 | return true;
|
|---|
| 511 | }
|
|---|
| [6428] | 512 | }
|
|---|
| [6431] | 513 | return false;
|
|---|
| [6428] | 514 | }
|
|---|
| 515 |
|
|---|