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