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