Add circle shape calculation for shear

This commit is contained in:
RedikultsevEvg
2025-07-20 21:45:07 +05:00
parent ddf075bffd
commit 6e8f4bcc58
40 changed files with 488 additions and 99 deletions

View File

@@ -5,11 +5,11 @@ namespace StructureHelperLogics.Models.BeamShears
/// <inheritdoc>
public class BeamShearDesignRangeProperty : IBeamShearDesignRangeProperty
{
private const int minStepCount = 0;
private const int minStepCount = 10;
private const int maxStepCount = 1000;
private double absoluteRangeValue = 0.0;
private double relativeEffectiveDepthRangeValue = 3.0;
private int stepCount = 50;
private double relativeEffectiveDepthRangeValue = 3.3;
private int stepCount = 55;
/// <inheritdoc>
public Guid Id { get; }

View File

@@ -28,7 +28,9 @@ namespace StructureHelperLogics.Models.BeamShears
public object Clone()
{
BeamShearSection newItem = new(Guid.NewGuid());
var cloneStrategy = new ShapeCloneStrategy();
IShape shapeClone = cloneStrategy.GetClone(Shape);
BeamShearSection newItem = new(Guid.NewGuid()) { Shape = shapeClone};
updateStrategy ??= new BeamShearSectionUpdateStrategy();
updateStrategy.Update(newItem, this);
return newItem;

View File

@@ -1,8 +1,10 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Forces.BeamShearActions;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -12,6 +14,7 @@ namespace StructureHelperLogics.Models.BeamShears
public enum ShearSectionTemplateTypes
{
Rectangle,
Circle
}
public static class BeamShearTemplatesFactory
{
@@ -21,23 +24,46 @@ namespace StructureHelperLogics.Models.BeamShears
{
return GetRectangleSection();
}
if (templateType is ShearSectionTemplateTypes.Circle)
{
return GetCircleSection();
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(templateType));
}
}
private static IBeamShearRepository GetCircleSection()
{
BeamShearSection section = new(Guid.NewGuid())
{
Name = "New circle section",
Shape = new CircleShape(Guid.NewGuid()) { Diameter = 0.6},
};
return BuildRepository(section);
}
private static IBeamShearRepository GetRectangleSection()
{
BeamShearSection section = new(Guid.NewGuid())
{
Name = "New rectangle section",
Shape = new RectangleShape(Guid.NewGuid()) { Height = 0.6, Width = 0.4 },
};
return BuildRepository(section);
}
private static IBeamShearRepository BuildRepository(BeamShearSection section)
{
BeamShearRepository shearRepository = new(Guid.Empty);
IBeamShearAction shearAction = BeamShearActionFactory.GetBeamShearAction(ShearActionTypes.DistributedLoad);
shearAction.Name = "New shear action";
shearRepository.Actions.Add(shearAction);
BeamShearSection section = new(Guid.NewGuid()) { Name = "New shear section"};
shearRepository.Sections.Add(section);
StirrupByRebar stirrupByUniformRebar = new(Guid.NewGuid()) { Name = "New uniform stirrup"};
StirrupByRebar stirrupByUniformRebar = new(Guid.NewGuid()) { Name = "New uniform stirrup" };
shearRepository.Stirrups.Add(stirrupByUniformRebar);
BeamShearCalculator beamShearCalculator = new(Guid.NewGuid()) { Name = "New shear calculator"};
BeamShearCalculator beamShearCalculator = new(Guid.NewGuid()) { Name = "New shear calculator" };
beamShearCalculator.InputData.Sections.Add(section);
beamShearCalculator.InputData.Stirrups.Add(stirrupByUniformRebar);
beamShearCalculator.InputData.Actions.Add(shearAction);

View File

@@ -9,7 +9,7 @@ namespace StructureHelperLogics.Models.BeamShears
{
public static class SectionEffectivenessFactory
{
public static ISectionEffectiveness GetSheaEffectiveness(BeamShearSectionType sectionType)
public static ISectionEffectiveness GetShearEffectiveness(BeamShearSectionType sectionType)
{
if (sectionType == BeamShearSectionType.Rectangle)
{

View File

@@ -36,7 +36,8 @@ namespace StructureHelperLogics.Models.BeamShears
{
MaxCrackLengthRatio = 1.5,
StirrupPlacementFactor = 0.75,
StirrupShapeFactor = 0.5
StirrupShapeFactor = 0.5,
MinimumStirrupRatio = 0.1
};
return stirrupEffectiveness;
}
@@ -47,7 +48,8 @@ namespace StructureHelperLogics.Models.BeamShears
{
MaxCrackLengthRatio = 2,
StirrupPlacementFactor = 0.75,
StirrupShapeFactor = 1
StirrupShapeFactor = 1,
MinimumStirrupRatio = 0.25
};
return stirrupEffectiveness;
}

View File

@@ -23,5 +23,9 @@ namespace StructureHelperLogics.Models.BeamShears
/// Factor of difference between real and uniform distribution
/// </summary>
double StirrupPlacementFactor { get; set; }
/// <summary>
/// Minimum ratio of density of stirrup to density of concrete
/// </summary>
double MinimumStirrupRatio { get; set; }
}
}

View File

@@ -1,7 +1,9 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.BeamShears.Logics;
namespace StructureHelperLogics.Models.BeamShears
@@ -72,7 +74,8 @@ namespace StructureHelperLogics.Models.BeamShears
double concreteStrength = concreteLogic.GetShearStrength();
double stirrupStrength = stirrupLogic.GetShearStrength();
if (stirrupStrength > concreteStrength)
{
{
localTraceLogger?.AddMessage($"Shear reinforcement strength Qsw = {stirrupStrength} is greater than concrete strength for shear Qb = {concreteStrength}, shear reinforcement strength has to be restricted.");
stirrupStrength = GetStirrupStrengthBySearch();
}
concreteStrength *= factorOfLongitudinalForce;
@@ -103,7 +106,7 @@ namespace StructureHelperLogics.Models.BeamShears
private double GetStirrupStrengthBySearch()
{
var logic = new StirrupBySearchLogic(TraceLogger)
var logic = new StirrupBySearchLogic(localTraceLogger.GetSimilarTraceLogger(100))
{
InputData = InputData,
SectionEffectiveness = sectionEffectiveness
@@ -115,7 +118,18 @@ namespace StructureHelperLogics.Models.BeamShears
private void InitializeStrategies()
{
sectionEffectiveness = SectionEffectivenessFactory.GetSheaEffectiveness(BeamShearSectionType.Rectangle);
if (InputData.InclinedSection.BeamShearSection.Shape is IRectangleShape)
{
sectionEffectiveness = SectionEffectivenessFactory.GetShearEffectiveness(BeamShearSectionType.Rectangle);
}
else if (InputData.InclinedSection.BeamShearSection.Shape is ICircleShape)
{
sectionEffectiveness = SectionEffectivenessFactory.GetShearEffectiveness(BeamShearSectionType.Circle);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(InputData.InclinedSection.BeamShearSection.Shape));
}
concreteLogic = new(sectionEffectiveness, InputData.InclinedSection, localTraceLogger);
stirrupLogic = new(InputData, localTraceLogger);
getLongitudinalForceFactorLogic = new GetLongitudinalForceFactorLogic(localTraceLogger?.GetSimilarTraceLogger(100));

View File

@@ -3,33 +3,45 @@ using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Models.Shapes.Logics;
using StructureHelperCommon.Services;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.BeamShears
{
public class BeamShearSectionUpdateStrategy : IUpdateStrategy<IBeamShearSection>
public class BeamShearSectionUpdateStrategy : IParentUpdateStrategy<IBeamShearSection>
{
private IUpdateStrategy<IShape> shapeUpdateStrategy;
private IUpdateStrategy<IConcreteLibMaterial> concreteUpdateStrategy;
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementUpdateStrategy;
public bool UpdateChildren { get; set; } = true;
public void Update(IBeamShearSection targetObject, IBeamShearSection sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
Check(targetObject, sourceObject);
InitializeStrategies();
targetObject.Name = sourceObject.Name;
targetObject.ReinforcementArea = sourceObject.ReinforcementArea;
shapeUpdateStrategy.Update(targetObject.Shape, sourceObject.Shape);
targetObject.ConcreteMaterial ??= new ConcreteLibMaterial();
concreteUpdateStrategy.Update(targetObject.ConcreteMaterial, sourceObject.ConcreteMaterial);
targetObject.ReinforcementMaterial ??= new ReinforcementLibMaterial(Guid.NewGuid());
reinforcementUpdateStrategy.Update(targetObject.ReinforcementMaterial, sourceObject.ReinforcementMaterial);
targetObject.CenterCover = sourceObject.CenterCover;
if (UpdateChildren)
{
shapeUpdateStrategy.Update(targetObject.Shape, sourceObject.Shape);
targetObject.ConcreteMaterial ??= new ConcreteLibMaterial(Guid.NewGuid());
concreteUpdateStrategy.Update(targetObject.ConcreteMaterial, sourceObject.ConcreteMaterial);
targetObject.ReinforcementMaterial ??= new ReinforcementLibMaterial(Guid.NewGuid());
reinforcementUpdateStrategy.Update(targetObject.ReinforcementMaterial, sourceObject.ReinforcementMaterial);
}
}
private static void Check(IBeamShearSection targetObject, IBeamShearSection sourceObject)
{
CheckObject.IsNull(sourceObject.Shape, "Source object shape");
CheckObject.IsNull(targetObject.Shape, "Target object shape");
CheckObject.IsNull(sourceObject.ConcreteMaterial, "Source concrete material");
CheckObject.IsNull(targetObject.ConcreteMaterial, "Target concrete material");
CheckObject.IsNull(sourceObject.ReinforcementMaterial, "Source reinforcement material");
CheckObject.IsNull(targetObject.ReinforcementMaterial, "Target reinforcement material");
}
private void InitializeStrategies()

View File

@@ -9,6 +9,7 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
private const double minValueOfCenterCover = 0.01;
private const double minValueOfCrossSectionWidth = 0.05;
private const double minValueOfCrossSectionHeight = 0.05;
private const double minCircleDiameter = 0.05;
private bool result;
private string checkResult;
@@ -63,6 +64,10 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
{
CheckRectangleShape(rectangle);
}
else if (Entity.Shape is ICircleShape circle)
{
CheckCircleShape(circle);
}
else
{
result = false;
@@ -71,6 +76,15 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
}
}
private void CheckCircleShape(ICircleShape circle)
{
if (circle.Diameter < minCircleDiameter)
{
result = false;
TraceMessage($"\nValue of cross-section diameter D = {circle.Diameter}(m) must not be less than bmin = {minCircleDiameter}(m)");
}
}
private void CheckRectangleShape(IRectangleShape rectangle)
{
if (rectangle.Width < minValueOfCrossSectionWidth)

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.Models.BeamShears
/// <inheritdoc/>
public class StirrupByDensityStrengthLogic : IBeamShearStrenghLogic
{
private const double minStirrupRatio = 0.25;
//private const double minStirrupRatio = 0.25;
private readonly IStirrupEffectiveness stirrupEffectiveness;
private readonly IStirrupByDensity stirrupByDensity;
private readonly IInclinedSection inclinedSection;
@@ -45,9 +45,10 @@ namespace StructureHelperLogics.Models.BeamShears
double finalDensity = stirrupEffectiveness.StirrupShapeFactor * stirrupEffectiveness.StirrupPlacementFactor * stirrupByDensity.StirrupDensity;
TraceLogger?.AddMessage($"Stirrups design density qsw = {stirrupEffectiveness.StirrupShapeFactor} * {stirrupEffectiveness.StirrupPlacementFactor} * {stirrupByDensity.StirrupDensity} = {finalDensity}(N/m)");
double concreteDensity = inclinedSection.WebWidth * inclinedSection.ConcreteTensionStrength;
if (finalDensity < minStirrupRatio * concreteDensity)
double minFinalDensity = stirrupEffectiveness.MinimumStirrupRatio * concreteDensity;
if (finalDensity < minFinalDensity)
{
TraceLogger?.AddMessage($"Since stirrups design density qsw = {finalDensity}(N/m) less than {minStirrupRatio} * {concreteDensity}, final density is equal to zero", TraceLogStatuses.Warning);
TraceLogger?.AddMessage($"Since stirrups design density qsw = {finalDensity}(N/m) less than qsw,min = {stirrupEffectiveness.MinimumStirrupRatio} * {concreteDensity} = {minFinalDensity}(N/m), final density is equal to zero", TraceLogStatuses.Warning);
finalDensity = 0;
}
double strength = finalDensity * finalCrackLength;

View File

@@ -35,12 +35,12 @@ namespace StructureHelperLogics.Models.BeamShears
GetGeometry();
if (inclinedSection.StartCoord > rebarEndPoint)
{
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is greater than inclined rebar end point x = {rebarEndPoint}, inclined rebar has been ignored");
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is greater than inclined rebar end point X = {rebarEndPoint}, inclined rebar has been ignored");
return 0.0;
}
if (inclinedSection.EndCoord < rebarStartPoint)
{
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is less than inclined rebar start point x = {rebarStartPoint}, inclined rebar has been ignored");
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is less than inclined rebar start point X = {rebarStartPoint}, inclined rebar has been ignored");
return 0.0;
}
if (inclinedSection.StartCoord > rebarTrueEndPoint & inclinedSection.StartCoord < rebarEndPoint)

View File

@@ -8,29 +8,32 @@ namespace StructureHelperLogics.Models.BeamShears
{
private ConcreteStrengthLogic concreteLogic;
private StirrupStrengthLogic stirrupLogic;
private ShiftTraceLogger? localTraceLogger { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public IBeamShearSectionLogicInputData InputData { get; internal set; }
public ISectionEffectiveness SectionEffectiveness { get; internal set; }
public StirrupBySearchLogic(IShiftTraceLogger? traceLogger)
{
TraceLogger = traceLogger;
}
public IShiftTraceLogger? TraceLogger { get; set; }
public IBeamShearSectionLogicInputData InputData { get; internal set; }
public ISectionEffectiveness SectionEffectiveness { get; internal set; }
public double GetShearStrength()
{
double parameter = GetParameter();
BeamShearSectionLogicInputData newInputData = GetNewInputData(parameter);
stirrupLogic = new(newInputData, localTraceLogger);
double parameter = GetInclinedCrackRatio();
BeamShearSectionLogicInputData newInputData = GetNewInputDataByCrackLengthRatio(parameter);
TraceLogger?.AddMessage($"New value of dangerous inclinated crack has been obtained: start point Xstart = {newInputData.InclinedSection.StartCoord}(m), end point Xend = {newInputData.InclinedSection.EndCoord}(m)");
stirrupLogic = new(newInputData, TraceLogger);
double stirrupStrength = stirrupLogic.GetShearStrength();
return stirrupStrength;
}
public double GetParameter()
/// <summary>
/// Calculates ratio of inclined crack length to inclined section length
/// </summary>
/// <returns></returns>
/// <exception cref="StructureHelperException"></exception>
private double GetInclinedCrackRatio()
{
var parameterCalculator = new FindParameterCalculator(TraceLogger);
var parameterCalculator = new FindParameterCalculator();
parameterCalculator.InputData.Predicate = GetPredicate;
parameterCalculator.Accuracy.IterationAccuracy = 0.0001d;
parameterCalculator.Accuracy.MaxIterationCount = 1000;
@@ -40,24 +43,32 @@ namespace StructureHelperLogics.Models.BeamShears
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate error");
}
var result = parameterCalculator.Result as FindParameterResult;
var parameter = result.Parameter;
return parameter;
var crackLengthRatio = result.Parameter;
while (GetPredicate(crackLengthRatio) == false)
{
crackLengthRatio += 0.0001;
}
return crackLengthRatio;
}
private bool GetPredicate(double factor)
/// <summary>
/// Predicate of comparing of stirrup strength and concrete strength
/// </summary>
/// <param name="crackLengthRatio">Ratio of inclined crack length and inclined section length</param>
/// <returns>Is true when stirrup strength is greate than concrete strength</returns>
private bool GetPredicate(double crackLengthRatio)
{
BeamShearSectionLogicInputData newInputData = GetNewInputData(factor);
concreteLogic = new(SectionEffectiveness, newInputData.InclinedSection, localTraceLogger);
stirrupLogic = new(newInputData, localTraceLogger);
BeamShearSectionLogicInputData newInputData = GetNewInputDataByCrackLengthRatio(crackLengthRatio);
concreteLogic = new(SectionEffectiveness, newInputData.InclinedSection, null);
stirrupLogic = new(newInputData, null);
double concreteStrength = concreteLogic.GetShearStrength();
double stirrupStrength = stirrupLogic.GetShearStrength();
return stirrupStrength > concreteStrength;
}
private BeamShearSectionLogicInputData GetNewInputData(double factor)
private BeamShearSectionLogicInputData GetNewInputDataByCrackLengthRatio(double crackLengthRatio)
{
double sourceCrackLength = InputData.InclinedSection.EndCoord - InputData.InclinedSection.StartCoord;
double newCrackLength = sourceCrackLength * factor;
double newCrackLength = sourceCrackLength * crackLengthRatio;
double newStartCoord = InputData.InclinedSection.EndCoord - newCrackLength;
InclinedSection newSection = new();
var updateStrategy = new InclinedSectionUpdateStrategy();

View File

@@ -1,5 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.Models.BeamShears
{
@@ -11,6 +12,7 @@ namespace StructureHelperLogics.Models.BeamShears
private IBeamShearStrenghLogic stirrupByDensityStrengthLogic;
private IBeamShearStrenghLogic stirrupGroupStrengthLogic;
private IBeamShearStrenghLogic stirrupByInclinedRebarStrengthLogic;
private IStirrupEffectiveness stirrupEffectiveness;
public StirrupStrengthLogic(IBeamShearSectionLogicInputData inputData, IShiftTraceLogger? traceLogger)
{
@@ -22,28 +24,28 @@ namespace StructureHelperLogics.Models.BeamShears
public double GetShearStrength()
{
var stirrupEffectiveness = StirrupEffectivenessFactory.GetEffectiveness(BeamShearSectionType.Rectangle);
GetStirrupEffectiveness();
if (stirrup is IStirrupByRebar stirrupByRebar)
{
TraceLogger?.AddMessage($"Stirrups type is stirrup by rebar {stirrupByRebar.Name}");
TraceLogger?.AddMessage($"Stirrups type is stirrup by rebar Name = {stirrupByRebar.Name}");
stirrupByDensityStrengthLogic = new StirrupByRebarStrengthLogic(stirrupEffectiveness, stirrupByRebar, inclinedSection, inputData.ForceTuple, TraceLogger);
return stirrupByDensityStrengthLogic.GetShearStrength();
}
else if (stirrup is IStirrupGroup stirrupGroup)
{
TraceLogger?.AddMessage($"Stirrups type is stirrupGroup {stirrupGroup.Name}");
TraceLogger?.AddMessage($"Stirrups type is stirrup group Name = {stirrupGroup.Name}");
stirrupGroupStrengthLogic ??= new StirrupGroupStrengthLogic(inputData, stirrupGroup, TraceLogger);
return stirrupGroupStrengthLogic.GetShearStrength();
}
else if (stirrup is IStirrupByDensity stirrupByDensity)
{
TraceLogger?.AddMessage($"Stirrups type is stirrup by density {stirrupByDensity.Name}");
stirrupByDensityStrengthLogic = new StirrupByDensityStrengthLogic(stirrupEffectiveness, stirrupByDensity, inclinedSection,TraceLogger);
TraceLogger?.AddMessage($"Stirrups type is stirrup by density Name = {stirrupByDensity.Name}");
stirrupByDensityStrengthLogic = new StirrupByDensityStrengthLogic(stirrupEffectiveness, stirrupByDensity, inclinedSection, TraceLogger);
return stirrupByDensityStrengthLogic.GetShearStrength();
}
else if (stirrup is IStirrupByInclinedRebar inclinedRebar)
{
TraceLogger?.AddMessage($"Stirrups type is inclined rebar {inclinedRebar.Name}");
TraceLogger?.AddMessage($"Stirrups type is inclined rebar Name = {inclinedRebar.Name}");
stirrupByInclinedRebarStrengthLogic ??= new StirrupByInclinedRebarStrengthLogic(inclinedSection, inclinedRebar, TraceLogger);
return stirrupByInclinedRebarStrengthLogic.GetShearStrength();
}
@@ -53,5 +55,18 @@ namespace StructureHelperLogics.Models.BeamShears
}
}
private void GetStirrupEffectiveness()
{
if (inclinedSection.BeamShearSection.Shape is IRectangleShape)
{
stirrupEffectiveness = StirrupEffectivenessFactory.GetEffectiveness(BeamShearSectionType.Rectangle);
}
else if (inclinedSection.BeamShearSection.Shape is ICircleShape)
{
stirrupEffectiveness = StirrupEffectivenessFactory.GetEffectiveness(BeamShearSectionType.Circle);
}
}
}
}

View File

@@ -15,5 +15,7 @@ namespace StructureHelperLogics.Models.BeamShears
public double StirrupShapeFactor { get; set; }
/// <inheritdoc/>
public double StirrupPlacementFactor { get; set; }
/// <inheritdoc/>
public double MinimumStirrupRatio { get; set; }
}
}