// /////////////////////////////////////////////////////////////////// // 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_VectorUnits = VectorUnits.Km; double mfactor = Globals.TWOPI * (Globals.OMEGA_E / Globals.SEC_PER_DAY); double lat = geo.Latitude; double lon = geo.Longitude; double alt = geo.Altitude; // 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_Position = new Vector(); m_Position.X = achcp * Math.Cos(theta); // km m_Position.Y = achcp * Math.Sin(theta); // km m_Position.Z = (Globals.XKMPER * s + alt) * Math.Sin(lat); // km m_Position.W = Math.Sqrt(Globals.Sqr(m_Position.X) + Globals.Sqr(m_Position.Y) + Globals.Sqr(m_Position.Z)); // range, km m_Velocity = new Vector(); m_Velocity.X = -mfactor * m_Position.Y; // km / sec m_Velocity.Y = mfactor * m_Position.X; m_Velocity.Z = 0.0; m_Velocity.W = Math.Sqrt(Globals.Sqr(m_Velocity.X) + // range rate km/sec^2 Globals.Sqr(m_Velocity.Y)); }
/// <summary> /// Creates a new instance of the class with the given position and /// velocity components. /// </summary> /// <param name="pos">The position vector.</param> /// <param name="vel">The velocity vector.</param> public Eci(Vector pos, Vector vel, Julian date, bool IsAeUnits) { Position = pos; Velocity = vel; jDate = date; Units = (IsAeUnits ? VectorUnits.Ae : VectorUnits.None); }
public Eci(Vector pos, Vector vel, Julian date, bool IsAeUnits) { m_Position = pos; m_Velocity = vel; m_Date = date; m_VectorUnits = (IsAeUnits ? VectorUnits.Ae : VectorUnits.None); }
// /////////////////////////////////////////////////////////////////////////// // 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_VectorUnits = VectorUnits.Km; } }
public void SetUnitsKm() { Units = VectorUnits.Km; }
public void SetUnitsAe() { Units = VectorUnits.Ae; }
public Eci() { m_VectorUnits = VectorUnits.None; }
public void Ae2Km() { if (UnitsAreAe()) { MulPos(6378.135); MulVel(106.30225); Units = VectorUnits.Km; } }