65 Cuc = Cus = Crc = Crs = Cic = Cis = M0 = dn = dndot =
66 ecc = A = Ahalf =Adot = OMEGA0 = i0 = w = OMEGAdot = idot = 0.0;
75 const short URAoeArg,
const bool healthyArg,
76 const double CucArg,
const double CusArg,
77 const double CrcArg,
const double CrsArg,
78 const double CicArg,
const double CisArg,
79 const double M0Arg,
const double dnArg,
80 const double dndotArg,
const double eccArg,
81 const double AArg,
const double AhalfArg,
82 const double AdotArg,
const double OMEGA0Arg,
83 const double i0Arg,
const double wArg,
84 const double OMEGAdotARg,
85 const double idotArg )
87 loadData(satSysArg, obsIDArg, PRNIDArg, beginFitArg, endFitArg, ToeArg,
88 URAoeArg, healthyArg, CucArg, CusArg, CrcArg,
89 CrsArg, CicArg, CisArg, M0Arg, dnArg, dndotArg, eccArg, AArg,
90 AhalfArg, AdotArg, OMEGA0Arg, i0Arg, wArg, OMEGAdotARg, idotArg);
95 const short fullweeknum,
96 const long subframe1[10],
97 const long subframe2[10],
98 const long subframe3[10] )
100 loadData(obsIDArg, PRNID,fullweeknum, subframe1, subframe2, subframe3 );
106 return ((dataLoaded == right.dataLoaded) &&
107 (satSys == right.satSys) &&
108 (obsID == right.obsID) &&
109 (PRNID == right.PRNID) &&
110 (Toe == right.Toe) &&
111 (URAoe == right.URAoe) &&
112 (healthy == right.healthy) &&
113 (Cuc == right.Cuc) &&
114 (Cus == right.Cus) &&
115 (Crc == right.Crc) &&
116 (Crs == right.Crs) &&
117 (Cic == right.Cic) &&
118 (Cis == right.Cis) &&
121 (dndot == right.dndot) &&
122 (ecc == right.ecc) &&
124 (Ahalf == right.Ahalf) &&
125 (Adot == right.Adot) &&
126 (OMEGA0 == right.OMEGA0) &&
129 (OMEGAdot == right.OMEGAdot) &&
130 (idot == right.idot) &&
131 (beginFit == right.beginFit) &&
132 (endFit == right.endFit));
137 const ObsID obsIDArg,
138 const short PRNIDArg,
142 const short URAoeArg,
const bool healthyArg,
143 const double CucArg,
const double CusArg,
144 const double CrcArg,
const double CrsArg,
145 const double CicArg,
const double CisArg,
146 const double M0Arg,
const double dnArg,
147 const double dndotArg,
const double eccArg,
148 const double AArg,
const double AhalfArg,
149 const double AdotArg,
const double OMEGA0Arg,
150 const double i0Arg,
const double wArg,
151 const double OMEGAdotARg,
const double idotArg)
156 beginFit = beginFitArg;
160 healthy = healthyArg;
177 OMEGAdot = OMEGAdotARg;
183 const short fullweeknum,
184 const long subframe1[10],
185 const long subframe2[10],
186 const long subframe3[10])
197 if (!subframeConvert(subframe1, fullweeknum, ficked))
199 InvalidParameter exc(
"Subframe 1 not valid.");
203 short weeknum =
static_cast<short>( ficked[5] );
204 short accFlag =
static_cast<short>( ficked[7] );
205 short health =
static_cast<short>( ficked[8] );
210 iodc =
static_cast<short>( ldexp( ficked[9], -11 ) );
213 if (!subframeConvert(subframe2, fullweeknum, ficked))
215 InvalidParameter exc(
"Subframe 2 not valid.");
227 double ToeSOW = ficked[13];
236 short fiti =
static_cast<short>(ficked[14]);
238 long beginFitSOW = ToeSOW - (fitHours/2)*3600;
239 long endFitSOW = ToeSOW + (fitHours/2)*3600;
240 short beginFitWk = weeknum;
241 short endFitWk = weeknum;
257 if (!subframeConvert(subframe3, fullweeknum, ficked))
259 InvalidParameter exc(
"Subframe3 not valid.");
269 OMEGAdot = ficked[11];
288 InvalidRequest exc(
"Required data not stored.");
298 InvalidRequest exc(
"Required data not stored.");
301 if (ct >= beginFit && ct <= endFit)
return(
true);
310 double ToeSOW = gpsws.
sow;
315 double q,sinea,cosea;
320 double alat,talat,c2al,s2al,du,dr,di,U,R,truea,AINC;
321 double ANLON,cosu,sinu,xip,yip,can,san,cinc,sinc;
322 double xef,yef,zef,dek,dlk,div,domk,duv,drv;
323 double dxp,dyp,vxef,vyef,vzef;
326 double sqrtgm =
SQRT(ell.
gm());
329 double twoPI = 2.0e0 *
PI;
337 elapte = t - getOrbitEpoch();
342 amm = (sqrtgm / (A*Ahalf)) + dn;
350 meana = M0 + elapte * amm;
351 meana = fmod(meana, twoPI);
353 ea = meana + lecc *
::sin(meana);
357 F = meana - ( ea - lecc *
::sin(ea));
358 G = 1.0 - lecc *
::cos(ea);
362 }
while ( (fabs(delea) > 1.0e-11 ) && (loop_cnt <= 20) );
370 q =
SQRT( 1.0e0 - lecc*lecc);
373 G = 1.0e0 - lecc * cosea;
380 truea = atan2 ( GSTA, GCTA );
384 talat = 2.0e0 * alat;
385 c2al =
::cos( talat );
386 s2al =
::sin( talat );
388 du = c2al * Cuc + s2al * Cus;
389 dr = c2al * Crc + s2al * Crs;
390 di = c2al * Cic + s2al * Cis;
395 AINC = i0 + tdrinc * elapte + di;
409 can =
::cos( ANLON );
410 san =
::sin( ANLON );
411 cinc =
::cos( AINC );
412 sinc =
::sin( AINC );
415 xef = xip*can - yip*cinc*san;
416 yef = xip*san + yip*cinc*can;
425 dlk = amm * q / (G*G);
426 div = tdrinc - 2.0e0 * dlk *
427 ( Cic * s2al - Cis * c2al );
429 duv = dlk*(1.e0+ 2.e0 * (Cus*c2al - Cuc*s2al) );
430 drv = A * lecc * dek * sinea - 2.e0 * dlk *
431 ( Crc * s2al - Crs * c2al ) + Adot * G;
433 dxp = drv*cosu - R*sinu*duv;
434 dyp = drv*sinu + R*cosu*duv;
437 vxef = dxp*can - xip*san*domk - dyp*cinc*san
438 + yip*( sinc*san*div - cinc*can*domk);
439 vyef = dxp*san + xip*can*domk + dyp*cinc*can
440 - yip*( sinc*can*div + cinc*san*domk);
441 vzef = dyp*sinc + yip*cinc*div;
455 double twoPI = 2.0e0 *
PI;
456 double sqrtgm =
SQRT(ell.
gm());
457 double elapte = t - getOrbitEpoch();
458 double amm = (sqrtgm / (A*Ahalf)) + dn;
459 double meana,F,G,delea;
461 meana = M0 + elapte * amm;
462 meana = fmod(meana, twoPI);
463 double ea = meana + ecc *
::sin(meana);
467 F = meana - ( ea - ecc *
::sin(ea));
468 G = 1.0 - ecc *
::cos(ea);
472 }
while ( (
ABS(delea) > 1.0e-11 ) && (loop_cnt <= 20) );
486 InvalidRequest exc(
"Required data not stored.");
496 InvalidRequest exc(
"Required data not stored.");
506 InvalidRequest exc(
"Required data not stored.");
516 InvalidRequest exc(
"Required data not stored.");
526 InvalidRequest exc(
"Required data not stored.");
537 InvalidRequest exc(
"Required data not stored.");
548 InvalidRequest exc(
"Required data not stored.");
558 InvalidRequest exc(
"Required data not stored.");
568 InvalidRequest exc(
"Required data not stored.");
578 InvalidRequest exc(
"Required data not stored.");
588 InvalidRequest exc(
"Required data not stored.");
598 InvalidRequest exc(
"Required data not stored.");
608 InvalidRequest exc(
"Required data not stored.");
618 InvalidRequest exc(
"Required data not stored.");
628 InvalidRequest exc(
"Required data not stored.");
639 InvalidRequest exc(
"Required data not stored.");
649 InvalidRequest exc(
"Required data not stored.");
659 InvalidRequest exc(
"Required data not stored.");
669 InvalidRequest exc(
"Required data not stored.");
679 InvalidRequest exc(
"Required data not stored.");
689 InvalidRequest exc(
"Required data not stored.");
699 InvalidRequest exc(
"Required data not stored.");
709 InvalidRequest exc(
"Required data not stored.");
719 InvalidRequest exc(
"Required data not stored.");
729 InvalidRequest exc(
"Required data not stored.");
739 InvalidRequest exc(
"Required data not stored.");
749 InvalidRequest exc(
"Required data not stored.");
760 os << setw(4) << dummyTime.
week <<
"(";
761 os << setw(4) << (dummyTime.
week & 0x03FF) <<
") ";
762 os << setw(6) << setfill(
' ') << dummyTime.
sow <<
" ";
766 case 0: os <<
"Sun-0";
break;
767 case 1: os <<
"Mon-1";
break;
768 case 2: os <<
"Tue-2";
break;
769 case 3: os <<
"Wed-3";
break;
770 case 4: os <<
"Thu-4";
break;
771 case 5: os <<
"Fri-5";
break;
772 case 6: os <<
"Sat-6";
break;
775 os <<
" " << (
static_cast<YDSTime>(t)).printf(
"%3j %5.0s ")
776 << (
static_cast<CivilTime>(t)).printf(
"%02m/%02d/%04Y %02H:%02M:%02S");
778 #pragma clang diagnostic push
779 #pragma clang diagnostic ignored "-Wunused-function"
780 static void shortcut(ostream & os,
const long HOW )
786 SOW =
static_cast<long>( HOW );
788 SOD = SOW -
static_cast<long>( DOW *
SEC_PER_DAY );
789 hour =
static_cast<short>( SOD/3600 );
791 SOH =
static_cast<short>( SOD - (
hour*3600) );
794 sec = SOH -
min * 60;
797 case 0: os <<
"Sun-0";
break;
798 case 1: os <<
"Mon-1";
break;
799 case 2: os <<
"Tue-2";
break;
800 case 3: os <<
"Wed-3";
break;
801 case 4: os <<
"Thu-4";
break;
802 case 5: os <<
"Fri-5";
break;
803 case 6: os <<
"Sat-6";
break;
807 os <<
":" << setfill(
'0')
809 <<
":" << setw(2) <<
min
810 <<
":" << setw(2) << sec
813 #pragma clang diagnostic pop
817 const ios::fmtflags oldFlags = s.flags();
818 s.setf(ios::fixed, ios::floatfield);
819 s.setf(ios::right, ios::adjustfield);
820 s.setf(ios::uppercase);
824 s <<
"****************************************************************"
825 <<
"************" << endl
826 <<
"Broadcast Ephemeris (Engineering Units)" << endl
828 <<
"PRN : " << setw(2) << PRNID << endl
831 s <<
" Week(10bt) SOW DOW UTD SOD"
832 <<
" MM/DD/YYYY HH:MM:SS\n";
839 s.setf(ios::scientific, ios::floatfield);
843 <<
" ORBIT PARAMETERS"
846 <<
"Semi-major axis: " << setw(16) << Ahalf <<
" m**.5" << endl
847 <<
"Motion correction: " << setw(16) << dn <<
" rad/sec"
849 <<
"Eccentricity: " << setw(16) << ecc << endl
850 <<
"Arg of perigee: " << setw(16) << w <<
" rad" << endl
851 <<
"Mean anomaly at epoch: " << setw(16) << M0 <<
" rad" << endl
852 <<
"Right ascension: " << setw(16) << OMEGA0 <<
" rad "
853 << setw(16) << OMEGAdot <<
" rad/sec" << endl
854 <<
"Inclination: " << setw(16) << i0 <<
" rad "
855 << setw(16) << idot <<
" rad/sec" << endl;
858 <<
" HARMONIC CORRECTIONS"
861 <<
"Radial Sine: " << setw(16) << Crs <<
" m Cosine: "
862 << setw(16) << Crc <<
" m" << endl
863 <<
"Inclination Sine: " << setw(16) << Cis <<
" rad Cosine: "
864 << setw(16) << Cic <<
" rad" << endl
865 <<
"In-track Sine: " << setw(16) << Cus <<
" rad Cosine: "
866 << setw(16) << Cuc <<
" rad" << endl;