예제 #1
0
        public void get_InitStateJx(IAgOrbitStateClassical keplerState)
        {
            keplerState.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis Orbitsize = keplerState.SizeShape as IAgClassicalSizeShapeSemimajorAxis;

            keplerState.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
            IAgClassicalLocationTrueAnomaly OrbitLocation = keplerState.Location as IAgClassicalLocationTrueAnomaly;

            IAgClassicalOrientation OrbitOrientation = keplerState.Orientation as IAgClassicalOrientation;

            OrbitOrientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN;
            IAgOrientationAscNodeRAAN OrbitAsc = keplerState.Orientation.AscNode as IAgOrientationAscNodeRAAN;


            SemiMajorAxis = Orbitsize.SemiMajorAxis;
            Eccentricity  = Orbitsize.Eccentricity;
            Inclination   = OrbitOrientation.Inclination;
            ArgOfPerigee  = OrbitOrientation.ArgOfPerigee;
            RAAN          = OrbitAsc.Value;
            TrueAnomaly   = OrbitLocation.Value;

            //Console.WriteLine(Orbitsize.SemiMajorAxis);
            //IAgQuantity a = OrbitOrientation as IAgQuantity;
            //Console.WriteLine(OrbitOrientation.Inclination);
        }
예제 #2
0
        // check if the resulting orbit is circular or parabolic/hyperbolic
        private static bool IsCircular(IAgVePropagatorJ2Perturbation prop)
        {
            IAgOrbitStateClassical testOrbit = prop.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;

            testOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis testSizeShape = testOrbit.SizeShape as IAgClassicalSizeShapeSemimajorAxis;

            if (testSizeShape.Eccentricity < 1.0)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        private void CreateSat1TwoBody()
        {
            try
            {
                try
                { root.ExecuteCommand("Unload / */Satellite/Sat1"); }
                catch
                { }

                IAgSatellite sat1 = root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "Sat1") as IAgSatellite;
                sat1.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody);

                IAgVePropagatorTwoBody propSat1 = sat1.Propagator as IAgVePropagatorTwoBody;
                propSat1.Step = 60;

                IAgVeGfxAttributesOrbit sat1Graph = sat1.Graphics.Attributes as IAgVeGfxAttributesOrbit;
                sat1Graph.Color      = Color.LimeGreen;
                sat1Graph.Line.Width = AgELineWidth.e2;

                //'Definisco i parametri Kepleriani classici del satellite
                IAgOrbitStateClassical classical2B = propSat1.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;
                classical2B.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000;

                //'Uso il semiasse maggiore e l'eccentricità per definire la forma e la dimensione dell'orbita
                classical2B.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
                IAgClassicalSizeShapeSemimajorAxis semi2B = classical2B.SizeShape as IAgClassicalSizeShapeSemimajorAxis;
                semi2B.SemiMajorAxis = semimajorAxisSat1;
                semi2B.Eccentricity  = eccentricitySat1;

                //'Per definire l'orientamento dell'orbita nello spazio uso l'inclinazione, l'argomento del perigeo e la RAAN
                classical2B.Orientation.Inclination  = inclinationSat1;
                classical2B.Orientation.ArgOfPerigee = argOfPerigeeSat1;
                classical2B.Orientation.AscNodeType  = AgEOrientationAscNode.eAscNodeRAAN;
                IAgOrientationAscNodeRAAN raan = classical2B.Orientation.AscNode as IAgOrientationAscNodeRAAN;
                raan.Value = raanSat1;

                //'uso l'anomalia vera per definire la posizione iniziale del satellite lungo la sua orbita
                classical2B.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
                IAgClassicalLocationTrueAnomaly trueAnomaly = classical2B.Location as IAgClassicalLocationTrueAnomaly;
                trueAnomaly.Value = trueAnomSat1;

                //'Infine assegno i parametri orbtali così definiti al satellite e lo propago
                propSat1.InitialState.Representation.Assign(classical2B);
                propSat1.Propagate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #4
0
        // check if perigee radius is positive
        private static bool IsPerigeePositive(IAgVePropagatorJ2Perturbation prop)
        {
            IAgOrbitStateClassical testOrbit = prop.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;

            testOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis testSizeShape = testOrbit.SizeShape as IAgClassicalSizeShapeSemimajorAxis;

            // perigee radius = a(1-e)
            double rPeri = testSizeShape.SemiMajorAxis * (1 - testSizeShape.Eccentricity);

            if (rPeri > 3000.0)
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
        private void CreateSat2J2()
        {
            try
            {
                try
                { root.ExecuteCommand("Unload / */Satellite/Sat2"); }
                catch
                { }

                IAgSatellite sat2 = root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "Sat2") as IAgSatellite;
                sat2.SetPropagatorType(AgEVePropagatorType.ePropagatorJ2Perturbation);

                IAgVePropagatorJ2Perturbation propSat2 = sat2.Propagator as IAgVePropagatorJ2Perturbation;
                propSat2.Step = 60;

                IAgVeGfxAttributesOrbit sat2Graph = sat2.Graphics.Attributes as IAgVeGfxAttributesOrbit;
                sat2Graph.Color      = Color.Orange;
                sat2Graph.Line.Width = AgELineWidth.e2;

                IAgOrbitStateClassical classicalJ2 = propSat2.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;
                classicalJ2.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000;

                classicalJ2.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
                IAgClassicalSizeShapeSemimajorAxis semiJ2 = classicalJ2.SizeShape as IAgClassicalSizeShapeSemimajorAxis;
                semiJ2.SemiMajorAxis = semimajorAxisSat2;
                semiJ2.Eccentricity  = eccentricitySat2;

                classicalJ2.Orientation.Inclination  = inclinationSat2;
                classicalJ2.Orientation.ArgOfPerigee = argOfPerigeeSat2;
                classicalJ2.Orientation.AscNodeType  = AgEOrientationAscNode.eAscNodeRAAN;
                IAgOrientationAscNodeRAAN raan = classicalJ2.Orientation.AscNode as IAgOrientationAscNodeRAAN;
                raan.Value = raanSat2;

                classicalJ2.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
                IAgClassicalLocationTrueAnomaly trueAnomaly = classicalJ2.Location as IAgClassicalLocationTrueAnomaly;
                trueAnomaly.Value = trueAnomSat2;

                propSat2.InitialState.Representation.Assign(classicalJ2);
                propSat2.Propagate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #6
0
        // check if apogee is above the Earth
        private static bool IsApogeeAboveGround(IAgVePropagatorJ2Perturbation prop)
        {
            IAgOrbitStateClassical testOrbit = prop.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;

            testOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis testSizeShape = testOrbit.SizeShape as IAgClassicalSizeShapeSemimajorAxis;

            // apogee radius = a(1+e)
            double rApo = testSizeShape.SemiMajorAxis * (1 + testSizeShape.Eccentricity);


            if (rApo > 6380.0)
            {
                return(true);
            }

            return(false);
        }
예제 #7
0
        public static bool UpdateClassicalOrbit(IAgSatellite sat, double a, double e, double i, double aop, double raan, double ta, ref string error)
        {
            IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;
            // need to set everything individually because true vs mean anomaly
            IAgOrbitStateClassical keplerian = prop.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;

            keplerian.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis sizeShape = keplerian.SizeShape as IAgClassicalSizeShapeSemimajorAxis;

            sizeShape.SemiMajorAxis = a;
            sizeShape.Eccentricity  = e;

            keplerian.Orientation.Inclination  = i;
            keplerian.Orientation.ArgOfPerigee = aop;
            (keplerian.Orientation.AscNode as IAgOrientationAscNodeRAAN).Value = raan;

            keplerian.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
            (keplerian.Location as IAgClassicalLocationTrueAnomaly).Value = ta;

            prop.InitialState.Representation.Assign(keplerian);

            return(Is_Error_Propagator(prop, ref error));
        }
예제 #8
0
        /* This code takes a set of Cartesian coordinates in a fixed frame and converts them into Keplerian orbital elements in an inertial frame
         * without using a satellite object (using conversion utility within STK Engine). The Keplerian elements you would like to return can be specified
         * by changing the enum values near the top of the Main function.
         */
        static void Main(string[] args)
        {
            AgSTKXApplication app = new AgSTKXApplication();

            app.NoGraphics = true;
            AgStkObjectRoot root = new AgStkObjectRoot();

            // Here are some preliminary variables for the classical coordinate elements you would like to obtain
            SizeShapeTypes SizeShapeType = SizeShapeTypes.Altitude;
            AscNodeTypes   AscNodeType   = AscNodeTypes.RAAN;
            LocationTypes  LocationType  = LocationTypes.ArgumentOfLatitude;

            // Here we create a new AgOrbitState object
            IAgConversionUtility ConversionUtility = root.ConversionUtility;
            IAgOrbitState        cartesianOrbit    = ConversionUtility.NewOrbitStateOnEarth();

            // Here is how you display and change the epoch
            Console.WriteLine("Epoch:");
            cartesianOrbit.Epoch = "1 Jun 2003 17:00:00.000";
            Console.WriteLine(cartesianOrbit.Epoch);

            // Here we assign whatever Cartesian coordinates we would like to in a fixed frame
            cartesianOrbit.AssignCartesian(AgECoordinateSystem.eCoordinateSystemFixed, 5598.42, -14988.6, 4.80738, 3.408, 1.27376, 2.60903);

            // Now we convert the orbit to a classical orbit state
            IAgOrbitStateClassical classicalOrbit = cartesianOrbit.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical;

            Console.WriteLine(classicalOrbit.CoordinateSystemType);

            // Prints out the first two classical orbit elements
            switch (SizeShapeType)
            {
            case SizeShapeTypes.Altitude:
                classicalOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeAltitude;
                IAgClassicalSizeShapeAltitude sizeShapeAltitude = classicalOrbit.SizeShape as IAgClassicalSizeShapeAltitude;
                Console.WriteLine("Apogee Altitude:");
                Console.WriteLine(sizeShapeAltitude.ApogeeAltitude);
                Console.WriteLine("Perigee Altitude:");
                Console.WriteLine(sizeShapeAltitude.PerigeeAltitude);
                break;

            case SizeShapeTypes.MeanMotion:
                classicalOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeMeanMotion;
                IAgClassicalSizeShapeMeanMotion sizeShapeMeanMotion = classicalOrbit.SizeShape as IAgClassicalSizeShapeMeanMotion;
                Console.WriteLine("Mean Motion:");
                Console.WriteLine(sizeShapeMeanMotion.MeanMotion);
                Console.WriteLine("Eccentricity:");
                Console.WriteLine(sizeShapeMeanMotion.Eccentricity);
                break;

            case SizeShapeTypes.Period:
                classicalOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapePeriod;
                IAgClassicalSizeShapePeriod sizeShapePeriod = classicalOrbit.SizeShape as IAgClassicalSizeShapePeriod;
                Console.WriteLine("Period:");
                Console.WriteLine(sizeShapePeriod.Period);
                Console.WriteLine("Eccentricity:");
                Console.WriteLine(sizeShapePeriod.Eccentricity);
                break;

            case SizeShapeTypes.Radius:
                classicalOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeRadius;
                IAgClassicalSizeShapeRadius sizeShapeRadius = classicalOrbit.SizeShape as IAgClassicalSizeShapeRadius;
                Console.WriteLine("Apogee Radius:");
                Console.WriteLine(sizeShapeRadius.ApogeeRadius);
                Console.WriteLine("Perigee Radius:");
                Console.WriteLine(sizeShapeRadius.PerigeeRadius);
                break;

            case SizeShapeTypes.SemimajorAxis:
                classicalOrbit.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
                IAgClassicalSizeShapeSemimajorAxis sizeShapeSemimajorAxis = classicalOrbit.SizeShape as IAgClassicalSizeShapeSemimajorAxis;
                Console.WriteLine("Semimajor Axis:");
                Console.WriteLine(sizeShapeSemimajorAxis.SemiMajorAxis);
                Console.WriteLine("Eccentricity:");
                Console.WriteLine(sizeShapeSemimajorAxis.Eccentricity);
                break;
            }

            // Prints the inclination and argument of perigee
            IAgClassicalOrientation orientation = classicalOrbit.Orientation;

            Console.WriteLine("Inclination:");
            Console.WriteLine(orientation.Inclination);
            Console.WriteLine("Argument of Perigee:");
            Console.WriteLine(orientation.ArgOfPerigee);

            // This section prints the ascending node value
            Console.WriteLine("Ascending Node:");
            switch (AscNodeType)
            {
            case AscNodeTypes.RAAN:
                orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN;
                IAgOrientationAscNodeRAAN ascNodeRAAN = orientation.AscNode as IAgOrientationAscNodeRAAN;
                Console.WriteLine(ascNodeRAAN.Value);
                break;

            case AscNodeTypes.LAN:
                orientation.AscNodeType = AgEOrientationAscNode.eAscNodeLAN;
                IAgOrientationAscNodeLAN ascNodeLAN = orientation.AscNode as IAgOrientationAscNodeLAN;
                Console.WriteLine(ascNodeLAN.Value);
                break;
            }

            // This section prints the location of the satellite along the orbit in terms of whatever you would like
            Console.WriteLine("Location:");
            switch (LocationType)
            {
            case LocationTypes.ArgumentOfLatitude:
                classicalOrbit.LocationType = AgEClassicalLocation.eLocationArgumentOfLatitude;
                IAgClassicalLocationArgumentOfLatitude locationArgumentOfLatitude = classicalOrbit.Location as IAgClassicalLocationArgumentOfLatitude;
                Console.WriteLine(locationArgumentOfLatitude.Value);
                break;

            case LocationTypes.EccentricAnomaly:
                classicalOrbit.LocationType = AgEClassicalLocation.eLocationEccentricAnomaly;
                IAgClassicalLocationEccentricAnomaly locationSpecificEccentricAnomaly = classicalOrbit.Location as IAgClassicalLocationEccentricAnomaly;
                Console.WriteLine(locationSpecificEccentricAnomaly.Value);
                break;

            case LocationTypes.MeanAnomaly:
                classicalOrbit.LocationType = AgEClassicalLocation.eLocationMeanAnomaly;
                IAgClassicalLocationMeanAnomaly locationSpecificMeanAnomaly = classicalOrbit.Location as IAgClassicalLocationMeanAnomaly;
                Console.WriteLine(locationSpecificMeanAnomaly.Value);
                break;

            case LocationTypes.TimePastAN:
                classicalOrbit.LocationType = AgEClassicalLocation.eLocationTimePastAN;
                IAgClassicalLocationTimePastAN locationSpecificTimePastAN = classicalOrbit.Location as IAgClassicalLocationTimePastAN;
                Console.WriteLine(locationSpecificTimePastAN.Value);
                break;

            case LocationTypes.TimePastPerigee:
                classicalOrbit.LocationType = AgEClassicalLocation.eLocationTimePastPerigee;
                IAgClassicalLocationTimePastPerigee locationSpecificTimePastPerigee = classicalOrbit.Location as IAgClassicalLocationTimePastPerigee;
                Console.WriteLine(locationSpecificTimePastPerigee.Value);
                break;

            case LocationTypes.TrueAnomaly:
                classicalOrbit.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
                IAgClassicalLocationTrueAnomaly locationTrueAnomaly = classicalOrbit.Location as IAgClassicalLocationTrueAnomaly;
                Console.WriteLine(locationTrueAnomaly.Value);
                break;
            }

            Console.ReadLine();
        }