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