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