Add test of rebar by density and rebar by inclined rebar

This commit is contained in:
RedikultsevEvg
2025-08-10 18:24:46 +05:00
parent 3d8ac6f0c4
commit c61069a394
29 changed files with 364 additions and 134 deletions

View File

@@ -13,10 +13,6 @@ namespace DataAccess.DTOs
public double RelativeEffectiveDepthRangeValue { get; set; } = 3.3;
[JsonProperty("StepCount")]
public int StepCount { get; set; } = 55;
[JsonProperty("SectionLengthMaxValue")]
public double RelativeEffectiveDepthSectionLengthMaxValue { get; set; } = 3;
[JsonProperty("LengthMinValue")]
public double RelativeEffectiveDepthSectionLengthMinValue { get; set; } = 0;
public BeamShearDesignRangePropertyDTO(Guid id)
{

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.VisualProperties;
using StructureHelper.Windows.UserControls;
using StructureHelperCommon.Models.VisualProperties;
using StructureHelperLogics.Models.BeamShears;
using System;
using System.Collections.Generic;
@@ -29,14 +30,16 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
public double SupportStartY => -SupportHeight;
public string SupportPathData => $"M 0 0 L {SupportWidth / 2} {-SupportHeight} L {-SupportWidth / 2} {-SupportHeight} Z";
public IPrimitiveVisualProperty VisualProperty => beamShearSection.VisualProperty;
public IBeamShearSection BeamShearSection => beamShearSection;
public PrimitiveVisualPropertyViewModel VisualProperty {get;}
public BeamShearSectionPrimitive(IBeamShearSection beamShearSection, IInclinedSection inclinedSection)
{
this.beamShearSection = beamShearSection;
this.inclinedSection = inclinedSection;
VisualProperty = new(beamShearSection.VisualProperty);
}
}
}

View File

@@ -1,4 +1,5 @@
using FieldVisualizer.Entities.Values.Primitives;
using StructureHelper.Windows.UserControls;
using StructureHelperCommon.Models.VisualProperties;
using System;
using System.Collections.Generic;
@@ -10,6 +11,6 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
{
public interface IGraphicalPrimitive : ICenter
{
IPrimitiveVisualProperty VisualProperty { get; }
PrimitiveVisualPropertyViewModel VisualProperty { get; }
}
}

View File

@@ -1,15 +1,16 @@
using StructureHelperCommon.Models.VisualProperties;
using StructureHelper.Windows.UserControls;
using StructureHelperLogics.Models.BeamShears;
using System;
using System.Windows.Media;
using PrimitiveVisualProperty = StructureHelperCommon.Models.VisualProperties.PrimitiveVisualProperty;
namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
{
public class InclinedSectionPrimitive : IGraphicalPrimitive
{
private IBeamShearSectionLogicResult source;
private IInclinedSection inclinedSection => source.InputData.InclinedSection;
private IInclinedSection inclinedCrack => source.InputData.InclinedCrack;
private IInclinedSection inclinedSection => source.ResultInputData.InclinedSection;
private IInclinedSection inclinedCrack => source.ResultInputData.InclinedCrack;
public double SectionStartX => inclinedSection.StartCoord;
public double SectionEndX => inclinedSection.EndCoord;
@@ -27,7 +28,8 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
public double CenterX => 0;
public double CenterY => 0;
public IPrimitiveVisualProperty VisualProperty { get; private set; } = new PrimitiveVisualProperty(Guid.Empty);
public PrimitiveVisualPropertyViewModel VisualProperty { get; } = new(new PrimitiveVisualProperty(Guid.Empty));
public InclinedSectionPrimitive(IBeamShearSectionLogicResult source)
{

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.VisualProperties;
using StructureHelper.Windows.UserControls;
using StructureHelperCommon.Models.VisualProperties;
using StructureHelperLogics.Models.BeamShears;
namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
@@ -14,14 +15,16 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
public double TopPointY => InclinedSection.FullDepth;
public double Length => StirrupByDensity.EndCoordinate - StirrupByDensity.StartCoordinate;
public double Depth => InclinedSection.EffectiveDepth;
public IPrimitiveVisualProperty VisualProperty => StirrupByDensity.VisualProperty;
public IInclinedSection InclinedSection { get; set; }
public PrimitiveVisualPropertyViewModel VisualProperty { get; }
public StirrupByDensityPrimitive(IStirrupByDensity stirrupByDensity, IInclinedSection inclinedSection)
{
StirrupByDensity = stirrupByDensity;
this.InclinedSection = inclinedSection;
VisualProperty = new(stirrupByDensity.VisualProperty);
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.VisualProperties;
using StructureHelper.Windows.UserControls;
using StructureHelperCommon.Models.VisualProperties;
using StructureHelperLogics.Models.BeamShears;
using System;
using System.Collections.Generic;
@@ -19,11 +20,14 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
public double CenterX => 0;
public double CenterY => 0;
public IPrimitiveVisualProperty VisualProperty => StirrupByInclinedRebar.VisualProperty;
public PrimitiveVisualPropertyViewModel VisualProperty { get; }
public StirrupByInclinedRebarPrimitive(IStirrupByInclinedRebar stirrupByInclinedRebar, IInclinedSection inclinedSection)
{
StirrupByInclinedRebar = stirrupByInclinedRebar;
this.inclinedSection = inclinedSection;
VisualProperty = new(stirrupByInclinedRebar.VisualProperty);
}
private double GetRebarLengthX()
{

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.VisualProperties;
using StructureHelper.Windows.UserControls;
using StructureHelperCommon.Models.VisualProperties;
using StructureHelperLogics.Models.BeamShears;
using System;
@@ -18,17 +19,19 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives
public double Length => StirrupByRebar.EndCoordinate - StirrupByRebar.StartCoordinate;
public double Depth => InclinedSection.EffectiveDepth;
public double Density => Math.Round(stirrupByDensity.StirrupDensity);
public IPrimitiveVisualProperty VisualProperty => StirrupByRebar.VisualProperty;
public IInclinedSection InclinedSection => inclinedSection;
public PrimitiveVisualPropertyViewModel VisualProperty { get; }
public StirrupByRebarPrimitive(IStirrupByRebar stirrupByRebar, IInclinedSection inclinedSection)
{
this.StirrupByRebar = stirrupByRebar;
this.inclinedSection = inclinedSection;
var logic = new StirrupByRebarToDensityConvertStrategy(null, inclinedSection);
stirrupByDensity = logic.Convert(stirrupByRebar);
VisualProperty = new(stirrupByRebar.VisualProperty);
}
}
}

View File

@@ -10,6 +10,7 @@
Width="{Binding PositiveLength}"
Height="{Binding FullDepth}"
StrokeThickness="0.01"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Rectangle.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}"/>
@@ -47,6 +48,8 @@
Y2="{Binding BottomCover}"
Stroke="Black"
StrokeThickness="0.012"
StrokeDashArray="0.1 0.05"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Line.ToolTip>
<Grid>
@@ -93,6 +96,7 @@
Y2="{Binding SectionEndY}"
StrokeThickness="0.01"
StrokeDashArray="0.05 0.02"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Line.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
@@ -131,17 +135,6 @@
</Grid>
</Line.ToolTip>
</Line>
<Line
X1="{Binding SectionStartX}"
X2="{Binding SectionStartX}"
Y1="0"
Y2="{Binding SectionStartY}"
StrokeThickness="0.01"
>
<Line.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
</Line.Stroke>
</Line>
<!--InclinedCrack-->
<Line
X1="{Binding CrackStartX}"
@@ -149,6 +142,7 @@
Y1="{Binding SectionStartY}"
Y2="{Binding SectionEndY}"
StrokeThickness="0.02"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Line.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
@@ -179,7 +173,7 @@
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding ConcreteShearForce, Converter={StaticResource ForceConverter}}"/>
<TextBlock Grid.Row="5" Text="Stirrup shear force: "/>
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding StirrupShearForce, Converter={StaticResource ForceConverter}}"/>
<TextBlock Grid.Row="6" Text="Crack span c0/d ratio: "/>
<TextBlock Grid.Row="6" Text="Span c0/d ratio: "/>
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding CrackSpanRatio, Converter={StaticResource PlainDouble}}"/>
</Grid>
</Line.ToolTip>
@@ -196,6 +190,7 @@
StrokeThickness="0.005"
Canvas.Left="{Binding StartPoinX}"
Canvas.Top="{Binding BottomPointY}"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Rectangle.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}"/>
@@ -244,6 +239,7 @@
StrokeThickness="0.005"
Canvas.Left="{Binding StartPoinX}"
Canvas.Top="{Binding BottomPointY}"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Rectangle.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}"/>
@@ -279,6 +275,7 @@
X2="{Binding EndPointX}"
Y1="{Binding StartPointY}"
Y2="{Binding EndPointY}"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
StrokeThickness="{Binding StirrupByInclinedRebar.RebarSection.Diameter}"
>
<Line.Stroke>
@@ -319,6 +316,7 @@
Y1="{Binding StartPointY}"
Y2="{Binding StartPointY}"
StrokeThickness="{Binding StirrupByInclinedRebar.RebarSection.Diameter}"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Line.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>
@@ -330,6 +328,7 @@
Y1="{Binding EndPointY}"
Y2="{Binding EndPointY}"
StrokeThickness="{Binding StirrupByInclinedRebar.RebarSection.Diameter}"
Visibility="{Binding VisualProperty.IsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"
>
<Line.Stroke>
<SolidColorBrush Color="{Binding VisualProperty.Color}" Opacity="{Binding VisualProperty.Opacity}"/>

View File

@@ -25,7 +25,7 @@
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show digram"
IconContent="{StaticResource MomentCurvatureDiagram}"
DescriptionText="Shows diagram for result where inclined section started from support (Note - the most dangerous combinations may be missed)"/>
DescriptionText="Shows diagram for result for inclined section where factor of using is maximum"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{StaticResource MomentCurvatureDiagram}"/>

View File

@@ -61,8 +61,12 @@ namespace StructureHelper.Windows.BeamShears
private void Show2DDiagram(object obj)
{
if (SelectedResult is null) { return; }
if (SelectedResult.SectionResults is null) { return; }
var sectionResult = SelectedResult.SectionResults
.OrderByDescending(x => x.FactorOfUsing)
.FirstOrDefault();
var logic = new ShearDiagramLogic(SelectedResult);
logic.ShowWindow(0.0);
logic.ShowWindow(sectionResult.ResultInputData.InclinedSection.StartCoord);
}
private void ShowSectionResults(object commandParameter)

View File

@@ -41,8 +41,8 @@
<ColumnDefinition Width="50"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding Opacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="1,2,3,4"/>
<Slider Grid.Column="1" Value="{Binding Opacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
<TextBox Text="{Binding FactoredOpacity, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}" Margin="1,2,3,4"/>
<Slider Grid.Column="1" Value="{Binding FactoredOpacity}" Maximum="100" TickPlacement="BottomRight" TickFrequency="10" IsSnapToTickEnabled="True" Margin="2"/>
</Grid>
</Grid>
</UserControl>

View File

@@ -32,6 +32,11 @@ namespace StructureHelper.Windows.UserControls
}
public double Opacity
{
get => visualProperty.Opacity;
}
public double FactoredOpacity
{
get => visualProperty.Opacity * 100d;
set

View File

@@ -10,8 +10,6 @@ namespace StructureHelperLogics.Models.BeamShears
private double absoluteRangeValue = 0.0;
private double relativeEffectiveDepthRangeValue = 3.3;
private int stepCount = 55;
private double relativeEffectiveDepthSectionLengthMaxValue = 3;
private double relativeEffectiveDepthSectionLengthMinValue = 0;
/// <inheritdoc>
public Guid Id { get; }
@@ -59,32 +57,6 @@ namespace StructureHelperLogics.Models.BeamShears
}
}
public double RelativeEffectiveDepthSectionLengthMaxValue
{
get => relativeEffectiveDepthSectionLengthMaxValue;
set
{
if (value <= 0)
{
throw new StructureHelperException($"Maximum inclined section factor must be greater than zero, but was {value}");
}
relativeEffectiveDepthSectionLengthMaxValue = value;
}
}
public double RelativeEffectiveDepthSectionLengthMinValue
{
get => relativeEffectiveDepthSectionLengthMinValue;
set
{
if (value < 0)
{
throw new StructureHelperException($"Maximum inclined section factor must be greater than zero, but was {value}");
}
relativeEffectiveDepthSectionLengthMinValue = value;
}
}
public BeamShearDesignRangeProperty(Guid id)
{
Id = id;

View File

@@ -12,6 +12,7 @@ namespace StructureHelperLogics.Models.BeamShears
public bool IsValid { get; set; }
public string? Description { get; set; }
public IBeamShearSectionLogicInputData InputData { get; set; }
public IBeamShearSectionLogicInputData ResultInputData { get; set; }
public double ConcreteStrength { get; set; }
public double StirrupStrength { get; set; }
public double TotalStrength { get; set; }

View File

@@ -21,14 +21,6 @@ namespace StructureHelperLogics.Models.BeamShears
/// </summary>
double RelativeEffectiveDepthRangeValue { get; set; }
/// <summary>
/// Relative value of inclination length as factor of effective depth of cross-section
/// </summary>
double RelativeEffectiveDepthSectionLengthMaxValue { get; set; }
/// <summary>
/// Relative value of inclination length as factor of effective depth of cross-section
/// </summary>
double RelativeEffectiveDepthSectionLengthMinValue { get; set; }
/// <summary>
/// Number of step of solvation
/// </summary>
int StepCount { get; set; }

View File

@@ -13,6 +13,10 @@ namespace StructureHelperLogics.Models.BeamShears
/// </summary>
IBeamShearSectionLogicInputData InputData { get; set; }
/// <summary>
/// New Input data for calculating
/// </summary>
IBeamShearSectionLogicInputData ResultInputData { get; set; }
/// <summary>
/// Ultimate shear force due to cocrete
/// </summary>
public double ConcreteStrength { get; set; }

View File

@@ -40,10 +40,10 @@ namespace StructureHelperLogics.Models.BeamShears
PrepareNewResult();
if (Check() == false) { return; }
localTraceLogger?.AddMessage(sectionMessage);
InitializeStrategies();
try
{
AddInclinedCrackToInputData();
PrepareResultData();
InitializeStrategies();
CalculateResult();
}
catch (Exception ex)
@@ -53,18 +53,22 @@ namespace StructureHelperLogics.Models.BeamShears
}
}
private void AddInclinedCrackToInputData()
private void PrepareResultData()
{
InclinedSection newSection = new();
InclinedSection crackSection = new();
var updateStrategy = new InclinedSectionUpdateStrategy();
updateStrategy.Update(newSection, InputData.InclinedSection);
double crackLength = newSection.EndCoord - newSection.StartCoord;
double maxCrackLength = 2 * newSection.EffectiveDepth;
updateStrategy.Update(crackSection, InputData.InclinedSection);
BeamShearSectionLogicInputData resultData = new(Guid.Empty);
var resultDataUpdateStrategy = new BeamShearSectionLogicInputDataUpdateStrategy();
resultDataUpdateStrategy.Update(resultData, InputData);
double crackLength = crackSection.EndCoord - crackSection.StartCoord;
double maxCrackLength = 2 * crackSection.EffectiveDepth;
if (crackLength > maxCrackLength)
{
newSection.StartCoord = newSection.EndCoord - maxCrackLength;
crackSection.StartCoord = crackSection.EndCoord - maxCrackLength;
}
InputData.InclinedCrack = newSection;
resultData.InclinedCrack = crackSection;
result.ResultInputData = resultData;
}
private bool Check()
@@ -104,7 +108,7 @@ namespace StructureHelperLogics.Models.BeamShears
double totalStrength = concreteStrength + stirrupStrength;
localTraceLogger?.AddMessage($"Total strength = {concreteStrength} + {stirrupStrength} = {totalStrength}(N)");
result.TotalStrength = totalStrength;
double actualShearForce = InputData.ForceTuple.Qy;
double actualShearForce = result.ResultInputData.ForceTuple.Qy;
if (actualShearForce > totalStrength)
{
result.IsValid = false;
@@ -125,38 +129,38 @@ namespace StructureHelperLogics.Models.BeamShears
{
var logic = new StirrupBySearchLogic(localTraceLogger.GetSimilarTraceLogger(100))
{
InputData = InputData,
InputData = result.ResultInputData,
SectionEffectiveness = sectionEffectiveness
};
double stirrupStrength = logic.GetShearStrength();
localTraceLogger?.AddMessage($"Stirrup strength was restricted as Qsw,restricted = {stirrupStrength}(N)");
InputData.InclinedCrack = logic.InclinedCrack;
result.ResultInputData.InclinedCrack = logic.InclinedCrack;
return stirrupStrength;
}
private void InitializeStrategies()
{
if (InputData.InclinedSection.BeamShearSection.Shape is IRectangleShape)
if (result.ResultInputData.InclinedSection.BeamShearSection.Shape is IRectangleShape)
{
sectionEffectiveness = SectionEffectivenessFactory.GetShearEffectiveness(BeamShearSectionType.Rectangle);
}
else if (InputData.InclinedSection.BeamShearSection.Shape is ICircleShape)
else if (result.ResultInputData.InclinedSection.BeamShearSection.Shape is ICircleShape)
{
sectionEffectiveness = SectionEffectivenessFactory.GetShearEffectiveness(BeamShearSectionType.Circle);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(InputData.InclinedSection.BeamShearSection.Shape));
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(result.ResultInputData.InclinedSection.BeamShearSection.Shape));
}
concreteLogic = new(sectionEffectiveness, InputData.InclinedSection, localTraceLogger);
stirrupLogic = new(InputData, localTraceLogger);
concreteLogic = new(sectionEffectiveness, result.ResultInputData.InclinedSection, localTraceLogger);
stirrupLogic = new(result.ResultInputData, localTraceLogger);
getLongitudinalForceFactorLogic = new GetLongitudinalForceFactorLogic(localTraceLogger?.GetSimilarTraceLogger(100));
}
private void SetLongitudinalForce()
{
getLongitudinalForceFactorLogic.LongitudinalForce = InputData.ForceTuple.Nz;
getLongitudinalForceFactorLogic.InclinedSection = InputData.InclinedSection;
getLongitudinalForceFactorLogic.LongitudinalForce = result.ResultInputData.ForceTuple.Nz;
getLongitudinalForceFactorLogic.InclinedSection = result.ResultInputData.InclinedSection;
}
private void PrepareNewResult()

View File

@@ -7,6 +7,8 @@ namespace StructureHelperLogics.Models.BeamShears
{
public class GetInclinedSectionListLogic : IGetInclinedSectionListLogic
{
private const int minimumInclinedSectionLengthFactor = 0;
private const int maximumInclinedSectionLengthFactor = 3;
private IGetInclinedSectionLogic inclinedSectionLogic;
private double depth;
private double effectiveDepth;
@@ -28,8 +30,8 @@ namespace StructureHelperLogics.Models.BeamShears
Check();
GetShapeParameters();
GetCoordinates();
double minSectionLength = DesignRangeProperty.RelativeEffectiveDepthSectionLengthMinValue * effectiveDepth;
double maxSectionLength = DesignRangeProperty.RelativeEffectiveDepthSectionLengthMaxValue * effectiveDepth;
double minSectionLength = minimumInclinedSectionLengthFactor * effectiveDepth;
double maxSectionLength = maximumInclinedSectionLengthFactor * effectiveDepth;
foreach (var startCoord in coordinates)
{
var endCoordinates = coordinates.Where(x => x >= startCoord);

View File

@@ -11,7 +11,6 @@ namespace StructureHelperLogics.Models.BeamShears
/// <inheritdoc/>
public class StirrupByDensityStrengthLogic : IBeamShearStrenghLogic
{
//private const double minStirrupRatio = 0.25;
private readonly IStirrupEffectiveness stirrupEffectiveness;
private readonly IStirrupByDensity stirrupByDensity;
private readonly IInclinedSection inclinedSection;

View File

@@ -11,25 +11,42 @@ namespace StructureHelperLogics.Models.BeamShears
const double stirrupEffectivenessFactor = 0.75;
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;
private IRebarSectionStrengthLogic rebarSectionStrengthLogic;
private IInterpolateValueLogic interpolationLogic;
public IShiftTraceLogger? TraceLogger { get; set; }
public StirrupByInclinedRebarStrengthLogic(IInclinedSection inclinedSection, IStirrupByInclinedRebar inclinedRebar, IShiftTraceLogger traceLogger)
public StirrupByInclinedRebarStrengthLogic(
IInclinedSection inclinedSection,
IStirrupByInclinedRebar inclinedRebar,
IShiftTraceLogger traceLogger) : this(
inclinedSection,
inclinedRebar,
new RebarSectionStrengthLogic(),
new InterpolateValueLogic(),
traceLogger
) { }
public StirrupByInclinedRebarStrengthLogic(
IInclinedSection inclinedSection,
IStirrupByInclinedRebar inclinedRebar,
IRebarSectionStrengthLogic rebarSectionStrengthLogic,
IInterpolateValueLogic interpolationLogic,
IShiftTraceLogger? traceLogger)
{
this.inclinedSection = inclinedSection;
this.inclinedRebar = inclinedRebar;
this.rebarSectionStrengthLogic = rebarSectionStrengthLogic;
this.interpolationLogic = interpolationLogic;
TraceLogger = traceLogger;
}
public double GetShearStrength()
{
GetGeometry();
@@ -48,7 +65,7 @@ namespace StructureHelperLogics.Models.BeamShears
TraceLogger?.AddMessage($"Inclined section start point coordinate X = {inclinedSection.StartCoord} is in end transfer zone");
return GetEndTransferValue();
}
if (inclinedSection.EndCoord > rebarStartPoint & inclinedSection.EndCoord < rebarTrueStartPoint)
if (inclinedSection.EndCoord > rebarStartPoint && inclinedSection.EndCoord < rebarTrueStartPoint)
{
TraceLogger?.AddMessage($"Inclined section end point coordinate X = {inclinedSection.EndCoord} is in start transfer zone");
return GetStartTransferValue();
@@ -59,41 +76,33 @@ namespace StructureHelperLogics.Models.BeamShears
private double GetStartTransferValue()
{
interpolationLogic = new InterpolateValueLogic()
{
X1 = rebarStartPoint,
X2 = rebarTrueStartPoint,
Y1 = 0.0,
Y2 = GetInclinedRebarStrength(),
KnownValueX = inclinedSection.EndCoord
};
interpolationLogic.X1 = rebarStartPoint;
interpolationLogic.X2 = rebarTrueStartPoint;
interpolationLogic.Y1 = 0.0;
interpolationLogic.Y2 = GetInclinedRebarStrength();
interpolationLogic.KnownValueX = inclinedSection.EndCoord;
return interpolationLogic.GetValueY();
}
private double GetEndTransferValue()
{
interpolationLogic = new InterpolateValueLogic()
{
X1 = rebarTrueEndPoint,
X2 = rebarEndPoint,
Y1 = GetInclinedRebarStrength(),
Y2 = 0.0,
KnownValueX = inclinedSection.StartCoord
};
interpolationLogic.X1 = rebarTrueEndPoint;
interpolationLogic.X2 = rebarEndPoint;
interpolationLogic.Y1 = GetInclinedRebarStrength();
interpolationLogic.Y2 = 0.0;
interpolationLogic.KnownValueX = inclinedSection.StartCoord;
return interpolationLogic.GetValueY();
}
private double GetInclinedRebarStrength()
{
rebarSectionStrengthLogic ??= new RebarSectionStrengthLogic()
{
RebarStrengthFactor = 0.8,
MaxRebarStrength = 3e8,
LimitState = LimitStates.ULS,
CalcTerm = CalcTerms.ShortTerm,
TraceLogger = TraceLogger,
};
rebarSectionStrengthLogic.RebarStrengthFactor = 0.8;
rebarSectionStrengthLogic.MaxRebarStrength = 3e8;
rebarSectionStrengthLogic.LimitState = LimitStates.ULS;
rebarSectionStrengthLogic.CalcTerm = CalcTerms.ShortTerm;
rebarSectionStrengthLogic.TraceLogger = TraceLogger;
rebarSectionStrengthLogic.RebarSection = inclinedRebar.RebarSection;
double rebarStrength = rebarSectionStrengthLogic.GetRebarMaxTensileForce();
double inclinedRebarStrength = stirrupEffectivenessFactor * rebarStrength * Math.Sin(angleInRad) * inclinedRebar.LegCount;
TraceLogger?.AddMessage($"Inclined rebar Name = {inclinedRebar.Name}, start point {rebarStartPoint}(m), end point {rebarEndPoint}(m), angle of inclination {inclinedRebar.AngleOfInclination}(deg), number of legs {inclinedRebar.LegCount}");
@@ -113,7 +122,7 @@ namespace StructureHelperLogics.Models.BeamShears
rebarTrueEndPoint = rebarEndPoint - transferLength;
if (rebarTrueStartPoint >= rebarTrueEndPoint)
{
throw new StructureHelperException("Transfer aone in inclined rebar is too big");
throw new StructureHelperException("Transfer zone in inclined rebar is too big");
}
}
}

View File

@@ -14,8 +14,6 @@ namespace StructureHelperLogics.Models.BeamShears
targetObject.AbsoluteRangeValue = sourceObject.AbsoluteRangeValue;
targetObject.RelativeEffectiveDepthRangeValue = sourceObject.RelativeEffectiveDepthRangeValue;
targetObject.StepCount = sourceObject.StepCount;
targetObject.RelativeEffectiveDepthSectionLengthMaxValue = sourceObject.RelativeEffectiveDepthSectionLengthMaxValue;
targetObject.RelativeEffectiveDepthSectionLengthMinValue = sourceObject.RelativeEffectiveDepthSectionLengthMinValue;
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
namespace StructureHelperLogics.Models.Materials
@@ -7,6 +8,10 @@ namespace StructureHelperLogics.Models.Materials
{
IRebarSection RebarSection { get; set; }
IShiftTraceLogger? TraceLogger { get; set; }
CalcTerms CalcTerm { get; set; }
LimitStates LimitState { get; set; }
double MaxRebarStrength { get; set; }
double RebarStrengthFactor { get; set; }
double GetRebarMaxTensileForce();
}

View File

@@ -33,21 +33,107 @@ namespace StructureHelperTests.UnitTests.BeamShearTests
);
}
[Test]
public void GetShearStrength_CalculatesCorrectly()
[TestCase(0.2, 0.48)]
[TestCase(0.5, 1.2)]
[TestCase(1.1, 2.64)]
[TestCase(2.2, 2.64)]
public void GetShearStrength_CalculatesCorrectly_differentStirrupEnd(double stirrupEnd, double expectedStrength)
{
// Arrange
_mockInclinedSection.Setup(s => s.StartCoord).Returns(1.0);
_mockInclinedSection.Setup(s => s.EndCoord).Returns(3.0);
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(2.0);
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
_mockInclinedSection.Setup(s => s.EndCoord).Returns(100);
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(0.5);
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(1.2);
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(1.1);
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(0.8);
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(0.75);
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(stirrupEnd);
double expectedStrength = 1.2 * 1.1 * 1.0 * 4.0; // Min(2.0, 1.0) = 1.0
// Act
double result = _beamShearStrength.GetShearStrength();
// Assert
Assert.That(result, Is.EqualTo(expectedStrength).Within(1e-6));
_mockTraceLogger.Verify(t => t.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.AtLeastOnce);
}
[TestCase(0.20, 0.48)]
[TestCase(0.55, 1.32)]
[TestCase(1.1, 2.64)]
[TestCase(2.2, 2.64)]
public void GetShearStrength_CalculatesCorrectly_differentInclinedSectionEnd(double inclinedSectionEnd, double expectedStrength)
{
// Arrange
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
_mockInclinedSection.Setup(s => s.EndCoord).Returns(inclinedSectionEnd);
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(0.8);
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(0.75);
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(100);
// Act
double result = _beamShearStrength.GetShearStrength();
// Assert
Assert.That(result, Is.EqualTo(expectedStrength).Within(1e-6));
_mockTraceLogger.Verify(t => t.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.AtLeastOnce);
}
[TestCase(0.2, 0.66)]
[TestCase(0.5, 1.65)]
[TestCase(0.8, 2.64)]
public void GetShearStrength_CalculatesCorrectly_differentShapeFactor(double shapeFactor, double expectedStrength)
{
// Arrange
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
_mockInclinedSection.Setup(s => s.EndCoord).Returns(1.1);
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(shapeFactor);
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(0.75);
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(100);
// Act
double result = _beamShearStrength.GetShearStrength();
// Assert
Assert.That(result, Is.EqualTo(expectedStrength).Within(1e-6));
_mockTraceLogger.Verify(t => t.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.AtLeastOnce);
}
[TestCase(0.2, 0.704)]
[TestCase(0.5, 1.76)]
[TestCase(0.8, 2.816)]
public void GetShearStrength_CalculatesCorrectly_differentPlacementFactor(double placementFactor, double expectedStrength)
{
// Arrange
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
_mockInclinedSection.Setup(s => s.EndCoord).Returns(1.1);
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(0.8);
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(placementFactor);
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(100);
// Act
double result = _beamShearStrength.GetShearStrength();

View File

@@ -3,6 +3,7 @@ using Moq;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.BeamShears;
using StructureHelperLogics.Models.Materials;
using System;
@@ -36,6 +37,7 @@ namespace StructureHelperTests.UnitTests.BeamShearTests
mockSection.Setup(s => s.ConcreteMaterial).Returns(mockConcreteMaterial.Object);
mockSection.Setup(s => s.ReinforcementMaterial).Returns(mockReinforcementMaterial.Object);
mockSection.Setup(s => s.ReinforcementArea).Returns(reinforcementArea);
mockSection.Setup(s => s.Shape).Returns(new RectangleShape(){ Width = 1, Height =2 });
var mockInclSection = new Mock<IInclinedSection>();
mockInclSection.Setup(s => s.WebWidth).Returns(width);

View File

@@ -5,6 +5,7 @@ using StructureHelperCommon.Models;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperCommon.Infrastructures.Interfaces;
namespace StructureHelperTests.UnitTests.Ndms
@@ -13,7 +14,7 @@ namespace StructureHelperTests.UnitTests.Ndms
public class CheckPrimitiveCollectionLogicTests
{
private Mock<IShiftTraceLogger> _mockTraceLogger;
private Mock<ICheckRebarPrimitiveLogic> _mockCheckRebarPrimitiveLogic;
private Mock<ICheckEntityLogic<IRebarNdmPrimitive>> _mockCheckRebarPrimitiveLogic;
private Mock<IHasPrimitives> _mockHasPrimitives;
private Mock<CheckPrimitiveCollectionLogic> _mockCheckPrimitiveCollectionLogic;
@@ -21,7 +22,7 @@ namespace StructureHelperTests.UnitTests.Ndms
public void SetUp()
{
_mockTraceLogger = new Mock<IShiftTraceLogger>();
_mockCheckRebarPrimitiveLogic = new Mock<ICheckRebarPrimitiveLogic>();
_mockCheckRebarPrimitiveLogic = new Mock<ICheckEntityLogic<IRebarNdmPrimitive>>();
_mockHasPrimitives = new Mock<IHasPrimitives>();
_mockCheckPrimitiveCollectionLogic = new Mock<CheckPrimitiveCollectionLogic>(_mockTraceLogger.Object, _mockCheckRebarPrimitiveLogic.Object)

View File

@@ -0,0 +1,135 @@
using Moq;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Services;
using StructureHelperLogics.Models.BeamShears;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperTests.UnitTests
{
[TestFixture]
public class StirrupByInclinedRebarStrengthLogicTests
{
private Mock<IInclinedSection> sectionMock;
private Mock<IStirrupByInclinedRebar> rebarMock;
private Mock<IRebarSectionStrengthLogic> rebarStrengthMock;
private Mock<IInterpolateValueLogic> interpolateMock;
private Mock<IShiftTraceLogger> loggerMock;
[SetUp]
public void SetUp()
{
sectionMock = new Mock<IInclinedSection>();
rebarMock = new Mock<IStirrupByInclinedRebar>();
rebarStrengthMock = new Mock<IRebarSectionStrengthLogic>();
interpolateMock = new Mock<IInterpolateValueLogic>();
loggerMock = new Mock<IShiftTraceLogger>();
// Default geometry
rebarMock.SetupGet(r => r.TransferLength).Returns(0.1);
rebarMock.SetupGet(r => r.StartCoordinate).Returns(0.0);
rebarMock.SetupGet(r => r.AngleOfInclination).Returns(45.0);
rebarMock.SetupGet(r => r.CompressedGap).Returns(0.0);
rebarMock.SetupGet(r => r.LegCount).Returns(2);
rebarMock.SetupGet(r => r.RebarSection).Returns(Mock.Of<IRebarSection>());
sectionMock.SetupGet(s => s.EffectiveDepth).Returns(1.0);
rebarStrengthMock.Setup(m => m.GetRebarMaxTensileForce()).Returns(1000.0);
interpolateMock.Setup(m => m.GetValueY()).Returns(123.0);
}
[Test]
public void GetShearStrength_RebarOutsideSectionStart_ReturnsZero()
{
sectionMock.SetupGet(s => s.StartCoord).Returns(10.0); // start is after rebar end
sectionMock.SetupGet(s => s.EndCoord).Returns(12.0);
var logic = CreateLogic();
var result = logic.GetShearStrength();
Assert.That(result, Is.EqualTo(0.0));
loggerMock.Verify(l => l.AddMessage(It.Is<string>(msg => msg.Contains("has been ignored"))));
}
[Test]
public void GetShearStrength_RebarOutsideSectionEnd_ReturnsZero()
{
sectionMock.SetupGet(s => s.StartCoord).Returns(-5.0);
sectionMock.SetupGet(s => s.EndCoord).Returns(-1.0);
var logic = CreateLogic();
var result = logic.GetShearStrength();
Assert.That(result, Is.EqualTo(0.0));
loggerMock.Verify(l => l.AddMessage(It.Is<string>(msg => msg.Contains("has been ignored"))));
}
[Test]
public void GetShearStrength_StartTransferZone_UsesInterpolation()
{
sectionMock.SetupGet(s => s.StartCoord).Returns(0.0);
sectionMock.SetupGet(s => s.EndCoord).Returns(0.05); // falls in start transfer zone
var logic = CreateLogic();
var result = logic.GetShearStrength();
Assert.That(result, Is.EqualTo(123.0)); // from interpolateMock
interpolateMock.Verify(m => m.GetValueY(), Times.Once);
}
[Test]
public void GetShearStrength_EndTransferZone_UsesInterpolation()
{
sectionMock.SetupGet(s => s.StartCoord).Returns(0.95); // falls in end transfer zone
sectionMock.SetupGet(s => s.EndCoord).Returns(2.0);
var logic = CreateLogic();
var result = logic.GetShearStrength();
Assert.That(result, Is.EqualTo(123.0));
interpolateMock.Verify(m => m.GetValueY(), Times.Once);
}
[Test]
public void GetShearStrength_MainZone_ComputesStrength()
{
sectionMock.SetupGet(s => s.StartCoord).Returns(0.2);
sectionMock.SetupGet(s => s.EndCoord).Returns(1.0);
var logic = CreateLogic();
var result = logic.GetShearStrength();
// Strength = 0.75 * 1000 * sin(45°) * 2
var expected = 0.75 * 1000.0 * Math.Sin(Math.PI / 4) * 2;
Assert.That(result, Is.EqualTo(expected).Within(1e-6));
}
[Test]
public void GetShearStrength_TransferZonesOverlap_ThrowsException()
{
rebarMock.SetupGet(r => r.TransferLength).Returns(5.0); // huge transfer length
var logic = CreateLogic();
Assert.Throws<StructureHelperException>(() => logic.GetShearStrength());
}
private StirrupByInclinedRebarStrengthLogic CreateLogic()
{
return new StirrupByInclinedRebarStrengthLogic(
sectionMock.Object,
rebarMock.Object,
rebarStrengthMock.Object,
interpolateMock.Object,
loggerMock.Object
);
}
}
}