Add rebar section logic

This commit is contained in:
RedikultsevEvg
2025-07-16 00:27:44 +05:00
parent 43c78729f0
commit 0addeda339
17 changed files with 478 additions and 48 deletions

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
/// <summary>
/// Implements properies of cross-section of reinforcement bar
/// </summary>
public interface IRebarSection : ISaveable, ICloneable
{
/// <summary>
/// Material of rebar
/// </summary>
IReinforcementLibMaterial Material { get; set; }
/// <summary>
/// Diameter of rebar
/// </summary>
double Diameter { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
namespace StructureHelperLogics.Models.Materials
{
public interface IRebarSectionStrengthLogic : ILogic
{
IRebarSection RebarSection { get; set; }
IShiftTraceLogger? TraceLogger { get; set; }
double GetRebarMaxTensileForce();
}
}

View File

@@ -0,0 +1,41 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
public class RebarSectionStrengthLogic : IRebarSectionStrengthLogic
{
public double RebarStrengthFactor { get; set; } = 1;
public double MaxRebarStrength { get; set; } = double.PositiveInfinity;
/// <summary>
/// Limit state, default - ULS
/// </summary>
public LimitStates LimitState { get; set; } = LimitStates.ULS;
/// <summary>
/// Calc term, default - short term
/// </summary>
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
public IRebarSection RebarSection { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetRebarMaxTensileForce()
{
double rebarArea = Math.PI * RebarSection.Diameter * RebarSection.Diameter / 4;
TraceLogger?.AddMessage($"Rebar area = {rebarArea}(m2)");
double materialStrength = RebarSection.Material.GetStrength(LimitState, CalcTerm).Tensile;
TraceLogger?.AddMessage($"Stirrup material strength Rsw = {materialStrength}");
double rebarStrength = RebarStrengthFactor * materialStrength;
TraceLogger?.AddMessage($"Strength of rebar Rs = {RebarStrengthFactor} * {materialStrength} = {rebarStrength}(Pa)");
double minimizedStrength = Math.Min(rebarStrength, MaxRebarStrength);
TraceLogger?.AddMessage($"Strength of rebar Rs = Min({rebarStrength}, {MaxRebarStrength})= {minimizedStrength}(Pa)");
double rebarForce = minimizedStrength * rebarArea;
TraceLogger?.AddMessage($"Force in rebar Ns = {minimizedStrength}(Pa) * {rebarArea}(m2) = {rebarForce}");
return rebarForce;
}
}
}

View File

@@ -0,0 +1,18 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
namespace StructureHelperLogics.Models.Materials
{
public class RebarSectionUpdateStrategy : IUpdateStrategy<IRebarSection>
{
public void Update(IRebarSection targetObject, IRebarSection sourceObject)
{
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
CheckObject.IsNull(sourceObject.Material);
targetObject.Material = sourceObject.Material.Clone() as IReinforcementLibMaterial;
targetObject.Diameter = sourceObject.Diameter;
}
}
}

View File

@@ -0,0 +1,52 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
/// <inheritdoc/>
public class RebarSection : IRebarSection
{
private const double minRebarDiameter = 0.001;
private const double maxRebarDiameter = 0.050;
private double diameter;
/// <inheritdoc/>
public Guid Id { get;}
/// <inheritdoc/>
public IReinforcementLibMaterial Material { get; set; }
/// <inheritdoc/>
public double Diameter
{
get => diameter; set
{
if (value < minRebarDiameter)
{
throw new StructureHelperException($"Diameter of stirrup must not be less than {minRebarDiameter * 1000}mm, but was {value}");
}
if (value > maxRebarDiameter)
{
throw new StructureHelperException($"Diameter of stirrup must be less or equal than {maxRebarDiameter * 1000}mm, but was {value}");
}
diameter = value;
}
}
public RebarSection(Guid id)
{
Id = id;
Diameter = 0.008;
Material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400).HelperMaterial as IReinforcementLibMaterial;
}
public object Clone()
{
var newItem = new RebarSection(Guid.NewGuid());
var logic = new RebarSectionUpdateStrategy();
logic.Update(newItem, this);
return newItem;
}
}
}