[1025] | 1 | #include <sstream>
|
---|
[2234] | 2 | #include <iostream>
|
---|
[1025] | 3 | #include <iomanip>
|
---|
[1239] | 4 | #include <cstring>
|
---|
[1025] | 5 |
|
---|
[2234] | 6 | #include <newmatio.h>
|
---|
| 7 |
|
---|
[1025] | 8 | #include "ephemeris.h"
|
---|
[2221] | 9 | #include "bncutils.h"
|
---|
[2285] | 10 | #include "bnctime.h"
|
---|
[5070] | 11 | #include "bnccore.h"
|
---|
[5839] | 12 | #include "bncutils.h"
|
---|
[6141] | 13 | #include "satObs.h"
|
---|
[6044] | 14 | #include "pppInclude.h"
|
---|
[6400] | 15 | #include "pppModel.h"
|
---|
[1025] | 16 |
|
---|
| 17 | using namespace std;
|
---|
| 18 |
|
---|
[5749] | 19 | // Constructor
|
---|
| 20 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 21 | t_eph::t_eph() {
|
---|
[6518] | 22 | _checkState = unchecked;
|
---|
[9765] | 23 | _navType = undefined;
|
---|
[6518] | 24 | _orbCorr = 0;
|
---|
| 25 | _clkCorr = 0;
|
---|
[5749] | 26 | }
|
---|
[7278] | 27 | // Destructor
|
---|
| 28 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 29 | t_eph::~t_eph() {
|
---|
| 30 | if (_orbCorr)
|
---|
| 31 | delete _orbCorr;
|
---|
| 32 | if (_clkCorr)
|
---|
| 33 | delete _clkCorr;
|
---|
| 34 | }
|
---|
[5749] | 35 |
|
---|
[7481] | 36 | //
|
---|
[5749] | 37 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6141] | 38 | void t_eph::setOrbCorr(const t_orbCorr* orbCorr) {
|
---|
[7888] | 39 | if (_orbCorr) {
|
---|
| 40 | delete _orbCorr;
|
---|
| 41 | _orbCorr = 0;
|
---|
| 42 | }
|
---|
[6141] | 43 | _orbCorr = new t_orbCorr(*orbCorr);
|
---|
[5749] | 44 | }
|
---|
| 45 |
|
---|
[7481] | 46 | //
|
---|
[5749] | 47 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6141] | 48 | void t_eph::setClkCorr(const t_clkCorr* clkCorr) {
|
---|
[7888] | 49 | if (_clkCorr) {
|
---|
| 50 | delete _clkCorr;
|
---|
| 51 | _clkCorr = 0;
|
---|
| 52 | }
|
---|
[6141] | 53 | _clkCorr = new t_clkCorr(*clkCorr);
|
---|
[5749] | 54 | }
|
---|
| 55 |
|
---|
[7481] | 56 | //
|
---|
[5749] | 57 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6109] | 58 | t_irc t_eph::getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const {
|
---|
[6518] | 59 |
|
---|
[8419] | 60 | if (_checkState == bad ||
|
---|
[8618] | 61 | _checkState == unhealthy ||
|
---|
| 62 | _checkState == outdated) {
|
---|
[6518] | 63 | return failure;
|
---|
| 64 | }
|
---|
[8903] | 65 |
|
---|
[8542] | 66 | xc.ReSize(6);
|
---|
[5749] | 67 | vv.ReSize(3);
|
---|
[6213] | 68 | if (position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data()) != success) {
|
---|
| 69 | return failure;
|
---|
| 70 | }
|
---|
[5789] | 71 | if (useCorr) {
|
---|
[5839] | 72 | if (_orbCorr && _clkCorr) {
|
---|
[5849] | 73 | double dtO = tt - _orbCorr->_time;
|
---|
[6556] | 74 | if (_orbCorr->_updateInt) {
|
---|
[8903] | 75 | dtO -= (0.5 * ssrUpdateInt[_orbCorr->_updateInt]);
|
---|
[6556] | 76 | }
|
---|
[5839] | 77 | ColumnVector dx(3);
|
---|
[5849] | 78 | dx[0] = _orbCorr->_xr[0] + _orbCorr->_dotXr[0] * dtO;
|
---|
| 79 | dx[1] = _orbCorr->_xr[1] + _orbCorr->_dotXr[1] * dtO;
|
---|
| 80 | dx[2] = _orbCorr->_xr[2] + _orbCorr->_dotXr[2] * dtO;
|
---|
| 81 |
|
---|
[7133] | 82 | RSW_to_XYZ(xc.Rows(1,3), vv.Rows(1,3), dx, dx);
|
---|
[5849] | 83 |
|
---|
[5839] | 84 | xc[0] -= dx[0];
|
---|
| 85 | xc[1] -= dx[1];
|
---|
| 86 | xc[2] -= dx[2];
|
---|
[5849] | 87 |
|
---|
[7133] | 88 | ColumnVector dv(3);
|
---|
| 89 | RSW_to_XYZ(xc.Rows(1,3), vv.Rows(1,3), _orbCorr->_dotXr, dv);
|
---|
| 90 |
|
---|
| 91 | vv[0] -= dv[0];
|
---|
| 92 | vv[1] -= dv[1];
|
---|
| 93 | vv[2] -= dv[2];
|
---|
| 94 |
|
---|
[5849] | 95 | double dtC = tt - _clkCorr->_time;
|
---|
[6556] | 96 | if (_clkCorr->_updateInt) {
|
---|
[8903] | 97 | dtC -= (0.5 * ssrUpdateInt[_clkCorr->_updateInt]);
|
---|
[6556] | 98 | }
|
---|
[7014] | 99 | xc[3] += _clkCorr->_dClk + _clkCorr->_dotDClk * dtC + _clkCorr->_dotDotDClk * dtC * dtC;
|
---|
[5839] | 100 | }
|
---|
| 101 | else {
|
---|
| 102 | return failure;
|
---|
| 103 | }
|
---|
[5749] | 104 | }
|
---|
| 105 | return success;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[9765] | 108 |
|
---|
[6801] | 109 | //
|
---|
| 110 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9765] | 111 | t_irc t_eph::setNavType(QString navTypeStr) {
|
---|
| 112 | if (navTypeStr == "LNAV") {_navType = t_eph::LNAV;}
|
---|
| 113 | else if (navTypeStr == "FDMA") {_navType = t_eph::FDMA;}
|
---|
| 114 | else if (navTypeStr == "FNAV") {_navType = t_eph::FNAV;}
|
---|
| 115 | else if (navTypeStr == "INAF") {_navType = t_eph::INAF;}
|
---|
| 116 | else if (navTypeStr == "D1") {_navType = t_eph::D1;}
|
---|
| 117 | else if (navTypeStr == "D2") {_navType = t_eph::D2;}
|
---|
| 118 | else if (navTypeStr == "SBAS") {_navType = t_eph::SBASL1;}
|
---|
| 119 | else if (navTypeStr == "CNAV") {_navType = t_eph::CNAV;}
|
---|
| 120 | else if (navTypeStr == "CNV1") {_navType = t_eph::CNV1;}
|
---|
| 121 | else if (navTypeStr == "CNV2") {_navType = t_eph::CNV2;}
|
---|
| 122 | else if (navTypeStr == "CNV3") {_navType = t_eph::CNV3;}
|
---|
| 123 | else {_navType = t_eph::undefined; return failure;}
|
---|
| 124 |
|
---|
| 125 | return success;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | //
|
---|
| 129 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 130 | QString t_eph::navTypeString(e_navType navType, const t_prn& prn, double version) {
|
---|
| 131 | QString navTypeString = "";
|
---|
| 132 | QString epochStart;
|
---|
| 133 | QString eolStr;
|
---|
| 134 |
|
---|
| 135 | if (version < 4.0) {
|
---|
| 136 | return navTypeString;
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | if (version == 99.0) {
|
---|
| 140 | epochStart = "";
|
---|
| 141 | eolStr = "";
|
---|
| 142 | }
|
---|
| 143 | else {
|
---|
| 144 | epochStart = "> ";
|
---|
| 145 | eolStr = "\n";
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | QString ephStr = QString("EPH %1 ").arg(prn.toString().c_str());
|
---|
| 149 | switch (navType) {
|
---|
| 150 | case undefined:
|
---|
| 151 | navTypeString = epochStart + ephStr + "unknown" + eolStr;
|
---|
| 152 | break;
|
---|
| 153 | case LNAV:
|
---|
| 154 | navTypeString = epochStart + ephStr + "LNAV" + eolStr;
|
---|
| 155 | break;
|
---|
| 156 | case FDMA:
|
---|
| 157 | navTypeString = epochStart + ephStr + "FDMA" + eolStr;
|
---|
| 158 | break;
|
---|
| 159 | case FNAV:
|
---|
| 160 | navTypeString = epochStart + ephStr + "FNAV" + eolStr;
|
---|
| 161 | break;
|
---|
| 162 | case INAF:
|
---|
| 163 | navTypeString = epochStart + ephStr + "INAV" + eolStr;
|
---|
| 164 | break;
|
---|
| 165 | case D1:
|
---|
[9774] | 166 | navTypeString = epochStart + ephStr + "D1 " + eolStr;
|
---|
[9765] | 167 | break;
|
---|
| 168 | case D2:
|
---|
[9774] | 169 | navTypeString = epochStart + ephStr + "D2 " + eolStr;
|
---|
[9765] | 170 | break;
|
---|
| 171 | case SBASL1:
|
---|
| 172 | navTypeString = epochStart + ephStr + "SBAS" + eolStr;
|
---|
| 173 | break;
|
---|
| 174 | case CNAV:
|
---|
| 175 | navTypeString = epochStart + ephStr + "CNAV" + eolStr;
|
---|
| 176 | break;
|
---|
| 177 | case CNV1:
|
---|
| 178 | navTypeString = epochStart + ephStr + "CNV1" + eolStr;
|
---|
| 179 | break;
|
---|
| 180 | case CNV2:
|
---|
| 181 | navTypeString = epochStart + ephStr + "CNV2" + eolStr;
|
---|
| 182 | break;
|
---|
| 183 | case CNV3:
|
---|
| 184 | navTypeString = epochStart + ephStr + "CNV3" + eolStr;
|
---|
| 185 | break;
|
---|
| 186 | }
|
---|
| 187 | return navTypeString;
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | //
|
---|
| 191 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6801] | 192 | QString t_eph::rinexDateStr(const bncTime& tt, const t_prn& prn, double version) {
|
---|
| 193 | QString prnStr(prn.toString().c_str());
|
---|
| 194 | return rinexDateStr(tt, prnStr, version);
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | //
|
---|
| 198 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 199 | QString t_eph::rinexDateStr(const bncTime& tt, const QString& prnStr, double version) {
|
---|
| 200 |
|
---|
| 201 | QString datStr;
|
---|
| 202 |
|
---|
| 203 | unsigned year, month, day, hour, min;
|
---|
| 204 | double sec;
|
---|
| 205 | tt.civil_date(year, month, day);
|
---|
| 206 | tt.civil_time(hour, min, sec);
|
---|
| 207 |
|
---|
| 208 | QTextStream out(&datStr);
|
---|
| 209 |
|
---|
| 210 | if (version < 3.0) {
|
---|
| 211 | QString prnHlp = prnStr.mid(1,2); if (prnHlp[0] == '0') prnHlp[0] = ' ';
|
---|
| 212 | out << prnHlp << QString(" %1 %2 %3 %4 %5%6")
|
---|
| 213 | .arg(year % 100, 2, 10, QChar('0'))
|
---|
| 214 | .arg(month, 2)
|
---|
| 215 | .arg(day, 2)
|
---|
| 216 | .arg(hour, 2)
|
---|
| 217 | .arg(min, 2)
|
---|
| 218 | .arg(sec, 5, 'f',1);
|
---|
| 219 | }
|
---|
[9765] | 220 | else if (version == 99) {
|
---|
| 221 | out << QString(" %1 %2 %3 %4 %5 %6")
|
---|
| 222 | .arg(year, 4)
|
---|
| 223 | .arg(month, 2, 10, QChar('0'))
|
---|
| 224 | .arg(day, 2, 10, QChar('0'))
|
---|
| 225 | .arg(hour, 2, 10, QChar('0'))
|
---|
| 226 | .arg(min, 2, 10, QChar('0'))
|
---|
| 227 | .arg(int(sec), 2, 10, QChar('0'));
|
---|
| 228 | }
|
---|
[6801] | 229 | else {
|
---|
| 230 | out << prnStr << QString(" %1 %2 %3 %4 %5 %6")
|
---|
| 231 | .arg(year, 4)
|
---|
| 232 | .arg(month, 2, 10, QChar('0'))
|
---|
| 233 | .arg(day, 2, 10, QChar('0'))
|
---|
| 234 | .arg(hour, 2, 10, QChar('0'))
|
---|
| 235 | .arg(min, 2, 10, QChar('0'))
|
---|
| 236 | .arg(int(sec), 2, 10, QChar('0'));
|
---|
| 237 | }
|
---|
| 238 |
|
---|
| 239 | return datStr;
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | // Constructor
|
---|
| 243 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 244 | t_ephGPS::t_ephGPS(double rnxVersion, const QStringList& lines) {
|
---|
[6801] | 245 |
|
---|
[9786] | 246 | int nLines = 8;
|
---|
[6801] | 247 |
|
---|
[9786] | 248 | if (navType() == t_eph::CNAV) {
|
---|
| 249 | nLines += 1;
|
---|
| 250 | }
|
---|
[9788] | 251 | if (navType() == t_eph::CNV2) {
|
---|
[9786] | 252 | nLines += 2;
|
---|
| 253 | }
|
---|
| 254 |
|
---|
[6801] | 255 | if (lines.size() != nLines) {
|
---|
| 256 | _checkState = bad;
|
---|
| 257 | return;
|
---|
| 258 | }
|
---|
| 259 |
|
---|
| 260 | // RINEX Format
|
---|
| 261 | // ------------
|
---|
| 262 | int fieldLen = 19;
|
---|
| 263 |
|
---|
| 264 | int pos[4];
|
---|
| 265 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 266 | pos[1] = pos[0] + fieldLen;
|
---|
| 267 | pos[2] = pos[1] + fieldLen;
|
---|
| 268 | pos[3] = pos[2] + fieldLen;
|
---|
| 269 |
|
---|
| 270 | // Read eight lines
|
---|
| 271 | // ----------------
|
---|
| 272 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 273 | QString line = lines[iLine];
|
---|
| 274 |
|
---|
| 275 | if ( iLine == 0 ) {
|
---|
[8204] | 276 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6801] | 277 | int year, month, day, hour, min;
|
---|
| 278 | double sec;
|
---|
| 279 |
|
---|
[7139] | 280 | QString prnStr, n;
|
---|
[6880] | 281 | in >> prnStr;
|
---|
[7639] | 282 |
|
---|
| 283 | if (prnStr.size() == 1 &&
|
---|
[8168] | 284 | (prnStr[0] == 'G' ||
|
---|
| 285 | prnStr[0] == 'J' ||
|
---|
| 286 | prnStr[0] == 'I')) {
|
---|
[7139] | 287 | in >> n;
|
---|
| 288 | prnStr.append(n);
|
---|
[6880] | 289 | }
|
---|
[7639] | 290 |
|
---|
[6880] | 291 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6801] | 292 | if (prnStr.at(0) == 'G') {
|
---|
| 293 | _prn.set('G', prnStr.mid(1).toInt());
|
---|
| 294 | }
|
---|
| 295 | else if (prnStr.at(0) == 'J') {
|
---|
| 296 | _prn.set('J', prnStr.mid(1).toInt());
|
---|
| 297 | }
|
---|
[8168] | 298 | else if (prnStr.at(0) == 'I') {
|
---|
| 299 | _prn.set('I', prnStr.mid(1).toInt());
|
---|
| 300 | }
|
---|
[6801] | 301 | else {
|
---|
| 302 | _prn.set('G', prnStr.toInt());
|
---|
| 303 | }
|
---|
| 304 |
|
---|
| 305 | if (year < 80) {
|
---|
| 306 | year += 2000;
|
---|
| 307 | }
|
---|
| 308 | else if (year < 100) {
|
---|
| 309 | year += 1900;
|
---|
| 310 | }
|
---|
| 311 |
|
---|
| 312 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 313 |
|
---|
[9786] | 314 | if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
|
---|
[6801] | 315 | readDbl(line, pos[2], fieldLen, _clock_drift ) ||
|
---|
| 316 | readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
|
---|
| 317 | _checkState = bad;
|
---|
| 318 | return;
|
---|
| 319 | }
|
---|
| 320 | }
|
---|
[9786] | 321 | // =====================
|
---|
| 322 | // BROADCAST ORBIT - 1
|
---|
| 323 | // =====================
|
---|
| 324 | else if ( iLine == 1) {
|
---|
[6801] | 325 |
|
---|
[9786] | 326 | if (navType() == t_eph::CNAV ||
|
---|
| 327 | navType() == t_eph::CNV2) {
|
---|
| 328 | if ( readDbl(line, pos[0], fieldLen, _ADOT ) ||
|
---|
| 329 | readDbl(line, pos[1], fieldLen, _Crs ) ||
|
---|
| 330 | readDbl(line, pos[2], fieldLen, _Delta_n) ||
|
---|
| 331 | readDbl(line, pos[3], fieldLen, _M0 ) ) {
|
---|
| 332 | _checkState = bad;
|
---|
| 333 | return;
|
---|
| 334 | }
|
---|
[6801] | 335 | }
|
---|
[9786] | 336 | else { // LNAV, undefined
|
---|
| 337 | if ( readDbl(line, pos[0], fieldLen, _IODE ) ||
|
---|
| 338 | readDbl(line, pos[1], fieldLen, _Crs ) ||
|
---|
| 339 | readDbl(line, pos[2], fieldLen, _Delta_n) ||
|
---|
| 340 | readDbl(line, pos[3], fieldLen, _M0 ) ) {
|
---|
| 341 | _checkState = bad;
|
---|
| 342 | return;
|
---|
| 343 | }
|
---|
| 344 | }
|
---|
[6801] | 345 | }
|
---|
[9786] | 346 | // =====================
|
---|
| 347 | // BROADCAST ORBIT - 2
|
---|
| 348 | // =====================
|
---|
[6801] | 349 | else if ( iLine == 2 ) {
|
---|
| 350 | if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
|
---|
| 351 | readDbl(line, pos[1], fieldLen, _e ) ||
|
---|
| 352 | readDbl(line, pos[2], fieldLen, _Cus ) ||
|
---|
| 353 | readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
|
---|
| 354 | _checkState = bad;
|
---|
| 355 | return;
|
---|
| 356 | }
|
---|
| 357 | }
|
---|
[9786] | 358 | // =====================
|
---|
| 359 | // BROADCAST ORBIT - 3
|
---|
| 360 | // =====================
|
---|
| 361 | else if ( iLine == 3 ) {
|
---|
[6801] | 362 |
|
---|
[9786] | 363 | if (navType() == t_eph::CNAV ||
|
---|
| 364 | navType() == t_eph::CNV2) {
|
---|
| 365 | if ( readDbl(line, pos[0], fieldLen, _top) ||
|
---|
| 366 | readDbl(line, pos[1], fieldLen, _Cic ) ||
|
---|
| 367 | readDbl(line, pos[2], fieldLen, _OMEGA0) ||
|
---|
| 368 | readDbl(line, pos[3], fieldLen, _Cis ) ) {
|
---|
| 369 | _checkState = bad;
|
---|
| 370 | return;
|
---|
| 371 | }
|
---|
[6801] | 372 | }
|
---|
[9786] | 373 | else { // LNAV, undefined
|
---|
| 374 | if ( readDbl(line, pos[0], fieldLen, _TOEsec) ||
|
---|
| 375 | readDbl(line, pos[1], fieldLen, _Cic ) ||
|
---|
| 376 | readDbl(line, pos[2], fieldLen, _OMEGA0) ||
|
---|
| 377 | readDbl(line, pos[3], fieldLen, _Cis ) ) {
|
---|
| 378 | _checkState = bad;
|
---|
| 379 | return;
|
---|
| 380 | }
|
---|
| 381 | }
|
---|
[6801] | 382 | }
|
---|
[9786] | 383 | // =====================
|
---|
| 384 | // BROADCAST ORBIT - 4
|
---|
| 385 | // =====================
|
---|
[6801] | 386 | else if ( iLine == 4 ) {
|
---|
| 387 | if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
|
---|
| 388 | readDbl(line, pos[1], fieldLen, _Crc ) ||
|
---|
| 389 | readDbl(line, pos[2], fieldLen, _omega ) ||
|
---|
| 390 | readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
|
---|
| 391 | _checkState = bad;
|
---|
| 392 | return;
|
---|
| 393 | }
|
---|
| 394 | }
|
---|
[9786] | 395 | // =====================
|
---|
| 396 | // BROADCAST ORBIT - 5
|
---|
| 397 | // =====================
|
---|
| 398 | else if ( iLine == 5 && type() != t_eph::IRNSS) {
|
---|
[6801] | 399 |
|
---|
[9786] | 400 | if (navType() == t_eph::CNAV ||
|
---|
| 401 | navType() == t_eph::CNV2) {
|
---|
[9788] | 402 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 403 | readDbl(line, pos[1], fieldLen, _Delta_n_dot) ||
|
---|
| 404 | readDbl(line, pos[2], fieldLen, _URAI_NED0 ) ||
|
---|
[9786] | 405 | readDbl(line, pos[3], fieldLen, _URAI_NED1) ) {
|
---|
| 406 | _checkState = bad;
|
---|
| 407 | return;
|
---|
| 408 | }
|
---|
[6801] | 409 | }
|
---|
[9786] | 410 | else { // LNAV, undefined
|
---|
| 411 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 412 | readDbl(line, pos[1], fieldLen, _L2Codes) ||
|
---|
[9788] | 413 | readDbl(line, pos[2], fieldLen, _TOEweek) ||
|
---|
[9786] | 414 | readDbl(line, pos[3], fieldLen, _L2PFlag) ) {
|
---|
| 415 | _checkState = bad;
|
---|
| 416 | return;
|
---|
| 417 | }
|
---|
| 418 | }
|
---|
[6801] | 419 | }
|
---|
[8168] | 420 | else if ( iLine == 5 && type() == t_eph::IRNSS) {
|
---|
| 421 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 422 | readDbl(line, pos[2], fieldLen, _TOEweek) ) {
|
---|
| 423 | _checkState = bad;
|
---|
| 424 | return;
|
---|
| 425 | }
|
---|
| 426 | }
|
---|
[9786] | 427 | // =====================
|
---|
| 428 | // BROADCAST ORBIT - 6
|
---|
| 429 | // =====================
|
---|
| 430 | else if ( iLine == 6 && type() != t_eph::IRNSS) {
|
---|
[6801] | 431 |
|
---|
[9786] | 432 | if (navType() == t_eph::CNAV ||
|
---|
| 433 | navType() == t_eph::CNV2 ) {
|
---|
| 434 | if ( readDbl(line, pos[0], fieldLen, _URAI_ED) ||
|
---|
| 435 | readDbl(line, pos[1], fieldLen, _health ) ||
|
---|
| 436 | readDbl(line, pos[2], fieldLen, _TGD ) ||
|
---|
| 437 | readDbl(line, pos[3], fieldLen, _URAI_NED2) ) {
|
---|
| 438 | _checkState = bad;
|
---|
| 439 | return;
|
---|
| 440 | }
|
---|
[6801] | 441 | }
|
---|
[9786] | 442 | else { // LNAV, undefined
|
---|
| 443 | if ( readDbl(line, pos[0], fieldLen, _ura ) ||
|
---|
| 444 | readDbl(line, pos[1], fieldLen, _health) ||
|
---|
| 445 | readDbl(line, pos[2], fieldLen, _TGD ) ||
|
---|
| 446 | readDbl(line, pos[3], fieldLen, _IODC ) ) {
|
---|
| 447 | _checkState = bad;
|
---|
| 448 | return;
|
---|
| 449 | }
|
---|
| 450 | }
|
---|
[6801] | 451 | }
|
---|
[8168] | 452 | else if ( iLine == 6 && type() == t_eph::IRNSS) {
|
---|
| 453 | if ( readDbl(line, pos[0], fieldLen, _ura ) ||
|
---|
| 454 | readDbl(line, pos[1], fieldLen, _health) ||
|
---|
| 455 | readDbl(line, pos[2], fieldLen, _TGD ) ) {
|
---|
| 456 | _checkState = bad;
|
---|
| 457 | return;
|
---|
| 458 | }
|
---|
| 459 | }
|
---|
[9786] | 460 | // =====================
|
---|
| 461 | // BROADCAST ORBIT - 7
|
---|
| 462 | // =====================
|
---|
[6801] | 463 | else if ( iLine == 7 ) {
|
---|
[9786] | 464 | if (navType() == t_eph::LNAV ||
|
---|
| 465 | navType() == t_eph::undefined) {
|
---|
| 466 |
|
---|
| 467 | if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
|
---|
| 468 | _checkState = bad;
|
---|
| 469 | return;
|
---|
| 470 | }
|
---|
| 471 |
|
---|
| 472 | if (type() != t_eph::IRNSS) {
|
---|
| 473 | double fitIntervalRnx;
|
---|
| 474 | if ( readDbl(line, pos[1], fieldLen, fitIntervalRnx) ) {
|
---|
| 475 | _checkState = bad;
|
---|
| 476 | return;
|
---|
[8931] | 477 | }
|
---|
[9786] | 478 | if (type() == t_eph::GPS) { // in RINEX specified always as time period for GPS
|
---|
| 479 | _fitInterval = fitIntervalRnx;
|
---|
| 480 | } else if (type() == t_eph::QZSS) { // specified as flag for QZSS
|
---|
| 481 | if (rnxVersion == 3.02) {
|
---|
| 482 | _fitInterval = fitIntervalRnx; // specified as time period
|
---|
| 483 | }
|
---|
| 484 | else {
|
---|
| 485 | _fitInterval = fitIntervalFromFlag(fitIntervalRnx, _IODC, t_eph::QZSS);
|
---|
| 486 | }
|
---|
[8934] | 487 | }
|
---|
[8927] | 488 | }
|
---|
[8925] | 489 | }
|
---|
[9786] | 490 |
|
---|
| 491 | else if (navType() == t_eph::CNAV ||
|
---|
| 492 | navType() == t_eph::CNV2) {
|
---|
| 493 | if ( readDbl(line, pos[0], fieldLen, _ISC_L1CA) ||
|
---|
| 494 | readDbl(line, pos[1], fieldLen, _ISC_L2C ) ||
|
---|
| 495 | readDbl(line, pos[2], fieldLen, _ISC_L5I5) ||
|
---|
| 496 | readDbl(line, pos[3], fieldLen, _ISC_L5Q5) ) {
|
---|
| 497 | _checkState = bad;
|
---|
| 498 | return;
|
---|
| 499 | }
|
---|
| 500 | }
|
---|
| 501 |
|
---|
[6801] | 502 | }
|
---|
[9786] | 503 | // =====================
|
---|
| 504 | // BROADCAST ORBIT - 8
|
---|
| 505 | // =====================
|
---|
| 506 | else if ( iLine == 8 ) {
|
---|
| 507 | if (navType() == t_eph::CNAV) {
|
---|
| 508 | if ( readDbl(line, pos[0], fieldLen, _TOT) ||
|
---|
| 509 | readDbl(line, pos[1], fieldLen, _wnop) ) {
|
---|
| 510 | _checkState = bad;
|
---|
| 511 | return;
|
---|
| 512 | }
|
---|
| 513 | }
|
---|
| 514 | else if (navType() == t_eph::CNV2) {
|
---|
| 515 | if ( readDbl(line, pos[0], fieldLen, _ISC_L1Cd) ||
|
---|
| 516 | readDbl(line, pos[1], fieldLen, _ISC_L1Cp)) {
|
---|
| 517 | _checkState = bad;
|
---|
| 518 | return;
|
---|
| 519 | }
|
---|
| 520 | }
|
---|
| 521 | }
|
---|
| 522 | // =====================
|
---|
| 523 | // BROADCAST ORBIT - 9
|
---|
| 524 | // =====================
|
---|
| 525 | else if ( iLine == 9 ) {
|
---|
| 526 | if (navType() == t_eph::CNV2) {
|
---|
| 527 | if ( readDbl(line, pos[0], fieldLen, _TOT) ||
|
---|
| 528 | readDbl(line, pos[1], fieldLen, _wnop) ) {
|
---|
| 529 | _checkState = bad;
|
---|
| 530 | return;
|
---|
| 531 | }
|
---|
| 532 | }
|
---|
| 533 | }
|
---|
[6801] | 534 | }
|
---|
| 535 | }
|
---|
| 536 |
|
---|
[2222] | 537 | // Compute GPS Satellite Position (virtual)
|
---|
[1025] | 538 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6213] | 539 | t_irc t_ephGPS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[1025] | 540 |
|
---|
[1098] | 541 | static const double omegaEarth = 7292115.1467e-11;
|
---|
[5277] | 542 | static const double gmGRS = 398.6005e12;
|
---|
[1025] | 543 |
|
---|
[8542] | 544 | memset(xc, 0, 6*sizeof(double));
|
---|
[1025] | 545 | memset(vv, 0, 3*sizeof(double));
|
---|
| 546 |
|
---|
| 547 | double a0 = _sqrt_A * _sqrt_A;
|
---|
| 548 | if (a0 == 0) {
|
---|
[6213] | 549 | return failure;
|
---|
[1025] | 550 | }
|
---|
| 551 |
|
---|
[5277] | 552 | double n0 = sqrt(gmGRS/(a0*a0*a0));
|
---|
[4018] | 553 |
|
---|
| 554 | bncTime tt(GPSweek, GPSweeks);
|
---|
[4543] | 555 | double tk = tt - bncTime(int(_TOEweek), _TOEsec);
|
---|
[4018] | 556 |
|
---|
[1025] | 557 | double n = n0 + _Delta_n;
|
---|
| 558 | double M = _M0 + n*tk;
|
---|
| 559 | double E = M;
|
---|
| 560 | double E_last;
|
---|
[8368] | 561 | int nLoop = 0;
|
---|
[1025] | 562 | do {
|
---|
| 563 | E_last = E;
|
---|
| 564 | E = M + _e*sin(E);
|
---|
[8368] | 565 |
|
---|
| 566 | if (++nLoop == 100) {
|
---|
| 567 | return failure;
|
---|
| 568 | }
|
---|
| 569 | } while ( fabs(E-E_last)*a0 > 0.001);
|
---|
[1025] | 570 | double v = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
|
---|
| 571 | double u0 = v + _omega;
|
---|
| 572 | double sin2u0 = sin(2*u0);
|
---|
| 573 | double cos2u0 = cos(2*u0);
|
---|
| 574 | double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
|
---|
| 575 | double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
|
---|
| 576 | double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
|
---|
| 577 | double xp = r*cos(u);
|
---|
| 578 | double yp = r*sin(u);
|
---|
[7481] | 579 | double OM = _OMEGA0 + (_OMEGADOT - omegaEarth)*tk -
|
---|
[4018] | 580 | omegaEarth*_TOEsec;
|
---|
[7278] | 581 |
|
---|
[1025] | 582 | double sinom = sin(OM);
|
---|
| 583 | double cosom = cos(OM);
|
---|
| 584 | double sini = sin(i);
|
---|
| 585 | double cosi = cos(i);
|
---|
| 586 | xc[0] = xp*cosom - yp*cosi*sinom;
|
---|
| 587 | xc[1] = xp*sinom + yp*cosi*cosom;
|
---|
[7481] | 588 | xc[2] = yp*sini;
|
---|
| 589 |
|
---|
[4018] | 590 | double tc = tt - _TOC;
|
---|
[2429] | 591 | xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
|
---|
[1025] | 592 |
|
---|
| 593 | // Velocity
|
---|
| 594 | // --------
|
---|
| 595 | double tanv2 = tan(v/2);
|
---|
| 596 | double dEdM = 1 / (1 - _e*cos(E));
|
---|
[7278] | 597 | double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2) / (1 + tanv2*tanv2)
|
---|
[1025] | 598 | * dEdM * n;
|
---|
| 599 | double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
|
---|
| 600 | double dotom = _OMEGADOT - omegaEarth;
|
---|
| 601 | double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
|
---|
[7278] | 602 | double dotr = a0 * _e*sin(E) * dEdM * n
|
---|
[1025] | 603 | + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
|
---|
| 604 | double dotx = dotr*cos(u) - r*sin(u)*dotu;
|
---|
| 605 | double doty = dotr*sin(u) + r*cos(u)*dotu;
|
---|
| 606 |
|
---|
| 607 | vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
|
---|
| 608 | - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
|
---|
| 609 | + yp*sini*sinom*doti; // dX / di
|
---|
| 610 |
|
---|
| 611 | vv[1] = sinom *dotx + cosi*cosom *doty
|
---|
| 612 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 613 | - yp*sini*cosom*doti;
|
---|
| 614 |
|
---|
| 615 | vv[2] = sini *doty + yp*cosi *doti;
|
---|
[2429] | 616 |
|
---|
| 617 | // Relativistic Correction
|
---|
| 618 | // -----------------------
|
---|
[9124] | 619 | xc[3] -= 4.442807633e-10 * _e * sqrt(a0) *sin(E);
|
---|
[9132] | 620 |
|
---|
[8542] | 621 | xc[4] = _clock_drift + _clock_driftrate*tc;
|
---|
| 622 | xc[5] = _clock_driftrate;
|
---|
[8581] | 623 |
|
---|
[6213] | 624 | return success;
|
---|
[1025] | 625 | }
|
---|
| 626 |
|
---|
[6801] | 627 | // RINEX Format String
|
---|
| 628 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 629 | QString t_ephGPS::toString(double version) const {
|
---|
[2221] | 630 |
|
---|
[9765] | 631 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 632 | QString rnxStr = navStr + rinexDateStr(_TOC, _prn, version);
|
---|
[2221] | 633 |
|
---|
[6801] | 634 | QTextStream out(&rnxStr);
|
---|
[2221] | 635 |
|
---|
[6801] | 636 | out << QString("%1%2%3\n")
|
---|
| 637 | .arg(_clock_bias, 19, 'e', 12)
|
---|
| 638 | .arg(_clock_drift, 19, 'e', 12)
|
---|
| 639 | .arg(_clock_driftrate, 19, 'e', 12);
|
---|
[2221] | 640 |
|
---|
[6801] | 641 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[2221] | 642 |
|
---|
[6801] | 643 |
|
---|
[9786] | 644 | // =====================
|
---|
| 645 | // BROADCAST ORBIT - 1
|
---|
| 646 | // =====================
|
---|
| 647 | if (navType() == t_eph::CNAV ||
|
---|
| 648 | navType() == t_eph::CNV2) {
|
---|
| 649 | out << QString(fmt)
|
---|
| 650 | .arg(_ADOT, 19, 'e', 12)
|
---|
| 651 | .arg(_Crs, 19, 'e', 12)
|
---|
| 652 | .arg(_Delta_n, 19, 'e', 12)
|
---|
| 653 | .arg(_M0, 19, 'e', 12);
|
---|
| 654 | }
|
---|
| 655 | else { // LNAV, undefinded
|
---|
| 656 | out << QString(fmt)
|
---|
| 657 | .arg(_IODE, 19, 'e', 12)
|
---|
| 658 | .arg(_Crs, 19, 'e', 12)
|
---|
| 659 | .arg(_Delta_n, 19, 'e', 12)
|
---|
| 660 | .arg(_M0, 19, 'e', 12);
|
---|
| 661 | }
|
---|
| 662 | // =====================
|
---|
| 663 | // BROADCAST ORBIT - 2
|
---|
| 664 | // =====================
|
---|
[6801] | 665 | out << QString(fmt)
|
---|
| 666 | .arg(_Cuc, 19, 'e', 12)
|
---|
| 667 | .arg(_e, 19, 'e', 12)
|
---|
| 668 | .arg(_Cus, 19, 'e', 12)
|
---|
| 669 | .arg(_sqrt_A, 19, 'e', 12);
|
---|
[9786] | 670 | // =====================
|
---|
| 671 | // BROADCAST ORBIT - 3
|
---|
| 672 | // =====================
|
---|
| 673 | if (navType() == t_eph::CNAV ||
|
---|
| 674 | navType() == t_eph::CNV2) {
|
---|
| 675 | out << QString(fmt)
|
---|
| 676 | .arg(_top, 19, 'e', 12)
|
---|
| 677 | .arg(_Cic, 19, 'e', 12)
|
---|
| 678 | .arg(_OMEGA0, 19, 'e', 12)
|
---|
| 679 | .arg(_Cis, 19, 'e', 12);
|
---|
| 680 | }
|
---|
| 681 | else {
|
---|
| 682 | out << QString(fmt)
|
---|
| 683 | .arg(_TOEsec, 19, 'e', 12)
|
---|
| 684 | .arg(_Cic, 19, 'e', 12)
|
---|
| 685 | .arg(_OMEGA0, 19, 'e', 12)
|
---|
| 686 | .arg(_Cis, 19, 'e', 12);
|
---|
| 687 | }
|
---|
| 688 | // =====================
|
---|
| 689 | // BROADCAST ORBIT - 4
|
---|
| 690 | // =====================
|
---|
[6801] | 691 | out << QString(fmt)
|
---|
| 692 | .arg(_i0, 19, 'e', 12)
|
---|
| 693 | .arg(_Crc, 19, 'e', 12)
|
---|
| 694 | .arg(_omega, 19, 'e', 12)
|
---|
| 695 | .arg(_OMEGADOT, 19, 'e', 12);
|
---|
[9786] | 696 | // =====================
|
---|
| 697 | // BROADCAST ORBIT - 5
|
---|
| 698 | // =====================
|
---|
[8800] | 699 | if (type() == t_eph::IRNSS) {
|
---|
[8168] | 700 | out << QString(fmt)
|
---|
| 701 | .arg(_IDOT, 19, 'e', 12)
|
---|
[8800] | 702 | .arg(0.0, 19, 'e', 12)
|
---|
| 703 | .arg(_TOEweek, 19, 'e', 12)
|
---|
| 704 | .arg(0.0, 19, 'e', 12);
|
---|
| 705 | }
|
---|
| 706 | else {
|
---|
[9786] | 707 | if (navType() == t_eph::CNAV ||
|
---|
| 708 | navType() == t_eph::CNV2) {
|
---|
| 709 | out << QString(fmt)
|
---|
[9788] | 710 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 711 | .arg(_Delta_n_dot, 19, 'e', 12)
|
---|
| 712 | .arg(_URAI_NED0, 19, 'e', 12)
|
---|
| 713 | .arg(_URAI_NED1, 19, 'e', 12);
|
---|
[9786] | 714 |
|
---|
| 715 | }
|
---|
| 716 | else { // LNAV, undefined
|
---|
| 717 | out << QString(fmt)
|
---|
| 718 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 719 | .arg(_L2Codes, 19, 'e', 12)
|
---|
| 720 | .arg(_TOEweek, 19, 'e', 12)
|
---|
| 721 | .arg(_L2PFlag, 19, 'e', 12);
|
---|
| 722 |
|
---|
| 723 | }
|
---|
[8800] | 724 | }
|
---|
[9786] | 725 | // =====================
|
---|
| 726 | // BROADCAST ORBIT - 6
|
---|
| 727 | // =====================
|
---|
[8168] | 728 | if (type() == t_eph::IRNSS) {
|
---|
| 729 | out << QString(fmt)
|
---|
| 730 | .arg(_ura, 19, 'e', 12)
|
---|
| 731 | .arg(_health, 19, 'e', 12)
|
---|
| 732 | .arg(_TGD, 19, 'e', 12)
|
---|
[8790] | 733 | .arg(0.0, 19, 'e', 12);
|
---|
[8168] | 734 | }
|
---|
| 735 | else {
|
---|
[9786] | 736 | if (navType() == t_eph::CNAV ||
|
---|
| 737 | navType() == t_eph::CNV2) {
|
---|
| 738 | out << QString(fmt)
|
---|
| 739 | .arg(_URAI_ED, 19, 'e', 12)
|
---|
| 740 | .arg(_health, 19, 'e', 12)
|
---|
| 741 | .arg(_TGD, 19, 'e', 12)
|
---|
| 742 | .arg(_URAI_NED2,19, 'e', 12);
|
---|
| 743 |
|
---|
| 744 | }
|
---|
| 745 | else { // LNAV, undefined
|
---|
| 746 | out << QString(fmt)
|
---|
| 747 | .arg(_ura, 19, 'e', 12)
|
---|
| 748 | .arg(_health, 19, 'e', 12)
|
---|
| 749 | .arg(_TGD, 19, 'e', 12)
|
---|
| 750 | .arg(_IODC, 19, 'e', 12);
|
---|
| 751 | }
|
---|
[8168] | 752 | }
|
---|
[9786] | 753 | // =====================
|
---|
| 754 | // BROADCAST ORBIT - 7
|
---|
| 755 | // =====================
|
---|
| 756 | if (navType() == t_eph::LNAV ||
|
---|
| 757 | navType() == t_eph::undefined) {
|
---|
[6801] | 758 |
|
---|
[9786] | 759 | double tot = _TOT;
|
---|
| 760 | if (tot == 0.9999e9 && version < 3.0) {
|
---|
| 761 | tot = 0.0;
|
---|
| 762 | }
|
---|
| 763 | // fitInterval
|
---|
| 764 | if (type() == t_eph::IRNSS) {// not valid for IRNSS
|
---|
| 765 | out << QString(fmt)
|
---|
| 766 | .arg(tot, 19, 'e', 12)
|
---|
| 767 | .arg(0.0, 19, 'e', 12)
|
---|
| 768 | .arg("", 19, QChar(' '))
|
---|
| 769 | .arg("", 19, QChar(' '));
|
---|
| 770 | }
|
---|
| 771 | else {
|
---|
| 772 | // for GPS and QZSS in version 3.02 specified in hours
|
---|
| 773 | double fitIntervalRnx = _fitInterval;
|
---|
| 774 | // otherwise specified as flag
|
---|
| 775 | if (type() == t_eph::QZSS && version != 3.02) {
|
---|
| 776 | (_fitInterval == 2.0) ? fitIntervalRnx = 0.0 : fitIntervalRnx = 1.0;
|
---|
| 777 | }
|
---|
| 778 | out << QString(fmt)
|
---|
| 779 | .arg(tot, 19, 'e', 12)
|
---|
| 780 | .arg(fitIntervalRnx, 19, 'e', 12)
|
---|
| 781 | .arg("", 19, QChar(' '))
|
---|
| 782 | .arg("", 19, QChar(' '));
|
---|
| 783 | }
|
---|
[7922] | 784 | }
|
---|
[9786] | 785 | else if (navType() == t_eph::CNAV ||
|
---|
| 786 | navType() == t_eph::CNV2) {
|
---|
[8800] | 787 | out << QString(fmt)
|
---|
[9786] | 788 | .arg(_ISC_L1CA, 19, 'e', 12)
|
---|
| 789 | .arg(_ISC_L2C, 19, 'e', 12)
|
---|
| 790 | .arg(_ISC_L5I5, 19, 'e', 12)
|
---|
| 791 | .arg(_ISC_L5Q5, 19, 'e', 12);
|
---|
[8800] | 792 | }
|
---|
[9786] | 793 | // =====================
|
---|
| 794 | // BROADCAST ORBIT - 8
|
---|
| 795 | // =====================
|
---|
| 796 | if (navType() == t_eph::CNAV) {
|
---|
[8800] | 797 | out << QString(fmt)
|
---|
[9786] | 798 | .arg(_TOT, 19, 'e', 12)
|
---|
| 799 | .arg(_wnop, 19, 'e', 12)
|
---|
| 800 | .arg("", 19, QChar(' '))
|
---|
| 801 | .arg("", 19, QChar(' '));
|
---|
[8800] | 802 | }
|
---|
[9786] | 803 | else if (navType() == t_eph::CNV2) {
|
---|
| 804 | out << QString(fmt)
|
---|
| 805 | .arg(_ISC_L1Cd, 19, 'e', 12)
|
---|
| 806 | .arg(_ISC_L1Cp, 19, 'e', 12)
|
---|
| 807 | .arg("", 19, QChar(' '))
|
---|
| 808 | .arg("", 19, QChar(' '));
|
---|
| 809 | }
|
---|
| 810 |
|
---|
| 811 | // =====================
|
---|
| 812 | // BROADCAST ORBIT - 9
|
---|
| 813 | // =====================
|
---|
| 814 | if (navType() == t_eph::CNV2) {
|
---|
| 815 | out << QString(fmt)
|
---|
| 816 | .arg(_TOT, 19, 'e', 12)
|
---|
| 817 | .arg(_wnop, 19, 'e', 12)
|
---|
| 818 | .arg("", 19, QChar(' '))
|
---|
| 819 | .arg("", 19, QChar(' '));
|
---|
| 820 | }
|
---|
| 821 |
|
---|
[6801] | 822 | return rnxStr;
|
---|
[2221] | 823 | }
|
---|
| 824 |
|
---|
[6801] | 825 | // Constructor
|
---|
| 826 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 827 | t_ephGlo::t_ephGlo(double rnxVersion, const QStringList& lines) {
|
---|
[2221] | 828 |
|
---|
[9367] | 829 | int nLines = 4;
|
---|
| 830 | if (rnxVersion >= 3.05) {
|
---|
| 831 | nLines += 1;
|
---|
| 832 | _flags_unknown = false;
|
---|
| 833 | }
|
---|
| 834 | else {
|
---|
| 835 | _M_delta_tau = 0.9999e9; // unknown
|
---|
| 836 | _M_FT = 1.5e1; // unknown
|
---|
| 837 | _flags_unknown = true;
|
---|
| 838 | }
|
---|
[6801] | 839 |
|
---|
| 840 | if (lines.size() != nLines) {
|
---|
| 841 | _checkState = bad;
|
---|
| 842 | return;
|
---|
[6518] | 843 | }
|
---|
| 844 |
|
---|
[6801] | 845 | // RINEX Format
|
---|
| 846 | // ------------
|
---|
| 847 | int fieldLen = 19;
|
---|
[9367] | 848 | double statusflags = 0.0;
|
---|
| 849 | double healthflags = 0.0;
|
---|
[2221] | 850 |
|
---|
[6801] | 851 | int pos[4];
|
---|
| 852 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 853 | pos[1] = pos[0] + fieldLen;
|
---|
| 854 | pos[2] = pos[1] + fieldLen;
|
---|
| 855 | pos[3] = pos[2] + fieldLen;
|
---|
[2221] | 856 |
|
---|
[6801] | 857 | // Read four lines
|
---|
| 858 | // ---------------
|
---|
| 859 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 860 | QString line = lines[iLine];
|
---|
[2221] | 861 |
|
---|
[6801] | 862 | if ( iLine == 0 ) {
|
---|
[8204] | 863 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6213] | 864 |
|
---|
[6801] | 865 | int year, month, day, hour, min;
|
---|
| 866 | double sec;
|
---|
[2221] | 867 |
|
---|
[7139] | 868 | QString prnStr, n;
|
---|
[6880] | 869 | in >> prnStr;
|
---|
[7639] | 870 | if (prnStr.size() == 1 && prnStr[0] == 'R') {
|
---|
[7139] | 871 | in >> n;
|
---|
| 872 | prnStr.append(n);
|
---|
[6880] | 873 | }
|
---|
| 874 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6801] | 875 | if (prnStr.at(0) == 'R') {
|
---|
| 876 | _prn.set('R', prnStr.mid(1).toInt());
|
---|
| 877 | }
|
---|
| 878 | else {
|
---|
| 879 | _prn.set('R', prnStr.toInt());
|
---|
| 880 | }
|
---|
[2221] | 881 |
|
---|
[6801] | 882 | if (year < 80) {
|
---|
| 883 | year += 2000;
|
---|
| 884 | }
|
---|
| 885 | else if (year < 100) {
|
---|
| 886 | year += 1900;
|
---|
| 887 | }
|
---|
[2221] | 888 |
|
---|
[6801] | 889 | _gps_utc = gnumleap(year, month, day);
|
---|
[2221] | 890 |
|
---|
[6801] | 891 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 892 | _TOC = _TOC + _gps_utc;
|
---|
[8800] | 893 | int nd = int((_TOC.gpssec())) / (24.0*60.0*60.0);
|
---|
[6801] | 894 | if ( readDbl(line, pos[1], fieldLen, _tau ) ||
|
---|
| 895 | readDbl(line, pos[2], fieldLen, _gamma) ||
|
---|
| 896 | readDbl(line, pos[3], fieldLen, _tki ) ) {
|
---|
| 897 | _checkState = bad;
|
---|
| 898 | return;
|
---|
| 899 | }
|
---|
[8800] | 900 | _tki -= nd * 86400.0;
|
---|
| 901 | _tau = -_tau;
|
---|
[6801] | 902 | }
|
---|
[9788] | 903 | // =====================
|
---|
| 904 | // BROADCAST ORBIT - 1
|
---|
| 905 | // =====================
|
---|
[6801] | 906 | else if ( iLine == 1 ) {
|
---|
| 907 | if ( readDbl(line, pos[0], fieldLen, _x_pos ) ||
|
---|
| 908 | readDbl(line, pos[1], fieldLen, _x_velocity ) ||
|
---|
| 909 | readDbl(line, pos[2], fieldLen, _x_acceleration) ||
|
---|
| 910 | readDbl(line, pos[3], fieldLen, _health ) ) {
|
---|
| 911 | _checkState = bad;
|
---|
| 912 | return;
|
---|
| 913 | }
|
---|
| 914 | }
|
---|
[9788] | 915 | // =====================
|
---|
| 916 | // BROADCAST ORBIT - 2
|
---|
| 917 | // =====================
|
---|
[6801] | 918 | else if ( iLine == 2 ) {
|
---|
| 919 | if ( readDbl(line, pos[0], fieldLen, _y_pos ) ||
|
---|
| 920 | readDbl(line, pos[1], fieldLen, _y_velocity ) ||
|
---|
| 921 | readDbl(line, pos[2], fieldLen, _y_acceleration ) ||
|
---|
| 922 | readDbl(line, pos[3], fieldLen, _frequency_number) ) {
|
---|
| 923 | _checkState = bad;
|
---|
| 924 | return;
|
---|
| 925 | }
|
---|
| 926 | }
|
---|
[9788] | 927 | // =====================
|
---|
| 928 | // BROADCAST ORBIT - 3
|
---|
| 929 | // =====================
|
---|
[6801] | 930 | else if ( iLine == 3 ) {
|
---|
| 931 | if ( readDbl(line, pos[0], fieldLen, _z_pos ) ||
|
---|
| 932 | readDbl(line, pos[1], fieldLen, _z_velocity ) ||
|
---|
| 933 | readDbl(line, pos[2], fieldLen, _z_acceleration) ||
|
---|
| 934 | readDbl(line, pos[3], fieldLen, _E ) ) {
|
---|
| 935 | _checkState = bad;
|
---|
| 936 | return;
|
---|
| 937 | }
|
---|
| 938 | }
|
---|
[9788] | 939 | // =====================
|
---|
| 940 | // BROADCAST ORBIT - 4
|
---|
| 941 | // =====================
|
---|
[9367] | 942 | else if ( iLine == 4 ) {
|
---|
| 943 | if ( readDbl(line, pos[0], fieldLen, statusflags ) ||
|
---|
| 944 | readDbl(line, pos[1], fieldLen, _M_delta_tau ) ||
|
---|
| 945 | readDbl(line, pos[2], fieldLen, _M_FT ) ||
|
---|
| 946 | readDbl(line, pos[3], fieldLen, healthflags ) ) {
|
---|
| 947 | _checkState = bad;
|
---|
| 948 | return;
|
---|
| 949 | }
|
---|
| 950 | else {
|
---|
| 951 | // status flags
|
---|
| 952 | // ============
|
---|
| 953 | // bit 0-1
|
---|
| 954 | _M_P = double(bitExtracted(statusflags, 2, 0));
|
---|
| 955 | // bit 2-3
|
---|
| 956 | _P1 = double(bitExtracted(statusflags, 2, 2));
|
---|
| 957 | // bit 4
|
---|
| 958 | _P2 = double(bitExtracted(statusflags, 1, 4));
|
---|
| 959 | // bit 5
|
---|
| 960 | _P3 = double(bitExtracted(statusflags, 1, 5));
|
---|
| 961 | // bit 6
|
---|
| 962 | _M_P4 = double(bitExtracted(statusflags, 1, 6));
|
---|
| 963 | // bit 7-8
|
---|
| 964 | _M_M = double(bitExtracted(statusflags, 2, 7));
|
---|
| 965 | /// GLO M/K exclusive flags/values only valid if flag M is set to '01'
|
---|
| 966 | if (!_M_M) {
|
---|
| 967 | _M_P4 = 0.0;
|
---|
| 968 | _M_P = 0.0;
|
---|
| 969 | }
|
---|
| 970 | // health flags
|
---|
| 971 | // ============
|
---|
| 972 | // bit 0 (is to be ignored, if bit 1 is zero)
|
---|
| 973 | _almanac_health = double(bitExtracted(healthflags, 1, 0));
|
---|
| 974 | // bit 1
|
---|
| 975 | _almanac_health_availablility_indicator = double(bitExtracted(healthflags, 1, 1));
|
---|
| 976 | // bit 2
|
---|
| 977 | _M_l3 = double(bitExtracted(healthflags, 1, 2));
|
---|
| 978 | }
|
---|
| 979 | }
|
---|
[6801] | 980 | }
|
---|
| 981 |
|
---|
| 982 | // Initialize status vector
|
---|
| 983 | // ------------------------
|
---|
| 984 | _tt = _TOC;
|
---|
[8698] | 985 | _xv.ReSize(6); _xv = 0.0;
|
---|
[6801] | 986 | _xv(1) = _x_pos * 1.e3;
|
---|
| 987 | _xv(2) = _y_pos * 1.e3;
|
---|
| 988 | _xv(3) = _z_pos * 1.e3;
|
---|
| 989 | _xv(4) = _x_velocity * 1.e3;
|
---|
| 990 | _xv(5) = _y_velocity * 1.e3;
|
---|
| 991 | _xv(6) = _z_velocity * 1.e3;
|
---|
[2221] | 992 | }
|
---|
| 993 |
|
---|
[6801] | 994 | // Compute Glonass Satellite Position (virtual)
|
---|
[2771] | 995 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6801] | 996 | t_irc t_ephGlo::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[2771] | 997 |
|
---|
[6801] | 998 | static const double nominalStep = 10.0;
|
---|
[2771] | 999 |
|
---|
[8542] | 1000 | memset(xc, 0, 6*sizeof(double));
|
---|
[2771] | 1001 | memset(vv, 0, 3*sizeof(double));
|
---|
| 1002 |
|
---|
[6801] | 1003 | double dtPos = bncTime(GPSweek, GPSweeks) - _tt;
|
---|
| 1004 |
|
---|
[8698] | 1005 | if (fabs(dtPos) > 24 * 3600.0) {
|
---|
[6213] | 1006 | return failure;
|
---|
[2771] | 1007 | }
|
---|
| 1008 |
|
---|
[6801] | 1009 | int nSteps = int(fabs(dtPos) / nominalStep) + 1;
|
---|
| 1010 | double step = dtPos / nSteps;
|
---|
[4018] | 1011 |
|
---|
[6801] | 1012 | double acc[3];
|
---|
| 1013 | acc[0] = _x_acceleration * 1.e3;
|
---|
| 1014 | acc[1] = _y_acceleration * 1.e3;
|
---|
| 1015 | acc[2] = _z_acceleration * 1.e3;
|
---|
[9132] | 1016 |
|
---|
[6801] | 1017 | for (int ii = 1; ii <= nSteps; ii++) {
|
---|
| 1018 | _xv = rungeKutta4(_tt.gpssec(), _xv, step, acc, glo_deriv);
|
---|
| 1019 | _tt = _tt + step;
|
---|
| 1020 | }
|
---|
[4018] | 1021 |
|
---|
[6801] | 1022 | // Position and Velocity
|
---|
| 1023 | // ---------------------
|
---|
| 1024 | xc[0] = _xv(1);
|
---|
| 1025 | xc[1] = _xv(2);
|
---|
| 1026 | xc[2] = _xv(3);
|
---|
[2771] | 1027 |
|
---|
[6801] | 1028 | vv[0] = _xv(4);
|
---|
| 1029 | vv[1] = _xv(5);
|
---|
| 1030 | vv[2] = _xv(6);
|
---|
[2771] | 1031 |
|
---|
[6801] | 1032 | // Clock Correction
|
---|
| 1033 | // ----------------
|
---|
| 1034 | double dtClk = bncTime(GPSweek, GPSweeks) - _TOC;
|
---|
| 1035 | xc[3] = -_tau + _gamma * dtClk;
|
---|
[2771] | 1036 |
|
---|
[8542] | 1037 | xc[4] = _gamma;
|
---|
| 1038 | xc[5] = 0.0;
|
---|
[8483] | 1039 |
|
---|
[6213] | 1040 | return success;
|
---|
[2771] | 1041 | }
|
---|
| 1042 |
|
---|
[6801] | 1043 | // RINEX Format String
|
---|
[3659] | 1044 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6801] | 1045 | QString t_ephGlo::toString(double version) const {
|
---|
[3664] | 1046 |
|
---|
[9765] | 1047 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 1048 | QString rnxStr = navStr + rinexDateStr(_TOC -_gps_utc, _prn, version);
|
---|
[8800] | 1049 | int nd = int((_TOC - _gps_utc).gpssec()) / (24.0*60.0*60.0);
|
---|
[6801] | 1050 | QTextStream out(&rnxStr);
|
---|
[3664] | 1051 |
|
---|
[6801] | 1052 | out << QString("%1%2%3\n")
|
---|
[8800] | 1053 | .arg(-_tau, 19, 'e', 12)
|
---|
| 1054 | .arg(_gamma, 19, 'e', 12)
|
---|
| 1055 | .arg(_tki+nd*86400.0, 19, 'e', 12);
|
---|
[3668] | 1056 |
|
---|
[6801] | 1057 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 1058 | // =====================
|
---|
| 1059 | // BROADCAST ORBIT - 1
|
---|
| 1060 | // =====================
|
---|
[6801] | 1061 | out << QString(fmt)
|
---|
| 1062 | .arg(_x_pos, 19, 'e', 12)
|
---|
| 1063 | .arg(_x_velocity, 19, 'e', 12)
|
---|
| 1064 | .arg(_x_acceleration, 19, 'e', 12)
|
---|
| 1065 | .arg(_health, 19, 'e', 12);
|
---|
[9788] | 1066 | // =====================
|
---|
| 1067 | // BROADCAST ORBIT - 2
|
---|
| 1068 | // =====================
|
---|
[6801] | 1069 | out << QString(fmt)
|
---|
| 1070 | .arg(_y_pos, 19, 'e', 12)
|
---|
| 1071 | .arg(_y_velocity, 19, 'e', 12)
|
---|
| 1072 | .arg(_y_acceleration, 19, 'e', 12)
|
---|
| 1073 | .arg(_frequency_number, 19, 'e', 12);
|
---|
[9788] | 1074 | // =====================
|
---|
| 1075 | // BROADCAST ORBIT - 3
|
---|
| 1076 | // =====================
|
---|
[6801] | 1077 | out << QString(fmt)
|
---|
| 1078 | .arg(_z_pos, 19, 'e', 12)
|
---|
| 1079 | .arg(_z_velocity, 19, 'e', 12)
|
---|
| 1080 | .arg(_z_acceleration, 19, 'e', 12)
|
---|
| 1081 | .arg(_E, 19, 'e', 12);
|
---|
[9788] | 1082 | // =====================
|
---|
| 1083 | // BROADCAST ORBIT - 4
|
---|
| 1084 | // =====================
|
---|
[9367] | 1085 | if (version >= 3.05) {
|
---|
| 1086 | // unknown (RINEX version < 3.05)
|
---|
| 1087 | if (_flags_unknown) {
|
---|
| 1088 | out << QString(fmt)
|
---|
| 1089 | .arg("", 19, QChar(' ')) // statusflags blank if unknown
|
---|
| 1090 | .arg(_M_delta_tau, 19, 'e', 12)
|
---|
| 1091 | .arg(_M_FT, 19, 'e', 12)
|
---|
| 1092 | .arg("", 19, QChar(' ')); // healthflags blank if unknown
|
---|
| 1093 | }
|
---|
| 1094 | else {
|
---|
| 1095 | int statusflags = 0;
|
---|
| 1096 | // bit 7-8
|
---|
| 1097 | if (_M_M == 2.0) {
|
---|
| 1098 | statusflags |= (1<<7);
|
---|
| 1099 | }
|
---|
| 1100 | // bit 6
|
---|
| 1101 | if (_M_P4) {
|
---|
| 1102 | statusflags |= (1<<6);
|
---|
| 1103 | }
|
---|
| 1104 | // bit 5
|
---|
| 1105 | if (_P3) {
|
---|
| 1106 | statusflags |= (1<<5);
|
---|
| 1107 | }
|
---|
| 1108 | // bit 4
|
---|
| 1109 | if (_P2) {
|
---|
| 1110 | statusflags |= (1<<4);
|
---|
| 1111 | }
|
---|
| 1112 | // bit 2-3
|
---|
| 1113 | if (_P1 == 2.0) {
|
---|
| 1114 | statusflags |= (1<<2);
|
---|
| 1115 | }
|
---|
| 1116 | else if (_P1 == 1.0) {
|
---|
| 1117 | statusflags |= (1<<3);
|
---|
| 1118 | }
|
---|
| 1119 | else if (_P1 == 3.0) {
|
---|
| 1120 | statusflags |= (1<<2);
|
---|
| 1121 | statusflags |= (1<<3);
|
---|
| 1122 | }
|
---|
| 1123 | // bit 0-1
|
---|
| 1124 | if (_M_P == 2.0) {
|
---|
| 1125 | statusflags |= (1<<0);
|
---|
| 1126 | }
|
---|
| 1127 | else if (_M_P == 1.0) {
|
---|
| 1128 | statusflags |= (1<<1);
|
---|
| 1129 | }
|
---|
| 1130 | else if (_M_P == 3.0) {
|
---|
| 1131 | statusflags |= (1<<0);
|
---|
| 1132 | statusflags |= (1<<1);
|
---|
| 1133 | }
|
---|
| 1134 | // health flags
|
---|
| 1135 | // ============
|
---|
| 1136 | int healthflags = 0;
|
---|
| 1137 | // bit 0 (is to be ignored, if bit 1 is zero)
|
---|
| 1138 | if (_almanac_health) {
|
---|
| 1139 | healthflags |= (1<<0);
|
---|
| 1140 | }
|
---|
| 1141 | // bit 1
|
---|
| 1142 | if (_almanac_health_availablility_indicator) {
|
---|
| 1143 | healthflags |= (1<<1);
|
---|
| 1144 | }
|
---|
| 1145 | // bit 2
|
---|
| 1146 | if (_M_l3) {
|
---|
| 1147 | healthflags |= (1<<2);
|
---|
| 1148 | }
|
---|
| 1149 | out << QString(fmt)
|
---|
| 1150 | .arg(double(statusflags), 19, 'e', 12)
|
---|
| 1151 | .arg(_M_delta_tau, 19, 'e', 12)
|
---|
| 1152 | .arg(_M_FT, 19, 'e', 12)
|
---|
| 1153 | .arg(double(healthflags), 19, 'e', 12);
|
---|
| 1154 | }
|
---|
| 1155 | }
|
---|
| 1156 |
|
---|
[6801] | 1157 | return rnxStr;
|
---|
[3659] | 1158 | }
|
---|
| 1159 |
|
---|
[6801] | 1160 | // Derivative of the state vector using a simple force model (static)
|
---|
| 1161 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1162 | ColumnVector t_ephGlo::glo_deriv(double /* tt */, const ColumnVector& xv,
|
---|
| 1163 | double* acc) {
|
---|
[3659] | 1164 |
|
---|
[6801] | 1165 | // State vector components
|
---|
| 1166 | // -----------------------
|
---|
| 1167 | ColumnVector rr = xv.rows(1,3);
|
---|
| 1168 | ColumnVector vv = xv.rows(4,6);
|
---|
[3699] | 1169 |
|
---|
[6801] | 1170 | // Acceleration
|
---|
[3699] | 1171 | // ------------
|
---|
[6801] | 1172 | static const double gmWGS = 398.60044e12;
|
---|
| 1173 | static const double AE = 6378136.0;
|
---|
| 1174 | static const double OMEGA = 7292115.e-11;
|
---|
| 1175 | static const double C20 = -1082.6257e-6;
|
---|
[3699] | 1176 |
|
---|
[8903] | 1177 | double rho = rr.NormFrobenius();
|
---|
[6801] | 1178 | double t1 = -gmWGS/(rho*rho*rho);
|
---|
| 1179 | double t2 = 3.0/2.0 * C20 * (gmWGS*AE*AE) / (rho*rho*rho*rho*rho);
|
---|
| 1180 | double t3 = OMEGA * OMEGA;
|
---|
| 1181 | double t4 = 2.0 * OMEGA;
|
---|
| 1182 | double z2 = rr(3) * rr(3);
|
---|
[3699] | 1183 |
|
---|
[6801] | 1184 | // Vector of derivatives
|
---|
| 1185 | // ---------------------
|
---|
| 1186 | ColumnVector va(6);
|
---|
| 1187 | va(1) = vv(1);
|
---|
| 1188 | va(2) = vv(2);
|
---|
| 1189 | va(3) = vv(3);
|
---|
| 1190 | va(4) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(1) + t4*vv(2) + acc[0];
|
---|
| 1191 | va(5) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(2) - t4*vv(1) + acc[1];
|
---|
| 1192 | va(6) = (t1 + t2*(3.0-5.0*z2/(rho*rho)) ) * rr(3) + acc[2];
|
---|
[3699] | 1193 |
|
---|
[6801] | 1194 | return va;
|
---|
| 1195 | }
|
---|
[3699] | 1196 |
|
---|
[6801] | 1197 | // IOD of Glonass Ephemeris (virtual)
|
---|
| 1198 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7169] | 1199 | unsigned int t_ephGlo::IOD() const {
|
---|
[6801] | 1200 | bncTime tMoscow = _TOC - _gps_utc + 3 * 3600.0;
|
---|
[7054] | 1201 | return (unsigned long)tMoscow.daysec() / 900;
|
---|
[3659] | 1202 | }
|
---|
| 1203 |
|
---|
[8187] | 1204 | // Health status of Glonass Ephemeris (virtual)
|
---|
| 1205 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1206 | unsigned int t_ephGlo::isUnhealthy() const {
|
---|
[8215] | 1207 |
|
---|
[8217] | 1208 | if (_almanac_health_availablility_indicator) {
|
---|
[8215] | 1209 | if ((_health == 0 && _almanac_health == 0) ||
|
---|
| 1210 | (_health == 1 && _almanac_health == 0) ||
|
---|
| 1211 | (_health == 1 && _almanac_health == 1)) {
|
---|
| 1212 | return 1;
|
---|
| 1213 | }
|
---|
[8187] | 1214 | }
|
---|
[8217] | 1215 | else if (!_almanac_health_availablility_indicator) {
|
---|
| 1216 | if (_health) {
|
---|
| 1217 | return 1;
|
---|
| 1218 | }
|
---|
| 1219 | }
|
---|
[8215] | 1220 | return 0; /* (_health == 0 && _almanac_health == 1) or (_health == 0) */
|
---|
[8187] | 1221 | }
|
---|
| 1222 |
|
---|
[3659] | 1223 | // Constructor
|
---|
| 1224 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 1225 | t_ephGal::t_ephGal(double rnxVersion, const QStringList& lines) {
|
---|
[6809] | 1226 | int year, month, day, hour, min;
|
---|
| 1227 | double sec;
|
---|
| 1228 | QString prnStr;
|
---|
[4891] | 1229 | const int nLines = 8;
|
---|
| 1230 | if (lines.size() != nLines) {
|
---|
[6518] | 1231 | _checkState = bad;
|
---|
[4891] | 1232 | return;
|
---|
| 1233 | }
|
---|
| 1234 |
|
---|
| 1235 | // RINEX Format
|
---|
| 1236 | // ------------
|
---|
| 1237 | int fieldLen = 19;
|
---|
[6792] | 1238 | double SVhealth = 0.0;
|
---|
| 1239 | double datasource = 0.0;
|
---|
[6798] | 1240 |
|
---|
[4891] | 1241 | int pos[4];
|
---|
| 1242 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 1243 | pos[1] = pos[0] + fieldLen;
|
---|
| 1244 | pos[2] = pos[1] + fieldLen;
|
---|
| 1245 | pos[3] = pos[2] + fieldLen;
|
---|
| 1246 |
|
---|
| 1247 | // Read eight lines
|
---|
| 1248 | // ----------------
|
---|
| 1249 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 1250 | QString line = lines[iLine];
|
---|
| 1251 |
|
---|
| 1252 | if ( iLine == 0 ) {
|
---|
[8204] | 1253 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[7140] | 1254 | QString n;
|
---|
[6880] | 1255 | in >> prnStr;
|
---|
[7639] | 1256 | if (prnStr.size() == 1 && prnStr[0] == 'E') {
|
---|
[7139] | 1257 | in >> n;
|
---|
| 1258 | prnStr.append(n);
|
---|
[6880] | 1259 | }
|
---|
| 1260 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[4891] | 1261 | if (year < 80) {
|
---|
| 1262 | year += 2000;
|
---|
| 1263 | }
|
---|
| 1264 | else if (year < 100) {
|
---|
| 1265 | year += 1900;
|
---|
| 1266 | }
|
---|
| 1267 |
|
---|
| 1268 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 1269 |
|
---|
| 1270 | if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
|
---|
| 1271 | readDbl(line, pos[2], fieldLen, _clock_drift ) ||
|
---|
| 1272 | readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
|
---|
[6518] | 1273 | _checkState = bad;
|
---|
[4891] | 1274 | return;
|
---|
| 1275 | }
|
---|
| 1276 | }
|
---|
[9788] | 1277 | // =====================
|
---|
| 1278 | // BROADCAST ORBIT - 1
|
---|
| 1279 | // =====================
|
---|
[4891] | 1280 | else if ( iLine == 1 ) {
|
---|
| 1281 | if ( readDbl(line, pos[0], fieldLen, _IODnav ) ||
|
---|
| 1282 | readDbl(line, pos[1], fieldLen, _Crs ) ||
|
---|
| 1283 | readDbl(line, pos[2], fieldLen, _Delta_n) ||
|
---|
| 1284 | readDbl(line, pos[3], fieldLen, _M0 ) ) {
|
---|
[6518] | 1285 | _checkState = bad;
|
---|
[4891] | 1286 | return;
|
---|
| 1287 | }
|
---|
| 1288 | }
|
---|
[9788] | 1289 | // =====================
|
---|
| 1290 | // BROADCAST ORBIT - 2
|
---|
| 1291 | // =====================
|
---|
[4891] | 1292 | else if ( iLine == 2 ) {
|
---|
| 1293 | if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
|
---|
| 1294 | readDbl(line, pos[1], fieldLen, _e ) ||
|
---|
| 1295 | readDbl(line, pos[2], fieldLen, _Cus ) ||
|
---|
| 1296 | readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
|
---|
[6518] | 1297 | _checkState = bad;
|
---|
[4891] | 1298 | return;
|
---|
| 1299 | }
|
---|
| 1300 | }
|
---|
[9788] | 1301 | // =====================
|
---|
| 1302 | // BROADCAST ORBIT - 3
|
---|
| 1303 | // =====================
|
---|
[4891] | 1304 | else if ( iLine == 3 ) {
|
---|
| 1305 | if ( readDbl(line, pos[0], fieldLen, _TOEsec) ||
|
---|
| 1306 | readDbl(line, pos[1], fieldLen, _Cic ) ||
|
---|
| 1307 | readDbl(line, pos[2], fieldLen, _OMEGA0) ||
|
---|
| 1308 | readDbl(line, pos[3], fieldLen, _Cis ) ) {
|
---|
[6518] | 1309 | _checkState = bad;
|
---|
[4891] | 1310 | return;
|
---|
| 1311 | }
|
---|
| 1312 | }
|
---|
[9788] | 1313 | // =====================
|
---|
| 1314 | // BROADCAST ORBIT - 4
|
---|
| 1315 | // =====================
|
---|
[4891] | 1316 | else if ( iLine == 4 ) {
|
---|
| 1317 | if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
|
---|
| 1318 | readDbl(line, pos[1], fieldLen, _Crc ) ||
|
---|
| 1319 | readDbl(line, pos[2], fieldLen, _omega ) ||
|
---|
| 1320 | readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
|
---|
[6518] | 1321 | _checkState = bad;
|
---|
[4891] | 1322 | return;
|
---|
| 1323 | }
|
---|
| 1324 | }
|
---|
[9788] | 1325 | // =====================
|
---|
| 1326 | // BROADCAST ORBIT - 5
|
---|
| 1327 | // =====================
|
---|
[4891] | 1328 | else if ( iLine == 5 ) {
|
---|
[6792] | 1329 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 1330 | readDbl(line, pos[1], fieldLen, datasource) ||
|
---|
| 1331 | readDbl(line, pos[2], fieldLen, _TOEweek ) ) {
|
---|
[6518] | 1332 | _checkState = bad;
|
---|
[4891] | 1333 | return;
|
---|
[6792] | 1334 | } else {
|
---|
| 1335 | if (int(datasource) & (1<<8)) {
|
---|
[6812] | 1336 | _fnav = true;
|
---|
| 1337 | _inav = false;
|
---|
[6792] | 1338 | } else if (int(datasource) & (1<<9)) {
|
---|
[6812] | 1339 | _fnav = false;
|
---|
| 1340 | _inav = true;
|
---|
[6792] | 1341 | }
|
---|
[6892] | 1342 | _TOEweek -= 1024.0;
|
---|
[4891] | 1343 | }
|
---|
| 1344 | }
|
---|
[9788] | 1345 | // =====================
|
---|
| 1346 | // BROADCAST ORBIT - 6
|
---|
| 1347 | // =====================
|
---|
[4891] | 1348 | else if ( iLine == 6 ) {
|
---|
| 1349 | if ( readDbl(line, pos[0], fieldLen, _SISA ) ||
|
---|
[6792] | 1350 | readDbl(line, pos[1], fieldLen, SVhealth) ||
|
---|
[4891] | 1351 | readDbl(line, pos[2], fieldLen, _BGD_1_5A) ||
|
---|
| 1352 | readDbl(line, pos[3], fieldLen, _BGD_1_5B) ) {
|
---|
[6518] | 1353 | _checkState = bad;
|
---|
[4891] | 1354 | return;
|
---|
[6792] | 1355 | } else {
|
---|
| 1356 | // Bit 0
|
---|
[9367] | 1357 | _e1DataInValid = (int(SVhealth) & (1<<0));
|
---|
[6792] | 1358 | // Bit 1-2
|
---|
[9367] | 1359 | _E1_bHS = double((int(SVhealth) >> 1) & 0x3);
|
---|
[6792] | 1360 | // Bit 3
|
---|
[6812] | 1361 | _e5aDataInValid = (int(SVhealth) & (1<<3));
|
---|
[6792] | 1362 | // Bit 4-5
|
---|
[9367] | 1363 | _E5aHS = double((int(SVhealth) >> 4) & 0x3);
|
---|
[6792] | 1364 | // Bit 6
|
---|
[6812] | 1365 | _e5bDataInValid = (int(SVhealth) & (1<<6));
|
---|
[6792] | 1366 | // Bit 7-8
|
---|
[9367] | 1367 | _E5bHS = double((int(SVhealth) >> 7) & 0x3);
|
---|
[6809] | 1368 |
|
---|
| 1369 | if (prnStr.at(0) == 'E') {
|
---|
[7140] | 1370 | _prn.set('E', prnStr.mid(1).toInt(), _inav ? 1 : 0);
|
---|
[6809] | 1371 | }
|
---|
[4891] | 1372 | }
|
---|
| 1373 | }
|
---|
[9788] | 1374 | // =====================
|
---|
| 1375 | // BROADCAST ORBIT - 7
|
---|
| 1376 | // =====================
|
---|
[4891] | 1377 | else if ( iLine == 7 ) {
|
---|
| 1378 | if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
|
---|
[6518] | 1379 | _checkState = bad;
|
---|
[4891] | 1380 | return;
|
---|
| 1381 | }
|
---|
| 1382 | }
|
---|
| 1383 | }
|
---|
[3659] | 1384 | }
|
---|
[4013] | 1385 |
|
---|
[6801] | 1386 | // Compute Galileo Satellite Position (virtual)
|
---|
| 1387 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1388 | t_irc t_ephGal::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[4013] | 1389 |
|
---|
[6801] | 1390 | static const double omegaEarth = 7292115.1467e-11;
|
---|
[8212] | 1391 | static const double gmWGS = 398.6004418e12;
|
---|
[4023] | 1392 |
|
---|
[8542] | 1393 | memset(xc, 0, 6*sizeof(double));
|
---|
[6801] | 1394 | memset(vv, 0, 3*sizeof(double));
|
---|
[4023] | 1395 |
|
---|
[6801] | 1396 | double a0 = _sqrt_A * _sqrt_A;
|
---|
| 1397 | if (a0 == 0) {
|
---|
| 1398 | return failure;
|
---|
| 1399 | }
|
---|
[4023] | 1400 |
|
---|
[6801] | 1401 | double n0 = sqrt(gmWGS/(a0*a0*a0));
|
---|
[4023] | 1402 |
|
---|
[6801] | 1403 | bncTime tt(GPSweek, GPSweeks);
|
---|
| 1404 | double tk = tt - bncTime(_TOC.gpsw(), _TOEsec);
|
---|
[4023] | 1405 |
|
---|
[6801] | 1406 | double n = n0 + _Delta_n;
|
---|
| 1407 | double M = _M0 + n*tk;
|
---|
| 1408 | double E = M;
|
---|
| 1409 | double E_last;
|
---|
[8368] | 1410 | int nLoop = 0;
|
---|
[6801] | 1411 | do {
|
---|
| 1412 | E_last = E;
|
---|
| 1413 | E = M + _e*sin(E);
|
---|
[8368] | 1414 |
|
---|
| 1415 | if (++nLoop == 100) {
|
---|
| 1416 | return failure;
|
---|
| 1417 | }
|
---|
[6801] | 1418 | } while ( fabs(E-E_last)*a0 > 0.001 );
|
---|
| 1419 | double v = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
|
---|
| 1420 | double u0 = v + _omega;
|
---|
| 1421 | double sin2u0 = sin(2*u0);
|
---|
| 1422 | double cos2u0 = cos(2*u0);
|
---|
| 1423 | double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
|
---|
| 1424 | double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
|
---|
| 1425 | double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
|
---|
| 1426 | double xp = r*cos(u);
|
---|
| 1427 | double yp = r*sin(u);
|
---|
| 1428 | double OM = _OMEGA0 + (_OMEGADOT - omegaEarth)*tk -
|
---|
| 1429 | omegaEarth*_TOEsec;
|
---|
[4023] | 1430 |
|
---|
[6801] | 1431 | double sinom = sin(OM);
|
---|
| 1432 | double cosom = cos(OM);
|
---|
| 1433 | double sini = sin(i);
|
---|
| 1434 | double cosi = cos(i);
|
---|
| 1435 | xc[0] = xp*cosom - yp*cosi*sinom;
|
---|
| 1436 | xc[1] = xp*sinom + yp*cosi*cosom;
|
---|
| 1437 | xc[2] = yp*sini;
|
---|
[4023] | 1438 |
|
---|
[6801] | 1439 | double tc = tt - _TOC;
|
---|
| 1440 | xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
|
---|
[4023] | 1441 |
|
---|
[6801] | 1442 | // Velocity
|
---|
| 1443 | // --------
|
---|
| 1444 | double tanv2 = tan(v/2);
|
---|
| 1445 | double dEdM = 1 / (1 - _e*cos(E));
|
---|
| 1446 | double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2) / (1 + tanv2*tanv2)
|
---|
| 1447 | * dEdM * n;
|
---|
| 1448 | double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
|
---|
| 1449 | double dotom = _OMEGADOT - omegaEarth;
|
---|
| 1450 | double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
|
---|
| 1451 | double dotr = a0 * _e*sin(E) * dEdM * n
|
---|
| 1452 | + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
|
---|
| 1453 | double dotx = dotr*cos(u) - r*sin(u)*dotu;
|
---|
| 1454 | double doty = dotr*sin(u) + r*cos(u)*dotu;
|
---|
[4023] | 1455 |
|
---|
[6801] | 1456 | vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
|
---|
| 1457 | - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
|
---|
| 1458 | + yp*sini*sinom*doti; // dX / di
|
---|
| 1459 |
|
---|
| 1460 | vv[1] = sinom *dotx + cosi*cosom *doty
|
---|
| 1461 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 1462 | - yp*sini*cosom*doti;
|
---|
| 1463 |
|
---|
| 1464 | vv[2] = sini *doty + yp*cosi *doti;
|
---|
| 1465 |
|
---|
| 1466 | // Relativistic Correction
|
---|
| 1467 | // -----------------------
|
---|
[9290] | 1468 | xc[3] -= 4.442807309e-10 * _e * sqrt(a0) *sin(E);
|
---|
[6801] | 1469 |
|
---|
[8542] | 1470 | xc[4] = _clock_drift + _clock_driftrate*tc;
|
---|
| 1471 | xc[5] = _clock_driftrate;
|
---|
[8581] | 1472 |
|
---|
[6801] | 1473 | return success;
|
---|
[4023] | 1474 | }
|
---|
| 1475 |
|
---|
[8187] | 1476 | // Health status of Galileo Ephemeris (virtual)
|
---|
| 1477 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1478 | unsigned int t_ephGal::isUnhealthy() const {
|
---|
| 1479 | if (_E5aHS && _E5bHS && _E1_bHS) {
|
---|
| 1480 | return 1;
|
---|
| 1481 | }
|
---|
| 1482 | return 0;
|
---|
| 1483 | }
|
---|
| 1484 |
|
---|
[4023] | 1485 | // RINEX Format String
|
---|
| 1486 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 1487 | QString t_ephGal::toString(double version) const {
|
---|
| 1488 |
|
---|
[9765] | 1489 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 1490 | QString rnxStr = navStr + rinexDateStr(_TOC, _prn, version);
|
---|
[4023] | 1491 |
|
---|
| 1492 | QTextStream out(&rnxStr);
|
---|
| 1493 |
|
---|
| 1494 | out << QString("%1%2%3\n")
|
---|
| 1495 | .arg(_clock_bias, 19, 'e', 12)
|
---|
| 1496 | .arg(_clock_drift, 19, 'e', 12)
|
---|
| 1497 | .arg(_clock_driftrate, 19, 'e', 12);
|
---|
| 1498 |
|
---|
| 1499 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 1500 | // =====================
|
---|
| 1501 | // BROADCAST ORBIT - 1
|
---|
| 1502 | // =====================
|
---|
[4023] | 1503 | out << QString(fmt)
|
---|
| 1504 | .arg(_IODnav, 19, 'e', 12)
|
---|
| 1505 | .arg(_Crs, 19, 'e', 12)
|
---|
| 1506 | .arg(_Delta_n, 19, 'e', 12)
|
---|
| 1507 | .arg(_M0, 19, 'e', 12);
|
---|
[9788] | 1508 | // =====================
|
---|
| 1509 | // BROADCAST ORBIT - 2
|
---|
| 1510 | // =====================
|
---|
[4023] | 1511 | out << QString(fmt)
|
---|
| 1512 | .arg(_Cuc, 19, 'e', 12)
|
---|
| 1513 | .arg(_e, 19, 'e', 12)
|
---|
| 1514 | .arg(_Cus, 19, 'e', 12)
|
---|
| 1515 | .arg(_sqrt_A, 19, 'e', 12);
|
---|
[9788] | 1516 | // =====================
|
---|
| 1517 | // BROADCAST ORBIT - 3
|
---|
| 1518 | // =====================
|
---|
[4023] | 1519 | out << QString(fmt)
|
---|
| 1520 | .arg(_TOEsec, 19, 'e', 12)
|
---|
| 1521 | .arg(_Cic, 19, 'e', 12)
|
---|
| 1522 | .arg(_OMEGA0, 19, 'e', 12)
|
---|
| 1523 | .arg(_Cis, 19, 'e', 12);
|
---|
[9788] | 1524 | // =====================
|
---|
| 1525 | // BROADCAST ORBIT - 4
|
---|
| 1526 | // =====================
|
---|
[4023] | 1527 | out << QString(fmt)
|
---|
| 1528 | .arg(_i0, 19, 'e', 12)
|
---|
| 1529 | .arg(_Crc, 19, 'e', 12)
|
---|
| 1530 | .arg(_omega, 19, 'e', 12)
|
---|
| 1531 | .arg(_OMEGADOT, 19, 'e', 12);
|
---|
[9788] | 1532 | // =====================
|
---|
| 1533 | // BROADCAST ORBIT - 5
|
---|
| 1534 | // =====================
|
---|
[6792] | 1535 | int dataSource = 0;
|
---|
| 1536 | int SVhealth = 0;
|
---|
| 1537 | double BGD_1_5A = _BGD_1_5A;
|
---|
| 1538 | double BGD_1_5B = _BGD_1_5B;
|
---|
[6812] | 1539 | if (_fnav) {
|
---|
[6792] | 1540 | dataSource |= (1<<1);
|
---|
| 1541 | dataSource |= (1<<8);
|
---|
| 1542 | BGD_1_5B = 0.0;
|
---|
| 1543 | // SVhealth
|
---|
| 1544 | // Bit 3 : E5a DVS
|
---|
[6812] | 1545 | if (_e5aDataInValid) {
|
---|
[6792] | 1546 | SVhealth |= (1<<3);
|
---|
| 1547 | }
|
---|
| 1548 | // Bit 4-5: E5a HS
|
---|
| 1549 | if (_E5aHS == 1.0) {
|
---|
| 1550 | SVhealth |= (1<<4);
|
---|
| 1551 | }
|
---|
| 1552 | else if (_E5aHS == 2.0) {
|
---|
| 1553 | SVhealth |= (1<<5);
|
---|
| 1554 | }
|
---|
| 1555 | else if (_E5aHS == 3.0) {
|
---|
| 1556 | SVhealth |= (1<<4);
|
---|
| 1557 | SVhealth |= (1<<5);
|
---|
| 1558 | }
|
---|
| 1559 | }
|
---|
[6812] | 1560 | else if(_inav) {
|
---|
[6803] | 1561 | // Bit 2 and 0 are set because from MT1046 the data source cannot be determined
|
---|
| 1562 | // and RNXv3.03 says both can be set if the navigation messages were merged
|
---|
[5539] | 1563 | dataSource |= (1<<0);
|
---|
[6792] | 1564 | dataSource |= (1<<2);
|
---|
[5540] | 1565 | dataSource |= (1<<9);
|
---|
[6792] | 1566 | // SVhealth
|
---|
| 1567 | // Bit 0 : E1-B DVS
|
---|
[6812] | 1568 | if (_e1DataInValid) {
|
---|
[6792] | 1569 | SVhealth |= (1<<0);
|
---|
| 1570 | }
|
---|
| 1571 | // Bit 1-2: E1-B HS
|
---|
| 1572 | if (_E1_bHS == 1.0) {
|
---|
| 1573 | SVhealth |= (1<<1);
|
---|
| 1574 | }
|
---|
| 1575 | else if (_E1_bHS == 2.0) {
|
---|
| 1576 | SVhealth |= (1<<2);
|
---|
| 1577 | }
|
---|
[6803] | 1578 | else if (_E1_bHS == 3.0) {
|
---|
[6792] | 1579 | SVhealth |= (1<<1);
|
---|
| 1580 | SVhealth |= (1<<2);
|
---|
| 1581 | }
|
---|
[6802] | 1582 | // Bit 3 : E5a DVS
|
---|
[6812] | 1583 | if (_e5aDataInValid) {
|
---|
[6802] | 1584 | SVhealth |= (1<<3);
|
---|
| 1585 | }
|
---|
| 1586 | // Bit 4-5: E5a HS
|
---|
| 1587 | if (_E5aHS == 1.0) {
|
---|
| 1588 | SVhealth |= (1<<4);
|
---|
| 1589 | }
|
---|
| 1590 | else if (_E5aHS == 2.0) {
|
---|
| 1591 | SVhealth |= (1<<5);
|
---|
| 1592 | }
|
---|
[6803] | 1593 | else if (_E5aHS == 3.0) {
|
---|
[6802] | 1594 | SVhealth |= (1<<4);
|
---|
| 1595 | SVhealth |= (1<<5);
|
---|
| 1596 | }
|
---|
[6792] | 1597 | // Bit 6 : E5b DVS
|
---|
[6812] | 1598 | if (_e5bDataInValid) {
|
---|
[6792] | 1599 | SVhealth |= (1<<6);
|
---|
| 1600 | }
|
---|
| 1601 | // Bit 7-8: E5b HS
|
---|
| 1602 | if (_E5bHS == 1.0) {
|
---|
| 1603 | SVhealth |= (1<<7);
|
---|
| 1604 | }
|
---|
| 1605 | else if (_E5bHS == 2.0) {
|
---|
| 1606 | SVhealth |= (1<<8);
|
---|
| 1607 | }
|
---|
[6803] | 1608 | else if (_E5bHS == 3.0) {
|
---|
[6792] | 1609 | SVhealth |= (1<<7);
|
---|
| 1610 | SVhealth |= (1<<8);
|
---|
| 1611 | }
|
---|
[5539] | 1612 | }
|
---|
[6792] | 1613 |
|
---|
[4023] | 1614 | out << QString(fmt)
|
---|
[5532] | 1615 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 1616 | .arg(double(dataSource), 19, 'e', 12)
|
---|
[6892] | 1617 | .arg(_TOEweek + 1024.0, 19, 'e', 12)
|
---|
[5532] | 1618 | .arg(0.0, 19, 'e', 12);
|
---|
[9788] | 1619 | // =====================
|
---|
| 1620 | // BROADCAST ORBIT - 6
|
---|
| 1621 | // =====================
|
---|
[4023] | 1622 | out << QString(fmt)
|
---|
[6798] | 1623 | .arg(_SISA, 19, 'e', 12)
|
---|
[6792] | 1624 | .arg(double(SVhealth), 19, 'e', 12)
|
---|
| 1625 | .arg(BGD_1_5A, 19, 'e', 12)
|
---|
| 1626 | .arg(BGD_1_5B, 19, 'e', 12);
|
---|
[9788] | 1627 | // =====================
|
---|
| 1628 | // BROADCAST ORBIT - 7
|
---|
| 1629 | // =====================
|
---|
[7922] | 1630 | double tot = _TOT;
|
---|
| 1631 | if (tot == 0.9999e9 && version < 3.0) {
|
---|
| 1632 | tot = 0.0;
|
---|
| 1633 | }
|
---|
[4023] | 1634 | out << QString(fmt)
|
---|
[7922] | 1635 | .arg(tot, 19, 'e', 12)
|
---|
[4024] | 1636 | .arg("", 19, QChar(' '))
|
---|
| 1637 | .arg("", 19, QChar(' '))
|
---|
| 1638 | .arg("", 19, QChar(' '));
|
---|
[4023] | 1639 |
|
---|
| 1640 | return rnxStr;
|
---|
| 1641 | }
|
---|
| 1642 |
|
---|
[6385] | 1643 | // Constructor
|
---|
| 1644 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 1645 | t_ephSBAS::t_ephSBAS(double rnxVersion, const QStringList& lines) {
|
---|
[6390] | 1646 |
|
---|
| 1647 | const int nLines = 4;
|
---|
| 1648 |
|
---|
| 1649 | if (lines.size() != nLines) {
|
---|
[6518] | 1650 | _checkState = bad;
|
---|
[6390] | 1651 | return;
|
---|
| 1652 | }
|
---|
| 1653 |
|
---|
| 1654 | // RINEX Format
|
---|
| 1655 | // ------------
|
---|
| 1656 | int fieldLen = 19;
|
---|
| 1657 |
|
---|
| 1658 | int pos[4];
|
---|
| 1659 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 1660 | pos[1] = pos[0] + fieldLen;
|
---|
| 1661 | pos[2] = pos[1] + fieldLen;
|
---|
| 1662 | pos[3] = pos[2] + fieldLen;
|
---|
| 1663 |
|
---|
| 1664 | // Read four lines
|
---|
| 1665 | // ---------------
|
---|
| 1666 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 1667 | QString line = lines[iLine];
|
---|
| 1668 |
|
---|
| 1669 | if ( iLine == 0 ) {
|
---|
[8204] | 1670 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6390] | 1671 |
|
---|
| 1672 | int year, month, day, hour, min;
|
---|
| 1673 | double sec;
|
---|
[6880] | 1674 |
|
---|
[7139] | 1675 | QString prnStr, n;
|
---|
[6880] | 1676 | in >> prnStr;
|
---|
[7639] | 1677 | if (prnStr.size() == 1 && prnStr[0] == 'S') {
|
---|
[7139] | 1678 | in >> n;
|
---|
| 1679 | prnStr.append(n);
|
---|
[6880] | 1680 | }
|
---|
| 1681 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6390] | 1682 | if (prnStr.at(0) == 'S') {
|
---|
| 1683 | _prn.set('S', prnStr.mid(1).toInt());
|
---|
| 1684 | }
|
---|
| 1685 | else {
|
---|
| 1686 | _prn.set('S', prnStr.toInt());
|
---|
| 1687 | }
|
---|
| 1688 |
|
---|
| 1689 | if (year < 80) {
|
---|
| 1690 | year += 2000;
|
---|
| 1691 | }
|
---|
| 1692 | else if (year < 100) {
|
---|
| 1693 | year += 1900;
|
---|
| 1694 | }
|
---|
| 1695 |
|
---|
| 1696 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 1697 |
|
---|
| 1698 | if ( readDbl(line, pos[1], fieldLen, _agf0 ) ||
|
---|
| 1699 | readDbl(line, pos[2], fieldLen, _agf1 ) ||
|
---|
[8456] | 1700 | readDbl(line, pos[3], fieldLen, _TOT ) ) {
|
---|
[6518] | 1701 | _checkState = bad;
|
---|
[6390] | 1702 | return;
|
---|
| 1703 | }
|
---|
| 1704 | }
|
---|
[9788] | 1705 | // =====================
|
---|
| 1706 | // BROADCAST ORBIT - 1
|
---|
| 1707 | // =====================
|
---|
[6390] | 1708 | else if ( iLine == 1 ) {
|
---|
| 1709 | if ( readDbl(line, pos[0], fieldLen, _x_pos ) ||
|
---|
| 1710 | readDbl(line, pos[1], fieldLen, _x_velocity ) ||
|
---|
| 1711 | readDbl(line, pos[2], fieldLen, _x_acceleration) ||
|
---|
| 1712 | readDbl(line, pos[3], fieldLen, _health ) ) {
|
---|
[6518] | 1713 | _checkState = bad;
|
---|
[6390] | 1714 | return;
|
---|
| 1715 | }
|
---|
| 1716 | }
|
---|
[9788] | 1717 | // =====================
|
---|
| 1718 | // BROADCAST ORBIT - 2
|
---|
| 1719 | // =====================
|
---|
[6390] | 1720 | else if ( iLine == 2 ) {
|
---|
| 1721 | if ( readDbl(line, pos[0], fieldLen, _y_pos ) ||
|
---|
| 1722 | readDbl(line, pos[1], fieldLen, _y_velocity ) ||
|
---|
| 1723 | readDbl(line, pos[2], fieldLen, _y_acceleration ) ||
|
---|
| 1724 | readDbl(line, pos[3], fieldLen, _ura ) ) {
|
---|
[6518] | 1725 | _checkState = bad;
|
---|
[6390] | 1726 | return;
|
---|
| 1727 | }
|
---|
| 1728 | }
|
---|
[9788] | 1729 | // =====================
|
---|
| 1730 | // BROADCAST ORBIT - 3
|
---|
| 1731 | // =====================
|
---|
[6390] | 1732 | else if ( iLine == 3 ) {
|
---|
[6536] | 1733 | double iodn;
|
---|
[6390] | 1734 | if ( readDbl(line, pos[0], fieldLen, _z_pos ) ||
|
---|
| 1735 | readDbl(line, pos[1], fieldLen, _z_velocity ) ||
|
---|
| 1736 | readDbl(line, pos[2], fieldLen, _z_acceleration) ||
|
---|
[6536] | 1737 | readDbl(line, pos[3], fieldLen, iodn ) ) {
|
---|
[6518] | 1738 | _checkState = bad;
|
---|
[6390] | 1739 | return;
|
---|
[6891] | 1740 | } else {
|
---|
[6536] | 1741 | _IODN = int(iodn);
|
---|
[6390] | 1742 | }
|
---|
| 1743 | }
|
---|
| 1744 | }
|
---|
| 1745 |
|
---|
[7278] | 1746 | _x_pos *= 1.e3;
|
---|
| 1747 | _y_pos *= 1.e3;
|
---|
| 1748 | _z_pos *= 1.e3;
|
---|
| 1749 | _x_velocity *= 1.e3;
|
---|
| 1750 | _y_velocity *= 1.e3;
|
---|
| 1751 | _z_velocity *= 1.e3;
|
---|
| 1752 | _x_acceleration *= 1.e3;
|
---|
| 1753 | _y_acceleration *= 1.e3;
|
---|
| 1754 | _z_acceleration *= 1.e3;
|
---|
[6385] | 1755 | }
|
---|
| 1756 |
|
---|
[7054] | 1757 | // IOD of SBAS Ephemeris (virtual)
|
---|
| 1758 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1759 |
|
---|
[7169] | 1760 | unsigned int t_ephSBAS::IOD() const {
|
---|
[7054] | 1761 | unsigned char buffer[80];
|
---|
| 1762 | int size = 0;
|
---|
| 1763 | int numbits = 0;
|
---|
| 1764 | long long bitbuffer = 0;
|
---|
| 1765 | unsigned char *startbuffer = buffer;
|
---|
| 1766 |
|
---|
| 1767 | SBASADDBITSFLOAT(30, this->_x_pos, 0.08)
|
---|
| 1768 | SBASADDBITSFLOAT(30, this->_y_pos, 0.08)
|
---|
| 1769 | SBASADDBITSFLOAT(25, this->_z_pos, 0.4)
|
---|
| 1770 | SBASADDBITSFLOAT(17, this->_x_velocity, 0.000625)
|
---|
| 1771 | SBASADDBITSFLOAT(17, this->_y_velocity, 0.000625)
|
---|
| 1772 | SBASADDBITSFLOAT(18, this->_z_velocity, 0.004)
|
---|
| 1773 | SBASADDBITSFLOAT(10, this->_x_acceleration, 0.0000125)
|
---|
| 1774 | SBASADDBITSFLOAT(10, this->_y_acceleration, 0.0000125)
|
---|
| 1775 | SBASADDBITSFLOAT(10, this->_z_acceleration, 0.0000625)
|
---|
| 1776 | SBASADDBITSFLOAT(12, this->_agf0, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
|
---|
| 1777 | SBASADDBITSFLOAT(8, this->_agf1, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
|
---|
| 1778 | SBASADDBITS(5,0); // the last byte is filled by 0-bits to obtain a length of an integer multiple of 8
|
---|
| 1779 |
|
---|
| 1780 | return CRC24(size, startbuffer);
|
---|
| 1781 | }
|
---|
| 1782 |
|
---|
[6385] | 1783 | // Compute SBAS Satellite Position (virtual)
|
---|
| 1784 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1785 | t_irc t_ephSBAS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[6386] | 1786 |
|
---|
| 1787 | bncTime tt(GPSweek, GPSweeks);
|
---|
| 1788 | double dt = tt - _TOC;
|
---|
| 1789 |
|
---|
[7278] | 1790 | xc[0] = _x_pos + _x_velocity * dt + _x_acceleration * dt * dt / 2.0;
|
---|
| 1791 | xc[1] = _y_pos + _y_velocity * dt + _y_acceleration * dt * dt / 2.0;
|
---|
| 1792 | xc[2] = _z_pos + _z_velocity * dt + _z_acceleration * dt * dt / 2.0;
|
---|
[6386] | 1793 |
|
---|
| 1794 | vv[0] = _x_velocity + _x_acceleration * dt;
|
---|
| 1795 | vv[1] = _y_velocity + _y_acceleration * dt;
|
---|
| 1796 | vv[2] = _z_velocity + _z_acceleration * dt;
|
---|
| 1797 |
|
---|
| 1798 | xc[3] = _agf0 + _agf1 * dt;
|
---|
| 1799 |
|
---|
[8542] | 1800 | xc[4] = _agf1;
|
---|
| 1801 | xc[5] = 0.0;
|
---|
[8483] | 1802 |
|
---|
[6386] | 1803 | return success;
|
---|
[6385] | 1804 | }
|
---|
| 1805 |
|
---|
[9774] | 1806 | // Health status of SBAS Ephemeris (virtual)
|
---|
| 1807 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1808 | unsigned int t_ephSBAS::isUnhealthy() const {
|
---|
| 1809 |
|
---|
| 1810 | // Bit 5
|
---|
| 1811 | bool URAindexIs15 = (int(_health) & (1<<5));
|
---|
| 1812 | if (URAindexIs15) {
|
---|
| 1813 | // in this case it is recommended
|
---|
| 1814 | // to set the bits 0,1,2,3 to 1 (MT17health = 15)
|
---|
| 1815 | return 1;
|
---|
| 1816 | }
|
---|
| 1817 |
|
---|
| 1818 | // Bit 0-3
|
---|
| 1819 | int MT17health = (int(_health)) & (0x0f);
|
---|
| 1820 | if (MT17health) {
|
---|
| 1821 | return 1;
|
---|
| 1822 | }
|
---|
| 1823 |
|
---|
| 1824 | // Bit 4
|
---|
| 1825 | // bool MT17HealthIsUnavailable = (int(_health) & (1<<4));
|
---|
| 1826 | // is not used because the MT17health bits can be independently set if URA index is 15
|
---|
| 1827 |
|
---|
| 1828 | return 0;
|
---|
| 1829 | }
|
---|
| 1830 |
|
---|
| 1831 |
|
---|
[6385] | 1832 | // RINEX Format String
|
---|
| 1833 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6388] | 1834 | QString t_ephSBAS::toString(double version) const {
|
---|
| 1835 |
|
---|
[9765] | 1836 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 1837 | QString rnxStr = navStr + rinexDateStr(_TOC, _prn, version);
|
---|
[6388] | 1838 |
|
---|
| 1839 | QTextStream out(&rnxStr);
|
---|
| 1840 |
|
---|
| 1841 | out << QString("%1%2%3\n")
|
---|
[6390] | 1842 | .arg(_agf0, 19, 'e', 12)
|
---|
| 1843 | .arg(_agf1, 19, 'e', 12)
|
---|
[8456] | 1844 | .arg(_TOT, 19, 'e', 12);
|
---|
[6388] | 1845 |
|
---|
| 1846 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 1847 | // =====================
|
---|
| 1848 | // BROADCAST ORBIT - 1
|
---|
| 1849 | // =====================
|
---|
[6388] | 1850 | out << QString(fmt)
|
---|
| 1851 | .arg(1.e-3*_x_pos, 19, 'e', 12)
|
---|
| 1852 | .arg(1.e-3*_x_velocity, 19, 'e', 12)
|
---|
| 1853 | .arg(1.e-3*_x_acceleration, 19, 'e', 12)
|
---|
[6390] | 1854 | .arg(_health, 19, 'e', 12);
|
---|
[9788] | 1855 | // =====================
|
---|
| 1856 | // BROADCAST ORBIT - 2
|
---|
| 1857 | // =====================
|
---|
[6388] | 1858 | out << QString(fmt)
|
---|
| 1859 | .arg(1.e-3*_y_pos, 19, 'e', 12)
|
---|
| 1860 | .arg(1.e-3*_y_velocity, 19, 'e', 12)
|
---|
| 1861 | .arg(1.e-3*_y_acceleration, 19, 'e', 12)
|
---|
[6390] | 1862 | .arg(_ura, 19, 'e', 12);
|
---|
[9788] | 1863 | // =====================
|
---|
| 1864 | // BROADCAST ORBIT - 3
|
---|
| 1865 | // =====================
|
---|
[6388] | 1866 | out << QString(fmt)
|
---|
| 1867 | .arg(1.e-3*_z_pos, 19, 'e', 12)
|
---|
| 1868 | .arg(1.e-3*_z_velocity, 19, 'e', 12)
|
---|
| 1869 | .arg(1.e-3*_z_acceleration, 19, 'e', 12)
|
---|
[6536] | 1870 | .arg(double(_IODN), 19, 'e', 12);
|
---|
[6388] | 1871 |
|
---|
| 1872 | return rnxStr;
|
---|
[6385] | 1873 | }
|
---|
[6400] | 1874 |
|
---|
| 1875 | // Constructor
|
---|
| 1876 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 1877 | t_ephBDS::t_ephBDS(double rnxVersion, const QStringList& lines) {
|
---|
[6400] | 1878 |
|
---|
[9788] | 1879 | int nLines = 8;
|
---|
[6400] | 1880 |
|
---|
[9788] | 1881 | if (navType() == t_eph::CNV1 ||
|
---|
| 1882 | navType() == t_eph::CNV2) {
|
---|
| 1883 | nLines += 2;
|
---|
| 1884 | }
|
---|
| 1885 | if (navType() == t_eph::CNV3) {
|
---|
| 1886 | nLines += 1;
|
---|
| 1887 | }
|
---|
| 1888 |
|
---|
[6400] | 1889 | if (lines.size() != nLines) {
|
---|
[6518] | 1890 | _checkState = bad;
|
---|
[6400] | 1891 | return;
|
---|
| 1892 | }
|
---|
| 1893 |
|
---|
| 1894 | // RINEX Format
|
---|
| 1895 | // ------------
|
---|
| 1896 | int fieldLen = 19;
|
---|
| 1897 |
|
---|
| 1898 | int pos[4];
|
---|
| 1899 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 1900 | pos[1] = pos[0] + fieldLen;
|
---|
| 1901 | pos[2] = pos[1] + fieldLen;
|
---|
| 1902 | pos[3] = pos[2] + fieldLen;
|
---|
| 1903 |
|
---|
| 1904 | // Read eight lines
|
---|
| 1905 | // ----------------
|
---|
| 1906 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 1907 | QString line = lines[iLine];
|
---|
| 1908 |
|
---|
| 1909 | if ( iLine == 0 ) {
|
---|
[8204] | 1910 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6400] | 1911 |
|
---|
| 1912 | int year, month, day, hour, min;
|
---|
| 1913 | double sec;
|
---|
[6880] | 1914 |
|
---|
[7139] | 1915 | QString prnStr, n;
|
---|
[6880] | 1916 | in >> prnStr;
|
---|
[7639] | 1917 | if (prnStr.size() == 1 && prnStr[0] == 'C') {
|
---|
[7139] | 1918 | in >> n;
|
---|
| 1919 | prnStr.append(n);
|
---|
[6880] | 1920 | }
|
---|
| 1921 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6400] | 1922 | if (prnStr.at(0) == 'C') {
|
---|
| 1923 | _prn.set('C', prnStr.mid(1).toInt());
|
---|
| 1924 | }
|
---|
| 1925 | else {
|
---|
| 1926 | _prn.set('C', prnStr.toInt());
|
---|
| 1927 | }
|
---|
| 1928 |
|
---|
| 1929 | if (year < 80) {
|
---|
| 1930 | year += 2000;
|
---|
| 1931 | }
|
---|
| 1932 | else if (year < 100) {
|
---|
| 1933 | year += 1900;
|
---|
| 1934 | }
|
---|
| 1935 |
|
---|
[6812] | 1936 | _TOC.setBDS(year, month, day, hour, min, sec);
|
---|
[6400] | 1937 |
|
---|
| 1938 | if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
|
---|
| 1939 | readDbl(line, pos[2], fieldLen, _clock_drift ) ||
|
---|
| 1940 | readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
|
---|
[6518] | 1941 | _checkState = bad;
|
---|
[6400] | 1942 | return;
|
---|
| 1943 | }
|
---|
| 1944 | }
|
---|
[9788] | 1945 | // =====================
|
---|
| 1946 | // BROADCAST ORBIT - 1
|
---|
| 1947 | // =====================
|
---|
[6400] | 1948 | else if ( iLine == 1 ) {
|
---|
| 1949 | double aode;
|
---|
| 1950 | if ( readDbl(line, pos[0], fieldLen, aode ) ||
|
---|
| 1951 | readDbl(line, pos[1], fieldLen, _Crs ) ||
|
---|
| 1952 | readDbl(line, pos[2], fieldLen, _Delta_n) ||
|
---|
| 1953 | readDbl(line, pos[3], fieldLen, _M0 ) ) {
|
---|
[6518] | 1954 | _checkState = bad;
|
---|
[6400] | 1955 | return;
|
---|
| 1956 | }
|
---|
| 1957 | _AODE = int(aode);
|
---|
| 1958 | }
|
---|
[9788] | 1959 | // =====================
|
---|
| 1960 | // BROADCAST ORBIT - 2
|
---|
| 1961 | // =====================
|
---|
[6400] | 1962 | else if ( iLine == 2 ) {
|
---|
| 1963 | if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
|
---|
| 1964 | readDbl(line, pos[1], fieldLen, _e ) ||
|
---|
| 1965 | readDbl(line, pos[2], fieldLen, _Cus ) ||
|
---|
| 1966 | readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
|
---|
[6518] | 1967 | _checkState = bad;
|
---|
[6400] | 1968 | return;
|
---|
| 1969 | }
|
---|
| 1970 | }
|
---|
[9788] | 1971 | // =====================
|
---|
| 1972 | // BROADCAST ORBIT - 3
|
---|
| 1973 | // =====================
|
---|
[6400] | 1974 | else if ( iLine == 3 ) {
|
---|
[6812] | 1975 | if ( readDbl(line, pos[0], fieldLen, _TOEsec ) ||
|
---|
[6400] | 1976 | readDbl(line, pos[1], fieldLen, _Cic ) ||
|
---|
| 1977 | readDbl(line, pos[2], fieldLen, _OMEGA0) ||
|
---|
| 1978 | readDbl(line, pos[3], fieldLen, _Cis ) ) {
|
---|
[6518] | 1979 | _checkState = bad;
|
---|
[6400] | 1980 | return;
|
---|
| 1981 | }
|
---|
| 1982 | }
|
---|
[9788] | 1983 | // =====================
|
---|
| 1984 | // BROADCAST ORBIT - 4
|
---|
| 1985 | // =====================
|
---|
[6400] | 1986 | else if ( iLine == 4 ) {
|
---|
| 1987 | if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
|
---|
| 1988 | readDbl(line, pos[1], fieldLen, _Crc ) ||
|
---|
| 1989 | readDbl(line, pos[2], fieldLen, _omega ) ||
|
---|
| 1990 | readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
|
---|
[6518] | 1991 | _checkState = bad;
|
---|
[6400] | 1992 | return;
|
---|
| 1993 | }
|
---|
| 1994 | }
|
---|
[9788] | 1995 | // =====================
|
---|
| 1996 | // BROADCAST ORBIT - 5
|
---|
| 1997 | // =====================
|
---|
| 1998 | else if ( iLine == 5 ) {
|
---|
[6400] | 1999 |
|
---|
[9788] | 2000 | if (navType() == t_eph::CNV1 ||
|
---|
| 2001 | navType() == t_eph::CNV2 ||
|
---|
| 2002 | navType() == t_eph::CNV3 ) {
|
---|
| 2003 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 2004 | readDbl(line, pos[1], fieldLen, _Delta_n_dot) ||
|
---|
| 2005 | readDbl(line, pos[2], fieldLen, _satType ) ||
|
---|
| 2006 | readDbl(line, pos[3], fieldLen, _top ) ) {
|
---|
| 2007 | _checkState = bad;
|
---|
| 2008 | return;
|
---|
| 2009 | }
|
---|
[6400] | 2010 | }
|
---|
[9788] | 2011 | else { // D1, D2, undefined
|
---|
| 2012 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 2013 | readDbl(line, pos[2], fieldLen, _BDTweek)) {
|
---|
| 2014 | _checkState = bad;
|
---|
| 2015 | return;
|
---|
| 2016 | }
|
---|
| 2017 | }
|
---|
[6400] | 2018 | }
|
---|
[9788] | 2019 | // =====================
|
---|
| 2020 | // BROADCAST ORBIT - 6
|
---|
| 2021 | // =====================
|
---|
[6400] | 2022 | else if ( iLine == 6 ) {
|
---|
[9788] | 2023 | if (navType() == t_eph::CNV1 ||
|
---|
| 2024 | navType() == t_eph::CNV2 ||
|
---|
| 2025 | navType() == t_eph::CNV3 ) {
|
---|
| 2026 | if ( readDbl(line, pos[0], fieldLen, _SISAI_oe ) ||
|
---|
| 2027 | readDbl(line, pos[1], fieldLen, _SISAI_ocb ) ||
|
---|
| 2028 | readDbl(line, pos[2], fieldLen, _SISAI_oc1 ) ||
|
---|
| 2029 | readDbl(line, pos[3], fieldLen, _SISAI_oc2 ) ) {
|
---|
| 2030 | _checkState = bad;
|
---|
| 2031 | return;
|
---|
| 2032 | }
|
---|
[6400] | 2033 | }
|
---|
[9788] | 2034 | else { // D1, D2, undefined
|
---|
| 2035 | double SatH1;
|
---|
| 2036 | if ( readDbl(line, pos[0], fieldLen, _URA ) ||
|
---|
| 2037 | readDbl(line, pos[1], fieldLen, SatH1) ||
|
---|
| 2038 | readDbl(line, pos[2], fieldLen, _TGD1) ||
|
---|
| 2039 | readDbl(line, pos[3], fieldLen, _TGD2) ) {
|
---|
| 2040 | _checkState = bad;
|
---|
| 2041 | return;
|
---|
| 2042 | }
|
---|
| 2043 | _SatH1 = int(SatH1);
|
---|
| 2044 | }
|
---|
[6400] | 2045 | }
|
---|
[9788] | 2046 | // =====================
|
---|
| 2047 | // BROADCAST ORBIT - 7
|
---|
| 2048 | // =====================
|
---|
[6400] | 2049 | else if ( iLine == 7 ) {
|
---|
[9788] | 2050 | if (navType() == t_eph::CNV1) {
|
---|
| 2051 | if ( readDbl(line, pos[0], fieldLen, _ISC_B1Cd) ||
|
---|
| 2052 | readDbl(line, pos[2], fieldLen, _TGD_B1Cp) ||
|
---|
| 2053 | readDbl(line, pos[3], fieldLen, _TGD_B2ap) ) {
|
---|
| 2054 | _checkState = bad;
|
---|
| 2055 | return;
|
---|
| 2056 | }
|
---|
[6400] | 2057 | }
|
---|
[9788] | 2058 | else if (navType() == t_eph::CNV2) {
|
---|
| 2059 | if ( readDbl(line, pos[1], fieldLen, _ISC_B2ad) ||
|
---|
| 2060 | readDbl(line, pos[2], fieldLen, _TGD_B1Cp) ||
|
---|
| 2061 | readDbl(line, pos[3], fieldLen, _TGD_B2ap) ) {
|
---|
| 2062 | _checkState = bad;
|
---|
| 2063 | return;
|
---|
| 2064 | }
|
---|
[6400] | 2065 | }
|
---|
[9788] | 2066 | else if (navType() == t_eph::CNV3) {
|
---|
| 2067 | if ( readDbl(line, pos[0], fieldLen, _SISMAI ) ||
|
---|
| 2068 | readDbl(line, pos[1], fieldLen, _health ) ||
|
---|
| 2069 | readDbl(line, pos[2], fieldLen, _INTEGRITYF_B2b) ||
|
---|
| 2070 | readDbl(line, pos[3], fieldLen, _TGD_B2bI) ) {
|
---|
| 2071 | _checkState = bad;
|
---|
| 2072 | return;
|
---|
| 2073 | }
|
---|
| 2074 | }
|
---|
| 2075 | else { // D1, D2 or undefined
|
---|
| 2076 | double aodc;
|
---|
| 2077 | if ( readDbl(line, pos[0], fieldLen, _TOT) ||
|
---|
| 2078 | readDbl(line, pos[1], fieldLen, aodc) ) {
|
---|
| 2079 | _checkState = bad;
|
---|
| 2080 | return;
|
---|
| 2081 | }
|
---|
| 2082 | if (_TOT == 0.9999e9) { // 0.9999e9 means not known (RINEX standard)
|
---|
| 2083 | _TOT = _TOEsec;
|
---|
| 2084 | }
|
---|
| 2085 | _AODC = int(aodc);
|
---|
| 2086 | }
|
---|
[6400] | 2087 | }
|
---|
[9788] | 2088 | // =====================
|
---|
| 2089 | // BROADCAST ORBIT - 8
|
---|
| 2090 | // =====================
|
---|
| 2091 | else if ( iLine == 8 ) {
|
---|
| 2092 |
|
---|
| 2093 | if (navType() == t_eph::CNV1) {
|
---|
| 2094 | if ( readDbl(line, pos[0], fieldLen, _SISMAI ) ||
|
---|
| 2095 | readDbl(line, pos[1], fieldLen, _health ) ||
|
---|
| 2096 | readDbl(line, pos[2], fieldLen, _INTEGRITYF_B1C) ||
|
---|
| 2097 | readDbl(line, pos[3], fieldLen, _IODC) ) {
|
---|
| 2098 | _checkState = bad;
|
---|
| 2099 | return;
|
---|
| 2100 | }
|
---|
| 2101 | }
|
---|
| 2102 | else if (navType() == t_eph::CNV2) {
|
---|
| 2103 | if ( readDbl(line, pos[0], fieldLen, _SISMAI ) ||
|
---|
| 2104 | readDbl(line, pos[1], fieldLen, _health ) ||
|
---|
| 2105 | readDbl(line, pos[2], fieldLen, _INTEGRITYF_B2aB1C) ||
|
---|
| 2106 | readDbl(line, pos[3], fieldLen, _IODC) ) {
|
---|
| 2107 | _checkState = bad;
|
---|
| 2108 | return;
|
---|
| 2109 | }
|
---|
| 2110 | }
|
---|
| 2111 | else if (navType() == t_eph::CNV3) {
|
---|
| 2112 | if ( readDbl(line, pos[0], fieldLen, _TOT)) {
|
---|
| 2113 | _checkState = bad;
|
---|
| 2114 | return;
|
---|
| 2115 | }
|
---|
| 2116 | }
|
---|
| 2117 |
|
---|
| 2118 | }
|
---|
| 2119 | // =====================
|
---|
| 2120 | // BROADCAST ORBIT - 9
|
---|
| 2121 | // =====================
|
---|
| 2122 | else if ( iLine == 9 ) {
|
---|
| 2123 |
|
---|
| 2124 | if (navType() == t_eph::CNV1 ||
|
---|
| 2125 | navType() == t_eph::CNV2) {
|
---|
| 2126 | if ( readDbl(line, pos[0], fieldLen, _TOT) ||
|
---|
| 2127 | readDbl(line, pos[3], fieldLen, _IODE) ) {
|
---|
| 2128 | _checkState = bad;
|
---|
| 2129 | return;
|
---|
| 2130 | }
|
---|
| 2131 | }
|
---|
| 2132 |
|
---|
| 2133 | }
|
---|
[6400] | 2134 | }
|
---|
| 2135 |
|
---|
[9788] | 2136 | _TOE.setBDS(int(_BDTweek), _TOEsec);
|
---|
[6400] | 2137 | // remark: actually should be computed from second_tot
|
---|
| 2138 | // but it seems to be unreliable in RINEX files
|
---|
[6843] | 2139 | //_TOT = _TOC.bdssec();
|
---|
[6400] | 2140 | }
|
---|
| 2141 |
|
---|
[7054] | 2142 | // IOD of BDS Ephemeris (virtual)
|
---|
| 2143 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7169] | 2144 | unsigned int t_ephBDS::IOD() const {
|
---|
[8410] | 2145 | return (int(_TOEsec)/720) % 240;
|
---|
[7054] | 2146 | }
|
---|
| 2147 |
|
---|
[6601] | 2148 | // Compute BDS Satellite Position (virtual)
|
---|
[6400] | 2149 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6600] | 2150 | t_irc t_ephBDS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[6400] | 2151 |
|
---|
[6602] | 2152 | static const double gmBDS = 398.6004418e12;
|
---|
| 2153 | static const double omegaBDS = 7292115.0000e-11;
|
---|
[6400] | 2154 |
|
---|
| 2155 | xc[0] = xc[1] = xc[2] = xc[3] = 0.0;
|
---|
| 2156 | vv[0] = vv[1] = vv[2] = 0.0;
|
---|
| 2157 |
|
---|
| 2158 | bncTime tt(GPSweek, GPSweeks);
|
---|
| 2159 |
|
---|
| 2160 | if (_sqrt_A == 0) {
|
---|
| 2161 | return failure;
|
---|
| 2162 | }
|
---|
| 2163 | double a0 = _sqrt_A * _sqrt_A;
|
---|
| 2164 |
|
---|
[6602] | 2165 | double n0 = sqrt(gmBDS/(a0*a0*a0));
|
---|
[6400] | 2166 | double tk = tt - _TOE;
|
---|
| 2167 | double n = n0 + _Delta_n;
|
---|
| 2168 | double M = _M0 + n*tk;
|
---|
| 2169 | double E = M;
|
---|
| 2170 | double E_last;
|
---|
| 2171 | int nLoop = 0;
|
---|
| 2172 | do {
|
---|
| 2173 | E_last = E;
|
---|
| 2174 | E = M + _e*sin(E);
|
---|
| 2175 |
|
---|
| 2176 | if (++nLoop == 100) {
|
---|
| 2177 | return failure;
|
---|
| 2178 | }
|
---|
| 2179 | } while ( fabs(E-E_last)*a0 > 0.001 );
|
---|
| 2180 |
|
---|
| 2181 | double v = atan2(sqrt(1-_e*_e) * sin(E), cos(E) - _e);
|
---|
| 2182 | double u0 = v + _omega;
|
---|
| 2183 | double sin2u0 = sin(2*u0);
|
---|
| 2184 | double cos2u0 = cos(2*u0);
|
---|
| 2185 | double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
|
---|
| 2186 | double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
|
---|
| 2187 | double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
|
---|
| 2188 | double xp = r*cos(u);
|
---|
| 2189 | double yp = r*sin(u);
|
---|
| 2190 | double toesec = (_TOE.gpssec() - 14.0);
|
---|
| 2191 | double sinom = 0;
|
---|
| 2192 | double cosom = 0;
|
---|
| 2193 | double sini = 0;
|
---|
| 2194 | double cosi = 0;
|
---|
[7278] | 2195 |
|
---|
[7481] | 2196 | // Velocity
|
---|
| 2197 | // --------
|
---|
| 2198 | double tanv2 = tan(v/2);
|
---|
| 2199 | double dEdM = 1 / (1 - _e*cos(E));
|
---|
| 2200 | double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2)
|
---|
| 2201 | / (1 + tanv2*tanv2) * dEdM * n;
|
---|
| 2202 | double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
|
---|
| 2203 | double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
|
---|
| 2204 | double dotr = a0 * _e*sin(E) * dEdM * n
|
---|
| 2205 | + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
|
---|
| 2206 |
|
---|
| 2207 | double dotx = dotr*cos(u) - r*sin(u)*dotu;
|
---|
| 2208 | double doty = dotr*sin(u) + r*cos(u)*dotu;
|
---|
| 2209 |
|
---|
[6400] | 2210 | const double iMaxGEO = 10.0 / 180.0 * M_PI;
|
---|
| 2211 |
|
---|
| 2212 | // MEO/IGSO satellite
|
---|
| 2213 | // ------------------
|
---|
| 2214 | if (_i0 > iMaxGEO) {
|
---|
[6602] | 2215 | double OM = _OMEGA0 + (_OMEGADOT - omegaBDS)*tk - omegaBDS*toesec;
|
---|
[6400] | 2216 |
|
---|
| 2217 | sinom = sin(OM);
|
---|
| 2218 | cosom = cos(OM);
|
---|
| 2219 | sini = sin(i);
|
---|
| 2220 | cosi = cos(i);
|
---|
| 2221 |
|
---|
| 2222 | xc[0] = xp*cosom - yp*cosi*sinom;
|
---|
| 2223 | xc[1] = xp*sinom + yp*cosi*cosom;
|
---|
[7278] | 2224 | xc[2] = yp*sini;
|
---|
[7481] | 2225 |
|
---|
| 2226 | // Velocity
|
---|
| 2227 | // --------
|
---|
| 2228 |
|
---|
| 2229 | double dotom = _OMEGADOT - t_CST::omega;
|
---|
| 2230 |
|
---|
| 2231 | vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
|
---|
| 2232 | - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
|
---|
| 2233 | + yp*sini*sinom*doti; // dX / di
|
---|
| 2234 |
|
---|
| 2235 | vv[1] = sinom *dotx + cosi*cosom *doty
|
---|
| 2236 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 2237 | - yp*sini*cosom*doti;
|
---|
| 2238 |
|
---|
| 2239 | vv[2] = sini *doty + yp*cosi *doti;
|
---|
| 2240 |
|
---|
[6400] | 2241 | }
|
---|
| 2242 |
|
---|
| 2243 | // GEO satellite
|
---|
| 2244 | // -------------
|
---|
| 2245 | else {
|
---|
[6602] | 2246 | double OM = _OMEGA0 + _OMEGADOT*tk - omegaBDS*toesec;
|
---|
| 2247 | double ll = omegaBDS*tk;
|
---|
[6400] | 2248 |
|
---|
| 2249 | sinom = sin(OM);
|
---|
| 2250 | cosom = cos(OM);
|
---|
| 2251 | sini = sin(i);
|
---|
| 2252 | cosi = cos(i);
|
---|
| 2253 |
|
---|
| 2254 | double xx = xp*cosom - yp*cosi*sinom;
|
---|
| 2255 | double yy = xp*sinom + yp*cosi*cosom;
|
---|
[7278] | 2256 | double zz = yp*sini;
|
---|
[6400] | 2257 |
|
---|
[7487] | 2258 | Matrix RX = BNC_PPP::t_astro::rotX(-5.0 / 180.0 * M_PI);
|
---|
| 2259 | Matrix RZ = BNC_PPP::t_astro::rotZ(ll);
|
---|
[6400] | 2260 |
|
---|
| 2261 | ColumnVector X1(3); X1 << xx << yy << zz;
|
---|
[7487] | 2262 | ColumnVector X2 = RZ*RX*X1;
|
---|
[6400] | 2263 |
|
---|
| 2264 | xc[0] = X2(1);
|
---|
| 2265 | xc[1] = X2(2);
|
---|
| 2266 | xc[2] = X2(3);
|
---|
[7278] | 2267 |
|
---|
[7481] | 2268 | double dotom = _OMEGADOT;
|
---|
[6400] | 2269 |
|
---|
[7481] | 2270 | double vx = cosom *dotx - cosi*sinom *doty
|
---|
| 2271 | - xp*sinom*dotom - yp*cosi*cosom*dotom
|
---|
| 2272 | + yp*sini*sinom*doti;
|
---|
[6400] | 2273 |
|
---|
[7481] | 2274 | double vy = sinom *dotx + cosi*cosom *doty
|
---|
| 2275 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 2276 | - yp*sini*cosom*doti;
|
---|
[7278] | 2277 |
|
---|
[7501] | 2278 | double vz = sini *doty + yp*cosi *doti;
|
---|
[6400] | 2279 |
|
---|
[7501] | 2280 | ColumnVector V(3); V << vx << vy << vz;
|
---|
[7481] | 2281 |
|
---|
[7487] | 2282 | Matrix RdotZ(3,3);
|
---|
[7481] | 2283 | double C = cos(ll);
|
---|
| 2284 | double S = sin(ll);
|
---|
| 2285 | Matrix UU(3,3);
|
---|
| 2286 | UU[0][0] = -S; UU[0][1] = +C; UU[0][2] = 0.0;
|
---|
| 2287 | UU[1][0] = -C; UU[1][1] = -S; UU[1][2] = 0.0;
|
---|
| 2288 | UU[2][0] = 0.0; UU[2][1] = 0.0; UU[2][2] = 0.0;
|
---|
[7487] | 2289 | RdotZ = omegaBDS * UU;
|
---|
[7481] | 2290 |
|
---|
| 2291 | ColumnVector VV(3);
|
---|
[7487] | 2292 | VV = RZ*RX*V + RdotZ*RX*X1;
|
---|
[7481] | 2293 |
|
---|
| 2294 | vv[0] = VV(1);
|
---|
| 2295 | vv[1] = VV(2);
|
---|
| 2296 | vv[2] = VV(3);
|
---|
| 2297 | }
|
---|
| 2298 |
|
---|
| 2299 | double tc = tt - _TOC;
|
---|
| 2300 | xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
|
---|
| 2301 |
|
---|
[9132] | 2302 | // dotC = _clock_drift + _clock_driftrate*tc
|
---|
[9290] | 2303 | // - 4.442807309e-10*_e * sqrt(a0) * cos(E) * dEdM * n;
|
---|
[6400] | 2304 |
|
---|
[7481] | 2305 | // Relativistic Correction
|
---|
| 2306 | // -----------------------
|
---|
[9290] | 2307 | xc[3] -= 4.442807309e-10 * _e * sqrt(a0) *sin(E);
|
---|
[7481] | 2308 |
|
---|
[8542] | 2309 | xc[4] = _clock_drift + _clock_driftrate*tc;
|
---|
| 2310 | xc[5] = _clock_driftrate;
|
---|
[9126] | 2311 |
|
---|
[6400] | 2312 | return success;
|
---|
| 2313 | }
|
---|
| 2314 |
|
---|
| 2315 | // RINEX Format String
|
---|
| 2316 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6600] | 2317 | QString t_ephBDS::toString(double version) const {
|
---|
[8419] | 2318 |
|
---|
[9765] | 2319 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 2320 | QString rnxStr = navStr + rinexDateStr(_TOC-14.0, _prn, version);
|
---|
[6400] | 2321 |
|
---|
| 2322 | QTextStream out(&rnxStr);
|
---|
| 2323 |
|
---|
| 2324 | out << QString("%1%2%3\n")
|
---|
| 2325 | .arg(_clock_bias, 19, 'e', 12)
|
---|
| 2326 | .arg(_clock_drift, 19, 'e', 12)
|
---|
| 2327 | .arg(_clock_driftrate, 19, 'e', 12);
|
---|
| 2328 |
|
---|
| 2329 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 2330 | // =====================
|
---|
| 2331 | // BROADCAST ORBIT - 1
|
---|
| 2332 | // =====================
|
---|
[6400] | 2333 | out << QString(fmt)
|
---|
| 2334 | .arg(double(_AODE), 19, 'e', 12)
|
---|
| 2335 | .arg(_Crs, 19, 'e', 12)
|
---|
| 2336 | .arg(_Delta_n, 19, 'e', 12)
|
---|
| 2337 | .arg(_M0, 19, 'e', 12);
|
---|
[9788] | 2338 | // =====================
|
---|
| 2339 | // BROADCAST ORBIT - 2
|
---|
| 2340 | // =====================
|
---|
[6400] | 2341 | out << QString(fmt)
|
---|
| 2342 | .arg(_Cuc, 19, 'e', 12)
|
---|
| 2343 | .arg(_e, 19, 'e', 12)
|
---|
| 2344 | .arg(_Cus, 19, 'e', 12)
|
---|
| 2345 | .arg(_sqrt_A, 19, 'e', 12);
|
---|
[9788] | 2346 | // =====================
|
---|
| 2347 | // BROADCAST ORBIT - 3
|
---|
| 2348 | // =====================
|
---|
[6400] | 2349 | out << QString(fmt)
|
---|
[9785] | 2350 | .arg(_TOEsec, 19, 'e', 12)
|
---|
[6755] | 2351 | .arg(_Cic, 19, 'e', 12)
|
---|
| 2352 | .arg(_OMEGA0, 19, 'e', 12)
|
---|
| 2353 | .arg(_Cis, 19, 'e', 12);
|
---|
[9788] | 2354 | // =====================
|
---|
| 2355 | // BROADCAST ORBIT - 4
|
---|
| 2356 | // =====================
|
---|
[6400] | 2357 | out << QString(fmt)
|
---|
| 2358 | .arg(_i0, 19, 'e', 12)
|
---|
| 2359 | .arg(_Crc, 19, 'e', 12)
|
---|
| 2360 | .arg(_omega, 19, 'e', 12)
|
---|
| 2361 | .arg(_OMEGADOT, 19, 'e', 12);
|
---|
[9788] | 2362 | // =====================
|
---|
| 2363 | // BROADCAST ORBIT - 5
|
---|
| 2364 | // =====================
|
---|
| 2365 | if (navType() == t_eph::CNV1 ||
|
---|
| 2366 | navType() == t_eph::CNV2 ||
|
---|
| 2367 | navType() == t_eph::CNV3 ) {
|
---|
| 2368 | out << QString(fmt)
|
---|
| 2369 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 2370 | .arg(_Delta_n_dot, 19, 'e', 12)
|
---|
| 2371 | .arg(_satType, 19, 'e', 12)
|
---|
| 2372 | .arg(_top, 19, 'e', 12);
|
---|
| 2373 | }
|
---|
| 2374 | else { // D1, D2, undefined
|
---|
| 2375 | out << QString(fmt)
|
---|
| 2376 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 2377 | .arg("", 19, QChar(' '))
|
---|
| 2378 | .arg(_BDTweek, 19, 'e', 12)
|
---|
| 2379 | .arg("", 19, QChar(' '));
|
---|
| 2380 | }
|
---|
| 2381 | // =====================
|
---|
| 2382 | // BROADCAST ORBIT - 6
|
---|
| 2383 | // =====================
|
---|
| 2384 | if (navType() == t_eph::CNV1 ||
|
---|
| 2385 | navType() == t_eph::CNV2 ||
|
---|
| 2386 | navType() == t_eph::CNV3 ) {
|
---|
| 2387 | out << QString(fmt)
|
---|
| 2388 | .arg(_SISAI_oe, 19, 'e', 12)
|
---|
| 2389 | .arg(_SISAI_ocb, 19, 'e', 12)
|
---|
| 2390 | .arg(_SISAI_oc1, 19, 'e', 12)
|
---|
| 2391 | .arg(_SISAI_oc2, 19, 'e', 12);
|
---|
| 2392 | }
|
---|
| 2393 | else { // D1, D2, undefined
|
---|
| 2394 | out << QString(fmt)
|
---|
| 2395 | .arg(_URA, 19, 'e', 12)
|
---|
| 2396 | .arg(double(_SatH1), 19, 'e', 12)
|
---|
| 2397 | .arg(_TGD1, 19, 'e', 12)
|
---|
| 2398 | .arg(_TGD2, 19, 'e', 12);
|
---|
| 2399 | }
|
---|
| 2400 | // =====================
|
---|
| 2401 | // BROADCAST ORBIT - 7
|
---|
| 2402 | // =====================
|
---|
| 2403 | if (navType() == t_eph::CNV1) {
|
---|
| 2404 | out << QString(fmt)
|
---|
| 2405 | .arg(_ISC_B1Cd, 19, 'e', 12)
|
---|
| 2406 | .arg("", 19, QChar(' '))
|
---|
| 2407 | .arg(_TGD_B1Cp, 19, 'e', 12)
|
---|
| 2408 | .arg(_TGD_B2ap, 19, 'e', 12);
|
---|
| 2409 | }
|
---|
| 2410 | else if (navType() == t_eph::CNV2) {
|
---|
| 2411 | out << QString(fmt)
|
---|
| 2412 | .arg("", 19, QChar(' '))
|
---|
| 2413 | .arg(_ISC_B2ad, 19, 'e', 12)
|
---|
| 2414 | .arg(_TGD_B1Cp, 19, 'e', 12)
|
---|
| 2415 | .arg(_TGD_B2ap, 19, 'e', 12);
|
---|
| 2416 | }
|
---|
| 2417 | else if (navType() == t_eph::CNV3) {
|
---|
| 2418 | out << QString(fmt)
|
---|
| 2419 | .arg(_SISMAI, 19, 'e', 12)
|
---|
| 2420 | .arg(_health, 19, 'e', 12)
|
---|
| 2421 | .arg(_INTEGRITYF_B2b, 19, 'e', 12)
|
---|
| 2422 | .arg(_TGD_B2bI, 19, 'e', 12);
|
---|
| 2423 | }
|
---|
| 2424 | else { // D1, D2, undefined
|
---|
| 2425 | double tots = 0.0;
|
---|
| 2426 | if (_receptDateTime.isValid()) {// RTCM stream input
|
---|
| 2427 | tots = _TOE.bdssec();
|
---|
| 2428 | }
|
---|
| 2429 | else { // RINEX input
|
---|
| 2430 | tots = _TOT;
|
---|
| 2431 | }
|
---|
| 2432 | out << QString(fmt)
|
---|
| 2433 | .arg(tots, 19, 'e', 12)
|
---|
| 2434 | .arg(double(_AODC), 19, 'e', 12)
|
---|
| 2435 | .arg("", 19, QChar(' '))
|
---|
| 2436 | .arg("", 19, QChar(' '));
|
---|
| 2437 | }
|
---|
[6400] | 2438 |
|
---|
[9788] | 2439 | // =====================
|
---|
| 2440 | // BROADCAST ORBIT - 8
|
---|
| 2441 | // =====================
|
---|
| 2442 | if (navType() == t_eph::CNV1) {
|
---|
| 2443 | out << QString(fmt)
|
---|
| 2444 | .arg(_SISMAI, 19, 'e', 12)
|
---|
| 2445 | .arg(_health, 19, 'e', 12)
|
---|
| 2446 | .arg(_INTEGRITYF_B1C, 19, 'e', 12)
|
---|
| 2447 | .arg(_IODC, 19, 'e', 12);
|
---|
| 2448 | }
|
---|
| 2449 | else if (navType() == t_eph::CNV2) {
|
---|
| 2450 | out << QString(fmt)
|
---|
| 2451 | .arg(_SISMAI, 19, 'e', 12)
|
---|
| 2452 | .arg(_health, 19, 'e', 12)
|
---|
| 2453 | .arg(_INTEGRITYF_B2aB1C, 19, 'e', 12)
|
---|
| 2454 | .arg(_IODC, 19, 'e', 12);
|
---|
| 2455 | }
|
---|
| 2456 | else if (navType() == t_eph::CNV3) {
|
---|
| 2457 | out << QString(fmt)
|
---|
| 2458 | .arg(_TOT, 19, 'e', 12)
|
---|
| 2459 | .arg("", 19, QChar(' '))
|
---|
| 2460 | .arg("", 19, QChar(' '))
|
---|
| 2461 | .arg("", 19, QChar(' '));
|
---|
| 2462 | }
|
---|
[6400] | 2463 |
|
---|
[9788] | 2464 | // =====================
|
---|
| 2465 | // BROADCAST ORBIT - 9
|
---|
| 2466 | // =====================
|
---|
| 2467 | if (navType() == t_eph::CNV1 ||
|
---|
| 2468 | navType() == t_eph::CNV2) {
|
---|
| 2469 | out << QString(fmt)
|
---|
| 2470 | .arg(_TOT, 19, 'e', 12)
|
---|
| 2471 | .arg("", 19, QChar(' '))
|
---|
| 2472 | .arg("", 19, QChar(' '))
|
---|
| 2473 | .arg(_IODE, 19, 'e', 12);
|
---|
| 2474 | }
|
---|
[6400] | 2475 |
|
---|
[9788] | 2476 |
|
---|
[6400] | 2477 | return rnxStr;
|
---|
| 2478 | }
|
---|