public static SectionI Design(HndzAnalysisResults resultStart, HndzAnalysisResults resultEnd, SectionI S, double _LUnsupported, double _LbInPlan, double kFactor, double _LbOutPlan, SteelGrade Grade, LoadingType Case, SwayCondtion Sway) { // List<SectionI> ColumnSections = new List<SectionI>(); // Column.AnalysisResults. // SectionI S = CrossSectionCalulator.CalculateSection(CrossSectionCalulator.SteelGrade.st37, resultEnd, 9.5); // SectionI End = CrossSectionCalulator.CalculateSection(CrossSectionCalulator.SteelGrade.st37, resultEnd, 9.5); // SectionI s = new SectionI("x", 50, 28, 28, 1.4, 1.4, 0.8); BeamColumnDesignerBuiltUp.initDesigner(Grade, Case, _LUnsupported, _LbInPlan, _LbOutPlan, S, resultStart, resultEnd); do { bool a = BeamColumnDesignerBuiltUp.CheckIfWebComapact(); bool b = BeamColumnDesignerBuiltUp.CheckIfFlangIsCompact(); if (!WebIsCompact) { S.d = S.d * 1.05; S.t_w = S.t_w * 1.05; BeamColumnDesignerBuiltUp.CheckIfWebComapact(); } if (!FlangIsCompact) { S.t_fTop = S.t_fTop * 1.05; S.b_fTop = S.b_fTop * 1.05; S.t_fBot = S.t_fBot * 1.05; S.b_fBot = S.b_fBot * 1.05; BeamColumnDesignerBuiltUp.CheckIfFlangIsCompact(); } // BeamColumnDesignerBuiltUp.CheckIfSectionIsCompact(); } while (!SectionIsCompact); BeamColumnDesignerBuiltUp.CheckColumnBuckling(kFactor); BeamColumnDesignerBuiltUp.CheckLateralTortionalBuckling(_LUnsupported); BeamColumnDesignerBuiltUp.CheckAllowableStresses(Sway); if (!BeamColumnDesignerBuiltUp.CheckAllowableStresses(Sway)) { Design(resultStart, resultEnd, S, _LUnsupported, _LbInPlan, kFactor, _LbOutPlan, Grade, Case, Sway); } return(S); }

public static bool CheckAllowableStresses(SwayCondtion Sway) { double Cm; double A1 = 0; double A2 = 0; double AlphaMoment = Math.Min(MxAtStationStart, MxAtStationEnd) / Math.Max(MxAtStationStart, MxAtStationEnd); if (LmdaMax <= 100) { Fc = FcP1 - FcP2 * LmdaMax * LmdaMax; } else { Fc = 7500 / (LmdaMax * LmdaMax); } double FcaFc = Fca / Fc; double Fex = 7500 / (LmdaIn * LmdaIn); double Fey = 7500 / (LmdaOut * LmdaOut); if (FcaFc < 0.15) { A1 = 1; A2 = 1; } else { switch (Sway) { case SwayCondtion.PermitedToSway: Cm = 0.85; A1 = Cm / (1 - (Fca / Fex)); A2 = Cm / (1 - (Fca / Fey)); break; case SwayCondtion.PreventedFromSway: Cm = 0.6 - (0.4 * AlphaMoment); if (Cm < 0.4) { Cm = 0.4; } A1 = Cm / (1 - (Fca / Fex)); A2 = Cm / (1 - (Fca / Fey)); break; } } double fbxActual = (MxAtStationEnd * 100) / Zx; double fbyActual = (MyAtStationEnd * 100) / Zy; //double Fbcy; //double Fbcx; //if (!SectionCompact) //{ // Fbcy = 0.58 * Fy; // Fbcx = 0.64 * Fy; //} //else //{ // Fbcy = 0.72 * Fy; // Fbcx = 0.58 * Fy; //} double stress = (Fca / Fc) + ((fbyActual / Fbcy) * A2) + ((fbxActual / Fbcx) * A1); if (stress < CaseStress) { return(SectionIsSafe = true); } else { return(SectionIsSafe = false); } }

public static SectionI DesignStart(double d, double t_w, double b_fTop, double t_fTop, double b_fBot, double t_fBot, double axial, double moment31, double moment32, object fy, int v1, int v2, double v3, int v4, SwayCondtion permitedToSway, SteelGrade st37, LoadingType case2) { throw new NotImplementedException(); }

public static SectionI DesignEnd(double WebHeight, double WebThickness, double FlangTopWidth, double FlangTopThickness, double FlangBotWidth, double FlangBotThickness, double AxialForce, double MxStart, double MxEnd, double Fy, double LUnsupported, double Kfactor, double LbInPlan, double LbOutPlan, SwayCondtion Sway, SteelGrade Grade, LoadingType Case) { SectionI Final; double NewWebHeight = WebHeight; double NewWebThickness = WebThickness; double NewFlangTopWidth = FlangTopWidth; double NewFlangBotWidth = FlangBotWidth; double NewFlangTopThickness = FlangTopThickness; double NewFlangBotThickness = FlangBotThickness; //================= double Fbcx; double Fbcy; //=================== double LmdaIn; double LmdaOut; double LmdaMax; //===================== double Stress; //==================== bool SafeForLocalBuckling; bool SafeForStress; //============================= //Section Parameters //===== double CaseStress; //==================== //==================== bool webCompact = CheckIFWebCompactFixed(WebHeight, WebThickness, FlangTopWidth, FlangTopThickness, AxialForce, MxEnd, Fy); bool flangCompact = CheckIfFlangisCompactFixed(FlangTopWidth, FlangTopThickness, WebThickness, Fy); while (!webCompact || !flangCompact) { if (!webCompact) { IncreaseWebThicknessFixed(WebThickness, out NewWebThickness); WebThickness = NewWebThickness; webCompact = CheckIFWebCompactFixed(WebHeight, WebThickness, AxialForce, FlangTopWidth, FlangTopThickness, MxEnd, Fy); } if (!flangCompact) { IncreaseFlangThicknessFixed(FlangTopThickness, FlangBotThickness, out NewFlangTopThickness, out NewFlangBotThickness); FlangTopThickness = NewFlangTopThickness; FlangBotThickness = NewFlangBotThickness; flangCompact = CheckIfFlangisCompactFixed(FlangTopWidth, FlangTopThickness, WebThickness, Fy); } } double Area = ((2 * FlangTopThickness * FlangTopWidth) + (WebThickness * WebHeight)); double Ix = ((WebHeight * WebHeight * WebHeight * WebThickness) / 12) + (2 * FlangTopWidth * FlangTopThickness * (((WebHeight / 2) + (FlangTopThickness / 2)) * ((WebHeight / 2) + (FlangTopThickness / 2)))); double Iy = ((2 * FlangTopWidth * FlangTopWidth * FlangTopWidth * FlangTopThickness) / 12); double Zx = (Ix / ((WebHeight / 2) + FlangTopThickness)); double Zy = (Iy / (FlangTopWidth / 2)); double Rx = Math.Sqrt(Ix / Area); double Ry = Math.Sqrt(Iy / Area); CheckLateralTortionalBucklingFixed(LUnsupported, MxStart, MxEnd, Fy, WebHeight, WebThickness, FlangTopWidth, FlangTopThickness, true, out Fbcx, out Fbcy); SafeForLocalBuckling = CheckColumnBuckling(Kfactor, LbInPlan, LbOutPlan, Rx, Ry, out LmdaIn, out LmdaOut, out LmdaMax); SafeForStress = CheckAllowableStresses(Sway, Grade, Case, MxStart, MxEnd, AxialForce, LmdaIn, LmdaOut, LmdaMax, Area, Zx, Zy, Fbcx, Fbcy, out Stress); while (!SafeForLocalBuckling) { if (!SafeForLocalBuckling) { if (LmdaIn > 180) { IncreaseWebHeightFixed(WebHeight, out NewWebHeight); WebHeight = NewWebHeight; Area = ((2 * FlangTopThickness * FlangTopWidth) + (WebThickness * WebHeight)); Ix = ((WebHeight * WebHeight * WebHeight * WebThickness) / 12) + (2 * FlangTopWidth * FlangTopThickness * (((WebHeight / 2) + (FlangTopThickness / 2)) * ((WebHeight / 2) + (FlangTopThickness / 2)))); Iy = ((2 * FlangTopWidth * FlangTopWidth * FlangTopWidth * FlangTopThickness) / 12); Zx = (Ix / ((WebHeight / 2) + FlangTopThickness)); Zy = (Iy / (FlangTopWidth / 2)); Rx = Math.Sqrt(Ix / Area); Ry = Math.Sqrt(Iy / Area); } else if (LmdaOut > 180) { IncreaseFlangWidthFixed(FlangTopWidth, FlangBotWidth, out NewFlangTopWidth, out NewFlangBotWidth); FlangTopWidth = NewFlangTopWidth; FlangBotWidth = NewFlangBotWidth; Area = ((2 * FlangTopThickness * FlangTopWidth) + (WebThickness * WebHeight)); Ix = ((WebHeight * WebHeight * WebHeight * WebThickness) / 12) + (2 * FlangTopWidth * FlangTopThickness * (((WebHeight / 2) + (FlangTopThickness / 2)) * ((WebHeight / 2) + (FlangTopThickness / 2)))); Iy = ((2 * FlangTopWidth * FlangTopWidth * FlangTopWidth * FlangTopThickness) / 12); Zx = (Ix / ((WebHeight / 2) + FlangTopThickness)); Zy = (Iy / (FlangTopWidth / 2)); Rx = Math.Sqrt(Ix / Area); Ry = Math.Sqrt(Iy / Area); } SafeForLocalBuckling = CheckColumnBuckling(Kfactor, LbInPlan, LbOutPlan, Rx, Ry, out LmdaIn, out LmdaOut, out LmdaMax); SafeForStress = CheckAllowableStresses(Sway, Grade, Case, MxStart, MxEnd, AxialForce, LbInPlan, LmdaOut, LmdaMax, Area, Zx, Zy, Fbcx, Fbcy, out Stress); } } while (!SafeForStress) { IncreaseFlangWidthFixed(FlangTopWidth, FlangBotWidth, out NewFlangTopWidth, out NewFlangBotWidth); FlangTopWidth = NewFlangTopWidth; FlangBotWidth = NewFlangBotWidth; IncreaseWebHeightFixed(WebHeight, out NewWebHeight); WebHeight = NewWebHeight; IncreaseWebThicknessFixed(WebThickness, out NewWebThickness); WebThickness = NewWebThickness; IncreaseFlangThicknessFixed(FlangTopThickness, FlangBotThickness, out NewFlangTopThickness, out NewFlangBotThickness); FlangTopThickness = NewFlangTopThickness; FlangBotThickness = NewFlangBotThickness; Area = ((2 * FlangTopThickness * FlangTopWidth) + (WebThickness * WebHeight)); Ix = ((WebHeight * WebHeight * WebHeight * WebThickness) / 12) + (2 * FlangTopWidth * FlangTopThickness * (((WebHeight / 2) + (FlangTopThickness / 2)) * ((WebHeight / 2) + (FlangTopThickness / 2)))); Iy = ((2 * FlangTopWidth * FlangTopWidth * FlangTopWidth * FlangTopThickness) / 12); Zx = (Ix / ((WebHeight / 2) + FlangTopThickness)); Zy = (Iy / (FlangTopWidth / 2)); Rx = Math.Sqrt(Ix / Area); Ry = Math.Sqrt(Iy / Area); SafeForLocalBuckling = CheckColumnBuckling(Kfactor, LbInPlan, LbOutPlan, Rx, Ry, out LmdaIn, out LmdaOut, out LmdaMax); SafeForStress = CheckAllowableStresses(Sway, Grade, Case, MxStart, MxEnd, AxialForce, LbInPlan, LmdaOut, LmdaMax, Area, Zx, Zy, Fbcx, Fbcy, out Stress); } return(Final = new SectionI("BeamColumn", WebHeight, FlangTopWidth, FlangBotWidth, FlangTopThickness, FlangBotThickness, WebThickness)); }

public static bool CheckAllowableStresses(SwayCondtion Sway, SteelGrade Grade, LoadingType Case, double MxStart, double MxEnd, double AxialForce, double LmdaIn, double LmdaOut, double LmdaMax, double Area, double Zx, double Zy, double Fbcx, double Fbcy, out double Stress) { bool SectionSafe; double Cm; double A1 = 0; double A2 = 0; double Fc; double FcP1 = 0; double FcP2 = 0; double Fca = AxialForce / Area; double CaseStress = 0; switch (Case) { case LoadingType.Case1: CaseStress = 1.0; break; case LoadingType.Case2: CaseStress = 1.2; break; } double AlphaMoment = Math.Min(MxStart, MxEnd) / Math.Max(MxStart, MxEnd); if (LmdaMax <= 100) { switch (Grade) { case SteelGrade.st37: FcP1 = 1.4; FcP2 = 0.000065; break; case SteelGrade.st44: FcP1 = 1.6; FcP2 = 0.000085; break; case SteelGrade.st52: FcP1 = 2.1; FcP2 = 0.000135; break; } Fc = FcP1 - FcP2 * LmdaMax * LmdaMax; } else { Fc = 7500 / (LmdaMax * LmdaMax); } double FcaFc = Fca / Fc; double Fex = 7500 / (LmdaIn * LmdaIn); double Fey = 7500 / (LmdaOut * LmdaOut); if (FcaFc < 0.15) { A1 = 1; A2 = 1; } else { switch (Sway) { case SwayCondtion.PermitedToSway: Cm = 0.85; A1 = Cm / (1 - (Fca / Fex)); A2 = Cm / (1 - (Fca / Fey)); break; case SwayCondtion.PreventedFromSway: Cm = 0.6 - (0.4 * AlphaMoment); if (Cm < 0.4) { Cm = 0.4; } A1 = Cm / (1 - (Fca / Fex)); A2 = Cm / (1 - (Fca / Fey)); break; } } double fbxActual = (MxEnd * 100) / Zx; Stress = (Fca / Fc) + ((fbxActual / Fbcx) * A1); if (Stress < CaseStress) { return(SectionSafe = true); } else { return(SectionSafe = false); } }

public static bool CheckAllowableStresses(SwayCondtion Sway, SteelGrade Grade) { double FcP1 = 0; double FcP2 = 0; switch (Grade) { case SteelGrade.st37: FcP1 = 1.4; FcP2 = 0.000065; break; case SteelGrade.st44: FcP1 = 1.6; FcP2 = 0.000085; break; case SteelGrade.st52: FcP1 = 2.1; FcP2 = 0.000135; break; default: break; } double A1 = 0; double A2 = 0; double Cm = 0; double AlphaMoment = Math.Min(MxAtStationStart, MxAtStationEnd) / Math.Max(MxAtStationStart, MxAtStationEnd); if (LmdaMax <= 100) { Fc = FcP1 - FcP2 * LmdaMax * LmdaMax; } else { Fc = 7500 / (LmdaMax * LmdaMax); } double FcaFc = Fca / Fc; double Fex = 7500 / (LmdaIn * LmdaIn); double Fey = 7500 / (LmdaOut * LmdaOut); if (FcaFc < 0.15) { A1 = 1; A2 = 1; } else { switch (Sway) { case SwayCondtion.PermitedToSway: Cm = 0.85; A1 = Cm / (1 - (Fca / Fex)); A2 = Cm / (1 - (Fca / Fey)); break; case SwayCondtion.PreventedFromSway: Cm = 0.6 - (0.4 * AlphaMoment); if (Cm < 0.4) { Cm = 0.4; } A1 = Cm / (1 - (Fca / Fex)); A2 = Cm / (1 - (Fca / Fey)); break; } } double fbxActual = (MxAtStationStart * 100) / Zx; double fbyActual = (MyAtStationStart * 100) / Zy; Stress = (Fca / Fc) + ((fbyActual / Fbcy) * A2) + ((fbxActual / Fbcx) * A1); if (Stress < CaseStress) { return(SectionIsSafe = true); } else { return(SectionIsSafe = false); } }