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