Moved calculate dot terms into seperate function

feature/19
Daniel Warner 2011-03-30 12:17:20 +01:00
parent 23877a56c4
commit c4dd1f28be
2 changed files with 54 additions and 46 deletions

View File

@ -1013,14 +1013,8 @@ void SGDP4::DeepPeriodics(const double& t, double& em,
* omegaq = omegao
*/
void SGDP4::DeepSecular(const double& t, double& xll, double& omgasm,
double& xnodes, double& em, double& xinc, double& xn,
const double& omgdot, const double& omegaq) {
double& xnodes, double& em, double& xinc, double& xn) {
static const double G22 = 5.7686396;
static const double G32 = 0.95240898;
static const double G44 = 1.8014998;
static const double G52 = 1.0508330;
static const double G54 = 4.4108898;
static const double THDT = 4.3752691E-3;
static const double step = 720.0;
@ -1065,9 +1059,39 @@ void SGDP4::DeepSecular(const double& t, double& xll, double& omgasm,
*/
d_xli_ = d_xli_ + xldot * delt + xndot * step2;
d_xni_ = d_xni_ + xndot * delt + xnddt * step2;
DeepSpaceCalcDotTerms(xndot, xnddt, xldot);
d_atime_ += delt;
ft = t - d_atime_;
} while (fabs(ft) >= step);
}
/*
* dot terms calculated
* integrator
*/
xn = d_xni_ + xndot * ft + xnddt * ft * ft * 0.5;
double xl = d_xli_ + xldot * ft + xndot * ft * ft * 0.5;
double temp = -xnodes + i_gsto_ + t * THDT;
if (!d_synchronous_flag_)
xll = xl + temp + temp;
else
xll = xl - omgasm + temp;
}
/*
* calculate dot terms
*/
void SGDP4::DeepSpaceCalcDotTerms(double& xndot, double& xnddt, double& xldot) {
static const double G22 = 5.7686396;
static const double G32 = 0.95240898;
static const double G44 = 1.8014998;
static const double G52 = 1.0508330;
static const double G54 = 4.4108898;
if (d_synchronous_flag_) {
xndot = d_del1_ * sin(d_xli_ - d_fasx2_) + d_del2_ * sin(2.0 * (d_xli_ - d_fasx4_))
@ -1078,7 +1102,7 @@ void SGDP4::DeepSecular(const double& t, double& xll, double& omgasm,
} else {
const double xomi = omegaq + omgdot * d_atime_;
const double xomi = ArgumentPerigee() + i_omgdot_ * d_atime_;
const double x2omi = xomi + xomi;
const double x2li = d_xli_ + d_xli_;
@ -1103,24 +1127,7 @@ void SGDP4::DeepSecular(const double& t, double& xll, double& omgasm,
+ d_d5421_ * cos(xomi + x2li - G54)
+ d_d5433_ * cos(-xomi + x2li - G54));
}
xldot = d_xni_ + d_xfact_;
xnddt = xnddt * xldot;
d_atime_ += delt;
ft = t - d_atime_;
} while (fabs(ft) >= step);
}
/*
* integrator
*/
xn = d_xni_ + xndot * ft + xnddt * ft * ft * 0.5;
double xl = d_xli_ + xldot * ft + xndot * ft * ft * 0.5;
double temp = -xnodes + i_gsto_ + t * THDT;
if (!d_synchronous_flag_)
xll = xl + temp + temp;
else
xll = xl - omgasm + temp;
}

View File

@ -34,6 +34,7 @@ private:
const double& xincl, const double& xlcof, const double& aycof,
const double& x3thm1, const double& x1mth2, const double& x7thm1,
const double& cosio, const double& sinio);
void DeepSpaceCalcDotTerms(double& xndot, double& xnddt, double& xldot);
bool first_run_;