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