Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix epoch naming #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion libsgp4/DateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,14 +626,24 @@ class DateTime
return Util::WrapTwoPI(Util::DegreesToRadians(gt / 240.0));
}

/**
* Return the modified julian date since the j1900 epoch
* January 1, 1900, at 12:00 TT
* @returns the modified julian date
*/
double ToJ1900() const
{
return ToJulian() - 2415020.0;
}

/**
* Return the modified julian date since the j2000 epoch
* January 1, 2000, at 12:00 TT
* @returns the modified julian date
*/
double ToJ2000() const
{
return ToJulian() - 2415020.0;
return ToJulian() - 2451545.0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libsgp4/SGP4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ void SGP4::DeepSpaceInitialise(
/*
* initialize lunar / solar terms
*/
const double jday = elements_.Epoch().ToJ2000();
const double jday = elements_.Epoch().ToJ1900();

const double xnodce = Util::WrapTwoPI(4.5236020 - 9.2422029e-4 * jday);
const double stem = sin(xnodce);
Expand Down
2 changes: 1 addition & 1 deletion libsgp4/SolarPosition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace libsgp4

Eci SolarPosition::FindPosition(const DateTime& dt)
{
const double mjd = dt.ToJ2000();
const double mjd = dt.ToJ1900();
const double year = 1900 + mjd / 365.25;
const double T = (mjd + Delta_ET(year) / kSECONDS_PER_DAY) / 36525.0;
const double M = Util::DegreesToRadians(Util::Wrap360(358.47583
Expand Down