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;
}
@ -807,6 +809,8 @@ void SGDP4::DeepPeriodics(const double& sinio, const double& cosio, const double
double cosis = cos(xinc);
double zm = d_zmos_ + ZNS * t;
if (first_run_)
zm = d_zmos_;
double zf = zm + 2.0 * ZES * sin(zm);
double sinzf = sin(zf);
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;
shs = d_sh2_ * f2 + d_sh3_ * f3;
zm = d_zmol_ + ZNL * t;
if (first_run_)
zm = d_zmol_;
zf = zm + 2.0 * ZEL * sin(zm);
sinzf = sin(zf);
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 ph = shs + shl;
xinc += pinc;
em += pe;
if (!first_run_) {
if (Inclination() >= 0.2) {
/*
* 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;
xinc += pinc;
em += pe;
alfdp += dalf;
betdp += dbet;
if (Inclination() >= 0.2) {
/*
* 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;
double dls = pl + pgh - pinc * xnodes * sinis;
alfdp += dalf;
betdp += dbet;
xls += dls;
xnodes = atan2(alfdp, betdp);
xll += pl;
omgasm = xls - xll - cos(xinc) * xnodes;
double xls = xll + omgasm + cosis * xnodes;
double dls = pl + pgh - pinc * xnodes * sinis;
xls += dls;
xnodes = atan2(alfdp, betdp);
xll += pl;
omgasm = xls - xll - cos(xinc) * xnodes;
}
}
}

View File

@ -10,9 +10,9 @@
void RunTest();
int main() {
#if 0
std::list<Tle> tles;
std::list<Tle> tles;
#if 0
tles.push_back(Tle("ALSAT 1 ",
"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"));
@ -47,7 +47,7 @@ int main() {
"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"));
#endif
tles.push_back(Tle("SGP4 Test",
"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"));
@ -61,8 +61,8 @@ int main() {
model.FindPosition(i * 360.0);
}
}
#endif
RunTest();
//RunTest();
return 0;
}