Ejemplo n.º 1
0
        //public STKObject(string name0, double value, params int[] ParentLevel)
        //{
        //    m_ObjName = name0;
        //    m_ObjType = null;
        //    m_Value = value;
        //    m_ObjectHandle = null;
        //    m_OrbitData = null;
        //    m_Unit = " ";
        //    if (ParentLevel.Length != 0)
        //    {
        //        isParentObj = ParentLevel[0];
        //    }
        //    else
        //    {
        //        isParentObj = 2;
        //    }
        //}

        //Satellite Object
        public STKObject(string name0, string type0, string propagatorType, IAgStkObject object0)
        {
            m_ObjName      = name0;
            m_ObjType      = type0;
            m_ObjectHandle = object0;
            m_propagator   = propagatorType;
            m_OrbitData    = new Satellite_OrbitData(object0);
            m_MassData     = new Satellite_MassData(object0);
            m_Unit         = " ";
            isParentObj    = 1;
        }
Ejemplo n.º 2
0
        public int invoke_STKUpdate(int index, string STKVarName, double Value)
        {
            var returnID = 0;

            if (AccessClassName[index] == implem_Classes.Satellite_OrbitData)
            {
                Satellite_OrbitData toUpdate = new Satellite_OrbitData(AccessObject[index] as IAgStkObject);
                toUpdate.set_InitStateJx((AccessObject[index]), STKVarName, Value);
                returnID = 1;
            }
            if (AccessClassName[index] == implem_Classes.Satellite_MassData)
            {
                Satellite_MassData toUpdate = new Satellite_MassData();
                toUpdate.set_MassProp((AccessObject[index]), STKVarName, Value);
                returnID = 1;
            }
            if (AccessClassName[index] == implem_Classes.Astg_InitState)
            {
                Astg_SegData toUpdate = new Astg_SegData();
                toUpdate.set_InitialState((AccessObject[index]), STKVarName, Value);
                returnID = 1;
            }
            if (AccessClassName[index] == implem_Classes.Astg_SC_InitParams)
            {
                Astg_SegData toUpdate = new Astg_SegData();
                toUpdate.set_SpacecraftParams((AccessObject[index]), STKVarName, Value);
                returnID = 1;
            }
            if (AccessClassName[index] == implem_Classes.Astg_FuelTankParams)
            {
                Astg_SegData toUpdate = new Astg_SegData();
                toUpdate.set_FuelTankParams((AccessObject[index]), STKVarName, Value);
                returnID = 1;
            }
            return(returnID);
        }
Ejemplo n.º 3
0
        public void readAllAttributes()
        {
            int Child_count = Scenario.Children.Count;

            // Note: IAgStkObject is instance of the object
            allChildren = Scenario.Children;
            makeChildrenList(allChildren);

            for (int i = 0; i < Child_count; i++)
            {
                List <string> localParent = new List <string>();
                if (allChildren[i].ClassName == "Satellite")
                {
                    string propName = getPropagator(allChildren[i]);

                    STKObject list0 = new STKObject(allChildren[i].InstanceName, allChildren[i].ClassName, propName, allChildren[i]);

                    UpdateGridDictLists(list0, null, implem_Classes.NULL, localParent);
                    localParent.Add(list0.m_ObjName);


                    //Jx Propagator
                    if (propName == "ePropagatorJ2Perturbation" || propName == "ePropagatorJ4Perturbation" || propName == "ePropagatorTwoBody")
                    {
                        #region Orbit Section
                        STKObject listHeader = new STKObject("Orbit", "IAgOrbitState"); //subcomp passed like this for ui
                        UpdateGridDictLists(listHeader, null, implem_Classes.NULL, localParent);
                        List <string> localParent_Orbit = Extensions.Clone <string>(localParent);
                        localParent_Orbit.Add(listHeader.m_ObjName);


                        Satellite_OrbitData SatOrbitData = list0.m_OrbitData;
                        var Times = new List <string> {
                            SatOrbitData.m_ObjectTimes.FindStartTime(), SatOrbitData.m_ObjectTimes.FindStopTime()
                        };
                        dictObjectTimes.Add(i, Times);

                        //Add List of Orbital Parameters
                        STKObject list1 = new STKObject(nameof(SatOrbitData.Step_Size), SatOrbitData.Step_Size, Units.u_Time);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.SemiMajorAxis), SatOrbitData.SemiMajorAxis, Units.u_Distance);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.Eccentricity), SatOrbitData.Eccentricity, Units.u_Null);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.Inclination), SatOrbitData.Inclination, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.RAAN), SatOrbitData.RAAN, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.ArgOfPerigee), SatOrbitData.ArgOfPerigee, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.TrueAnomaly), SatOrbitData.TrueAnomaly, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        #endregion

                        #region Mass Properties Section
                        listHeader = new STKObject("Mass", "IAgVeMassProperties"); //subcomp passed like this for ui
                        UpdateGridDictLists(listHeader, null, implem_Classes.NULL, localParent);
                        var localParent_Mass = Extensions.Clone <string>(localParent);
                        localParent_Mass.Add(listHeader.m_ObjName);

                        Satellite_MassData SatMassData = list0.m_MassData;
                        STKObject          list2       = new STKObject(nameof(SatMassData.Mass), SatMassData.Mass, Units.u_Mass); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Ixx), SatMassData.Ixx, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Iyy), SatMassData.Iyy, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Izz), SatMassData.Izz, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Ixy), SatMassData.Ixy, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Ixz), SatMassData.Ixz, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Iyz), SatMassData.Iyz, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);

                        #endregion
                    }

                    //Astrogator
                    else if (propName == "ePropagatorAstrogator")
                    {
                        IAgSatellite satellite = allChildren[i] as IAgSatellite;

                        #region Orbit Section
                        STKObject listHeader = new STKObject("Orbit: Astrogator", "IAgVAMCSDriver", 2); //subcomp passed like this for ui
                        UpdateGridDictLists(listHeader, null, implem_Classes.NULL, localParent);
                        var localParent_Orbit = Extensions.Clone <string>(localParent);
                        localParent_Orbit.Add(listHeader.m_ObjName);
                        //get all sequences
                        MCS_Segments ListSegments = new MCS_Segments(satellite);
                        dictObjectTimes.Add(i, ListSegments.objectTimes);
                        STKObject AstgList = new STKObject();

                        for (int k = 0; k < ListSegments.SegmentDataList.Count; k++)
                        {
                            for (int j = 0; j < ListSegments.SegmentDataList[k].l_Names.Count; j++)
                            {
                                if (!ListSegments.SegmentDataList[k].l_isQuantity[j])
                                {
                                    AstgList = new STKObject(ListSegments.SegmentDataList[k].l_Names[j], ListSegments.SegmentDataList[k].l_types[j], Math.Min(5, (3 + ListSegments.SegmentDataList[k].l_depth[j])));
                                    var thislocalParent = Extensions.Clone <string>(localParent_Orbit);
                                    thislocalParent.AddRange(ListSegments.SegmentDataList[k].l_localParents[j]);
                                    UpdateGridDictLists(AstgList, null, implem_Classes.NULL, thislocalParent);
                                }
                                else
                                {
                                    var AccessObj       = (ListSegments.SegmentDataList[k].l_SegObj[j]);
                                    var AccessObjType   = (ListSegments.SegmentDataList[k].l_implemClass[j]);
                                    var thislocalParent = Extensions.Clone <string>(localParent_Orbit); thislocalParent.AddRange(ListSegments.SegmentDataList[k].l_localParents[j]);

                                    localParent_Orbit.AddRange(ListSegments.SegmentDataList[k].l_localParents[j]);
                                    AstgList = new STKObject(ListSegments.SegmentDataList[k].l_Names[j], ListSegments.SegmentDataList[k].l_Values[j], ListSegments.SegmentDataList[k].l_unit[j]);
                                    UpdateGridDictLists(AstgList, AccessObj, AccessObjType, thislocalParent);
                                    //ADD ULTIMATE ACCESS HANDLER HEREEEEEE.
                                }
                            }
                        }
                        #endregion

                        #region Mass Properties Section

                        #endregion
                    }
                }
                else if (allChildren[i].ClassName == "Facility")
                {
                    Facility_Data thisFacility = new Facility_Data(allChildren[i]);
                    STKObject     list0        = new STKObject(allChildren[i].InstanceName, allChildren[i].ClassName, allChildren[i]);
                    UpdateGridDictLists(list0, null, implem_Classes.NULL, localParent);
                    localParent.Add(allChildren[i].InstanceName);
                    for (int ii = 0; ii < thisFacility.l_Names.Count; ii++)
                    {
                        if (!thisFacility.l_isQuantity[ii])
                        {
                            var facilityList = new STKObject(thisFacility.l_Names[ii], thisFacility.l_types[ii], (1 + thisFacility.l_depth[ii])); UpdateGridDictLists(facilityList, null, implem_Classes.NULL, localParent);
                        }
                        else
                        {
                            var accessObj    = thisFacility.l_SegObj[ii];
                            var accessType   = thisFacility.l_implemClass[ii];
                            var facilityList = new STKObject(thisFacility.l_Names[ii], thisFacility.l_Values[ii], thisFacility.l_unit[ii]);

                            UpdateGridDictLists(facilityList, null, implem_Classes.Facility_Location, localParent);
                        }
                    }
                }
                else
                {
                    STKObject list0 = new STKObject(allChildren[i].InstanceName, allChildren[i].ClassName, allChildren[i]);
                    UpdateGridDictLists(list0, null, implem_Classes.NULL, localParent);
                }
            }
            /// File Load Last used project name
            if (projInfoFile.hasInfo["Project Name"])
            {
                var projName = (string)(projInfoFile.getInfo("Project Name"));

                StatusBox.Text        = "Project Loaded: \" " + projName + " \" . Press 'Refresh Valispace Data' ";
                thisProjectLabel.Text = "Project :  " + projName + " (Refresh)";

                LoadProject_Msg.Visibility = Visibility.Hidden;
                //loadLastProjectName();
            }
        }