Exemple #1
0
        /***************************************************/

        public static double GetDifferentialComponent(this BarDifferentialTemperatureLoad load, Bar bar, out int myType)
        {
            Dictionary <double, double> profile = load.TemperatureProfile;
            double length;

            myType = 1;

            if (bar.SectionProperty == null)
            {
                Engine.Base.Compute.RecordError("Cannot assign a BarDifferentialTemperature load to a bar with no SectionProperty.");
                return(double.NaN);
            }

            switch (load.LoadDirection)
            {
            case DifferentialTemperatureLoadDirection.LocalY:
                length = bar.SectionProperty.Vy + bar.SectionProperty.Vpy;
                myType = 2;
                break;

            case DifferentialTemperatureLoadDirection.LocalZ:
                length = bar.SectionProperty.Vz + bar.SectionProperty.Vpz;
                myType = 3;
                break;

            default:
                Engine.Base.Compute.RecordError("Could not understand BarDifferentialTemperatureLoad Direction.");
                return(double.NaN);
            }

            double temp = (profile[1] - profile[0]) / length;

            foreach (double key in profile.Keys)
            {
                if (profile[key] - GetUniformComponent(load) != key * temp)
                {
                    Engine.Base.Compute.RecordWarning("Only linear temperature gradients are allowed.");
                }
                break;
            }

            return(temp);
        }
Exemple #2
0
        /***************************************************/

        private bool CreateLoad(BarDifferentialTemperatureLoad bhLoad)
        {
            List <Bar> bars        = bhLoad.Objects.Elements.ToList();
            string     loadPat     = GetAdapterId <string>(bhLoad.Loadcase);
            string     patternName = "None";
            bool       replace     = SAPPushConfig.ReplaceLoads;
            int        myType      = 1;

            double tempUniform = bhLoad.GetUniformComponent();

            // Loop through bars and set load for each bar
            foreach (Bar bar in bars)
            {
                string barName = GetAdapterId <string>(bar);

                double tempGradient = bhLoad.GetDifferentialComponent(bar, out myType);

                if (double.IsNaN(tempGradient))
                {
                    CreateElementError("BarDifferentialTemperatureLoad", barName);
                    continue; // skip this bar if it didn't work.
                }

                if (m_model.FrameObj.SetLoadTemperature(barName, loadPat, myType, tempGradient, patternName, replace, eItemType.Objects) != 0)
                {
                    CreateElementError("BarDifferentialTemperatureLoad", bar.Name);
                }

                if (tempUniform != 0)
                {
                    Engine.Base.Compute.RecordNote("BarDifferentialTemperatureLoad has been split into gradient and uniform components");
                    if (m_model.FrameObj.SetLoadTemperature(barName, loadPat, 1, tempUniform, patternName, false, eItemType.Objects) != 0)
                    {
                        CreateElementError("BarDifferentialTemperatureLoad", bar.Name);
                    }
                }
            }

            SetAdapterId(bhLoad, null);

            return(true);
        }
Exemple #3
0
        /***************************************************/

        public static double GetUniformComponent(this BarDifferentialTemperatureLoad load)
        {
            return((load.TemperatureProfile[0] + load.TemperatureProfile[1]) / 2);
        }