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

@@ -43,7 +43,7 @@ namespace DataAccess.DTOs
private void InitializeStrategies() private void InitializeStrategies()
{ {
updateStrategy ??= new BeamShearSectionUpdateStrategy(); updateStrategy ??= new BeamShearSectionUpdateStrategy() { UpdateChildren = false};
shapeConvertStrategy = new DictionaryConvertStrategy<IShape, IShape> shapeConvertStrategy = new DictionaryConvertStrategy<IShape, IShape>
(this, new ShapeFromDTOConvertStrategy(this)); (this, new ShapeFromDTOConvertStrategy(this));
concreteConvertStrategy = new ConcreteLibMaterialFromDTOConvertStrategy() concreteConvertStrategy = new ConcreteLibMaterialFromDTOConvertStrategy()

View File

@@ -50,7 +50,7 @@ namespace DataAccess.DTOs
private void InitializeStrategies() private void InitializeStrategies()
{ {
updateStrategy ??= new BeamShearSectionUpdateStrategy(); updateStrategy ??= new BeamShearSectionUpdateStrategy() { UpdateChildren = false};
shapeConvertStrategy = new DictionaryConvertStrategy<IShape, IShape> shapeConvertStrategy = new DictionaryConvertStrategy<IShape, IShape>
(this, new ShapeToDTOConvertStrategy(this)); (this, new ShapeToDTOConvertStrategy(this));
concreteConvertStrategy = new ConcreteLibMaterialToDTOConvertStrategy() concreteConvertStrategy = new ConcreteLibMaterialToDTOConvertStrategy()

View File

@@ -0,0 +1,29 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class CircleShapeFromDTOConvertStrategy : ConvertStrategy<CircleShape, CircleShapeDTO>
{
private IUpdateStrategy<ICircleShape> updateStrategy;
public CircleShapeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override CircleShape GetNewItem(CircleShapeDTO source)
{
ChildClass = this;
ChildClass = this;
updateStrategy ??= new CircleShapeUpdateStrategy();
NewItem = new CircleShape(source.Id);
updateStrategy.Update(NewItem, source);
return NewItem;
}
}
}

View File

@@ -0,0 +1,23 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
namespace DataAccess.DTOs
{
public class CircleShapeToDTOConvertStrategy : ConvertStrategy<CircleShapeDTO, ICircleShape>
{
private IUpdateStrategy<ICircleShape> updateStrategy;
public CircleShapeToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override CircleShapeDTO GetNewItem(ICircleShape source)
{
ChildClass = this;
updateStrategy ??= new CircleShapeUpdateStrategy();
NewItem = new(source.Id);
updateStrategy.Update(NewItem, source);
return NewItem;
}
}
}

View File

@@ -7,6 +7,7 @@ namespace DataAccess.DTOs
internal class ShapeFromDTOConvertStrategy : ConvertStrategy<IShape, IShape> internal class ShapeFromDTOConvertStrategy : ConvertStrategy<IShape, IShape>
{ {
private IConvertStrategy<RectangleShape, RectangleShapeDTO> rectangleConvertStrategy; private IConvertStrategy<RectangleShape, RectangleShapeDTO> rectangleConvertStrategy;
private IConvertStrategy<CircleShape, CircleShapeDTO> circleConvertStrategy;
public ShapeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy) public ShapeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{ {
@@ -14,12 +15,19 @@ namespace DataAccess.DTOs
public override IShape GetNewItem(IShape source) public override IShape GetNewItem(IShape source)
{ {
ChildClass = this;
if (source is RectangleShapeDTO rectangleShapeDTO) if (source is RectangleShapeDTO rectangleShapeDTO)
{ {
rectangleConvertStrategy ??= new DictionaryConvertStrategy<RectangleShape, RectangleShapeDTO> rectangleConvertStrategy ??= new DictionaryConvertStrategy<RectangleShape, RectangleShapeDTO>
(this, new RectangleShapeFromDTOConvertStrategy(this)); (this, new RectangleShapeFromDTOConvertStrategy(this));
NewItem = rectangleConvertStrategy.Convert(rectangleShapeDTO); NewItem = rectangleConvertStrategy.Convert(rectangleShapeDTO);
} }
if (source is CircleShapeDTO circleShapeDTO)
{
circleConvertStrategy ??= new DictionaryConvertStrategy<CircleShape, CircleShapeDTO>
(this, new CircleShapeFromDTOConvertStrategy(this));
NewItem = circleConvertStrategy.Convert(circleShapeDTO);
}
else else
{ {
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape is unknown"); throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape is unknown");

View File

@@ -8,6 +8,7 @@ namespace DataAccess.DTOs
public class ShapeToDTOConvertStrategy : ConvertStrategy<IShape, IShape> public class ShapeToDTOConvertStrategy : ConvertStrategy<IShape, IShape>
{ {
private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleConvertStrategy; private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleConvertStrategy;
private IConvertStrategy<CircleShapeDTO, ICircleShape> circleConvertStrategy;
public ShapeToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy) public ShapeToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{ {
@@ -15,16 +16,9 @@ namespace DataAccess.DTOs
public override IShape GetNewItem(IShape source) public override IShape GetNewItem(IShape source)
{ {
try ChildClass = this;
{ GetNewShape(source);
GetNewShape(source); return NewItem;
return NewItem;
}
catch (Exception ex)
{
TraceErrorByEntity(this, ex.Message);
throw;
}
} }
private void GetNewShape(IShape source) private void GetNewShape(IShape source)
@@ -34,6 +28,10 @@ namespace DataAccess.DTOs
{ {
ProcessRectangle(rectangle); ProcessRectangle(rectangle);
} }
else if (source is ICircleShape circle)
{
ProcessCircle(circle);
}
else else
{ {
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape type"; string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape type";
@@ -42,6 +40,14 @@ namespace DataAccess.DTOs
TraceLogger?.AddMessage($"Shape converting Id = {NewItem.Id} has been has been finished successfully", TraceLogStatuses.Debug); TraceLogger?.AddMessage($"Shape converting Id = {NewItem.Id} has been has been finished successfully", TraceLogStatuses.Debug);
} }
private void ProcessCircle(ICircleShape circle)
{
TraceLogger?.AddMessage($"Shape is circle", TraceLogStatuses.Debug);
circleConvertStrategy = new DictionaryConvertStrategy<CircleShapeDTO, ICircleShape>
(this, new CircleShapeToDTOConvertStrategy(this));
NewItem = circleConvertStrategy.Convert(circle);
}
private void ProcessRectangle(IRectangleShape rectangle) private void ProcessRectangle(IRectangleShape rectangle)
{ {
TraceLogger?.AddMessage($"Shape is rectangle", TraceLogStatuses.Debug); TraceLogger?.AddMessage($"Shape is rectangle", TraceLogStatuses.Debug);

View File

@@ -14,7 +14,7 @@ namespace DataAccess.DTOs
public List<IBeamShearSection> Sections { get; } = new(); public List<IBeamShearSection> Sections { get; } = new();
[JsonProperty("Stirrups")] [JsonProperty("Stirrups")]
public List<IStirrup> Stirrups { get; } = new(); public List<IStirrup> Stirrups { get; } = new();
public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; } public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; } = new BeamShearDesignRangePropertyDTO(Guid.NewGuid());
public BeamShearCalculatorInputDataDTO(Guid id) public BeamShearCalculatorInputDataDTO(Guid id)
{ {

View File

@@ -10,9 +10,9 @@ namespace DataAccess.DTOs
[JsonProperty("AbsoluteRangeValue")] [JsonProperty("AbsoluteRangeValue")]
public double AbsoluteRangeValue { get; set; } = 0.0; public double AbsoluteRangeValue { get; set; } = 0.0;
[JsonProperty("RelativeEffectiveDepthRangeValue")] [JsonProperty("RelativeEffectiveDepthRangeValue")]
public double RelativeEffectiveDepthRangeValue { get; set; } = 3.0; public double RelativeEffectiveDepthRangeValue { get; set; } = 3.3;
[JsonProperty("StepCount")] [JsonProperty("StepCount")]
public int StepCount { get; set; } = 50; public int StepCount { get; set; } = 55;
public BeamShearDesignRangePropertyDTO(Guid id) public BeamShearDesignRangePropertyDTO(Guid id)
{ {

View File

@@ -17,13 +17,13 @@ namespace DataAccess.DTOs
[JsonProperty("Shape")] [JsonProperty("Shape")]
public IShape Shape { get; set; } = new RectangleShapeDTO(Guid.Empty); public IShape Shape { get; set; } = new RectangleShapeDTO(Guid.Empty);
[JsonProperty("ConcreteMaterial")] [JsonProperty("ConcreteMaterial")]
public IConcreteLibMaterial ConcreteMaterial { get; set; } public IConcreteLibMaterial ConcreteMaterial { get; set; } = new ConcreteLibMaterial(Guid.NewGuid());
[JsonProperty("CenterCover")] [JsonProperty("CenterCover")]
public double CenterCover { get; set; } public double CenterCover { get; set; }
[JsonProperty("ReinforcementArea")] [JsonProperty("ReinforcementArea")]
public double ReinforcementArea { get; set; } public double ReinforcementArea { get; set; }
[JsonProperty("ReinforcementMaterial")] [JsonProperty("ReinforcementMaterial")]
public IReinforcementLibMaterial ReinforcementMaterial { get; set; } public IReinforcementLibMaterial ReinforcementMaterial { get; set; } = new ReinforcementLibMaterial(Guid.NewGuid());
public BeamShearSectionDTO(Guid id) public BeamShearSectionDTO(Guid id)
{ {

View File

@@ -0,0 +1,23 @@
using Newtonsoft.Json;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class CircleShapeDTO : ICircleShape
{
[JsonProperty("Id")]
public Guid Id { get; }
[JsonProperty("Diameter")]
public double Diameter { get; set; }
public CircleShapeDTO(Guid id)
{
Id = id;
}
}
}

View File

@@ -34,6 +34,7 @@ namespace DataAccess.DTOs
List<(Type type, string name)> newList = new List<(Type type, string name)> List<(Type type, string name)> newList = new List<(Type type, string name)>
{ {
{ (typeof(AccuracyDTO), "Accuracy") }, { (typeof(AccuracyDTO), "Accuracy") },
{ (typeof(CircleShapeDTO), "CircleShape") },
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") }, { (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
{ (typeof(ColumnFilePropertyDTO), "ColumnFileProperty") }, { (typeof(ColumnFilePropertyDTO), "ColumnFileProperty") },
{ (typeof(ColumnedFilePropertyDTO), "ColumnedFileProperty") }, { (typeof(ColumnedFilePropertyDTO), "ColumnedFileProperty") },
@@ -119,6 +120,7 @@ namespace DataAccess.DTOs
{ (typeof(BeamShearAnalysisDTO), "BeamShearAnalysis") }, { (typeof(BeamShearAnalysisDTO), "BeamShearAnalysis") },
{ (typeof(BeamShearCalculatorDTO), "BeamShearCalculator") }, { (typeof(BeamShearCalculatorDTO), "BeamShearCalculator") },
{ (typeof(BeamShearCalculatorInputDataDTO), "BeamShearCalculatorInputData") }, { (typeof(BeamShearCalculatorInputDataDTO), "BeamShearCalculatorInputData") },
{ (typeof(BeamShearDesignRangePropertyDTO), "BeamShearDesignRangeProperty") },
{ (typeof(BeamShearRepositoryDTO), "BeamShearRepository") }, { (typeof(BeamShearRepositoryDTO), "BeamShearRepository") },
{ (typeof(BeamShearSectionDTO), "BeamShearSection") }, { (typeof(BeamShearSectionDTO), "BeamShearSection") },
{ (typeof(List<IBeamShearAction>), "ListOfBeamShearActions") }, { (typeof(List<IBeamShearAction>), "ListOfBeamShearActions") },

View File

@@ -637,6 +637,19 @@
</Canvas.Children> </Canvas.Children>
</Canvas> </Canvas>
</DataTemplate> </DataTemplate>
<DataTemplate x:Key="ShearCircleSection">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Ellipse Canvas.Left="3" Canvas.Top="3" Width="26" Height="26" Fill="LightGray" Stroke ="Black"/>
<Ellipse Canvas.Left="14" Canvas.Top="5" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="21" Canvas.Top="10" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="7" Canvas.Top="10" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="21" Canvas.Top="17" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="7" Canvas.Top="17" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="14" Canvas.Top="22" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="ShearRectangleSection"> <DataTemplate x:Key="ShearRectangleSection">
<Canvas Style="{DynamicResource ButtonResultCanvas}"> <Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children> <Canvas.Children>
@@ -646,7 +659,21 @@
</Canvas.Children> </Canvas.Children>
</Canvas> </Canvas>
</DataTemplate> </DataTemplate>
<DataTemplate x:Key="ShearSectionTemplate"> <DataTemplate x:Key="ShearSectionCircleTemplate">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<Ellipse Canvas.Left="3" Canvas.Top="3" Width="26" Height="26" Fill="LightGray" Stroke ="Black"/>
<Ellipse Canvas.Left="5" Canvas.Top="5" Width="22" Height="22" Fill="LightGray" Stroke ="Black"/>
<Ellipse Canvas.Left="14" Canvas.Top="7" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="20" Canvas.Top="10.5" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="8" Canvas.Top="10.5" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="20" Canvas.Top="16.5" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="8" Canvas.Top="16.5" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
<Ellipse Canvas.Left="14" Canvas.Top="20" Width="4" Height="4" Fill="DarkGray" Stroke ="Black"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="ShearSectionRectangleTemplate">
<Canvas Style="{DynamicResource ButtonResultCanvas}"> <Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children> <Canvas.Children>
<Rectangle Canvas.Left="5" Canvas.Top="3" Width="22" Height="26" Fill="LightGray" Stroke ="Black"/> <Rectangle Canvas.Left="5" Canvas.Top="3" Width="22" Height="26" Fill="LightGray" Stroke ="Black"/>

View File

@@ -21,6 +21,16 @@
<ContentControl ContentTemplate="{StaticResource Report}"/> <ContentControl ContentTemplate="{StaticResource Report}"/>
</Viewbox> </Viewbox>
</Button> </Button>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowDiagramCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show digram"
IconContent="{StaticResource MomentCurvatureDiagram}"
DescriptionText="Shows diagram for result where inclined section is started from selected result start point"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{StaticResource MomentCurvatureDiagram}"/>
</Viewbox>
</Button>
</ToolBar> </ToolBar>
</ToolBarTray> </ToolBarTray>
<Grid> <Grid>

View File

@@ -2,11 +2,7 @@
using StructureHelper.Windows.CalculationWindows.CalculatorsViews; using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
using StructureHelper.Windows.CalculationWindows.ProgressViews; using StructureHelper.Windows.CalculationWindows.ProgressViews;
using StructureHelperLogics.Models.BeamShears; using StructureHelperLogics.Models.BeamShears;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
namespace StructureHelper.Windows.BeamShears namespace StructureHelper.Windows.BeamShears
@@ -15,6 +11,7 @@ namespace StructureHelper.Windows.BeamShears
{ {
private IBeamShearActionResult result; private IBeamShearActionResult result;
private RelayCommand showTraceCommand; private RelayCommand showTraceCommand;
private RelayCommand showDiagramCommand;
public IBeamShearSectionLogicResult SelectedResult { get; set; } public IBeamShearSectionLogicResult SelectedResult { get; set; }
public List<IBeamShearSectionLogicResult> SectionResults => result.SectionResults; public List<IBeamShearSectionLogicResult> SectionResults => result.SectionResults;
@@ -27,6 +24,7 @@ namespace StructureHelper.Windows.BeamShears
} }
public ICommand ShowTraceCommand => showTraceCommand ??= new RelayCommand(ShowTrace, o => SelectedResult != null); public ICommand ShowTraceCommand => showTraceCommand ??= new RelayCommand(ShowTrace, o => SelectedResult != null);
public ICommand ShowDiagramCommand => showDiagramCommand ??= new RelayCommand(Show2DDiagram, o => SelectedResult != null);
private void ShowTrace(object obj) private void ShowTrace(object obj)
{ {
@@ -34,5 +32,12 @@ namespace StructureHelper.Windows.BeamShears
var traceWindows = new TraceDocumentView(SelectedResult.TraceLogger); var traceWindows = new TraceDocumentView(SelectedResult.TraceLogger);
traceWindows.ShowDialog(); traceWindows.ShowDialog();
} }
private void Show2DDiagram(object obj)
{
if (SelectedResult is null) { return; }
var logic = new ShearDiagramLogic(result);
logic.ShowWindow(SelectedResult.InputData.InclinedSection.StartCoord);
}
} }
} }

View File

@@ -48,7 +48,7 @@ namespace StructureHelper.Windows.BeamShears
{ {
if (SelectedResult is null) { return; } if (SelectedResult is null) { return; }
var logic = new ShearDiagramLogic(SelectedResult); var logic = new ShearDiagramLogic(SelectedResult);
logic.ShowWindow(); logic.ShowWindow(0.0);
} }
private void ShowSectionResults(object commandParameter) private void ShowSectionResults(object commandParameter)

View File

@@ -3,6 +3,7 @@ using StructureHelper.Windows.ViewModels;
using StructureHelper.Windows.ViewModels.Errors; using StructureHelper.Windows.ViewModels.Errors;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.BeamShears; using StructureHelperLogics.Models.BeamShears;
using System; using System;
using System.Windows; using System.Windows;
@@ -50,6 +51,18 @@ namespace StructureHelper.Windows.BeamShears
Name = "New rectangle section" Name = "New rectangle section"
}; };
} }
else if (sectionType is PrimitiveType.Circle)
{
NewItem = new BeamShearSection(Guid.NewGuid())
{
Name = "New circle section",
Shape = new CircleShape(Guid.NewGuid()) { Diameter = 0.6 }
};
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(sectionType));
}
} }
private void EditSection() private void EditSection()

View File

@@ -37,6 +37,18 @@
<ContentControl ContentTemplate="{DynamicResource ShearRectangleSection}"/> <ContentControl ContentTemplate="{DynamicResource ShearRectangleSection}"/>
</Viewbox> </Viewbox>
</Button> </Button>
<Button Style="{StaticResource ToolButton}"
Command="{Binding Add}"
CommandParameter="{x:Static enums:PrimitiveType.Circle}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Circle section"
IconContent="{StaticResource ShearCircleSection}"
DescriptionText="Add circle shear section (diameter, strength)"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource ShearCircleSection}"/>
</Viewbox>
</Button>
</ToolBar> </ToolBar>
<ToolBar ToolTip="Stirrups" DataContext="{Binding Stirrups}"> <ToolBar ToolTip="Stirrups" DataContext="{Binding Stirrups}">
<Button Style="{StaticResource ToolButton}" <Button Style="{StaticResource ToolButton}"
@@ -103,14 +115,27 @@ CommandParameter="{x:Static enums:StirrupTypes.GroupOfStirrups}">
</ToolBar> </ToolBar>
<ToolBar ToolTip="Templates"> <ToolBar ToolTip="Templates">
<Button Style="{StaticResource ToolButton}" <Button Style="{StaticResource ToolButton}"
Command="{Binding AddTemplate}"> Command="{Binding AddTemplate}"
CommandParameter="{x:Static enums:PrimitiveType.Rectangle}">
<Button.ToolTip> <Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Create rectangle template" <uc:ButtonToolTipEh HeaderText="Create rectangle template"
IconContent="{StaticResource ShearSectionTemplate}" IconContent="{StaticResource ShearSectionRectangleTemplate}"
DescriptionText="Create rectangle section by template"/> DescriptionText="Create rectangle section by template"/>
</Button.ToolTip> </Button.ToolTip>
<Viewbox> <Viewbox>
<ContentControl ContentTemplate="{DynamicResource ShearSectionTemplate}"/> <ContentControl ContentTemplate="{DynamicResource ShearSectionRectangleTemplate}"/>
</Viewbox>
</Button>
<Button Style="{StaticResource ToolButton}"
Command="{Binding AddTemplate}"
CommandParameter="{x:Static enums:PrimitiveType.Circle}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Create circle template"
IconContent="{StaticResource ShearSectionCircleTemplate}"
DescriptionText="Create circle section by template"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource ShearSectionCircleTemplate}"/>
</Viewbox> </Viewbox>
</Button> </Button>
</ToolBar> </ToolBar>

View File

@@ -1,4 +1,6 @@
using StructureHelper.Infrastructure; using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperLogics.Models.Analyses; using StructureHelperLogics.Models.Analyses;
using StructureHelperLogics.Models.BeamShears; using StructureHelperLogics.Models.BeamShears;
using System; using System;
@@ -38,10 +40,24 @@ namespace StructureHelper.Windows.BeamShears
private void AddTemplateMethod(object param) private void AddTemplateMethod(object param)
{ {
var templateRepository = BeamShearTemplatesFactory.GetTemplateRepository(ShearSectionTemplateTypes.Rectangle); if (param is PrimitiveType.Rectangle)
var updateStrategy = new BeamShearRepositoryAddUpdateStrategy(); {
updateStrategy.Update(repository, templateRepository); var templateRepository = BeamShearTemplatesFactory.GetTemplateRepository(ShearSectionTemplateTypes.Rectangle);
Refresh(); var updateStrategy = new BeamShearRepositoryAddUpdateStrategy();
updateStrategy.Update(repository, templateRepository);
Refresh();
}
else if (param is PrimitiveType.Circle)
{
var templateRepository = BeamShearTemplatesFactory.GetTemplateRepository(ShearSectionTemplateTypes.Circle);
var updateStrategy = new BeamShearRepositoryAddUpdateStrategy();
updateStrategy.Update(repository, templateRepository);
Refresh();
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(param));
}
} }
private void Refresh() private void Refresh()

View File

@@ -17,7 +17,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TabControl> <TabControl>
<TabItem Header="Main"> <TabItem Header="Main">
<StackPanel> <StackPanel x:Name="ShapeStackPanel">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
@@ -31,7 +31,6 @@
<TextBox Grid.Column="1" Text="{Binding Name}"/> <TextBox Grid.Column="1" Text="{Binding Name}"/>
</Grid> </Grid>
<!--ShapeEditTemplates.xaml--> <!--ShapeEditTemplates.xaml-->
<ContentControl ContentTemplate="{StaticResource RectangleShapeEdit}" Content="{Binding Shape}"/>
</StackPanel> </StackPanel>
</TabItem> </TabItem>
<TabItem Header="Concrete" DataContext="{Binding ConcreteMaterial}"> <TabItem Header="Concrete" DataContext="{Binding ConcreteMaterial}">

View File

@@ -1,5 +1,13 @@
using StructureHelperLogics.Models.BeamShears; using StructureHelper.Infrastructure.Enums;
using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.BeamShears;
using StructureHelperLogics.Models.Primitives;
using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace StructureHelper.Windows.BeamShears namespace StructureHelper.Windows.BeamShears
{ {
@@ -18,7 +26,26 @@ namespace StructureHelper.Windows.BeamShears
} }
public SectionView(IBeamShearSection section) : this(new SectionViewModel(section)) public SectionView(IBeamShearSection section) : this(new SectionViewModel(section))
{ {
AddPrimitiveProperties(section.Shape, ShapeStackPanel);
}
private void AddPrimitiveProperties(IShape shape, StackPanel stackPanel)
{
List<string> templateNames = new List<string>();
if (shape is IRectangleShape) { templateNames.Add("RectangleShapeEdit"); }
else if (shape is ICircleShape) { templateNames.Add("CircleShapeEdit"); }
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(shape));
}
foreach (var name in templateNames)
{
ContentControl contentControl = new ContentControl();
contentControl.SetResourceReference(ContentTemplateProperty, name);
Binding binding = new Binding { Source = viewModel.Shape };
contentControl.SetBinding(ContentProperty, binding);
stackPanel.Children.Add(contentControl);
}
} }
} }
} }

View File

@@ -41,7 +41,7 @@ namespace StructureHelper.Windows.BeamShears
beamShearSection.CenterCover = value; beamShearSection.CenterCover = value;
} }
} }
public IRectangleShape Shape { get; } public IShape Shape { get; }
public ConcreteViewModel ConcreteMaterial { get; } public ConcreteViewModel ConcreteMaterial { get; }
public ReinforcementViewModel ReinforcementMaterial { get; } public ReinforcementViewModel ReinforcementMaterial { get; }
@@ -55,7 +55,7 @@ namespace StructureHelper.Windows.BeamShears
TensionForSLSVisibility = false, TensionForSLSVisibility = false,
HumidityVisibility = false HumidityVisibility = false
}; };
Shape = beamShearSection.Shape as IRectangleShape; Shape = beamShearSection.Shape;
ReinforcementMaterial = new(beamShearSection.ReinforcementMaterial) { MaterialLogicVisibility = false }; ReinforcementMaterial = new(beamShearSection.ReinforcementMaterial) { MaterialLogicVisibility = false };
} }
} }

View File

@@ -11,8 +11,7 @@ namespace StructureHelper.Windows.BeamShears
{ {
public class ShearDiagramLogic public class ShearDiagramLogic
{ {
const string ForceUnitString = "kN"; private const string ForceUnitString = "kN";
private IBeamShearActionResult result; private IBeamShearActionResult result;
private IUnit unitForce; private IUnit unitForce;
@@ -23,23 +22,23 @@ namespace StructureHelper.Windows.BeamShears
unitForce = unitLogic.GetUnit(UnitTypes.Force, ForceUnitString); unitForce = unitLogic.GetUnit(UnitTypes.Force, ForceUnitString);
} }
public void ShowWindow() public void ShowWindow(double sectionsStartCoordinate)
{ {
SafetyProcessor.RunSafeProcess(() => SafetyProcessor.RunSafeProcess(() =>
{ {
var seriesList = new List<Series>(); var seriesList = new List<Series>();
var series = new Series(GetParametersByCurveResult()) { Name = "" }; var series = new Series(GetParametersByCurveResult(sectionsStartCoordinate)) { Name = "" };
seriesList.Add(series); seriesList.Add(series);
var vm = new GraphViewModel(seriesList); var vm = new GraphViewModel(seriesList);
var wnd = new GraphView(vm); var wnd = new GraphView(vm);
wnd.ShowDialog(); wnd.ShowDialog();
}, },
"Errors appeared during showing a graph, see detailed information"); "Errors appeared during showing a chart, see detailed information");
} }
private ArrayParameter<double> GetParametersByCurveResult() private ArrayParameter<double> GetParametersByCurveResult(double sectionsStartCoordinate)
{ {
List<IBeamShearSectionLogicResult> results = result.SectionResults List<IBeamShearSectionLogicResult> results = result.SectionResults
.Where(x => x.InputData.InclinedSection.StartCoord == 0) .Where(x => x.InputData.InclinedSection.StartCoord == sectionsStartCoordinate)
.ToList(); .ToList();
var labels = GetLabels(); var labels = GetLabels();
var arrayParameter = new ArrayParameter<double>(results.Count(), labels.Count(), labels); var arrayParameter = new ArrayParameter<double>(results.Count(), labels.Count(), labels);

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
namespace StructureHelperCommon.Models.Shapes
{
internal class CircleShapeCloneStrategy : ICloneStrategy<ICircleShape>
{
IUpdateStrategy<ICircleShape> updateStrategy;
public ICircleShape GetClone(ICircleShape sourceObject)
{
updateStrategy ??= new CircleShapeUpdateStrategy();
CircleShape clone = new CircleShape(Guid.NewGuid());
updateStrategy.Update(clone, sourceObject);
return clone;
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -11,6 +12,8 @@ namespace StructureHelperCommon.Models.Shapes
{ {
public void Update(ICircleShape targetObject, ICircleShape sourceObject) public void Update(ICircleShape targetObject, ICircleShape sourceObject)
{ {
CheckObject.IsNull(sourceObject);
CheckObject.IsNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Diameter = sourceObject.Diameter; targetObject.Diameter = sourceObject.Diameter;
} }

View File

@@ -0,0 +1,21 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Shapes
{
public class RectangleShapeCloneStrategy : ICloneStrategy<IRectangleShape>
{
IUpdateStrategy<IRectangleShape> updateStrategy;
public IRectangleShape GetClone(IRectangleShape sourceObject)
{
RectangleShape clone = new RectangleShape(Guid.NewGuid());
updateStrategy ??= new RectangleShapeUpdateStrategy();
updateStrategy.Update(clone, sourceObject);
return clone;
}
}
}

View File

@@ -0,0 +1,33 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Shapes
{
public class ShapeCloneStrategy : ICloneStrategy<IShape>
{
private ICloneStrategy<IRectangleShape> rectangleCloneStrategy;
private ICloneStrategy<ICircleShape> circleCloneStrategy;
public IShape GetClone(IShape sourceObject)
{
if (sourceObject is IRectangleShape rectangleShape)
{
rectangleCloneStrategy ??= new RectangleShapeCloneStrategy();
return rectangleCloneStrategy.GetClone(rectangleShape);
}
else if (sourceObject is ICircleShape circleShape)
{
circleCloneStrategy ??= new CircleShapeCloneStrategy();
return circleCloneStrategy.GetClone(circleShape);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(sourceObject));
}
}
}
}

View File

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

View File

@@ -28,7 +28,9 @@ namespace StructureHelperLogics.Models.BeamShears
public object Clone() 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 ??= new BeamShearSectionUpdateStrategy();
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;

View File

@@ -1,8 +1,10 @@
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Forces.BeamShearActions; using StructureHelperCommon.Models.Forces.BeamShearActions;
using StructureHelperCommon.Models.Shapes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -12,6 +14,7 @@ namespace StructureHelperLogics.Models.BeamShears
public enum ShearSectionTemplateTypes public enum ShearSectionTemplateTypes
{ {
Rectangle, Rectangle,
Circle
} }
public static class BeamShearTemplatesFactory public static class BeamShearTemplatesFactory
{ {
@@ -21,23 +24,46 @@ namespace StructureHelperLogics.Models.BeamShears
{ {
return GetRectangleSection(); return GetRectangleSection();
} }
if (templateType is ShearSectionTemplateTypes.Circle)
{
return GetCircleSection();
}
else else
{ {
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(templateType)); 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() 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); BeamShearRepository shearRepository = new(Guid.Empty);
IBeamShearAction shearAction = BeamShearActionFactory.GetBeamShearAction(ShearActionTypes.DistributedLoad); IBeamShearAction shearAction = BeamShearActionFactory.GetBeamShearAction(ShearActionTypes.DistributedLoad);
shearAction.Name = "New shear action"; shearAction.Name = "New shear action";
shearRepository.Actions.Add(shearAction); shearRepository.Actions.Add(shearAction);
BeamShearSection section = new(Guid.NewGuid()) { Name = "New shear section"};
shearRepository.Sections.Add(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); 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.Sections.Add(section);
beamShearCalculator.InputData.Stirrups.Add(stirrupByUniformRebar); beamShearCalculator.InputData.Stirrups.Add(stirrupByUniformRebar);
beamShearCalculator.InputData.Actions.Add(shearAction); beamShearCalculator.InputData.Actions.Add(shearAction);

View File

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

View File

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

View File

@@ -23,5 +23,9 @@ namespace StructureHelperLogics.Models.BeamShears
/// Factor of difference between real and uniform distribution /// Factor of difference between real and uniform distribution
/// </summary> /// </summary>
double StirrupPlacementFactor { get; set; } 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;
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Loggers; using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.BeamShears.Logics; using StructureHelperLogics.Models.BeamShears.Logics;
namespace StructureHelperLogics.Models.BeamShears namespace StructureHelperLogics.Models.BeamShears
@@ -72,7 +74,8 @@ namespace StructureHelperLogics.Models.BeamShears
double concreteStrength = concreteLogic.GetShearStrength(); double concreteStrength = concreteLogic.GetShearStrength();
double stirrupStrength = stirrupLogic.GetShearStrength(); double stirrupStrength = stirrupLogic.GetShearStrength();
if (stirrupStrength > concreteStrength) 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(); stirrupStrength = GetStirrupStrengthBySearch();
} }
concreteStrength *= factorOfLongitudinalForce; concreteStrength *= factorOfLongitudinalForce;
@@ -103,7 +106,7 @@ namespace StructureHelperLogics.Models.BeamShears
private double GetStirrupStrengthBySearch() private double GetStirrupStrengthBySearch()
{ {
var logic = new StirrupBySearchLogic(TraceLogger) var logic = new StirrupBySearchLogic(localTraceLogger.GetSimilarTraceLogger(100))
{ {
InputData = InputData, InputData = InputData,
SectionEffectiveness = sectionEffectiveness SectionEffectiveness = sectionEffectiveness
@@ -115,7 +118,18 @@ namespace StructureHelperLogics.Models.BeamShears
private void InitializeStrategies() 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); concreteLogic = new(sectionEffectiveness, InputData.InclinedSection, localTraceLogger);
stirrupLogic = new(InputData, localTraceLogger); stirrupLogic = new(InputData, localTraceLogger);
getLongitudinalForceFactorLogic = new GetLongitudinalForceFactorLogic(localTraceLogger?.GetSimilarTraceLogger(100)); getLongitudinalForceFactorLogic = new GetLongitudinalForceFactorLogic(localTraceLogger?.GetSimilarTraceLogger(100));

View File

@@ -3,33 +3,45 @@ using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Models.Shapes.Logics; using StructureHelperCommon.Models.Shapes.Logics;
using StructureHelperCommon.Services; using StructureHelperCommon.Services;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.BeamShears namespace StructureHelperLogics.Models.BeamShears
{ {
public class BeamShearSectionUpdateStrategy : IUpdateStrategy<IBeamShearSection> public class BeamShearSectionUpdateStrategy : IParentUpdateStrategy<IBeamShearSection>
{ {
private IUpdateStrategy<IShape> shapeUpdateStrategy; private IUpdateStrategy<IShape> shapeUpdateStrategy;
private IUpdateStrategy<IConcreteLibMaterial> concreteUpdateStrategy; private IUpdateStrategy<IConcreteLibMaterial> concreteUpdateStrategy;
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementUpdateStrategy; private IUpdateStrategy<IReinforcementLibMaterial> reinforcementUpdateStrategy;
public bool UpdateChildren { get; set; } = true;
public void Update(IBeamShearSection targetObject, IBeamShearSection sourceObject) public void Update(IBeamShearSection targetObject, IBeamShearSection sourceObject)
{ {
CheckObject.IsNull(targetObject); CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject); CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; } if (ReferenceEquals(targetObject, sourceObject)) { return; }
Check(targetObject, sourceObject);
InitializeStrategies(); InitializeStrategies();
targetObject.Name = sourceObject.Name; targetObject.Name = sourceObject.Name;
targetObject.ReinforcementArea = sourceObject.ReinforcementArea; 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; 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() private void InitializeStrategies()

View File

@@ -9,6 +9,7 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
private const double minValueOfCenterCover = 0.01; private const double minValueOfCenterCover = 0.01;
private const double minValueOfCrossSectionWidth = 0.05; private const double minValueOfCrossSectionWidth = 0.05;
private const double minValueOfCrossSectionHeight = 0.05; private const double minValueOfCrossSectionHeight = 0.05;
private const double minCircleDiameter = 0.05;
private bool result; private bool result;
private string checkResult; private string checkResult;
@@ -63,6 +64,10 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
{ {
CheckRectangleShape(rectangle); CheckRectangleShape(rectangle);
} }
else if (Entity.Shape is ICircleShape circle)
{
CheckCircleShape(circle);
}
else else
{ {
result = false; 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) private void CheckRectangleShape(IRectangleShape rectangle)
{ {
if (rectangle.Width < minValueOfCrossSectionWidth) if (rectangle.Width < minValueOfCrossSectionWidth)

View File

@@ -11,7 +11,7 @@ namespace StructureHelperLogics.Models.BeamShears
/// <inheritdoc/> /// <inheritdoc/>
public class StirrupByDensityStrengthLogic : IBeamShearStrenghLogic public class StirrupByDensityStrengthLogic : IBeamShearStrenghLogic
{ {
private const double minStirrupRatio = 0.25; //private const double minStirrupRatio = 0.25;
private readonly IStirrupEffectiveness stirrupEffectiveness; private readonly IStirrupEffectiveness stirrupEffectiveness;
private readonly IStirrupByDensity stirrupByDensity; private readonly IStirrupByDensity stirrupByDensity;
private readonly IInclinedSection inclinedSection; private readonly IInclinedSection inclinedSection;
@@ -45,9 +45,10 @@ namespace StructureHelperLogics.Models.BeamShears
double finalDensity = stirrupEffectiveness.StirrupShapeFactor * stirrupEffectiveness.StirrupPlacementFactor * stirrupByDensity.StirrupDensity; double finalDensity = stirrupEffectiveness.StirrupShapeFactor * stirrupEffectiveness.StirrupPlacementFactor * stirrupByDensity.StirrupDensity;
TraceLogger?.AddMessage($"Stirrups design density qsw = {stirrupEffectiveness.StirrupShapeFactor} * {stirrupEffectiveness.StirrupPlacementFactor} * {stirrupByDensity.StirrupDensity} = {finalDensity}(N/m)"); TraceLogger?.AddMessage($"Stirrups design density qsw = {stirrupEffectiveness.StirrupShapeFactor} * {stirrupEffectiveness.StirrupPlacementFactor} * {stirrupByDensity.StirrupDensity} = {finalDensity}(N/m)");
double concreteDensity = inclinedSection.WebWidth * inclinedSection.ConcreteTensionStrength; 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; finalDensity = 0;
} }
double strength = finalDensity * finalCrackLength; double strength = finalDensity * finalCrackLength;

View File

@@ -35,12 +35,12 @@ namespace StructureHelperLogics.Models.BeamShears
GetGeometry(); GetGeometry();
if (inclinedSection.StartCoord > rebarEndPoint) 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; return 0.0;
} }
if (inclinedSection.EndCoord < rebarStartPoint) 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; return 0.0;
} }
if (inclinedSection.StartCoord > rebarTrueEndPoint & inclinedSection.StartCoord < rebarEndPoint) if (inclinedSection.StartCoord > rebarTrueEndPoint & inclinedSection.StartCoord < rebarEndPoint)

View File

@@ -8,29 +8,32 @@ namespace StructureHelperLogics.Models.BeamShears
{ {
private ConcreteStrengthLogic concreteLogic; private ConcreteStrengthLogic concreteLogic;
private StirrupStrengthLogic stirrupLogic; 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) public StirrupBySearchLogic(IShiftTraceLogger? traceLogger)
{ {
TraceLogger = traceLogger; TraceLogger = traceLogger;
} }
public IShiftTraceLogger? TraceLogger { get; set; }
public IBeamShearSectionLogicInputData InputData { get; internal set; }
public ISectionEffectiveness SectionEffectiveness { get; internal set; }
public double GetShearStrength() public double GetShearStrength()
{ {
double parameter = GetParameter(); double parameter = GetInclinedCrackRatio();
BeamShearSectionLogicInputData newInputData = GetNewInputData(parameter); BeamShearSectionLogicInputData newInputData = GetNewInputDataByCrackLengthRatio(parameter);
stirrupLogic = new(newInputData, localTraceLogger); 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(); double stirrupStrength = stirrupLogic.GetShearStrength();
return stirrupStrength; 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.InputData.Predicate = GetPredicate;
parameterCalculator.Accuracy.IterationAccuracy = 0.0001d; parameterCalculator.Accuracy.IterationAccuracy = 0.0001d;
parameterCalculator.Accuracy.MaxIterationCount = 1000; parameterCalculator.Accuracy.MaxIterationCount = 1000;
@@ -40,24 +43,32 @@ namespace StructureHelperLogics.Models.BeamShears
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate error"); throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate error");
} }
var result = parameterCalculator.Result as FindParameterResult; var result = parameterCalculator.Result as FindParameterResult;
var parameter = result.Parameter; var crackLengthRatio = result.Parameter;
return parameter; while (GetPredicate(crackLengthRatio) == false)
{
crackLengthRatio += 0.0001;
}
return crackLengthRatio;
} }
/// <summary>
private bool GetPredicate(double factor) /// 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); BeamShearSectionLogicInputData newInputData = GetNewInputDataByCrackLengthRatio(crackLengthRatio);
concreteLogic = new(SectionEffectiveness, newInputData.InclinedSection, localTraceLogger); concreteLogic = new(SectionEffectiveness, newInputData.InclinedSection, null);
stirrupLogic = new(newInputData, localTraceLogger); stirrupLogic = new(newInputData, null);
double concreteStrength = concreteLogic.GetShearStrength(); double concreteStrength = concreteLogic.GetShearStrength();
double stirrupStrength = stirrupLogic.GetShearStrength(); double stirrupStrength = stirrupLogic.GetShearStrength();
return stirrupStrength > concreteStrength; return stirrupStrength > concreteStrength;
} }
private BeamShearSectionLogicInputData GetNewInputData(double factor) private BeamShearSectionLogicInputData GetNewInputDataByCrackLengthRatio(double crackLengthRatio)
{ {
double sourceCrackLength = InputData.InclinedSection.EndCoord - InputData.InclinedSection.StartCoord; double sourceCrackLength = InputData.InclinedSection.EndCoord - InputData.InclinedSection.StartCoord;
double newCrackLength = sourceCrackLength * factor; double newCrackLength = sourceCrackLength * crackLengthRatio;
double newStartCoord = InputData.InclinedSection.EndCoord - newCrackLength; double newStartCoord = InputData.InclinedSection.EndCoord - newCrackLength;
InclinedSection newSection = new(); InclinedSection newSection = new();
var updateStrategy = new InclinedSectionUpdateStrategy(); var updateStrategy = new InclinedSectionUpdateStrategy();

View File

@@ -1,5 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.Models.BeamShears namespace StructureHelperLogics.Models.BeamShears
{ {
@@ -11,6 +12,7 @@ namespace StructureHelperLogics.Models.BeamShears
private IBeamShearStrenghLogic stirrupByDensityStrengthLogic; private IBeamShearStrenghLogic stirrupByDensityStrengthLogic;
private IBeamShearStrenghLogic stirrupGroupStrengthLogic; private IBeamShearStrenghLogic stirrupGroupStrengthLogic;
private IBeamShearStrenghLogic stirrupByInclinedRebarStrengthLogic; private IBeamShearStrenghLogic stirrupByInclinedRebarStrengthLogic;
private IStirrupEffectiveness stirrupEffectiveness;
public StirrupStrengthLogic(IBeamShearSectionLogicInputData inputData, IShiftTraceLogger? traceLogger) public StirrupStrengthLogic(IBeamShearSectionLogicInputData inputData, IShiftTraceLogger? traceLogger)
{ {
@@ -22,28 +24,28 @@ namespace StructureHelperLogics.Models.BeamShears
public double GetShearStrength() public double GetShearStrength()
{ {
var stirrupEffectiveness = StirrupEffectivenessFactory.GetEffectiveness(BeamShearSectionType.Rectangle); GetStirrupEffectiveness();
if (stirrup is IStirrupByRebar stirrupByRebar) 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); stirrupByDensityStrengthLogic = new StirrupByRebarStrengthLogic(stirrupEffectiveness, stirrupByRebar, inclinedSection, inputData.ForceTuple, TraceLogger);
return stirrupByDensityStrengthLogic.GetShearStrength(); return stirrupByDensityStrengthLogic.GetShearStrength();
} }
else if (stirrup is IStirrupGroup stirrupGroup) 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); stirrupGroupStrengthLogic ??= new StirrupGroupStrengthLogic(inputData, stirrupGroup, TraceLogger);
return stirrupGroupStrengthLogic.GetShearStrength(); return stirrupGroupStrengthLogic.GetShearStrength();
} }
else if (stirrup is IStirrupByDensity stirrupByDensity) else if (stirrup is IStirrupByDensity stirrupByDensity)
{ {
TraceLogger?.AddMessage($"Stirrups type is stirrup by density {stirrupByDensity.Name}"); TraceLogger?.AddMessage($"Stirrups type is stirrup by density Name = {stirrupByDensity.Name}");
stirrupByDensityStrengthLogic = new StirrupByDensityStrengthLogic(stirrupEffectiveness, stirrupByDensity, inclinedSection,TraceLogger); stirrupByDensityStrengthLogic = new StirrupByDensityStrengthLogic(stirrupEffectiveness, stirrupByDensity, inclinedSection, TraceLogger);
return stirrupByDensityStrengthLogic.GetShearStrength(); return stirrupByDensityStrengthLogic.GetShearStrength();
} }
else if (stirrup is IStirrupByInclinedRebar inclinedRebar) 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); stirrupByInclinedRebarStrengthLogic ??= new StirrupByInclinedRebarStrengthLogic(inclinedSection, inclinedRebar, TraceLogger);
return stirrupByInclinedRebarStrengthLogic.GetShearStrength(); 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; } public double StirrupShapeFactor { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
public double StirrupPlacementFactor { get; set; } public double StirrupPlacementFactor { get; set; }
/// <inheritdoc/>
public double MinimumStirrupRatio { get; set; }
} }
} }