[3222] | 1 | /* -------------------------------------------------------------------------
|
---|
| 2 | * BKG NTRIP Server
|
---|
| 3 | * -------------------------------------------------------------------------
|
---|
| 4 | *
|
---|
[3224] | 5 | * Class: bncRtnetUploadCaster
|
---|
[3222] | 6 | *
|
---|
| 7 | * Purpose: Connection to NTRIP Caster
|
---|
| 8 | *
|
---|
| 9 | * Author: L. Mervart
|
---|
| 10 | *
|
---|
| 11 | * Created: 29-Mar-2011
|
---|
| 12 | *
|
---|
[5662] | 13 | * Changes:
|
---|
[3222] | 14 | *
|
---|
| 15 | * -----------------------------------------------------------------------*/
|
---|
| 16 |
|
---|
| 17 | #include <math.h>
|
---|
[5662] | 18 | #include "bncrtnetuploadcaster.h"
|
---|
[3222] | 19 | #include "bncsettings.h"
|
---|
[3224] | 20 | #include "bncephuser.h"
|
---|
[3222] | 21 | #include "bncclockrinex.h"
|
---|
| 22 | #include "bncsp3.h"
|
---|
[6812] | 23 | #include "gnss.h"
|
---|
[3222] | 24 |
|
---|
| 25 | using namespace std;
|
---|
| 26 |
|
---|
| 27 | // Constructor
|
---|
| 28 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3224] | 29 | bncRtnetUploadCaster::bncRtnetUploadCaster(const QString& mountpoint,
|
---|
[8275] | 30 | const QString& outHost, int outPort,
|
---|
| 31 | const QString& ntripVersion,
|
---|
| 32 | const QString& userName, const QString& password,
|
---|
[9025] | 33 | const QString& crdTrafo, const QString& ssrFormat, bool CoM, const QString& sp3FileName,
|
---|
[6877] | 34 | const QString& rnxFileName, int PID, int SID, int IOD, int iRow) :
|
---|
[8275] | 35 | bncUploadCaster(mountpoint, outHost, outPort, ntripVersion, userName, password, iRow, 0) {
|
---|
[3224] | 36 |
|
---|
[8361] | 37 | if (!mountpoint.isEmpty()) {
|
---|
| 38 | _casterID += mountpoint;
|
---|
| 39 | }
|
---|
[5130] | 40 | if (!outHost.isEmpty()) {
|
---|
[8361] | 41 | _casterID += " " + outHost;
|
---|
| 42 | if (outPort) {
|
---|
| 43 | _casterID += ":" + QString("%1").arg(outPort, 10);
|
---|
| 44 | }
|
---|
[5130] | 45 | }
|
---|
| 46 | if (!crdTrafo.isEmpty()) {
|
---|
| 47 | _casterID += " " + crdTrafo;
|
---|
| 48 | }
|
---|
| 49 | if (!sp3FileName.isEmpty()) {
|
---|
| 50 | _casterID += " " + sp3FileName;
|
---|
| 51 | }
|
---|
| 52 | if (!rnxFileName.isEmpty()) {
|
---|
| 53 | _casterID += " " + rnxFileName;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
[6877] | 56 | _crdTrafo = crdTrafo;
|
---|
[9025] | 57 |
|
---|
| 58 | _ssrFormat = ssrFormat;qDebug() << _ssrFormat;
|
---|
| 59 | _ssrCorr = 0;
|
---|
| 60 | if (_ssrFormat == "IGS-SSR") {qDebug() << "bin hier IGS";
|
---|
| 61 | _ssrCorr = new SsrCorrIgs();
|
---|
| 62 | }
|
---|
| 63 | else if (_ssrFormat == "RTCM-SSR") {qDebug() << "bin hier RTCM";
|
---|
| 64 | _ssrCorr = new SsrCorrRtcm();
|
---|
| 65 | }
|
---|
| 66 | if (!_ssrCorr) {
|
---|
| 67 | qDebug() << "no _ssrCorr";
|
---|
| 68 | }
|
---|
[6877] | 69 | _CoM = CoM;
|
---|
| 70 | _PID = PID;
|
---|
| 71 | _SID = SID;
|
---|
| 72 | _IOD = IOD;
|
---|
[3222] | 73 |
|
---|
[3224] | 74 | // Member that receives the ephemeris
|
---|
| 75 | // ----------------------------------
|
---|
[6441] | 76 | _ephUser = new bncEphUser(true);
|
---|
[3222] | 77 |
|
---|
[3272] | 78 | bncSettings settings;
|
---|
[6877] | 79 | QString intr = settings.value("uploadIntr").toString();
|
---|
[7297] | 80 | QStringList hlp = settings.value("cmbStreams").toStringList();
|
---|
[6559] | 81 | _samplRtcmEphCorr = settings.value("uploadSamplRtcmEphCorr").toDouble();
|
---|
| 82 | if (hlp.size() > 1) { // combination stream upload
|
---|
[6877] | 83 | _samplRtcmClkCorr = settings.value("cmbSampl").toInt();
|
---|
[6557] | 84 | }
|
---|
[6877] | 85 | else { // single stream upload or sp3 file generation
|
---|
| 86 | _samplRtcmClkCorr = 5; // default
|
---|
| 87 | }
|
---|
| 88 | int samplClkRnx = settings.value("uploadSamplClkRnx").toInt();
|
---|
| 89 | int samplSp3 = settings.value("uploadSamplSp3").toInt() * 60;
|
---|
[4174] | 90 |
|
---|
| 91 | if (_samplRtcmEphCorr == 0.0) {
|
---|
[3753] | 92 | _usedEph = 0;
|
---|
| 93 | }
|
---|
| 94 | else {
|
---|
[6442] | 95 | _usedEph = new QMap<QString, const t_eph*>;
|
---|
[3753] | 96 | }
|
---|
[3272] | 97 |
|
---|
[3222] | 98 | // RINEX writer
|
---|
| 99 | // ------------
|
---|
| 100 | if (!rnxFileName.isEmpty()) {
|
---|
[4174] | 101 | _rnx = new bncClockRinex(rnxFileName, intr, samplClkRnx);
|
---|
[3222] | 102 | }
|
---|
| 103 | else {
|
---|
| 104 | _rnx = 0;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | // SP3 writer
|
---|
| 108 | // ----------
|
---|
| 109 | if (!sp3FileName.isEmpty()) {
|
---|
[4174] | 110 | _sp3 = new bncSP3(sp3FileName, intr, samplSp3);
|
---|
[3222] | 111 | }
|
---|
| 112 | else {
|
---|
| 113 | _sp3 = 0;
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | // Set Transformation Parameters
|
---|
| 117 | // -----------------------------
|
---|
[8405] | 118 | // Transformation Parameters from ITRF2014 to ETRF2000
|
---|
[8720] | 119 | // EUREF Technical Note 1 Relationship and Transformation between the ITRF and ETRF
|
---|
| 120 | // Zuheir Altamimi, June 28, 2018
|
---|
[6877] | 121 | if (_crdTrafo == "ETRF2000") {
|
---|
[8720] | 122 | _dx = 0.0547;
|
---|
| 123 | _dy = 0.0522;
|
---|
| 124 | _dz = -0.0741;
|
---|
| 125 |
|
---|
[8094] | 126 | _dxr = 0.0001;
|
---|
| 127 | _dyr = 0.0001;
|
---|
[8405] | 128 | _dzr = -0.0019;
|
---|
[8720] | 129 |
|
---|
| 130 | _ox = 0.001701;
|
---|
| 131 | _oy = 0.010290;
|
---|
| 132 | _oz = -0.016632;
|
---|
| 133 |
|
---|
| 134 | _oxr = 0.000081;
|
---|
| 135 | _oyr = 0.000490;
|
---|
| 136 | _ozr = -0.000729;
|
---|
| 137 |
|
---|
| 138 | _sc = 2.12;
|
---|
[8405] | 139 | _scr = 0.11;
|
---|
[8720] | 140 |
|
---|
| 141 | _t0 = 2010.0;
|
---|
[3222] | 142 | }
|
---|
[8094] | 143 | // Transformation Parameters from ITRF2014 to GDA2020 (Ryan Ruddick, GA)
|
---|
| 144 | else if (_crdTrafo == "GDA2020") {
|
---|
| 145 | _dx = 0.0;
|
---|
| 146 | _dy = 0.0;
|
---|
| 147 | _dz = 0.0;
|
---|
[8720] | 148 |
|
---|
[8094] | 149 | _dxr = 0.0;
|
---|
| 150 | _dyr = 0.0;
|
---|
| 151 | _dzr = 0.0;
|
---|
[8720] | 152 |
|
---|
[8094] | 153 | _ox = 0.0;
|
---|
| 154 | _oy = 0.0;
|
---|
| 155 | _oz = 0.0;
|
---|
[8720] | 156 |
|
---|
[8094] | 157 | _oxr = 0.00150379;
|
---|
| 158 | _oyr = 0.00118346;
|
---|
| 159 | _ozr = 0.00120716;
|
---|
[8720] | 160 |
|
---|
[8094] | 161 | _sc = 0.0;
|
---|
| 162 | _scr = 0.0;
|
---|
[8720] | 163 |
|
---|
[8094] | 164 | _t0 = 2020.0;
|
---|
[3222] | 165 | }
|
---|
[8962] | 166 | // Transformation Parameters from IGb14 to SIRGAS2000 (Thanks to Sonia Costa, BRA)
|
---|
| 167 | // June 29 2020: TX:-0.0027 m TY:-0.0025 m TZ:-0.0042 m SCL:1.20 (ppb) no rotations and no rates.*/
|
---|
[8094] | 168 | else if (_crdTrafo == "SIRGAS2000") {
|
---|
[8962] | 169 | _dx = -0.0027;
|
---|
| 170 | _dy = -0.0025;
|
---|
| 171 | _dz = -0.0042;
|
---|
[8720] | 172 |
|
---|
[8094] | 173 | _dxr = 0.0000;
|
---|
| 174 | _dyr = 0.0000;
|
---|
| 175 | _dzr = 0.0000;
|
---|
[8720] | 176 |
|
---|
| 177 | _ox = 0.000000;
|
---|
| 178 | _oy = 0.000000;
|
---|
| 179 | _oz = 0.000000;
|
---|
| 180 |
|
---|
[8094] | 181 | _oxr = 0.000000;
|
---|
| 182 | _oyr = 0.000000;
|
---|
| 183 | _ozr = 0.000000;
|
---|
[8720] | 184 |
|
---|
[8962] | 185 | _sc = 1.20000;
|
---|
[8720] | 186 | _scr = 0.00000;
|
---|
| 187 | _t0 = 2000.0;
|
---|
[3222] | 188 | }
|
---|
[8405] | 189 | // Transformation Parameters from ITRF2014 to DREF91
|
---|
[5347] | 190 | else if (_crdTrafo == "DREF91") {
|
---|
[8720] | 191 | _dx = 0.0547;
|
---|
| 192 | _dy = 0.0522;
|
---|
| 193 | _dz = -0.0741;
|
---|
| 194 |
|
---|
[8094] | 195 | _dxr = 0.0001;
|
---|
| 196 | _dyr = 0.0001;
|
---|
[8405] | 197 | _dzr = -0.0019;
|
---|
[8720] | 198 | // ERTF200 + rotation parameters (ETRF200 => DREF91)
|
---|
| 199 | _ox = 0.001701 + 0.000658;
|
---|
| 200 | _oy = 0.010290 - 0.000208;
|
---|
| 201 | _oz = -0.016632 + 0.000755;
|
---|
| 202 |
|
---|
| 203 | _oxr = 0.000081;
|
---|
| 204 | _oyr = 0.000490;
|
---|
| 205 | _ozr = -0.000729;
|
---|
| 206 |
|
---|
| 207 | _sc = 2.12;
|
---|
[8405] | 208 | _scr = 0.11;
|
---|
[8720] | 209 |
|
---|
| 210 | _t0 = 2010.0;
|
---|
[5340] | 211 | }
|
---|
[3222] | 212 | else if (_crdTrafo == "Custom") {
|
---|
[6877] | 213 | _dx = settings.value("trafo_dx").toDouble();
|
---|
| 214 | _dy = settings.value("trafo_dy").toDouble();
|
---|
| 215 | _dz = settings.value("trafo_dz").toDouble();
|
---|
[3222] | 216 | _dxr = settings.value("trafo_dxr").toDouble();
|
---|
| 217 | _dyr = settings.value("trafo_dyr").toDouble();
|
---|
| 218 | _dzr = settings.value("trafo_dzr").toDouble();
|
---|
[6877] | 219 | _ox = settings.value("trafo_ox").toDouble();
|
---|
| 220 | _oy = settings.value("trafo_oy").toDouble();
|
---|
| 221 | _oz = settings.value("trafo_oz").toDouble();
|
---|
[3222] | 222 | _oxr = settings.value("trafo_oxr").toDouble();
|
---|
| 223 | _oyr = settings.value("trafo_oyr").toDouble();
|
---|
| 224 | _ozr = settings.value("trafo_ozr").toDouble();
|
---|
[6877] | 225 | _sc = settings.value("trafo_sc").toDouble();
|
---|
[3222] | 226 | _scr = settings.value("trafo_scr").toDouble();
|
---|
[6877] | 227 | _t0 = settings.value("trafo_t0").toDouble();
|
---|
[3222] | 228 | }
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | // Destructor
|
---|
| 232 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3224] | 233 | bncRtnetUploadCaster::~bncRtnetUploadCaster() {
|
---|
[3222] | 234 | if (isRunning()) {
|
---|
| 235 | wait();
|
---|
| 236 | }
|
---|
| 237 | delete _rnx;
|
---|
| 238 | delete _sp3;
|
---|
| 239 | delete _ephUser;
|
---|
[3753] | 240 | delete _usedEph;
|
---|
[9025] | 241 | delete _ssrCorr;
|
---|
[3222] | 242 | }
|
---|
| 243 |
|
---|
[5662] | 244 | //
|
---|
[3222] | 245 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9032] | 246 | void bncRtnetUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {
|
---|
| 247 |
|
---|
[3222] | 248 | QMutexLocker locker(&_mutex);
|
---|
| 249 |
|
---|
[3230] | 250 | // Append to internal buffer
|
---|
| 251 | // -------------------------
|
---|
[3222] | 252 | _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
|
---|
[3230] | 253 |
|
---|
| 254 | // Select buffer part that contains last epoch
|
---|
| 255 | // -------------------------------------------
|
---|
| 256 | QStringList lines;
|
---|
| 257 | int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); // begin of last epoch
|
---|
| 258 | if (iEpoBeg == -1) {
|
---|
[3226] | 259 | _rtnetStreamBuffer.clear();
|
---|
| 260 | return;
|
---|
[3222] | 261 | }
|
---|
[8755] | 262 | int iEpoBegEarlier = _rtnetStreamBuffer.indexOf('*');
|
---|
| 263 | if (iEpoBegEarlier != -1 && iEpoBegEarlier < iEpoBeg) { // are there two epoch lines in buffer?
|
---|
| 264 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBegEarlier);
|
---|
| 265 | }
|
---|
[6896] | 266 | else {
|
---|
| 267 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
|
---|
| 268 | }
|
---|
[8755] | 269 | int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch
|
---|
[3230] | 270 | if (iEpoEnd == -1) {
|
---|
| 271 | return;
|
---|
| 272 | }
|
---|
[8755] | 273 |
|
---|
| 274 | while (_rtnetStreamBuffer.count('*') > 1) { // is there more than 1 epoch line in buffer?
|
---|
| 275 | QString rtnetStreamBuffer = _rtnetStreamBuffer.mid(1);
|
---|
| 276 | int nextEpoch = rtnetStreamBuffer.indexOf('*');
|
---|
[8982] | 277 | if (nextEpoch != -1 && nextEpoch < iEpoEnd) {
|
---|
[8755] | 278 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(nextEpoch);
|
---|
| 279 | }
|
---|
[8761] | 280 | else if (nextEpoch != -1 && nextEpoch >= iEpoEnd) {
|
---|
| 281 | break;
|
---|
| 282 | }
|
---|
[3226] | 283 | }
|
---|
[3222] | 284 |
|
---|
[8904] | 285 | lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n',
|
---|
[8755] | 286 | QString::SkipEmptyParts);
|
---|
| 287 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd + 3);
|
---|
| 288 |
|
---|
[3226] | 289 | if (lines.size() < 2) {
|
---|
[3222] | 290 | return;
|
---|
| 291 | }
|
---|
| 292 |
|
---|
[3226] | 293 | // Read first line (with epoch time)
|
---|
| 294 | // ---------------------------------
|
---|
[8204] | 295 | QTextStream in(lines[0].toLatin1());
|
---|
[3226] | 296 | QString hlp;
|
---|
[6877] | 297 | int year, month, day, hour, min;
|
---|
| 298 | double sec;
|
---|
[3226] | 299 | in >> hlp >> year >> month >> day >> hour >> min >> sec;
|
---|
[6877] | 300 | bncTime epoTime;
|
---|
| 301 | epoTime.set(year, month, day, hour, min, sec);
|
---|
[3226] | 302 |
|
---|
[6877] | 303 | emit(newMessage(
|
---|
| 304 | "bncRtnetUploadCaster: decode " + QByteArray(epoTime.datestr().c_str())
|
---|
| 305 | + " " + QByteArray(epoTime.timestr().c_str()) + " "
|
---|
[8204] | 306 | + _casterID.toLatin1(), false));
|
---|
[4808] | 307 |
|
---|
[9025] | 308 | struct SsrCorr::ClockOrbit co;
|
---|
[3222] | 309 | memset(&co, 0, sizeof(co));
|
---|
[8991] | 310 | co.EpochTime[CLOCKORBIT_SATGPS] = static_cast<int>(epoTime.gpssec());
|
---|
[9025] | 311 | if (_ssrFormat == "RTCM-SSR") {
|
---|
| 312 | double gt = epoTime.gpssec() + 3 * 3600 - gnumleap(year, month, day);
|
---|
| 313 | co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
|
---|
| 314 | }
|
---|
| 315 | else if (_ssrFormat == "IGS-SSR") {
|
---|
| 316 | co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(epoTime.gpssec());
|
---|
| 317 | }
|
---|
[6846] | 318 | co.EpochTime[CLOCKORBIT_SATGALILEO] = static_cast<int>(epoTime.gpssec());
|
---|
[9025] | 319 | co.EpochTime[CLOCKORBIT_SATQZSS] = static_cast<int>(epoTime.gpssec());
|
---|
| 320 | co.EpochTime[CLOCKORBIT_SATSBAS] = static_cast<int>(epoTime.gpssec());
|
---|
| 321 | if (_ssrFormat == "RTCM-SSR") {
|
---|
| 322 | co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
|
---|
| 323 | }
|
---|
| 324 | else if (_ssrFormat == "IGS-SSR") {
|
---|
| 325 | co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
|
---|
| 326 | }
|
---|
| 327 | co.Supplied[_ssrCorr->COBOFS_CLOCK] = 1;
|
---|
| 328 | co.Supplied[_ssrCorr->COBOFS_ORBIT] = 1;
|
---|
| 329 | co.SatRefDatum = _ssrCorr->DATUM_ITRF; // ToDo: to decode from RTNET format
|
---|
| 330 | co.SSRIOD = _IOD;
|
---|
[6850] | 331 | co.SSRProviderID = _PID; // 256 .. BKG, 257 ... EUREF
|
---|
| 332 | co.SSRSolutionID = _SID;
|
---|
[5662] | 333 |
|
---|
[9025] | 334 | struct SsrCorr::CodeBias bias;
|
---|
[3222] | 335 | memset(&bias, 0, sizeof(bias));
|
---|
[9025] | 336 | bias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
|
---|
[5666] | 337 | bias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
|
---|
[6846] | 338 | bias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
|
---|
[9025] | 339 | bias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
|
---|
| 340 | bias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
|
---|
| 341 | bias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
|
---|
| 342 | bias.SSRIOD = _IOD;
|
---|
[6850] | 343 | bias.SSRProviderID = _PID;
|
---|
| 344 | bias.SSRSolutionID = _SID;
|
---|
[5662] | 345 |
|
---|
[9025] | 346 | struct SsrCorr::PhaseBias phasebias;
|
---|
[6850] | 347 | memset(&phasebias, 0, sizeof(phasebias));
|
---|
[8017] | 348 | unsigned int dispersiveBiasConsistenyIndicator = 0;
|
---|
| 349 | unsigned int mwConsistencyIndicator = 0;
|
---|
[9025] | 350 | phasebias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
|
---|
[6850] | 351 | phasebias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
|
---|
| 352 | phasebias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
|
---|
[9025] | 353 | phasebias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
|
---|
| 354 | phasebias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
|
---|
| 355 | phasebias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
|
---|
| 356 | phasebias.SSRIOD = _IOD;
|
---|
[6850] | 357 | phasebias.SSRProviderID = _PID;
|
---|
| 358 | phasebias.SSRSolutionID = _SID;
|
---|
| 359 |
|
---|
[9025] | 360 | struct SsrCorr::VTEC vtec;
|
---|
[6860] | 361 | memset(&vtec, 0, sizeof(vtec));
|
---|
| 362 | vtec.EpochTime = static_cast<int>(epoTime.gpssec());
|
---|
[9025] | 363 | vtec.SSRIOD = _IOD;
|
---|
[6860] | 364 | vtec.SSRProviderID = _PID;
|
---|
| 365 | vtec.SSRSolutionID = _SID;
|
---|
| 366 |
|
---|
[4753] | 367 | // Default Update Interval
|
---|
| 368 | // -----------------------
|
---|
[4754] | 369 | int clkUpdInd = 2; // 5 sec
|
---|
| 370 | int ephUpdInd = clkUpdInd; // default
|
---|
[6557] | 371 |
|
---|
[6559] | 372 | if (_samplRtcmClkCorr > 5.0 && _samplRtcmEphCorr <= 5.0) { // combined orb and clock
|
---|
| 373 | ephUpdInd = determineUpdateInd(_samplRtcmClkCorr);
|
---|
[4754] | 374 | }
|
---|
[6559] | 375 | if (_samplRtcmClkCorr > 5.0) {
|
---|
[6557] | 376 | clkUpdInd = determineUpdateInd(_samplRtcmClkCorr);
|
---|
[4754] | 377 | }
|
---|
[6559] | 378 | if (_samplRtcmEphCorr > 5.0) {
|
---|
| 379 | ephUpdInd = determineUpdateInd(_samplRtcmEphCorr);
|
---|
| 380 | }
|
---|
[4753] | 381 |
|
---|
[6877] | 382 | co.UpdateInterval = clkUpdInd;
|
---|
[4754] | 383 | bias.UpdateInterval = clkUpdInd;
|
---|
[6850] | 384 | phasebias.UpdateInterval = clkUpdInd;
|
---|
[4753] | 385 |
|
---|
[3226] | 386 | for (int ii = 1; ii < lines.size(); ii++) {
|
---|
[6877] | 387 | QString key; // prn or key VTEC, IND (phase bias indicators)
|
---|
[8679] | 388 | double rtnUra = 0.0; // [m]
|
---|
| 389 | ColumnVector rtnAPC; rtnAPC.ReSize(3); rtnAPC = 0.0; // [m, m, m]
|
---|
| 390 | ColumnVector rtnVel; rtnVel.ReSize(3); rtnVel = 0.0; // [m/s, m/s, m/s]
|
---|
| 391 | ColumnVector rtnCoM; rtnCoM.ReSize(3); rtnCoM = 0.0; // [m, m, m]
|
---|
| 392 | ColumnVector rtnClk; rtnClk.ReSize(3); rtnClk = 0.0; // [m, m/s, m/s²]
|
---|
| 393 | ColumnVector rtnClkSig; rtnClkSig.ReSize(3); rtnClkSig = 0.0; // [m, m/s, m/s²]
|
---|
[6877] | 394 | t_prn prn;
|
---|
[5662] | 395 |
|
---|
[8204] | 396 | QTextStream in(lines[ii].toLatin1());
|
---|
[3222] | 397 |
|
---|
[6876] | 398 | in >> key;
|
---|
[3222] | 399 |
|
---|
[6860] | 400 | // non-satellite specific parameters
|
---|
[6877] | 401 | if (key.contains("IND", Qt::CaseSensitive)) {
|
---|
[8017] | 402 | in >> dispersiveBiasConsistenyIndicator >> mwConsistencyIndicator;
|
---|
[6860] | 403 | continue;
|
---|
| 404 | }
|
---|
[6893] | 405 | // non-satellite specific parameters
|
---|
[6876] | 406 | if (key.contains("VTEC", Qt::CaseSensitive)) {
|
---|
[6897] | 407 | double ui;
|
---|
| 408 | in >> ui >> vtec.NumLayers;
|
---|
| 409 | vtec.UpdateInterval = (unsigned int) determineUpdateInd(ui);
|
---|
[6860] | 410 | for (unsigned ll = 0; ll < vtec.NumLayers; ll++) {
|
---|
| 411 | int dummy;
|
---|
| 412 | in >> dummy >> vtec.Layers[ll].Degree >> vtec.Layers[ll].Order
|
---|
[6877] | 413 | >> vtec.Layers[ll].Height;
|
---|
[6879] | 414 | for (unsigned iDeg = 0; iDeg <= vtec.Layers[ll].Degree; iDeg++) {
|
---|
| 415 | for (unsigned iOrd = 0; iOrd <= vtec.Layers[ll].Order; iOrd++) {
|
---|
[6860] | 416 | in >> vtec.Layers[ll].Cosinus[iDeg][iOrd];
|
---|
| 417 | }
|
---|
| 418 | }
|
---|
[6879] | 419 | for (unsigned iDeg = 0; iDeg <= vtec.Layers[ll].Degree; iDeg++) {
|
---|
| 420 | for (unsigned iOrd = 0; iOrd <= vtec.Layers[ll].Order; iOrd++) {
|
---|
[6860] | 421 | in >> vtec.Layers[ll].Sinus[iDeg][iOrd];
|
---|
| 422 | }
|
---|
| 423 | }
|
---|
| 424 | }
|
---|
| 425 | continue;
|
---|
| 426 | }
|
---|
[6877] | 427 | // satellite specific parameters
|
---|
[8204] | 428 | char sys = key.mid(0, 1).at(0).toLatin1();
|
---|
[6877] | 429 | int number = key.mid(1, 2).toInt();
|
---|
| 430 | int flags = 0;
|
---|
| 431 | if (sys == 'E') { // I/NAV
|
---|
| 432 | flags = 1;
|
---|
| 433 | }
|
---|
[6876] | 434 | prn.set(sys, number, flags);
|
---|
| 435 | QString prnInternalStr = QString::fromStdString(prn.toInternalString());
|
---|
[6877] | 436 | QString prnStr = QString::fromStdString(prn.toString());
|
---|
| 437 |
|
---|
[6876] | 438 | const t_eph* ephLast = _ephUser->ephLast(prnInternalStr);
|
---|
| 439 | const t_eph* ephPrev = _ephUser->ephPrev(prnInternalStr);
|
---|
[6877] | 440 | const t_eph* eph = ephLast;
|
---|
[6442] | 441 | if (eph) {
|
---|
[3754] | 442 |
|
---|
[4098] | 443 | // Use previous ephemeris if the last one is too recent
|
---|
| 444 | // ----------------------------------------------------
|
---|
| 445 | const int MINAGE = 60; // seconds
|
---|
[6877] | 446 | if (ephPrev && eph->receptDateTime().isValid()
|
---|
| 447 | && eph->receptDateTime().secsTo(currentDateAndTimeGPS()) < MINAGE) {
|
---|
[6442] | 448 | eph = ephPrev;
|
---|
[4098] | 449 | }
|
---|
[3754] | 450 |
|
---|
[3753] | 451 | // Make sure the clock messages refer to same IOD as orbit messages
|
---|
| 452 | // ----------------------------------------------------------------
|
---|
| 453 | if (_usedEph) {
|
---|
[4174] | 454 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
[6876] | 455 | (*_usedEph)[prnInternalStr] = eph;
|
---|
[3753] | 456 | }
|
---|
| 457 | else {
|
---|
| 458 | eph = 0;
|
---|
[6876] | 459 | if (_usedEph->contains(prnInternalStr)) {
|
---|
| 460 | const t_eph* usedEph = _usedEph->value(prnInternalStr);
|
---|
[6877] | 461 | if (usedEph == ephLast) {
|
---|
[6442] | 462 | eph = ephLast;
|
---|
[3753] | 463 | }
|
---|
[6442] | 464 | else if (usedEph == ephPrev) {
|
---|
| 465 | eph = ephPrev;
|
---|
[3753] | 466 | }
|
---|
| 467 | }
|
---|
| 468 | }
|
---|
| 469 | }
|
---|
| 470 | }
|
---|
| 471 |
|
---|
[8679] | 472 | if (eph &&
|
---|
| 473 | eph->checkState() != t_eph::bad &&
|
---|
| 474 | eph->checkState() != t_eph::unhealthy &&
|
---|
| 475 | eph->checkState() != t_eph::outdated) {
|
---|
[5503] | 476 | QMap<QString, double> codeBiases;
|
---|
[6851] | 477 | QList<phaseBiasSignal> phaseBiasList;
|
---|
| 478 | phaseBiasesSat pbSat;
|
---|
[5503] | 479 |
|
---|
[4991] | 480 | while (true) {
|
---|
| 481 | QString key;
|
---|
[6877] | 482 | int numVal = 0;
|
---|
[9032] | 483 | in >> key;
|
---|
[4991] | 484 | if (in.status() != QTextStream::Ok) {
|
---|
| 485 | break;
|
---|
| 486 | }
|
---|
[6877] | 487 | if (key == "APC") {
|
---|
[6850] | 488 | in >> numVal;
|
---|
[8679] | 489 | rtnAPC.ReSize(3); rtnAPC = 0.0;
|
---|
[6850] | 490 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 491 | in >> rtnAPC[ii];
|
---|
| 492 | }
|
---|
[4991] | 493 | }
|
---|
[8483] | 494 | else if (key == "Ura") {
|
---|
[6850] | 495 | in >> numVal;
|
---|
[6877] | 496 | if (numVal == 1)
|
---|
[8483] | 497 | in >> rtnUra;
|
---|
[4991] | 498 | }
|
---|
[8483] | 499 | else if (key == "Clk") {
|
---|
| 500 | in >> numVal;
|
---|
[8679] | 501 | rtnClk.ReSize(3); rtnClk = 0.0;
|
---|
[8483] | 502 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 503 | in >> rtnClk[ii];
|
---|
| 504 | }
|
---|
| 505 | }
|
---|
| 506 | else if (key == "ClkSig") {
|
---|
| 507 | in >> numVal;
|
---|
[8679] | 508 | rtnClkSig.ReSize(3); rtnClkSig = 0.0;
|
---|
[8483] | 509 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 510 | in >> rtnClkSig[ii];
|
---|
| 511 | }
|
---|
| 512 | }
|
---|
[4991] | 513 | else if (key == "Vel") {
|
---|
[6850] | 514 | in >> numVal;
|
---|
[8679] | 515 | rtnVel.ReSize(3); rtnVel = 0.0;
|
---|
[6850] | 516 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 517 | in >> rtnVel[ii];
|
---|
| 518 | }
|
---|
[4991] | 519 | }
|
---|
| 520 | else if (key == "CoM") {
|
---|
[6850] | 521 | in >> numVal;
|
---|
[8679] | 522 | rtnCoM.ReSize(3); rtnCoM = 0.0;
|
---|
[6850] | 523 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 524 | in >> rtnCoM[ii];
|
---|
| 525 | }
|
---|
[4991] | 526 | }
|
---|
[5503] | 527 | else if (key == "CodeBias") {
|
---|
[6850] | 528 | in >> numVal;
|
---|
[5503] | 529 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 530 | QString type;
|
---|
[6877] | 531 | double value;
|
---|
[5503] | 532 | in >> type >> value;
|
---|
| 533 | codeBiases[type] = value;
|
---|
| 534 | }
|
---|
| 535 | }
|
---|
[6857] | 536 | else if (key == "YawAngle") {
|
---|
[8017] | 537 | in >> numVal >> pbSat.yawAngle;
|
---|
| 538 | if (pbSat.yawAngle < 0.0) {
|
---|
| 539 | pbSat.yawAngle += (2*M_PI);
|
---|
[6975] | 540 | }
|
---|
[8017] | 541 | else if (pbSat.yawAngle > 2*M_PI) {
|
---|
| 542 | pbSat.yawAngle -= (2*M_PI);
|
---|
[6975] | 543 | }
|
---|
[6851] | 544 | }
|
---|
[6857] | 545 | else if (key == "YawRate") {
|
---|
[8017] | 546 | in >> numVal >> pbSat.yawRate;
|
---|
[6851] | 547 | }
|
---|
[6850] | 548 | else if (key == "PhaseBias") {
|
---|
| 549 | in >> numVal;
|
---|
| 550 | for (int ii = 0; ii < numVal; ii++) {
|
---|
[6851] | 551 | phaseBiasSignal pb;
|
---|
[8017] | 552 | in >> pb.type >> pb.bias >> pb.integerIndicator
|
---|
| 553 | >> pb.wlIndicator >> pb.discontinuityCounter;
|
---|
[6851] | 554 | phaseBiasList.append(pb);
|
---|
[6850] | 555 | }
|
---|
| 556 | }
|
---|
[4991] | 557 | else {
|
---|
[8689] | 558 | in >> numVal;
|
---|
| 559 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 560 | double dummy;
|
---|
| 561 | in >> dummy;
|
---|
| 562 | }
|
---|
[8542] | 563 | emit(newMessage(" RTNET format error: "
|
---|
| 564 | + lines[ii].toLatin1(), false));
|
---|
[4991] | 565 | }
|
---|
[5662] | 566 | }
|
---|
[6850] | 567 |
|
---|
[9025] | 568 | struct SsrCorr::ClockOrbit::SatData* sd = 0;
|
---|
[6877] | 569 | if (prn.system() == 'G') {
|
---|
[5666] | 570 | sd = co.Sat + co.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 571 | ++co.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
[3222] | 572 | }
|
---|
[6876] | 573 | else if (prn.system() == 'R') {
|
---|
[6877] | 574 | sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
[5666] | 575 | ++co.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
[3222] | 576 | }
|
---|
[6876] | 577 | else if (prn.system() == 'E') {
|
---|
[6844] | 578 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8967] | 579 | + co.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
[6844] | 580 | ++co.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 581 | }
|
---|
[6876] | 582 | else if (prn.system() == 'J') {
|
---|
[6877] | 583 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8967] | 584 | + CLOCKORBIT_NUMGALILEO
|
---|
[8982] | 585 | + co.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
[6844] | 586 | ++co.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 587 | }
|
---|
[8980] | 588 | else if (prn.system() == 'S') {
|
---|
| 589 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 590 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 591 | + co.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 592 | ++co.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 593 | }
|
---|
[8967] | 594 | else if (prn.system() == 'C') {
|
---|
| 595 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8980] | 596 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 597 | + CLOCKORBIT_NUMSBAS
|
---|
| 598 | + co.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
[8967] | 599 | ++co.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 600 | }
|
---|
[3222] | 601 | if (sd) {
|
---|
| 602 | QString outLine;
|
---|
[8542] | 603 | t_irc irc = processSatellite(eph, epoTime.gpsw(), epoTime.gpssec(), prnStr, rtnAPC,
|
---|
| 604 | rtnUra, rtnClk, rtnVel, rtnCoM, rtnClkSig, sd, outLine);
|
---|
| 605 | if (irc != success) {
|
---|
[8679] | 606 | // very few cases: check states bad and unhealthy are excluded earlier
|
---|
| 607 | sd->ID = prnStr.mid(1).toInt(); // to prevent G00, R00 entries
|
---|
| 608 | sd->IOD = eph->IOD();
|
---|
[8542] | 609 | }
|
---|
[3222] | 610 | }
|
---|
[5662] | 611 |
|
---|
[6850] | 612 | // Code Biases
|
---|
| 613 | // -----------
|
---|
[9025] | 614 | struct SsrCorr::CodeBias::BiasSat* biasSat = 0;
|
---|
[6877] | 615 | if (!codeBiases.isEmpty()) {
|
---|
| 616 | if (prn.system() == 'G') {
|
---|
| 617 | biasSat = bias.Sat + bias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 618 | ++bias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 619 | }
|
---|
| 620 | else if (prn.system() == 'R') {
|
---|
| 621 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS
|
---|
[8967] | 622 | + bias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
[6877] | 623 | ++bias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 624 | }
|
---|
| 625 | else if (prn.system() == 'E') {
|
---|
| 626 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8982] | 627 | + bias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
[6877] | 628 | ++bias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 629 | }
|
---|
| 630 | else if (prn.system() == 'J') {
|
---|
| 631 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8967] | 632 | + CLOCKORBIT_NUMGALILEO
|
---|
[8982] | 633 | + bias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
[6877] | 634 | ++bias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 635 | }
|
---|
| 636 | else if (prn.system() == 'S') {
|
---|
| 637 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8982] | 638 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
[8967] | 639 | + bias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
[6877] | 640 | ++bias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 641 | }
|
---|
[8982] | 642 | else if (prn.system() == 'C') {
|
---|
| 643 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
[8983] | 644 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
[8982] | 645 | + CLOCKORBIT_NUMSBAS
|
---|
| 646 | + bias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 647 | ++bias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 648 | }
|
---|
[3222] | 649 | }
|
---|
[5662] | 650 |
|
---|
[3222] | 651 | if (biasSat) {
|
---|
[6876] | 652 | biasSat->ID = prn.number();
|
---|
[5503] | 653 | biasSat->NumberOfCodeBiases = 0;
|
---|
[9025] | 654 | QMapIterator<QString, double> it(codeBiases);
|
---|
| 655 | while (it.hasNext()) {
|
---|
| 656 | it.next();
|
---|
| 657 | int ii = biasSat->NumberOfCodeBiases;
|
---|
| 658 | if (ii >= CLOCKORBIT_NUMBIAS)
|
---|
| 659 | break;
|
---|
| 660 | SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), it.key().toStdString());
|
---|
| 661 | if (type != _ssrCorr->RESERVED) {
|
---|
| 662 | biasSat->NumberOfCodeBiases += 1;
|
---|
| 663 | biasSat->Biases[ii].Type = type;
|
---|
| 664 | biasSat->Biases[ii].Bias = it.value();
|
---|
[5503] | 665 | }
|
---|
[3222] | 666 | }
|
---|
| 667 | }
|
---|
[8944] | 668 |
|
---|
[6850] | 669 | // Phase Biases
|
---|
| 670 | // ------------
|
---|
[9025] | 671 | struct SsrCorr::PhaseBias::PhaseBiasSat* phasebiasSat = 0;
|
---|
[8986] | 672 | if (prn.system() == 'G') {
|
---|
| 673 | phasebiasSat = phasebias.Sat
|
---|
| 674 | + phasebias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 675 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 676 | }
|
---|
| 677 | else if (prn.system() == 'R') {
|
---|
| 678 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS
|
---|
| 679 | + phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 680 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 681 | }
|
---|
| 682 | else if (prn.system() == 'E') {
|
---|
| 683 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 684 | + phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 685 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 686 | }
|
---|
| 687 | else if (prn.system() == 'J') {
|
---|
| 688 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 689 | + CLOCKORBIT_NUMGALILEO
|
---|
| 690 | + phasebias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 691 | ++phasebias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 692 | }
|
---|
| 693 | else if (prn.system() == 'S') {
|
---|
| 694 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 695 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 696 | + phasebias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 697 | ++phasebias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 698 | }
|
---|
| 699 | else if (prn.system() == 'C') {
|
---|
| 700 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 701 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 702 | + CLOCKORBIT_NUMSBAS
|
---|
| 703 | + phasebias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 704 | ++phasebias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 705 | }
|
---|
[6850] | 706 |
|
---|
| 707 | if (phasebiasSat) {
|
---|
[8017] | 708 | phasebias.DispersiveBiasConsistencyIndicator = dispersiveBiasConsistenyIndicator;
|
---|
| 709 | phasebias.MWConsistencyIndicator = mwConsistencyIndicator;
|
---|
[6876] | 710 | phasebiasSat->ID = prn.number();
|
---|
[6850] | 711 | phasebiasSat->NumberOfPhaseBiases = 0;
|
---|
[8017] | 712 | phasebiasSat->YawAngle = pbSat.yawAngle;
|
---|
| 713 | phasebiasSat->YawRate = pbSat.yawRate;
|
---|
[9025] | 714 | QListIterator<phaseBiasSignal> it(phaseBiasList);
|
---|
| 715 | while (it.hasNext()) {
|
---|
| 716 | const phaseBiasSignal &pbSig = it.next();
|
---|
| 717 | int ii = phasebiasSat->NumberOfPhaseBiases;
|
---|
| 718 | if (ii >= CLOCKORBIT_NUMBIAS)
|
---|
| 719 | break;
|
---|
| 720 | SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), pbSig.type.toStdString());
|
---|
| 721 | if (type != _ssrCorr->RESERVED) {
|
---|
| 722 | phasebiasSat->NumberOfPhaseBiases += 1;
|
---|
| 723 | phasebiasSat->Biases[ii].Type = type;
|
---|
| 724 | phasebiasSat->Biases[ii].Bias = pbSig.bias;
|
---|
| 725 | phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
|
---|
| 726 | phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
|
---|
| 727 | phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
|
---|
[6850] | 728 | }
|
---|
| 729 | }
|
---|
| 730 | }
|
---|
[3222] | 731 | }
|
---|
| 732 | }
|
---|
[3227] | 733 |
|
---|
[5662] | 734 | QByteArray hlpBufferCo;
|
---|
[3493] | 735 |
|
---|
| 736 | // Orbit and Clock Corrections together
|
---|
| 737 | // ------------------------------------
|
---|
[4174] | 738 | if (_samplRtcmEphCorr == 0.0) {
|
---|
[6877] | 739 | if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
| 740 | || co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
| 741 | || co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
| 742 | || co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
| 743 | || co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
| 744 | || co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
[3493] | 745 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
[9025] | 746 | int len = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
[3493] | 747 | if (len > 0) {
|
---|
| 748 | hlpBufferCo = QByteArray(obuffer, len);
|
---|
| 749 | }
|
---|
[3222] | 750 | }
|
---|
| 751 | }
|
---|
[3493] | 752 |
|
---|
| 753 | // Orbit and Clock Corrections separately
|
---|
| 754 | // --------------------------------------
|
---|
| 755 | else {
|
---|
[5666] | 756 | if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
|
---|
[3493] | 757 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
[4174] | 758 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
[4754] | 759 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 760 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSORBIT, 1, obuffer,
|
---|
[6877] | 761 | sizeof(obuffer));
|
---|
[4754] | 762 | co.UpdateInterval = clkUpdInd;
|
---|
[3493] | 763 | if (len1 > 0) {
|
---|
| 764 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 765 | }
|
---|
| 766 | }
|
---|
[8808] | 767 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 ||
|
---|
| 768 | co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 ||
|
---|
| 769 | co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
| 770 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 771 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 772 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSCLOCK, mmsg, obuffer,
|
---|
[6877] | 773 | sizeof(obuffer));
|
---|
[3493] | 774 | if (len2 > 0) {
|
---|
| 775 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 776 | }
|
---|
| 777 | }
|
---|
[5666] | 778 | if (co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
|
---|
[3493] | 779 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
[4174] | 780 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
[4754] | 781 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 782 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSORBIT, 1, obuffer,
|
---|
[6877] | 783 | sizeof(obuffer));
|
---|
[4754] | 784 | co.UpdateInterval = clkUpdInd;
|
---|
[3493] | 785 | if (len1 > 0) {
|
---|
| 786 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 787 | }
|
---|
| 788 | }
|
---|
[8808] | 789 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 ||
|
---|
| 790 | co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
| 791 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 792 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 793 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSCLOCK, mmsg, obuffer,
|
---|
[6877] | 794 | sizeof(obuffer));
|
---|
[3493] | 795 | if (len2 > 0) {
|
---|
| 796 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 797 | }
|
---|
| 798 | }
|
---|
[6844] | 799 | if (co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0) {
|
---|
| 800 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
| 801 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 802 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 803 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOORBIT, 1, obuffer,
|
---|
[6877] | 804 | sizeof(obuffer));
|
---|
[6844] | 805 | co.UpdateInterval = clkUpdInd;
|
---|
| 806 | if (len1 > 0) {
|
---|
| 807 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 808 | }
|
---|
| 809 | }
|
---|
[8808] | 810 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
| 811 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 812 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 813 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOCLOCK, mmsg, obuffer,
|
---|
[6877] | 814 | sizeof(obuffer));
|
---|
[6844] | 815 | if (len2 > 0) {
|
---|
| 816 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 817 | }
|
---|
| 818 | }
|
---|
| 819 | if (co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0) {
|
---|
| 820 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
| 821 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 822 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 823 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSORBIT, 1, obuffer,
|
---|
[6877] | 824 | sizeof(obuffer));
|
---|
[6844] | 825 | co.UpdateInterval = clkUpdInd;
|
---|
| 826 | if (len1 > 0) {
|
---|
| 827 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 828 | }
|
---|
| 829 | }
|
---|
[8808] | 830 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 831 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 832 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSCLOCK, mmsg, obuffer,
|
---|
[6877] | 833 | sizeof(obuffer));
|
---|
[6844] | 834 | if (len2 > 0) {
|
---|
| 835 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 836 | }
|
---|
| 837 | }
|
---|
| 838 | if (co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0) {
|
---|
| 839 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
| 840 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 841 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 842 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASORBIT, 1, obuffer,
|
---|
[6877] | 843 | sizeof(obuffer));
|
---|
[6844] | 844 | co.UpdateInterval = clkUpdInd;
|
---|
| 845 | if (len1 > 0) {
|
---|
| 846 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 847 | }
|
---|
| 848 | }
|
---|
| 849 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) ? 1 : 0;
|
---|
[9025] | 850 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASCLOCK, mmsg, obuffer,
|
---|
[6877] | 851 | sizeof(obuffer));
|
---|
[6844] | 852 | if (len2 > 0) {
|
---|
| 853 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 854 | }
|
---|
| 855 | }
|
---|
| 856 | if (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
| 857 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
| 858 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 859 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 860 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSORBIT, 1, obuffer,
|
---|
[6877] | 861 | sizeof(obuffer));
|
---|
[6844] | 862 | co.UpdateInterval = clkUpdInd;
|
---|
| 863 | if (len1 > 0) {
|
---|
| 864 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 865 | }
|
---|
| 866 | }
|
---|
[8808] | 867 | int mmsg = 0;
|
---|
[9025] | 868 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSCLOCK, mmsg, obuffer,
|
---|
[6877] | 869 | sizeof(obuffer));
|
---|
[6844] | 870 | if (len2 > 0) {
|
---|
| 871 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 872 | }
|
---|
| 873 | }
|
---|
[3493] | 874 | }
|
---|
[5662] | 875 |
|
---|
[6850] | 876 | // Code Biases
|
---|
| 877 | // -----------
|
---|
[5662] | 878 | QByteArray hlpBufferBias;
|
---|
[6877] | 879 | if (bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
| 880 | || bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
| 881 | || bias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
| 882 | || bias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
| 883 | || bias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
| 884 | || bias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
[3222] | 885 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
[9025] | 886 | int len = _ssrCorr->MakeCodeBias(&bias, _ssrCorr->CBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
[3222] | 887 | if (len > 0) {
|
---|
[3227] | 888 | hlpBufferBias = QByteArray(obuffer, len);
|
---|
[3222] | 889 | }
|
---|
| 890 | }
|
---|
[3227] | 891 |
|
---|
[6850] | 892 | // Phase Biases
|
---|
| 893 | // ------------
|
---|
| 894 | QByteArray hlpBufferPhaseBias;
|
---|
[6877] | 895 | if (phasebias.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
| 896 | || phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
| 897 | || phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
| 898 | || phasebias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
| 899 | || phasebias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
| 900 | || phasebias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
[6850] | 901 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
[9025] | 902 | int len = _ssrCorr->MakePhaseBias(&phasebias, _ssrCorr->PBTYPE_AUTO, 0, obuffer,
|
---|
[6877] | 903 | sizeof(obuffer));
|
---|
[6850] | 904 | if (len > 0) {
|
---|
| 905 | hlpBufferPhaseBias = QByteArray(obuffer, len);
|
---|
| 906 | }
|
---|
| 907 | }
|
---|
| 908 |
|
---|
| 909 | // VTEC
|
---|
| 910 | // ----
|
---|
| 911 | QByteArray hlpBufferVtec;
|
---|
[6860] | 912 | if (vtec.NumLayers > 0) {
|
---|
| 913 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
[9025] | 914 | int len = _ssrCorr->MakeVTEC(&vtec, 0, obuffer, sizeof(obuffer));
|
---|
[6860] | 915 | if (len > 0) {
|
---|
| 916 | hlpBufferVtec = QByteArray(obuffer, len);
|
---|
| 917 | }
|
---|
| 918 | }
|
---|
[6850] | 919 |
|
---|
[6877] | 920 | _outBuffer += hlpBufferCo + hlpBufferBias + hlpBufferPhaseBias
|
---|
| 921 | + hlpBufferVtec;
|
---|
[3222] | 922 | }
|
---|
| 923 |
|
---|
[5662] | 924 | //
|
---|
[3222] | 925 | ////////////////////////////////////////////////////////////////////////////
|
---|
[8542] | 926 | t_irc bncRtnetUploadCaster::processSatellite(const t_eph* eph, int GPSweek,
|
---|
[6877] | 927 | double GPSweeks, const QString& prn, const ColumnVector& rtnAPC,
|
---|
[8483] | 928 | double rtnUra, const ColumnVector& rtnClk, const ColumnVector& rtnVel,
|
---|
| 929 | const ColumnVector& rtnCoM, const ColumnVector& rtnClkSig,
|
---|
[9025] | 930 | struct SsrCorr::ClockOrbit::SatData* sd, QString& outLine) {
|
---|
[3222] | 931 |
|
---|
[4930] | 932 | // Broadcast Position and Velocity
|
---|
| 933 | // -------------------------------
|
---|
[8542] | 934 | ColumnVector xB(6);
|
---|
[4930] | 935 | ColumnVector vB(3);
|
---|
[8542] | 936 | t_irc irc = eph->getCrd(bncTime(GPSweek, GPSweeks), xB, vB, false);
|
---|
[5662] | 937 |
|
---|
[8542] | 938 | if (irc != success) {
|
---|
| 939 | return irc;
|
---|
| 940 | }
|
---|
| 941 |
|
---|
[4991] | 942 | // Precise Position
|
---|
| 943 | // ----------------
|
---|
| 944 | ColumnVector xP = _CoM ? rtnCoM : rtnAPC;
|
---|
[3222] | 945 |
|
---|
[8542] | 946 | if (xP.size() == 0) {
|
---|
| 947 | return failure;
|
---|
| 948 | }
|
---|
| 949 |
|
---|
[5662] | 950 | double dc = 0.0;
|
---|
[8405] | 951 | if (_crdTrafo != "IGS14") {
|
---|
[8145] | 952 | crdTrafo(GPSweek, xP, dc);
|
---|
[8094] | 953 | }
|
---|
[5662] | 954 |
|
---|
[4930] | 955 | // Difference in xyz
|
---|
| 956 | // -----------------
|
---|
[6877] | 957 | ColumnVector dx = xB.Rows(1, 3) - xP;
|
---|
| 958 | ColumnVector dv = vB - rtnVel;
|
---|
[5662] | 959 |
|
---|
[4930] | 960 | // Difference in RSW
|
---|
| 961 | // -----------------
|
---|
[3222] | 962 | ColumnVector rsw(3);
|
---|
[6877] | 963 | XYZ_to_RSW(xB.Rows(1, 3), vB, dx, rsw);
|
---|
[3222] | 964 |
|
---|
[4930] | 965 | ColumnVector dotRsw(3);
|
---|
[6877] | 966 | XYZ_to_RSW(xB.Rows(1, 3), vB, dv, dotRsw);
|
---|
[3222] | 967 |
|
---|
[4930] | 968 | // Clock Correction
|
---|
| 969 | // ----------------
|
---|
[8499] | 970 | double dClkA0 = rtnClk(1) - (xB(4) - dc) * t_CST::c;
|
---|
[8679] | 971 | double dClkA1 = 0.0;
|
---|
| 972 | if (rtnClk(2)) {
|
---|
[9025] | 973 | dClkA1 = rtnClk(2) - xB(5) * t_CST::c;
|
---|
[8679] | 974 | }
|
---|
| 975 | double dClkA2 = 0.0;
|
---|
| 976 | if (rtnClk(3)) {
|
---|
[9025] | 977 | dClkA2 = rtnClk(3) - xB(6) * t_CST::c;
|
---|
[8679] | 978 | }
|
---|
[3222] | 979 |
|
---|
| 980 | if (sd) {
|
---|
[6877] | 981 | sd->ID = prn.mid(1).toInt();
|
---|
| 982 | sd->IOD = eph->IOD();
|
---|
[8483] | 983 | sd->Clock.DeltaA0 = dClkA0;
|
---|
| 984 | sd->Clock.DeltaA1 = dClkA1;
|
---|
| 985 | sd->Clock.DeltaA2 = dClkA2;
|
---|
| 986 | sd->UserRangeAccuracy = rtnUra;
|
---|
| 987 | sd->Orbit.DeltaRadial = rsw(1);
|
---|
[6877] | 988 | sd->Orbit.DeltaAlongTrack = rsw(2);
|
---|
| 989 | sd->Orbit.DeltaCrossTrack = rsw(3);
|
---|
[8483] | 990 | sd->Orbit.DotDeltaRadial = dotRsw(1);
|
---|
[4930] | 991 | sd->Orbit.DotDeltaAlongTrack = dotRsw(2);
|
---|
| 992 | sd->Orbit.DotDeltaCrossTrack = dotRsw(3);
|
---|
[3222] | 993 | }
|
---|
| 994 |
|
---|
[8483] | 995 | outLine.sprintf("%d %.1f %s %u %10.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", GPSweek,
|
---|
| 996 | GPSweeks, eph->prn().toString().c_str(), eph->IOD(), dClkA0, dClkA1, dClkA2,
|
---|
| 997 | rsw(1), rsw(2), rsw(3));
|
---|
[3222] | 998 |
|
---|
[8499] | 999 | // RTNET full clock for RINEX and SP3 file
|
---|
| 1000 | // ---------------------------------------
|
---|
[4991] | 1001 | double relativity = -2.0 * DotProduct(xP, rtnVel) / t_CST::c;
|
---|
[8499] | 1002 | double clkRnx = (rtnClk[0] - relativity) / t_CST::c; // [s]
|
---|
[8483] | 1003 | double clkRnxRate = rtnClk[1] / t_CST::c; // [s/s = -]
|
---|
| 1004 | double clkRnxAcc = rtnClk[2] / t_CST::c; // [s/s² ) -/s]
|
---|
[4991] | 1005 |
|
---|
[3222] | 1006 | if (_rnx) {
|
---|
[8510] | 1007 | double clkRnxSig, clkRnxRateSig, clkRnxAccSig;
|
---|
| 1008 | int s = rtnClkSig.size();
|
---|
| 1009 | switch (s) {
|
---|
| 1010 | case 1:
|
---|
| 1011 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
| 1012 | clkRnxRateSig = 0.0; // [s/s = -]
|
---|
| 1013 | clkRnxAccSig = 0.0; // [s/s² ) -/s]
|
---|
| 1014 | break;
|
---|
| 1015 | case 2:
|
---|
| 1016 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
| 1017 | clkRnxRateSig = rtnClkSig[1] / t_CST::c; // [s/s = -]
|
---|
| 1018 | clkRnxAccSig = 0.0; // [s/s² ) -/s]
|
---|
| 1019 | break;
|
---|
| 1020 | case 3:
|
---|
| 1021 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
| 1022 | clkRnxRateSig = rtnClkSig[1] / t_CST::c; // [s/s = -]
|
---|
| 1023 | clkRnxAccSig = rtnClkSig[2] / t_CST::c; // [s/s² ) -/s]
|
---|
| 1024 | break;
|
---|
| 1025 | }
|
---|
[8483] | 1026 | _rnx->write(GPSweek, GPSweeks, prn, clkRnx, clkRnxRate, clkRnxAcc,
|
---|
| 1027 | clkRnxSig, clkRnxRateSig, clkRnxAccSig);
|
---|
[3222] | 1028 | }
|
---|
| 1029 | if (_sp3) {
|
---|
[8483] | 1030 | _sp3->write(GPSweek, GPSweeks, prn, rtnCoM, clkRnx, rtnVel, clkRnxRate);
|
---|
[3222] | 1031 | }
|
---|
[8542] | 1032 | return success;
|
---|
[3222] | 1033 | }
|
---|
| 1034 |
|
---|
| 1035 | // Transform Coordinates
|
---|
| 1036 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5662] | 1037 | void bncRtnetUploadCaster::crdTrafo(int GPSWeek, ColumnVector& xyz,
|
---|
[6877] | 1038 | double& dc) {
|
---|
[3222] | 1039 |
|
---|
| 1040 | // Current epoch minus 2000.0 in years
|
---|
| 1041 | // ------------------------------------
|
---|
[6877] | 1042 | double dt = (GPSWeek - (1042.0 + 6.0 / 7.0)) / 365.2422 * 7.0 + 2000.0 - _t0;
|
---|
[3222] | 1043 |
|
---|
| 1044 | ColumnVector dx(3);
|
---|
| 1045 |
|
---|
| 1046 | dx(1) = _dx + dt * _dxr;
|
---|
| 1047 | dx(2) = _dy + dt * _dyr;
|
---|
| 1048 | dx(3) = _dz + dt * _dzr;
|
---|
| 1049 |
|
---|
| 1050 | static const double arcSec = 180.0 * 3600.0 / M_PI;
|
---|
| 1051 |
|
---|
| 1052 | double ox = (_ox + dt * _oxr) / arcSec;
|
---|
| 1053 | double oy = (_oy + dt * _oyr) / arcSec;
|
---|
| 1054 | double oz = (_oz + dt * _ozr) / arcSec;
|
---|
| 1055 |
|
---|
| 1056 | double sc = 1.0 + _sc * 1e-9 + dt * _scr * 1e-9;
|
---|
| 1057 |
|
---|
[4912] | 1058 | // Specify approximate center of area
|
---|
| 1059 | // ----------------------------------
|
---|
| 1060 | ColumnVector meanSta(3);
|
---|
| 1061 |
|
---|
[6877] | 1062 | if (_crdTrafo == "ETRF2000") {
|
---|
| 1063 | meanSta(1) = 3661090.0;
|
---|
| 1064 | meanSta(2) = 845230.0;
|
---|
| 1065 | meanSta(3) = 5136850.0;
|
---|
[4908] | 1066 | }
|
---|
[8094] | 1067 | else if (_crdTrafo == "GDA2020") {
|
---|
[4973] | 1068 | meanSta(1) = -4052050.0;
|
---|
[6877] | 1069 | meanSta(2) = 4212840.0;
|
---|
[4973] | 1070 | meanSta(3) = -2545110.0;
|
---|
[4912] | 1071 | }
|
---|
| 1072 | else if (_crdTrafo == "SIRGAS2000") {
|
---|
[6877] | 1073 | meanSta(1) = 3740860.0;
|
---|
[4973] | 1074 | meanSta(2) = -4964290.0;
|
---|
| 1075 | meanSta(3) = -1425420.0;
|
---|
[4912] | 1076 | }
|
---|
[5343] | 1077 | else if (_crdTrafo == "DREF91") {
|
---|
[6877] | 1078 | meanSta(1) = 3959579.0;
|
---|
| 1079 | meanSta(2) = 721719.0;
|
---|
| 1080 | meanSta(3) = 4931539.0;
|
---|
[5343] | 1081 | }
|
---|
[4912] | 1082 | else if (_crdTrafo == "Custom") {
|
---|
[6877] | 1083 | meanSta(1) = 0.0; // TODO
|
---|
| 1084 | meanSta(2) = 0.0; // TODO
|
---|
| 1085 | meanSta(3) = 0.0; // TODO
|
---|
[4912] | 1086 | }
|
---|
[4908] | 1087 |
|
---|
[4912] | 1088 | // Clock correction proportional to topocentric distance to satellites
|
---|
| 1089 | // -------------------------------------------------------------------
|
---|
[8904] | 1090 | double rho = (xyz - meanSta).NormFrobenius();
|
---|
[4913] | 1091 | dc = rho * (sc - 1.0) / sc / t_CST::c;
|
---|
[4908] | 1092 |
|
---|
[6877] | 1093 | Matrix rMat(3, 3);
|
---|
| 1094 | rMat(1, 1) = 1.0;
|
---|
| 1095 | rMat(1, 2) = -oz;
|
---|
| 1096 | rMat(1, 3) = oy;
|
---|
| 1097 | rMat(2, 1) = oz;
|
---|
| 1098 | rMat(2, 2) = 1.0;
|
---|
| 1099 | rMat(2, 3) = -ox;
|
---|
| 1100 | rMat(3, 1) = -oy;
|
---|
| 1101 | rMat(3, 2) = ox;
|
---|
| 1102 | rMat(3, 3) = 1.0;
|
---|
[3222] | 1103 |
|
---|
| 1104 | xyz = sc * rMat * xyz + dx;
|
---|
| 1105 | }
|
---|
| 1106 |
|
---|
[6557] | 1107 | int bncRtnetUploadCaster::determineUpdateInd(double samplingRate) {
|
---|
| 1108 |
|
---|
| 1109 | if (samplingRate == 10.0) {
|
---|
| 1110 | return 3;
|
---|
| 1111 | }
|
---|
| 1112 | else if (samplingRate == 15.0) {
|
---|
| 1113 | return 4;
|
---|
| 1114 | }
|
---|
| 1115 | else if (samplingRate == 30.0) {
|
---|
| 1116 | return 5;
|
---|
| 1117 | }
|
---|
| 1118 | else if (samplingRate == 60.0) {
|
---|
| 1119 | return 6;
|
---|
| 1120 | }
|
---|
| 1121 | else if (samplingRate == 120.0) {
|
---|
| 1122 | return 7;
|
---|
| 1123 | }
|
---|
| 1124 | else if (samplingRate == 240.0) {
|
---|
| 1125 | return 8;
|
---|
| 1126 | }
|
---|
| 1127 | else if (samplingRate == 300.0) {
|
---|
| 1128 | return 9;
|
---|
| 1129 | }
|
---|
| 1130 | else if (samplingRate == 600.0) {
|
---|
| 1131 | return 10;
|
---|
| 1132 | }
|
---|
| 1133 | else if (samplingRate == 900.0) {
|
---|
| 1134 | return 11;
|
---|
| 1135 | }
|
---|
| 1136 | else if (samplingRate == 1800.0) {
|
---|
| 1137 | return 12;
|
---|
| 1138 | }
|
---|
| 1139 | else if (samplingRate == 3600.0) {
|
---|
| 1140 | return 13;
|
---|
| 1141 | }
|
---|
| 1142 | else if (samplingRate == 7200.0) {
|
---|
| 1143 | return 14;
|
---|
| 1144 | }
|
---|
| 1145 | else if (samplingRate == 10800.0) {
|
---|
| 1146 | return 15;
|
---|
| 1147 | }
|
---|
[6877] | 1148 | return 2; // default
|
---|
[6557] | 1149 | }
|
---|