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