Exemple #1
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static AreaUniformTemperatureLoad ToAreaTempratureLoad(
            IFLoading lusasTemperatureLoad,
            IEnumerable <IFAssignment> lusasAssignments,
            Dictionary <string, Panel> panels)
        {
            IFLoadcase assignedLoadcase  = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase          = ToLoadcase(assignedLoadcase);
            double     temperatureChange = lusasTemperatureLoad.getValue("T")
                                           - lusasTemperatureLoad.getValue("T0");

            IEnumerable <IAreaElement> assignedPanels             = GetSurfaceAssignments(lusasAssignments, panels);
            AreaUniformTemperatureLoad AreaUniformTemperatureLoad = BH.Engine.Structure.Create.AreaUniformTemperatureLoad(
                loadcase,
                temperatureChange,
                assignedPanels,
                LoadAxis.Local,
                false,
                GetName(lusasTemperatureLoad));

            int adapterNameId = lusasTemperatureLoad.getID();

            AreaUniformTemperatureLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(AreaUniformTemperatureLoad);
        }
Exemple #2
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static BarUniformTemperatureLoad ToBarUniformTemperatureLoad(
            IFLoading lusasTemperatureLoad,
            IEnumerable <IFAssignment> lusasAssignments,
            Dictionary <string, Bar> bars)
        {
            IFLoadcase assignedLoadcase  = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase          = ToLoadcase(assignedLoadcase);
            double     temperatureChange = lusasTemperatureLoad.getValue("T")
                                           - lusasTemperatureLoad.getValue("T0");

            IEnumerable <Bar>         assignedBars = GetLineAssignments(lusasAssignments, bars);
            BarUniformTemperatureLoad barUniformTemperatureLoad = Engine.Structure.Create.BarUniformTemperatureLoad(
                loadcase,
                temperatureChange,
                assignedBars,
                LoadAxis.Local,
                false,
                GetName(lusasTemperatureLoad));

            int adapterNameId = lusasTemperatureLoad.getID();

            barUniformTemperatureLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(barUniformTemperatureLoad);
        }
Exemple #3
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static GravityLoad ToGravityLoad(IFLoading lusasGravityLoad,
                                                IEnumerable <IFAssignment> lusasAssignments,
                                                Dictionary <string, Node> nodes,
                                                Dictionary <string, Bar> bars,
                                                Dictionary <string, Panel> panels)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase         = ToLoadcase(assignedLoadcase);
            Vector     gravityVector    = new Vector
            {
                X = lusasGravityLoad.getValue("accX"),
                Y = lusasGravityLoad.getValue("accY"),
                Z = lusasGravityLoad.getValue("accZ")
            };

            IEnumerable <BHoMObject> assignedObjects = GetGeometryAssignments(
                lusasAssignments, nodes, bars, panels);
            GravityLoad gravityLoad = Engine.Structure.Create.GravityLoad(
                loadcase, gravityVector, assignedObjects, GetName(lusasGravityLoad));

            int adapterNameId = lusasGravityLoad.getID();

            gravityLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(gravityLoad);
        }
Exemple #4
0
        private List <ILoad> ReadAreaUniformlyDistributedLoads(List <string> ids = null)
        {
            /***************************************************/
            /**** Private Methods                           ****/
            /***************************************************/

            List <ILoad> areaUniformlyDistributedLoads = new List <ILoad>();

            object[] lusasGlobalDistributedLoads = d_LusasData.getAttributes("Global Distributed Load");
            object[] lusasLocalDistributedLoads  = d_LusasData.getAttributes("Distributed Load");


            object[] lusasDistributedLoads = lusasGlobalDistributedLoads.Concat(
                lusasLocalDistributedLoads).ToArray();

            if (!(lusasDistributedLoads.Count() == 0))
            {
                List <Panel> panelsList           = ReadPanels();
                Dictionary <string, Panel> panels = panelsList.ToDictionary(
                    x => x.AdapterId <string>(typeof(LusasId)));

                List <IFLoadcase> allLoadcases = new List <IFLoadcase>();

                for (int i = 0; i < lusasDistributedLoads.Count(); i++)
                {
                    IFLoading lusasDistributedLoad = (IFLoading)lusasDistributedLoads[i];

                    if (lusasDistributedLoad.getValue("type") == "Area" || lusasDistributedLoad.getValue("type") == "all")
                    {
                        IEnumerable <IGrouping <string, IFAssignment> > groupedByLoadcases =
                            GetLoadAssignments(lusasDistributedLoad);

                        foreach (IEnumerable <IFAssignment> groupedAssignment in groupedByLoadcases)
                        {
                            AreaUniformlyDistributedLoad areaUniformlyDistributedLoad =
                                Adapters.Lusas.Convert.ToAreaUniformlyDistributed(
                                    lusasDistributedLoad, groupedAssignment, panels);

                            List <string> analysisName = new List <string> {
                                lusasDistributedLoad.getAttributeType()
                            };
                            areaUniformlyDistributedLoad.Tags = new HashSet <string>(analysisName);
                            areaUniformlyDistributedLoads.Add(areaUniformlyDistributedLoad);
                        }
                    }
                }
            }

            return(areaUniformlyDistributedLoads);
        }
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static AreaUniformlyDistributedLoad ToAreaUniformlyDistributed(
            IFLoading lusasDistributed, IEnumerable <IFAssignment> lusasAssignments,
            Dictionary <string, Panel> panels)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase         = ToLoadcase(assignedLoadcase);

            IEnumerable <IAreaElement> assignedPanels = GetSurfaceAssignments(
                lusasAssignments, panels);

            Vector pressureVector = new Vector
            {
                X = lusasDistributed.getValue("WX"),
                Y = lusasDistributed.getValue("WY"),
                Z = lusasDistributed.getValue("WZ")
            };

            AreaUniformlyDistributedLoad areaUniformlyDistributedLoad = null;

            if (lusasDistributed.getAttributeType() == "Global Distributed Load")
            {
                areaUniformlyDistributedLoad = Engine.Structure.Create.AreaUniformlyDistributedLoad(
                    loadcase,
                    pressureVector,
                    assignedPanels,
                    LoadAxis.Global,
                    true,
                    GetName(lusasDistributed));
            }
            else if (lusasDistributed.getAttributeType() == "Distributed Load")
            {
                areaUniformlyDistributedLoad = Engine.Structure.Create.AreaUniformlyDistributedLoad(
                    loadcase,
                    pressureVector,
                    assignedPanels,
                    LoadAxis.Local,
                    true,
                    GetName(lusasDistributed));
            }

            int adapterNameId = lusasDistributed.getID();

            areaUniformlyDistributedLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(areaUniformlyDistributedLoad);
        }
Exemple #6
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private List <ILoad> ReadBarUniformlyDistributedLoads(List <string> ids = null)
        {
            List <ILoad> barUniformlyDistributedLoads = new List <ILoad>();

            object[] lusasGlobalDistributedLoads = d_LusasData.getAttributes("Global Distributed Load");
            object[] lusasLocalDistributedLoads  = d_LusasData.getAttributes("Distributed Load");

            object[] lusasDistributedLoads = lusasGlobalDistributedLoads.Concat(
                lusasLocalDistributedLoads).ToArray();

            if (!(lusasDistributedLoads.Count() == 0))
            {
                List <Bar> barsList           = ReadBars();
                Dictionary <string, Bar> bars = barsList.ToDictionary(
                    x => x.AdapterId <string>(typeof(LusasId)));

                List <IFLoadcase> allLoadcases = new List <IFLoadcase>();

                for (int i = 0; i < lusasDistributedLoads.Count(); i++)
                {
                    IFLoading lusasDistributedLoad = (IFLoading)lusasDistributedLoads[i];

                    IEnumerable <IGrouping <string, IFAssignment> > groupedByLoadcases = GetLoadAssignments(
                        lusasDistributedLoad);

                    if (lusasDistributedLoad.getValue("type") == "Length" || lusasDistributedLoad.getValue("type") == "line")
                    {
                        foreach (IEnumerable <IFAssignment> groupedAssignment in groupedByLoadcases)
                        {
                            BarUniformlyDistributedLoad barUniformlyDistributedLoad =
                                Adapters.Lusas.Convert.ToBarUniformlyDistributed(
                                    lusasDistributedLoad, groupedAssignment, bars);

                            List <string> analysisName = new List <string> {
                                lusasDistributedLoad.getAttributeType()
                            };
                            barUniformlyDistributedLoad.Tags = new HashSet <string>(analysisName);
                            barUniformlyDistributedLoads.Add(barUniformlyDistributedLoad);
                        }
                    }
                }
            }

            return(barUniformlyDistributedLoads);
        }
Exemple #7
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static PointDisplacement ToPointDisplacement(IFLoading lusasPrescribedDisplacement,
                                                            IEnumerable <IFAssignment> lusasAssignments, Dictionary <string, Node> nodes)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase         = ToLoadcase(assignedLoadcase);

            IEnumerable <Node> assignedNodes = GetPointAssignments(lusasAssignments, nodes);

            Vector translationVector = new Vector
            {
                X = lusasPrescribedDisplacement.getValue("U"),
                Y = lusasPrescribedDisplacement.getValue("V"),
                Z = lusasPrescribedDisplacement.getValue("W")
            };

            Vector rotationVector = new Vector
            {
                X = lusasPrescribedDisplacement.getValue("THX"),
                Y = lusasPrescribedDisplacement.getValue("THY"),
                Z = lusasPrescribedDisplacement.getValue("THZ")
            };

            PointDisplacement pointDisplacement = BH.Engine.Structure.Create.PointDisplacement(
                loadcase, assignedNodes, translationVector, rotationVector, LoadAxis.Global,
                GetName(lusasPrescribedDisplacement));

            int adapterNameId = lusasPrescribedDisplacement.getID();

            pointDisplacement.SetAdapterId(typeof(LusasId), adapterNameId);
            // Needs to be a bit here that determines whether it is global or local - actually this cannot be done as the
            //attribute is applied to a group, and within the group the axis could local or global

            return(pointDisplacement);
        }
Exemple #8
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/
        public static BarUniformlyDistributedLoad ToBarUniformlyDistributed(IFLoading lusasDistributed,
            IEnumerable<IFAssignment> lusasAssignments, Dictionary<string, Bar> bars)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase loadcase = ToLoadcase(assignedLoadcase);

            IEnumerable<Bar> assignedBars = GetLineAssignments(lusasAssignments, bars);

            Vector forceVector = new Vector
            {
                X = lusasDistributed.getValue("WX"),
                Y = lusasDistributed.getValue("WY"),
                Z = lusasDistributed.getValue("WZ")
            };

            BarUniformlyDistributedLoad barUniformlyDistributed = null;

            if (lusasDistributed.getAttributeType() == "Global Distributed Load")
            {
                Vector momentVector = new Vector
                {
                    X = lusasDistributed.getValue("MX"),
                    Y = lusasDistributed.getValue("MY"),
                    Z = lusasDistributed.getValue("MZ")
                };

                barUniformlyDistributed = Engine.Structure.Create.BarUniformlyDistributedLoad(
                    loadcase,
                    assignedBars,
                    forceVector,
                    momentVector,
                    LoadAxis.Global,
                    true,
                    GetName(lusasDistributed));
            }
            else if (lusasDistributed.getAttributeType() == "Distributed Load")
            {
                barUniformlyDistributed = Engine.Structure.Create.BarUniformlyDistributedLoad(
                    loadcase,
                    assignedBars,
                    forceVector,
                    null,
                    LoadAxis.Local,
                    true,
                    GetName(lusasDistributed));
            }

            int adapterNameId = lusasDistributed.getID();
            barUniformlyDistributed.SetAdapterId(typeof(LusasId), adapterNameId);

            return barUniformlyDistributed;
        }
Exemple #9
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static BarPointLoad ToBarPointLoad(IFLoading lusasBarPointLoad,
                                                  IEnumerable <IFAssignment> lusasAssignments, Dictionary <string, Bar> bars)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase         = ToLoadcase(assignedLoadcase);

            IEnumerable <Bar> assignedBars = GetLineAssignments(lusasAssignments, bars);

            Vector forceVector = new Vector
            {
                X = lusasBarPointLoad.getValue("PX"),
                Y = lusasBarPointLoad.getValue("PY"),
                Z = lusasBarPointLoad.getValue("PZ")
            };

            Vector momentVector = new Vector
            {
                X = lusasBarPointLoad.getValue("MX"),
                Y = lusasBarPointLoad.getValue("MY"),
                Z = lusasBarPointLoad.getValue("MZ")
            };

            double forcePosition = lusasBarPointLoad.getValue("Distance");

            BarPointLoad barPointLoad;

            barPointLoad = Engine.Structure.Create.BarPointLoad(
                loadcase,
                forcePosition,
                assignedBars,
                forceVector,
                momentVector,
                LoadAxis.Global,
                GetName(lusasBarPointLoad));

            int adapterNameId = lusasBarPointLoad.getID();

            barPointLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(barPointLoad);
        }
Exemple #10
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static PointLoad ToPointLoad(
            IFLoading lusasPointLoad, IEnumerable <IFAssignment> lusasAssignments,
            Dictionary <string, Node> nodes)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase         = ToLoadcase(assignedLoadcase);

            IEnumerable <Node> assignedNodes = GetPointAssignments(lusasAssignments, nodes);

            Vector forceVector = new Vector
            {
                X = lusasPointLoad.getValue("px"),
                Y = lusasPointLoad.getValue("py"),
                Z = lusasPointLoad.getValue("pz")
            };

            Vector momentVector = new Vector
            {
                X = lusasPointLoad.getValue("mx"),
                Y = lusasPointLoad.getValue("my"),
                Z = lusasPointLoad.getValue("mz")
            };

            PointLoad pointLoad = Engine.Structure.Create.PointLoad(
                loadcase,
                assignedNodes,
                forceVector,
                momentVector,
                LoadAxis.Global,
                GetName(lusasPointLoad));

            int adapterNameId = lusasPointLoad.getID();

            pointLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(pointLoad);
        }
Exemple #11
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static BarVaryingDistributedLoad ToBarDistributedLoad(IFLoading lusasBarDistributedLoad,
                                                                     IEnumerable <IFAssignment> lusasAssignments, Dictionary <string, Bar> bars)
        {
            IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset();
            Loadcase   loadcase         = ToLoadcase(assignedLoadcase);

            IEnumerable <Bar> assignedBars = GetLineAssignments(lusasAssignments, bars);

            Vector startForceVector = new Vector
            {
                X = lusasBarDistributedLoad.getValue("startpx"),
                Y = lusasBarDistributedLoad.getValue("startpy"),
                Z = lusasBarDistributedLoad.getValue("startpz")
            };

            Vector endForceVector = new Vector
            {
                X = lusasBarDistributedLoad.getValue("endpx"),
                Y = lusasBarDistributedLoad.getValue("endpy"),
                Z = lusasBarDistributedLoad.getValue("endpz")
            };

            Vector startMomentVector = new Vector
            {
                X = lusasBarDistributedLoad.getValue("startmx"),
                Y = lusasBarDistributedLoad.getValue("startmy"),
                Z = lusasBarDistributedLoad.getValue("startmz")
            };

            Vector endMomentVector = new Vector
            {
                X = lusasBarDistributedLoad.getValue("endmx"),
                Y = lusasBarDistributedLoad.getValue("endmy"),
                Z = lusasBarDistributedLoad.getValue("endmz")
            };

            double startPosition = lusasBarDistributedLoad.getValue("startDistance");
            double endPosition   = lusasBarDistributedLoad.getValue("endDistance");

            bool     relativePositions = lusasBarDistributedLoad.getValue("Type") == "Parametric" ? true : false;
            LoadAxis axis      = LoadAxis.Global;
            bool     projected = false;

            BH.Engine.Base.Compute.RecordWarning("All BarVaryingDistributedLoads pulled from Lusas are assumed to be in global coordinates and to not be projected.");

            BarVaryingDistributedLoad barVarDistributedLoad;

            barVarDistributedLoad = Engine.Structure.Create.BarVaryingDistributedLoad(
                loadcase,
                assignedBars,
                startPosition,
                startForceVector,
                startMomentVector,
                endPosition,
                endForceVector,
                endMomentVector,
                relativePositions,
                axis,
                projected,
                GetName(lusasBarDistributedLoad));

            if (barVarDistributedLoad == null)
            {
                return(null);
            }

            int adapterNameId = lusasBarDistributedLoad.getID();

            barVarDistributedLoad.SetAdapterId(typeof(LusasId), adapterNameId);

            return(barVarDistributedLoad);
        }