コード例 #1
0
 public static void HideRAAN(AgSatellite sat)
 {
     ShowVGT("Satellite/" + sat.InstanceName + " RAAN Angle", "Modify", "Off", false, "Red");
     ShowVGT("CentralBody/Earth Inertial.X Vector", "Modify", "Off", false, "Pink");
     ShowVGT("CentralBody/Earth Inertial.Z Vector", "Modify", "Off", false, "Pink");
     ShowVGT("Satellite/" + sat.InstanceName + " LineOfNodes Vector", "Modify", "Off", false, "Pink");
 }
コード例 #2
0
 public static void HideTA(AgSatellite sat)
 {
     ShowVGT("Satellite/" + sat.InstanceName + " TrueAnomaly Angle", "Modify", "Off", false, "Blue");
     ShowVGT("Satellite/" + sat.InstanceName + " Ecc Vector", "Modify", "Off", false, "Blue");
     ShowVGT("Satellite/" + sat.InstanceName + " Position Vector", "Modify", "Off", false, "Blue");
     ShowVGT("Satellite/" + sat.InstanceName + " AngMomentum Vector", "Modify", "Off", false, "Blue");
 }
コード例 #3
0
        public static void ShowInclination(AgSatellite sat)
        {
            if (!(sat.Vgt.Planes.Contains("Orbit")))
            {
                // create orbit plane

                string orbitPlaneCmd = "VectorTool * Satellite/" + sat.InstanceName + " Create Plane Orbit \"Normal\" \"Satellite/" + sat.InstanceName + " Orbit_Normal\" \"Satellite/" + sat.InstanceName + " Velocity\" \"Satellite/" + sat.InstanceName + " Center\" \"X\" \"Y\"";
                StkRoot.ExecuteCommand(orbitPlaneCmd);
                ShowVGT("Satellite/" + sat.InstanceName + " Orbit Plane", "Add", "On", true, "White");
            }
            else
            {
                ShowVGT("Satellite/" + sat.InstanceName + " Orbit Plane", "Modify", "On", true, "White");
            }

            TryShowVGT("CentralBody/Earth Equator Plane", "On", true, "White");

            if (!(sat.Vgt.Angles.Contains("Inclination")))
            {
                string createInclination = "VectorTool * Satellite/" + sat.InstanceName + " Create Angle Inclination \"Between Planes\" \"Satellite/" + sat.InstanceName + " Orbit\" \"CentralBody/Earth Equator\"";
                StkRoot.ExecuteCommand(createInclination);
                ShowVGT("Satellite/" + sat.InstanceName + " Inclination Angle", "Add", "On", false, "Green");
            }
            else
            {
                ShowVGT("Satellite/" + sat.InstanceName + " Inclination Angle", "Modify", "On", false, "Green");
            }
        }
コード例 #4
0
        private static void TurnOnTrueScale(AgSatellite satObj, string type)
        {
            string             name = "Satellite/" + satObj.InstanceName + " " + type;
            IAgVORefCrdnVector ecc  = GetVector(satObj, name) as IAgVORefCrdnVector;

            if (type.Contains("Periapsis") || type.Contains("Apoapsis"))
            {
                ecc.TrueScale = true;
            }
        }
コード例 #5
0
        public void SetSite(IAgUiPluginEmbeddedControlSite Site)
        {
            m_pEmbeddedControlSite = Site;
            m_uiPlugin             = m_pEmbeddedControlSite.Plugin as Setup;
            m_stkObjectsLibrary    = new StkObjectsLibrary();

            // Get object that user selected
            m_selectedObject = CommonData.StkRoot.GetObjectFromPath(m_uiPlugin.Site.Selection[0].Path) as AgSatellite;

            PopulateComboBox();
        }
コード例 #6
0
        private static void ShowVector(AgSatellite satObj, string type)
        {
            string       name = "Satellite/" + satObj.InstanceName + " " + type;
            IAgVORefCrdn ecc  = GetVector(satObj, name);

            ecc.Visible      = true;
            ecc.LabelVisible = true;
            IAgVORefCrdnVector eccVector = ecc as IAgVORefCrdnVector;

            eccVector.DrawAtCB = true;
            TurnOnTrueScale(satObj, type);
        }
コード例 #7
0
 private static IAgVORefCrdn GetVector(AgSatellite satObj, string name)
 {
     try
     {
         IAgVORefCrdn vector = satObj.VO.Vector.RefCrdns.GetCrdnByName(0, name);
         return(vector);
     }
     catch
     {
         satObj.VO.Vector.RefCrdns.Add(0, name);
         return(satObj.VO.Vector.RefCrdns.GetCrdnByName(0, name));
     }
 }
コード例 #8
0
        public static void ShowRAAN(AgSatellite sat)
        {
            if (!(sat.Vgt.Angles.Contains("RAAN")))
            {
                string parent = "Satellite/" + sat.InstanceName;
                CreateShowDihedralAngle(parent, "RAAN", "CentralBody/Earth Inertial.X", parent + " LineOfNodes", "CentralBody/Earth Inertial.Z", "Red");
            }

            else
            {
                ShowVGT("Satellite/" + sat.InstanceName + " RAAN Angle", "Modify", "On", false, "Red");
            }

            TryShowVGT("Satellite/" + sat.InstanceName + " LineOfNodes Vector", "On", false, "Pink");
            TryShowVGT("CentralBody/Earth Inertial.X Vector", "On", false, "Pink");
            TryShowVGT("CentralBody/Earth Inertial.Z Vector", "On", false, "Pink");
        }
コード例 #9
0
        public static void ShowAoP(AgSatellite sat)
        {
            TryShowVGT("Satellite/" + sat.InstanceName + " Ecc Vector", "On", false, "Red");
            TryShowVGT("Satellite/" + sat.InstanceName + " LineOfNodes Vector", "On", false, "Red");


            if (!(sat.Vgt.Angles.Contains("AoP")))
            {
                string cmd = "VectorTool * Satellite/" + sat.InstanceName + " Create Angle AoP \"Between Vectors\" \"Satellite/" + sat.InstanceName + " LineOfNodes\" \"Satellite/" + sat.InstanceName + " Ecc\"";
                StkRoot.ExecuteCommand(cmd);
                ShowVGT("Satellite/" + sat.InstanceName + " AoP Angle", "Add", "On", false, "Red");
            }

            else
            {
                ShowVGT("Satellite/" + sat.InstanceName + " AoP Angle", "Modify", "On", false, "Red");
            }
        }
コード例 #10
0
        private void SetAlignedConstrainedAttitude(AgSatellite satellite, IAgCrdnVector alignedVector, string alignedAxis, IAgCrdnVector constrainedVector, string constrainedAxis)
        {
            // Set attitude to Aligned & Constrained
            IAgVeOrbitAttitudeStandard attitude = satellite.Attitude as IAgVeOrbitAttitudeStandard;

            attitude.Basic.SetProfileType(AgEVeProfile.eProfileAlignedAndConstrained);

            double[] alignedBody     = GetCartesianArray(alignedAxis);
            double[] constrainedBody = GetCartesianArray(constrainedAxis);

            // Set vectors and body axis
            IAgVeProfileAlignedAndConstrained profile = attitude.Basic.Profile as IAgVeProfileAlignedAndConstrained;

            profile.AlignedVector.ReferenceVector = ((IAgCrdn)alignedVector).Path;
            profile.AlignedVector.Body.AssignXYZ(alignedBody[0], alignedBody[1], alignedBody[2]);

            profile.ConstrainedVector.ReferenceVector = ((IAgCrdn)constrainedVector).Path;
            profile.ConstrainedVector.Body.AssignXYZ(constrainedBody[0], constrainedBody[1], constrainedBody[2]);
        }
コード例 #11
0
        public static void ShowTA(AgSatellite sat)
        {
            if (!(sat.Vgt.Angles.Contains("TrueAnomaly")))
            {
                string parent = "Satellite/" + sat.InstanceName;
                CreateShowDihedralAngle(parent, "TrueAnomaly", parent + " Ecc", parent + " Position", parent + " AngMomentum", "White");
            }

            else
            {
                ShowVGT("Satellite/" + sat.InstanceName + " TrueAnomaly Angle", "Modify", "On", false, "White");
            }


            TryShowVGT("Satellite/" + sat.InstanceName + " Ecc Vector", "On", false, "Blue");
            TryShowVGT("Satellite/" + sat.InstanceName + " Position Vector", "On", false, "Blue");
            TryShowVGT("Satellite/" + sat.InstanceName + " AngMomentum Vector", "On", false, "Blue");
            TurnOnTrueScale(sat, "Position Vector");
        }
コード例 #12
0
        private void HideVectors(AgSatellite sat)
        {
            string coordType = "Classical";

            if (checkBox_orbElt1.Checked)
            {
                checkBox_orbElt1.Checked = false;
                STKHelper.HidePeriapsisApoapsis(sat);
            }

            if (checkBox_orbElt2.Checked)
            {
                checkBox_orbElt2.Checked = false;
                STKHelper.HideEcc(sat);
            }

            if (checkBox_orbElt3.Checked)
            {
                checkBox_orbElt3.Checked = false;
                STKHelper.HideInclination(sat);
                ;
            }

            if (checkBox_orbElt4.Checked)
            {
                checkBox_orbElt4.Checked = false;
                STKHelper.HideAoP(sat);
            }

            if (checkBox_orbElt5.Checked)
            {
                checkBox_orbElt5.Checked = false;
                STKHelper.HideRAAN(sat);
            }

            if (checkBox_orbElt6.Checked)
            {
                checkBox_orbElt6.Checked = false;
                STKHelper.HideTA(sat);
            }
        }
コード例 #13
0
        private void addSatelliteButton_Click(object sender, EventArgs e)
        {
            //Create vehicle (satellite)
            string      satName   = "TLE" + tleNumberTb.Text;
            AgSatellite satellite = null;

            if (CommonData.StkRoot.CurrentScenario.Children.Contains(AgESTKObjectType.eSatellite, satName))
            {
                satellite = CommonData.StkRoot.GetObjectFromPath("Satellite/" + satName) as AgSatellite;
            }
            else
            {
                satellite = CommonData.StkRoot.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, satName) as AgSatellite;
                //Using SPG4 propagator
                satellite.SetPropagatorType(AgEVePropagatorType.ePropagatorSGP4);
                IAgVePropagatorSGP4 propagator = satellite.Propagator as IAgVePropagatorSGP4;
                propagator.CommonTasks.AddSegsFromOnlineSource(tleNumberTb.Text);
                propagator.Propagate();
            }



            //using Two Body propagator
            //satellite.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody);
            //IAgVePropagatorTwoBody twoBodyPropagator = satellite.Propagator as IAgVePropagatorTwoBody;
            //twoBodyPropagator.Propagate();

            //Add access constraints to object
            IAgAccessCnstrCondition lightingConstraint = null;

            if (!satellite.AccessConstraints.IsConstraintActive(AgEAccessConstraints.eCstrLighting))
            {
                lightingConstraint = satellite.AccessConstraints.AddConstraint(AgEAccessConstraints.eCstrLighting) as IAgAccessCnstrCondition;
            }
            else
            {
                lightingConstraint = satellite.AccessConstraints.GetActiveConstraint(AgEAccessConstraints.eCstrLighting) as IAgAccessCnstrCondition;
            }
            lightingConstraint.Condition = AgECnstrLighting.eDirectSun;
        }
コード例 #14
0
        private AgSatellite DuplicateObject(AgSatellite originalObject)
        {
            string duplicateName = $"{originalObject.InstanceName }_Reference";

            CheckForExistingObject($"Satellite/{duplicateName}");

            // Duplicate selected object and hide graphics
            AgSatellite duplicate = originalObject.CopyObject(duplicateName) as AgSatellite;

            // Using a connect command, because disabling graphics with object model still leaves a checked box in the object browser.
            string path          = m_stkObjectsLibrary.SimplifiedObjectPath(duplicate.Path);
            string commandString = $"Graphics {path} Basic Show Off";

            try
            {
                CommonData.StkRoot.ExecuteCommand(commandString);
            }
            catch
            {
                throw new Exception($"Command failed while disabling {duplicate.InstanceName}'s graphics.");
            }

            return(duplicate);
        }
コード例 #15
0
        private void CreateAttitudeButton_Click(object sender, EventArgs e)
        {
            try
            {
                progressBar.Visible = true;
                UpdateProgress(0);

                // Check inputs
                CheckUserInputs();

                // Get inputs
                string alignedVectorName     = alignedVectorComboBox.SelectedItem.ToString();
                string constrainedVectorName = constrainedVectorComboBox.SelectedItem.ToString();
                double angleLimit            = Convert.ToDouble(angleLimitTextBox.Text);
                string alignedBodyAxis       = GetBodyAxis(VectorType.eAligned);
                string constrainedBodyAxis   = GetBodyAxis(VectorType.eConstrained);

                UserInputs inputs = new UserInputs
                {
                    AlignedVectorName     = alignedVectorName,
                    AlignedBodyAxis       = alignedBodyAxis,
                    ConstrainedVectorName = constrainedVectorName,
                    ConstrainedBodyAxis   = constrainedBodyAxis,
                    AngleLimit            = angleLimit
                };
                UpdateProgress(25);

                // Duplicate the satellite to create a reference sat. All AWB components are created on this reference sat to avoid circular logic.
                m_referenceSatellite = DuplicateObject(m_selectedObject);
                UpdateProgress(50);

                // Create AWB components from user inputs
                IAgCrdnVector scheduledVector = CreateAlignedScheduledVector(inputs);
                UpdateProgress(75);

                // Set final attitude profile
                IAgCrdnVector selectedConstrainedVector = GetVectorFromObject((IAgStkObject)m_selectedObject, constrainedVectorName);
                SetAlignedConstrainedAttitude(m_selectedObject, scheduledVector, alignedBodyAxis, selectedConstrainedVector, constrainedBodyAxis);


                if (showGraphicsCheckBox.Checked == true)
                {
                    // Get AWB components to display
                    IAgCrdnAxes   selectedBodyAxes = m_selectedObject.Vgt.Axes["Body"];
                    IAgCrdnVector selectedConstrainedBodyVector = GetVectorFromAxes((IAgStkObject)m_selectedObject, selectedBodyAxes, constrainedBodyAxis);
                    IAgCrdnVector selectedAlignedVector         = GetVectorFromObject((IAgStkObject)m_selectedObject, alignedVectorName);
                    IAgCrdnAngle  displayAngle = CreateAngle((IAgStkObject)m_selectedObject, $"Off_{constrainedVectorName}", selectedConstrainedVector, selectedConstrainedBodyVector);

                    // Display in 3D Graphics window.
                    ShowAttitudeGraphics(selectedAlignedVector, selectedConstrainedVector, selectedBodyAxes, displayAngle);

                    // Add negative body axis if necessary
                    if (constrainedBodyAxis.Contains("-"))
                    {
                        IAgCrdnVector bodyVector = m_selectedObject.Vgt.Vectors[$"Body.{constrainedBodyAxis}"];
                        DisplayElement(AgEGeometricElemType.eVectorElem, (IAgCrdn)bodyVector, Color.RoyalBlue);
                    }
                }

                UpdateProgress(100);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            progressBar.Visible = false;
        }
コード例 #16
0
 public static void HideAoP(AgSatellite sat)
 {
     ShowVGT("Satellite/" + sat.InstanceName + " LineOfNodes Vector", "Modify", "Off", false, "Red");
     ShowVGT("Satellite/" + sat.InstanceName + " Ecc Vector", "Modify", "Off", false, "Red");
     ShowVGT("Satellite/" + sat.InstanceName + " AoP Angle", "Modify", "Off", false, "Red");
 }
コード例 #17
0
 public static void HideEcc(AgSatellite satObj)
 {
     HideVector(satObj, "Ecc");
 }
コード例 #18
0
 public static void ShowEcc(AgSatellite satObj)
 {
     ShowVector(satObj, "Ecc Vector");
 }
コード例 #19
0
 public static void HidePeriapsisApoapsis(AgSatellite sat)
 {
     HideVector(sat, "Periapsis");
     HideVector(sat, "Apoapsis");
 }
コード例 #20
0
 public static void ShowPeriapsisApoapsis(AgSatellite sat)
 {
     ShowVector(sat, "Periapsis Vector");
     ShowVector(sat, "Apoapsis Vector");
 }
コード例 #21
0
        private static void HideVector(AgSatellite satObj, string type)
        {
            IAgVORefCrdn ecc = GetVector(satObj, "Satellite/" + satObj.InstanceName + " " + type + " Vector");

            ecc.Visible = false;
        }
コード例 #22
0
 public static void HideInclination(AgSatellite sat)
 {
     ShowVGT("Satellite/" + sat.InstanceName + " Orbit Plane", "Modify", "Off", false, "White");
     ShowVGT("CentralBody/Earth Equator Plane", "Modify", "Off", false, "White");
     ShowVGT("Satellite/" + sat.InstanceName + " Inclination Angle", "Modify", "Off", false, "Green");
 }