private void CreateBeam()
        {
            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            AiscShapeFactory AiscShapeFactory = new AiscShapeFactory();
            ISection section = AiscShapeFactory.GetShape("HSS8X6X.500", ShapeTypeSteel.RectangularHSS);
            SteelMaterial mat = new SteelMaterial(46.0,29000);
            beam = factory.GetBeam(section,mat,null, MomentAxis.XAxis, FlexuralCompressionFiberPosition.Top);

        }
        private void CreateBeam()
        {
            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            AiscShapeFactory AiscShapeFactory = new AiscShapeFactory();
            ISection section = AiscShapeFactory.GetShape("W18X35", ShapeTypeSteel.IShapeRolled);
            SteelMaterial mat = new SteelMaterial(50.0,29000);
            beam = factory.GetBeam(section,mat,null, MomentAxis.XAxis, FlexuralCompressionFiberPosition.Top);

        }
        public void DoublySymmetricIReturnsFlexuralLateralTorsionalBucklingStrengthInelasticW12 ()
        {
            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            AiscShapeFactory AiscShapeFactory = new AiscShapeFactory();
            ISection section = AiscShapeFactory.GetShape("W12X26", ShapeTypeSteel.IShapeRolled);
            SteelMaterial mat = new SteelMaterial(50.0, 29000);
            ISteelBeamFlexure beam12 = factory.GetBeam(section, mat, null, MomentAxis.XAxis, FlexuralCompressionFiberPosition.Top);

            SteelLimitStateValue LTB =
            beam12.GetFlexuralLateralTorsionalBucklingStrength(1.0, 19 * 12, FlexuralCompressionFiberPosition.Top, Steel.AISC.FlexuralAndTorsionalBracingType.NoLateralBracing);
            double phiM_n = LTB.Value;
            double refValue = 60*12; // from AISC Steel Manual Table 3-10
            double actualTolerance = EvaluateActualTolerance(phiM_n, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public void RectangleShapeReturnsYieldStrength()
        {

            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            SectionRectangular r = new SectionRectangular(0.5, 12.0);


            SteelMaterial mat = new SteelMaterial(50.0, 29000);
            ISteelBeamFlexure beam12 = factory.GetBeam(r, mat, null, MomentAxis.XAxis, FlexuralCompressionFiberPosition.Top);

            SteelLimitStateValue Y =
            beam12.GetFlexuralYieldingStrength(FlexuralCompressionFiberPosition.Top);
            double phiM_n = Y.Value;
            double refValue = 67.5; 
            double actualTolerance = EvaluateActualTolerance(phiM_n, refValue);


            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public void IShapeReturnsYieldStrength()
        {

            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            AiscShapeFactory AiscShapeFactory = new AiscShapeFactory();
            ISection r = AiscShapeFactory.GetShape("W18X35");


            SteelMaterial mat = new SteelMaterial(50.0, 29000);
            ISteelBeamFlexure beam12 = factory.GetBeam(r, mat, null, MomentAxis.XAxis, FlexuralCompressionFiberPosition.Top);

            SteelLimitStateValue Y =
            beam12.GetFlexuralYieldingStrength(FlexuralCompressionFiberPosition.Top);
            double phiM_n = Y.Value;
            double refValue = 249 * 12; // from AISC Steel Manual Table 3-2
            double actualTolerance = EvaluateActualTolerance(phiM_n, refValue);


            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public static Dictionary<string, object> FlexuralYielding(CustomProfile Shape, double F_y, string BendingAxis="XAxis", string FlexuralCompressionLocation="Top",
            double E = 29000, bool IsRolledMember = true, string Code = "AISC360-10")
        {
            //Default values
            double phiM_n = 0;
            bool IsApplicableLimitState = false;


            //Calculation logic:
            MomentAxis Axis;
            //Calculation logic:
            bool IsValidStringAxis = Enum.TryParse(BendingAxis, true, out Axis);
            if (IsValidStringAxis == false)
            {
                throw new Exception("Axis selection not recognized. Check input string.");
            }

            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.");
            }


            SteelMaterial mat = new SteelMaterial(F_y, E);
            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            ISteelBeamFlexure beam = factory.GetBeam(Shape.Section, mat, null, Axis, FlexuralCompression, IsRolledMember);

            SteelLimitStateValue Y =
            beam.GetFlexuralYieldingStrength(FlexuralCompression);
            phiM_n = Y.Value;

            IsApplicableLimitState = Y.IsApplicable;

            return new Dictionary<string, object>
            {
                { "phiM_n", phiM_n }
            ,{ "IsApplicableLimitState", IsApplicableLimitState }
 
            };
        }
        public static Dictionary<string, object> FlexuralLateralTorsionalBuckling(CustomProfile Shape,string BendingAxis,string FlexuralCompressionLocation,double F_y,
            double L_b, double C_b = 1.0, string FlexuralBracingCase = "NoLateralBracing", double E = 29000, bool IsRolledMember = true, string Code = "AISC360-10")
        {
            //Default values
            double phiM_n = 0;
            bool IsApplicableLimitState = false;


            //Calculation logic:

            MomentAxis Axis;

            bool IsValidStringAxis = Enum.TryParse(BendingAxis, true, out Axis);
            if (IsValidStringAxis == false)
            {
                throw new Exception("Axis selection not recognized. Check input string.");
            }

            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.");
            }

            FlexuralAndTorsionalBracingType Bracing;
            //Calculation logic:
            bool IsValidStringBracing = Enum.TryParse(FlexuralBracingCase, true, out Bracing);
            if (IsValidStringBracing == false)
            {
                throw new Exception("Flexural bracing case selection not recognized. Check input string.");
            }


            SteelMaterial mat = new SteelMaterial(F_y, E);
            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            ISteelBeamFlexure beam = factory.GetBeam(Shape.Section, mat, null, Axis, FlexuralCompression, IsRolledMember);


            SteelLimitStateValue LTB = beam.GetFlexuralLateralTorsionalBucklingStrength(C_b, L_b, FlexuralCompression, Bracing);
            phiM_n = LTB.Value;

            IsApplicableLimitState = LTB.IsApplicable;

            return new Dictionary<string, object>
            {
                { "phiM_n", phiM_n }
                ,{ "IsApplicableLimitState", IsApplicableLimitState }
 
            };
        }
        public void FactoryReturnsChannel()
        {

            FlexuralMemberFactory factory = new FlexuralMemberFactory();
            AiscShapeFactory AiscShapeFactory = new AiscShapeFactory();
            ISectionChannel r = new SectionChannel("", 12.0, 6, 0.4, 0.25);


            SteelMaterial mat = new SteelMaterial(50.0, 29000);
            ISteelBeamFlexure beam12 = factory.GetBeam(r, mat, null, MomentAxis.XAxis, FlexuralCompressionFiberPosition.Top);

            Assert.IsTrue(true);
        }