Beispiel #1
0
        public static void SetOrbitGraphics(string satName, bool showInertial, bool showFixed)
        {
            AgStkObjectRoot root;
            AgUiApplication app;

            // initialize variables
            app = System.Runtime.InteropServices.Marshal.GetActiveObject("STK11.Application") as AGI.Ui.Application.AgUiApplication;
            root = (AgStkObjectRoot)app.Personality2;

            // get the satellite object interfce
            string objectPath = " */Satellite/" + satName;
            IAgSatellite sat = root.GetObjectFromPath(objectPath) as IAgSatellite;

            // Configure the pass graphics
            IAgVeVOPass pass = sat.VO.Pass as IAgVeVOPass;
            pass.TrackData.PassData.Orbit.SetLeadDataType(AgELeadTrailData.eDataAll);
            pass.TrackData.PassData.Orbit.SetTrailDataType(AgELeadTrailData.eDataAll);

            // Change the orbit system
            IAgVeVOSystemsCollection orbitSystemsCollection = sat.VO.OrbitSystems as IAgVeVOSystemsCollection;

            if (showInertial)
            { orbitSystemsCollection.InertialByWindow.IsVisible = true; }
            else { orbitSystemsCollection.InertialByWindow.IsVisible = false; }

            if (showFixed)
            { orbitSystemsCollection.FixedByWindow.IsVisible = true; }
            else { orbitSystemsCollection.FixedByWindow.IsVisible = false; }
            
        }
        private void RemovePlanes()
        {
            List <ObjectData> data = SmartViewFunctions.GetObjectData();

            foreach (ObjectData item in data)
            {
                if (item.ClassName == "Satellite")
                {
                    IAgStkObject sat  = CommonData.StkRoot.GetObjectFromPath(item.SimplePath);
                    IAgSatellite sat1 = CommonData.StkRoot.GetObjectFromPath(item.SimplePath) as IAgSatellite;
                    try
                    {
                        sat.Vgt.Planes.Remove("ProximityPlane");
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        sat1.VO.Proximity.GeoBox.IsVisible = false;
                    }
                    catch (Exception)
                    {
                    }

                    try
                    {
                        sat1.VO.Proximity.Ellipsoid.IsVisible = false;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
        public void UpdateSelectSatComboBox()
        {
            // load existing satellites into pull-down and create new one if there are no satellites
            selectSatelliteComboBox.Items.Clear();
            foreach (IAgStkObject thisSat in m_root.CurrentScenario.Children.GetElements(AgESTKObjectType.eSatellite))
            {
                IAgSatellite temp = thisSat as IAgSatellite;
                if (temp.PropagatorType == AgEVePropagatorType.ePropagatorJ2Perturbation)
                {
                    selectSatelliteComboBox.Items.Add(thisSat.InstanceName);
                }
            }

            if (selectSatelliteComboBox.Items.Count == 0 && m_root.CurrentScenario.Children.GetElements(AgESTKObjectType.eSatellite).Count == 0)
            {
                STKHelper.CreateSat(m_satellite);
            }

            if (!IsMSatInList() && selectSatelliteComboBox.Items.Count != 0)
            {
                m_satellite = m_root.GetObjectFromPath("Satellite/" + selectSatelliteComboBox.Items[0].ToString()) as IAgSatellite;
            }

            if (selectSatelliteComboBox.Items.Count != 0)
            {
                int index = getSatComboIndex(SatelliteStkObject.InstanceName);
                if (index != -1)
                {
                    this.selectSatelliteComboBox.SelectedIndexChanged -= new System.EventHandler(this.selectSatelliteComboBox_SelectedIndexChanged);
                    selectSatelliteComboBox.SelectedIndex              = index;
                    selectSatelliteComboBox.Text = selectSatelliteComboBox.Items[index].ToString();
                    this.selectSatelliteComboBox.SelectedIndexChanged += new System.EventHandler(this.selectSatelliteComboBox_SelectedIndexChanged);
                }
            }
        }
        public string getPropagator(IAgStkObject object0)
        {
            IAgSatellite sat = object0 as IAgSatellite;

            return(sat.PropagatorType.ToString());
            //return ("0");
        }
        public static bool UpdateCartesianOrbit(IAgSatellite sat, double x, double y, double z, double dx, double dy, double dz, ref string error)
        {
            IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;

            prop.InitialState.Representation.AssignCartesian(AgECoordinateSystem.eCoordinateSystemICRF, x, y, z, dx, dy, dz);
            return(Is_Error_Propagator(prop, ref error));
        }
        public static bool UpdateDelaunayOrbit(IAgSatellite sat, double lD, double gD, double hD, double LD, double GD, double HD, ref string error)
        {
            IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;

            // there is no AssignDelaunay so we need to do this one at a time
            IAgOrbitStateDelaunay delaunay = prop.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateDelaunay) as IAgOrbitStateDelaunay;



            delaunay.MeanAnomaly    = lD;
            delaunay.ArgOfPeriapsis = gD;
            delaunay.RAAN           = hD;

            delaunay.LType = AgEDelaunayLType.eL;
            IAgDelaunayL delaunayL = delaunay.L as IAgDelaunayL;

            delaunayL.L = LD;

            delaunay.GType = AgEDelaunayGType.eG;
            IAgDelaunayG delaunayG = delaunay.G as IAgDelaunayG;

            delaunayG.G = GD;

            delaunay.HType = AgEDelaunayHType.eH;
            IAgDelaunayH delaunayH = delaunay.H as IAgDelaunayH;

            delaunayH.H = HD;

            prop.InitialState.Representation.Assign(delaunay);

            return(Is_Error_Propagator(prop, ref error));
        }
Beispiel #7
0
        private void RemoveProximityGeometry()
        {
            IAgExecCmdResult result;

            result = CommonData.StkRoot.ExecuteCommand("ShowNames * Class Satellite");
            if (result[0] != "None")
            {
                string[] satArray = result[0].Split(null);
                foreach (var item in satArray)
                {
                    string newItem = item.Split('/').Last();
                    if (newItem != "" && newItem != null)
                    {
                        try
                        {
                            IAgSatellite sat = CommonData.StkRoot.GetObjectFromPath("Satellite/" + newItem) as IAgSatellite;
                            sat.VO.Proximity.Ellipsoid.IsVisible  = false;
                            sat.VO.Proximity.ControlBox.IsVisible = false;
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
        }
Beispiel #8
0
        private void ProxGeometry_CheckedChanged(object sender, EventArgs e)
        {
            IAgSatellite sat    = CommonData.StkRoot.GetObjectFromPath("Satellite/" + CommonData.TargetName) as IAgSatellite;
            IAgStkObject satObj = sat as IAgStkObject;

            if (ProxGeometry.Checked)
            {
                if (CommonData.RunList[0].IsSpherical)
                {
                    sat.VO.Proximity.Ellipsoid.IsVisible = true;
                    IAgCrdnAxes axes = satObj.Vgt.Axes["RIC"];
                    sat.VO.Proximity.Ellipsoid.ReferenceFrame  = axes;
                    sat.VO.Proximity.Ellipsoid.XSemiAxisLength = CommonData.RunList[0].UserMinRange;
                    sat.VO.Proximity.Ellipsoid.YSemiAxisLength = CommonData.RunList[0].UserMinRange;
                    sat.VO.Proximity.Ellipsoid.ZSemiAxisLength = CommonData.RunList[0].UserMinRange;
                }
                else
                {
                    sat.VO.Proximity.ControlBox.IsVisible = true;
                    IAgCrdnAxes axes = satObj.Vgt.Axes["RIC"];
                    sat.VO.Proximity.ControlBox.ReferenceFrame = axes;
                    sat.VO.Proximity.ControlBox.XAxisLength    = CommonData.RunList[0].UserMinR;
                    sat.VO.Proximity.ControlBox.YAxisLength    = CommonData.RunList[0].UserMinI;
                    sat.VO.Proximity.ControlBox.ZAxisLength    = CommonData.RunList[0].UserMinC;
                }
            }
            else
            {
                sat.VO.Proximity.Ellipsoid.IsVisible  = false;
                sat.VO.Proximity.ControlBox.IsVisible = false;
            }
        }
Beispiel #9
0
        public Satellite_MassData(IAgStkObject object0) // Devise get,set methods
        {
            IAgSatellite        satellite0 = object0 as IAgSatellite;
            IAgVeMassProperties MassProp   = satellite0.MassProperties as IAgVeMassProperties;

            m_ultimateObject = MassProp;
            get_MassProps(MassProp);
        }
Beispiel #10
0
        public static bool UpdateMixedSphericalOrbit(IAgSatellite sat, double lonM, double latM, double altM, double fpaM, double azM, double velM, ref string error)
        {
            IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;

            prop.InitialState.Representation.AssignMixedSpherical(AgECoordinateSystem.eCoordinateSystemICRF, latM, lonM, altM, fpaM, azM, velM);

            return(Is_Error_Propagator(prop, ref error));
        }
Beispiel #11
0
        public static List <AgELeadTrailData> GetLeadTrailData(string objectPath, string className)
        {
            List <AgELeadTrailData> leadTrailData = new List <AgELeadTrailData>();

            if (className == "Satellite")
            {
                IAgSatellite mySat = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgSatellite;
                leadTrailData.Add(mySat.VO.Pass.TrackData.PassData.Orbit.LeadDataType);
                leadTrailData.Add(mySat.VO.Pass.TrackData.PassData.Orbit.TrailDataType);
                leadTrailData.Add(mySat.Graphics.PassData.GroundTrack.LeadDataType);
                leadTrailData.Add(mySat.Graphics.PassData.GroundTrack.TrailDataType);
            }
            else if (className == "Aircraft")
            {
                IAgAircraft myAircraft = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgAircraft;
                leadTrailData.Add(myAircraft.VO.Route.TrackData.LeadDataType);
                leadTrailData.Add(myAircraft.VO.Route.TrackData.TrailDataType);
                leadTrailData.Add(myAircraft.Graphics.PassData.Route.LeadDataType);
                leadTrailData.Add(myAircraft.Graphics.PassData.Route.TrailDataType);
            }
            else if (className == "Missile")
            {
                IAgMissile myMissile = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgMissile;
                leadTrailData.Add(myMissile.VO.Trajectory.TrackData.PassData.Trajectory.LeadDataType);
                leadTrailData.Add(myMissile.VO.Trajectory.TrackData.PassData.Trajectory.TrailDataType);
                leadTrailData.Add(myMissile.Graphics.PassData.Trajectory.LeadDataType);
                leadTrailData.Add(myMissile.Graphics.PassData.Trajectory.TrailDataType);
            }
            else if (className == "GroundVehicle")
            {
                IAgGroundVehicle myGv = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgGroundVehicle;
                leadTrailData.Add(myGv.VO.Route.TrackData.LeadDataType);
                leadTrailData.Add(myGv.VO.Route.TrackData.TrailDataType);
                leadTrailData.Add(myGv.Graphics.PassData.Route.LeadDataType);
                leadTrailData.Add(myGv.Graphics.PassData.Route.TrailDataType);
            }
            else if (className == "Ship")
            {
                IAgShip myShip = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgShip;
                leadTrailData.Add(myShip.VO.Route.TrackData.LeadDataType);
                leadTrailData.Add(myShip.VO.Route.TrackData.TrailDataType);
                leadTrailData.Add(myShip.Graphics.PassData.Route.LeadDataType);
                leadTrailData.Add(myShip.Graphics.PassData.Route.TrailDataType);
            }
            else if (className == "LaunchVehicle")
            {
                IAgLaunchVehicle myLv = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgLaunchVehicle;
                leadTrailData.Add(myLv.VO.Trajectory.TrackData.PassData.Trajectory.LeadDataType);
                leadTrailData.Add(myLv.VO.Trajectory.TrackData.PassData.Trajectory.TrailDataType);
                leadTrailData.Add(myLv.Graphics.PassData.GroundTrack.LeadDataType);
                leadTrailData.Add(myLv.Graphics.PassData.GroundTrack.TrailDataType);
            }
            else
            {
            }

            return(leadTrailData);
        }
Beispiel #12
0
        public static bool UpdateSphericalOrbit(IAgSatellite sat, double raS, double decS, double radS, double fpaS, double azS, double velS, ref string error)
        {
            IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;

            prop.InitialState.Representation.AssignSpherical(AgECoordinateSystem.eCoordinateSystemICRF, raS, decS, radS, fpaS, azS, velS);


            return(Is_Error_Propagator(prop, ref error));
        }
 private void PopulateDisplayReports(ComboBox box, ComboBox ddObject)
 {
     if (ddObject.SelectedIndex != -1)
     {
         string className = SmartViewFunctions.GetClassName(ddObject.Text);
         IAgVODataDisplayCollection ddCollection = null;
         if (className == "Satellite")
         {
             IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgSatellite;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Aircraft")
         {
             IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgAircraft;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Facility")
         {
             IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgFacility;
             ddCollection = myObject.VO.DataDisplays;
         }
         else if (className == "Missile")
         {
             IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgMissile;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "GroundVehicle")
         {
             IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgGroundVehicle;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "LaunchVehicle")
         {
             IAgLaunchVehicle myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgLaunchVehicle;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Place")
         {
             IAgPlace myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgPlace;
             ddCollection = myObject.VO.DataDisplays;
         }
         else if (className == "Target")
         {
             IAgTarget myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + ddObject.Text) as IAgTarget;
             ddCollection = myObject.VO.DataDisplays;
         }
         box.Items.Clear();
         Array reportNames = ddCollection.AvailableData;
         foreach (var name in reportNames)
         {
             box.Items.Add(name);
         }
         box.SelectedIndex = 0;
     }
 }
Beispiel #14
0
 private void groundtrack_set(IAgSatellite passedsat, AgELeadTrailData taildata)
 {
     passedsat.Graphics.PassData.GroundTrack.SetLeadDataType(taildata);
     //disable trailing ground track
     passedsat.Graphics.PassData.GroundTrack.SetTrailDataType(taildata);
     //VO is the 3D window???
     passedsat.VO.Pass.TrackData.PassData.GroundTrack.SetLeadDataType(taildata);
     passedsat.VO.Pass.TrackData.PassData.GroundTrack.SetTrailDataType(taildata);
     passedsat.VO.Pass.TrackData.PassData.Orbit.SetLeadDataType(taildata);
     passedsat.VO.Pass.TrackData.PassData.Orbit.SetTrailDataType(taildata);
 }
Beispiel #15
0
        public static void SetLeadTrailData(ObjectData stkObject)
        {
            List <string> leadTrailData = new List <string>();

            if (stkObject.ClassName == "Satellite")
            {
                IAgSatellite mySat = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgSatellite;
                mySat.VO.Pass.TrackData.PassData.Orbit.SetLeadDataType(stkObject.LeadSetting3D);
                mySat.VO.Pass.TrackData.PassData.Orbit.SetTrailDataType(stkObject.TrailSetting3D);
                mySat.Graphics.PassData.GroundTrack.SetLeadDataType(stkObject.LeadSetting2D);
                mySat.Graphics.PassData.GroundTrack.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "Aircraft")
            {
                IAgAircraft myAircraft = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgAircraft;
                myAircraft.VO.Route.TrackData.SetLeadDataType(stkObject.LeadSetting3D);
                myAircraft.VO.Route.TrackData.SetTrailDataType(stkObject.TrailSetting3D);
                myAircraft.Graphics.PassData.Route.SetLeadDataType(stkObject.LeadSetting2D);
                myAircraft.Graphics.PassData.Route.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "Missile")
            {
                IAgMissile myMissile = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgMissile;
                myMissile.VO.Trajectory.TrackData.PassData.Trajectory.SetLeadDataType(stkObject.LeadSetting3D);
                myMissile.VO.Trajectory.TrackData.PassData.Trajectory.SetTrailDataType(stkObject.TrailSetting3D);
                myMissile.Graphics.PassData.Trajectory.SetLeadDataType(stkObject.LeadSetting2D);
                myMissile.Graphics.PassData.Trajectory.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "GroundVehicle")
            {
                IAgGroundVehicle myGv = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgGroundVehicle;
                myGv.VO.Route.TrackData.SetLeadDataType(stkObject.LeadSetting3D);
                myGv.VO.Route.TrackData.SetTrailDataType(stkObject.TrailSetting3D);
                myGv.Graphics.PassData.Route.SetLeadDataType(stkObject.LeadSetting2D);
                myGv.Graphics.PassData.Route.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "Ship")
            {
                IAgShip myShip = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgShip;
                myShip.VO.Route.TrackData.SetLeadDataType(stkObject.LeadSetting3D);
                myShip.VO.Route.TrackData.SetTrailDataType(stkObject.TrailSetting3D);
                myShip.Graphics.PassData.Route.SetLeadDataType(stkObject.LeadSetting2D);
                myShip.Graphics.PassData.Route.SetTrailDataType(stkObject.TrailSetting2D);
            }
            else if (stkObject.ClassName == "LaunchVehicle")
            {
                IAgLaunchVehicle myLv = CommonData.StkRoot.GetObjectFromPath(stkObject.SimplePath) as IAgLaunchVehicle;
                myLv.VO.Trajectory.TrackData.PassData.Trajectory.SetLeadDataType(stkObject.LeadSetting3D);
                myLv.VO.Trajectory.TrackData.PassData.Trajectory.SetTrailDataType(stkObject.TrailSetting3D);
                myLv.Graphics.PassData.GroundTrack.SetLeadDataType(stkObject.LeadSetting2D);
                myLv.Graphics.PassData.GroundTrack.SetTrailDataType(stkObject.TrailSetting2D);
            }
        }
Beispiel #16
0
        private void groundtrack_set(IAgSatellite passedsat, bool enabled)
        {
            if (enabled == false)
            {
                passedsat.Graphics.PassData.GroundTrack.SetLeadDataType(AgELeadTrailData.eDataNone);
                //disable trailing ground track
                passedsat.Graphics.PassData.GroundTrack.SetTrailDataType(AgELeadTrailData.eDataNone);
                passedsat.VO.Pass.TrackData.PassData.GroundTrack.SetLeadDataType(AgELeadTrailData.eDataNone);
                passedsat.VO.Pass.TrackData.PassData.GroundTrack.SetTrailDataType(AgELeadTrailData.eDataNone);

                passedsat.VO.Pass.TrackData.PassData.Orbit.SetLeadDataType(AgELeadTrailData.eDataNone);
                passedsat.VO.Pass.TrackData.PassData.Orbit.SetTrailDataType(AgELeadTrailData.eDataNone);
            }
        }
Beispiel #17
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);
            }
        }
Beispiel #18
0
        private void LoadAttitude_Click(object sender, EventArgs e)
        {
            foreach (Section item in CommonData.sectionList)
            {
                item.linkedToAttitude = false;
                if (item.articName.Contains("Yaw") || item.articName.Contains("Pitch") || item.articName.Contains("Roll"))
                {
                    item.linkedToAttitude = true;
                }
            }
            string       objectPath = CommonData.objectClass + "/" + CommonData.simpleName;
            IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);
            string       fileName   = CommonData.directoryStr + "\\" + CommonData.simpleName + ".a";

            if (AttitudeCoordFrame.SelectedIndex == 0)
            {
                ArticFunctions.WriteVVLHAttitudeFile(fileName);
            }
            else if (AttitudeCoordFrame.SelectedIndex == 1)
            {
                ArticFunctions.WriteICRFAttitudeFile(fileName);
            }

            if (CommonData.objectClass == "Aircraft")
            {
                try
                {
                    AgAircraft aircraft = obj as AgAircraft;
                    IAgVeRouteAttitudeStandard attitude = aircraft.Attitude as IAgVeRouteAttitudeStandard;
                    attitude.External.Load(fileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not load attitude file");
                }
            }
            else if (CommonData.objectClass == "Satellite")
            {
                try
                {
                    IAgSatellite sat = obj as IAgSatellite;
                    IAgVeOrbitAttitudeStandard attitude = sat.Attitude as IAgVeOrbitAttitudeStandard;
                    attitude.External.Load(fileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not load attitude file");
                }
            }
        }
Beispiel #19
0
        public void set_InitStateJx(object InitStateObj, string name, double value)
        {
            if (name == "SemiMajorAxis")
            {
                SemiMajorAxis = value;
            }
            else if (name == "Eccentricity")
            {
                Eccentricity = value;
            }
            else if (name == "Inclination")
            {
                Inclination = value;
            }
            else if (name == "ArgOfPerigee")
            {
                ArgOfPerigee = value;
            }
            else if (name == "RAAN")
            {
                RAAN = value;
            }
            else if (name == "TrueAnomaly")
            {
                TrueAnomaly = value;
            }

            IAgSatellite sat = InitStateObj as IAgSatellite;

            if (sat.PropagatorType == AgEVePropagatorType.ePropagatorJ2Perturbation)
            {
                IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;
                prop.InitialState.Representation.AssignClassical(AgECoordinateSystem.eCoordinateSystemICRF, SemiMajorAxis, Eccentricity, Inclination, ArgOfPerigee, RAAN, TrueAnomaly);
                prop.Propagate();
            }
            if (sat.PropagatorType == AgEVePropagatorType.ePropagatorJ4Perturbation)
            {
                IAgVePropagatorJ4Perturbation prop = sat.Propagator as IAgVePropagatorJ4Perturbation;
                prop.InitialState.Representation.AssignClassical(AgECoordinateSystem.eCoordinateSystemICRF, SemiMajorAxis, Eccentricity, Inclination, ArgOfPerigee, RAAN, TrueAnomaly);
                prop.Propagate();
            }
            if (sat.PropagatorType == AgEVePropagatorType.ePropagatorTwoBody)
            {
                IAgVePropagatorTwoBody prop = sat.Propagator as IAgVePropagatorTwoBody;
                prop.InitialState.Representation.AssignClassical(AgECoordinateSystem.eCoordinateSystemICRF, SemiMajorAxis, Eccentricity, Inclination, ArgOfPerigee, RAAN, TrueAnomaly);
                prop.Propagate();
            }
        }
 private void TTDisplayObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (TTDisplayObject.SelectedIndex != -1)
     {
         TTDisplayReport.Items.Clear();
         if (TTDisplayObject.SelectedIndex == 0)
         {
             TTDisplayLocation.Enabled = true;
             TTDisplayReport.Items.Add("LLA Position");
             TTDisplayReport.Items.Add("Classical Orbital Elements");
             TTDisplayReport.Items.Add("Inertial Position Velocity");
             TTDisplayReport.Items.Add("Fixed Position Velocity");
         }
         else if (TTDisplayObject.SelectedIndex == 1)
         {
             TTDisplayLocation.Enabled = false;
             TTDisplayReport.Items.Add("RIC");
             TTDisplayReport.Items.Add("LLA Position");
             TTDisplayReport.Items.Add("Classical Orbital Elements");
             TTDisplayReport.Items.Add("Inertial Position Velocity");
             TTDisplayReport.Items.Add("Fixed Position Velocity");
         }
         else
         {
             TTDisplayLocation.Enabled = true;
             string className = SmartViewFunctions.GetClassName(TTDisplayObject.Text);
             IAgVODataDisplayCollection ddCollection = null;
             if (className == "Satellite")
             {
                 IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + TTDisplayObject.Text) as IAgSatellite;
                 ddCollection = myObject.VO.DataDisplay;
             }
             Array reportNames = ddCollection.AvailableData;
             foreach (var name in reportNames)
             {
                 TTDisplayReport.Items.Add(name);
                 if (name.ToString() == CommonData.SavedViewList[CommonData.SelectedIndex].TtDataDisplayReportName)
                 {
                     TTDisplayReport.SelectedIndex = TTDisplayReport.Items.Count - 1;
                 }
             }
         }
         if (TTDisplayReport.SelectedIndex == -1)
         {
             TTDisplayReport.SelectedIndex = 0;
         }
     }
 }
        public void ChangeNameSatComboBox(string oldName, string newName)
        {
            for (int i = 0; i < selectSatelliteComboBox.Items.Count; ++i)
            {
                if (selectSatelliteComboBox.Items[i].ToString() == oldName)
                {
                    selectSatelliteComboBox.Items[i] = newName;


                    if (SatelliteStkObject.InstanceName == oldName)
                    {
                        m_satellite = m_root.GetObjectFromPath("Satellite/" + newName) as IAgSatellite;
                    }
                }
            }
        }
Beispiel #22
0
 private void DisplayObject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DisplayObject.SelectedIndex != -1)
     {
         string className = SmartViewFunctions.GetClassName(DisplayObject.Text);
         IAgVODataDisplayCollection ddCollection = null;
         if (className == "Satellite")
         {
             IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgSatellite;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Aircraft")
         {
             IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgAircraft;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "Facility")
         {
             IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgFacility;
             ddCollection = myObject.VO.DataDisplays;
         }
         else if (className == "Missile")
         {
             IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgMissile;
             ddCollection = myObject.VO.DataDisplay;
         }
         else if (className == "GroundVehicle")
         {
             IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(className + "/" + DisplayObject.Text) as IAgGroundVehicle;
             ddCollection = myObject.VO.DataDisplay;
         }
         DisplayReport.Items.Clear();
         Array reportNames = ddCollection.AvailableData;
         foreach (var name in reportNames)
         {
             DisplayReport.Items.Add(name);
             if (name.ToString() == CommonData.SavedViewList[CommonData.SelectedIndex].DataDisplayReportName)
             {
                 DisplayReport.SelectedIndex = DisplayReport.Items.Count - 1;
             }
         }
         if (DisplayReport.SelectedIndex == -1)
         {
             DisplayReport.SelectedIndex = 0;
         }
     }
 }
Beispiel #23
0
        public static void CreateSat(IAgSatellite m_satellite)
        {
            if (StkRoot.CurrentScenario.Children.Contains(AgESTKObjectType.eSatellite, "OrbitTunerSat"))
            {
                return;
            }
            m_satellite = StkRoot.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "OrbitTunerSat") as IAgSatellite;

            // set prop. to J2 pertubation
            m_satellite.SetPropagatorType(AgEVePropagatorType.ePropagatorJ2Perturbation);

            STKHelper.SetMaxViewing(m_satellite);
            // get the j2 perturbation propagator
            IAgVePropagatorJ2Perturbation prop = m_satellite.Propagator as IAgVePropagatorJ2Perturbation;

            prop.Propagate();
        }
Beispiel #24
0
        public static string GetOrbitSystemData(string objectPath)
        {
            //Satellites only
            string                   systemName   = null;
            IAgSatellite             sat          = CommonData.StkRoot.GetObjectFromPath(objectPath) as IAgSatellite;
            IAgVeVOSystemsCollection orbitSystems = sat.VO.OrbitSystems;
            int numberSys = orbitSystems.Count;

            for (int i = 0; i < numberSys; i++)
            {
                if (orbitSystems[i].IsVisible)
                {
                    systemName = orbitSystems[i].Name;
                }
            }
            return(systemName);
        }
Beispiel #25
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);
            }
        }
Beispiel #26
0
        public static void SetOrbitSystem(ObjectData data)
        {
            IAgSatellite             sat          = CommonData.StkRoot.GetObjectFromPath(data.SimplePath) as IAgSatellite;
            IAgVeVOSystemsCollection orbitSystems = sat.VO.OrbitSystems;
            int numberSys = orbitSystems.Count;

            for (int i = 0; i < numberSys; i++)
            {
                if (orbitSystems[i].Name == data.CoordSys)
                {
                    orbitSystems[i].IsVisible = true;
                }
                else
                {
                    orbitSystems[i].IsVisible = false;
                }
            }
        }
Beispiel #27
0
        /// <summary>
        /// 获取卫星的Astrogator
        /// </summary>
        /// <param name="step"></param>
        public static IAgVADriverMCS GetSatelliteMCSDriver(IAgStkObject obj)
        {
            IAgSatellite satellite = obj as IAgSatellite;

            if (satellite == null)
            {
                throw new Exception("此物体不是卫星类型:" + obj.InstanceName);
            }

            IAgVADriverMCS driver = satellite.Propagator as IAgVADriverMCS;

            if (driver == null)
            {
                throw new Exception("此卫星的积分器不是Astrogator!卫星名:" + obj.InstanceName);
            }

            return(driver);
        }
Beispiel #28
0
        public static void SetColorSingle(string satName, Color color)
        {
            AgStkObjectRoot root;
            AgUiApplication app;

            // initialize variables
            app = System.Runtime.InteropServices.Marshal.GetActiveObject("STK11.Application") as AGI.Ui.Application.AgUiApplication;
            root = (AgStkObjectRoot)app.Personality2;

            // define the sat object
            IAgSatellite sat = (IAgSatellite)root.CurrentScenario.Children[satName];

            // set color               
            sat.Graphics.SetAttributesType(AgEVeGfxAttributes.eAttributesBasic);
            IAgVeGfxAttributesBasic basicAttributes = (IAgVeGfxAttributesBasic)sat.Graphics.Attributes;
            basicAttributes.Line.Width = AgELineWidth.e2;
            basicAttributes.Color = color;
        }
Beispiel #29
0
        public static IAgVORefCrdnCollection GetRefCrdns(IAgStkObject stkObject)
        {
            switch (stkObject.ClassType)
            {
            case AgESTKObjectType.eAircraft:
                IAgAircraft _aircraft = stkObject as IAgAircraft;
                return(_aircraft.VO.Vector.RefCrdns);

            case AgESTKObjectType.eFacility:
                IAgFacility fac = stkObject as IAgFacility;
                return(fac.VO.Vector.RefCrdns);

            case AgESTKObjectType.eGroundVehicle:
                IAgGroundVehicle gv = stkObject as IAgGroundVehicle;
                return(gv.VO.Vector.RefCrdns);

            case AgESTKObjectType.eMissile:
                IAgMissile miss = stkObject as IAgMissile;
                return(miss.VO.Vector.RefCrdns);

            case AgESTKObjectType.ePlace:
                IAgPlace place = stkObject as IAgPlace;
                return(place.VO.Vector.RefCrdns);

            case AgESTKObjectType.eSatellite:
                IAgSatellite sat = stkObject as IAgSatellite;
                return(sat.VO.Vector.RefCrdns);

            case AgESTKObjectType.eSensor:
                IAgSensor sensor = stkObject as IAgSensor;
                return(sensor.VO.Vector.RefCrdns);

            case AgESTKObjectType.eShip:
                IAgShip ship = stkObject as IAgShip;
                return(ship.VO.Vector.RefCrdns);

            case AgESTKObjectType.eTarget:
                IAgTarget target = stkObject as IAgTarget;
                return(target.VO.Vector.RefCrdns);

            default:
                return(null);
            }
        }
Beispiel #30
0
        public static void CreateSatellite(string satName, double orbitPeriod, double eccentricity, double inclination, double rightAscension, double meanAnomaly, double argOfPerigee)
        {
            AgStkObjectRoot root;
            AgUiApplication app;

            app = System.Runtime.InteropServices.Marshal.GetActiveObject("STK11.Application") as AGI.Ui.Application.AgUiApplication;
            root = (AgStkObjectRoot)app.Personality2;
    
            // new satellite
            IAgSatellite sat = root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, satName) as IAgSatellite;

            // set the propagator to J2
            sat.SetPropagatorType(AgEVePropagatorType.ePropagatorJ2Perturbation);

            // get the propagator
            IAgVePropagatorJ2Perturbation j2 = (IAgVePropagatorJ2Perturbation) sat.Propagator;


            //Define the satellite's orbit using classical (Keplerian) orbital elements
            IAgOrbitStateClassical classical = (IAgOrbitStateClassical) j2.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            //Use period and eccentricity to define the size and shape of the orbit
            classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapePeriod;
            IAgClassicalSizeShapePeriod period = (IAgClassicalSizeShapePeriod)classical.SizeShape;
            period.Eccentricity = eccentricity;
            period.Period = orbitPeriod;

            //Use argument of perigee, inclination and RAAN to define the orientation of the orbit
            classical.Orientation.ArgOfPerigee = argOfPerigee;
            classical.Orientation.Inclination = inclination;
            classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN;
            IAgOrientationAscNodeRAAN raan = (IAgOrientationAscNodeRAAN)classical.Orientation.AscNode;
            raan.Value = rightAscension;

            //Use mean anomaly to specify the position of the satellite in orbit
            classical.LocationType = AgEClassicalLocation.eLocationMeanAnomaly;
            IAgClassicalLocationMeanAnomaly ma = (IAgClassicalLocationMeanAnomaly)classical.Location;
            ma.Value = meanAnomaly;

            //Assign the orbital elements to the satellite's propagator and propagate the orbit	
            j2.InitialState.Representation.Assign(classical);
            j2.Propagate();
        }
Beispiel #31
0
        /// <summary>
        /// 新建一个SARSYS在当前sc文件中
        /// 需要建立最基础的系统
        /// 参数大多数有默认值
        /// </summary>
        public void newsarsys()
        {
            #region 写入信息
            AGI.STKX.IAgExecCmdResult resultmsg = rootapp.ExecuteCommand("SetDescription * long SARSYS");
            #endregion

            #region 设定单位、仿真时间
            // Reset the units to the STK defaults
            dimensions = root.UnitPreferences;
            dimensions.ResetUnits();

            // Set the date unit, acquire an interface to the scenario and use
            // it to set the time period and epoch
            dimensions.SetCurrentUnit("DateFormat", "UTCG");

            scene = (IAgScenario)root.CurrentScenario;
            scene.StartTime = simstarttime;
            scene.StopTime = simstoptime;
            scene.Epoch = simstarttime;

            // Set new preference for Temperature
            dimensions.SetCurrentUnit("Temperature", "degC");
            #endregion

            #region 放置发射站
            //SATELLITE #1: TDRS
            //Assign a two-body propagator to propagate it
            tdrs = (IAgSatellite)root.CurrentScenario.Children.New(AgESTKObjectType.
                eSatellite, "TDRS");
            tdrs.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody);
            twobody = (IAgVePropagatorTwoBody)tdrs.Propagator;

            //Define the TDRS satellite's orbit using
            //classical (Keplerian) orbital elements
            classical = (IAgOrbitStateClassical)twobody.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            //Set J2000 as the coordinate system
            //and set the time period and time step
            classical.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000;
            twobody.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            twobody.Step = 60;

            //定义半主轴长度,离心率
            //Use period and eccentricity to define the size
            //and shape of the orbit
            classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis semi = (IAgClassicalSizeShapeSemimajorAxis)classical.SizeShape;
            semi.SemiMajorAxis = 35860;
            semi.Eccentricity = 0.0;

            //定义轨道倾角,升交点赤经,近地点幅角
            //Use argument of perigee, inclination
            //and longitude of ascending node to
            //define the orientation of the orbit
            classical.Orientation.ArgOfPerigee = 15.0;
            classical.Orientation.Inclination = 40.0;
            classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeLAN;
            IAgOrientationAscNodeLAN lan = (IAgOrientationAscNodeLAN)classical.Orientation.AscNode;
            lan.Value = 259.999982;

            //定义真近点角(?)来定义初始位置
            //Use true anomaly to specify the position of
            //the satellite in orbit
            classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
            IAgClassicalLocationTrueAnomaly trueAnomaly = (IAgClassicalLocationTrueAnomaly)classical.Location;
            trueAnomaly.Value = 178.845262;

            //Assign the orbital elements to the TDRS
            //satellite's propagator and propagate the orbit
            twobody.InitialState.Representation.Assign(classical);
            twobody.Propagate();

            root.Rewind();

            #endregion

            #region 放置接收站
            cruise = (IAgAircraft)root.CurrentScenario.Children.New(AgESTKObjectType.eAircraft, "Cruise");
            cruise.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc);
            greatArc = (IAgVePropagatorGreatArc)cruise.Route;
            greatArc.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            greatArc.Method = AgEVeWayPtCompMethod.eDetermineTimeAccFromVel;

            ((IAgVOModelFile)cruise.VO.Model.ModelData).Filename = @"\STKData\VO\Models\Air\e-3a_sentry_awacs.mdl";
            cruise.VO.Offsets.Rotational.Enable = true;
            cruise.VO.Offsets.Rotational.X = 180;

            //Use the convenience method defined above
            //to add waypoints specifying the ship's route
            AddWaypoint(greatArc.Waypoints, -42.1, -121.5, 3.0, .15, 0.0);
            AddWaypoint(greatArc.Waypoints, 62.0, -56.6, 3.0, .15, 0.0);

            cruise.SetAttitudeType(AgEVeAttitude.eAttitudeStandard);
            IAgVeRouteAttitudeStandard attitude = (IAgVeRouteAttitudeStandard)cruise.Attitude;
            attitude.Basic.SetProfileType(AgEVeProfile.
                eProfileECFVelocityAlignmentWithRadialConstraint);
            cruise.Graphics.WaypointMarker.IsWaypointMarkersVisible = true;
            cruise.Graphics.WaypointMarker.IsTurnMarkersVisible = true;
            greatArc.Propagate();
            root.Rewind();

            #endregion

            #region 放置发射站雷达
            horizon = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children.
                    New(AgESTKObjectType.eSensor, "Horizon");
            horizon.SetPatternType(AgESnPattern.eSnSimpleConic);
            IAgSnSimpleConicPattern simpleConic = (IAgSnSimpleConicPattern)horizon.Pattern;
            simpleConic.ConeAngle = 0.1;

            //Select a Fixed pointing type and the Az-El
            //orientation type, and set the elevation angle to
            //90 deg, so that the sensor points straight down
            //with reference to the satellite
            horizon.SetPointingType(AgESnPointing.eSnPtFixed);
            IAgSnPtFixed fixedPt = (IAgSnPtFixed)horizon.Pointing;
            IAgOrientationAzEl azEl = (IAgOrientationAzEl)fixedPt.Orientation.ConvertTo(AgEOrientationType.eAzEl);
            azEl.Elevation = 89.2;
            azEl.AboutBoresight = AgEAzElAboutBoresight.eAzElAboutBoresightRotate;
            fixedPt.Orientation.Assign(azEl);

            root.Rewind();

            #endregion
        }
Beispiel #32
0
        /// <summary>
        /// 新建一个SARSYS在当前sc文件中
        /// 需要建立最基础的系统
        /// 参数大多数有默认值
        /// </summary>
        public void newsarsys()
        {
            #region 写入信息
            AGI.STKX.IAgExecCmdResult resultmsg = rootapp.ExecuteCommand("SetDescription * long SARSYS");
            #endregion


            #region 设定单位、仿真时间
            // Reset the units to the STK defaults
            dimensions = root.UnitPreferences;
            dimensions.ResetUnits();

            // Set the date unit, acquire an interface to the scenario and use
            // it to set the time period and epoch
            dimensions.SetCurrentUnit("DateFormat", "UTCG");

            scene = (IAgScenario)root.CurrentScenario;
            scene.StartTime = simstarttime;
            scene.StopTime = simstoptime;
            scene.Epoch = simstarttime;

            //rootapp.ExecuteCommand("MapTracking * UTM");

            // Set new preference for Temperature
            dimensions.SetCurrentUnit("Temperature", "degC");
            #endregion

            #region 放置发射站
            //SATELLITE #1: TDRS
            //Assign a two-body propagator to propagate it
            tdrs = (IAgSatellite)root.CurrentScenario.Children.New(AgESTKObjectType.
                eSatellite, "TDRS");
            tdrs.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody);
            twobody = (IAgVePropagatorTwoBody)tdrs.Propagator;

            //Define the TDRS satellite's orbit using
            //classical (Keplerian) orbital elements
            classical = (IAgOrbitStateClassical)twobody.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            //Set J2000 as the coordinate system
            //and set the time period and time step
            classical.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000;
            twobody.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            twobody.Step = 60;

            //定义半主轴长度,离心率
            //Use period and eccentricity to define the size
            //and shape of the orbit
            classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis;
            IAgClassicalSizeShapeSemimajorAxis semi = (IAgClassicalSizeShapeSemimajorAxis)classical.SizeShape;
            semi.SemiMajorAxis = sasem;
            semi.Eccentricity = saecc;


            //定义轨道倾角,升交点赤经,近地点幅角
            //Use argument of perigee, inclination
            //and longitude of ascending node to
            //define the orientation of the orbit
            classical.Orientation.ArgOfPerigee = saaop;
            classical.Orientation.Inclination = sainc;
            classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeLAN;
            IAgOrientationAscNodeLAN lan = (IAgOrientationAscNodeLAN)classical.Orientation.AscNode;
            lan.Value = salan;

            //定义真近点角(?)来定义初始位置
            //Use true anomaly to specify the position of
            //the satellite in orbit
            classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly;
            IAgClassicalLocationTrueAnomaly trueAnomaly = (IAgClassicalLocationTrueAnomaly)classical.Location;
            trueAnomaly.Value = satra;


            //Assign the orbital elements to the TDRS
            //satellite's propagator and propagate the orbit	
            twobody.InitialState.Representation.Assign(classical);
            twobody.Propagate();

            root.Rewind();

            #endregion

            
            #region 放置接收站
            cruise = (IAgAircraft)root.CurrentScenario.Children.New(AgESTKObjectType.eAircraft, "Cruise");
            cruise.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc);
            greatArc = (IAgVePropagatorGreatArc)cruise.Route;
            greatArc.EphemerisInterval.SetStartAndStopTimes(simstarttime, simstoptime);
            greatArc.Method = AgEVeWayPtCompMethod.eDetermineTimeAccFromVel;

            ((IAgVOModelFile)cruise.VO.Model.ModelData).Filename = @"\STKData\VO\Models\Air\rq-4a_globalhawk.mdl";
            cruise.VO.Offsets.Rotational.Enable = true;
            cruise.VO.Offsets.Rotational.X = 180;

            //Use the convenience method defined above
            //to add waypoints specifying the ship's route
            for (int ii = 0; ii < plwaypoints.Length; ii += 5)
            {
                AddWaypoint(greatArc.Waypoints, plwaypoints[ii], plwaypoints[ii + 1], plwaypoints[ii + 2], plwaypoints[ii + 3], plwaypoints[ii + 4]);
            }
              
            
            cruise.SetAttitudeType(AgEVeAttitude.eAttitudeStandard);
            IAgVeRouteAttitudeStandard attitude = (IAgVeRouteAttitudeStandard)cruise.Attitude;
            attitude.Basic.SetProfileType(AgEVeProfile.
                eProfileECFVelocityAlignmentWithRadialConstraint);
            cruise.Graphics.WaypointMarker.IsWaypointMarkersVisible = true;
            cruise.Graphics.WaypointMarker.IsTurnMarkersVisible = true;
            greatArc.Propagate();
            root.Rewind();


            #endregion

            #region 放置发射站雷达
            radar_t = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children.New(AgESTKObjectType.eSensor, "radar_t");
            radar_t.SetPatternType(AgESnPattern.eSnSimpleConic);
            ((IAgSnSimpleConicPattern)radar_t.Pattern).ConeAngle = racoang;



            //Select a Fixed pointing type and the Az-El
            //orientation type, and set the elevation angle to
            //90 deg, so that the sensor points straight down
            //with reference to the satellite
            radar_t.SetPointingType(AgESnPointing.eSnPtFixed);
            IAgSnPtFixed fixedPt = (IAgSnPtFixed)radar_t.Pointing;
            IAgOrientationAzEl azEl = (IAgOrientationAzEl)fixedPt.Orientation.ConvertTo(AgEOrientationType.eAzEl);
            azEl.Elevation = raeleva;
            azEl.AboutBoresight = AgEAzElAboutBoresight.eAzElAboutBoresightRotate;
            fixedPt.Orientation.Assign(azEl);

            radar_t.Graphics.FillVisible = true;
            radar_t.VO.FillVisible = true;
            

            root.Rewind();


            #endregion


            #region 放置接收站雷达


            target = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children.New(AgESTKObjectType.eSensor, "target");

            target.SetLocationType(AgESnLocation.eSnLocationCrdnPoint);
            IAgLocationCrdnPoint vgtPoint = target.LocationData as IAgLocationCrdnPoint;
            //vgtPoint.PointPath = "TDRS/radar_t BoresightIntersection(Terrain)";
            vgtPoint.PointPath = "Satellite/TDRS/Sensor/radar_t BoresightIntersection(Terrain)";
            target.SetPatternType(AgESnPattern.eSnSimpleConic);
            ((IAgSnSimpleConicPattern)target.Pattern).ConeAngle = 0.00001;
           
            

            IAgSnPtTargeted targetedSensor1 = target.CommonTasks.SetPointingTargetedTracking(
   AgETrackModeType.eTrackModeTranspond, AgEBoresightType.eBoresightRotate, "*/Aircraft/Cruise");


            target.SetPointingType(AgESnPointing.eSnPtTargeted);
            IAgSnPtTargeted rpt1 = (IAgSnPtTargeted)target.Pointing;
            rpt1.Boresight = AgESnPtTrgtBsightType.eSnPtTrgtBsightTracking;
            root.Rewind();
            rootapp.ExecuteCommand("Graphics */Satellite/TDRS/Sensor/target Show Off");


            /////////////////////////
            radar_r = (IAgSensor)root.CurrentScenario.Children["Cruise"].Children.New(AgESTKObjectType.eSensor, "radar_r");
            radar_r.SetPatternType(AgESnPattern.eSnSimpleConic);
            ((IAgSnSimpleConicPattern)radar_r.Pattern).ConeAngle = 3;
        

            IAgSnPtTargeted targetedSensor = radar_r.CommonTasks.SetPointingTargetedTracking(
    AgETrackModeType.eTrackModeTranspond, AgEBoresightType.eBoresightRotate, "*/Satellite/TDRS/Sensor/target");   

            
            radar_r.SetPointingType(AgESnPointing.eSnPtTargeted);
            IAgSnPtTargeted rpt = (IAgSnPtTargeted)radar_r.Pointing;
            rpt.Boresight = AgESnPtTrgtBsightType.eSnPtTrgtBsightTracking;
            

            root.Rewind();
            #endregion
        }
Beispiel #33
0
        /// <summary>
        /// 读出当前sc文件中已经存在的SARSYS
        /// </summary>
        public void readsarsys()
        {

            AGI.STKX.IAgExecCmdResult resultmsg = rootapp.ExecuteCommand("GetDescription * long");


            dimensions = root.UnitPreferences;
            scene = (IAgScenario)root.CurrentScenario;
            tdrs = (IAgSatellite)root.CurrentScenario.Children["TDRS"];
            
            twobody = (IAgVePropagatorTwoBody)tdrs.Propagator;
            classical = (IAgOrbitStateClassical)twobody.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical);

            cruise = (IAgAircraft)root.CurrentScenario.Children["Cruise"];
            greatArc = (IAgVePropagatorGreatArc)cruise.Route;

            radar_t = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children["radar_t"];

            radar_r = (IAgSensor)root.CurrentScenario.Children["Cruise"].Children["radar_r"];

            target = (IAgSensor)root.CurrentScenario.Children["TDRS"].Children["target"];

            simstarttime = scene.StartTime;
            simstoptime = scene.StopTime;
            simstep = scene.Animation.AnimStepValue;
            IAgClassicalSizeShapeSemimajorAxis semi = (IAgClassicalSizeShapeSemimajorAxis)classical.SizeShape;
            sasem = semi.SemiMajorAxis;
            saecc = semi.Eccentricity;
            saaop = classical.Orientation.ArgOfPerigee;
            sainc = classical.Orientation.Inclination;
            salan = ((IAgOrientationAscNodeLAN)classical.Orientation.AscNode).Value;
            satra = ((IAgClassicalLocationTrueAnomaly)classical.Location).Value;
            racoang = ((IAgSnSimpleConicPattern)radar_t.Pattern).ConeAngle;

            IAgSnPtFixed fixedPt = (IAgSnPtFixed)radar_t.Pointing;
            IAgOrientationAzEl azEl = (IAgOrientationAzEl)fixedPt.Orientation.ConvertTo(AgEOrientationType.eAzEl);
            raeleva = azEl.Elevation;

            plwaypoints = new double[5 * greatArc.Waypoints.Count];
            for(int ii=0;ii<greatArc.Waypoints.Count;ii++)
            {
                plwaypoints[ii * 5] = greatArc.Waypoints[ii].Latitude;
                plwaypoints[ii * 5 + 1] = greatArc.Waypoints[ii].Longitude;
                plwaypoints[ii * 5 + 2] = greatArc.Waypoints[ii].Altitude;
                plwaypoints[ii * 5 + 3] = greatArc.Waypoints[ii].Speed;
                plwaypoints[ii * 5 + 4] = greatArc.Waypoints[ii].TurnRadius;
            }




        }