예제 #1
0
        // ///////////////////////////////////////////////////////////////////
        // 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));
        }
예제 #2
0
        private CoordGeo m_geo; // lat, lon, alt of earth site

        #region Construction

        // //////////////////////////////////////////////////////////////////////////
        public Site(CoordGeo geo)
        {
            m_geo = geo;
        }
예제 #3
0
 // ///////////////////////////////////////////////////////////////////////////
 // c'tor accepting:
 //    Latitude  in degress (negative south)
 //    Longitude in degress (negative west)
 //    Altitude  in km
 public Site(double degLat, double degLon, double kmAlt)
 {
     m_geo =
         new CoordGeo(Globals.Deg2Rad(degLat), Globals.Deg2Rad(degLon), kmAlt);
 }
예제 #4
0
 public CoordGeo ToGeo()
 {
     double num;
     double num1;
     //this.Ae2Km();
     double num2 = Globals.AcTan(Position.Y, Position.X);
     double gmst = (num2 - jDate.ToGmst()) % 6.28318530717959;
     if (gmst < 0)
     {
         gmst = gmst + 6.28318530717959;
     }
     double num3 = Math.Sqrt(Globals.Sqr(Position.X) + Globals.Sqr(Position.Y));
     double num4 = 0.00669431777826672;
     double num5 = Globals.AcTan(Position.Z, num3);
     do
     {
         num = num5;
         num1 = 1 / Math.Sqrt(1 - num4 * Globals.Sqr(Math.Sin(num)));
         num5 = Globals.AcTan(Position.Z + 6378.135 * num1 * num4 * Math.Sin(num), num3);
     }
     while (Math.Abs(num5 - num) > 1E-07);
     double num6 = num3 / Math.Cos(num5) - 6378.135 * num1;
     CoordGeo coordGeo = new CoordGeo(num5, gmst, num6);
     return coordGeo;
 }