Refactoring of beam shear calculation, add test for beam shea
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class GetSectionLogicFactory : IGetSectionLogicFactory
|
||||
{
|
||||
ShearCodeTypes shearCodeType;
|
||||
private IBeamShearSectionLogic sectionLogic;
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public GetSectionLogicFactory(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IBeamShearSectionLogic GetSectionLogic(ShearCodeTypes shearCodeType)
|
||||
{
|
||||
this.shearCodeType = shearCodeType;
|
||||
if (shearCodeType == ShearCodeTypes.SP_63_13330_2018_3)
|
||||
{
|
||||
GetSPLogic();
|
||||
}
|
||||
else if (shearCodeType == ShearCodeTypes.StructureHelper_0)
|
||||
{
|
||||
GetSHLogic();
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(shearCodeType) + $": design code type {shearCodeType} for shear calculation is unknown";
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
return sectionLogic;
|
||||
}
|
||||
|
||||
private void GetSHLogic()
|
||||
{
|
||||
BeamShearSectionLogic logic = GetBaseLogic();
|
||||
logic.RestrictStirrupCalculator = new RestrictStirrupBySearchCalculator();
|
||||
sectionLogic = logic;
|
||||
}
|
||||
private void GetSPLogic()
|
||||
{
|
||||
BeamShearSectionLogic logic = GetBaseLogic();
|
||||
logic.RestrictStirrupCalculator = new RestrictStirrupByValueCalculator();
|
||||
sectionLogic = logic;
|
||||
}
|
||||
|
||||
private BeamShearSectionLogic GetBaseLogic()
|
||||
{
|
||||
BeamShearSectionLogic logic = new(TraceLogger);
|
||||
logic.ShearCodeType = shearCodeType;
|
||||
logic.GetSectionEffectivenessLogic = new GetSectionEffectivenessLogic();
|
||||
return logic;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IGetSectionLogicFactory : ILogic
|
||||
{
|
||||
IBeamShearSectionLogic GetSectionLogic(ShearCodeTypes shearCodeTypes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface ISectionEffectivenessFactory
|
||||
{
|
||||
ISectionEffectiveness GetShearEffectiveness(BeamShearSectionType sectionType);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public static class SectionEffectivenessFactory
|
||||
public class SectionEffectivenessFactorySH : ISectionEffectivenessFactory
|
||||
{
|
||||
public static ISectionEffectiveness GetShearEffectiveness(BeamShearSectionType sectionType)
|
||||
public ISectionEffectiveness GetShearEffectiveness(BeamShearSectionType sectionType)
|
||||
{
|
||||
if (sectionType == BeamShearSectionType.Rectangle)
|
||||
{
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class SectionEffectivenessFactorySP2018 : ISectionEffectivenessFactory
|
||||
{
|
||||
public ISectionEffectiveness GetShearEffectiveness(BeamShearSectionType sectionType)
|
||||
{
|
||||
if (sectionType == BeamShearSectionType.Rectangle)
|
||||
{
|
||||
return GetRectangleEffectiveness();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(sectionType));
|
||||
}
|
||||
}
|
||||
|
||||
private static ISectionEffectiveness GetRectangleEffectiveness()
|
||||
{
|
||||
SectionEffectiveness sectionEffectiveness = new()
|
||||
{
|
||||
BaseShapeFactor = 1.5,
|
||||
MaxCrackLengthRatio = 3,
|
||||
MinCrackLengthRatio = 0.6,
|
||||
ShapeFactor = 1
|
||||
};
|
||||
return sectionEffectiveness;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public enum BeamShearSectionType
|
||||
{
|
||||
Rectangle,
|
||||
Circle
|
||||
Rectangle = 0,
|
||||
Circle = 1,
|
||||
TShape = 2
|
||||
}
|
||||
public static class StirrupEffectivenessFactory
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user