Update so that SolarPosition class works

feature/19
Daniel Warner 2013-05-28 21:28:22 +01:00
parent cbffb8355c
commit db1b42de86
2 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,7 @@ libsgp4_a_SOURCES = \
Observer.cpp \ Observer.cpp \
OrbitalElements.cpp \ OrbitalElements.cpp \
SGP4.cpp \ SGP4.cpp \
SolarPosition.cpp \
TimeSpan.cpp \ TimeSpan.cpp \
Tle.cpp \ Tle.cpp \
Util.cpp \ Util.cpp \
@ -22,6 +23,7 @@ include_HEADERS = CoordGeodetic.h \
Globals.h \ Globals.h \
Observer.h \ Observer.h \
SGP4.h \ SGP4.h \
SolarPosition.h \
Tle.h \ Tle.h \
Util.h \ Util.h \
TimeSpan.h \ TimeSpan.h \

View File

@ -24,7 +24,7 @@
Eci SolarPosition::FindPosition(const DateTime& dt) Eci SolarPosition::FindPosition(const DateTime& dt)
{ {
const double mjd = j.FromJan1_12h_1900(); const double mjd = dt.ToJulian() - kEPOCH_JAN1_12H_1900;
const double year = 1900 + mjd / 365.25; const double year = 1900 + mjd / 365.25;
const double T = (mjd + Delta_ET(year) / kSECONDS_PER_DAY) / 36525.0; const double T = (mjd + Delta_ET(year) / kSECONDS_PER_DAY) / 36525.0;
const double M = Util::DegreesToRadians(Util::Wrap360(358.47583 const double M = Util::DegreesToRadians(Util::Wrap360(358.47583
@ -48,12 +48,12 @@ Eci SolarPosition::FindPosition(const DateTime& dt)
+ (0.00000164 - 0.000000503 * T) * T) * T + 0.00256 * cos(O)); + (0.00000164 - 0.000000503 * T) * T) * T + 0.00256 * cos(O));
R = R * kAU; R = R * kAU;
Vector solar_position = Vector(R * cos(Lsa), Vector solar_position(R * cos(Lsa),
R * sin(Lsa) * cos(eps), R * sin(Lsa) * cos(eps),
R * sin(Lsa) * sin(eps), R * sin(Lsa) * sin(eps),
R); R);
return Eci(j, solar_position); return Eci(dt, solar_position);
} }
double SolarPosition::Delta_ET(double year) const double SolarPosition::Delta_ET(double year) const