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