public void ColumnDistributedInteractionReturnsSPCol2()
        {
            double b   = 16;
            double h   = 16;
            double f_c = 5000;

            List <RebarPoint>         LongitudinalBars   = new List <RebarPoint>();
            FlexuralSectionFactory    flexureFactory     = new FlexuralSectionFactory();
            CompressionSectionFactory compressionFactory = new CompressionSectionFactory();
            IConcreteMaterial         mat      = GetConcreteMaterial(f_c);
            IRebarMaterial            rebarMat = new MaterialAstmA615(A615Grade.Grade60);

            ConcreteSectionFlexure flexureMember = flexureFactory.GetRectangularSectionFourSidesDistributed(b, h, 4.0, 0, 2.5, 2.5,
                                                                                                            mat, rebarMat, ConfinementReinforcementType.Ties, 1);

            ConcreteSectionCompression col = compressionFactory.GetCompressionMemberFromFlexuralSection(flexureMember,
                                                                                                        CompressionMemberType.NonPrestressedWithTies);



            double phiP_n   = 797 * 1000;
            double refValue = 102;//from SP column software

            double M_n          = col.GetNominalMomentResult(phiP_n / 0.65, FlexuralCompressionFiberPosition.Top).Moment;
            double phiM_n_KipFt = M_n / 1000.0 / 12.0;

            double phiM_n          = col.GetDesignMomentWithCompressionStrength(phiP_n, FlexuralCompressionFiberPosition.Top).phiM_n / (12 * 1000);
            double actualTolerance = EvaluateActualTolerance(phiM_n, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public void ColumnInteractionReturnsM_n_Z_Neg2Factored()
        {
            ConcreteSectionCompression col = GetConcreteExampleColumn();
            double phiP_n    = 205 * 1000;
            double phiM_nRef = 282.0 * 1000 * 12;

            double phiM_n          = col.GetDesignMomentWithCompressionStrength(phiP_n, FlexuralCompressionFiberPosition.Top).phiM_n;
            double actualTolerance = EvaluateActualTolerance(phiM_n, phiM_nRef);


            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        public void ColumnDistributedInteractionReturnsM_n_Z_Neg4Factored()
        {
            ConcreteSectionCompression col = GetConcreteExampleColumnWithDistributed();
            double phiP_n   = 39.5 * 1000;
            double refValue = 232 * 12 * 1000; //from MacGregor


            double phiM_n = col.GetDesignMomentWithCompressionStrength(phiP_n, FlexuralCompressionFiberPosition.Top).phiM_n;

            double actualTolerance = EvaluateActualTolerance(phiM_n, refValue);

            Assert.LessOrEqual(actualTolerance, tolerance);
        }
        /// <summary>
        ///     Moment strength with axial force (kip - in unit system for all inputs and outputs)
        /// </summary>
        /// <param name="P_u">   Factored axial force; to be taken as positive for  compression and negative for tension  </param>
        /// <param name="ConcreteSection">  Reinforced concrete section </param>
        /// <param name="ConfinementReinforcementType">  Type of compression member confinement reinforcement (tied, spiral etc) </param>
        /// <param name="FlexuralCompressionFiberLocation">Specifies if top or bottom fiber is in compression from the effects of bending moment</param>
        /// <param name="IsPrestressed">Indicates if member is prestressed</param>
        /// <param name="Code">Applicable version of code/standard</param>
        /// <returns name="phiM_n">  Design flexural strength at section   </returns>


        public static double MaximumMomentFromAxialForce(double P_u, ConcreteFlexureAndAxiaSection ConcreteSection,
                                                         string ConfinementReinforcementType = "Ties", string FlexuralCompressionFiberLocation = "Top",
                                                         bool IsPrestressed = false, string Code = "ACI318-14")
        {
            //Default values

            double phiM_n = 0.0;

            //Calculation logic:


            ConfinementReinforcementType ConfinementReinforcement;
            bool IsValidConfinementReinforcementType = Enum.TryParse(ConfinementReinforcementType, true, out ConfinementReinforcement);

            if (IsValidConfinementReinforcementType == false)
            {
                throw new Exception("Failed to convert string. ConfinementReinforcementType. Please check input");
            }

            FlexuralCompressionFiberPosition p;
            bool IsValidStringFiber = Enum.TryParse(FlexuralCompressionFiberLocation, true, out p);

            if (IsValidStringFiber == false)
            {
                throw new Exception("Flexural compression fiber location is not recognized. Check input.");
            }


            CalcLog log = new CalcLog();

            if (ConcreteSection.FlexuralSection is IConcreteSectionWithLongitudinalRebar)
            {
                IConcreteSectionWithLongitudinalRebar Section = (IConcreteSectionWithLongitudinalRebar)ConcreteSection.FlexuralSection;
                ConcreteSectionCompression            column  = new ConcreteSectionCompression(Section, ConfinementReinforcement, log);
                //Convert axial force to pounds
                double P_u_pounds = P_u * 1000.0;
                phiM_n = column.GetDesignMomentWithCompressionStrength(P_u_pounds, p).phiM_n / 1000.0; // convert to kip inch units
            }
            else
            {
                throw new Exception("Section of wrong type. Create a section type that has longitudinal bars as part of definition.");
            }

            return(phiM_n);
        }