[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 | }
|
---|
| 833 | else {
|
---|
| 834 | _M_delta_tau = 0.9999e9; // unknown
|
---|
| 835 | _M_FT = 1.5e1; // unknown
|
---|
| 836 | }
|
---|
[6801] | 837 |
|
---|
| 838 | if (lines.size() != nLines) {
|
---|
| 839 | _checkState = bad;
|
---|
| 840 | return;
|
---|
[6518] | 841 | }
|
---|
| 842 |
|
---|
[6801] | 843 | // RINEX Format
|
---|
| 844 | // ------------
|
---|
| 845 | int fieldLen = 19;
|
---|
[9367] | 846 | double statusflags = 0.0;
|
---|
| 847 | double healthflags = 0.0;
|
---|
[2221] | 848 |
|
---|
[6801] | 849 | int pos[4];
|
---|
| 850 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 851 | pos[1] = pos[0] + fieldLen;
|
---|
| 852 | pos[2] = pos[1] + fieldLen;
|
---|
| 853 | pos[3] = pos[2] + fieldLen;
|
---|
[2221] | 854 |
|
---|
[6801] | 855 | // Read four lines
|
---|
| 856 | // ---------------
|
---|
| 857 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 858 | QString line = lines[iLine];
|
---|
[2221] | 859 |
|
---|
[6801] | 860 | if ( iLine == 0 ) {
|
---|
[8204] | 861 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6213] | 862 |
|
---|
[6801] | 863 | int year, month, day, hour, min;
|
---|
| 864 | double sec;
|
---|
[2221] | 865 |
|
---|
[7139] | 866 | QString prnStr, n;
|
---|
[6880] | 867 | in >> prnStr;
|
---|
[7639] | 868 | if (prnStr.size() == 1 && prnStr[0] == 'R') {
|
---|
[7139] | 869 | in >> n;
|
---|
| 870 | prnStr.append(n);
|
---|
[6880] | 871 | }
|
---|
| 872 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6801] | 873 | if (prnStr.at(0) == 'R') {
|
---|
| 874 | _prn.set('R', prnStr.mid(1).toInt());
|
---|
| 875 | }
|
---|
| 876 | else {
|
---|
| 877 | _prn.set('R', prnStr.toInt());
|
---|
| 878 | }
|
---|
[2221] | 879 |
|
---|
[6801] | 880 | if (year < 80) {
|
---|
| 881 | year += 2000;
|
---|
| 882 | }
|
---|
| 883 | else if (year < 100) {
|
---|
| 884 | year += 1900;
|
---|
| 885 | }
|
---|
[2221] | 886 |
|
---|
[6801] | 887 | _gps_utc = gnumleap(year, month, day);
|
---|
[2221] | 888 |
|
---|
[6801] | 889 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 890 | _TOC = _TOC + _gps_utc;
|
---|
[8800] | 891 | int nd = int((_TOC.gpssec())) / (24.0*60.0*60.0);
|
---|
[6801] | 892 | if ( readDbl(line, pos[1], fieldLen, _tau ) ||
|
---|
| 893 | readDbl(line, pos[2], fieldLen, _gamma) ||
|
---|
| 894 | readDbl(line, pos[3], fieldLen, _tki ) ) {
|
---|
| 895 | _checkState = bad;
|
---|
| 896 | return;
|
---|
| 897 | }
|
---|
[8800] | 898 | _tki -= nd * 86400.0;
|
---|
| 899 | _tau = -_tau;
|
---|
[6801] | 900 | }
|
---|
[9788] | 901 | // =====================
|
---|
| 902 | // BROADCAST ORBIT - 1
|
---|
| 903 | // =====================
|
---|
[6801] | 904 | else if ( iLine == 1 ) {
|
---|
| 905 | if ( readDbl(line, pos[0], fieldLen, _x_pos ) ||
|
---|
| 906 | readDbl(line, pos[1], fieldLen, _x_velocity ) ||
|
---|
| 907 | readDbl(line, pos[2], fieldLen, _x_acceleration) ||
|
---|
| 908 | readDbl(line, pos[3], fieldLen, _health ) ) {
|
---|
| 909 | _checkState = bad;
|
---|
| 910 | return;
|
---|
| 911 | }
|
---|
| 912 | }
|
---|
[9788] | 913 | // =====================
|
---|
| 914 | // BROADCAST ORBIT - 2
|
---|
| 915 | // =====================
|
---|
[6801] | 916 | else if ( iLine == 2 ) {
|
---|
| 917 | if ( readDbl(line, pos[0], fieldLen, _y_pos ) ||
|
---|
| 918 | readDbl(line, pos[1], fieldLen, _y_velocity ) ||
|
---|
| 919 | readDbl(line, pos[2], fieldLen, _y_acceleration ) ||
|
---|
| 920 | readDbl(line, pos[3], fieldLen, _frequency_number) ) {
|
---|
| 921 | _checkState = bad;
|
---|
| 922 | return;
|
---|
| 923 | }
|
---|
| 924 | }
|
---|
[9788] | 925 | // =====================
|
---|
| 926 | // BROADCAST ORBIT - 3
|
---|
| 927 | // =====================
|
---|
[6801] | 928 | else if ( iLine == 3 ) {
|
---|
| 929 | if ( readDbl(line, pos[0], fieldLen, _z_pos ) ||
|
---|
| 930 | readDbl(line, pos[1], fieldLen, _z_velocity ) ||
|
---|
| 931 | readDbl(line, pos[2], fieldLen, _z_acceleration) ||
|
---|
| 932 | readDbl(line, pos[3], fieldLen, _E ) ) {
|
---|
| 933 | _checkState = bad;
|
---|
| 934 | return;
|
---|
| 935 | }
|
---|
| 936 | }
|
---|
[9788] | 937 | // =====================
|
---|
| 938 | // BROADCAST ORBIT - 4
|
---|
| 939 | // =====================
|
---|
[9367] | 940 | else if ( iLine == 4 ) {
|
---|
[9892] | 941 | if (readDbl(line, pos[0], fieldLen, statusflags ) ) {
|
---|
| 942 | //statusflags BLK, do nothing
|
---|
| 943 | _flags_unknown = true;
|
---|
[9367] | 944 | }
|
---|
| 945 | else {
|
---|
[9892] | 946 | _flags_unknown = false;
|
---|
[9367] | 947 | // status flags
|
---|
| 948 | // ============
|
---|
| 949 | // bit 0-1
|
---|
| 950 | _M_P = double(bitExtracted(statusflags, 2, 0));
|
---|
| 951 | // bit 2-3
|
---|
| 952 | _P1 = double(bitExtracted(statusflags, 2, 2));
|
---|
| 953 | // bit 4
|
---|
| 954 | _P2 = double(bitExtracted(statusflags, 1, 4));
|
---|
| 955 | // bit 5
|
---|
| 956 | _P3 = double(bitExtracted(statusflags, 1, 5));
|
---|
| 957 | // bit 6
|
---|
| 958 | _M_P4 = double(bitExtracted(statusflags, 1, 6));
|
---|
| 959 | // bit 7-8
|
---|
| 960 | _M_M = double(bitExtracted(statusflags, 2, 7));
|
---|
| 961 | /// GLO M/K exclusive flags/values only valid if flag M is set to '01'
|
---|
| 962 | if (!_M_M) {
|
---|
| 963 | _M_P4 = 0.0;
|
---|
| 964 | _M_P = 0.0;
|
---|
| 965 | }
|
---|
[9892] | 966 | }
|
---|
| 967 | if ( readDbl(line, pos[1], fieldLen, _M_delta_tau ) ||
|
---|
| 968 | readDbl(line, pos[2], fieldLen, _M_FT ) ) {
|
---|
| 969 | _checkState = bad;
|
---|
| 970 | return;
|
---|
| 971 | }
|
---|
| 972 | if (readDbl(line, pos[3], fieldLen, healthflags ) ) {
|
---|
| 973 | // healthflags BLK
|
---|
| 974 | _flags_unknown = true;
|
---|
| 975 | }
|
---|
| 976 | else {
|
---|
| 977 | _flags_unknown = false;
|
---|
[9367] | 978 | // health flags
|
---|
| 979 | // ============
|
---|
| 980 | // bit 0 (is to be ignored, if bit 1 is zero)
|
---|
| 981 | _almanac_health = double(bitExtracted(healthflags, 1, 0));
|
---|
| 982 | // bit 1
|
---|
| 983 | _almanac_health_availablility_indicator = double(bitExtracted(healthflags, 1, 1));
|
---|
| 984 | // bit 2
|
---|
| 985 | _M_l3 = double(bitExtracted(healthflags, 1, 2));
|
---|
| 986 | }
|
---|
| 987 | }
|
---|
[6801] | 988 | }
|
---|
| 989 |
|
---|
| 990 | // Initialize status vector
|
---|
| 991 | // ------------------------
|
---|
| 992 | _tt = _TOC;
|
---|
[8698] | 993 | _xv.ReSize(6); _xv = 0.0;
|
---|
[6801] | 994 | _xv(1) = _x_pos * 1.e3;
|
---|
| 995 | _xv(2) = _y_pos * 1.e3;
|
---|
| 996 | _xv(3) = _z_pos * 1.e3;
|
---|
| 997 | _xv(4) = _x_velocity * 1.e3;
|
---|
| 998 | _xv(5) = _y_velocity * 1.e3;
|
---|
| 999 | _xv(6) = _z_velocity * 1.e3;
|
---|
[2221] | 1000 | }
|
---|
| 1001 |
|
---|
[6801] | 1002 | // Compute Glonass Satellite Position (virtual)
|
---|
[2771] | 1003 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6801] | 1004 | t_irc t_ephGlo::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[2771] | 1005 |
|
---|
[6801] | 1006 | static const double nominalStep = 10.0;
|
---|
[2771] | 1007 |
|
---|
[8542] | 1008 | memset(xc, 0, 6*sizeof(double));
|
---|
[2771] | 1009 | memset(vv, 0, 3*sizeof(double));
|
---|
| 1010 |
|
---|
[6801] | 1011 | double dtPos = bncTime(GPSweek, GPSweeks) - _tt;
|
---|
| 1012 |
|
---|
[8698] | 1013 | if (fabs(dtPos) > 24 * 3600.0) {
|
---|
[6213] | 1014 | return failure;
|
---|
[2771] | 1015 | }
|
---|
| 1016 |
|
---|
[6801] | 1017 | int nSteps = int(fabs(dtPos) / nominalStep) + 1;
|
---|
| 1018 | double step = dtPos / nSteps;
|
---|
[4018] | 1019 |
|
---|
[6801] | 1020 | double acc[3];
|
---|
| 1021 | acc[0] = _x_acceleration * 1.e3;
|
---|
| 1022 | acc[1] = _y_acceleration * 1.e3;
|
---|
| 1023 | acc[2] = _z_acceleration * 1.e3;
|
---|
[9132] | 1024 |
|
---|
[6801] | 1025 | for (int ii = 1; ii <= nSteps; ii++) {
|
---|
| 1026 | _xv = rungeKutta4(_tt.gpssec(), _xv, step, acc, glo_deriv);
|
---|
| 1027 | _tt = _tt + step;
|
---|
| 1028 | }
|
---|
[4018] | 1029 |
|
---|
[6801] | 1030 | // Position and Velocity
|
---|
| 1031 | // ---------------------
|
---|
| 1032 | xc[0] = _xv(1);
|
---|
| 1033 | xc[1] = _xv(2);
|
---|
| 1034 | xc[2] = _xv(3);
|
---|
[2771] | 1035 |
|
---|
[6801] | 1036 | vv[0] = _xv(4);
|
---|
| 1037 | vv[1] = _xv(5);
|
---|
| 1038 | vv[2] = _xv(6);
|
---|
[2771] | 1039 |
|
---|
[6801] | 1040 | // Clock Correction
|
---|
| 1041 | // ----------------
|
---|
| 1042 | double dtClk = bncTime(GPSweek, GPSweeks) - _TOC;
|
---|
| 1043 | xc[3] = -_tau + _gamma * dtClk;
|
---|
[2771] | 1044 |
|
---|
[8542] | 1045 | xc[4] = _gamma;
|
---|
| 1046 | xc[5] = 0.0;
|
---|
[8483] | 1047 |
|
---|
[6213] | 1048 | return success;
|
---|
[2771] | 1049 | }
|
---|
| 1050 |
|
---|
[6801] | 1051 | // RINEX Format String
|
---|
[3659] | 1052 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6801] | 1053 | QString t_ephGlo::toString(double version) const {
|
---|
[3664] | 1054 |
|
---|
[9765] | 1055 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 1056 | QString rnxStr = navStr + rinexDateStr(_TOC -_gps_utc, _prn, version);
|
---|
[8800] | 1057 | int nd = int((_TOC - _gps_utc).gpssec()) / (24.0*60.0*60.0);
|
---|
[6801] | 1058 | QTextStream out(&rnxStr);
|
---|
[3664] | 1059 |
|
---|
[6801] | 1060 | out << QString("%1%2%3\n")
|
---|
[8800] | 1061 | .arg(-_tau, 19, 'e', 12)
|
---|
| 1062 | .arg(_gamma, 19, 'e', 12)
|
---|
| 1063 | .arg(_tki+nd*86400.0, 19, 'e', 12);
|
---|
[3668] | 1064 |
|
---|
[6801] | 1065 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 1066 | // =====================
|
---|
| 1067 | // BROADCAST ORBIT - 1
|
---|
| 1068 | // =====================
|
---|
[6801] | 1069 | out << QString(fmt)
|
---|
| 1070 | .arg(_x_pos, 19, 'e', 12)
|
---|
| 1071 | .arg(_x_velocity, 19, 'e', 12)
|
---|
| 1072 | .arg(_x_acceleration, 19, 'e', 12)
|
---|
| 1073 | .arg(_health, 19, 'e', 12);
|
---|
[9788] | 1074 | // =====================
|
---|
| 1075 | // BROADCAST ORBIT - 2
|
---|
| 1076 | // =====================
|
---|
[6801] | 1077 | out << QString(fmt)
|
---|
| 1078 | .arg(_y_pos, 19, 'e', 12)
|
---|
| 1079 | .arg(_y_velocity, 19, 'e', 12)
|
---|
| 1080 | .arg(_y_acceleration, 19, 'e', 12)
|
---|
| 1081 | .arg(_frequency_number, 19, 'e', 12);
|
---|
[9788] | 1082 | // =====================
|
---|
| 1083 | // BROADCAST ORBIT - 3
|
---|
| 1084 | // =====================
|
---|
[6801] | 1085 | out << QString(fmt)
|
---|
| 1086 | .arg(_z_pos, 19, 'e', 12)
|
---|
| 1087 | .arg(_z_velocity, 19, 'e', 12)
|
---|
| 1088 | .arg(_z_acceleration, 19, 'e', 12)
|
---|
| 1089 | .arg(_E, 19, 'e', 12);
|
---|
[9788] | 1090 | // =====================
|
---|
| 1091 | // BROADCAST ORBIT - 4
|
---|
| 1092 | // =====================
|
---|
[9367] | 1093 | if (version >= 3.05) {
|
---|
| 1094 | // unknown (RINEX version < 3.05)
|
---|
| 1095 | if (_flags_unknown) {
|
---|
| 1096 | out << QString(fmt)
|
---|
| 1097 | .arg("", 19, QChar(' ')) // statusflags blank if unknown
|
---|
| 1098 | .arg(_M_delta_tau, 19, 'e', 12)
|
---|
| 1099 | .arg(_M_FT, 19, 'e', 12)
|
---|
| 1100 | .arg("", 19, QChar(' ')); // healthflags blank if unknown
|
---|
| 1101 | }
|
---|
| 1102 | else {
|
---|
| 1103 | int statusflags = 0;
|
---|
| 1104 | // bit 7-8
|
---|
| 1105 | if (_M_M == 2.0) {
|
---|
| 1106 | statusflags |= (1<<7);
|
---|
| 1107 | }
|
---|
| 1108 | // bit 6
|
---|
| 1109 | if (_M_P4) {
|
---|
| 1110 | statusflags |= (1<<6);
|
---|
| 1111 | }
|
---|
| 1112 | // bit 5
|
---|
| 1113 | if (_P3) {
|
---|
| 1114 | statusflags |= (1<<5);
|
---|
| 1115 | }
|
---|
| 1116 | // bit 4
|
---|
| 1117 | if (_P2) {
|
---|
| 1118 | statusflags |= (1<<4);
|
---|
| 1119 | }
|
---|
| 1120 | // bit 2-3
|
---|
| 1121 | if (_P1 == 2.0) {
|
---|
| 1122 | statusflags |= (1<<2);
|
---|
| 1123 | }
|
---|
| 1124 | else if (_P1 == 1.0) {
|
---|
| 1125 | statusflags |= (1<<3);
|
---|
| 1126 | }
|
---|
| 1127 | else if (_P1 == 3.0) {
|
---|
| 1128 | statusflags |= (1<<2);
|
---|
| 1129 | statusflags |= (1<<3);
|
---|
| 1130 | }
|
---|
| 1131 | // bit 0-1
|
---|
| 1132 | if (_M_P == 2.0) {
|
---|
| 1133 | statusflags |= (1<<0);
|
---|
| 1134 | }
|
---|
| 1135 | else if (_M_P == 1.0) {
|
---|
| 1136 | statusflags |= (1<<1);
|
---|
| 1137 | }
|
---|
| 1138 | else if (_M_P == 3.0) {
|
---|
| 1139 | statusflags |= (1<<0);
|
---|
| 1140 | statusflags |= (1<<1);
|
---|
| 1141 | }
|
---|
| 1142 | // health flags
|
---|
| 1143 | // ============
|
---|
| 1144 | int healthflags = 0;
|
---|
| 1145 | // bit 0 (is to be ignored, if bit 1 is zero)
|
---|
| 1146 | if (_almanac_health) {
|
---|
| 1147 | healthflags |= (1<<0);
|
---|
| 1148 | }
|
---|
| 1149 | // bit 1
|
---|
| 1150 | if (_almanac_health_availablility_indicator) {
|
---|
| 1151 | healthflags |= (1<<1);
|
---|
| 1152 | }
|
---|
| 1153 | // bit 2
|
---|
| 1154 | if (_M_l3) {
|
---|
| 1155 | healthflags |= (1<<2);
|
---|
| 1156 | }
|
---|
| 1157 | out << QString(fmt)
|
---|
| 1158 | .arg(double(statusflags), 19, 'e', 12)
|
---|
| 1159 | .arg(_M_delta_tau, 19, 'e', 12)
|
---|
| 1160 | .arg(_M_FT, 19, 'e', 12)
|
---|
| 1161 | .arg(double(healthflags), 19, 'e', 12);
|
---|
| 1162 | }
|
---|
| 1163 | }
|
---|
| 1164 |
|
---|
[6801] | 1165 | return rnxStr;
|
---|
[3659] | 1166 | }
|
---|
| 1167 |
|
---|
[6801] | 1168 | // Derivative of the state vector using a simple force model (static)
|
---|
| 1169 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1170 | ColumnVector t_ephGlo::glo_deriv(double /* tt */, const ColumnVector& xv,
|
---|
| 1171 | double* acc) {
|
---|
[3659] | 1172 |
|
---|
[6801] | 1173 | // State vector components
|
---|
| 1174 | // -----------------------
|
---|
| 1175 | ColumnVector rr = xv.rows(1,3);
|
---|
| 1176 | ColumnVector vv = xv.rows(4,6);
|
---|
[3699] | 1177 |
|
---|
[6801] | 1178 | // Acceleration
|
---|
[3699] | 1179 | // ------------
|
---|
[6801] | 1180 | static const double gmWGS = 398.60044e12;
|
---|
| 1181 | static const double AE = 6378136.0;
|
---|
| 1182 | static const double OMEGA = 7292115.e-11;
|
---|
| 1183 | static const double C20 = -1082.6257e-6;
|
---|
[3699] | 1184 |
|
---|
[8903] | 1185 | double rho = rr.NormFrobenius();
|
---|
[6801] | 1186 | double t1 = -gmWGS/(rho*rho*rho);
|
---|
| 1187 | double t2 = 3.0/2.0 * C20 * (gmWGS*AE*AE) / (rho*rho*rho*rho*rho);
|
---|
| 1188 | double t3 = OMEGA * OMEGA;
|
---|
| 1189 | double t4 = 2.0 * OMEGA;
|
---|
| 1190 | double z2 = rr(3) * rr(3);
|
---|
[3699] | 1191 |
|
---|
[6801] | 1192 | // Vector of derivatives
|
---|
| 1193 | // ---------------------
|
---|
| 1194 | ColumnVector va(6);
|
---|
| 1195 | va(1) = vv(1);
|
---|
| 1196 | va(2) = vv(2);
|
---|
| 1197 | va(3) = vv(3);
|
---|
| 1198 | va(4) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(1) + t4*vv(2) + acc[0];
|
---|
| 1199 | va(5) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(2) - t4*vv(1) + acc[1];
|
---|
| 1200 | va(6) = (t1 + t2*(3.0-5.0*z2/(rho*rho)) ) * rr(3) + acc[2];
|
---|
[3699] | 1201 |
|
---|
[6801] | 1202 | return va;
|
---|
| 1203 | }
|
---|
[3699] | 1204 |
|
---|
[6801] | 1205 | // IOD of Glonass Ephemeris (virtual)
|
---|
| 1206 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7169] | 1207 | unsigned int t_ephGlo::IOD() const {
|
---|
[6801] | 1208 | bncTime tMoscow = _TOC - _gps_utc + 3 * 3600.0;
|
---|
[7054] | 1209 | return (unsigned long)tMoscow.daysec() / 900;
|
---|
[3659] | 1210 | }
|
---|
| 1211 |
|
---|
[8187] | 1212 | // Health status of Glonass Ephemeris (virtual)
|
---|
| 1213 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1214 | unsigned int t_ephGlo::isUnhealthy() const {
|
---|
[8215] | 1215 |
|
---|
[8217] | 1216 | if (_almanac_health_availablility_indicator) {
|
---|
[8215] | 1217 | if ((_health == 0 && _almanac_health == 0) ||
|
---|
| 1218 | (_health == 1 && _almanac_health == 0) ||
|
---|
| 1219 | (_health == 1 && _almanac_health == 1)) {
|
---|
| 1220 | return 1;
|
---|
| 1221 | }
|
---|
[8187] | 1222 | }
|
---|
[8217] | 1223 | else if (!_almanac_health_availablility_indicator) {
|
---|
| 1224 | if (_health) {
|
---|
| 1225 | return 1;
|
---|
| 1226 | }
|
---|
| 1227 | }
|
---|
[8215] | 1228 | return 0; /* (_health == 0 && _almanac_health == 1) or (_health == 0) */
|
---|
[8187] | 1229 | }
|
---|
| 1230 |
|
---|
[3659] | 1231 | // Constructor
|
---|
| 1232 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 1233 | t_ephGal::t_ephGal(double rnxVersion, const QStringList& lines) {
|
---|
[6809] | 1234 | int year, month, day, hour, min;
|
---|
| 1235 | double sec;
|
---|
| 1236 | QString prnStr;
|
---|
[4891] | 1237 | const int nLines = 8;
|
---|
| 1238 | if (lines.size() != nLines) {
|
---|
[6518] | 1239 | _checkState = bad;
|
---|
[4891] | 1240 | return;
|
---|
| 1241 | }
|
---|
| 1242 |
|
---|
| 1243 | // RINEX Format
|
---|
| 1244 | // ------------
|
---|
| 1245 | int fieldLen = 19;
|
---|
[6792] | 1246 | double SVhealth = 0.0;
|
---|
| 1247 | double datasource = 0.0;
|
---|
[6798] | 1248 |
|
---|
[4891] | 1249 | int pos[4];
|
---|
| 1250 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 1251 | pos[1] = pos[0] + fieldLen;
|
---|
| 1252 | pos[2] = pos[1] + fieldLen;
|
---|
| 1253 | pos[3] = pos[2] + fieldLen;
|
---|
| 1254 |
|
---|
| 1255 | // Read eight lines
|
---|
| 1256 | // ----------------
|
---|
| 1257 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 1258 | QString line = lines[iLine];
|
---|
| 1259 |
|
---|
| 1260 | if ( iLine == 0 ) {
|
---|
[8204] | 1261 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[7140] | 1262 | QString n;
|
---|
[6880] | 1263 | in >> prnStr;
|
---|
[7639] | 1264 | if (prnStr.size() == 1 && prnStr[0] == 'E') {
|
---|
[7139] | 1265 | in >> n;
|
---|
| 1266 | prnStr.append(n);
|
---|
[6880] | 1267 | }
|
---|
| 1268 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[4891] | 1269 | if (year < 80) {
|
---|
| 1270 | year += 2000;
|
---|
| 1271 | }
|
---|
| 1272 | else if (year < 100) {
|
---|
| 1273 | year += 1900;
|
---|
| 1274 | }
|
---|
| 1275 |
|
---|
| 1276 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 1277 |
|
---|
| 1278 | if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
|
---|
| 1279 | readDbl(line, pos[2], fieldLen, _clock_drift ) ||
|
---|
| 1280 | readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
|
---|
[6518] | 1281 | _checkState = bad;
|
---|
[4891] | 1282 | return;
|
---|
| 1283 | }
|
---|
| 1284 | }
|
---|
[9788] | 1285 | // =====================
|
---|
| 1286 | // BROADCAST ORBIT - 1
|
---|
| 1287 | // =====================
|
---|
[4891] | 1288 | else if ( iLine == 1 ) {
|
---|
| 1289 | if ( readDbl(line, pos[0], fieldLen, _IODnav ) ||
|
---|
| 1290 | readDbl(line, pos[1], fieldLen, _Crs ) ||
|
---|
| 1291 | readDbl(line, pos[2], fieldLen, _Delta_n) ||
|
---|
| 1292 | readDbl(line, pos[3], fieldLen, _M0 ) ) {
|
---|
[6518] | 1293 | _checkState = bad;
|
---|
[4891] | 1294 | return;
|
---|
| 1295 | }
|
---|
| 1296 | }
|
---|
[9788] | 1297 | // =====================
|
---|
| 1298 | // BROADCAST ORBIT - 2
|
---|
| 1299 | // =====================
|
---|
[4891] | 1300 | else if ( iLine == 2 ) {
|
---|
| 1301 | if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
|
---|
| 1302 | readDbl(line, pos[1], fieldLen, _e ) ||
|
---|
| 1303 | readDbl(line, pos[2], fieldLen, _Cus ) ||
|
---|
| 1304 | readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
|
---|
[6518] | 1305 | _checkState = bad;
|
---|
[4891] | 1306 | return;
|
---|
| 1307 | }
|
---|
| 1308 | }
|
---|
[9788] | 1309 | // =====================
|
---|
| 1310 | // BROADCAST ORBIT - 3
|
---|
| 1311 | // =====================
|
---|
[4891] | 1312 | else if ( iLine == 3 ) {
|
---|
| 1313 | if ( readDbl(line, pos[0], fieldLen, _TOEsec) ||
|
---|
| 1314 | readDbl(line, pos[1], fieldLen, _Cic ) ||
|
---|
| 1315 | readDbl(line, pos[2], fieldLen, _OMEGA0) ||
|
---|
| 1316 | readDbl(line, pos[3], fieldLen, _Cis ) ) {
|
---|
[6518] | 1317 | _checkState = bad;
|
---|
[4891] | 1318 | return;
|
---|
| 1319 | }
|
---|
| 1320 | }
|
---|
[9788] | 1321 | // =====================
|
---|
| 1322 | // BROADCAST ORBIT - 4
|
---|
| 1323 | // =====================
|
---|
[4891] | 1324 | else if ( iLine == 4 ) {
|
---|
| 1325 | if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
|
---|
| 1326 | readDbl(line, pos[1], fieldLen, _Crc ) ||
|
---|
| 1327 | readDbl(line, pos[2], fieldLen, _omega ) ||
|
---|
| 1328 | readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
|
---|
[6518] | 1329 | _checkState = bad;
|
---|
[4891] | 1330 | return;
|
---|
| 1331 | }
|
---|
| 1332 | }
|
---|
[9788] | 1333 | // =====================
|
---|
| 1334 | // BROADCAST ORBIT - 5
|
---|
| 1335 | // =====================
|
---|
[4891] | 1336 | else if ( iLine == 5 ) {
|
---|
[6792] | 1337 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 1338 | readDbl(line, pos[1], fieldLen, datasource) ||
|
---|
| 1339 | readDbl(line, pos[2], fieldLen, _TOEweek ) ) {
|
---|
[6518] | 1340 | _checkState = bad;
|
---|
[4891] | 1341 | return;
|
---|
[6792] | 1342 | } else {
|
---|
| 1343 | if (int(datasource) & (1<<8)) {
|
---|
[6812] | 1344 | _fnav = true;
|
---|
| 1345 | _inav = false;
|
---|
[6792] | 1346 | } else if (int(datasource) & (1<<9)) {
|
---|
[6812] | 1347 | _fnav = false;
|
---|
| 1348 | _inav = true;
|
---|
[6792] | 1349 | }
|
---|
[6892] | 1350 | _TOEweek -= 1024.0;
|
---|
[4891] | 1351 | }
|
---|
| 1352 | }
|
---|
[9788] | 1353 | // =====================
|
---|
| 1354 | // BROADCAST ORBIT - 6
|
---|
| 1355 | // =====================
|
---|
[4891] | 1356 | else if ( iLine == 6 ) {
|
---|
| 1357 | if ( readDbl(line, pos[0], fieldLen, _SISA ) ||
|
---|
[6792] | 1358 | readDbl(line, pos[1], fieldLen, SVhealth) ||
|
---|
[4891] | 1359 | readDbl(line, pos[2], fieldLen, _BGD_1_5A) ||
|
---|
| 1360 | readDbl(line, pos[3], fieldLen, _BGD_1_5B) ) {
|
---|
[6518] | 1361 | _checkState = bad;
|
---|
[4891] | 1362 | return;
|
---|
[6792] | 1363 | } else {
|
---|
| 1364 | // Bit 0
|
---|
[9367] | 1365 | _e1DataInValid = (int(SVhealth) & (1<<0));
|
---|
[6792] | 1366 | // Bit 1-2
|
---|
[9367] | 1367 | _E1_bHS = double((int(SVhealth) >> 1) & 0x3);
|
---|
[6792] | 1368 | // Bit 3
|
---|
[6812] | 1369 | _e5aDataInValid = (int(SVhealth) & (1<<3));
|
---|
[6792] | 1370 | // Bit 4-5
|
---|
[9367] | 1371 | _E5aHS = double((int(SVhealth) >> 4) & 0x3);
|
---|
[6792] | 1372 | // Bit 6
|
---|
[6812] | 1373 | _e5bDataInValid = (int(SVhealth) & (1<<6));
|
---|
[6792] | 1374 | // Bit 7-8
|
---|
[9367] | 1375 | _E5bHS = double((int(SVhealth) >> 7) & 0x3);
|
---|
[6809] | 1376 |
|
---|
| 1377 | if (prnStr.at(0) == 'E') {
|
---|
[7140] | 1378 | _prn.set('E', prnStr.mid(1).toInt(), _inav ? 1 : 0);
|
---|
[6809] | 1379 | }
|
---|
[4891] | 1380 | }
|
---|
| 1381 | }
|
---|
[9788] | 1382 | // =====================
|
---|
| 1383 | // BROADCAST ORBIT - 7
|
---|
| 1384 | // =====================
|
---|
[4891] | 1385 | else if ( iLine == 7 ) {
|
---|
| 1386 | if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
|
---|
[6518] | 1387 | _checkState = bad;
|
---|
[4891] | 1388 | return;
|
---|
| 1389 | }
|
---|
| 1390 | }
|
---|
| 1391 | }
|
---|
[3659] | 1392 | }
|
---|
[4013] | 1393 |
|
---|
[6801] | 1394 | // Compute Galileo Satellite Position (virtual)
|
---|
| 1395 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1396 | t_irc t_ephGal::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[4013] | 1397 |
|
---|
[6801] | 1398 | static const double omegaEarth = 7292115.1467e-11;
|
---|
[8212] | 1399 | static const double gmWGS = 398.6004418e12;
|
---|
[4023] | 1400 |
|
---|
[8542] | 1401 | memset(xc, 0, 6*sizeof(double));
|
---|
[6801] | 1402 | memset(vv, 0, 3*sizeof(double));
|
---|
[4023] | 1403 |
|
---|
[6801] | 1404 | double a0 = _sqrt_A * _sqrt_A;
|
---|
| 1405 | if (a0 == 0) {
|
---|
| 1406 | return failure;
|
---|
| 1407 | }
|
---|
[4023] | 1408 |
|
---|
[6801] | 1409 | double n0 = sqrt(gmWGS/(a0*a0*a0));
|
---|
[4023] | 1410 |
|
---|
[6801] | 1411 | bncTime tt(GPSweek, GPSweeks);
|
---|
| 1412 | double tk = tt - bncTime(_TOC.gpsw(), _TOEsec);
|
---|
[4023] | 1413 |
|
---|
[6801] | 1414 | double n = n0 + _Delta_n;
|
---|
| 1415 | double M = _M0 + n*tk;
|
---|
| 1416 | double E = M;
|
---|
| 1417 | double E_last;
|
---|
[8368] | 1418 | int nLoop = 0;
|
---|
[6801] | 1419 | do {
|
---|
| 1420 | E_last = E;
|
---|
| 1421 | E = M + _e*sin(E);
|
---|
[8368] | 1422 |
|
---|
| 1423 | if (++nLoop == 100) {
|
---|
| 1424 | return failure;
|
---|
| 1425 | }
|
---|
[6801] | 1426 | } while ( fabs(E-E_last)*a0 > 0.001 );
|
---|
| 1427 | double v = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
|
---|
| 1428 | double u0 = v + _omega;
|
---|
| 1429 | double sin2u0 = sin(2*u0);
|
---|
| 1430 | double cos2u0 = cos(2*u0);
|
---|
| 1431 | double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
|
---|
| 1432 | double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
|
---|
| 1433 | double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
|
---|
| 1434 | double xp = r*cos(u);
|
---|
| 1435 | double yp = r*sin(u);
|
---|
| 1436 | double OM = _OMEGA0 + (_OMEGADOT - omegaEarth)*tk -
|
---|
| 1437 | omegaEarth*_TOEsec;
|
---|
[4023] | 1438 |
|
---|
[6801] | 1439 | double sinom = sin(OM);
|
---|
| 1440 | double cosom = cos(OM);
|
---|
| 1441 | double sini = sin(i);
|
---|
| 1442 | double cosi = cos(i);
|
---|
| 1443 | xc[0] = xp*cosom - yp*cosi*sinom;
|
---|
| 1444 | xc[1] = xp*sinom + yp*cosi*cosom;
|
---|
| 1445 | xc[2] = yp*sini;
|
---|
[4023] | 1446 |
|
---|
[6801] | 1447 | double tc = tt - _TOC;
|
---|
| 1448 | xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
|
---|
[4023] | 1449 |
|
---|
[6801] | 1450 | // Velocity
|
---|
| 1451 | // --------
|
---|
| 1452 | double tanv2 = tan(v/2);
|
---|
| 1453 | double dEdM = 1 / (1 - _e*cos(E));
|
---|
| 1454 | double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2) / (1 + tanv2*tanv2)
|
---|
| 1455 | * dEdM * n;
|
---|
| 1456 | double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
|
---|
| 1457 | double dotom = _OMEGADOT - omegaEarth;
|
---|
| 1458 | double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
|
---|
| 1459 | double dotr = a0 * _e*sin(E) * dEdM * n
|
---|
| 1460 | + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
|
---|
| 1461 | double dotx = dotr*cos(u) - r*sin(u)*dotu;
|
---|
| 1462 | double doty = dotr*sin(u) + r*cos(u)*dotu;
|
---|
[4023] | 1463 |
|
---|
[6801] | 1464 | vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
|
---|
| 1465 | - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
|
---|
| 1466 | + yp*sini*sinom*doti; // dX / di
|
---|
| 1467 |
|
---|
| 1468 | vv[1] = sinom *dotx + cosi*cosom *doty
|
---|
| 1469 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 1470 | - yp*sini*cosom*doti;
|
---|
| 1471 |
|
---|
| 1472 | vv[2] = sini *doty + yp*cosi *doti;
|
---|
| 1473 |
|
---|
| 1474 | // Relativistic Correction
|
---|
| 1475 | // -----------------------
|
---|
[9290] | 1476 | xc[3] -= 4.442807309e-10 * _e * sqrt(a0) *sin(E);
|
---|
[6801] | 1477 |
|
---|
[8542] | 1478 | xc[4] = _clock_drift + _clock_driftrate*tc;
|
---|
| 1479 | xc[5] = _clock_driftrate;
|
---|
[8581] | 1480 |
|
---|
[6801] | 1481 | return success;
|
---|
[4023] | 1482 | }
|
---|
| 1483 |
|
---|
[8187] | 1484 | // Health status of Galileo Ephemeris (virtual)
|
---|
| 1485 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1486 | unsigned int t_ephGal::isUnhealthy() const {
|
---|
| 1487 | if (_E5aHS && _E5bHS && _E1_bHS) {
|
---|
| 1488 | return 1;
|
---|
| 1489 | }
|
---|
| 1490 | return 0;
|
---|
| 1491 | }
|
---|
| 1492 |
|
---|
[4023] | 1493 | // RINEX Format String
|
---|
| 1494 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 1495 | QString t_ephGal::toString(double version) const {
|
---|
| 1496 |
|
---|
[9765] | 1497 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 1498 | QString rnxStr = navStr + rinexDateStr(_TOC, _prn, version);
|
---|
[4023] | 1499 |
|
---|
| 1500 | QTextStream out(&rnxStr);
|
---|
| 1501 |
|
---|
| 1502 | out << QString("%1%2%3\n")
|
---|
| 1503 | .arg(_clock_bias, 19, 'e', 12)
|
---|
| 1504 | .arg(_clock_drift, 19, 'e', 12)
|
---|
| 1505 | .arg(_clock_driftrate, 19, 'e', 12);
|
---|
| 1506 |
|
---|
| 1507 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 1508 | // =====================
|
---|
| 1509 | // BROADCAST ORBIT - 1
|
---|
| 1510 | // =====================
|
---|
[4023] | 1511 | out << QString(fmt)
|
---|
| 1512 | .arg(_IODnav, 19, 'e', 12)
|
---|
| 1513 | .arg(_Crs, 19, 'e', 12)
|
---|
| 1514 | .arg(_Delta_n, 19, 'e', 12)
|
---|
| 1515 | .arg(_M0, 19, 'e', 12);
|
---|
[9788] | 1516 | // =====================
|
---|
| 1517 | // BROADCAST ORBIT - 2
|
---|
| 1518 | // =====================
|
---|
[4023] | 1519 | out << QString(fmt)
|
---|
| 1520 | .arg(_Cuc, 19, 'e', 12)
|
---|
| 1521 | .arg(_e, 19, 'e', 12)
|
---|
| 1522 | .arg(_Cus, 19, 'e', 12)
|
---|
| 1523 | .arg(_sqrt_A, 19, 'e', 12);
|
---|
[9788] | 1524 | // =====================
|
---|
| 1525 | // BROADCAST ORBIT - 3
|
---|
| 1526 | // =====================
|
---|
[4023] | 1527 | out << QString(fmt)
|
---|
| 1528 | .arg(_TOEsec, 19, 'e', 12)
|
---|
| 1529 | .arg(_Cic, 19, 'e', 12)
|
---|
| 1530 | .arg(_OMEGA0, 19, 'e', 12)
|
---|
| 1531 | .arg(_Cis, 19, 'e', 12);
|
---|
[9788] | 1532 | // =====================
|
---|
| 1533 | // BROADCAST ORBIT - 4
|
---|
| 1534 | // =====================
|
---|
[4023] | 1535 | out << QString(fmt)
|
---|
| 1536 | .arg(_i0, 19, 'e', 12)
|
---|
| 1537 | .arg(_Crc, 19, 'e', 12)
|
---|
| 1538 | .arg(_omega, 19, 'e', 12)
|
---|
| 1539 | .arg(_OMEGADOT, 19, 'e', 12);
|
---|
[9788] | 1540 | // =====================
|
---|
| 1541 | // BROADCAST ORBIT - 5
|
---|
| 1542 | // =====================
|
---|
[6792] | 1543 | int dataSource = 0;
|
---|
| 1544 | int SVhealth = 0;
|
---|
| 1545 | double BGD_1_5A = _BGD_1_5A;
|
---|
| 1546 | double BGD_1_5B = _BGD_1_5B;
|
---|
[6812] | 1547 | if (_fnav) {
|
---|
[6792] | 1548 | dataSource |= (1<<1);
|
---|
| 1549 | dataSource |= (1<<8);
|
---|
| 1550 | BGD_1_5B = 0.0;
|
---|
| 1551 | // SVhealth
|
---|
| 1552 | // Bit 3 : E5a DVS
|
---|
[6812] | 1553 | if (_e5aDataInValid) {
|
---|
[6792] | 1554 | SVhealth |= (1<<3);
|
---|
| 1555 | }
|
---|
| 1556 | // Bit 4-5: E5a HS
|
---|
| 1557 | if (_E5aHS == 1.0) {
|
---|
| 1558 | SVhealth |= (1<<4);
|
---|
| 1559 | }
|
---|
| 1560 | else if (_E5aHS == 2.0) {
|
---|
| 1561 | SVhealth |= (1<<5);
|
---|
| 1562 | }
|
---|
| 1563 | else if (_E5aHS == 3.0) {
|
---|
| 1564 | SVhealth |= (1<<4);
|
---|
| 1565 | SVhealth |= (1<<5);
|
---|
| 1566 | }
|
---|
| 1567 | }
|
---|
[6812] | 1568 | else if(_inav) {
|
---|
[6803] | 1569 | // Bit 2 and 0 are set because from MT1046 the data source cannot be determined
|
---|
| 1570 | // and RNXv3.03 says both can be set if the navigation messages were merged
|
---|
[5539] | 1571 | dataSource |= (1<<0);
|
---|
[6792] | 1572 | dataSource |= (1<<2);
|
---|
[5540] | 1573 | dataSource |= (1<<9);
|
---|
[6792] | 1574 | // SVhealth
|
---|
| 1575 | // Bit 0 : E1-B DVS
|
---|
[6812] | 1576 | if (_e1DataInValid) {
|
---|
[6792] | 1577 | SVhealth |= (1<<0);
|
---|
| 1578 | }
|
---|
| 1579 | // Bit 1-2: E1-B HS
|
---|
| 1580 | if (_E1_bHS == 1.0) {
|
---|
| 1581 | SVhealth |= (1<<1);
|
---|
| 1582 | }
|
---|
| 1583 | else if (_E1_bHS == 2.0) {
|
---|
| 1584 | SVhealth |= (1<<2);
|
---|
| 1585 | }
|
---|
[6803] | 1586 | else if (_E1_bHS == 3.0) {
|
---|
[6792] | 1587 | SVhealth |= (1<<1);
|
---|
| 1588 | SVhealth |= (1<<2);
|
---|
| 1589 | }
|
---|
[6802] | 1590 | // Bit 3 : E5a DVS
|
---|
[6812] | 1591 | if (_e5aDataInValid) {
|
---|
[6802] | 1592 | SVhealth |= (1<<3);
|
---|
| 1593 | }
|
---|
| 1594 | // Bit 4-5: E5a HS
|
---|
| 1595 | if (_E5aHS == 1.0) {
|
---|
| 1596 | SVhealth |= (1<<4);
|
---|
| 1597 | }
|
---|
| 1598 | else if (_E5aHS == 2.0) {
|
---|
| 1599 | SVhealth |= (1<<5);
|
---|
| 1600 | }
|
---|
[6803] | 1601 | else if (_E5aHS == 3.0) {
|
---|
[6802] | 1602 | SVhealth |= (1<<4);
|
---|
| 1603 | SVhealth |= (1<<5);
|
---|
| 1604 | }
|
---|
[6792] | 1605 | // Bit 6 : E5b DVS
|
---|
[6812] | 1606 | if (_e5bDataInValid) {
|
---|
[6792] | 1607 | SVhealth |= (1<<6);
|
---|
| 1608 | }
|
---|
| 1609 | // Bit 7-8: E5b HS
|
---|
| 1610 | if (_E5bHS == 1.0) {
|
---|
| 1611 | SVhealth |= (1<<7);
|
---|
| 1612 | }
|
---|
| 1613 | else if (_E5bHS == 2.0) {
|
---|
| 1614 | SVhealth |= (1<<8);
|
---|
| 1615 | }
|
---|
[6803] | 1616 | else if (_E5bHS == 3.0) {
|
---|
[6792] | 1617 | SVhealth |= (1<<7);
|
---|
| 1618 | SVhealth |= (1<<8);
|
---|
| 1619 | }
|
---|
[5539] | 1620 | }
|
---|
[6792] | 1621 |
|
---|
[4023] | 1622 | out << QString(fmt)
|
---|
[5532] | 1623 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 1624 | .arg(double(dataSource), 19, 'e', 12)
|
---|
[6892] | 1625 | .arg(_TOEweek + 1024.0, 19, 'e', 12)
|
---|
[5532] | 1626 | .arg(0.0, 19, 'e', 12);
|
---|
[9788] | 1627 | // =====================
|
---|
| 1628 | // BROADCAST ORBIT - 6
|
---|
| 1629 | // =====================
|
---|
[4023] | 1630 | out << QString(fmt)
|
---|
[6798] | 1631 | .arg(_SISA, 19, 'e', 12)
|
---|
[6792] | 1632 | .arg(double(SVhealth), 19, 'e', 12)
|
---|
| 1633 | .arg(BGD_1_5A, 19, 'e', 12)
|
---|
| 1634 | .arg(BGD_1_5B, 19, 'e', 12);
|
---|
[9788] | 1635 | // =====================
|
---|
| 1636 | // BROADCAST ORBIT - 7
|
---|
| 1637 | // =====================
|
---|
[7922] | 1638 | double tot = _TOT;
|
---|
| 1639 | if (tot == 0.9999e9 && version < 3.0) {
|
---|
| 1640 | tot = 0.0;
|
---|
| 1641 | }
|
---|
[4023] | 1642 | out << QString(fmt)
|
---|
[7922] | 1643 | .arg(tot, 19, 'e', 12)
|
---|
[4024] | 1644 | .arg("", 19, QChar(' '))
|
---|
| 1645 | .arg("", 19, QChar(' '))
|
---|
| 1646 | .arg("", 19, QChar(' '));
|
---|
[4023] | 1647 |
|
---|
| 1648 | return rnxStr;
|
---|
| 1649 | }
|
---|
| 1650 |
|
---|
[6385] | 1651 | // Constructor
|
---|
| 1652 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 1653 | t_ephSBAS::t_ephSBAS(double rnxVersion, const QStringList& lines) {
|
---|
[6390] | 1654 |
|
---|
| 1655 | const int nLines = 4;
|
---|
| 1656 |
|
---|
| 1657 | if (lines.size() != nLines) {
|
---|
[6518] | 1658 | _checkState = bad;
|
---|
[6390] | 1659 | return;
|
---|
| 1660 | }
|
---|
| 1661 |
|
---|
| 1662 | // RINEX Format
|
---|
| 1663 | // ------------
|
---|
| 1664 | int fieldLen = 19;
|
---|
| 1665 |
|
---|
| 1666 | int pos[4];
|
---|
| 1667 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 1668 | pos[1] = pos[0] + fieldLen;
|
---|
| 1669 | pos[2] = pos[1] + fieldLen;
|
---|
| 1670 | pos[3] = pos[2] + fieldLen;
|
---|
| 1671 |
|
---|
| 1672 | // Read four lines
|
---|
| 1673 | // ---------------
|
---|
| 1674 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 1675 | QString line = lines[iLine];
|
---|
| 1676 |
|
---|
| 1677 | if ( iLine == 0 ) {
|
---|
[8204] | 1678 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6390] | 1679 |
|
---|
| 1680 | int year, month, day, hour, min;
|
---|
| 1681 | double sec;
|
---|
[6880] | 1682 |
|
---|
[7139] | 1683 | QString prnStr, n;
|
---|
[6880] | 1684 | in >> prnStr;
|
---|
[7639] | 1685 | if (prnStr.size() == 1 && prnStr[0] == 'S') {
|
---|
[7139] | 1686 | in >> n;
|
---|
| 1687 | prnStr.append(n);
|
---|
[6880] | 1688 | }
|
---|
| 1689 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6390] | 1690 | if (prnStr.at(0) == 'S') {
|
---|
| 1691 | _prn.set('S', prnStr.mid(1).toInt());
|
---|
| 1692 | }
|
---|
| 1693 | else {
|
---|
| 1694 | _prn.set('S', prnStr.toInt());
|
---|
| 1695 | }
|
---|
| 1696 |
|
---|
| 1697 | if (year < 80) {
|
---|
| 1698 | year += 2000;
|
---|
| 1699 | }
|
---|
| 1700 | else if (year < 100) {
|
---|
| 1701 | year += 1900;
|
---|
| 1702 | }
|
---|
| 1703 |
|
---|
| 1704 | _TOC.set(year, month, day, hour, min, sec);
|
---|
| 1705 |
|
---|
| 1706 | if ( readDbl(line, pos[1], fieldLen, _agf0 ) ||
|
---|
| 1707 | readDbl(line, pos[2], fieldLen, _agf1 ) ||
|
---|
[8456] | 1708 | readDbl(line, pos[3], fieldLen, _TOT ) ) {
|
---|
[6518] | 1709 | _checkState = bad;
|
---|
[6390] | 1710 | return;
|
---|
| 1711 | }
|
---|
| 1712 | }
|
---|
[9788] | 1713 | // =====================
|
---|
| 1714 | // BROADCAST ORBIT - 1
|
---|
| 1715 | // =====================
|
---|
[6390] | 1716 | else if ( iLine == 1 ) {
|
---|
| 1717 | if ( readDbl(line, pos[0], fieldLen, _x_pos ) ||
|
---|
| 1718 | readDbl(line, pos[1], fieldLen, _x_velocity ) ||
|
---|
| 1719 | readDbl(line, pos[2], fieldLen, _x_acceleration) ||
|
---|
| 1720 | readDbl(line, pos[3], fieldLen, _health ) ) {
|
---|
[6518] | 1721 | _checkState = bad;
|
---|
[6390] | 1722 | return;
|
---|
| 1723 | }
|
---|
| 1724 | }
|
---|
[9788] | 1725 | // =====================
|
---|
| 1726 | // BROADCAST ORBIT - 2
|
---|
| 1727 | // =====================
|
---|
[6390] | 1728 | else if ( iLine == 2 ) {
|
---|
| 1729 | if ( readDbl(line, pos[0], fieldLen, _y_pos ) ||
|
---|
| 1730 | readDbl(line, pos[1], fieldLen, _y_velocity ) ||
|
---|
| 1731 | readDbl(line, pos[2], fieldLen, _y_acceleration ) ||
|
---|
| 1732 | readDbl(line, pos[3], fieldLen, _ura ) ) {
|
---|
[6518] | 1733 | _checkState = bad;
|
---|
[6390] | 1734 | return;
|
---|
| 1735 | }
|
---|
| 1736 | }
|
---|
[9788] | 1737 | // =====================
|
---|
| 1738 | // BROADCAST ORBIT - 3
|
---|
| 1739 | // =====================
|
---|
[6390] | 1740 | else if ( iLine == 3 ) {
|
---|
[6536] | 1741 | double iodn;
|
---|
[6390] | 1742 | if ( readDbl(line, pos[0], fieldLen, _z_pos ) ||
|
---|
| 1743 | readDbl(line, pos[1], fieldLen, _z_velocity ) ||
|
---|
| 1744 | readDbl(line, pos[2], fieldLen, _z_acceleration) ||
|
---|
[6536] | 1745 | readDbl(line, pos[3], fieldLen, iodn ) ) {
|
---|
[6518] | 1746 | _checkState = bad;
|
---|
[6390] | 1747 | return;
|
---|
[6891] | 1748 | } else {
|
---|
[6536] | 1749 | _IODN = int(iodn);
|
---|
[6390] | 1750 | }
|
---|
| 1751 | }
|
---|
| 1752 | }
|
---|
| 1753 |
|
---|
[7278] | 1754 | _x_pos *= 1.e3;
|
---|
| 1755 | _y_pos *= 1.e3;
|
---|
| 1756 | _z_pos *= 1.e3;
|
---|
| 1757 | _x_velocity *= 1.e3;
|
---|
| 1758 | _y_velocity *= 1.e3;
|
---|
| 1759 | _z_velocity *= 1.e3;
|
---|
| 1760 | _x_acceleration *= 1.e3;
|
---|
| 1761 | _y_acceleration *= 1.e3;
|
---|
| 1762 | _z_acceleration *= 1.e3;
|
---|
[6385] | 1763 | }
|
---|
| 1764 |
|
---|
[7054] | 1765 | // IOD of SBAS Ephemeris (virtual)
|
---|
| 1766 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1767 |
|
---|
[7169] | 1768 | unsigned int t_ephSBAS::IOD() const {
|
---|
[7054] | 1769 | unsigned char buffer[80];
|
---|
| 1770 | int size = 0;
|
---|
| 1771 | int numbits = 0;
|
---|
| 1772 | long long bitbuffer = 0;
|
---|
| 1773 | unsigned char *startbuffer = buffer;
|
---|
| 1774 |
|
---|
| 1775 | SBASADDBITSFLOAT(30, this->_x_pos, 0.08)
|
---|
| 1776 | SBASADDBITSFLOAT(30, this->_y_pos, 0.08)
|
---|
| 1777 | SBASADDBITSFLOAT(25, this->_z_pos, 0.4)
|
---|
| 1778 | SBASADDBITSFLOAT(17, this->_x_velocity, 0.000625)
|
---|
| 1779 | SBASADDBITSFLOAT(17, this->_y_velocity, 0.000625)
|
---|
| 1780 | SBASADDBITSFLOAT(18, this->_z_velocity, 0.004)
|
---|
| 1781 | SBASADDBITSFLOAT(10, this->_x_acceleration, 0.0000125)
|
---|
| 1782 | SBASADDBITSFLOAT(10, this->_y_acceleration, 0.0000125)
|
---|
| 1783 | SBASADDBITSFLOAT(10, this->_z_acceleration, 0.0000625)
|
---|
| 1784 | SBASADDBITSFLOAT(12, this->_agf0, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
|
---|
| 1785 | SBASADDBITSFLOAT(8, this->_agf1, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
|
---|
| 1786 | SBASADDBITS(5,0); // the last byte is filled by 0-bits to obtain a length of an integer multiple of 8
|
---|
| 1787 |
|
---|
| 1788 | return CRC24(size, startbuffer);
|
---|
| 1789 | }
|
---|
| 1790 |
|
---|
[6385] | 1791 | // Compute SBAS Satellite Position (virtual)
|
---|
| 1792 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1793 | t_irc t_ephSBAS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[6386] | 1794 |
|
---|
| 1795 | bncTime tt(GPSweek, GPSweeks);
|
---|
| 1796 | double dt = tt - _TOC;
|
---|
| 1797 |
|
---|
[7278] | 1798 | xc[0] = _x_pos + _x_velocity * dt + _x_acceleration * dt * dt / 2.0;
|
---|
| 1799 | xc[1] = _y_pos + _y_velocity * dt + _y_acceleration * dt * dt / 2.0;
|
---|
| 1800 | xc[2] = _z_pos + _z_velocity * dt + _z_acceleration * dt * dt / 2.0;
|
---|
[6386] | 1801 |
|
---|
| 1802 | vv[0] = _x_velocity + _x_acceleration * dt;
|
---|
| 1803 | vv[1] = _y_velocity + _y_acceleration * dt;
|
---|
| 1804 | vv[2] = _z_velocity + _z_acceleration * dt;
|
---|
| 1805 |
|
---|
| 1806 | xc[3] = _agf0 + _agf1 * dt;
|
---|
| 1807 |
|
---|
[8542] | 1808 | xc[4] = _agf1;
|
---|
| 1809 | xc[5] = 0.0;
|
---|
[8483] | 1810 |
|
---|
[6386] | 1811 | return success;
|
---|
[6385] | 1812 | }
|
---|
| 1813 |
|
---|
[9774] | 1814 | // Health status of SBAS Ephemeris (virtual)
|
---|
| 1815 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 1816 | unsigned int t_ephSBAS::isUnhealthy() const {
|
---|
| 1817 |
|
---|
| 1818 | // Bit 5
|
---|
| 1819 | bool URAindexIs15 = (int(_health) & (1<<5));
|
---|
| 1820 | if (URAindexIs15) {
|
---|
| 1821 | // in this case it is recommended
|
---|
| 1822 | // to set the bits 0,1,2,3 to 1 (MT17health = 15)
|
---|
| 1823 | return 1;
|
---|
| 1824 | }
|
---|
| 1825 |
|
---|
| 1826 | // Bit 0-3
|
---|
| 1827 | int MT17health = (int(_health)) & (0x0f);
|
---|
| 1828 | if (MT17health) {
|
---|
| 1829 | return 1;
|
---|
| 1830 | }
|
---|
| 1831 |
|
---|
| 1832 | // Bit 4
|
---|
| 1833 | // bool MT17HealthIsUnavailable = (int(_health) & (1<<4));
|
---|
| 1834 | // is not used because the MT17health bits can be independently set if URA index is 15
|
---|
| 1835 |
|
---|
| 1836 | return 0;
|
---|
| 1837 | }
|
---|
| 1838 |
|
---|
| 1839 |
|
---|
[6385] | 1840 | // RINEX Format String
|
---|
| 1841 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6388] | 1842 | QString t_ephSBAS::toString(double version) const {
|
---|
| 1843 |
|
---|
[9765] | 1844 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 1845 | QString rnxStr = navStr + rinexDateStr(_TOC, _prn, version);
|
---|
[6388] | 1846 |
|
---|
| 1847 | QTextStream out(&rnxStr);
|
---|
| 1848 |
|
---|
| 1849 | out << QString("%1%2%3\n")
|
---|
[6390] | 1850 | .arg(_agf0, 19, 'e', 12)
|
---|
| 1851 | .arg(_agf1, 19, 'e', 12)
|
---|
[8456] | 1852 | .arg(_TOT, 19, 'e', 12);
|
---|
[6388] | 1853 |
|
---|
| 1854 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 1855 | // =====================
|
---|
| 1856 | // BROADCAST ORBIT - 1
|
---|
| 1857 | // =====================
|
---|
[6388] | 1858 | out << QString(fmt)
|
---|
| 1859 | .arg(1.e-3*_x_pos, 19, 'e', 12)
|
---|
| 1860 | .arg(1.e-3*_x_velocity, 19, 'e', 12)
|
---|
| 1861 | .arg(1.e-3*_x_acceleration, 19, 'e', 12)
|
---|
[6390] | 1862 | .arg(_health, 19, 'e', 12);
|
---|
[9788] | 1863 | // =====================
|
---|
| 1864 | // BROADCAST ORBIT - 2
|
---|
| 1865 | // =====================
|
---|
[6388] | 1866 | out << QString(fmt)
|
---|
| 1867 | .arg(1.e-3*_y_pos, 19, 'e', 12)
|
---|
| 1868 | .arg(1.e-3*_y_velocity, 19, 'e', 12)
|
---|
| 1869 | .arg(1.e-3*_y_acceleration, 19, 'e', 12)
|
---|
[6390] | 1870 | .arg(_ura, 19, 'e', 12);
|
---|
[9788] | 1871 | // =====================
|
---|
| 1872 | // BROADCAST ORBIT - 3
|
---|
| 1873 | // =====================
|
---|
[6388] | 1874 | out << QString(fmt)
|
---|
| 1875 | .arg(1.e-3*_z_pos, 19, 'e', 12)
|
---|
| 1876 | .arg(1.e-3*_z_velocity, 19, 'e', 12)
|
---|
| 1877 | .arg(1.e-3*_z_acceleration, 19, 'e', 12)
|
---|
[6536] | 1878 | .arg(double(_IODN), 19, 'e', 12);
|
---|
[6388] | 1879 |
|
---|
| 1880 | return rnxStr;
|
---|
[6385] | 1881 | }
|
---|
[6400] | 1882 |
|
---|
| 1883 | // Constructor
|
---|
| 1884 | //////////////////////////////////////////////////////////////////////////////
|
---|
[9367] | 1885 | t_ephBDS::t_ephBDS(double rnxVersion, const QStringList& lines) {
|
---|
[6400] | 1886 |
|
---|
[9788] | 1887 | int nLines = 8;
|
---|
[6400] | 1888 |
|
---|
[9788] | 1889 | if (navType() == t_eph::CNV1 ||
|
---|
| 1890 | navType() == t_eph::CNV2) {
|
---|
| 1891 | nLines += 2;
|
---|
| 1892 | }
|
---|
| 1893 | if (navType() == t_eph::CNV3) {
|
---|
| 1894 | nLines += 1;
|
---|
| 1895 | }
|
---|
| 1896 |
|
---|
[6400] | 1897 | if (lines.size() != nLines) {
|
---|
[6518] | 1898 | _checkState = bad;
|
---|
[6400] | 1899 | return;
|
---|
| 1900 | }
|
---|
| 1901 |
|
---|
| 1902 | // RINEX Format
|
---|
| 1903 | // ------------
|
---|
| 1904 | int fieldLen = 19;
|
---|
| 1905 |
|
---|
| 1906 | int pos[4];
|
---|
| 1907 | pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
|
---|
| 1908 | pos[1] = pos[0] + fieldLen;
|
---|
| 1909 | pos[2] = pos[1] + fieldLen;
|
---|
| 1910 | pos[3] = pos[2] + fieldLen;
|
---|
| 1911 |
|
---|
| 1912 | // Read eight lines
|
---|
| 1913 | // ----------------
|
---|
| 1914 | for (int iLine = 0; iLine < nLines; iLine++) {
|
---|
| 1915 | QString line = lines[iLine];
|
---|
| 1916 |
|
---|
| 1917 | if ( iLine == 0 ) {
|
---|
[8204] | 1918 | QTextStream in(line.left(pos[1]).toLatin1());
|
---|
[6400] | 1919 |
|
---|
| 1920 | int year, month, day, hour, min;
|
---|
| 1921 | double sec;
|
---|
[6880] | 1922 |
|
---|
[7139] | 1923 | QString prnStr, n;
|
---|
[6880] | 1924 | in >> prnStr;
|
---|
[7639] | 1925 | if (prnStr.size() == 1 && prnStr[0] == 'C') {
|
---|
[7139] | 1926 | in >> n;
|
---|
| 1927 | prnStr.append(n);
|
---|
[6880] | 1928 | }
|
---|
| 1929 | in >> year >> month >> day >> hour >> min >> sec;
|
---|
[6400] | 1930 | if (prnStr.at(0) == 'C') {
|
---|
| 1931 | _prn.set('C', prnStr.mid(1).toInt());
|
---|
| 1932 | }
|
---|
| 1933 | else {
|
---|
| 1934 | _prn.set('C', prnStr.toInt());
|
---|
| 1935 | }
|
---|
| 1936 |
|
---|
| 1937 | if (year < 80) {
|
---|
| 1938 | year += 2000;
|
---|
| 1939 | }
|
---|
| 1940 | else if (year < 100) {
|
---|
| 1941 | year += 1900;
|
---|
| 1942 | }
|
---|
| 1943 |
|
---|
[6812] | 1944 | _TOC.setBDS(year, month, day, hour, min, sec);
|
---|
[6400] | 1945 |
|
---|
| 1946 | if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
|
---|
| 1947 | readDbl(line, pos[2], fieldLen, _clock_drift ) ||
|
---|
| 1948 | readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
|
---|
[6518] | 1949 | _checkState = bad;
|
---|
[6400] | 1950 | return;
|
---|
| 1951 | }
|
---|
| 1952 | }
|
---|
[9788] | 1953 | // =====================
|
---|
| 1954 | // BROADCAST ORBIT - 1
|
---|
| 1955 | // =====================
|
---|
[6400] | 1956 | else if ( iLine == 1 ) {
|
---|
| 1957 | double aode;
|
---|
| 1958 | if ( readDbl(line, pos[0], fieldLen, aode ) ||
|
---|
| 1959 | readDbl(line, pos[1], fieldLen, _Crs ) ||
|
---|
| 1960 | readDbl(line, pos[2], fieldLen, _Delta_n) ||
|
---|
| 1961 | readDbl(line, pos[3], fieldLen, _M0 ) ) {
|
---|
[6518] | 1962 | _checkState = bad;
|
---|
[6400] | 1963 | return;
|
---|
| 1964 | }
|
---|
| 1965 | _AODE = int(aode);
|
---|
| 1966 | }
|
---|
[9788] | 1967 | // =====================
|
---|
| 1968 | // BROADCAST ORBIT - 2
|
---|
| 1969 | // =====================
|
---|
[6400] | 1970 | else if ( iLine == 2 ) {
|
---|
| 1971 | if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
|
---|
| 1972 | readDbl(line, pos[1], fieldLen, _e ) ||
|
---|
| 1973 | readDbl(line, pos[2], fieldLen, _Cus ) ||
|
---|
| 1974 | readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
|
---|
[6518] | 1975 | _checkState = bad;
|
---|
[6400] | 1976 | return;
|
---|
| 1977 | }
|
---|
| 1978 | }
|
---|
[9788] | 1979 | // =====================
|
---|
| 1980 | // BROADCAST ORBIT - 3
|
---|
| 1981 | // =====================
|
---|
[6400] | 1982 | else if ( iLine == 3 ) {
|
---|
[6812] | 1983 | if ( readDbl(line, pos[0], fieldLen, _TOEsec ) ||
|
---|
[6400] | 1984 | readDbl(line, pos[1], fieldLen, _Cic ) ||
|
---|
| 1985 | readDbl(line, pos[2], fieldLen, _OMEGA0) ||
|
---|
| 1986 | readDbl(line, pos[3], fieldLen, _Cis ) ) {
|
---|
[6518] | 1987 | _checkState = bad;
|
---|
[6400] | 1988 | return;
|
---|
| 1989 | }
|
---|
| 1990 | }
|
---|
[9788] | 1991 | // =====================
|
---|
| 1992 | // BROADCAST ORBIT - 4
|
---|
| 1993 | // =====================
|
---|
[6400] | 1994 | else if ( iLine == 4 ) {
|
---|
| 1995 | if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
|
---|
| 1996 | readDbl(line, pos[1], fieldLen, _Crc ) ||
|
---|
| 1997 | readDbl(line, pos[2], fieldLen, _omega ) ||
|
---|
| 1998 | readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
|
---|
[6518] | 1999 | _checkState = bad;
|
---|
[6400] | 2000 | return;
|
---|
| 2001 | }
|
---|
| 2002 | }
|
---|
[9788] | 2003 | // =====================
|
---|
| 2004 | // BROADCAST ORBIT - 5
|
---|
| 2005 | // =====================
|
---|
| 2006 | else if ( iLine == 5 ) {
|
---|
[6400] | 2007 |
|
---|
[9788] | 2008 | if (navType() == t_eph::CNV1 ||
|
---|
| 2009 | navType() == t_eph::CNV2 ||
|
---|
| 2010 | navType() == t_eph::CNV3 ) {
|
---|
| 2011 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 2012 | readDbl(line, pos[1], fieldLen, _Delta_n_dot) ||
|
---|
| 2013 | readDbl(line, pos[2], fieldLen, _satType ) ||
|
---|
| 2014 | readDbl(line, pos[3], fieldLen, _top ) ) {
|
---|
| 2015 | _checkState = bad;
|
---|
| 2016 | return;
|
---|
| 2017 | }
|
---|
[6400] | 2018 | }
|
---|
[9788] | 2019 | else { // D1, D2, undefined
|
---|
| 2020 | if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
|
---|
| 2021 | readDbl(line, pos[2], fieldLen, _BDTweek)) {
|
---|
| 2022 | _checkState = bad;
|
---|
| 2023 | return;
|
---|
| 2024 | }
|
---|
| 2025 | }
|
---|
[6400] | 2026 | }
|
---|
[9788] | 2027 | // =====================
|
---|
| 2028 | // BROADCAST ORBIT - 6
|
---|
| 2029 | // =====================
|
---|
[6400] | 2030 | else if ( iLine == 6 ) {
|
---|
[9788] | 2031 | if (navType() == t_eph::CNV1 ||
|
---|
| 2032 | navType() == t_eph::CNV2 ||
|
---|
| 2033 | navType() == t_eph::CNV3 ) {
|
---|
| 2034 | if ( readDbl(line, pos[0], fieldLen, _SISAI_oe ) ||
|
---|
| 2035 | readDbl(line, pos[1], fieldLen, _SISAI_ocb ) ||
|
---|
| 2036 | readDbl(line, pos[2], fieldLen, _SISAI_oc1 ) ||
|
---|
| 2037 | readDbl(line, pos[3], fieldLen, _SISAI_oc2 ) ) {
|
---|
| 2038 | _checkState = bad;
|
---|
| 2039 | return;
|
---|
| 2040 | }
|
---|
[6400] | 2041 | }
|
---|
[9788] | 2042 | else { // D1, D2, undefined
|
---|
| 2043 | double SatH1;
|
---|
| 2044 | if ( readDbl(line, pos[0], fieldLen, _URA ) ||
|
---|
| 2045 | readDbl(line, pos[1], fieldLen, SatH1) ||
|
---|
| 2046 | readDbl(line, pos[2], fieldLen, _TGD1) ||
|
---|
| 2047 | readDbl(line, pos[3], fieldLen, _TGD2) ) {
|
---|
| 2048 | _checkState = bad;
|
---|
| 2049 | return;
|
---|
| 2050 | }
|
---|
| 2051 | _SatH1 = int(SatH1);
|
---|
| 2052 | }
|
---|
[6400] | 2053 | }
|
---|
[9788] | 2054 | // =====================
|
---|
| 2055 | // BROADCAST ORBIT - 7
|
---|
| 2056 | // =====================
|
---|
[6400] | 2057 | else if ( iLine == 7 ) {
|
---|
[9788] | 2058 | if (navType() == t_eph::CNV1) {
|
---|
| 2059 | if ( readDbl(line, pos[0], fieldLen, _ISC_B1Cd) ||
|
---|
| 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::CNV2) {
|
---|
| 2067 | if ( readDbl(line, pos[1], fieldLen, _ISC_B2ad) ||
|
---|
| 2068 | readDbl(line, pos[2], fieldLen, _TGD_B1Cp) ||
|
---|
| 2069 | readDbl(line, pos[3], fieldLen, _TGD_B2ap) ) {
|
---|
| 2070 | _checkState = bad;
|
---|
| 2071 | return;
|
---|
| 2072 | }
|
---|
[6400] | 2073 | }
|
---|
[9788] | 2074 | else if (navType() == t_eph::CNV3) {
|
---|
[9789] | 2075 | double health;
|
---|
[9788] | 2076 | if ( readDbl(line, pos[0], fieldLen, _SISMAI ) ||
|
---|
[9789] | 2077 | readDbl(line, pos[1], fieldLen, health ) ||
|
---|
[9788] | 2078 | readDbl(line, pos[2], fieldLen, _INTEGRITYF_B2b) ||
|
---|
| 2079 | readDbl(line, pos[3], fieldLen, _TGD_B2bI) ) {
|
---|
| 2080 | _checkState = bad;
|
---|
| 2081 | return;
|
---|
| 2082 | }
|
---|
[9789] | 2083 | _health = int(health);
|
---|
[9788] | 2084 | }
|
---|
| 2085 | else { // D1, D2 or undefined
|
---|
| 2086 | double aodc;
|
---|
| 2087 | if ( readDbl(line, pos[0], fieldLen, _TOT) ||
|
---|
| 2088 | readDbl(line, pos[1], fieldLen, aodc) ) {
|
---|
| 2089 | _checkState = bad;
|
---|
| 2090 | return;
|
---|
| 2091 | }
|
---|
| 2092 | if (_TOT == 0.9999e9) { // 0.9999e9 means not known (RINEX standard)
|
---|
| 2093 | _TOT = _TOEsec;
|
---|
| 2094 | }
|
---|
| 2095 | _AODC = int(aodc);
|
---|
| 2096 | }
|
---|
[6400] | 2097 | }
|
---|
[9788] | 2098 | // =====================
|
---|
| 2099 | // BROADCAST ORBIT - 8
|
---|
| 2100 | // =====================
|
---|
| 2101 | else if ( iLine == 8 ) {
|
---|
[9789] | 2102 | double health;
|
---|
[9788] | 2103 | if (navType() == t_eph::CNV1) {
|
---|
| 2104 | if ( readDbl(line, pos[0], fieldLen, _SISMAI ) ||
|
---|
[9789] | 2105 | readDbl(line, pos[1], fieldLen, health ) ||
|
---|
[9788] | 2106 | readDbl(line, pos[2], fieldLen, _INTEGRITYF_B1C) ||
|
---|
| 2107 | readDbl(line, pos[3], fieldLen, _IODC) ) {
|
---|
| 2108 | _checkState = bad;
|
---|
| 2109 | return;
|
---|
| 2110 | }
|
---|
[9789] | 2111 | _health = int(health);
|
---|
[9788] | 2112 | }
|
---|
| 2113 | else if (navType() == t_eph::CNV2) {
|
---|
| 2114 | if ( readDbl(line, pos[0], fieldLen, _SISMAI ) ||
|
---|
[9789] | 2115 | readDbl(line, pos[1], fieldLen, health ) ||
|
---|
[9788] | 2116 | readDbl(line, pos[2], fieldLen, _INTEGRITYF_B2aB1C) ||
|
---|
| 2117 | readDbl(line, pos[3], fieldLen, _IODC) ) {
|
---|
| 2118 | _checkState = bad;
|
---|
| 2119 | return;
|
---|
| 2120 | }
|
---|
[9789] | 2121 | _health = int(health);
|
---|
[9788] | 2122 | }
|
---|
| 2123 | else if (navType() == t_eph::CNV3) {
|
---|
| 2124 | if ( readDbl(line, pos[0], fieldLen, _TOT)) {
|
---|
| 2125 | _checkState = bad;
|
---|
| 2126 | return;
|
---|
| 2127 | }
|
---|
| 2128 | }
|
---|
| 2129 |
|
---|
| 2130 | }
|
---|
| 2131 | // =====================
|
---|
| 2132 | // BROADCAST ORBIT - 9
|
---|
| 2133 | // =====================
|
---|
| 2134 | else if ( iLine == 9 ) {
|
---|
| 2135 |
|
---|
| 2136 | if (navType() == t_eph::CNV1 ||
|
---|
| 2137 | navType() == t_eph::CNV2) {
|
---|
| 2138 | if ( readDbl(line, pos[0], fieldLen, _TOT) ||
|
---|
| 2139 | readDbl(line, pos[3], fieldLen, _IODE) ) {
|
---|
| 2140 | _checkState = bad;
|
---|
| 2141 | return;
|
---|
| 2142 | }
|
---|
| 2143 | }
|
---|
| 2144 |
|
---|
| 2145 | }
|
---|
[6400] | 2146 | }
|
---|
| 2147 |
|
---|
[9788] | 2148 | _TOE.setBDS(int(_BDTweek), _TOEsec);
|
---|
[6400] | 2149 | // remark: actually should be computed from second_tot
|
---|
| 2150 | // but it seems to be unreliable in RINEX files
|
---|
[6843] | 2151 | //_TOT = _TOC.bdssec();
|
---|
[6400] | 2152 | }
|
---|
| 2153 |
|
---|
[7054] | 2154 | // IOD of BDS Ephemeris (virtual)
|
---|
| 2155 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7169] | 2156 | unsigned int t_ephBDS::IOD() const {
|
---|
[9939] | 2157 | return (int(_TOC.gpssec())/720) % 240; //return (int(_TOEsec)/720) % 240;
|
---|
[7054] | 2158 | }
|
---|
| 2159 |
|
---|
[6601] | 2160 | // Compute BDS Satellite Position (virtual)
|
---|
[6400] | 2161 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6600] | 2162 | t_irc t_ephBDS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
|
---|
[6400] | 2163 |
|
---|
[6602] | 2164 | static const double gmBDS = 398.6004418e12;
|
---|
| 2165 | static const double omegaBDS = 7292115.0000e-11;
|
---|
[6400] | 2166 |
|
---|
| 2167 | xc[0] = xc[1] = xc[2] = xc[3] = 0.0;
|
---|
| 2168 | vv[0] = vv[1] = vv[2] = 0.0;
|
---|
| 2169 |
|
---|
| 2170 | bncTime tt(GPSweek, GPSweeks);
|
---|
| 2171 |
|
---|
| 2172 | if (_sqrt_A == 0) {
|
---|
| 2173 | return failure;
|
---|
| 2174 | }
|
---|
| 2175 | double a0 = _sqrt_A * _sqrt_A;
|
---|
| 2176 |
|
---|
[6602] | 2177 | double n0 = sqrt(gmBDS/(a0*a0*a0));
|
---|
[6400] | 2178 | double tk = tt - _TOE;
|
---|
| 2179 | double n = n0 + _Delta_n;
|
---|
| 2180 | double M = _M0 + n*tk;
|
---|
| 2181 | double E = M;
|
---|
| 2182 | double E_last;
|
---|
| 2183 | int nLoop = 0;
|
---|
| 2184 | do {
|
---|
| 2185 | E_last = E;
|
---|
| 2186 | E = M + _e*sin(E);
|
---|
| 2187 |
|
---|
| 2188 | if (++nLoop == 100) {
|
---|
| 2189 | return failure;
|
---|
| 2190 | }
|
---|
| 2191 | } while ( fabs(E-E_last)*a0 > 0.001 );
|
---|
| 2192 |
|
---|
| 2193 | double v = atan2(sqrt(1-_e*_e) * sin(E), cos(E) - _e);
|
---|
| 2194 | double u0 = v + _omega;
|
---|
| 2195 | double sin2u0 = sin(2*u0);
|
---|
| 2196 | double cos2u0 = cos(2*u0);
|
---|
| 2197 | double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
|
---|
| 2198 | double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
|
---|
| 2199 | double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
|
---|
| 2200 | double xp = r*cos(u);
|
---|
| 2201 | double yp = r*sin(u);
|
---|
| 2202 | double toesec = (_TOE.gpssec() - 14.0);
|
---|
| 2203 | double sinom = 0;
|
---|
| 2204 | double cosom = 0;
|
---|
| 2205 | double sini = 0;
|
---|
| 2206 | double cosi = 0;
|
---|
[7278] | 2207 |
|
---|
[7481] | 2208 | // Velocity
|
---|
| 2209 | // --------
|
---|
| 2210 | double tanv2 = tan(v/2);
|
---|
| 2211 | double dEdM = 1 / (1 - _e*cos(E));
|
---|
| 2212 | double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2)
|
---|
| 2213 | / (1 + tanv2*tanv2) * dEdM * n;
|
---|
| 2214 | double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
|
---|
| 2215 | double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
|
---|
| 2216 | double dotr = a0 * _e*sin(E) * dEdM * n
|
---|
| 2217 | + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
|
---|
| 2218 |
|
---|
| 2219 | double dotx = dotr*cos(u) - r*sin(u)*dotu;
|
---|
| 2220 | double doty = dotr*sin(u) + r*cos(u)*dotu;
|
---|
| 2221 |
|
---|
[6400] | 2222 | const double iMaxGEO = 10.0 / 180.0 * M_PI;
|
---|
| 2223 |
|
---|
| 2224 | // MEO/IGSO satellite
|
---|
| 2225 | // ------------------
|
---|
| 2226 | if (_i0 > iMaxGEO) {
|
---|
[6602] | 2227 | double OM = _OMEGA0 + (_OMEGADOT - omegaBDS)*tk - omegaBDS*toesec;
|
---|
[6400] | 2228 |
|
---|
| 2229 | sinom = sin(OM);
|
---|
| 2230 | cosom = cos(OM);
|
---|
| 2231 | sini = sin(i);
|
---|
| 2232 | cosi = cos(i);
|
---|
| 2233 |
|
---|
| 2234 | xc[0] = xp*cosom - yp*cosi*sinom;
|
---|
| 2235 | xc[1] = xp*sinom + yp*cosi*cosom;
|
---|
[7278] | 2236 | xc[2] = yp*sini;
|
---|
[7481] | 2237 |
|
---|
| 2238 | // Velocity
|
---|
| 2239 | // --------
|
---|
| 2240 |
|
---|
| 2241 | double dotom = _OMEGADOT - t_CST::omega;
|
---|
| 2242 |
|
---|
| 2243 | vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
|
---|
| 2244 | - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
|
---|
| 2245 | + yp*sini*sinom*doti; // dX / di
|
---|
| 2246 |
|
---|
| 2247 | vv[1] = sinom *dotx + cosi*cosom *doty
|
---|
| 2248 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 2249 | - yp*sini*cosom*doti;
|
---|
| 2250 |
|
---|
| 2251 | vv[2] = sini *doty + yp*cosi *doti;
|
---|
| 2252 |
|
---|
[6400] | 2253 | }
|
---|
| 2254 |
|
---|
| 2255 | // GEO satellite
|
---|
| 2256 | // -------------
|
---|
| 2257 | else {
|
---|
[6602] | 2258 | double OM = _OMEGA0 + _OMEGADOT*tk - omegaBDS*toesec;
|
---|
| 2259 | double ll = omegaBDS*tk;
|
---|
[6400] | 2260 |
|
---|
| 2261 | sinom = sin(OM);
|
---|
| 2262 | cosom = cos(OM);
|
---|
| 2263 | sini = sin(i);
|
---|
| 2264 | cosi = cos(i);
|
---|
| 2265 |
|
---|
| 2266 | double xx = xp*cosom - yp*cosi*sinom;
|
---|
| 2267 | double yy = xp*sinom + yp*cosi*cosom;
|
---|
[7278] | 2268 | double zz = yp*sini;
|
---|
[6400] | 2269 |
|
---|
[7487] | 2270 | Matrix RX = BNC_PPP::t_astro::rotX(-5.0 / 180.0 * M_PI);
|
---|
| 2271 | Matrix RZ = BNC_PPP::t_astro::rotZ(ll);
|
---|
[6400] | 2272 |
|
---|
| 2273 | ColumnVector X1(3); X1 << xx << yy << zz;
|
---|
[7487] | 2274 | ColumnVector X2 = RZ*RX*X1;
|
---|
[6400] | 2275 |
|
---|
| 2276 | xc[0] = X2(1);
|
---|
| 2277 | xc[1] = X2(2);
|
---|
| 2278 | xc[2] = X2(3);
|
---|
[7278] | 2279 |
|
---|
[7481] | 2280 | double dotom = _OMEGADOT;
|
---|
[6400] | 2281 |
|
---|
[7481] | 2282 | double vx = cosom *dotx - cosi*sinom *doty
|
---|
| 2283 | - xp*sinom*dotom - yp*cosi*cosom*dotom
|
---|
| 2284 | + yp*sini*sinom*doti;
|
---|
[6400] | 2285 |
|
---|
[7481] | 2286 | double vy = sinom *dotx + cosi*cosom *doty
|
---|
| 2287 | + xp*cosom*dotom - yp*cosi*sinom*dotom
|
---|
| 2288 | - yp*sini*cosom*doti;
|
---|
[7278] | 2289 |
|
---|
[7501] | 2290 | double vz = sini *doty + yp*cosi *doti;
|
---|
[6400] | 2291 |
|
---|
[7501] | 2292 | ColumnVector V(3); V << vx << vy << vz;
|
---|
[7481] | 2293 |
|
---|
[7487] | 2294 | Matrix RdotZ(3,3);
|
---|
[7481] | 2295 | double C = cos(ll);
|
---|
| 2296 | double S = sin(ll);
|
---|
| 2297 | Matrix UU(3,3);
|
---|
| 2298 | UU[0][0] = -S; UU[0][1] = +C; UU[0][2] = 0.0;
|
---|
| 2299 | UU[1][0] = -C; UU[1][1] = -S; UU[1][2] = 0.0;
|
---|
| 2300 | UU[2][0] = 0.0; UU[2][1] = 0.0; UU[2][2] = 0.0;
|
---|
[7487] | 2301 | RdotZ = omegaBDS * UU;
|
---|
[7481] | 2302 |
|
---|
| 2303 | ColumnVector VV(3);
|
---|
[7487] | 2304 | VV = RZ*RX*V + RdotZ*RX*X1;
|
---|
[7481] | 2305 |
|
---|
| 2306 | vv[0] = VV(1);
|
---|
| 2307 | vv[1] = VV(2);
|
---|
| 2308 | vv[2] = VV(3);
|
---|
| 2309 | }
|
---|
| 2310 |
|
---|
| 2311 | double tc = tt - _TOC;
|
---|
| 2312 | xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
|
---|
| 2313 |
|
---|
[9132] | 2314 | // dotC = _clock_drift + _clock_driftrate*tc
|
---|
[9290] | 2315 | // - 4.442807309e-10*_e * sqrt(a0) * cos(E) * dEdM * n;
|
---|
[6400] | 2316 |
|
---|
[7481] | 2317 | // Relativistic Correction
|
---|
| 2318 | // -----------------------
|
---|
[9290] | 2319 | xc[3] -= 4.442807309e-10 * _e * sqrt(a0) *sin(E);
|
---|
[7481] | 2320 |
|
---|
[8542] | 2321 | xc[4] = _clock_drift + _clock_driftrate*tc;
|
---|
| 2322 | xc[5] = _clock_driftrate;
|
---|
[9126] | 2323 |
|
---|
[6400] | 2324 | return success;
|
---|
| 2325 | }
|
---|
| 2326 |
|
---|
[9789] | 2327 |
|
---|
| 2328 | // Health status of SBAS Ephemeris (virtual)
|
---|
| 2329 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 2330 | unsigned int t_ephBDS::isUnhealthy() const {
|
---|
| 2331 |
|
---|
| 2332 | if (navType() == t_eph::CNV1 ||
|
---|
| 2333 | navType() == t_eph::CNV2 ||
|
---|
| 2334 | navType() == t_eph::CNV3) {
|
---|
| 2335 | return static_cast<unsigned int>(_health);
|
---|
| 2336 | }
|
---|
| 2337 |
|
---|
| 2338 | return static_cast<unsigned int>(_SatH1);
|
---|
| 2339 |
|
---|
| 2340 | }
|
---|
| 2341 |
|
---|
| 2342 |
|
---|
[6400] | 2343 | // RINEX Format String
|
---|
| 2344 | //////////////////////////////////////////////////////////////////////////////
|
---|
[6600] | 2345 | QString t_ephBDS::toString(double version) const {
|
---|
[8419] | 2346 |
|
---|
[9765] | 2347 | QString navStr = navTypeString(_navType, _prn, version);
|
---|
| 2348 | QString rnxStr = navStr + rinexDateStr(_TOC-14.0, _prn, version);
|
---|
[6400] | 2349 |
|
---|
| 2350 | QTextStream out(&rnxStr);
|
---|
| 2351 |
|
---|
| 2352 | out << QString("%1%2%3\n")
|
---|
| 2353 | .arg(_clock_bias, 19, 'e', 12)
|
---|
| 2354 | .arg(_clock_drift, 19, 'e', 12)
|
---|
| 2355 | .arg(_clock_driftrate, 19, 'e', 12);
|
---|
| 2356 |
|
---|
| 2357 | QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
|
---|
[9788] | 2358 | // =====================
|
---|
| 2359 | // BROADCAST ORBIT - 1
|
---|
| 2360 | // =====================
|
---|
[6400] | 2361 | out << QString(fmt)
|
---|
| 2362 | .arg(double(_AODE), 19, 'e', 12)
|
---|
| 2363 | .arg(_Crs, 19, 'e', 12)
|
---|
| 2364 | .arg(_Delta_n, 19, 'e', 12)
|
---|
| 2365 | .arg(_M0, 19, 'e', 12);
|
---|
[9788] | 2366 | // =====================
|
---|
| 2367 | // BROADCAST ORBIT - 2
|
---|
| 2368 | // =====================
|
---|
[6400] | 2369 | out << QString(fmt)
|
---|
| 2370 | .arg(_Cuc, 19, 'e', 12)
|
---|
| 2371 | .arg(_e, 19, 'e', 12)
|
---|
| 2372 | .arg(_Cus, 19, 'e', 12)
|
---|
| 2373 | .arg(_sqrt_A, 19, 'e', 12);
|
---|
[9788] | 2374 | // =====================
|
---|
| 2375 | // BROADCAST ORBIT - 3
|
---|
| 2376 | // =====================
|
---|
[6400] | 2377 | out << QString(fmt)
|
---|
[9785] | 2378 | .arg(_TOEsec, 19, 'e', 12)
|
---|
[6755] | 2379 | .arg(_Cic, 19, 'e', 12)
|
---|
| 2380 | .arg(_OMEGA0, 19, 'e', 12)
|
---|
| 2381 | .arg(_Cis, 19, 'e', 12);
|
---|
[9788] | 2382 | // =====================
|
---|
| 2383 | // BROADCAST ORBIT - 4
|
---|
| 2384 | // =====================
|
---|
[6400] | 2385 | out << QString(fmt)
|
---|
| 2386 | .arg(_i0, 19, 'e', 12)
|
---|
| 2387 | .arg(_Crc, 19, 'e', 12)
|
---|
| 2388 | .arg(_omega, 19, 'e', 12)
|
---|
| 2389 | .arg(_OMEGADOT, 19, 'e', 12);
|
---|
[9788] | 2390 | // =====================
|
---|
| 2391 | // BROADCAST ORBIT - 5
|
---|
| 2392 | // =====================
|
---|
| 2393 | if (navType() == t_eph::CNV1 ||
|
---|
| 2394 | navType() == t_eph::CNV2 ||
|
---|
| 2395 | navType() == t_eph::CNV3 ) {
|
---|
| 2396 | out << QString(fmt)
|
---|
| 2397 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 2398 | .arg(_Delta_n_dot, 19, 'e', 12)
|
---|
| 2399 | .arg(_satType, 19, 'e', 12)
|
---|
| 2400 | .arg(_top, 19, 'e', 12);
|
---|
| 2401 | }
|
---|
| 2402 | else { // D1, D2, undefined
|
---|
| 2403 | out << QString(fmt)
|
---|
| 2404 | .arg(_IDOT, 19, 'e', 12)
|
---|
| 2405 | .arg("", 19, QChar(' '))
|
---|
| 2406 | .arg(_BDTweek, 19, 'e', 12)
|
---|
| 2407 | .arg("", 19, QChar(' '));
|
---|
| 2408 | }
|
---|
| 2409 | // =====================
|
---|
| 2410 | // BROADCAST ORBIT - 6
|
---|
| 2411 | // =====================
|
---|
| 2412 | if (navType() == t_eph::CNV1 ||
|
---|
| 2413 | navType() == t_eph::CNV2 ||
|
---|
| 2414 | navType() == t_eph::CNV3 ) {
|
---|
| 2415 | out << QString(fmt)
|
---|
| 2416 | .arg(_SISAI_oe, 19, 'e', 12)
|
---|
| 2417 | .arg(_SISAI_ocb, 19, 'e', 12)
|
---|
| 2418 | .arg(_SISAI_oc1, 19, 'e', 12)
|
---|
| 2419 | .arg(_SISAI_oc2, 19, 'e', 12);
|
---|
| 2420 | }
|
---|
| 2421 | else { // D1, D2, undefined
|
---|
| 2422 | out << QString(fmt)
|
---|
| 2423 | .arg(_URA, 19, 'e', 12)
|
---|
| 2424 | .arg(double(_SatH1), 19, 'e', 12)
|
---|
| 2425 | .arg(_TGD1, 19, 'e', 12)
|
---|
| 2426 | .arg(_TGD2, 19, 'e', 12);
|
---|
| 2427 | }
|
---|
| 2428 | // =====================
|
---|
| 2429 | // BROADCAST ORBIT - 7
|
---|
| 2430 | // =====================
|
---|
| 2431 | if (navType() == t_eph::CNV1) {
|
---|
| 2432 | out << QString(fmt)
|
---|
| 2433 | .arg(_ISC_B1Cd, 19, 'e', 12)
|
---|
| 2434 | .arg("", 19, QChar(' '))
|
---|
| 2435 | .arg(_TGD_B1Cp, 19, 'e', 12)
|
---|
| 2436 | .arg(_TGD_B2ap, 19, 'e', 12);
|
---|
| 2437 | }
|
---|
| 2438 | else if (navType() == t_eph::CNV2) {
|
---|
| 2439 | out << QString(fmt)
|
---|
| 2440 | .arg("", 19, QChar(' '))
|
---|
| 2441 | .arg(_ISC_B2ad, 19, 'e', 12)
|
---|
| 2442 | .arg(_TGD_B1Cp, 19, 'e', 12)
|
---|
| 2443 | .arg(_TGD_B2ap, 19, 'e', 12);
|
---|
| 2444 | }
|
---|
| 2445 | else if (navType() == t_eph::CNV3) {
|
---|
| 2446 | out << QString(fmt)
|
---|
| 2447 | .arg(_SISMAI, 19, 'e', 12)
|
---|
[9789] | 2448 | .arg(double(_health), 19, 'e', 12)
|
---|
[9788] | 2449 | .arg(_INTEGRITYF_B2b, 19, 'e', 12)
|
---|
| 2450 | .arg(_TGD_B2bI, 19, 'e', 12);
|
---|
| 2451 | }
|
---|
| 2452 | else { // D1, D2, undefined
|
---|
| 2453 | double tots = 0.0;
|
---|
| 2454 | if (_receptDateTime.isValid()) {// RTCM stream input
|
---|
| 2455 | tots = _TOE.bdssec();
|
---|
| 2456 | }
|
---|
| 2457 | else { // RINEX input
|
---|
| 2458 | tots = _TOT;
|
---|
| 2459 | }
|
---|
| 2460 | out << QString(fmt)
|
---|
| 2461 | .arg(tots, 19, 'e', 12)
|
---|
| 2462 | .arg(double(_AODC), 19, 'e', 12)
|
---|
| 2463 | .arg("", 19, QChar(' '))
|
---|
| 2464 | .arg("", 19, QChar(' '));
|
---|
| 2465 | }
|
---|
[6400] | 2466 |
|
---|
[9788] | 2467 | // =====================
|
---|
| 2468 | // BROADCAST ORBIT - 8
|
---|
| 2469 | // =====================
|
---|
| 2470 | if (navType() == t_eph::CNV1) {
|
---|
| 2471 | out << QString(fmt)
|
---|
| 2472 | .arg(_SISMAI, 19, 'e', 12)
|
---|
[9789] | 2473 | .arg(double(_health), 19, 'e', 12)
|
---|
[9788] | 2474 | .arg(_INTEGRITYF_B1C, 19, 'e', 12)
|
---|
| 2475 | .arg(_IODC, 19, 'e', 12);
|
---|
| 2476 | }
|
---|
| 2477 | else if (navType() == t_eph::CNV2) {
|
---|
| 2478 | out << QString(fmt)
|
---|
| 2479 | .arg(_SISMAI, 19, 'e', 12)
|
---|
[9789] | 2480 | .arg(double(_health), 19, 'e', 12)
|
---|
[9788] | 2481 | .arg(_INTEGRITYF_B2aB1C, 19, 'e', 12)
|
---|
| 2482 | .arg(_IODC, 19, 'e', 12);
|
---|
| 2483 | }
|
---|
| 2484 | else if (navType() == t_eph::CNV3) {
|
---|
| 2485 | out << QString(fmt)
|
---|
| 2486 | .arg(_TOT, 19, 'e', 12)
|
---|
| 2487 | .arg("", 19, QChar(' '))
|
---|
| 2488 | .arg("", 19, QChar(' '))
|
---|
| 2489 | .arg("", 19, QChar(' '));
|
---|
| 2490 | }
|
---|
[6400] | 2491 |
|
---|
[9788] | 2492 | // =====================
|
---|
| 2493 | // BROADCAST ORBIT - 9
|
---|
| 2494 | // =====================
|
---|
| 2495 | if (navType() == t_eph::CNV1 ||
|
---|
| 2496 | navType() == t_eph::CNV2) {
|
---|
| 2497 | out << QString(fmt)
|
---|
| 2498 | .arg(_TOT, 19, 'e', 12)
|
---|
| 2499 | .arg("", 19, QChar(' '))
|
---|
| 2500 | .arg("", 19, QChar(' '))
|
---|
| 2501 | .arg(_IODE, 19, 'e', 12);
|
---|
| 2502 | }
|
---|
[6400] | 2503 |
|
---|
[9788] | 2504 |
|
---|
[6400] | 2505 | return rnxStr;
|
---|
| 2506 | }
|
---|