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