Add inclined rebar
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements properies of stirrup by inclined rebar
|
||||
/// </summary>
|
||||
public interface IStirrupByInclinedRebar : IStirrup
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate of start point of inclination, m
|
||||
/// </summary>
|
||||
double StartCoordinate { get; set; }
|
||||
/// <summary>
|
||||
/// Distance beetwen start/end point and point where rebar work is started
|
||||
/// </summary>
|
||||
double OffSet { get; set; }
|
||||
/// <summary>
|
||||
/// Angle of inclination of rebar in degrees
|
||||
/// </summary>
|
||||
double AngleOfInclination { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,10 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// </summary>
|
||||
IReinforcementLibMaterial Material { get; set; }
|
||||
/// <summary>
|
||||
/// True if hoop is spiral one
|
||||
/// </summary>
|
||||
bool IsSpiral { get; set; }
|
||||
/// <summary>
|
||||
/// Count of legs of stirrup in specific cross-section
|
||||
/// </summary>
|
||||
double LegCount { get; set; }
|
||||
|
||||
@@ -6,8 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IStirrupGroup : IStirrup
|
||||
public interface IStirrupGroup : IStirrup, IHasStirrups
|
||||
{
|
||||
List<IStirrup> Stirrups { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
convertStrategy ??= new StirrupByRebarToDensityConvertStrategy(TraceLogger);
|
||||
convertStrategy ??= new StirrupByRebarToDensityConvertStrategy(TraceLogger, inclinedSection);
|
||||
IStirrupByDensity stirrupByDensity = convertStrategy.Convert(stirrupByRebar);
|
||||
stirrupDensityStrengthLogic ??= new(stirrupEffectiveness, stirrupByDensity, inclinedSection, TraceLogger);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
@@ -8,13 +9,15 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
private const double stirrupStrengthFactor = 0.8d;
|
||||
private const double maxStirrupStrength = 3e8;
|
||||
private IInclinedSection inclinedSection;
|
||||
private IUpdateStrategy<IStirrup> updateStrategy;
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public StirrupByRebarToDensityConvertStrategy(IShiftTraceLogger traceLogger)
|
||||
public StirrupByRebarToDensityConvertStrategy(IShiftTraceLogger traceLogger, IInclinedSection inclinedSection)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
this.inclinedSection = inclinedSection;
|
||||
}
|
||||
|
||||
public StirrupByRebarToDensityConvertStrategy(IUpdateStrategy<IStirrup> updateStrategy, IShiftTraceLogger traceLogger)
|
||||
@@ -42,9 +45,33 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
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 density = minimizedStrength * area * source.LegCount / source.Spacing;
|
||||
TraceLogger?.AddMessage($"Density of stirrups = {minimizedStrength} * {area} * {source.LegCount} / {source.Spacing} = {density}(N/m)");
|
||||
double spiralEffectiveness = 1;
|
||||
if (source.IsSpiral = true)
|
||||
{
|
||||
spiralEffectiveness = GetSpiralEffectiveness(source);
|
||||
}
|
||||
double density = minimizedStrength * area * source.LegCount / source.Spacing * spiralEffectiveness;
|
||||
TraceLogger?.AddMessage($"Density of stirrups = {minimizedStrength} * {area} * {source.LegCount} / {source.Spacing} * {spiralEffectiveness} = {density}(N/m)");
|
||||
return density;
|
||||
}
|
||||
|
||||
private double GetSpiralEffectiveness(IStirrupByRebar source)
|
||||
{
|
||||
if (inclinedSection is null)
|
||||
{
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": Inclined Section";
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
double spiralHeight = inclinedSection.EffectiveDepth - (inclinedSection.FullDepth - inclinedSection.EffectiveDepth);
|
||||
TraceLogger?.AddMessage($"Spiral height = {spiralHeight}(m)");
|
||||
double spiralSpacing = source.Spacing;
|
||||
TraceLogger?.AddMessage($"Spiral spacing = {spiralSpacing}(m)");
|
||||
double spiralAng = Math.Atan2(spiralHeight, spiralSpacing);
|
||||
double spriralEffectiveness = Math.Sin(spiralAng);
|
||||
double spiralAngInDegrees = 180 / (Math.PI) * spiralAng;
|
||||
TraceLogger?.AddMessage($"Spiral effectiveness factor = sin({spiralAngInDegrees}(deg)) = {spriralEffectiveness}");
|
||||
return spriralEffectiveness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
targetObject.Diameter = sourceObject.Diameter;
|
||||
targetObject.LegCount = sourceObject.LegCount;
|
||||
targetObject.Spacing = sourceObject.Spacing;
|
||||
targetObject.IsSpiral = sourceObject.IsSpiral;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,49 +13,74 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
{
|
||||
private IUpdateStrategy<IStirrupByDensity> densityUpdateStrategy;
|
||||
private IUpdateStrategy<IStirrupByRebar> uniformUpdateStrategy;
|
||||
private IUpdateStrategy<IStirrupGroup> groupUpdateStrategy;
|
||||
private IUpdateStrategy<IStirrupByInclinedRebar> inclinedUpdateStrategy;
|
||||
|
||||
public void Update(IStirrup targetObject, IStirrup sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
if (sourceObject is IStirrupByDensity density)
|
||||
if (sourceObject is IStirrupGroup group)
|
||||
{
|
||||
UpdateByDensity(targetObject, density);
|
||||
UpdateGroup(targetObject, group);
|
||||
}
|
||||
else if (sourceObject is IStirrupByRebar stirrupByUniformRebar)
|
||||
{
|
||||
UpdateByUniformRebar(targetObject, stirrupByUniformRebar);
|
||||
}
|
||||
else if (sourceObject is IStirrupByDensity density)
|
||||
{
|
||||
UpdateByDensity(targetObject, density);
|
||||
}
|
||||
else if (sourceObject is IStirrupByInclinedRebar inclinedRebar)
|
||||
{
|
||||
UpdateByInclinedRebar(targetObject, inclinedRebar);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(sourceObject));
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateByUniformRebar(IStirrup targetObject, IStirrupByRebar stirrupByUniformRebar)
|
||||
private void UpdateByInclinedRebar(IStirrup targetObject, IStirrupByInclinedRebar surceInclinedRebar)
|
||||
{
|
||||
uniformUpdateStrategy ??= new StirrupByRebarUpdateStrategy();
|
||||
if (targetObject is IStirrupByRebar targetUniformRebar)
|
||||
{
|
||||
uniformUpdateStrategy.Update(targetUniformRebar, stirrupByUniformRebar);
|
||||
}
|
||||
else
|
||||
if (targetObject is not IStirrupByInclinedRebar targetInclinedRebar)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||
}
|
||||
inclinedUpdateStrategy ??= new StirrupByInclinedRebarUpdateStrategy();
|
||||
inclinedUpdateStrategy.Update(targetInclinedRebar, surceInclinedRebar);
|
||||
}
|
||||
|
||||
private void UpdateGroup(IStirrup targetObject, IStirrupGroup sourceGroup)
|
||||
{
|
||||
if (targetObject is not IStirrupGroup targetGroup)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||
}
|
||||
groupUpdateStrategy ??= new StirrupGroupUpdateStrategy();
|
||||
groupUpdateStrategy.Update(targetGroup, sourceGroup);
|
||||
}
|
||||
|
||||
private void UpdateByUniformRebar(IStirrup targetObject, IStirrupByRebar stirrupByUniformRebar)
|
||||
{
|
||||
if (targetObject is not IStirrupByRebar targetUniformRebar)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||
}
|
||||
uniformUpdateStrategy ??= new StirrupByRebarUpdateStrategy();
|
||||
uniformUpdateStrategy.Update(targetUniformRebar, stirrupByUniformRebar);
|
||||
}
|
||||
|
||||
private void UpdateByDensity(IStirrup targetObject, IStirrupByDensity density)
|
||||
{
|
||||
densityUpdateStrategy ??= new StirrupByDensityUpdateStrategy();
|
||||
if (targetObject is IStirrupByDensity targetDensity)
|
||||
{
|
||||
densityUpdateStrategy.Update(targetDensity, density);
|
||||
}
|
||||
else
|
||||
if (targetObject is not IStirrupByDensity targetDensity)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(targetObject));
|
||||
}
|
||||
densityUpdateStrategy ??= new StirrupByDensityUpdateStrategy();
|
||||
densityUpdateStrategy.Update(targetDensity, density);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupByInclinedRebarUpdateStrategy : IUpdateStrategy<IStirrupByInclinedRebar>
|
||||
{
|
||||
private IUpdateStrategy<IStirrup>? baseUpdateStrategy;
|
||||
public void Update(IStirrupByInclinedRebar targetObject, IStirrupByInclinedRebar sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
baseUpdateStrategy ??= new StirrupBaseUpdateStrategy();
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.StartCoordinate = sourceObject.StartCoordinate;
|
||||
targetObject.OffSet = sourceObject.OffSet;
|
||||
targetObject.AngleOfInclination = sourceObject.AngleOfInclination;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class StirrupGroupUpdateStrategy : IUpdateStrategy<IStirrupGroup>
|
||||
{
|
||||
private StirrupBaseUpdateStrategy baseUpdateStrategy;
|
||||
|
||||
public void Update(IStirrupGroup targetObject, IStirrupGroup sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
|
||||
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
baseUpdateStrategy ??= new StirrupBaseUpdateStrategy();
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
CheckObject.IsNull(sourceObject.Stirrups);
|
||||
CheckObject.IsNull(targetObject.Stirrups);
|
||||
targetObject.Stirrups.Clear();
|
||||
foreach (var item in sourceObject.Stirrups)
|
||||
{
|
||||
IStirrup? newItem = item.Clone() as IStirrup;
|
||||
targetObject.Stirrups.Add(newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
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 class StirrupByInclinedRebar : IStirrupByInclinedRebar
|
||||
{
|
||||
private const int minInclinationAngle = 10;
|
||||
private const int maxInclinationAngle = 80;
|
||||
private double angleOfInclination = 45;
|
||||
private double startCoordinate = 0.05;
|
||||
private double compressedGap = 0.05;
|
||||
|
||||
/// <inheritdoc>
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; } = string.Empty;
|
||||
/// <inheritdoc>
|
||||
public double CompressedGap
|
||||
{
|
||||
get => compressedGap;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.IncorrectValue + $": distance from compressed edge must be positive");
|
||||
}
|
||||
compressedGap = value;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc>
|
||||
public double StartCoordinate
|
||||
{
|
||||
get => startCoordinate;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.IncorrectValue + $": start coordinate must be positive");
|
||||
}
|
||||
startCoordinate = value;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc>
|
||||
public double OffSet { get; set; } = 0.05;
|
||||
/// <inheritdoc>
|
||||
public double AngleOfInclination
|
||||
{
|
||||
get => angleOfInclination;
|
||||
set
|
||||
{
|
||||
if (value < minInclinationAngle || value > maxInclinationAngle)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.IncorrectValue + $": angle of inclination of rebar must be beetwen {minInclinationAngle} and {maxInclinationAngle} degrees");
|
||||
}
|
||||
angleOfInclination = value;
|
||||
}
|
||||
}
|
||||
|
||||
public StirrupByInclinedRebar(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var logic = new StirrupByInclinedRebarUpdateStrategy();
|
||||
StirrupByInclinedRebar newItem = new(Guid.NewGuid());
|
||||
logic.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
}
|
||||
legCount = value;
|
||||
}
|
||||
} /// <inheritdoc/>
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public double Diameter
|
||||
{
|
||||
get => diameter; set
|
||||
@@ -44,7 +45,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
}
|
||||
diameter = value;
|
||||
}
|
||||
} /// <inheritdoc/>
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public double Spacing
|
||||
{
|
||||
get => step; set
|
||||
@@ -55,8 +57,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
}
|
||||
step = value;
|
||||
}
|
||||
} /// <inheritdoc/>
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public double CompressedGap { get; set; } = 0;
|
||||
/// <inheritdoc/>
|
||||
public bool IsSpiral { get; set; } = false;
|
||||
|
||||
public StirrupByRebar(Guid id)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -9,18 +10,21 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
public class StirrupGroup : IStirrupGroup
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
public double CompressedGap { get; set; }
|
||||
|
||||
public double GetShearBearingCapacity(IInclinedSection inclinedSection)
|
||||
public StirrupGroup(Guid id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var updateStrategy = new StirrupGroupUpdateStrategy();
|
||||
StirrupGroup newItem = new(Guid.NewGuid());
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user