public static Dictionary <string, object> FlexuralYieldingAndRupture(CustomProfile Shape, AluminumMaterial AluminumMaterial,
                                                                             string FlexuralCompressionLocation = "Top", string Code = "AA2015")
        {
            //Default values
            double phiM_n = 0;


            FlexuralCompressionFiberPosition FlexuralCompression;
            //Calculation logic:
            bool IsValidStringCompressionLoc = Enum.TryParse(FlexuralCompressionLocation, true, out FlexuralCompression);

            if (IsValidStringCompressionLoc == false)
            {
                throw new Exception("Flexural compression location selection not recognized. Check input string.");
            }

            AluminumFlexuralMember m = new AluminumFlexuralMember();

            Kodestruct.Aluminum.AA.AA2015.AluminumMaterial a = new Kodestruct.Aluminum.AA.AA2015.AluminumMaterial(
                AluminumMaterial.Alloy, AluminumMaterial.Temper, AluminumMaterial.ThicknessRange, AluminumMaterial.ProductType);


            m.Section = new AluminumSection(a, Shape.Section);
            AluminumLimitStateValue ls_Y = m.GetFlexuralYieldingStrength(FlexuralCompression);

            AluminumLimitStateValue ls_R = m.GetFlexuralRuptureStrength();

            phiM_n = Math.Min(ls_Y.Value, ls_R.Value);

            return(new Dictionary <string, object>
            {
                { "phiM_n", phiM_n }
            });
        }
        public void AluminumShapeReturnsLocalBucklingStressF_b()
        {
            //6063,T6,Up to 1,extrusion

            AluminumMaterial       mat   = new AluminumMaterial("6063", "T6", "Up to 1", "extrusion");
            SectionBox             sb    = new SectionBox(null, 12, 4, 0.25, 0.25);
            AluminumSection        alSec = new AluminumSection(mat, sb);
            AluminumFlexuralMember m     = new AluminumFlexuralMember(alSec);

            FlexuralLocalBucklingElement lbe = new FlexuralLocalBucklingElement(mat, 7, 0.25, LateralSupportType.OneEdge, 100, 80, Aluminum.AA.Entities.WeldCase.NotAffected);
            double F_b = m.GetLocalBucklingFlexuralCriticalStress(7, 0.25, LateralSupportType.OneEdge, Common.Section.Interfaces.FlexuralCompressionFiberPosition.Top,
                                                                  Aluminum.AA.Entities.WeldCase.NotAffected).Value;

            double refValue        = 9.95;
            double actualTolerance = EvaluateActualTolerance(F_b, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public static Dictionary <string, object> FlexuralLocalBucklingCriticalStress(CustomProfile Shape, AluminumMaterial AluminumMaterial, double b, double t, string LateralSupportType,
                                                                                      string FlexuralCompressionLocation = "Top", string WeldCaseId = "NotAffected", string SectionSubElementType = "Flat", string Code = "AA2015")
        {
            //Default values
            double F_b = 0;


            //Calculation logic:
            FlexuralCompressionFiberPosition FlexuralCompression;
            //Calculation logic:
            bool IsValidStringCompressionLoc = Enum.TryParse(FlexuralCompressionLocation, true, out FlexuralCompression);

            if (IsValidStringCompressionLoc == false)
            {
                throw new Exception("Flexural compression location selection not recognized. Check input string.");
            }


            Kodestruct.Aluminum.AA.Entities.Enums.LateralSupportType LateralSupportTypeParsed;
            bool IsValidLateralSupportType = Enum.TryParse(LateralSupportType, true, out LateralSupportTypeParsed);

            if (IsValidLateralSupportType == false)
            {
                throw new Exception("Failed to convert string. LateralSupportType shall be OneEdge or BothEdges. Please check input");
            }


            WeldCase WeldCaseParsed;
            bool     IsValidWeldCase = Enum.TryParse(WeldCaseId, true, out WeldCaseParsed);

            if (IsValidWeldCase == false)
            {
                throw new Exception("Failed to convert string. WeldCase shall be NotAffected or WeldAffected. Please check input");
            }


            SubElementType SubElementType;
            bool           IsValidInputString = Enum.TryParse(SectionSubElementType, true, out SubElementType);

            if (IsValidInputString == false)
            {
                throw new Exception("Failed to convert string. Currently supported value is Flat. Please check input");
            }



            AluminumFlexuralMember m = new AluminumFlexuralMember();

            Kodestruct.Aluminum.AA.AA2015.AluminumMaterial a = new Kodestruct.Aluminum.AA.AA2015.AluminumMaterial(
                AluminumMaterial.Alloy, AluminumMaterial.Temper, AluminumMaterial.ThicknessRange, AluminumMaterial.ProductType);


            m.Section = new AluminumSection(a, Shape.Section);
            AluminumLimitStateValue ls_LB = m.GetLocalBucklingFlexuralCriticalStress(b, t, LateralSupportTypeParsed, FlexuralCompression, WeldCaseParsed, SubElementType);

            F_b = ls_LB.Value;


            return(new Dictionary <string, object>
            {
                { "F_b", F_b }
            });
        }