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