Using first_run_ code

feature/19
Daniel Warner 2011-03-28 17:36:54 +01:00
parent a12f6396e9
commit 7dccfeb548
2 changed files with 43 additions and 34 deletions

View File

@ -176,6 +176,8 @@ void SGDP4::Initialize(const double& theta2, const double& betao2, const double&
} }
} }
FindPosition(0.0);
first_run_ = false; first_run_ = false;
} }
@ -807,6 +809,8 @@ void SGDP4::DeepPeriodics(const double& sinio, const double& cosio, const double
double cosis = cos(xinc); double cosis = cos(xinc);
double zm = d_zmos_ + ZNS * t; double zm = d_zmos_ + ZNS * t;
if (first_run_)
zm = d_zmos_;
double zf = zm + 2.0 * ZES * sin(zm); double zf = zm + 2.0 * ZES * sin(zm);
double sinzf = sin(zf); double sinzf = sin(zf);
double f2 = 0.5 * sinzf * sinzf - 0.25; double f2 = 0.5 * sinzf * sinzf - 0.25;
@ -818,6 +822,8 @@ void SGDP4::DeepPeriodics(const double& sinio, const double& cosio, const double
sghs = d_sgh2_ * f2 + d_sgh3_ * f3 + d_sgh4_ * sinzf; sghs = d_sgh2_ * f2 + d_sgh3_ * f3 + d_sgh4_ * sinzf;
shs = d_sh2_ * f2 + d_sh3_ * f3; shs = d_sh2_ * f2 + d_sh3_ * f3;
zm = d_zmol_ + ZNL * t; zm = d_zmol_ + ZNL * t;
if (first_run_)
zm = d_zmol_;
zf = zm + 2.0 * ZEL * sin(zm); zf = zm + 2.0 * ZEL * sin(zm);
sinzf = sin(zf); sinzf = sin(zf);
f2 = 0.5 * sinzf * sinzf - 0.25; f2 = 0.5 * sinzf * sinzf - 0.25;
@ -834,39 +840,42 @@ void SGDP4::DeepPeriodics(const double& sinio, const double& cosio, const double
double pgh = sghs + sghl; double pgh = sghs + sghl;
double ph = shs + shl; double ph = shs + shl;
xinc += pinc; if (!first_run_) {
em += pe;
if (Inclination() >= 0.2) { xinc += pinc;
/* em += pe;
* apply periodics directly
*/
ph /= sinio;
pgh -= cosio * ph;
omgasm += pgh;
xnodes += ph;
xll += pl;
} else {
/*
* apply periodics with lyddane modification
*/
double sinok = sin(xnodes);
double cosok = cos(xnodes);
double alfdp = sinis * sinok;
double betdp = sinis * cosok;
double dalf = ph * cosok + pinc * cosis * sinok;
double dbet = -ph * sinok + pinc * cosis * cosok;
alfdp += dalf; if (Inclination() >= 0.2) {
betdp += dbet; /*
* apply periodics directly
*/
ph /= sinio;
pgh -= cosio * ph;
omgasm += pgh;
xnodes += ph;
xll += pl;
} else {
/*
* apply periodics with lyddane modification
*/
double sinok = sin(xnodes);
double cosok = cos(xnodes);
double alfdp = sinis * sinok;
double betdp = sinis * cosok;
double dalf = ph * cosok + pinc * cosis * sinok;
double dbet = -ph * sinok + pinc * cosis * cosok;
double xls = xll + omgasm + cosis * xnodes; alfdp += dalf;
double dls = pl + pgh - pinc * xnodes * sinis; betdp += dbet;
xls += dls; double xls = xll + omgasm + cosis * xnodes;
xnodes = atan2(alfdp, betdp); double dls = pl + pgh - pinc * xnodes * sinis;
xll += pl;
omgasm = xls - xll - cos(xinc) * xnodes; xls += dls;
xnodes = atan2(alfdp, betdp);
xll += pl;
omgasm = xls - xll - cos(xinc) * xnodes;
}
} }
} }

View File

@ -10,9 +10,9 @@
void RunTest(); void RunTest();
int main() { int main() {
#if 0
std::list<Tle> tles;
std::list<Tle> tles;
#if 0
tles.push_back(Tle("ALSAT 1 ", tles.push_back(Tle("ALSAT 1 ",
"1 27559U 02054A 11083.20474426 .00000231 00000-0 46807-4 0 3956", "1 27559U 02054A 11083.20474426 .00000231 00000-0 46807-4 0 3956",
"2 27559 97.8504 306.7237 0024736 97.8736 262.5269 14.69492531444449")); "2 27559 97.8504 306.7237 0024736 97.8736 262.5269 14.69492531444449"));
@ -47,7 +47,7 @@ int main() {
"1 35683U 09041C 11083.19129526 .00000128 00000-0 29890-4 0 8539", "1 35683U 09041C 11083.19129526 .00000128 00000-0 29890-4 0 8539",
"2 35683 98.0774 342.2478 0001262 104.0560 256.0776 14.69410764 88426")); "2 35683 98.0774 342.2478 0001262 104.0560 256.0776 14.69410764 88426"));
#endif
tles.push_back(Tle("SGP4 Test", tles.push_back(Tle("SGP4 Test",
"1 88888U 80275.98708465 .00073094 13844-3 66816-4 0 8", "1 88888U 80275.98708465 .00073094 13844-3 66816-4 0 8",
"2 88888 72.8435 115.9689 0086731 52.6988 110.5714 16.05824518 105")); "2 88888 72.8435 115.9689 0086731 52.6988 110.5714 16.05824518 105"));
@ -61,8 +61,8 @@ int main() {
model.FindPosition(i * 360.0); model.FindPosition(i * 360.0);
} }
} }
#endif
RunTest(); //RunTest();
return 0; return 0;
} }