[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 |
|
---|
[9840] | 266 |
|
---|
[9841] | 267 | /* Append to internal buffer
|
---|
[3230] | 268 | // -------------------------
|
---|
[3222] | 269 | _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
|
---|
[3230] | 270 |
|
---|
| 271 | // Select buffer part that contains last epoch
|
---|
| 272 | // -------------------------------------------
|
---|
| 273 | QStringList lines;
|
---|
| 274 | int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); // begin of last epoch
|
---|
| 275 | if (iEpoBeg == -1) {
|
---|
[3226] | 276 | _rtnetStreamBuffer.clear();
|
---|
| 277 | return;
|
---|
[3222] | 278 | }
|
---|
[8755] | 279 | int iEpoBegEarlier = _rtnetStreamBuffer.indexOf('*');
|
---|
| 280 | if (iEpoBegEarlier != -1 && iEpoBegEarlier < iEpoBeg) { // are there two epoch lines in buffer?
|
---|
| 281 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBegEarlier);
|
---|
| 282 | }
|
---|
[6896] | 283 | else {
|
---|
| 284 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
|
---|
| 285 | }
|
---|
[8755] | 286 | int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch
|
---|
[3230] | 287 | if (iEpoEnd == -1) {
|
---|
| 288 | return;
|
---|
| 289 | }
|
---|
[8755] | 290 |
|
---|
| 291 | while (_rtnetStreamBuffer.count('*') > 1) { // is there more than 1 epoch line in buffer?
|
---|
| 292 | QString rtnetStreamBuffer = _rtnetStreamBuffer.mid(1);
|
---|
| 293 | int nextEpoch = rtnetStreamBuffer.indexOf('*');
|
---|
[8982] | 294 | if (nextEpoch != -1 && nextEpoch < iEpoEnd) {
|
---|
[8755] | 295 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(nextEpoch);
|
---|
| 296 | }
|
---|
[8761] | 297 | else if (nextEpoch != -1 && nextEpoch >= iEpoEnd) {
|
---|
| 298 | break;
|
---|
| 299 | }
|
---|
[3226] | 300 | }
|
---|
[3222] | 301 |
|
---|
[9687] | 302 | lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
|
---|
| 303 |
|
---|
[8755] | 304 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd + 3);
|
---|
| 305 |
|
---|
[3226] | 306 | if (lines.size() < 2) {
|
---|
[9823] | 307 | emit(newMessage(
|
---|
| 308 | "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
|
---|
[3222] | 309 | return;
|
---|
| 310 | }
|
---|
[9841] | 311 | */
|
---|
[3222] | 312 |
|
---|
[9841] | 313 | // Append to internal buffer
|
---|
| 314 | // -------------------------
|
---|
| 315 | _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
|
---|
| 316 |
|
---|
| 317 | // Select buffer part that contains last epoch
|
---|
| 318 | // -------------------------------------------
|
---|
| 319 | QStringList lines;
|
---|
| 320 | int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); // begin of last epoch
|
---|
| 321 | if (iEpoBeg == -1) {
|
---|
| 322 | _rtnetStreamBuffer.clear();
|
---|
| 323 | return;
|
---|
| 324 | }
|
---|
| 325 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
|
---|
| 326 |
|
---|
| 327 | int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch
|
---|
| 328 | if (iEpoEnd == -1) {
|
---|
| 329 | return;
|
---|
| 330 | }
|
---|
| 331 | else {
|
---|
| 332 | lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
|
---|
| 333 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3);
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | if (lines.size() < 2) {
|
---|
| 337 | emit(newMessage(
|
---|
| 338 | "bncRtnetUploadCaster: less than 2 lines to decode " + _casterID.toLatin1(), false));
|
---|
| 339 | return;
|
---|
| 340 | }
|
---|
| 341 |
|
---|
| 342 | // Keep the last unfinished line in buffer
|
---|
| 343 | // ---------------------------------------
|
---|
| 344 | int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n');
|
---|
| 345 | if (iLastEOL != -1) {
|
---|
| 346 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1);
|
---|
| 347 | }
|
---|
| 348 |
|
---|
[3226] | 349 | // Read first line (with epoch time)
|
---|
| 350 | // ---------------------------------
|
---|
[8204] | 351 | QTextStream in(lines[0].toLatin1());
|
---|
[3226] | 352 | QString hlp;
|
---|
[6877] | 353 | int year, month, day, hour, min;
|
---|
| 354 | double sec;
|
---|
[3226] | 355 | in >> hlp >> year >> month >> day >> hour >> min >> sec;
|
---|
[6877] | 356 | bncTime epoTime;
|
---|
| 357 | epoTime.set(year, month, day, hour, min, sec);
|
---|
[3226] | 358 |
|
---|
[6877] | 359 | emit(newMessage(
|
---|
| 360 | "bncRtnetUploadCaster: decode " + QByteArray(epoTime.datestr().c_str())
|
---|
| 361 | + " " + QByteArray(epoTime.timestr().c_str()) + " "
|
---|
[8204] | 362 | + _casterID.toLatin1(), false));
|
---|
[4808] | 363 |
|
---|
[9025] | 364 | struct SsrCorr::ClockOrbit co;
|
---|
[3222] | 365 | memset(&co, 0, sizeof(co));
|
---|
[8991] | 366 | co.EpochTime[CLOCKORBIT_SATGPS] = static_cast<int>(epoTime.gpssec());
|
---|
[9025] | 367 | if (_ssrFormat == "RTCM-SSR") {
|
---|
| 368 | double gt = epoTime.gpssec() + 3 * 3600 - gnumleap(year, month, day);
|
---|
| 369 | co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
|
---|
| 370 | }
|
---|
| 371 | else if (_ssrFormat == "IGS-SSR") {
|
---|
| 372 | co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(epoTime.gpssec());
|
---|
| 373 | }
|
---|
[6846] | 374 | co.EpochTime[CLOCKORBIT_SATGALILEO] = static_cast<int>(epoTime.gpssec());
|
---|
[9025] | 375 | co.EpochTime[CLOCKORBIT_SATQZSS] = static_cast<int>(epoTime.gpssec());
|
---|
| 376 | co.EpochTime[CLOCKORBIT_SATSBAS] = static_cast<int>(epoTime.gpssec());
|
---|
| 377 | if (_ssrFormat == "RTCM-SSR") {
|
---|
| 378 | co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
|
---|
| 379 | }
|
---|
| 380 | else if (_ssrFormat == "IGS-SSR") {
|
---|
| 381 | co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
|
---|
| 382 | }
|
---|
| 383 | co.Supplied[_ssrCorr->COBOFS_CLOCK] = 1;
|
---|
| 384 | co.Supplied[_ssrCorr->COBOFS_ORBIT] = 1;
|
---|
| 385 | co.SatRefDatum = _ssrCorr->DATUM_ITRF; // ToDo: to decode from RTNET format
|
---|
| 386 | co.SSRIOD = _IOD;
|
---|
[6850] | 387 | co.SSRProviderID = _PID; // 256 .. BKG, 257 ... EUREF
|
---|
| 388 | co.SSRSolutionID = _SID;
|
---|
[5662] | 389 |
|
---|
[9025] | 390 | struct SsrCorr::CodeBias bias;
|
---|
[3222] | 391 | memset(&bias, 0, sizeof(bias));
|
---|
[9025] | 392 | bias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
|
---|
[5666] | 393 | bias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
|
---|
[6846] | 394 | bias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
|
---|
[9025] | 395 | bias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
|
---|
| 396 | bias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
|
---|
| 397 | bias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
|
---|
| 398 | bias.SSRIOD = _IOD;
|
---|
[6850] | 399 | bias.SSRProviderID = _PID;
|
---|
| 400 | bias.SSRSolutionID = _SID;
|
---|
[5662] | 401 |
|
---|
[9025] | 402 | struct SsrCorr::PhaseBias phasebias;
|
---|
[6850] | 403 | memset(&phasebias, 0, sizeof(phasebias));
|
---|
[8017] | 404 | unsigned int dispersiveBiasConsistenyIndicator = 0;
|
---|
| 405 | unsigned int mwConsistencyIndicator = 0;
|
---|
[9025] | 406 | phasebias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
|
---|
[6850] | 407 | phasebias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
|
---|
| 408 | phasebias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
|
---|
[9025] | 409 | phasebias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
|
---|
| 410 | phasebias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
|
---|
| 411 | phasebias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
|
---|
| 412 | phasebias.SSRIOD = _IOD;
|
---|
[6850] | 413 | phasebias.SSRProviderID = _PID;
|
---|
| 414 | phasebias.SSRSolutionID = _SID;
|
---|
| 415 |
|
---|
[9025] | 416 | struct SsrCorr::VTEC vtec;
|
---|
[6860] | 417 | memset(&vtec, 0, sizeof(vtec));
|
---|
| 418 | vtec.EpochTime = static_cast<int>(epoTime.gpssec());
|
---|
[9025] | 419 | vtec.SSRIOD = _IOD;
|
---|
[6860] | 420 | vtec.SSRProviderID = _PID;
|
---|
| 421 | vtec.SSRSolutionID = _SID;
|
---|
| 422 |
|
---|
[4753] | 423 | // Default Update Interval
|
---|
| 424 | // -----------------------
|
---|
[4754] | 425 | int clkUpdInd = 2; // 5 sec
|
---|
| 426 | int ephUpdInd = clkUpdInd; // default
|
---|
[6557] | 427 |
|
---|
[9275] | 428 | if (!_samplRtcmEphCorr) {
|
---|
| 429 | _samplRtcmEphCorr = 5.0;
|
---|
| 430 | }
|
---|
| 431 |
|
---|
[6559] | 432 | if (_samplRtcmClkCorr > 5.0 && _samplRtcmEphCorr <= 5.0) { // combined orb and clock
|
---|
| 433 | ephUpdInd = determineUpdateInd(_samplRtcmClkCorr);
|
---|
[4754] | 434 | }
|
---|
[6559] | 435 | if (_samplRtcmClkCorr > 5.0) {
|
---|
[6557] | 436 | clkUpdInd = determineUpdateInd(_samplRtcmClkCorr);
|
---|
[4754] | 437 | }
|
---|
[6559] | 438 | if (_samplRtcmEphCorr > 5.0) {
|
---|
| 439 | ephUpdInd = determineUpdateInd(_samplRtcmEphCorr);
|
---|
| 440 | }
|
---|
[4753] | 441 |
|
---|
[6877] | 442 | co.UpdateInterval = clkUpdInd;
|
---|
[9124] | 443 | bias.UpdateInterval = ephUpdInd;
|
---|
| 444 | phasebias.UpdateInterval = ephUpdInd;
|
---|
[4753] | 445 |
|
---|
[3226] | 446 | for (int ii = 1; ii < lines.size(); ii++) {
|
---|
[6877] | 447 | QString key; // prn or key VTEC, IND (phase bias indicators)
|
---|
[9247] | 448 | double rtnUra = 0.0; // [m]
|
---|
[8679] | 449 | ColumnVector rtnAPC; rtnAPC.ReSize(3); rtnAPC = 0.0; // [m, m, m]
|
---|
| 450 | ColumnVector rtnVel; rtnVel.ReSize(3); rtnVel = 0.0; // [m/s, m/s, m/s]
|
---|
| 451 | ColumnVector rtnCoM; rtnCoM.ReSize(3); rtnCoM = 0.0; // [m, m, m]
|
---|
| 452 | ColumnVector rtnClk; rtnClk.ReSize(3); rtnClk = 0.0; // [m, m/s, m/s²]
|
---|
| 453 | ColumnVector rtnClkSig; rtnClkSig.ReSize(3); rtnClkSig = 0.0; // [m, m/s, m/s²]
|
---|
[6877] | 454 | t_prn prn;
|
---|
[5662] | 455 |
|
---|
[8204] | 456 | QTextStream in(lines[ii].toLatin1());
|
---|
[3222] | 457 |
|
---|
[6876] | 458 | in >> key;
|
---|
[3222] | 459 |
|
---|
[6860] | 460 | // non-satellite specific parameters
|
---|
[6877] | 461 | if (key.contains("IND", Qt::CaseSensitive)) {
|
---|
[8017] | 462 | in >> dispersiveBiasConsistenyIndicator >> mwConsistencyIndicator;
|
---|
[6860] | 463 | continue;
|
---|
| 464 | }
|
---|
[6893] | 465 | // non-satellite specific parameters
|
---|
[6876] | 466 | if (key.contains("VTEC", Qt::CaseSensitive)) {
|
---|
[6897] | 467 | double ui;
|
---|
| 468 | in >> ui >> vtec.NumLayers;
|
---|
| 469 | vtec.UpdateInterval = (unsigned int) determineUpdateInd(ui);
|
---|
[6860] | 470 | for (unsigned ll = 0; ll < vtec.NumLayers; ll++) {
|
---|
| 471 | int dummy;
|
---|
| 472 | in >> dummy >> vtec.Layers[ll].Degree >> vtec.Layers[ll].Order
|
---|
[6877] | 473 | >> vtec.Layers[ll].Height;
|
---|
[6879] | 474 | for (unsigned iDeg = 0; iDeg <= vtec.Layers[ll].Degree; iDeg++) {
|
---|
| 475 | for (unsigned iOrd = 0; iOrd <= vtec.Layers[ll].Order; iOrd++) {
|
---|
[6860] | 476 | in >> vtec.Layers[ll].Cosinus[iDeg][iOrd];
|
---|
| 477 | }
|
---|
| 478 | }
|
---|
[6879] | 479 | for (unsigned iDeg = 0; iDeg <= vtec.Layers[ll].Degree; iDeg++) {
|
---|
| 480 | for (unsigned iOrd = 0; iOrd <= vtec.Layers[ll].Order; iOrd++) {
|
---|
[6860] | 481 | in >> vtec.Layers[ll].Sinus[iDeg][iOrd];
|
---|
| 482 | }
|
---|
| 483 | }
|
---|
| 484 | }
|
---|
| 485 | continue;
|
---|
| 486 | }
|
---|
[6877] | 487 | // satellite specific parameters
|
---|
[8204] | 488 | char sys = key.mid(0, 1).at(0).toLatin1();
|
---|
[6877] | 489 | int number = key.mid(1, 2).toInt();
|
---|
| 490 | int flags = 0;
|
---|
| 491 | if (sys == 'E') { // I/NAV
|
---|
| 492 | flags = 1;
|
---|
| 493 | }
|
---|
[9509] | 494 | if (number == 0) {
|
---|
| 495 | continue;
|
---|
| 496 | }
|
---|
[6876] | 497 | prn.set(sys, number, flags);
|
---|
| 498 | QString prnInternalStr = QString::fromStdString(prn.toInternalString());
|
---|
[6877] | 499 | QString prnStr = QString::fromStdString(prn.toString());
|
---|
| 500 |
|
---|
[6876] | 501 | const t_eph* ephLast = _ephUser->ephLast(prnInternalStr);
|
---|
| 502 | const t_eph* ephPrev = _ephUser->ephPrev(prnInternalStr);
|
---|
[6877] | 503 | const t_eph* eph = ephLast;
|
---|
[6442] | 504 | if (eph) {
|
---|
[3754] | 505 |
|
---|
[4098] | 506 | // Use previous ephemeris if the last one is too recent
|
---|
| 507 | // ----------------------------------------------------
|
---|
| 508 | const int MINAGE = 60; // seconds
|
---|
[6877] | 509 | if (ephPrev && eph->receptDateTime().isValid()
|
---|
| 510 | && eph->receptDateTime().secsTo(currentDateAndTimeGPS()) < MINAGE) {
|
---|
[6442] | 511 | eph = ephPrev;
|
---|
[4098] | 512 | }
|
---|
[3754] | 513 |
|
---|
[3753] | 514 | // Make sure the clock messages refer to same IOD as orbit messages
|
---|
| 515 | // ----------------------------------------------------------------
|
---|
| 516 | if (_usedEph) {
|
---|
[4174] | 517 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
[6876] | 518 | (*_usedEph)[prnInternalStr] = eph;
|
---|
[3753] | 519 | }
|
---|
| 520 | else {
|
---|
| 521 | eph = 0;
|
---|
[6876] | 522 | if (_usedEph->contains(prnInternalStr)) {
|
---|
| 523 | const t_eph* usedEph = _usedEph->value(prnInternalStr);
|
---|
[6877] | 524 | if (usedEph == ephLast) {
|
---|
[6442] | 525 | eph = ephLast;
|
---|
[3753] | 526 | }
|
---|
[6442] | 527 | else if (usedEph == ephPrev) {
|
---|
| 528 | eph = ephPrev;
|
---|
[3753] | 529 | }
|
---|
| 530 | }
|
---|
| 531 | }
|
---|
| 532 | }
|
---|
[9354] | 533 | }
|
---|
[9488] | 534 |
|
---|
[9354] | 535 | if (eph &&
|
---|
| 536 | !outDatedBcep(eph) && // detected from storage because of no update
|
---|
| 537 | eph->checkState() != t_eph::bad &&
|
---|
| 538 | eph->checkState() != t_eph::unhealthy &&
|
---|
| 539 | eph->checkState() != t_eph::outdated) { // detected during reception (bncephuser)
|
---|
| 540 | QMap<QString, double> codeBiases;
|
---|
| 541 | QList<phaseBiasSignal> phaseBiasList;
|
---|
| 542 | phaseBiasesSat pbSat;
|
---|
| 543 | _phaseBiasInformationDecoded = false;
|
---|
[3753] | 544 |
|
---|
[9354] | 545 | while (true) {
|
---|
| 546 | QString key;
|
---|
| 547 | int numVal = 0;
|
---|
| 548 | in >> key;
|
---|
| 549 | if (in.status() != QTextStream::Ok) {
|
---|
| 550 | break;
|
---|
| 551 | }
|
---|
| 552 | if (key == "APC") {
|
---|
| 553 | in >> numVal;
|
---|
| 554 | rtnAPC.ReSize(3); rtnAPC = 0.0;
|
---|
| 555 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 556 | in >> rtnAPC[ii];
|
---|
[6850] | 557 | }
|
---|
[9354] | 558 | }
|
---|
| 559 | else if (key == "Ura") {
|
---|
| 560 | in >> numVal;
|
---|
| 561 | if (numVal == 1)
|
---|
| 562 | in >> rtnUra;
|
---|
| 563 | }
|
---|
| 564 | else if (key == "Clk") {
|
---|
| 565 | in >> numVal;
|
---|
| 566 | rtnClk.ReSize(3); rtnClk = 0.0;
|
---|
| 567 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 568 | in >> rtnClk[ii];
|
---|
[8483] | 569 | }
|
---|
[9354] | 570 | }
|
---|
| 571 | else if (key == "ClkSig") {
|
---|
| 572 | in >> numVal;
|
---|
| 573 | rtnClkSig.ReSize(3); rtnClkSig = 0.0;
|
---|
| 574 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 575 | in >> rtnClkSig[ii];
|
---|
[8483] | 576 | }
|
---|
[9354] | 577 | }
|
---|
| 578 | else if (key == "Vel") {
|
---|
| 579 | in >> numVal;
|
---|
| 580 | rtnVel.ReSize(3); rtnVel = 0.0;
|
---|
| 581 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 582 | in >> rtnVel[ii];
|
---|
[6850] | 583 | }
|
---|
[9354] | 584 | }
|
---|
| 585 | else if (key == "CoM") {
|
---|
| 586 | in >> numVal;
|
---|
| 587 | rtnCoM.ReSize(3); rtnCoM = 0.0;
|
---|
| 588 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 589 | in >> rtnCoM[ii];
|
---|
[6850] | 590 | }
|
---|
[9354] | 591 | }
|
---|
| 592 | else if (key == "CodeBias") {
|
---|
| 593 | in >> numVal;
|
---|
| 594 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 595 | QString type;
|
---|
| 596 | double value;
|
---|
| 597 | in >> type >> value;
|
---|
| 598 | codeBiases[type] = value;
|
---|
[5503] | 599 | }
|
---|
[9354] | 600 | }
|
---|
| 601 | else if (key == "YawAngle") {
|
---|
| 602 | _phaseBiasInformationDecoded = true;
|
---|
| 603 | in >> numVal >> pbSat.yawAngle;
|
---|
| 604 | if (pbSat.yawAngle < 0.0) {
|
---|
| 605 | pbSat.yawAngle += (2*M_PI);
|
---|
[6975] | 606 | }
|
---|
[9354] | 607 | else if (pbSat.yawAngle > 2*M_PI) {
|
---|
| 608 | pbSat.yawAngle -= (2*M_PI);
|
---|
[6975] | 609 | }
|
---|
[6851] | 610 | }
|
---|
[9354] | 611 | else if (key == "YawRate") {
|
---|
| 612 | _phaseBiasInformationDecoded = true;
|
---|
| 613 | in >> numVal >> pbSat.yawRate;
|
---|
[6851] | 614 | }
|
---|
[9354] | 615 | else if (key == "PhaseBias") {
|
---|
| 616 | _phaseBiasInformationDecoded = true;
|
---|
| 617 | in >> numVal;
|
---|
| 618 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 619 | phaseBiasSignal pb;
|
---|
| 620 | in >> pb.type >> pb.bias >> pb.integerIndicator
|
---|
| 621 | >> pb.wlIndicator >> pb.discontinuityCounter;
|
---|
| 622 | phaseBiasList.append(pb);
|
---|
[6850] | 623 | }
|
---|
| 624 | }
|
---|
[9354] | 625 | else {
|
---|
| 626 | in >> numVal;
|
---|
| 627 | for (int ii = 0; ii < numVal; ii++) {
|
---|
| 628 | double dummy;
|
---|
| 629 | in >> dummy;
|
---|
[8689] | 630 | }
|
---|
[9354] | 631 | emit(newMessage(" RTNET format error: "
|
---|
| 632 | + lines[ii].toLatin1(), false));
|
---|
[9821] | 633 | break;
|
---|
[4991] | 634 | }
|
---|
[9354] | 635 | }
|
---|
[6850] | 636 |
|
---|
[9354] | 637 | struct SsrCorr::ClockOrbit::SatData* sd = 0;
|
---|
| 638 | if (prn.system() == 'G') {
|
---|
| 639 | sd = co.Sat + co.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 640 | ++co.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 641 | }
|
---|
| 642 | else if (prn.system() == 'R') {
|
---|
| 643 | sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 644 | ++co.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 645 | }
|
---|
| 646 | else if (prn.system() == 'E') {
|
---|
| 647 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 648 | + co.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 649 | ++co.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 650 | }
|
---|
| 651 | else if (prn.system() == 'J') {
|
---|
| 652 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 653 | + CLOCKORBIT_NUMGALILEO
|
---|
| 654 | + co.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 655 | ++co.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 656 | }
|
---|
| 657 | else if (prn.system() == 'S') {
|
---|
| 658 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 659 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 660 | + co.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 661 | ++co.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 662 | }
|
---|
| 663 | else if (prn.system() == 'C') {
|
---|
| 664 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 665 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 666 | + CLOCKORBIT_NUMSBAS
|
---|
| 667 | + co.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 668 | ++co.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 669 | }
|
---|
| 670 | if (sd) {
|
---|
| 671 | QString outLine;
|
---|
| 672 | t_irc irc = processSatellite(eph, epoTime.gpsw(), epoTime.gpssec(), prnStr, rtnAPC,
|
---|
| 673 | rtnUra, rtnClk, rtnVel, rtnCoM, rtnClkSig, sd, outLine);
|
---|
[9509] | 674 | if (irc != success) {
|
---|
[9354] | 675 | continue;
|
---|
[8542] | 676 | }
|
---|
[9354] | 677 | }
|
---|
[5662] | 678 |
|
---|
[9354] | 679 | // Code Biases
|
---|
| 680 | // -----------
|
---|
| 681 | struct SsrCorr::CodeBias::BiasSat* biasSat = 0;
|
---|
| 682 | if (!codeBiases.isEmpty()) {
|
---|
| 683 | if (prn.system() == 'G') {
|
---|
| 684 | biasSat = bias.Sat + bias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 685 | ++bias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
[6877] | 686 | }
|
---|
| 687 | else if (prn.system() == 'R') {
|
---|
[9354] | 688 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS
|
---|
| 689 | + bias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 690 | ++bias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
[6877] | 691 | }
|
---|
| 692 | else if (prn.system() == 'E') {
|
---|
[9354] | 693 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 694 | + bias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 695 | ++bias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
[6877] | 696 | }
|
---|
| 697 | else if (prn.system() == 'J') {
|
---|
[9354] | 698 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 699 | + CLOCKORBIT_NUMGALILEO
|
---|
| 700 | + bias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 701 | ++bias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
[6877] | 702 | }
|
---|
| 703 | else if (prn.system() == 'S') {
|
---|
[9354] | 704 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 705 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 706 | + bias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 707 | ++bias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
[6877] | 708 | }
|
---|
[8982] | 709 | else if (prn.system() == 'C') {
|
---|
[9354] | 710 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 711 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 712 | + CLOCKORBIT_NUMSBAS
|
---|
| 713 | + bias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 714 | ++bias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
[8982] | 715 | }
|
---|
[9354] | 716 | }
|
---|
[5662] | 717 |
|
---|
[9354] | 718 | if (biasSat) {
|
---|
| 719 | biasSat->ID = prn.number();
|
---|
| 720 | biasSat->NumberOfCodeBiases = 0;
|
---|
| 721 | QMapIterator<QString, double> it(codeBiases);
|
---|
| 722 | while (it.hasNext()) {
|
---|
| 723 | it.next();
|
---|
| 724 | int ii = biasSat->NumberOfCodeBiases;
|
---|
| 725 | if (ii >= CLOCKORBIT_NUMBIAS)
|
---|
| 726 | break;
|
---|
| 727 | SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), it.key().toStdString());
|
---|
| 728 | if (type != _ssrCorr->RESERVED) {
|
---|
| 729 | biasSat->NumberOfCodeBiases += 1;
|
---|
| 730 | biasSat->Biases[ii].Type = type;
|
---|
| 731 | biasSat->Biases[ii].Bias = it.value();
|
---|
[9652] | 732 | if (_bsx) {
|
---|
| 733 | QString obsCode = 'C' + it.key();
|
---|
| 734 | _bsx->write(epoTime.gpsw(), epoTime.gpssec(), prnStr, obsCode, it.value());
|
---|
| 735 | }
|
---|
[5503] | 736 | }
|
---|
[3222] | 737 | }
|
---|
| 738 | }
|
---|
[9354] | 739 |
|
---|
| 740 | // Phase Biases
|
---|
| 741 | // ------------
|
---|
| 742 | struct SsrCorr::PhaseBias::PhaseBiasSat* phasebiasSat = 0;
|
---|
| 743 | if (prn.system() == 'G') {
|
---|
| 744 | phasebiasSat = phasebias.Sat
|
---|
| 745 | + phasebias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 746 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
| 747 | }
|
---|
| 748 | else if (prn.system() == 'R') {
|
---|
| 749 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS
|
---|
| 750 | + phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 751 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
| 752 | }
|
---|
| 753 | else if (prn.system() == 'E') {
|
---|
| 754 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 755 | + phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 756 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
| 757 | }
|
---|
| 758 | else if (prn.system() == 'J') {
|
---|
| 759 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 760 | + CLOCKORBIT_NUMGALILEO
|
---|
| 761 | + phasebias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 762 | ++phasebias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
| 763 | }
|
---|
| 764 | else if (prn.system() == 'S') {
|
---|
| 765 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 766 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 767 | + phasebias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 768 | ++phasebias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
| 769 | }
|
---|
| 770 | else if (prn.system() == 'C') {
|
---|
| 771 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
| 772 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
| 773 | + CLOCKORBIT_NUMSBAS
|
---|
| 774 | + phasebias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 775 | ++phasebias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
| 776 | }
|
---|
| 777 |
|
---|
| 778 | if (phasebiasSat && _phaseBiasInformationDecoded) {
|
---|
| 779 | phasebias.DispersiveBiasConsistencyIndicator = dispersiveBiasConsistenyIndicator;
|
---|
| 780 | phasebias.MWConsistencyIndicator = mwConsistencyIndicator;
|
---|
| 781 | phasebiasSat->ID = prn.number();
|
---|
| 782 | phasebiasSat->NumberOfPhaseBiases = 0;
|
---|
| 783 | phasebiasSat->YawAngle = pbSat.yawAngle;
|
---|
| 784 | phasebiasSat->YawRate = pbSat.yawRate;
|
---|
| 785 | QListIterator<phaseBiasSignal> it(phaseBiasList);
|
---|
| 786 | while (it.hasNext()) {
|
---|
| 787 | const phaseBiasSignal &pbSig = it.next();
|
---|
| 788 | int ii = phasebiasSat->NumberOfPhaseBiases;
|
---|
| 789 | if (ii >= CLOCKORBIT_NUMBIAS)
|
---|
| 790 | break;
|
---|
| 791 | SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), pbSig.type.toStdString());
|
---|
| 792 | if (type != _ssrCorr->RESERVED) {
|
---|
| 793 | phasebiasSat->NumberOfPhaseBiases += 1;
|
---|
| 794 | phasebiasSat->Biases[ii].Type = type;
|
---|
| 795 | phasebiasSat->Biases[ii].Bias = pbSig.bias;
|
---|
| 796 | phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
|
---|
| 797 | phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
|
---|
| 798 | phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
|
---|
[9652] | 799 | if (_bsx) {
|
---|
| 800 | QString obsCode = 'L' + pbSig.type;
|
---|
| 801 | _bsx->write(epoTime.gpsw(), epoTime.gpssec(), prnStr, obsCode, pbSig.bias);
|
---|
| 802 | }
|
---|
[9354] | 803 | }
|
---|
| 804 | }
|
---|
| 805 | }
|
---|
[3222] | 806 | }
|
---|
| 807 | }
|
---|
[3227] | 808 |
|
---|
[5662] | 809 | QByteArray hlpBufferCo;
|
---|
[3493] | 810 |
|
---|
| 811 | // Orbit and Clock Corrections together
|
---|
| 812 | // ------------------------------------
|
---|
[9275] | 813 | if (_samplRtcmEphCorr == _samplRtcmClkCorr) {
|
---|
[6877] | 814 | if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
| 815 | || co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
| 816 | || co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
| 817 | || co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
| 818 | || co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
| 819 | || co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
[9189] | 820 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[9025] | 821 | int len = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
[3493] | 822 | if (len > 0) {
|
---|
| 823 | hlpBufferCo = QByteArray(obuffer, len);
|
---|
| 824 | }
|
---|
[3222] | 825 | }
|
---|
| 826 | }
|
---|
[3493] | 827 |
|
---|
| 828 | // Orbit and Clock Corrections separately
|
---|
| 829 | // --------------------------------------
|
---|
| 830 | else {
|
---|
[5666] | 831 | if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
|
---|
[9189] | 832 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[4174] | 833 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
[4754] | 834 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 835 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSORBIT, 1, obuffer,
|
---|
[6877] | 836 | sizeof(obuffer));
|
---|
[4754] | 837 | co.UpdateInterval = clkUpdInd;
|
---|
[3493] | 838 | if (len1 > 0) {
|
---|
| 839 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 840 | }
|
---|
| 841 | }
|
---|
[8808] | 842 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 ||
|
---|
| 843 | co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 ||
|
---|
| 844 | co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
| 845 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 846 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 847 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSCLOCK, mmsg, obuffer,
|
---|
[6877] | 848 | sizeof(obuffer));
|
---|
[3493] | 849 | if (len2 > 0) {
|
---|
| 850 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 851 | }
|
---|
| 852 | }
|
---|
[5666] | 853 | if (co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
|
---|
[9189] | 854 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[4174] | 855 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
[4754] | 856 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 857 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSORBIT, 1, obuffer,
|
---|
[6877] | 858 | sizeof(obuffer));
|
---|
[4754] | 859 | co.UpdateInterval = clkUpdInd;
|
---|
[3493] | 860 | if (len1 > 0) {
|
---|
| 861 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 862 | }
|
---|
| 863 | }
|
---|
[8808] | 864 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 ||
|
---|
| 865 | co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
| 866 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 867 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 868 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSCLOCK, mmsg, obuffer,
|
---|
[6877] | 869 | sizeof(obuffer));
|
---|
[3493] | 870 | if (len2 > 0) {
|
---|
| 871 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 872 | }
|
---|
| 873 | }
|
---|
[6844] | 874 | if (co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0) {
|
---|
[9189] | 875 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[6844] | 876 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 877 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 878 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOORBIT, 1, obuffer,
|
---|
[6877] | 879 | sizeof(obuffer));
|
---|
[6844] | 880 | co.UpdateInterval = clkUpdInd;
|
---|
| 881 | if (len1 > 0) {
|
---|
| 882 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 883 | }
|
---|
| 884 | }
|
---|
[8808] | 885 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
| 886 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 887 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 888 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOCLOCK, mmsg, obuffer,
|
---|
[6877] | 889 | sizeof(obuffer));
|
---|
[6844] | 890 | if (len2 > 0) {
|
---|
| 891 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 892 | }
|
---|
| 893 | }
|
---|
| 894 | if (co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0) {
|
---|
[9189] | 895 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[6844] | 896 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 897 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 898 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSORBIT, 1, obuffer,
|
---|
[6877] | 899 | sizeof(obuffer));
|
---|
[6844] | 900 | co.UpdateInterval = clkUpdInd;
|
---|
| 901 | if (len1 > 0) {
|
---|
| 902 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 903 | }
|
---|
| 904 | }
|
---|
[8808] | 905 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
| 906 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
[9025] | 907 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSCLOCK, mmsg, obuffer,
|
---|
[6877] | 908 | sizeof(obuffer));
|
---|
[6844] | 909 | if (len2 > 0) {
|
---|
| 910 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 911 | }
|
---|
| 912 | }
|
---|
| 913 | if (co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0) {
|
---|
[9189] | 914 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[6844] | 915 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 916 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 917 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASORBIT, 1, obuffer,
|
---|
[6877] | 918 | sizeof(obuffer));
|
---|
[6844] | 919 | co.UpdateInterval = clkUpdInd;
|
---|
| 920 | if (len1 > 0) {
|
---|
| 921 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 922 | }
|
---|
| 923 | }
|
---|
| 924 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) ? 1 : 0;
|
---|
[9025] | 925 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASCLOCK, mmsg, obuffer,
|
---|
[6877] | 926 | sizeof(obuffer));
|
---|
[6844] | 927 | if (len2 > 0) {
|
---|
| 928 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 929 | }
|
---|
| 930 | }
|
---|
| 931 | if (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
[9189] | 932 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[6844] | 933 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 934 | co.UpdateInterval = ephUpdInd;
|
---|
[9025] | 935 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSORBIT, 1, obuffer,
|
---|
[6877] | 936 | sizeof(obuffer));
|
---|
[6844] | 937 | co.UpdateInterval = clkUpdInd;
|
---|
| 938 | if (len1 > 0) {
|
---|
| 939 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
| 940 | }
|
---|
| 941 | }
|
---|
[8808] | 942 | int mmsg = 0;
|
---|
[9025] | 943 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSCLOCK, mmsg, obuffer,
|
---|
[6877] | 944 | sizeof(obuffer));
|
---|
[6844] | 945 | if (len2 > 0) {
|
---|
| 946 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
| 947 | }
|
---|
| 948 | }
|
---|
[3493] | 949 | }
|
---|
[5662] | 950 |
|
---|
[6850] | 951 | // Code Biases
|
---|
| 952 | // -----------
|
---|
[5662] | 953 | QByteArray hlpBufferBias;
|
---|
[6877] | 954 | if (bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
| 955 | || bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
| 956 | || bias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
| 957 | || bias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
| 958 | || bias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
| 959 | || bias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
[9189] | 960 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[9140] | 961 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 962 | int len = _ssrCorr->MakeCodeBias(&bias, _ssrCorr->CBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
| 963 | if (len > 0) {
|
---|
| 964 | hlpBufferBias = QByteArray(obuffer, len);
|
---|
| 965 | }
|
---|
[3222] | 966 | }
|
---|
| 967 | }
|
---|
[3227] | 968 |
|
---|
[6850] | 969 | // Phase Biases
|
---|
| 970 | // ------------
|
---|
| 971 | QByteArray hlpBufferPhaseBias;
|
---|
[9128] | 972 | if ((phasebias.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
[6877] | 973 | || phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
| 974 | || phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
| 975 | || phasebias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
| 976 | || phasebias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
[9129] | 977 | || phasebias.NumberOfSat[CLOCKORBIT_SATBDS] > 0)
|
---|
| 978 | && (_phaseBiasInformationDecoded)) {
|
---|
[9189] | 979 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[9140] | 980 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
| 981 | int len = _ssrCorr->MakePhaseBias(&phasebias, _ssrCorr->PBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
| 982 | if (len > 0) {
|
---|
| 983 | hlpBufferPhaseBias = QByteArray(obuffer, len);
|
---|
| 984 | }
|
---|
[6850] | 985 | }
|
---|
| 986 | }
|
---|
| 987 |
|
---|
| 988 | // VTEC
|
---|
| 989 | // ----
|
---|
| 990 | QByteArray hlpBufferVtec;
|
---|
[6860] | 991 | if (vtec.NumLayers > 0) {
|
---|
[9189] | 992 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
[9025] | 993 | int len = _ssrCorr->MakeVTEC(&vtec, 0, obuffer, sizeof(obuffer));
|
---|
[6860] | 994 | if (len > 0) {
|
---|
| 995 | hlpBufferVtec = QByteArray(obuffer, len);
|
---|
| 996 | }
|
---|
| 997 | }
|
---|
[6850] | 998 |
|
---|
[6877] | 999 | _outBuffer += hlpBufferCo + hlpBufferBias + hlpBufferPhaseBias
|
---|
[9203] | 1000 | + hlpBufferVtec + '\0';
|
---|
[3222] | 1001 | }
|
---|
| 1002 |
|
---|
[5662] | 1003 | //
|
---|
[3222] | 1004 | ////////////////////////////////////////////////////////////////////////////
|
---|
[8542] | 1005 | t_irc bncRtnetUploadCaster::processSatellite(const t_eph* eph, int GPSweek,
|
---|
[6877] | 1006 | double GPSweeks, const QString& prn, const ColumnVector& rtnAPC,
|
---|
[8483] | 1007 | double rtnUra, const ColumnVector& rtnClk, const ColumnVector& rtnVel,
|
---|
| 1008 | const ColumnVector& rtnCoM, const ColumnVector& rtnClkSig,
|
---|
[9025] | 1009 | struct SsrCorr::ClockOrbit::SatData* sd, QString& outLine) {
|
---|
[3222] | 1010 |
|
---|
[4930] | 1011 | // Broadcast Position and Velocity
|
---|
| 1012 | // -------------------------------
|
---|
[8542] | 1013 | ColumnVector xB(6);
|
---|
[4930] | 1014 | ColumnVector vB(3);
|
---|
[8542] | 1015 | t_irc irc = eph->getCrd(bncTime(GPSweek, GPSweeks), xB, vB, false);
|
---|
[5662] | 1016 |
|
---|
[8542] | 1017 | if (irc != success) {
|
---|
| 1018 | return irc;
|
---|
| 1019 | }
|
---|
| 1020 |
|
---|
[4991] | 1021 | // Precise Position
|
---|
| 1022 | // ----------------
|
---|
| 1023 | ColumnVector xP = _CoM ? rtnCoM : rtnAPC;
|
---|
[3222] | 1024 |
|
---|
[8542] | 1025 | if (xP.size() == 0) {
|
---|
| 1026 | return failure;
|
---|
| 1027 | }
|
---|
| 1028 |
|
---|
[5662] | 1029 | double dc = 0.0;
|
---|
[8405] | 1030 | if (_crdTrafo != "IGS14") {
|
---|
[8145] | 1031 | crdTrafo(GPSweek, xP, dc);
|
---|
[8094] | 1032 | }
|
---|
[5662] | 1033 |
|
---|
[4930] | 1034 | // Difference in xyz
|
---|
| 1035 | // -----------------
|
---|
[6877] | 1036 | ColumnVector dx = xB.Rows(1, 3) - xP;
|
---|
| 1037 | ColumnVector dv = vB - rtnVel;
|
---|
[5662] | 1038 |
|
---|
[4930] | 1039 | // Difference in RSW
|
---|
| 1040 | // -----------------
|
---|
[3222] | 1041 | ColumnVector rsw(3);
|
---|
[6877] | 1042 | XYZ_to_RSW(xB.Rows(1, 3), vB, dx, rsw);
|
---|
[3222] | 1043 |
|
---|
[4930] | 1044 | ColumnVector dotRsw(3);
|
---|
[6877] | 1045 | XYZ_to_RSW(xB.Rows(1, 3), vB, dv, dotRsw);
|
---|
[3222] | 1046 |
|
---|
[4930] | 1047 | // Clock Correction
|
---|
| 1048 | // ----------------
|
---|
[8499] | 1049 | double dClkA0 = rtnClk(1) - (xB(4) - dc) * t_CST::c;
|
---|
[8679] | 1050 | double dClkA1 = 0.0;
|
---|
| 1051 | if (rtnClk(2)) {
|
---|
[9126] | 1052 | dClkA1 = rtnClk(2) - xB(5) * t_CST::c;
|
---|
[8679] | 1053 | }
|
---|
| 1054 | double dClkA2 = 0.0;
|
---|
| 1055 | if (rtnClk(3)) {
|
---|
[9126] | 1056 | dClkA2 = rtnClk(3) - xB(6) * t_CST::c;
|
---|
[8679] | 1057 | }
|
---|
[3222] | 1058 |
|
---|
| 1059 | if (sd) {
|
---|
[6877] | 1060 | sd->ID = prn.mid(1).toInt();
|
---|
| 1061 | sd->IOD = eph->IOD();
|
---|
[8483] | 1062 | sd->Clock.DeltaA0 = dClkA0;
|
---|
| 1063 | sd->Clock.DeltaA1 = dClkA1;
|
---|
| 1064 | sd->Clock.DeltaA2 = dClkA2;
|
---|
| 1065 | sd->UserRangeAccuracy = rtnUra;
|
---|
| 1066 | sd->Orbit.DeltaRadial = rsw(1);
|
---|
[6877] | 1067 | sd->Orbit.DeltaAlongTrack = rsw(2);
|
---|
| 1068 | sd->Orbit.DeltaCrossTrack = rsw(3);
|
---|
[8483] | 1069 | sd->Orbit.DotDeltaRadial = dotRsw(1);
|
---|
[4930] | 1070 | sd->Orbit.DotDeltaAlongTrack = dotRsw(2);
|
---|
| 1071 | sd->Orbit.DotDeltaCrossTrack = dotRsw(3);
|
---|
[9179] | 1072 |
|
---|
| 1073 | if (corrIsOutOfRange(sd)) {
|
---|
| 1074 | return failure;
|
---|
| 1075 | }
|
---|
[3222] | 1076 | }
|
---|
| 1077 |
|
---|
[9675] | 1078 | outLine = QString().asprintf("%d %.1f %s %u %10.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", GPSweek,
|
---|
[8483] | 1079 | GPSweeks, eph->prn().toString().c_str(), eph->IOD(), dClkA0, dClkA1, dClkA2,
|
---|
[9179] | 1080 | rsw(1), rsw(2), rsw(3)); //fprintf(stderr, "%s\n", outLine.toStdString().c_str());
|
---|
[3222] | 1081 |
|
---|
[8499] | 1082 | // RTNET full clock for RINEX and SP3 file
|
---|
| 1083 | // ---------------------------------------
|
---|
[4991] | 1084 | double relativity = -2.0 * DotProduct(xP, rtnVel) / t_CST::c;
|
---|
[8499] | 1085 | double clkRnx = (rtnClk[0] - relativity) / t_CST::c; // [s]
|
---|
[8483] | 1086 | double clkRnxRate = rtnClk[1] / t_CST::c; // [s/s = -]
|
---|
| 1087 | double clkRnxAcc = rtnClk[2] / t_CST::c; // [s/s² ) -/s]
|
---|
[4991] | 1088 |
|
---|
[3222] | 1089 | if (_rnx) {
|
---|
[8510] | 1090 | double clkRnxSig, clkRnxRateSig, clkRnxAccSig;
|
---|
| 1091 | int s = rtnClkSig.size();
|
---|
| 1092 | switch (s) {
|
---|
| 1093 | case 1:
|
---|
| 1094 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
| 1095 | clkRnxRateSig = 0.0; // [s/s = -]
|
---|
| 1096 | clkRnxAccSig = 0.0; // [s/s² ) -/s]
|
---|
| 1097 | break;
|
---|
| 1098 | case 2:
|
---|
| 1099 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
| 1100 | clkRnxRateSig = rtnClkSig[1] / t_CST::c; // [s/s = -]
|
---|
| 1101 | clkRnxAccSig = 0.0; // [s/s² ) -/s]
|
---|
| 1102 | break;
|
---|
| 1103 | case 3:
|
---|
| 1104 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
| 1105 | clkRnxRateSig = rtnClkSig[1] / t_CST::c; // [s/s = -]
|
---|
| 1106 | clkRnxAccSig = rtnClkSig[2] / t_CST::c; // [s/s² ) -/s]
|
---|
| 1107 | break;
|
---|
| 1108 | }
|
---|
[8483] | 1109 | _rnx->write(GPSweek, GPSweeks, prn, clkRnx, clkRnxRate, clkRnxAcc,
|
---|
| 1110 | clkRnxSig, clkRnxRateSig, clkRnxAccSig);
|
---|
[3222] | 1111 | }
|
---|
| 1112 | if (_sp3) {
|
---|
[8483] | 1113 | _sp3->write(GPSweek, GPSweeks, prn, rtnCoM, clkRnx, rtnVel, clkRnxRate);
|
---|
[3222] | 1114 | }
|
---|
[8542] | 1115 | return success;
|
---|
[3222] | 1116 | }
|
---|
| 1117 |
|
---|
| 1118 | // Transform Coordinates
|
---|
| 1119 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5662] | 1120 | void bncRtnetUploadCaster::crdTrafo(int GPSWeek, ColumnVector& xyz,
|
---|
[6877] | 1121 | double& dc) {
|
---|
[3222] | 1122 |
|
---|
| 1123 | // Current epoch minus 2000.0 in years
|
---|
| 1124 | // ------------------------------------
|
---|
[6877] | 1125 | double dt = (GPSWeek - (1042.0 + 6.0 / 7.0)) / 365.2422 * 7.0 + 2000.0 - _t0;
|
---|
[3222] | 1126 |
|
---|
| 1127 | ColumnVector dx(3);
|
---|
| 1128 |
|
---|
| 1129 | dx(1) = _dx + dt * _dxr;
|
---|
| 1130 | dx(2) = _dy + dt * _dyr;
|
---|
| 1131 | dx(3) = _dz + dt * _dzr;
|
---|
| 1132 |
|
---|
| 1133 | static const double arcSec = 180.0 * 3600.0 / M_PI;
|
---|
| 1134 |
|
---|
| 1135 | double ox = (_ox + dt * _oxr) / arcSec;
|
---|
| 1136 | double oy = (_oy + dt * _oyr) / arcSec;
|
---|
| 1137 | double oz = (_oz + dt * _ozr) / arcSec;
|
---|
| 1138 |
|
---|
| 1139 | double sc = 1.0 + _sc * 1e-9 + dt * _scr * 1e-9;
|
---|
| 1140 |
|
---|
[4912] | 1141 | // Specify approximate center of area
|
---|
| 1142 | // ----------------------------------
|
---|
| 1143 | ColumnVector meanSta(3);
|
---|
| 1144 |
|
---|
[6877] | 1145 | if (_crdTrafo == "ETRF2000") {
|
---|
| 1146 | meanSta(1) = 3661090.0;
|
---|
| 1147 | meanSta(2) = 845230.0;
|
---|
| 1148 | meanSta(3) = 5136850.0;
|
---|
[4908] | 1149 | }
|
---|
[8094] | 1150 | else if (_crdTrafo == "GDA2020") {
|
---|
[4973] | 1151 | meanSta(1) = -4052050.0;
|
---|
[6877] | 1152 | meanSta(2) = 4212840.0;
|
---|
[4973] | 1153 | meanSta(3) = -2545110.0;
|
---|
[4912] | 1154 | }
|
---|
| 1155 | else if (_crdTrafo == "SIRGAS2000") {
|
---|
[6877] | 1156 | meanSta(1) = 3740860.0;
|
---|
[4973] | 1157 | meanSta(2) = -4964290.0;
|
---|
| 1158 | meanSta(3) = -1425420.0;
|
---|
[4912] | 1159 | }
|
---|
[5343] | 1160 | else if (_crdTrafo == "DREF91") {
|
---|
[6877] | 1161 | meanSta(1) = 3959579.0;
|
---|
| 1162 | meanSta(2) = 721719.0;
|
---|
| 1163 | meanSta(3) = 4931539.0;
|
---|
[5343] | 1164 | }
|
---|
[4912] | 1165 | else if (_crdTrafo == "Custom") {
|
---|
[6877] | 1166 | meanSta(1) = 0.0; // TODO
|
---|
| 1167 | meanSta(2) = 0.0; // TODO
|
---|
| 1168 | meanSta(3) = 0.0; // TODO
|
---|
[4912] | 1169 | }
|
---|
[4908] | 1170 |
|
---|
[4912] | 1171 | // Clock correction proportional to topocentric distance to satellites
|
---|
| 1172 | // -------------------------------------------------------------------
|
---|
[8904] | 1173 | double rho = (xyz - meanSta).NormFrobenius();
|
---|
[4913] | 1174 | dc = rho * (sc - 1.0) / sc / t_CST::c;
|
---|
[4908] | 1175 |
|
---|
[6877] | 1176 | Matrix rMat(3, 3);
|
---|
| 1177 | rMat(1, 1) = 1.0;
|
---|
| 1178 | rMat(1, 2) = -oz;
|
---|
| 1179 | rMat(1, 3) = oy;
|
---|
| 1180 | rMat(2, 1) = oz;
|
---|
| 1181 | rMat(2, 2) = 1.0;
|
---|
| 1182 | rMat(2, 3) = -ox;
|
---|
| 1183 | rMat(3, 1) = -oy;
|
---|
| 1184 | rMat(3, 2) = ox;
|
---|
| 1185 | rMat(3, 3) = 1.0;
|
---|
[3222] | 1186 |
|
---|
| 1187 | xyz = sc * rMat * xyz + dx;
|
---|
| 1188 | }
|
---|
| 1189 |
|
---|
[6557] | 1190 | int bncRtnetUploadCaster::determineUpdateInd(double samplingRate) {
|
---|
| 1191 |
|
---|
| 1192 | if (samplingRate == 10.0) {
|
---|
| 1193 | return 3;
|
---|
| 1194 | }
|
---|
| 1195 | else if (samplingRate == 15.0) {
|
---|
| 1196 | return 4;
|
---|
| 1197 | }
|
---|
| 1198 | else if (samplingRate == 30.0) {
|
---|
| 1199 | return 5;
|
---|
| 1200 | }
|
---|
| 1201 | else if (samplingRate == 60.0) {
|
---|
| 1202 | return 6;
|
---|
| 1203 | }
|
---|
| 1204 | else if (samplingRate == 120.0) {
|
---|
| 1205 | return 7;
|
---|
| 1206 | }
|
---|
| 1207 | else if (samplingRate == 240.0) {
|
---|
| 1208 | return 8;
|
---|
| 1209 | }
|
---|
| 1210 | else if (samplingRate == 300.0) {
|
---|
| 1211 | return 9;
|
---|
| 1212 | }
|
---|
| 1213 | else if (samplingRate == 600.0) {
|
---|
| 1214 | return 10;
|
---|
| 1215 | }
|
---|
| 1216 | else if (samplingRate == 900.0) {
|
---|
| 1217 | return 11;
|
---|
| 1218 | }
|
---|
| 1219 | else if (samplingRate == 1800.0) {
|
---|
| 1220 | return 12;
|
---|
| 1221 | }
|
---|
| 1222 | else if (samplingRate == 3600.0) {
|
---|
| 1223 | return 13;
|
---|
| 1224 | }
|
---|
| 1225 | else if (samplingRate == 7200.0) {
|
---|
| 1226 | return 14;
|
---|
| 1227 | }
|
---|
| 1228 | else if (samplingRate == 10800.0) {
|
---|
| 1229 | return 15;
|
---|
| 1230 | }
|
---|
[6877] | 1231 | return 2; // default
|
---|
[6557] | 1232 | }
|
---|
[9179] | 1233 |
|
---|
| 1234 | bool bncRtnetUploadCaster::corrIsOutOfRange(struct SsrCorr::ClockOrbit::SatData* sd) {
|
---|
| 1235 |
|
---|
| 1236 | if (fabs(sd->Clock.DeltaA0) > 209.7151) {return true;}
|
---|
| 1237 | if (fabs(sd->Clock.DeltaA1) > 1.048575) {return true;}
|
---|
| 1238 | if (fabs(sd->Clock.DeltaA2) > 1.34217726) {return true;}
|
---|
| 1239 |
|
---|
| 1240 | if (fabs(sd->Orbit.DeltaRadial) > 209.7151) {return true;}
|
---|
| 1241 | if (fabs(sd->Orbit.DeltaAlongTrack) > 209.7148) {return true;}
|
---|
| 1242 | if (fabs(sd->Orbit.DeltaCrossTrack) > 209.7148) {return true;}
|
---|
| 1243 |
|
---|
| 1244 | if (fabs(sd->Orbit.DotDeltaRadial) > 1.048575) {return true;}
|
---|
| 1245 | if (fabs(sd->Orbit.DotDeltaAlongTrack) > 1.048572) {return true;}
|
---|
| 1246 | if (fabs(sd->Orbit.DotDeltaCrossTrack) > 1.048572) {return true;}
|
---|
| 1247 | return false;
|
---|
[9275] | 1248 | }
|
---|