Add rebar section logic
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -23,5 +24,13 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// Angle of inclination of rebar in degrees
|
||||
/// </summary>
|
||||
double AngleOfInclination { get; set; }
|
||||
/// <summary>
|
||||
/// Number of legs of inclinated rebar
|
||||
/// </summary>
|
||||
double LegCount { get; set; }
|
||||
/// <summary>
|
||||
/// Cross-section of rebar
|
||||
/// </summary>
|
||||
IRebarSection RebarSection { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
checkResult += checkDensityLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
if (Entity is IStirrupByRebar rebar)
|
||||
else if (Entity is IStirrupByRebar rebar)
|
||||
{
|
||||
checkRebarLogic ??= new CheckStirrupsByRebarLogic(TraceLogger);
|
||||
checkRebarLogic.Entity = rebar;
|
||||
@@ -53,6 +53,14 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
result = false;
|
||||
checkResult += checkRebarLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
else if (Entity is IStirrupGroup stirrupGroup)
|
||||
{
|
||||
|
||||
}
|
||||
else if (Entity is IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models;
|
||||
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 StirrupByInclinedRebarStrengthLogic : IBeamShearStrenghLogic
|
||||
{
|
||||
private readonly IStirrupByInclinedRebar inclinedRebar;
|
||||
private readonly IInclinedSection inclinedSection;
|
||||
private IRebarSectionStrengthLogic rebarSectionStrengthLogic;
|
||||
private double angleInRad;
|
||||
private double rebarStartPoint;
|
||||
private double rebarHeight;
|
||||
private double rebarEndPoint;
|
||||
private double rebarTrueStartPoint;
|
||||
private double rebarTrueEndPoint;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public StirrupByInclinedRebarStrengthLogic(IInclinedSection inclinedSection, IStirrupByInclinedRebar inclinedRebar, IShiftTraceLogger traceLogger)
|
||||
{
|
||||
this.inclinedSection = inclinedSection;
|
||||
this.inclinedRebar = inclinedRebar;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
|
||||
public double GetShearStrength()
|
||||
{
|
||||
GetGeometry();
|
||||
if (inclinedSection.StartCoord > rebarTrueEndPoint)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is greater than inclined rebar true end point x = {rebarTrueEndPoint}, inclined rebar has been ignored");
|
||||
return 0.0;
|
||||
}
|
||||
if (inclinedSection.EndCoord < rebarTrueStartPoint)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is less than inclined rebar true end point x = {rebarTrueStartPoint}, inclined rebar has been ignored");
|
||||
return 0.0;
|
||||
}
|
||||
return GetInclinedRebarStrength();
|
||||
}
|
||||
|
||||
private double GetInclinedRebarStrength()
|
||||
{
|
||||
rebarSectionStrengthLogic ??= new RebarSectionStrengthLogic()
|
||||
{
|
||||
RebarStrengthFactor = 0.8,
|
||||
MaxRebarStrength = 3e8,
|
||||
LimitState = LimitStates.ULS,
|
||||
CalcTerm = CalcTerms.ShortTerm,
|
||||
TraceLogger = TraceLogger,
|
||||
};
|
||||
rebarSectionStrengthLogic.RebarSection = inclinedRebar.RebarSection;
|
||||
double rebarStrength = rebarSectionStrengthLogic.GetRebarMaxTensileForce();
|
||||
double inclinedRebarStrength = rebarStrength * Math.Sin(angleInRad) * inclinedRebar.LegCount;
|
||||
TraceLogger?.AddMessage($"Inclinated rebar {inclinedRebar.Name}, start point {rebarStartPoint}(m), end point {rebarEndPoint}(m), angle of inclination {inclinedRebar.AngleOfInclination}(deg), number of legs {inclinedRebar.LegCount}");
|
||||
TraceLogger?.AddMessage($"Force in inclined rebar = {rebarStrength}(N) * sin({inclinedRebar.AngleOfInclination}) * {inclinedRebar.LegCount} = {inclinedRebarStrength}(N)");
|
||||
return inclinedRebarStrength;
|
||||
}
|
||||
|
||||
private void GetGeometry()
|
||||
{
|
||||
angleInRad = inclinedRebar.AngleOfInclination / 180 * Math.PI;
|
||||
rebarStartPoint = inclinedRebar.StartCoordinate;
|
||||
rebarHeight = inclinedSection.EffectiveDepth - inclinedRebar.CompressedGap;
|
||||
rebarEndPoint = rebarStartPoint + rebarHeight * Math.Cos(angleInRad);
|
||||
rebarTrueStartPoint = rebarStartPoint + inclinedRebar.OffSet;
|
||||
rebarTrueEndPoint = rebarEndPoint - inclinedRebar.OffSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,14 +39,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
double area = Math.PI * source.Diameter * source.Diameter / 4d;
|
||||
TraceLogger?.AddMessage($"Area of rebar = {Math.PI} * ({source.Diameter})^2 / 4 = {area}(m^2)");
|
||||
double materialStrength = source.Material.GetStrength(LimitStates.ULS, CalcTerms.ShortTerm).Tensile;
|
||||
TraceLogger?.AddMessage($"Stirrup material strength Rsw = {materialStrength}");
|
||||
double stirrupStrength = stirrupStrengthFactor * materialStrength;
|
||||
TraceLogger?.AddMessage($"Strength of rebar Rsw = {stirrupStrengthFactor} * {materialStrength} = {stirrupStrength}(Pa)");
|
||||
double minimizedStrength = Math.Min(stirrupStrength, maxStirrupStrength);
|
||||
TraceLogger?.AddMessage($"Strength of rebar Rsw = Min({stirrupStrength}, {maxStirrupStrength})= {minimizedStrength}(Pa)");
|
||||
double minimizedStrength = GetRebarStrength(source);
|
||||
double spiralEffectiveness = 1;
|
||||
if (source.IsSpiral = true)
|
||||
if (source.IsSpiral == true)
|
||||
{
|
||||
spiralEffectiveness = GetSpiralEffectiveness(source);
|
||||
}
|
||||
@@ -55,6 +50,17 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
return density;
|
||||
}
|
||||
|
||||
private double GetRebarStrength(IStirrupByRebar source)
|
||||
{
|
||||
double materialStrength = source.Material.GetStrength(LimitStates.ULS, CalcTerms.ShortTerm).Tensile;
|
||||
TraceLogger?.AddMessage($"Stirrup material strength Rsw = {materialStrength}");
|
||||
double stirrupStrength = stirrupStrengthFactor * materialStrength;
|
||||
TraceLogger?.AddMessage($"Strength of rebar Rsw = {stirrupStrengthFactor} * {materialStrength} = {stirrupStrength}(Pa)");
|
||||
double minimizedStrength = Math.Min(stirrupStrength, maxStirrupStrength);
|
||||
TraceLogger?.AddMessage($"Strength of rebar Rsw = Min({stirrupStrength}, {maxStirrupStrength})= {minimizedStrength}(Pa)");
|
||||
return minimizedStrength;
|
||||
}
|
||||
|
||||
private double GetSpiralEffectiveness(IStirrupByRebar source)
|
||||
{
|
||||
if (inclinedSection is null)
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
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.BeamShears
|
||||
{
|
||||
internal class StirrupGroupStrengthLogic : IBeamShearStrenghLogic
|
||||
{
|
||||
private readonly IBeamShearSectionLogicInputData sourceInputData;
|
||||
private IBeamShearSectionLogicInputData localInputData;
|
||||
private IStirrupGroup stirrupGroup;
|
||||
private IUpdateStrategy<IBeamShearSectionLogicInputData> inputDataUpdateStrategy;
|
||||
|
||||
public StirrupGroupStrengthLogic(IBeamShearSectionLogicInputData inputData, IStirrupGroup stirrupGroup, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
this.sourceInputData = inputData;
|
||||
this.stirrupGroup = stirrupGroup;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public double GetShearStrength()
|
||||
{
|
||||
Check();
|
||||
if (!stirrupGroup.Stirrups.Any()) { return 0.0; }
|
||||
GetLocalInputData();
|
||||
double shearStrength = 0;
|
||||
foreach (var item in stirrupGroup.Stirrups)
|
||||
{
|
||||
localInputData.Stirrup = item;
|
||||
var stirrupSrengthLogic = new StirrupStrengthLogic(localInputData, TraceLogger?.GetSimilarTraceLogger(50));
|
||||
shearStrength += stirrupSrengthLogic.GetShearStrength();
|
||||
}
|
||||
TraceLogger?.AddMessage($"Total bearing capacity of group {stirrupGroup.Name} for shear Vtot = {shearStrength}(N)");
|
||||
return shearStrength;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
if (stirrupGroup is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": Stirrup group");
|
||||
}
|
||||
if (stirrupGroup.Stirrups is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + ": Stirrups");
|
||||
}
|
||||
}
|
||||
|
||||
private void GetLocalInputData()
|
||||
{
|
||||
localInputData = new BeamShearSectionLogicInputData(Guid.Empty);
|
||||
inputDataUpdateStrategy ??= new BeamShearSectionLogicInputDataUpdateStrategy();
|
||||
inputDataUpdateStrategy.Update(localInputData, sourceInputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
private readonly IBeamShearSectionLogicInputData inputData;
|
||||
private IStirrup stirrup => inputData.Stirrup;
|
||||
private IInclinedSection inclinedSection => inputData.InclinedSection;
|
||||
private IBeamShearStrenghLogic stirrupDensityStrengthLogic;
|
||||
private IBeamShearStrenghLogic stirrupByDensityStrengthLogic;
|
||||
private IBeamShearStrenghLogic stirrupGroupStrengthLogic;
|
||||
private IBeamShearStrenghLogic stirrupByInclinedRebarStrengthLogic;
|
||||
|
||||
public StirrupStrengthLogic(IBeamShearSectionLogicInputData inputData, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
@@ -21,17 +23,29 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
public double GetShearStrength()
|
||||
{
|
||||
var stirrupEffectiveness = StirrupEffectivenessFactory.GetEffectiveness(BeamShearSectionType.Rectangle);
|
||||
if (stirrup is IStirrupByDensity stirrupByDensity)
|
||||
if (stirrup is IStirrupByRebar stirrupByRebar)
|
||||
{
|
||||
TraceLogger?.AddMessage("Stirrups type is stirrup by density");
|
||||
stirrupDensityStrengthLogic = new StirrupByDensityStrengthLogic(stirrupEffectiveness, stirrupByDensity, inclinedSection,TraceLogger);
|
||||
return stirrupDensityStrengthLogic.GetShearStrength();
|
||||
TraceLogger?.AddMessage($"Stirrups type is stirrup by rebar {stirrupByRebar.Name}");
|
||||
stirrupByDensityStrengthLogic = new StirrupByRebarStrengthLogic(stirrupEffectiveness, stirrupByRebar, inclinedSection, inputData.ForceTuple, TraceLogger);
|
||||
return stirrupByDensityStrengthLogic.GetShearStrength();
|
||||
}
|
||||
else if (stirrup is IStirrupByRebar stirrupByRebar)
|
||||
else if (stirrup is IStirrupGroup stirrupGroup)
|
||||
{
|
||||
TraceLogger?.AddMessage("Stirrups type is stirrup by rebar");
|
||||
stirrupDensityStrengthLogic = new StirrupByRebarStrengthLogic(stirrupEffectiveness, stirrupByRebar, inclinedSection, inputData.ForceTuple, TraceLogger);
|
||||
return stirrupDensityStrengthLogic.GetShearStrength();
|
||||
TraceLogger?.AddMessage($"Stirrups type is stirrupGroup {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);
|
||||
return stirrupByDensityStrengthLogic.GetShearStrength();
|
||||
}
|
||||
else if (stirrup is IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Stirrups type is inclined rebar {inclinedRebar.Name}");
|
||||
stirrupByInclinedRebarStrengthLogic ??= new StirrupByInclinedRebarStrengthLogic(inclinedSection, inclinedRebar, TraceLogger);
|
||||
return stirrupByInclinedRebarStrengthLogic.GetShearStrength();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearSectionLogicInputDataUpdateStrategy : IUpdateStrategy<IBeamShearSectionLogicInputData>
|
||||
{
|
||||
public void Update(IBeamShearSectionLogicInputData targetObject, IBeamShearSectionLogicInputData sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.InclinedSection = sourceObject.InclinedSection;
|
||||
targetObject.Stirrup = sourceObject.Stirrup;
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
targetObject.CalcTerm = sourceObject.CalcTerm;
|
||||
targetObject.ForceTuple = sourceObject.ForceTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
@@ -18,6 +19,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
targetObject.StartCoordinate = sourceObject.StartCoordinate;
|
||||
targetObject.OffSet = sourceObject.OffSet;
|
||||
targetObject.AngleOfInclination = sourceObject.AngleOfInclination;
|
||||
targetObject.LegCount = sourceObject.LegCount;
|
||||
CheckObject.IsNull(sourceObject.RebarSection, "Rebar section");
|
||||
targetObject.RebarSection = sourceObject.RebarSection.Clone() as IRebarSection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -59,6 +60,10 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
angleOfInclination = value;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc>
|
||||
public IRebarSection RebarSection { get; set; } = new RebarSection(Guid.NewGuid());
|
||||
/// <inheritdoc>
|
||||
public double LegCount { get; set; } = 2;
|
||||
|
||||
public StirrupByInclinedRebar(Guid id)
|
||||
{
|
||||
|
||||
24
StructureHelperLogics/Models/Materials/IRebarSection.cs
Normal file
24
StructureHelperLogics/Models/Materials/IRebarSection.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
52
StructureHelperLogics/Models/Materials/RebarSection.cs
Normal file
52
StructureHelperLogics/Models/Materials/RebarSection.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user