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