// /////////////////////////////////////////////////////////////////// // Calculate the ECI coordinates of the location "geo" at time "date". // Assumes geo coordinates are km-based. // Assumes the earth is an oblate spheroid as defined in WGS '72. // Reference: The 1992 Astronomical Almanac, page K11 // Reference: www.celestrak.com (Dr. TS Kelso) public Eci(CoordGeo geo, Julian date) { m_VecUnits = VecUnits.UNITS_KM; double mfactor = Globals.TWOPI * (Globals.OMEGA_E / Globals.SEC_PER_DAY); double lat = geo.m_Lat; double lon = geo.m_Lon; double alt = geo.Altitude.Kilometers; // Calculate Local Mean Sidereal Time (theta) double theta = date.toLMST(lon); double c = 1.0 / Math.Sqrt(1.0 + Globals.F * (Globals.F - 2.0) * Globals.Sqr(Math.Sin(lat))); double s = Globals.Sqr(1.0 - Globals.F) * c; double achcp = (Globals.XKMPER * c + alt) * Math.Cos(lat); m_date = date; m_pos = new Vector(); m_pos.X = achcp * Math.Cos(theta); // km m_pos.Y = achcp * Math.Sin(theta); // km m_pos.Z = (Globals.XKMPER * s + alt) * Math.Sin(lat); // km m_pos.W = Math.Sqrt(Globals.Sqr(m_pos.X) + Globals.Sqr(m_pos.Y) + Globals.Sqr(m_pos.Z)); // range, km m_vel = new Vector(); m_vel.X = -mfactor * m_pos.Y; // km / sec m_vel.Y = mfactor * m_pos.X; m_vel.Z = 0.0; m_vel.W = Math.Sqrt(Globals.Sqr(m_vel.X) + // range rate km/sec^2 Globals.Sqr(m_vel.Y)); }
public Eci(Vector pos, Vector vel, Julian date, bool IsAeUnits) { m_pos = pos; m_vel = vel; m_date = date; m_VecUnits = (IsAeUnits ? VecUnits.UNITS_AE : VecUnits.UNITS_NONE); }
public Eci() { m_VecUnits = VecUnits.UNITS_NONE; }
public void setUnitsKm() { m_VecUnits = VecUnits.UNITS_KM; }
public void setUnitsAe() { m_VecUnits = VecUnits.UNITS_AE; }
// /////////////////////////////////////////////////////////////////////////// // Convert the position and velocity vector units from Globals.AE-based units // to kilometer based units. public void ae2km() { if (UnitsAreAe()) { MulPos(Globals.XKMPER / Globals.AE); // km MulVel((Globals.XKMPER / Globals.AE) * (Globals.MIN_PER_DAY / 86400)); // km/sec m_VecUnits = VecUnits.UNITS_KM; } }