示例#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_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));
        }
示例#2
0
 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);
 }
示例#3
0
        /// <summary>
        /// Creates a instance of the class from geodetic coordinates.
        /// </summary>
        /// <param name="geo">The geocentric coordinates.</param>
        /// <param name="date">The Julian date.</param>
        /// <remarks>
        /// Assumes the Earth is an oblate spheroid.
        /// Reference: The 1992 Astronomical Almanac, page K11
        /// Reference: www.celestrak.com (Dr. T.S. Kelso)
        /// </remarks>
        public Eci(Geo geo, Julian date)
        {
            double lat = geo.LatitudeRad;
             double lon = geo.LongitudeRad;
             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);

             Position = new Vector();

             Position.X = achcp * Math.Cos(theta);             // km
             Position.Y = achcp * Math.Sin(theta);             // km
             Position.Z = (Globals.Xkmper * s + alt) * Math.Sin(lat);   // km
             Position.W = Math.Sqrt(Globals.Sqr(Position.X) +
                                Globals.Sqr(Position.Y) +
                                Globals.Sqr(Position.Z));  // range, km

             Velocity = new Vector();
             double mfactor = Globals.TwoPi * (Globals.OmegaE / Globals.SecPerDay);

             Velocity.X = -mfactor * Position.Y;               // km / sec
             Velocity.Y =  mfactor * Position.X;               // km / sec
             Velocity.Z = 0.0;                                 // km / sec
             Velocity.W = Math.Sqrt(Globals.Sqr(Velocity.X) +  // range rate km/sec^2
                                Globals.Sqr(Velocity.Y));
        }
示例#4
0
        // ///////////////////////////////////////////////////////////////////
        public Orbit(Tle tle)
        {
            m_NoradModel = null;
            m_tle = tle;
            m_tle.Initialize();

            int epochYear = (int)m_tle.getField(Tle.eField.FLD_EPOCHYEAR);
            double epochDay = m_tle.getField(Tle.eField.FLD_EPOCHDAY);

            if (epochYear < 57)
                epochYear += 2000;
            else
                epochYear += 1900;

            m_jdEpoch = new Julian(epochYear, epochDay);

            m_secPeriod = -1.0;

            // Recover the original mean motion and semimajor axis from the
            // input elements.
            double mm = mnMotion();
            double rpmin = mm * 2 * Globals.PI / Globals.MIN_PER_DAY;   // rads per minute

            double a1 = Math.Pow(Globals.XKE / rpmin, Globals.TWOTHRD);
            double e = Eccentricity();
            double i = Inclination();
            double temp = (1.5 * Globals.CK2 * (3.0 * Globals.Sqr(Math.Cos(i)) - 1.0) /
                            Math.Pow(1.0 - e * e, 1.5));
            double delta1 = temp / (a1 * a1);
            double a0 = a1 *
                           (1.0 - delta1 *
                           ((1.0 / 3.0) + delta1 *
                           (1.0 + 134.0 / 81.0 * delta1)));

            double delta0 = temp / (a0 * a0);

            m_mnMotionRec = rpmin / (1.0 + delta0);
            m_aeAxisSemiMinorRec = a0 / (1.0 - delta0);
            m_aeAxisSemiMajorRec = m_aeAxisSemiMinorRec / Math.Sqrt(1.0 - (e * e));
            m_kmPerigeeRec = Globals.XKMPER * (m_aeAxisSemiMinorRec * (1.0 - e) - Globals.AE);

            if (2.0 * Globals.PI / m_mnMotionRec >= 225.0)
            {
                // SDP4 : period >= 225 minutes.
                m_NoradModel = new NoradSDP4(this);
            }
            else
            {
                // SGP4 : period < 225 minutes
                m_NoradModel = new NoradSGP4(this);
            }
        }
		// /////////////////////////////////////////////////////////////////////
		public TimeSpan Diff(Julian date)
		{
			const double TICKS_PER_DAY = 8.64e11; // 1 tick = 100 nanoseconds
			return new TimeSpan((long)((m_Date - date.m_Date) * TICKS_PER_DAY));
		}
示例#6
0
 /// <summary>
 /// Returns the ECI coordinates of the site at the given time.
 /// </summary>
 /// <param name="date">Time of position calculation.</param>
 /// <returns>The site's ECI coordinates.</returns>
 public EciTime GetPosition(Julian date)
 {
     return new EciTime(Geo, date);
 }
示例#7
0
 /// <summary>
 /// Creates a new instance of the class given ECI coordinates.
 /// </summary>
 /// <param name="eci">The ECI coordinates.</param>
 /// <param name="date">The Julian date.</param>
 public Geo(Eci eci, Julian date)
     : this(eci.Position, 
        (Globals.AcTan(eci.Position.Y, eci.Position.X) - date.ToGmst()) % Globals.TwoPi)
 {
 }
示例#8
0
 /// <summary>
 /// Creates a new instance of the class from the given components.
 /// </summary>
 /// <param name="radAz">Azimuth, in radians.</param>
 /// <param name="radEl">Elevation, in radians.</param>
 /// <param name="range">Range, in kilometers.</param>
 /// <param name="rangeRate">Range rate, in kilometers per second. A negative
 /// range rate means "towards the observer".</param>
 /// <param name="date">The time associated with the coordinates.</param>
 public TopoTime(double radAz, double radEl, double range, double rangeRate, Julian date)
     : base(radAz, radEl, range, rangeRate)
 {
     Date = date;
 }
示例#9
0
 /// <summary>
 /// Creates a new instance of the class from ECI-time coordinates.
 /// </summary>
 /// <param name="eci">The ECI coordinates.</param>
 /// <param name="date">The time associated with the ECI coordinates.</param>
 public EciTime(Eci eci, Julian date)
     : this(eci.Position, eci.Velocity, date)
 {
 }
		// ///////////////////////////////////////////////////////////////////
		public Orbit(Tle tle)
		{
			m_NoradModel = null;
			m_tle        = tle;
			m_jdEpoch    = m_tle.EpochJulian;
			m_secPeriod  = -1.0;

			// Recover the original mean motion and semimajor axis from the
			// input elements.
			double mm     = mnMotion;
			double rpmin  = mm * 2 * Globals.PI / Globals.MIN_PER_DAY;   // rads per minute

			double a1     = Math.Pow(Globals.XKE / rpmin, Globals.TWOTHRD);
			double e      = Eccentricity;
			double i      = Inclination;
			double temp   = (1.5 * Globals.CK2 * (3.0 * Globals.Sqr(Math.Cos(i)) - 1.0) /
				Math.Pow(1.0 - e * e, 1.5));
			double delta1 = temp / (a1 * a1);
			double a0     = a1 *
				(1.0 - delta1 *
				((1.0 / 3.0) + delta1 *
				(1.0 + 134.0 / 81.0 * delta1)));

			double delta0 = temp / (a0 * a0);

			m_mnMotionRec        = rpmin / (1.0 + delta0);
			m_aeAxisSemiMinorRec = a0 / (1.0 - delta0);
			m_aeAxisSemiMajorRec = m_aeAxisSemiMinorRec / Math.Sqrt(1.0 - (e * e));
			m_kmPerigeeRec       = Globals.XKMPER * (m_aeAxisSemiMajorRec * (1.0 - e) - Globals.AE);
			m_kmApogeeRec        = Globals.XKMPER * (m_aeAxisSemiMajorRec * (1.0 + e) - Globals.AE);

			if (2.0 * Globals.PI / m_mnMotionRec >= 225.0)
			{
				// SDP4 - period >= 225 minutes.
				m_NoradModel = new NoradSDP4(this);
			}
			else
			{
				// SGP4 - period < 225 minutes
				m_NoradModel = new NoradSGP4(this);
			}
		}
示例#11
0
 /// <summary>
 /// Constructor accepting Geo and Julian objects.
 /// </summary>
 /// <param name="geo">The Geo object.</param>
 /// <param name="date">The Julian date.</param>
 public GeoTime(Geo geo, Julian date)
     : base(geo)
 {
     Date = date;
 }
示例#12
0
 /// <summary>
 /// Standard constructor.
 /// </summary>
 /// <param name="radLat">Latitude, in radians. Negative values indicate
 /// latitude south.</param>
 /// <param name="radLon">Longitude, in radians. Negative value indicate longitude
 /// west.</param>
 /// <param name="kmAlt">Altitude above the ellipsoid model, in kilometers.</param>
 /// <param name="date">The time associated with the coordinates.</param>
 public GeoTime(double radLat, double radLon, double kmAlt, Julian date)
     : base(radLat, radLon, kmAlt)
 {
     Date = date;
 }
示例#13
0
 /// <summary>
 /// Creates a new instance of the class from geodetic coordinates.
 /// </summary>
 /// <param name="geo">The geodetic coordinates.</param>
 /// <param name="date">The time associated with the ECI coordinates.</param>
 public EciTime(Geo geo, Julian date)
     : base(geo, date)
 {
     Date = date;
 }
		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);
		}
示例#15
0
 /// <summary>
 /// Creates a new instance of the class from ECI coordinates.
 /// </summary>
 /// <param name="eci">The ECI coordinates.</param>
 /// <param name="date">The Julian date.</param>
 public GeoTime(Eci eci, Julian date)
     : base(eci, date)
 {
     Date = date;
 }
		// ///////////////////////////////////////////////////////////////////
		// 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));
		}
示例#17
0
 /// <summary>
 /// Creates an instance of the class from topo and time information.
 /// </summary>
 /// <param name="topo"></param>
 /// <param name="date"></param>
 public TopoTime(Topo topo, Julian date)
     : base(topo.AzimuthRad, topo.ElevationRad, topo.Range, topo.RangeRate)
 {
     Date = date;
 }
		// ///////////////////////////////////////////////////////////////////////////
		// getPosition()
		// Return the ECI coordinate of the site at the given time.
		public Eci getPosition(Julian date)
		{
			return new Eci(m_geo, date);
		}
示例#19
0
 /// <summary>
 /// Creates an instance of the class with the given position, velocity, and time.
 /// </summary>
 /// <param name="pos">The position vector.</param>
 /// <param name="vel">The velocity vector.</param>
 /// <param name="date">The time associated with the position.</param>
 public EciTime(Vector pos, Vector vel, Julian date)
     : base(pos, vel)
 {
     Date = date;
 }