source: ntrip/branches/BNC_2.12/src/ephemeris.cpp@ 8455

Last change on this file since 8455 was 8455, checked in by stuerze, 6 years ago

bug fixed regarding TOT in BDS and SBAS RTCM3 ephemeris message

File size: 48.9 KB
RevLine 
[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
17using namespace std;
18
[5749]19// Constructor
20////////////////////////////////////////////////////////////////////////////
21t_eph::t_eph() {
[6518]22 _checkState = unchecked;
23 _orbCorr = 0;
24 _clkCorr = 0;
[5749]25}
[7278]26// Destructor
27////////////////////////////////////////////////////////////////////////////
28t_eph::~t_eph() {
29 if (_orbCorr)
30 delete _orbCorr;
31 if (_clkCorr)
32 delete _clkCorr;
33}
[5749]34
[7481]35//
[5749]36////////////////////////////////////////////////////////////////////////////
[6141]37void t_eph::setOrbCorr(const t_orbCorr* orbCorr) {
[8006]38 if (_orbCorr) {
39 delete _orbCorr;
40 _orbCorr = 0;
41 }
[6141]42 _orbCorr = new t_orbCorr(*orbCorr);
[5749]43}
44
[7481]45//
[5749]46////////////////////////////////////////////////////////////////////////////
[6141]47void t_eph::setClkCorr(const t_clkCorr* clkCorr) {
[8006]48 if (_clkCorr) {
49 delete _clkCorr;
50 _clkCorr = 0;
51 }
[6141]52 _clkCorr = new t_clkCorr(*clkCorr);
[5749]53}
54
[7481]55//
[5749]56////////////////////////////////////////////////////////////////////////////
[6109]57t_irc t_eph::getCrd(const bncTime& tt, ColumnVector& xc, ColumnVector& vv, bool useCorr) const {
[6518]58
[8420]59 if (_checkState == bad ||
60 _checkState == unhealthy) {
[6518]61 return failure;
62 }
[6556]63 const QVector<int> updateInt = QVector<int>() << 1 << 2 << 5 << 10 << 15 << 30
64 << 60 << 120 << 240 << 300 << 600
65 << 900 << 1800 << 3600 << 7200
66 << 10800;
[5749]67 xc.ReSize(4);
68 vv.ReSize(3);
[6213]69 if (position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data()) != success) {
70 return failure;
71 }
[5789]72 if (useCorr) {
[5839]73 if (_orbCorr && _clkCorr) {
[5849]74 double dtO = tt - _orbCorr->_time;
[6556]75 if (_orbCorr->_updateInt) {
76 dtO -= (0.5 * updateInt[_orbCorr->_updateInt]);
77 }
[5839]78 ColumnVector dx(3);
[5849]79 dx[0] = _orbCorr->_xr[0] + _orbCorr->_dotXr[0] * dtO;
80 dx[1] = _orbCorr->_xr[1] + _orbCorr->_dotXr[1] * dtO;
81 dx[2] = _orbCorr->_xr[2] + _orbCorr->_dotXr[2] * dtO;
82
[7133]83 RSW_to_XYZ(xc.Rows(1,3), vv.Rows(1,3), dx, dx);
[5849]84
[5839]85 xc[0] -= dx[0];
86 xc[1] -= dx[1];
87 xc[2] -= dx[2];
[5849]88
[7133]89 ColumnVector dv(3);
90 RSW_to_XYZ(xc.Rows(1,3), vv.Rows(1,3), _orbCorr->_dotXr, dv);
91
92 vv[0] -= dv[0];
93 vv[1] -= dv[1];
94 vv[2] -= dv[2];
95
[5849]96 double dtC = tt - _clkCorr->_time;
[6556]97 if (_clkCorr->_updateInt) {
98 dtC -= (0.5 * updateInt[_clkCorr->_updateInt]);
99 }
[7014]100 xc[3] += _clkCorr->_dClk + _clkCorr->_dotDClk * dtC + _clkCorr->_dotDotDClk * dtC * dtC;
[5839]101 }
102 else {
103 return failure;
104 }
[5749]105 }
106 return success;
107}
108
[6801]109//
110//////////////////////////////////////////////////////////////////////////////
111QString t_eph::rinexDateStr(const bncTime& tt, const t_prn& prn, double version) {
112 QString prnStr(prn.toString().c_str());
113 return rinexDateStr(tt, prnStr, version);
114}
115
116//
117//////////////////////////////////////////////////////////////////////////////
118QString t_eph::rinexDateStr(const bncTime& tt, const QString& prnStr, double version) {
119
120 QString datStr;
121
122 unsigned year, month, day, hour, min;
123 double sec;
124 tt.civil_date(year, month, day);
125 tt.civil_time(hour, min, sec);
126
127 QTextStream out(&datStr);
128
129 if (version < 3.0) {
130 QString prnHlp = prnStr.mid(1,2); if (prnHlp[0] == '0') prnHlp[0] = ' ';
131 out << prnHlp << QString(" %1 %2 %3 %4 %5%6")
132 .arg(year % 100, 2, 10, QChar('0'))
133 .arg(month, 2)
134 .arg(day, 2)
135 .arg(hour, 2)
136 .arg(min, 2)
137 .arg(sec, 5, 'f',1);
138 }
139 else {
140 out << prnStr << QString(" %1 %2 %3 %4 %5 %6")
141 .arg(year, 4)
142 .arg(month, 2, 10, QChar('0'))
143 .arg(day, 2, 10, QChar('0'))
144 .arg(hour, 2, 10, QChar('0'))
145 .arg(min, 2, 10, QChar('0'))
146 .arg(int(sec), 2, 10, QChar('0'));
147 }
148
149 return datStr;
150}
151
152// Constructor
153//////////////////////////////////////////////////////////////////////////////
154t_ephGPS::t_ephGPS(float rnxVersion, const QStringList& lines) {
155
156 const int nLines = 8;
157
158 if (lines.size() != nLines) {
159 _checkState = bad;
160 return;
161 }
162
163 // RINEX Format
164 // ------------
165 int fieldLen = 19;
166
167 int pos[4];
168 pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
169 pos[1] = pos[0] + fieldLen;
170 pos[2] = pos[1] + fieldLen;
171 pos[3] = pos[2] + fieldLen;
172
173 // Read eight lines
174 // ----------------
175 for (int iLine = 0; iLine < nLines; iLine++) {
176 QString line = lines[iLine];
177
178 if ( iLine == 0 ) {
179 QTextStream in(line.left(pos[1]).toAscii());
180 int year, month, day, hour, min;
181 double sec;
182
[7139]183 QString prnStr, n;
[6880]184 in >> prnStr;
[7639]185
186 if (prnStr.size() == 1 &&
[8167]187 (prnStr[0] == 'G' ||
188 prnStr[0] == 'J' ||
189 prnStr[0] == 'I')) {
[7139]190 in >> n;
191 prnStr.append(n);
[6880]192 }
[7639]193
[6880]194 in >> year >> month >> day >> hour >> min >> sec;
[6801]195 if (prnStr.at(0) == 'G') {
196 _prn.set('G', prnStr.mid(1).toInt());
197 }
198 else if (prnStr.at(0) == 'J') {
199 _prn.set('J', prnStr.mid(1).toInt());
200 }
[8167]201 else if (prnStr.at(0) == 'I') {
202 _prn.set('I', prnStr.mid(1).toInt());
203 }
[6801]204 else {
205 _prn.set('G', prnStr.toInt());
206 }
207
208 if (year < 80) {
209 year += 2000;
210 }
211 else if (year < 100) {
212 year += 1900;
213 }
214
215 _TOC.set(year, month, day, hour, min, sec);
216
217 if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
218 readDbl(line, pos[2], fieldLen, _clock_drift ) ||
219 readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
220 _checkState = bad;
221 return;
222 }
223 }
224
225 else if ( iLine == 1 ) {
226 if ( readDbl(line, pos[0], fieldLen, _IODE ) ||
227 readDbl(line, pos[1], fieldLen, _Crs ) ||
228 readDbl(line, pos[2], fieldLen, _Delta_n) ||
229 readDbl(line, pos[3], fieldLen, _M0 ) ) {
230 _checkState = bad;
231 return;
232 }
233 }
234
235 else if ( iLine == 2 ) {
236 if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
237 readDbl(line, pos[1], fieldLen, _e ) ||
238 readDbl(line, pos[2], fieldLen, _Cus ) ||
239 readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
240 _checkState = bad;
241 return;
242 }
243 }
244
245 else if ( iLine == 3 ) {
246 if ( readDbl(line, pos[0], fieldLen, _TOEsec) ||
247 readDbl(line, pos[1], fieldLen, _Cic ) ||
248 readDbl(line, pos[2], fieldLen, _OMEGA0) ||
249 readDbl(line, pos[3], fieldLen, _Cis ) ) {
250 _checkState = bad;
251 return;
252 }
253 }
254
255 else if ( iLine == 4 ) {
256 if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
257 readDbl(line, pos[1], fieldLen, _Crc ) ||
258 readDbl(line, pos[2], fieldLen, _omega ) ||
259 readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
260 _checkState = bad;
261 return;
262 }
263 }
264
[8167]265 else if ( iLine == 5 && type() != t_eph::IRNSS) {
[6801]266 if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
267 readDbl(line, pos[1], fieldLen, _L2Codes) ||
268 readDbl(line, pos[2], fieldLen, _TOEweek ) ||
269 readDbl(line, pos[3], fieldLen, _L2PFlag) ) {
270 _checkState = bad;
271 return;
272 }
273 }
[8167]274 else if ( iLine == 5 && type() == t_eph::IRNSS) {
275 if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
276 readDbl(line, pos[2], fieldLen, _TOEweek) ) {
277 _checkState = bad;
278 return;
279 }
280 }
[6801]281
[8167]282 else if ( iLine == 6 && type() != t_eph::IRNSS) {
[6801]283 if ( readDbl(line, pos[0], fieldLen, _ura ) ||
284 readDbl(line, pos[1], fieldLen, _health) ||
285 readDbl(line, pos[2], fieldLen, _TGD ) ||
286 readDbl(line, pos[3], fieldLen, _IODC ) ) {
287 _checkState = bad;
288 return;
289 }
290 }
[8167]291 else if ( iLine == 6 && type() == t_eph::IRNSS) {
292 if ( readDbl(line, pos[0], fieldLen, _ura ) ||
293 readDbl(line, pos[1], fieldLen, _health) ||
294 readDbl(line, pos[2], fieldLen, _TGD ) ) {
295 _checkState = bad;
296 return;
297 }
298 }
[6801]299
300 else if ( iLine == 7 ) {
301 if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
302 _checkState = bad;
303 return;
304 }
305 readDbl(line, pos[1], fieldLen, _fitInterval); // _fitInterval optional
306 }
307 }
308}
309
[2222]310// Compute GPS Satellite Position (virtual)
[1025]311////////////////////////////////////////////////////////////////////////////
[6213]312t_irc t_ephGPS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
[1025]313
[8420]314 if (_checkState == bad ||
315 _checkState == unhealthy) {
[6518]316 return failure;
317 }
318
[1098]319 static const double omegaEarth = 7292115.1467e-11;
[5277]320 static const double gmGRS = 398.6005e12;
[1025]321
322 memset(xc, 0, 4*sizeof(double));
323 memset(vv, 0, 3*sizeof(double));
324
325 double a0 = _sqrt_A * _sqrt_A;
326 if (a0 == 0) {
[6213]327 return failure;
[1025]328 }
329
[5277]330 double n0 = sqrt(gmGRS/(a0*a0*a0));
[4018]331
332 bncTime tt(GPSweek, GPSweeks);
[4543]333 double tk = tt - bncTime(int(_TOEweek), _TOEsec);
[4018]334
[1025]335 double n = n0 + _Delta_n;
336 double M = _M0 + n*tk;
337 double E = M;
338 double E_last;
[8370]339 int nLoop = 0;
[1025]340 do {
341 E_last = E;
342 E = M + _e*sin(E);
[8455]343
[8370]344 if (++nLoop == 100) {
345 return failure;
346 }
[1025]347 } while ( fabs(E-E_last)*a0 > 0.001 );
348 double v = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
349 double u0 = v + _omega;
350 double sin2u0 = sin(2*u0);
351 double cos2u0 = cos(2*u0);
352 double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
353 double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
354 double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
355 double xp = r*cos(u);
356 double yp = r*sin(u);
[7481]357 double OM = _OMEGA0 + (_OMEGADOT - omegaEarth)*tk -
[4018]358 omegaEarth*_TOEsec;
[7278]359
[1025]360 double sinom = sin(OM);
361 double cosom = cos(OM);
362 double sini = sin(i);
363 double cosi = cos(i);
364 xc[0] = xp*cosom - yp*cosi*sinom;
365 xc[1] = xp*sinom + yp*cosi*cosom;
[7481]366 xc[2] = yp*sini;
367
[4018]368 double tc = tt - _TOC;
[2429]369 xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
[1025]370
371 // Velocity
372 // --------
373 double tanv2 = tan(v/2);
374 double dEdM = 1 / (1 - _e*cos(E));
[7278]375 double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2) / (1 + tanv2*tanv2)
[1025]376 * dEdM * n;
377 double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
378 double dotom = _OMEGADOT - omegaEarth;
379 double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
[7278]380 double dotr = a0 * _e*sin(E) * dEdM * n
[1025]381 + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
382 double dotx = dotr*cos(u) - r*sin(u)*dotu;
383 double doty = dotr*sin(u) + r*cos(u)*dotu;
384
385 vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
386 - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
387 + yp*sini*sinom*doti; // dX / di
388
389 vv[1] = sinom *dotx + cosi*cosom *doty
390 + xp*cosom*dotom - yp*cosi*sinom*dotom
391 - yp*sini*cosom*doti;
392
393 vv[2] = sini *doty + yp*cosi *doti;
[2429]394
395 // Relativistic Correction
396 // -----------------------
[7481]397 // correspondent to IGS convention and GPS ICD (and SSR standard)
[2429]398 xc[3] -= 2.0 * (xc[0]*vv[0] + xc[1]*vv[1] + xc[2]*vv[2]) / t_CST::c / t_CST::c;
[6213]399
400 return success;
[1025]401}
402
[6801]403// RINEX Format String
404//////////////////////////////////////////////////////////////////////////////
405QString t_ephGPS::toString(double version) const {
[2221]406
[6801]407 QString rnxStr = rinexDateStr(_TOC, _prn, version);
[2221]408
[6801]409 QTextStream out(&rnxStr);
[2221]410
[6801]411 out << QString("%1%2%3\n")
412 .arg(_clock_bias, 19, 'e', 12)
413 .arg(_clock_drift, 19, 'e', 12)
414 .arg(_clock_driftrate, 19, 'e', 12);
[2221]415
[6801]416 QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
[2221]417
[8167]418 out << QString(fmt)
[6801]419 .arg(_IODE, 19, 'e', 12)
420 .arg(_Crs, 19, 'e', 12)
421 .arg(_Delta_n, 19, 'e', 12)
422 .arg(_M0, 19, 'e', 12);
423
424 out << QString(fmt)
425 .arg(_Cuc, 19, 'e', 12)
426 .arg(_e, 19, 'e', 12)
427 .arg(_Cus, 19, 'e', 12)
428 .arg(_sqrt_A, 19, 'e', 12);
429
430 out << QString(fmt)
431 .arg(_TOEsec, 19, 'e', 12)
432 .arg(_Cic, 19, 'e', 12)
433 .arg(_OMEGA0, 19, 'e', 12)
434 .arg(_Cis, 19, 'e', 12);
435
436 out << QString(fmt)
437 .arg(_i0, 19, 'e', 12)
438 .arg(_Crc, 19, 'e', 12)
439 .arg(_omega, 19, 'e', 12)
440 .arg(_OMEGADOT, 19, 'e', 12);
441
[8167]442 if (type() == t_eph::IRNSS) {
443 out << QString(fmt)
444 .arg(_IDOT, 19, 'e', 12)
445 .arg("", 19, QChar(' '))
446 .arg(_TOEweek, 19, 'e', 12)
447 .arg("", 19, QChar(' '));
448 }
449 else {
450 out << QString(fmt)
451 .arg(_IDOT, 19, 'e', 12)
452 .arg(_L2Codes, 19, 'e', 12)
453 .arg(_TOEweek, 19, 'e', 12)
454 .arg(_L2PFlag, 19, 'e', 12);
455 }
[6801]456
[8167]457 if (type() == t_eph::IRNSS) {
458 out << QString(fmt)
459 .arg(_ura, 19, 'e', 12)
460 .arg(_health, 19, 'e', 12)
461 .arg(_TGD, 19, 'e', 12)
462 .arg("", 19, QChar(' '));
463 }
464 else {
465 out << QString(fmt)
466 .arg(_ura, 19, 'e', 12)
467 .arg(_health, 19, 'e', 12)
468 .arg(_TGD, 19, 'e', 12)
469 .arg(_IODC, 19, 'e', 12);
470 }
[6801]471
[7923]472 double tot = _TOT;
473 if (tot == 0.9999e9 && version < 3.0) {
474 tot = 0.0;
475 }
[8167]476 if (type() == t_eph::IRNSS) {
477 out << QString(fmt)
478 .arg(tot, 19, 'e', 12)
479 .arg("", 19, QChar(' '))
480 .arg("", 19, QChar(' '))
481 .arg("", 19, QChar(' '));
482 }
483 else {
484 out << QString(fmt)
485 .arg(tot, 19, 'e', 12)
486 .arg(_fitInterval, 19, 'e', 12)
487 .arg("", 19, QChar(' '))
488 .arg("", 19, QChar(' '));
489 }
[6801]490
491 return rnxStr;
[2221]492}
493
[6801]494// Constructor
495//////////////////////////////////////////////////////////////////////////////
496t_ephGlo::t_ephGlo(float rnxVersion, const QStringList& lines) {
[2221]497
[6801]498 const int nLines = 4;
499
500 if (lines.size() != nLines) {
501 _checkState = bad;
502 return;
[6518]503 }
504
[6801]505 // RINEX Format
506 // ------------
507 int fieldLen = 19;
[2221]508
[6801]509 int pos[4];
510 pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
511 pos[1] = pos[0] + fieldLen;
512 pos[2] = pos[1] + fieldLen;
513 pos[3] = pos[2] + fieldLen;
[2221]514
[6801]515 // Read four lines
516 // ---------------
517 for (int iLine = 0; iLine < nLines; iLine++) {
518 QString line = lines[iLine];
[2221]519
[6801]520 if ( iLine == 0 ) {
521 QTextStream in(line.left(pos[1]).toAscii());
[6213]522
[6801]523 int year, month, day, hour, min;
524 double sec;
[2221]525
[7139]526 QString prnStr, n;
[6880]527 in >> prnStr;
[7639]528 if (prnStr.size() == 1 && prnStr[0] == 'R') {
[7139]529 in >> n;
530 prnStr.append(n);
[6880]531 }
532 in >> year >> month >> day >> hour >> min >> sec;
[6801]533 if (prnStr.at(0) == 'R') {
534 _prn.set('R', prnStr.mid(1).toInt());
535 }
536 else {
537 _prn.set('R', prnStr.toInt());
538 }
[2221]539
[6801]540 if (year < 80) {
541 year += 2000;
542 }
543 else if (year < 100) {
544 year += 1900;
545 }
[2221]546
[6801]547 _gps_utc = gnumleap(year, month, day);
[2221]548
[6801]549 _TOC.set(year, month, day, hour, min, sec);
550 _TOC = _TOC + _gps_utc;
[6213]551
[6801]552 if ( readDbl(line, pos[1], fieldLen, _tau ) ||
553 readDbl(line, pos[2], fieldLen, _gamma) ||
554 readDbl(line, pos[3], fieldLen, _tki ) ) {
555 _checkState = bad;
556 return;
557 }
[2221]558
[6801]559 _tau = -_tau;
560 }
561
562 else if ( iLine == 1 ) {
563 if ( readDbl(line, pos[0], fieldLen, _x_pos ) ||
564 readDbl(line, pos[1], fieldLen, _x_velocity ) ||
565 readDbl(line, pos[2], fieldLen, _x_acceleration) ||
566 readDbl(line, pos[3], fieldLen, _health ) ) {
567 _checkState = bad;
568 return;
569 }
570 }
571
572 else if ( iLine == 2 ) {
573 if ( readDbl(line, pos[0], fieldLen, _y_pos ) ||
574 readDbl(line, pos[1], fieldLen, _y_velocity ) ||
575 readDbl(line, pos[2], fieldLen, _y_acceleration ) ||
576 readDbl(line, pos[3], fieldLen, _frequency_number) ) {
577 _checkState = bad;
578 return;
579 }
580 }
581
582 else if ( iLine == 3 ) {
583 if ( readDbl(line, pos[0], fieldLen, _z_pos ) ||
584 readDbl(line, pos[1], fieldLen, _z_velocity ) ||
585 readDbl(line, pos[2], fieldLen, _z_acceleration) ||
586 readDbl(line, pos[3], fieldLen, _E ) ) {
587 _checkState = bad;
588 return;
589 }
590 }
591 }
592
593 // Initialize status vector
594 // ------------------------
595 _tt = _TOC;
596 _xv.ReSize(6);
597 _xv(1) = _x_pos * 1.e3;
598 _xv(2) = _y_pos * 1.e3;
599 _xv(3) = _z_pos * 1.e3;
600 _xv(4) = _x_velocity * 1.e3;
601 _xv(5) = _y_velocity * 1.e3;
602 _xv(6) = _z_velocity * 1.e3;
[2221]603}
604
[6801]605// Compute Glonass Satellite Position (virtual)
[2771]606////////////////////////////////////////////////////////////////////////////
[6801]607t_irc t_ephGlo::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
[2771]608
[8420]609 if (_checkState == bad ||
610 _checkState == unhealthy) {
[6518]611 return failure;
612 }
613
[6801]614 static const double nominalStep = 10.0;
[2771]615
616 memset(xc, 0, 4*sizeof(double));
617 memset(vv, 0, 3*sizeof(double));
618
[6801]619 double dtPos = bncTime(GPSweek, GPSweeks) - _tt;
620
621 if (fabs(dtPos) > 24*3600.0) {
[6213]622 return failure;
[2771]623 }
624
[8455]625
[6801]626 int nSteps = int(fabs(dtPos) / nominalStep) + 1;
627 double step = dtPos / nSteps;
[4018]628
[6801]629 double acc[3];
630 acc[0] = _x_acceleration * 1.e3;
631 acc[1] = _y_acceleration * 1.e3;
632 acc[2] = _z_acceleration * 1.e3;
633 for (int ii = 1; ii <= nSteps; ii++) {
634 _xv = rungeKutta4(_tt.gpssec(), _xv, step, acc, glo_deriv);
635 _tt = _tt + step;
636 }
[4018]637
[6801]638 // Position and Velocity
639 // ---------------------
640 xc[0] = _xv(1);
641 xc[1] = _xv(2);
642 xc[2] = _xv(3);
[2771]643
[6801]644 vv[0] = _xv(4);
645 vv[1] = _xv(5);
646 vv[2] = _xv(6);
[2771]647
[6801]648 // Clock Correction
649 // ----------------
650 double dtClk = bncTime(GPSweek, GPSweeks) - _TOC;
651 xc[3] = -_tau + _gamma * dtClk;
[2771]652
[6213]653 return success;
[2771]654}
655
[6801]656// RINEX Format String
[3659]657//////////////////////////////////////////////////////////////////////////////
[6801]658QString t_ephGlo::toString(double version) const {
[3664]659
[6801]660 QString rnxStr = rinexDateStr(_TOC-_gps_utc, _prn, version);
[3699]661
[6801]662 QTextStream out(&rnxStr);
[3664]663
[6801]664 out << QString("%1%2%3\n")
665 .arg(-_tau, 19, 'e', 12)
666 .arg(_gamma, 19, 'e', 12)
667 .arg(_tki, 19, 'e', 12);
[3668]668
[6801]669 QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
[3664]670
[6801]671 out << QString(fmt)
672 .arg(_x_pos, 19, 'e', 12)
673 .arg(_x_velocity, 19, 'e', 12)
674 .arg(_x_acceleration, 19, 'e', 12)
675 .arg(_health, 19, 'e', 12);
[3664]676
[6801]677 out << QString(fmt)
678 .arg(_y_pos, 19, 'e', 12)
679 .arg(_y_velocity, 19, 'e', 12)
680 .arg(_y_acceleration, 19, 'e', 12)
681 .arg(_frequency_number, 19, 'e', 12);
[3666]682
[6801]683 out << QString(fmt)
684 .arg(_z_pos, 19, 'e', 12)
685 .arg(_z_velocity, 19, 'e', 12)
686 .arg(_z_acceleration, 19, 'e', 12)
687 .arg(_E, 19, 'e', 12);
[3666]688
[6801]689 return rnxStr;
[3659]690}
691
[6801]692// Derivative of the state vector using a simple force model (static)
693////////////////////////////////////////////////////////////////////////////
694ColumnVector t_ephGlo::glo_deriv(double /* tt */, const ColumnVector& xv,
695 double* acc) {
[3659]696
[6801]697 // State vector components
698 // -----------------------
699 ColumnVector rr = xv.rows(1,3);
700 ColumnVector vv = xv.rows(4,6);
[3699]701
[6801]702 // Acceleration
[3699]703 // ------------
[6801]704 static const double gmWGS = 398.60044e12;
705 static const double AE = 6378136.0;
706 static const double OMEGA = 7292115.e-11;
707 static const double C20 = -1082.6257e-6;
[3699]708
[6801]709 double rho = rr.norm_Frobenius();
710 double t1 = -gmWGS/(rho*rho*rho);
711 double t2 = 3.0/2.0 * C20 * (gmWGS*AE*AE) / (rho*rho*rho*rho*rho);
712 double t3 = OMEGA * OMEGA;
713 double t4 = 2.0 * OMEGA;
714 double z2 = rr(3) * rr(3);
[3699]715
[6801]716 // Vector of derivatives
717 // ---------------------
718 ColumnVector va(6);
719 va(1) = vv(1);
720 va(2) = vv(2);
721 va(3) = vv(3);
722 va(4) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(1) + t4*vv(2) + acc[0];
723 va(5) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(2) - t4*vv(1) + acc[1];
724 va(6) = (t1 + t2*(3.0-5.0*z2/(rho*rho)) ) * rr(3) + acc[2];
[3699]725
[6801]726 return va;
727}
[3699]728
[6801]729// IOD of Glonass Ephemeris (virtual)
730////////////////////////////////////////////////////////////////////////////
[7169]731unsigned int t_ephGlo::IOD() const {
[6801]732 bncTime tMoscow = _TOC - _gps_utc + 3 * 3600.0;
[7054]733 return (unsigned long)tMoscow.daysec() / 900;
[3659]734}
735
[8188]736// Health status of Glonass Ephemeris (virtual)
737////////////////////////////////////////////////////////////////////////////
738unsigned int t_ephGlo::isUnhealthy() const {
[8216]739
[8218]740 if (_almanac_health_availablility_indicator) {
[8216]741 if ((_health == 0 && _almanac_health == 0) ||
742 (_health == 1 && _almanac_health == 0) ||
743 (_health == 1 && _almanac_health == 1)) {
744 return 1;
745 }
[8188]746 }
[8218]747 else if (!_almanac_health_availablility_indicator) {
748 if (_health) {
749 return 1;
750 }
751 }
[8216]752 return 0; /* (_health == 0 && _almanac_health == 1) or (_health == 0) */
[8188]753}
754
[3659]755// Constructor
756//////////////////////////////////////////////////////////////////////////////
[4891]757t_ephGal::t_ephGal(float rnxVersion, const QStringList& lines) {
[6809]758 int year, month, day, hour, min;
759 double sec;
760 QString prnStr;
[4891]761 const int nLines = 8;
762 if (lines.size() != nLines) {
[6518]763 _checkState = bad;
[4891]764 return;
765 }
766
767 // RINEX Format
768 // ------------
769 int fieldLen = 19;
[6792]770 double SVhealth = 0.0;
771 double datasource = 0.0;
[6798]772
[4891]773 int pos[4];
774 pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
775 pos[1] = pos[0] + fieldLen;
776 pos[2] = pos[1] + fieldLen;
777 pos[3] = pos[2] + fieldLen;
778
779 // Read eight lines
780 // ----------------
781 for (int iLine = 0; iLine < nLines; iLine++) {
782 QString line = lines[iLine];
783
784 if ( iLine == 0 ) {
785 QTextStream in(line.left(pos[1]).toAscii());
[7140]786 QString n;
[6880]787 in >> prnStr;
[7639]788 if (prnStr.size() == 1 && prnStr[0] == 'E') {
[7139]789 in >> n;
790 prnStr.append(n);
[6880]791 }
792 in >> year >> month >> day >> hour >> min >> sec;
[4891]793 if (year < 80) {
794 year += 2000;
795 }
796 else if (year < 100) {
797 year += 1900;
798 }
799
800 _TOC.set(year, month, day, hour, min, sec);
801
802 if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
803 readDbl(line, pos[2], fieldLen, _clock_drift ) ||
804 readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
[6518]805 _checkState = bad;
[4891]806 return;
807 }
808 }
809
810 else if ( iLine == 1 ) {
811 if ( readDbl(line, pos[0], fieldLen, _IODnav ) ||
812 readDbl(line, pos[1], fieldLen, _Crs ) ||
813 readDbl(line, pos[2], fieldLen, _Delta_n) ||
814 readDbl(line, pos[3], fieldLen, _M0 ) ) {
[6518]815 _checkState = bad;
[4891]816 return;
817 }
818 }
819
820 else if ( iLine == 2 ) {
821 if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
822 readDbl(line, pos[1], fieldLen, _e ) ||
823 readDbl(line, pos[2], fieldLen, _Cus ) ||
824 readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
[6518]825 _checkState = bad;
[4891]826 return;
827 }
828 }
829
830 else if ( iLine == 3 ) {
831 if ( readDbl(line, pos[0], fieldLen, _TOEsec) ||
832 readDbl(line, pos[1], fieldLen, _Cic ) ||
833 readDbl(line, pos[2], fieldLen, _OMEGA0) ||
834 readDbl(line, pos[3], fieldLen, _Cis ) ) {
[6518]835 _checkState = bad;
[4891]836 return;
837 }
838 }
839
840 else if ( iLine == 4 ) {
841 if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
842 readDbl(line, pos[1], fieldLen, _Crc ) ||
843 readDbl(line, pos[2], fieldLen, _omega ) ||
844 readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
[6518]845 _checkState = bad;
[4891]846 return;
847 }
848 }
849
850 else if ( iLine == 5 ) {
[6792]851 if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
852 readDbl(line, pos[1], fieldLen, datasource) ||
853 readDbl(line, pos[2], fieldLen, _TOEweek ) ) {
[6518]854 _checkState = bad;
[4891]855 return;
[6792]856 } else {
857 if (int(datasource) & (1<<8)) {
[6812]858 _fnav = true;
859 _inav = false;
[6792]860 } else if (int(datasource) & (1<<9)) {
[6812]861 _fnav = false;
862 _inav = true;
[6792]863 }
[6892]864 _TOEweek -= 1024.0;
[4891]865 }
866 }
867
868 else if ( iLine == 6 ) {
869 if ( readDbl(line, pos[0], fieldLen, _SISA ) ||
[6792]870 readDbl(line, pos[1], fieldLen, SVhealth) ||
[4891]871 readDbl(line, pos[2], fieldLen, _BGD_1_5A) ||
872 readDbl(line, pos[3], fieldLen, _BGD_1_5B) ) {
[6518]873 _checkState = bad;
[4891]874 return;
[6792]875 } else {
876 // Bit 0
[6812]877 _e1DataInValid = (int(SVhealth) & (1<<0));
[6792]878 // Bit 1-2
[6802]879 _E1_bHS = double((int(SVhealth) >> 1) & 0x3);
[6792]880 // Bit 3
[6812]881 _e5aDataInValid = (int(SVhealth) & (1<<3));
[6792]882 // Bit 4-5
[6802]883 _E5aHS = double((int(SVhealth) >> 4) & 0x3);
[6792]884 // Bit 6
[6812]885 _e5bDataInValid = (int(SVhealth) & (1<<6));
[6792]886 // Bit 7-8
[6802]887 _E5bHS = double((int(SVhealth) >> 7) & 0x3);
[6809]888
889 if (prnStr.at(0) == 'E') {
[7140]890 _prn.set('E', prnStr.mid(1).toInt(), _inav ? 1 : 0);
[6809]891 }
[4891]892 }
893 }
894
895 else if ( iLine == 7 ) {
896 if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
[6518]897 _checkState = bad;
[4891]898 return;
899 }
900 }
901 }
[3659]902}
[4013]903
[6801]904// Compute Galileo Satellite Position (virtual)
905////////////////////////////////////////////////////////////////////////////
906t_irc t_ephGal::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
[4013]907
[8420]908 if (_checkState == bad ||
909 _checkState == unhealthy) {
[6801]910 return failure;
911 }
[4013]912
[6801]913 static const double omegaEarth = 7292115.1467e-11;
[8213]914 static const double gmWGS = 398.6004418e12;
[4023]915
[6801]916 memset(xc, 0, 4*sizeof(double));
917 memset(vv, 0, 3*sizeof(double));
[4023]918
[6801]919 double a0 = _sqrt_A * _sqrt_A;
920 if (a0 == 0) {
921 return failure;
922 }
[4023]923
[6801]924 double n0 = sqrt(gmWGS/(a0*a0*a0));
[4023]925
[6801]926 bncTime tt(GPSweek, GPSweeks);
927 double tk = tt - bncTime(_TOC.gpsw(), _TOEsec);
[4023]928
[6801]929 double n = n0 + _Delta_n;
930 double M = _M0 + n*tk;
931 double E = M;
932 double E_last;
[8370]933 int nLoop = 0;
[6801]934 do {
935 E_last = E;
936 E = M + _e*sin(E);
[8370]937
938 if (++nLoop == 100) {
939 return failure;
940 }
[6801]941 } while ( fabs(E-E_last)*a0 > 0.001 );
942 double v = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) );
943 double u0 = v + _omega;
944 double sin2u0 = sin(2*u0);
945 double cos2u0 = cos(2*u0);
946 double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
947 double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
948 double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
949 double xp = r*cos(u);
950 double yp = r*sin(u);
951 double OM = _OMEGA0 + (_OMEGADOT - omegaEarth)*tk -
952 omegaEarth*_TOEsec;
[4023]953
[6801]954 double sinom = sin(OM);
955 double cosom = cos(OM);
956 double sini = sin(i);
957 double cosi = cos(i);
958 xc[0] = xp*cosom - yp*cosi*sinom;
959 xc[1] = xp*sinom + yp*cosi*cosom;
960 xc[2] = yp*sini;
[4023]961
[6801]962 double tc = tt - _TOC;
963 xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
[4023]964
[6801]965 // Velocity
966 // --------
967 double tanv2 = tan(v/2);
968 double dEdM = 1 / (1 - _e*cos(E));
969 double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2) / (1 + tanv2*tanv2)
970 * dEdM * n;
971 double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
972 double dotom = _OMEGADOT - omegaEarth;
973 double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
974 double dotr = a0 * _e*sin(E) * dEdM * n
975 + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
976 double dotx = dotr*cos(u) - r*sin(u)*dotu;
977 double doty = dotr*sin(u) + r*cos(u)*dotu;
[4023]978
[6801]979 vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
980 - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
981 + yp*sini*sinom*doti; // dX / di
982
983 vv[1] = sinom *dotx + cosi*cosom *doty
984 + xp*cosom*dotom - yp*cosi*sinom*dotom
985 - yp*sini*cosom*doti;
986
987 vv[2] = sini *doty + yp*cosi *doti;
988
989 // Relativistic Correction
990 // -----------------------
[7481]991 // correspondent to Galileo ICD and to SSR standard
992 xc[3] -= 4.442807633e-10 * _e * sqrt(a0) *sin(E);
993 // correspondent to IGS convention
994 //xc[3] -= 2.0 * (xc[0]*vv[0] + xc[1]*vv[1] + xc[2]*vv[2]) / t_CST::c / t_CST::c;
[6801]995
996 return success;
[4023]997}
998
[8188]999// Health status of Galileo Ephemeris (virtual)
1000////////////////////////////////////////////////////////////////////////////
1001unsigned int t_ephGal::isUnhealthy() const {
1002 if (_E5aHS && _E5bHS && _E1_bHS) {
1003 return 1;
1004 }
1005 return 0;
1006}
1007
[4023]1008// RINEX Format String
1009//////////////////////////////////////////////////////////////////////////////
1010QString t_ephGal::toString(double version) const {
1011
[4029]1012 QString rnxStr = rinexDateStr(_TOC, _prn, version);
[4023]1013
1014 QTextStream out(&rnxStr);
1015
1016 out << QString("%1%2%3\n")
1017 .arg(_clock_bias, 19, 'e', 12)
1018 .arg(_clock_drift, 19, 'e', 12)
1019 .arg(_clock_driftrate, 19, 'e', 12);
1020
1021 QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
1022
1023 out << QString(fmt)
1024 .arg(_IODnav, 19, 'e', 12)
1025 .arg(_Crs, 19, 'e', 12)
1026 .arg(_Delta_n, 19, 'e', 12)
1027 .arg(_M0, 19, 'e', 12);
1028
1029 out << QString(fmt)
1030 .arg(_Cuc, 19, 'e', 12)
1031 .arg(_e, 19, 'e', 12)
1032 .arg(_Cus, 19, 'e', 12)
1033 .arg(_sqrt_A, 19, 'e', 12);
1034
1035 out << QString(fmt)
1036 .arg(_TOEsec, 19, 'e', 12)
1037 .arg(_Cic, 19, 'e', 12)
1038 .arg(_OMEGA0, 19, 'e', 12)
1039 .arg(_Cis, 19, 'e', 12);
1040
1041 out << QString(fmt)
1042 .arg(_i0, 19, 'e', 12)
1043 .arg(_Crc, 19, 'e', 12)
1044 .arg(_omega, 19, 'e', 12)
1045 .arg(_OMEGADOT, 19, 'e', 12);
1046
[6792]1047 int dataSource = 0;
1048 int SVhealth = 0;
1049 double BGD_1_5A = _BGD_1_5A;
1050 double BGD_1_5B = _BGD_1_5B;
[6812]1051 if (_fnav) {
[6792]1052 dataSource |= (1<<1);
1053 dataSource |= (1<<8);
1054 BGD_1_5B = 0.0;
1055 // SVhealth
1056 // Bit 3 : E5a DVS
[6812]1057 if (_e5aDataInValid) {
[6792]1058 SVhealth |= (1<<3);
1059 }
1060 // Bit 4-5: E5a HS
1061 if (_E5aHS == 1.0) {
1062 SVhealth |= (1<<4);
1063 }
1064 else if (_E5aHS == 2.0) {
1065 SVhealth |= (1<<5);
1066 }
1067 else if (_E5aHS == 3.0) {
1068 SVhealth |= (1<<4);
1069 SVhealth |= (1<<5);
1070 }
1071 }
[6812]1072 else if(_inav) {
[6803]1073 // Bit 2 and 0 are set because from MT1046 the data source cannot be determined
1074 // and RNXv3.03 says both can be set if the navigation messages were merged
[5539]1075 dataSource |= (1<<0);
[6792]1076 dataSource |= (1<<2);
[5540]1077 dataSource |= (1<<9);
[6792]1078 // SVhealth
1079 // Bit 0 : E1-B DVS
[6812]1080 if (_e1DataInValid) {
[6792]1081 SVhealth |= (1<<0);
1082 }
1083 // Bit 1-2: E1-B HS
1084 if (_E1_bHS == 1.0) {
1085 SVhealth |= (1<<1);
1086 }
1087 else if (_E1_bHS == 2.0) {
1088 SVhealth |= (1<<2);
1089 }
[6803]1090 else if (_E1_bHS == 3.0) {
[6792]1091 SVhealth |= (1<<1);
1092 SVhealth |= (1<<2);
1093 }
[6802]1094 // Bit 3 : E5a DVS
[6812]1095 if (_e5aDataInValid) {
[6802]1096 SVhealth |= (1<<3);
1097 }
1098 // Bit 4-5: E5a HS
1099 if (_E5aHS == 1.0) {
1100 SVhealth |= (1<<4);
1101 }
1102 else if (_E5aHS == 2.0) {
1103 SVhealth |= (1<<5);
1104 }
[6803]1105 else if (_E5aHS == 3.0) {
[6802]1106 SVhealth |= (1<<4);
1107 SVhealth |= (1<<5);
1108 }
[6792]1109 // Bit 6 : E5b DVS
[6812]1110 if (_e5bDataInValid) {
[6792]1111 SVhealth |= (1<<6);
1112 }
1113 // Bit 7-8: E5b HS
1114 if (_E5bHS == 1.0) {
1115 SVhealth |= (1<<7);
1116 }
1117 else if (_E5bHS == 2.0) {
1118 SVhealth |= (1<<8);
1119 }
[6803]1120 else if (_E5bHS == 3.0) {
[6792]1121 SVhealth |= (1<<7);
1122 SVhealth |= (1<<8);
1123 }
[5539]1124 }
[6792]1125
[4023]1126 out << QString(fmt)
[5532]1127 .arg(_IDOT, 19, 'e', 12)
1128 .arg(double(dataSource), 19, 'e', 12)
[6892]1129 .arg(_TOEweek + 1024.0, 19, 'e', 12)
[5532]1130 .arg(0.0, 19, 'e', 12);
[4023]1131
1132 out << QString(fmt)
[6798]1133 .arg(_SISA, 19, 'e', 12)
[6792]1134 .arg(double(SVhealth), 19, 'e', 12)
1135 .arg(BGD_1_5A, 19, 'e', 12)
1136 .arg(BGD_1_5B, 19, 'e', 12);
[4023]1137
[7923]1138 double tot = _TOT;
1139 if (tot == 0.9999e9 && version < 3.0) {
1140 tot = 0.0;
1141 }
[4023]1142 out << QString(fmt)
[7923]1143 .arg(tot, 19, 'e', 12)
[4024]1144 .arg("", 19, QChar(' '))
1145 .arg("", 19, QChar(' '))
1146 .arg("", 19, QChar(' '));
[4023]1147
1148 return rnxStr;
1149}
1150
[6385]1151// Constructor
1152//////////////////////////////////////////////////////////////////////////////
[6390]1153t_ephSBAS::t_ephSBAS(float rnxVersion, const QStringList& lines) {
1154
1155 const int nLines = 4;
1156
1157 if (lines.size() != nLines) {
[6518]1158 _checkState = bad;
[6390]1159 return;
1160 }
1161
1162 // RINEX Format
1163 // ------------
1164 int fieldLen = 19;
1165
1166 int pos[4];
1167 pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
1168 pos[1] = pos[0] + fieldLen;
1169 pos[2] = pos[1] + fieldLen;
1170 pos[3] = pos[2] + fieldLen;
1171
1172 // Read four lines
1173 // ---------------
1174 for (int iLine = 0; iLine < nLines; iLine++) {
1175 QString line = lines[iLine];
1176
1177 if ( iLine == 0 ) {
1178 QTextStream in(line.left(pos[1]).toAscii());
1179
1180 int year, month, day, hour, min;
1181 double sec;
[6880]1182
[7139]1183 QString prnStr, n;
[6880]1184 in >> prnStr;
[7639]1185 if (prnStr.size() == 1 && prnStr[0] == 'S') {
[7139]1186 in >> n;
1187 prnStr.append(n);
[6880]1188 }
1189 in >> year >> month >> day >> hour >> min >> sec;
[6390]1190 if (prnStr.at(0) == 'S') {
1191 _prn.set('S', prnStr.mid(1).toInt());
1192 }
1193 else {
1194 _prn.set('S', prnStr.toInt());
1195 }
1196
1197 if (year < 80) {
1198 year += 2000;
1199 }
1200 else if (year < 100) {
1201 year += 1900;
1202 }
1203
1204 _TOC.set(year, month, day, hour, min, sec);
1205
1206 if ( readDbl(line, pos[1], fieldLen, _agf0 ) ||
1207 readDbl(line, pos[2], fieldLen, _agf1 ) ||
[8455]1208 readDbl(line, pos[3], fieldLen, _TOT ) ) {
[6518]1209 _checkState = bad;
[6390]1210 return;
1211 }
1212 }
1213
1214 else if ( iLine == 1 ) {
1215 if ( readDbl(line, pos[0], fieldLen, _x_pos ) ||
1216 readDbl(line, pos[1], fieldLen, _x_velocity ) ||
1217 readDbl(line, pos[2], fieldLen, _x_acceleration) ||
1218 readDbl(line, pos[3], fieldLen, _health ) ) {
[6518]1219 _checkState = bad;
[6390]1220 return;
1221 }
1222 }
1223
1224 else if ( iLine == 2 ) {
1225 if ( readDbl(line, pos[0], fieldLen, _y_pos ) ||
1226 readDbl(line, pos[1], fieldLen, _y_velocity ) ||
1227 readDbl(line, pos[2], fieldLen, _y_acceleration ) ||
1228 readDbl(line, pos[3], fieldLen, _ura ) ) {
[6518]1229 _checkState = bad;
[6390]1230 return;
1231 }
1232 }
1233
1234 else if ( iLine == 3 ) {
[6536]1235 double iodn;
[6390]1236 if ( readDbl(line, pos[0], fieldLen, _z_pos ) ||
1237 readDbl(line, pos[1], fieldLen, _z_velocity ) ||
1238 readDbl(line, pos[2], fieldLen, _z_acceleration) ||
[6536]1239 readDbl(line, pos[3], fieldLen, iodn ) ) {
[6518]1240 _checkState = bad;
[6390]1241 return;
[6891]1242 } else {
[6536]1243 _IODN = int(iodn);
[6390]1244 }
1245 }
1246 }
1247
[7278]1248 _x_pos *= 1.e3;
1249 _y_pos *= 1.e3;
1250 _z_pos *= 1.e3;
1251 _x_velocity *= 1.e3;
1252 _y_velocity *= 1.e3;
1253 _z_velocity *= 1.e3;
1254 _x_acceleration *= 1.e3;
1255 _y_acceleration *= 1.e3;
1256 _z_acceleration *= 1.e3;
[6385]1257}
1258
[7054]1259// IOD of SBAS Ephemeris (virtual)
1260////////////////////////////////////////////////////////////////////////////
1261
[7169]1262unsigned int t_ephSBAS::IOD() const {
[7054]1263 unsigned char buffer[80];
1264 int size = 0;
1265 int numbits = 0;
1266 long long bitbuffer = 0;
1267 unsigned char *startbuffer = buffer;
1268
1269 SBASADDBITSFLOAT(30, this->_x_pos, 0.08)
1270 SBASADDBITSFLOAT(30, this->_y_pos, 0.08)
1271 SBASADDBITSFLOAT(25, this->_z_pos, 0.4)
1272 SBASADDBITSFLOAT(17, this->_x_velocity, 0.000625)
1273 SBASADDBITSFLOAT(17, this->_y_velocity, 0.000625)
1274 SBASADDBITSFLOAT(18, this->_z_velocity, 0.004)
1275 SBASADDBITSFLOAT(10, this->_x_acceleration, 0.0000125)
1276 SBASADDBITSFLOAT(10, this->_y_acceleration, 0.0000125)
1277 SBASADDBITSFLOAT(10, this->_z_acceleration, 0.0000625)
1278 SBASADDBITSFLOAT(12, this->_agf0, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1279 SBASADDBITSFLOAT(8, this->_agf1, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
1280 SBASADDBITS(5,0); // the last byte is filled by 0-bits to obtain a length of an integer multiple of 8
1281
1282 return CRC24(size, startbuffer);
1283}
1284
[6385]1285// Compute SBAS Satellite Position (virtual)
1286////////////////////////////////////////////////////////////////////////////
1287t_irc t_ephSBAS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
[6386]1288
[8420]1289 if (_checkState == bad ||
1290 _checkState == unhealthy) {
[6518]1291 return failure;
1292 }
1293
[6386]1294 bncTime tt(GPSweek, GPSweeks);
1295 double dt = tt - _TOC;
1296
[7278]1297 xc[0] = _x_pos + _x_velocity * dt + _x_acceleration * dt * dt / 2.0;
1298 xc[1] = _y_pos + _y_velocity * dt + _y_acceleration * dt * dt / 2.0;
1299 xc[2] = _z_pos + _z_velocity * dt + _z_acceleration * dt * dt / 2.0;
[6386]1300
1301 vv[0] = _x_velocity + _x_acceleration * dt;
1302 vv[1] = _y_velocity + _y_acceleration * dt;
1303 vv[2] = _z_velocity + _z_acceleration * dt;
1304
1305 xc[3] = _agf0 + _agf1 * dt;
1306
1307 return success;
[6385]1308}
1309
1310// RINEX Format String
1311//////////////////////////////////////////////////////////////////////////////
[6388]1312QString t_ephSBAS::toString(double version) const {
1313
1314 QString rnxStr = rinexDateStr(_TOC, _prn, version);
1315
1316 QTextStream out(&rnxStr);
1317
1318 out << QString("%1%2%3\n")
[6390]1319 .arg(_agf0, 19, 'e', 12)
1320 .arg(_agf1, 19, 'e', 12)
[8455]1321 .arg(_TOT, 19, 'e', 12);
[6388]1322
1323 QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
1324
1325 out << QString(fmt)
1326 .arg(1.e-3*_x_pos, 19, 'e', 12)
1327 .arg(1.e-3*_x_velocity, 19, 'e', 12)
1328 .arg(1.e-3*_x_acceleration, 19, 'e', 12)
[6390]1329 .arg(_health, 19, 'e', 12);
[6388]1330
1331 out << QString(fmt)
1332 .arg(1.e-3*_y_pos, 19, 'e', 12)
1333 .arg(1.e-3*_y_velocity, 19, 'e', 12)
1334 .arg(1.e-3*_y_acceleration, 19, 'e', 12)
[6390]1335 .arg(_ura, 19, 'e', 12);
[6388]1336
1337 out << QString(fmt)
1338 .arg(1.e-3*_z_pos, 19, 'e', 12)
1339 .arg(1.e-3*_z_velocity, 19, 'e', 12)
1340 .arg(1.e-3*_z_acceleration, 19, 'e', 12)
[6536]1341 .arg(double(_IODN), 19, 'e', 12);
[6388]1342
1343 return rnxStr;
[6385]1344}
[6400]1345
1346// Constructor
1347//////////////////////////////////////////////////////////////////////////////
[6600]1348t_ephBDS::t_ephBDS(float rnxVersion, const QStringList& lines) {
[6400]1349
1350 const int nLines = 8;
1351
1352 if (lines.size() != nLines) {
[6518]1353 _checkState = bad;
[6400]1354 return;
1355 }
1356
1357 // RINEX Format
1358 // ------------
1359 int fieldLen = 19;
1360
1361 int pos[4];
1362 pos[0] = (rnxVersion <= 2.12) ? 3 : 4;
1363 pos[1] = pos[0] + fieldLen;
1364 pos[2] = pos[1] + fieldLen;
1365 pos[3] = pos[2] + fieldLen;
1366
1367 // Read eight lines
1368 // ----------------
1369 for (int iLine = 0; iLine < nLines; iLine++) {
1370 QString line = lines[iLine];
1371
1372 if ( iLine == 0 ) {
1373 QTextStream in(line.left(pos[1]).toAscii());
1374
1375 int year, month, day, hour, min;
1376 double sec;
[6880]1377
[7139]1378 QString prnStr, n;
[6880]1379 in >> prnStr;
[7639]1380 if (prnStr.size() == 1 && prnStr[0] == 'C') {
[7139]1381 in >> n;
1382 prnStr.append(n);
[6880]1383 }
1384 in >> year >> month >> day >> hour >> min >> sec;
[6400]1385 if (prnStr.at(0) == 'C') {
1386 _prn.set('C', prnStr.mid(1).toInt());
1387 }
1388 else {
1389 _prn.set('C', prnStr.toInt());
1390 }
1391
1392 if (year < 80) {
1393 year += 2000;
1394 }
1395 else if (year < 100) {
1396 year += 1900;
1397 }
1398
[6812]1399 _TOC.setBDS(year, month, day, hour, min, sec);
[6400]1400
1401 if ( readDbl(line, pos[1], fieldLen, _clock_bias ) ||
1402 readDbl(line, pos[2], fieldLen, _clock_drift ) ||
1403 readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
[6518]1404 _checkState = bad;
[6400]1405 return;
1406 }
1407 }
1408
1409 else if ( iLine == 1 ) {
1410 double aode;
1411 if ( readDbl(line, pos[0], fieldLen, aode ) ||
1412 readDbl(line, pos[1], fieldLen, _Crs ) ||
1413 readDbl(line, pos[2], fieldLen, _Delta_n) ||
1414 readDbl(line, pos[3], fieldLen, _M0 ) ) {
[6518]1415 _checkState = bad;
[6400]1416 return;
1417 }
1418 _AODE = int(aode);
1419 }
1420
1421 else if ( iLine == 2 ) {
1422 if ( readDbl(line, pos[0], fieldLen, _Cuc ) ||
1423 readDbl(line, pos[1], fieldLen, _e ) ||
1424 readDbl(line, pos[2], fieldLen, _Cus ) ||
1425 readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
[6518]1426 _checkState = bad;
[6400]1427 return;
1428 }
1429 }
1430
1431 else if ( iLine == 3 ) {
[6812]1432 if ( readDbl(line, pos[0], fieldLen, _TOEsec ) ||
[6400]1433 readDbl(line, pos[1], fieldLen, _Cic ) ||
1434 readDbl(line, pos[2], fieldLen, _OMEGA0) ||
1435 readDbl(line, pos[3], fieldLen, _Cis ) ) {
[6518]1436 _checkState = bad;
[6400]1437 return;
1438 }
1439 }
1440
1441 else if ( iLine == 4 ) {
1442 if ( readDbl(line, pos[0], fieldLen, _i0 ) ||
1443 readDbl(line, pos[1], fieldLen, _Crc ) ||
1444 readDbl(line, pos[2], fieldLen, _omega ) ||
1445 readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
[6518]1446 _checkState = bad;
[6400]1447 return;
1448 }
1449 }
1450
1451 else if ( iLine == 5 ) {
1452 if ( readDbl(line, pos[0], fieldLen, _IDOT ) ||
[6812]1453 readDbl(line, pos[2], fieldLen, _TOEweek)) {
[6518]1454 _checkState = bad;
[6400]1455 return;
1456 }
1457 }
1458
1459 else if ( iLine == 6 ) {
1460 double SatH1;
[6755]1461 if ( readDbl(line, pos[0], fieldLen, _URA ) ||
1462 readDbl(line, pos[1], fieldLen, SatH1) ||
[6400]1463 readDbl(line, pos[2], fieldLen, _TGD1) ||
1464 readDbl(line, pos[3], fieldLen, _TGD2) ) {
[6518]1465 _checkState = bad;
[6400]1466 return;
1467 }
1468 _SatH1 = int(SatH1);
1469 }
1470
1471 else if ( iLine == 7 ) {
1472 double aodc;
[6812]1473 if ( readDbl(line, pos[0], fieldLen, _TOT) ||
[6400]1474 readDbl(line, pos[1], fieldLen, aodc) ) {
[6518]1475 _checkState = bad;
[6400]1476 return;
1477 }
[6812]1478 if (_TOT == 0.9999e9) { // 0.9999e9 means not known (RINEX standard)
1479 _TOT = _TOEsec;
[6400]1480 }
1481 _AODC = int(aodc);
1482 }
1483 }
1484
[7138]1485 _TOE.setBDS(int(_TOEweek), _TOEsec);
1486
[6400]1487 // remark: actually should be computed from second_tot
1488 // but it seems to be unreliable in RINEX files
[6843]1489 //_TOT = _TOC.bdssec();
[6400]1490}
1491
[7054]1492// IOD of BDS Ephemeris (virtual)
1493////////////////////////////////////////////////////////////////////////////
[7169]1494unsigned int t_ephBDS::IOD() const {
[7054]1495 unsigned char buffer[80];
1496 int size = 0;
1497 int numbits = 0;
1498 long long bitbuffer = 0;
1499 unsigned char *startbuffer = buffer;
1500
1501 BDSADDBITSFLOAT(14, this->_IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
1502 BDSADDBITSFLOAT(11, this->_clock_driftrate, 1.0/static_cast<double>(1<<30)
1503 /static_cast<double>(1<<30)/static_cast<double>(1<<6))
1504 BDSADDBITSFLOAT(22, this->_clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<20))
1505 BDSADDBITSFLOAT(24, this->_clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
1506 BDSADDBITSFLOAT(18, this->_Crs, 1.0/static_cast<double>(1<<6))
1507 BDSADDBITSFLOAT(16, this->_Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
1508 BDSADDBITSFLOAT(32, this->_M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1509 BDSADDBITSFLOAT(18, this->_Cuc, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1510 BDSADDBITSFLOAT(32, this->_e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
1511 BDSADDBITSFLOAT(18, this->_Cus, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1512 BDSADDBITSFLOAT(32, this->_sqrt_A, 1.0/static_cast<double>(1<<19))
1513 BDSADDBITSFLOAT(18, this->_Cic, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1514 BDSADDBITSFLOAT(32, this->_OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1515 BDSADDBITSFLOAT(18, this->_Cis, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1516 BDSADDBITSFLOAT(32, this->_i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1517 BDSADDBITSFLOAT(18, this->_Crc, 1.0/static_cast<double>(1<<6))
1518 BDSADDBITSFLOAT(32, this->_omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
1519 BDSADDBITSFLOAT(24, this->_OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
1520 BDSADDBITS(5, 0) // the last byte is filled by 0-bits to obtain a length of an integer multiple of 8
1521
1522 return CRC24(size, startbuffer);
1523}
1524
[6601]1525// Compute BDS Satellite Position (virtual)
[6400]1526//////////////////////////////////////////////////////////////////////////////
[6600]1527t_irc t_ephBDS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
[6400]1528
[8420]1529 if (_checkState == bad ||
1530 _checkState == unhealthy) {
[6518]1531 return failure;
1532 }
1533
[6602]1534 static const double gmBDS = 398.6004418e12;
1535 static const double omegaBDS = 7292115.0000e-11;
[6400]1536
1537 xc[0] = xc[1] = xc[2] = xc[3] = 0.0;
1538 vv[0] = vv[1] = vv[2] = 0.0;
1539
1540 bncTime tt(GPSweek, GPSweeks);
1541
1542 if (_sqrt_A == 0) {
1543 return failure;
1544 }
1545 double a0 = _sqrt_A * _sqrt_A;
1546
[6602]1547 double n0 = sqrt(gmBDS/(a0*a0*a0));
[6400]1548 double tk = tt - _TOE;
1549 double n = n0 + _Delta_n;
1550 double M = _M0 + n*tk;
1551 double E = M;
1552 double E_last;
1553 int nLoop = 0;
1554 do {
1555 E_last = E;
1556 E = M + _e*sin(E);
1557
1558 if (++nLoop == 100) {
1559 return failure;
1560 }
1561 } while ( fabs(E-E_last)*a0 > 0.001 );
1562
1563 double v = atan2(sqrt(1-_e*_e) * sin(E), cos(E) - _e);
1564 double u0 = v + _omega;
1565 double sin2u0 = sin(2*u0);
1566 double cos2u0 = cos(2*u0);
1567 double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0;
1568 double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0;
1569 double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0;
1570 double xp = r*cos(u);
1571 double yp = r*sin(u);
1572 double toesec = (_TOE.gpssec() - 14.0);
1573 double sinom = 0;
1574 double cosom = 0;
1575 double sini = 0;
1576 double cosi = 0;
[7278]1577
[7481]1578 // Velocity
1579 // --------
1580 double tanv2 = tan(v/2);
1581 double dEdM = 1 / (1 - _e*cos(E));
1582 double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2)
1583 / (1 + tanv2*tanv2) * dEdM * n;
1584 double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv;
1585 double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv;
1586 double dotr = a0 * _e*sin(E) * dEdM * n
1587 + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv;
1588
1589 double dotx = dotr*cos(u) - r*sin(u)*dotu;
1590 double doty = dotr*sin(u) + r*cos(u)*dotu;
1591
[6400]1592 const double iMaxGEO = 10.0 / 180.0 * M_PI;
1593
1594 // MEO/IGSO satellite
1595 // ------------------
1596 if (_i0 > iMaxGEO) {
[6602]1597 double OM = _OMEGA0 + (_OMEGADOT - omegaBDS)*tk - omegaBDS*toesec;
[6400]1598
1599 sinom = sin(OM);
1600 cosom = cos(OM);
1601 sini = sin(i);
1602 cosi = cos(i);
1603
1604 xc[0] = xp*cosom - yp*cosi*sinom;
1605 xc[1] = xp*sinom + yp*cosi*cosom;
[7278]1606 xc[2] = yp*sini;
[7481]1607
1608 // Velocity
1609 // --------
1610
1611 double dotom = _OMEGADOT - t_CST::omega;
1612
1613 vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr
1614 - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA
1615 + yp*sini*sinom*doti; // dX / di
1616
1617 vv[1] = sinom *dotx + cosi*cosom *doty
1618 + xp*cosom*dotom - yp*cosi*sinom*dotom
1619 - yp*sini*cosom*doti;
1620
1621 vv[2] = sini *doty + yp*cosi *doti;
1622
[6400]1623 }
1624
1625 // GEO satellite
1626 // -------------
1627 else {
[6602]1628 double OM = _OMEGA0 + _OMEGADOT*tk - omegaBDS*toesec;
1629 double ll = omegaBDS*tk;
[6400]1630
1631 sinom = sin(OM);
1632 cosom = cos(OM);
1633 sini = sin(i);
1634 cosi = cos(i);
1635
1636 double xx = xp*cosom - yp*cosi*sinom;
1637 double yy = xp*sinom + yp*cosi*cosom;
[7278]1638 double zz = yp*sini;
[6400]1639
[7487]1640 Matrix RX = BNC_PPP::t_astro::rotX(-5.0 / 180.0 * M_PI);
1641 Matrix RZ = BNC_PPP::t_astro::rotZ(ll);
[6400]1642
1643 ColumnVector X1(3); X1 << xx << yy << zz;
[7487]1644 ColumnVector X2 = RZ*RX*X1;
[6400]1645
1646 xc[0] = X2(1);
1647 xc[1] = X2(2);
1648 xc[2] = X2(3);
[7278]1649
[7481]1650 double dotom = _OMEGADOT;
[6400]1651
[7481]1652 double vx = cosom *dotx - cosi*sinom *doty
1653 - xp*sinom*dotom - yp*cosi*cosom*dotom
1654 + yp*sini*sinom*doti;
[6400]1655
[7481]1656 double vy = sinom *dotx + cosi*cosom *doty
1657 + xp*cosom*dotom - yp*cosi*sinom*dotom
1658 - yp*sini*cosom*doti;
[7278]1659
[7501]1660 double vz = sini *doty + yp*cosi *doti;
[6400]1661
[7501]1662 ColumnVector V(3); V << vx << vy << vz;
[7481]1663
[7487]1664 Matrix RdotZ(3,3);
[7481]1665 double C = cos(ll);
1666 double S = sin(ll);
1667 Matrix UU(3,3);
1668 UU[0][0] = -S; UU[0][1] = +C; UU[0][2] = 0.0;
1669 UU[1][0] = -C; UU[1][1] = -S; UU[1][2] = 0.0;
1670 UU[2][0] = 0.0; UU[2][1] = 0.0; UU[2][2] = 0.0;
[7487]1671 RdotZ = omegaBDS * UU;
[7481]1672
1673 ColumnVector VV(3);
[7487]1674 VV = RZ*RX*V + RdotZ*RX*X1;
[7481]1675
1676 vv[0] = VV(1);
1677 vv[1] = VV(2);
1678 vv[2] = VV(3);
1679 }
1680
1681 double tc = tt - _TOC;
1682 xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc;
1683
[7278]1684 // dotC = _clock_drift + _clock_driftrate*tc
[6400]1685 // - 4.442807633e-10*_e*sqrt(a0)*cos(E) * dEdM * n;
1686
[7481]1687 // Relativistic Correction
1688 // -----------------------
1689 // correspondent to BDS ICD and to SSR standard
1690 xc[3] -= 4.442807633e-10 * _e * sqrt(a0) *sin(E);
1691 // correspondent to IGS convention
1692 // xc[3] -= 2.0 * (xc[0]*vv[0] + xc[1]*vv[1] + xc[2]*vv[2]) / t_CST::c / t_CST::c;
1693
[6400]1694 return success;
1695}
1696
1697// RINEX Format String
1698//////////////////////////////////////////////////////////////////////////////
[6600]1699QString t_ephBDS::toString(double version) const {
[6400]1700
[6812]1701 QString rnxStr = rinexDateStr(_TOC-14.0, _prn, version);
[6400]1702
1703 QTextStream out(&rnxStr);
1704
1705 out << QString("%1%2%3\n")
1706 .arg(_clock_bias, 19, 'e', 12)
1707 .arg(_clock_drift, 19, 'e', 12)
1708 .arg(_clock_driftrate, 19, 'e', 12);
1709
1710 QString fmt = version < 3.0 ? " %1%2%3%4\n" : " %1%2%3%4\n";
1711
1712 out << QString(fmt)
1713 .arg(double(_AODE), 19, 'e', 12)
1714 .arg(_Crs, 19, 'e', 12)
1715 .arg(_Delta_n, 19, 'e', 12)
1716 .arg(_M0, 19, 'e', 12);
1717
1718 out << QString(fmt)
1719 .arg(_Cuc, 19, 'e', 12)
1720 .arg(_e, 19, 'e', 12)
1721 .arg(_Cus, 19, 'e', 12)
1722 .arg(_sqrt_A, 19, 'e', 12);
1723
[6843]1724 double toes = 0.0;
1725 if (_TOEweek > -1.0) {// RINEX input
1726 toes = _TOEsec;
1727 }
1728 else {// RTCM stream input
[6812]1729 toes = _TOE.bdssec();
[6755]1730 }
[6400]1731 out << QString(fmt)
[6843]1732 .arg(toes, 19, 'e', 12)
[6755]1733 .arg(_Cic, 19, 'e', 12)
1734 .arg(_OMEGA0, 19, 'e', 12)
1735 .arg(_Cis, 19, 'e', 12);
[6400]1736
1737 out << QString(fmt)
1738 .arg(_i0, 19, 'e', 12)
1739 .arg(_Crc, 19, 'e', 12)
1740 .arg(_omega, 19, 'e', 12)
1741 .arg(_OMEGADOT, 19, 'e', 12);
1742
[6843]1743 double toew = 0.0;
1744 if (_TOEweek > -1.0) {// RINEX input
1745 toew = _TOEweek;
1746 }
1747 else {// RTCM stream input
1748 toew = double(_TOE.bdsw());
1749 }
[6400]1750 out << QString(fmt)
[6843]1751 .arg(_IDOT, 19, 'e', 12)
1752 .arg(0.0, 19, 'e', 12)
1753 .arg(toew, 19, 'e', 12)
1754 .arg(0.0, 19, 'e', 12);
[6400]1755
1756 out << QString(fmt)
[6798]1757 .arg(_URA, 19, 'e', 12)
[6400]1758 .arg(double(_SatH1), 19, 'e', 12)
1759 .arg(_TGD1, 19, 'e', 12)
1760 .arg(_TGD2, 19, 'e', 12);
1761
[6843]1762 double tots = 0.0;
1763 if (_TOEweek > -1.0) {// RINEX input
1764 tots = _TOT;
1765 }
1766 else {// RTCM stream input
[6812]1767 tots = _TOE.bdssec();
[6755]1768 }
[6400]1769 out << QString(fmt)
[6792]1770 .arg(tots, 19, 'e', 12)
[6755]1771 .arg(double(_AODC), 19, 'e', 12)
1772 .arg("", 19, QChar(' '))
1773 .arg("", 19, QChar(' '));
[6400]1774 return rnxStr;
1775}
Note: See TracBrowser for help on using the repository browser.