diff --git a/DataAccess/DTOs/Converters/PrimitiveVisualPropertyFromDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/PrimitiveVisualPropertyFromDTOConvertStrategy.cs index e97ad9f..7cb3597 100644 --- a/DataAccess/DTOs/Converters/PrimitiveVisualPropertyFromDTOConvertStrategy.cs +++ b/DataAccess/DTOs/Converters/PrimitiveVisualPropertyFromDTOConvertStrategy.cs @@ -6,7 +6,7 @@ namespace DataAccess.DTOs { internal class PrimitiveVisualPropertyFromDTOConvertStrategy : ConvertStrategy { - private IUpdateStrategy _updateStrategy; + private IUpdateStrategy updateStrategy; public PrimitiveVisualPropertyFromDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger) : base(referenceDictionary, traceLogger) { @@ -14,9 +14,10 @@ namespace DataAccess.DTOs public override PrimitiveVisualProperty GetNewItem(PrimitiveVisualPropertyDTO source) { - _updateStrategy ??= new PrimitiveVisualPropertyUpdateStrategy(); + updateStrategy ??= new PrimitiveVisualPropertyUpdateStrategy(); ChildClass = this; NewItem = new(source.Id); + updateStrategy.Update(NewItem, source); return NewItem; } } diff --git a/DataAccess/DTOs/Converters/PrimitiveVisualPropertyToDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/PrimitiveVisualPropertyToDTOConvertStrategy.cs index 3c912b1..b30dce2 100644 --- a/DataAccess/DTOs/Converters/PrimitiveVisualPropertyToDTOConvertStrategy.cs +++ b/DataAccess/DTOs/Converters/PrimitiveVisualPropertyToDTOConvertStrategy.cs @@ -19,6 +19,7 @@ namespace DataAccess.DTOs _updateStrategy ??= new PrimitiveVisualPropertyUpdateStrategy(); ChildClass = this; NewItem = new(source.Id); + _updateStrategy.Update(NewItem, source); return NewItem; } } diff --git a/DataAccess/DTOs/DTOEntities/BeamShears/BeamShearDesignRangePropertyDTO.cs b/DataAccess/DTOs/DTOEntities/BeamShears/BeamShearDesignRangePropertyDTO.cs index 8275f86..02a000c 100644 --- a/DataAccess/DTOs/DTOEntities/BeamShears/BeamShearDesignRangePropertyDTO.cs +++ b/DataAccess/DTOs/DTOEntities/BeamShears/BeamShearDesignRangePropertyDTO.cs @@ -13,6 +13,10 @@ 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) { diff --git a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs index b03fbf7..420f99b 100644 --- a/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs +++ b/StructureHelper/Infrastructure/UI/GraphicalPrimitives/InclinedSectionPrimitive.cs @@ -9,16 +9,21 @@ namespace StructureHelper.Infrastructure.UI.GraphicalPrimitives { private IBeamShearSectionLogicResult source; private IInclinedSection inclinedSection => source.InputData.InclinedSection; + private IInclinedSection inclinedCrack => source.InputData.InclinedCrack; public double SectionStartX => inclinedSection.StartCoord; public double SectionEndX => inclinedSection.EndCoord; public double SectionStartY => inclinedSection.FullDepth - inclinedSection.EffectiveDepth; public double SectionEndY => inclinedSection.FullDepth; + public double CrackStartX => inclinedCrack.StartCoord; public double FactorOfUsing => Math.Round(source.FactorOfUsing, 4); public double EffectiveDepth => Math.Round(inclinedSection.EffectiveDepth, 3); public double SpanRatio => (inclinedSection.EndCoord - inclinedSection.StartCoord) / inclinedSection.EffectiveDepth; + public double CrackSpanRatio => (inclinedCrack.EndCoord - inclinedCrack.StartCoord) / inclinedSection.EffectiveDepth; public double ActualShearForce => Math.Round(source.InputData.ForceTuple.Qy); public double UltimateShearForce => Math.Round(source.TotalStrength); + public double ConcreteShearForce => Math.Round(source.ConcreteStrength); + public double StirrupShearForce => Math.Round(source.StirrupStrength); public double CenterX => 0; public double CenterY => 0; diff --git a/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml b/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml index 524141f..e23077b 100644 --- a/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml +++ b/StructureHelper/Infrastructure/UI/Resources/BeamShearTemplate.xaml @@ -24,12 +24,12 @@ - - - - + + + + - + @@ -85,12 +85,14 @@ + @@ -102,16 +104,16 @@ - - - - - - - - + + + + + + + + - + @@ -126,7 +128,6 @@ - @@ -141,6 +142,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -167,14 +210,14 @@ - - - - - - + + + + + + - + @@ -215,10 +258,10 @@ - - + + - + @@ -248,13 +291,14 @@ - - - - - + + + + + + - + @@ -262,8 +306,10 @@ - - + + + + diff --git a/StructureHelperCommon/Models/Calculators/FindParameterCalculator.cs b/StructureHelperCommon/Models/Calculators/FindParameterCalculator.cs index 4990578..ab7057f 100644 --- a/StructureHelperCommon/Models/Calculators/FindParameterCalculator.cs +++ b/StructureHelperCommon/Models/Calculators/FindParameterCalculator.cs @@ -12,7 +12,15 @@ namespace StructureHelperCommon.Models.Calculators { public class FindParameterCalculator : IFindParameterCalculator { - FindParameterResult result; + private double start, end; + private Predicate predicate; + private FindParameterResult result; + private double precision; + private int maxIterationCount; + private double current; + private double step; + private int iterationNum; + public string Name { get; set; } public IFindParameterCalculatorInputData InputData { get; set; } public IAccuracy Accuracy { get; set; } @@ -43,7 +51,10 @@ namespace StructureHelperCommon.Models.Calculators result = new(); try { - FindMinimumValue(InputData.StartValue, InputData.EndValue, InputData.Predicate); + start = InputData.StartValue; + end = InputData.EndValue; + predicate = InputData.Predicate; + FindMinimumValue(); } catch (Exception ex) { @@ -56,7 +67,7 @@ namespace StructureHelperCommon.Models.Calculators throw new NotImplementedException(); } - private void FindMinimumValue(double start, double end, Predicate predicate) + private void FindMinimumValue() { TraceLogger?.AddMessage($"Calculating parameter by iterations is started,\nrequired precision {Accuracy.IterationAccuracy}"); if (predicate(end) == false) @@ -64,41 +75,14 @@ namespace StructureHelperCommon.Models.Calculators TraceLogger?.AddMessage($"Predicate for end value must be true", TraceLogStatuses.Error); throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for end value must be true"); } - double precision = Accuracy.IterationAccuracy; - int maxIterationCount = Accuracy.MaxIterationCount; - double current = start; - double step = (end - start) / 2d; - int iterationNum = 0; + precision = Accuracy.IterationAccuracy; + maxIterationCount = Accuracy.MaxIterationCount; + current = start; + step = (end - start) / 2d; + iterationNum = 0; while (step > precision) { - TraceLogger?.AddMessage($"Iteration number {iterationNum} is started", TraceLogStatuses.Debug); - if (predicate(current) == true) - { - TraceLogger?.AddMessage($"Predicate value in {current} is true", TraceLogStatuses.Debug, 50); - end = current; - } - else - { - TraceLogger?.AddMessage($"Predicate value in {current} is false", TraceLogStatuses.Debug, 50); - start = current; - } - current = (start + end) / 2d; - TraceLogger?.AddMessage($"New current value Cur=({start}+{end})/2={current}", TraceLogStatuses.Debug); - step = (end - start) / 2d; - TraceLogger?.AddMessage($"New step S={current}", TraceLogStatuses.Debug, 50); - iterationNum++; - - result.IsValid = false; - result.IterationNumber = iterationNum; - result.CurrentAccuracy = step; - ActionToOutputResults?.Invoke(result); - - if (iterationNum > maxIterationCount) - { - TraceLogger?.AddMessage($"Recuired precision was not achieved, current step {step}, required precision {precision}", TraceLogStatuses.Error); - result.Description = "Parameter was not found succefully: \n"; - throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count"); - } + ProcessIteration(); } TraceLogger?.AddMessage($"Parameter value Cur={current} was found,\nCalculation has finished succefully"); result.Parameter = current; @@ -106,5 +90,37 @@ namespace StructureHelperCommon.Models.Calculators result.IsValid = true; ActionToOutputResults?.Invoke(result); } + + private void ProcessIteration() + { + TraceLogger?.AddMessage($"Iteration number {iterationNum} is started", TraceLogStatuses.Debug); + if (predicate(current) == true) + { + TraceLogger?.AddMessage($"Predicate value in {current} is true", TraceLogStatuses.Debug, 50); + end = current; + } + else + { + TraceLogger?.AddMessage($"Predicate value in {current} is false", TraceLogStatuses.Debug, 50); + start = current; + } + current = (start + end) / 2d; + TraceLogger?.AddMessage($"New current value Cur=({start}+{end})/2={current}", TraceLogStatuses.Debug); + step = (end - start) / 2d; + TraceLogger?.AddMessage($"New step S={current}", TraceLogStatuses.Debug, 50); + iterationNum++; + + result.IsValid = false; + result.IterationNumber = iterationNum; + result.CurrentAccuracy = step; + ActionToOutputResults?.Invoke(result); + + if (iterationNum > maxIterationCount) + { + TraceLogger?.AddMessage($"Recuired precision was not achieved, current step {step}, required precision {precision}", TraceLogStatuses.Error); + result.Description = "Parameter was not found succefully: \n"; + throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": violation of iteration count"); + } + } } } diff --git a/StructureHelperLogics/Models/BeamShears/BeamShearDesignRangeProperty.cs b/StructureHelperLogics/Models/BeamShears/BeamShearDesignRangeProperty.cs index 4d3b74d..f94c325 100644 --- a/StructureHelperLogics/Models/BeamShears/BeamShearDesignRangeProperty.cs +++ b/StructureHelperLogics/Models/BeamShears/BeamShearDesignRangeProperty.cs @@ -10,6 +10,8 @@ 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; /// public Guid Id { get; } @@ -56,6 +58,33 @@ namespace StructureHelperLogics.Models.BeamShears stepCount = value; } } + + 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; diff --git a/StructureHelperLogics/Models/BeamShears/BeamShearSectionLogicInputData.cs b/StructureHelperLogics/Models/BeamShears/BeamShearSectionLogicInputData.cs index f871658..36e286a 100644 --- a/StructureHelperLogics/Models/BeamShears/BeamShearSectionLogicInputData.cs +++ b/StructureHelperLogics/Models/BeamShears/BeamShearSectionLogicInputData.cs @@ -14,6 +14,8 @@ namespace StructureHelperLogics.Models.BeamShears /// public IInclinedSection InclinedSection { get; set; } /// + public IInclinedSection InclinedCrack { get; set; } + /// public IStirrup Stirrup { get; set; } /// public LimitStates LimitState { get; set; } @@ -21,6 +23,10 @@ namespace StructureHelperLogics.Models.BeamShears public CalcTerms CalcTerm { get; set; } /// public IForceTuple ForceTuple { get; set; } + /// + public IBeamShearAction BeamShearAction { get; set; } + /// + public IBeamShearSection BeamShearSection { get; set; } public BeamShearSectionLogicInputData(Guid id) { diff --git a/StructureHelperLogics/Models/BeamShears/IBeamShearDesignRangeProperty.cs b/StructureHelperLogics/Models/BeamShears/IBeamShearDesignRangeProperty.cs index 2dadcd7..b68baa0 100644 --- a/StructureHelperLogics/Models/BeamShears/IBeamShearDesignRangeProperty.cs +++ b/StructureHelperLogics/Models/BeamShears/IBeamShearDesignRangeProperty.cs @@ -21,6 +21,14 @@ namespace StructureHelperLogics.Models.BeamShears /// double RelativeEffectiveDepthRangeValue { get; set; } /// + /// Relative value of inclination length as factor of effective depth of cross-section + /// + double RelativeEffectiveDepthSectionLengthMaxValue { get; set; } + /// + /// Relative value of inclination length as factor of effective depth of cross-section + /// + double RelativeEffectiveDepthSectionLengthMinValue { get; set; } + /// /// Number of step of solvation /// int StepCount { get; set; } diff --git a/StructureHelperLogics/Models/BeamShears/IBeamShearSectionLogicInputData.cs b/StructureHelperLogics/Models/BeamShears/IBeamShearSectionLogicInputData.cs index cfc7a66..18d6057 100644 --- a/StructureHelperLogics/Models/BeamShears/IBeamShearSectionLogicInputData.cs +++ b/StructureHelperLogics/Models/BeamShears/IBeamShearSectionLogicInputData.cs @@ -13,10 +13,13 @@ namespace StructureHelperLogics.Models.BeamShears /// public interface IBeamShearSectionLogicInputData : IInputData, ISaveable { + IBeamShearAction BeamShearAction { get; set; } + IBeamShearSection BeamShearSection { get; set; } /// /// Properties of RC cross-section /// IInclinedSection InclinedSection { get; set; } + IInclinedSection InclinedCrack { get; set; } /// /// Properties of stirrups in cross-section /// diff --git a/StructureHelperLogics/Models/BeamShears/Logics/BeamShearCalculatorLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/BeamShearCalculatorLogic.cs index a7f85ac..811eb97 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/BeamShearCalculatorLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/BeamShearCalculatorLogic.cs @@ -2,22 +2,23 @@ using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models; -using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Loggers; using StructureHelperLogics.Models.Materials; -using StructureHelperLogics.NdmCalculations.Primitives; namespace StructureHelperLogics.Models.BeamShears { public class BeamShearCalculatorLogic : IGetResultByInputDataLogic { private const LimitStates CollapseLimitState = LimitStates.ULS; + private readonly List calcTerms = new() { CalcTerms.LongTerm, CalcTerms.ShortTerm }; private IBeamShearCalculatorResult result; - private IBeamShearSectionLogic beamShearSectionLogic; private List actionResults; private IBeamShearCalculatorInputData inputData; - private readonly List calcTerms = new() { CalcTerms.LongTerm, CalcTerms.ShortTerm }; + private List inclinedSections; + private IBeamShearSectionLogic beamShearSectionLogic; + private IGetBeamShearSectionIputDatasLogic getBeamShearSectionIputDatasLogic; + private IGetInclinedSectionListLogic getInclinedSectionListLogic; public IShiftTraceLogger? TraceLogger { get; set; } @@ -36,7 +37,7 @@ namespace StructureHelperLogics.Models.BeamShears InitializeStrategies(); try { - GetSections(); + GetActionResults(); result.ActionResults = actionResults; } catch (Exception ex) @@ -82,6 +83,8 @@ namespace StructureHelperLogics.Models.BeamShears private void InitializeStrategies() { beamShearSectionLogic ??= new BeamShearSectionLogic(TraceLogger); + getInclinedSectionListLogic ??= new GetInclinedSectionListLogic(null); + getBeamShearSectionIputDatasLogic ??= new GetBeamShearSectionIputDatasLogic(); } private void PrepareNewResult() @@ -93,7 +96,7 @@ namespace StructureHelperLogics.Models.BeamShears }; } - private void GetSections() + private void GetActionResults() { actionResults = new(); List stirrups = inputData.Stirrups.ToList(); @@ -103,17 +106,24 @@ namespace StructureHelperLogics.Models.BeamShears } foreach (var beamShearAction in inputData.Actions) { + getBeamShearSectionIputDatasLogic.Action = beamShearAction; foreach (var calcTerm in calcTerms) { + getBeamShearSectionIputDatasLogic.CalcTerm = calcTerm; foreach (var section in inputData.Sections) { + getInclinedSectionListLogic.BeamShearSection = section; + getInclinedSectionListLogic.DesignRangeProperty = inputData.DesignRangeProperty; + inclinedSections = getInclinedSectionListLogic.GetInclinedSections(); + getBeamShearSectionIputDatasLogic.Section = section; + getBeamShearSectionIputDatasLogic.InclinedSectionList = inclinedSections; TraceLogger?.AddMessage($"Analysis for action: {beamShearAction.Name}, section: {section.Name}, calc turm {calcTerm} has been started"); TraceSection(section); foreach (var stirrup in stirrups) { - List inclinedSections = GetInclinedSections(section); - List sectionInputDatas = GetSectionInputDatas(beamShearAction, calcTerm, section, stirrup, inclinedSections); - List sectionResults = GetSectionResults(sectionInputDatas); + getBeamShearSectionIputDatasLogic.Stirrup = stirrup; + List sectionInputDatas = getBeamShearSectionIputDatasLogic.GetBeamShearSectionInputDatas(); + List sectionResults = GetInclinedSectionResults(sectionInputDatas); BeamShearActionResult actionResult = GetActionResult(beamShearAction, calcTerm, section, stirrup, sectionResults); actionResults.Add(actionResult); } @@ -139,7 +149,7 @@ namespace StructureHelperLogics.Models.BeamShears return actionResult; } - private List GetSectionResults(List sectionInputDatas) + private List GetInclinedSectionResults(List sectionInputDatas) { List sectionResults = new(); foreach (var item in sectionInputDatas) @@ -147,42 +157,9 @@ namespace StructureHelperLogics.Models.BeamShears IBeamShearSectionLogicResult sectionResult = CalculateInclinedSectionResult(item); sectionResults.Add(sectionResult); } - return sectionResults; } - private List GetSectionInputDatas(IBeamShearAction beamShearAction, CalcTerms calcTerm, IBeamShearSection section, IStirrup stirrup, List inclinedSections) - { - List sectionInputDatas = new(); - var material = section.ConcreteMaterial; - var strength = material.GetStrength(CollapseLimitState, calcTerm); - foreach (var inclinedSection in inclinedSections) - { - inclinedSection.LimitState = CollapseLimitState; - inclinedSection.CalcTerm = calcTerm; - inclinedSection.ConcreteCompressionStrength = strength.Compressive; - inclinedSection.ConcreteTensionStrength = strength.Tensile; - DirectShearForceLogicInputData inputData = new() - { - BeamShearAction = beamShearAction, - InclinedSection = inclinedSection, - LimitState = CollapseLimitState, - CalcTerm = calcTerm, - }; - IForceTuple forceTuple = GetForceTupleByShearAction(inputData); - BeamShearSectionLogicInputData newInputData = new(Guid.NewGuid()) - { - InclinedSection = inclinedSection, - Stirrup = stirrup, - ForceTuple = forceTuple, - LimitState = CollapseLimitState, - CalcTerm = calcTerm - }; - sectionInputDatas.Add(newInputData); - } - - return sectionInputDatas; - } private static BeamShearActionResult PrepareNewActionResult(IBeamShearAction beamShearAction, CalcTerms calcTerm, IBeamShearSection section, IStirrup stirrup) { @@ -197,19 +174,5 @@ namespace StructureHelperLogics.Models.BeamShears Stirrup = stirrup }; } - - private List GetInclinedSections(IBeamShearSection beamShearSection) - { - IGetInclinedSectionListInputData inclinedSectionInputDataLogic = new GetInclinedSectionListInputData(inputData.DesignRangeProperty, beamShearSection); - //IGetInclinedSectionListLogic getInclinedSectionListLogic = new GetInclinedSectionListLogic(inclinedSectionInputDataLogic, TraceLogger); - IGetInclinedSectionListLogic getInclinedSectionListLogic = new GetInclinedSectionListLogic(inclinedSectionInputDataLogic, null); - return getInclinedSectionListLogic.GetInclinedSections(); - } - - private IForceTuple GetForceTupleByShearAction(IDirectShearForceLogicInputData inputData) - { - IGetDirectShearForceLogic getDirectShearForceLogic = new GetDirectShearForceLogic(inputData, null); - return getDirectShearForceLogic.CalculateShearForceTuple(); - } } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/BeamShearSectionLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/BeamShearSectionLogic.cs index 637af11..470e96e 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/BeamShearSectionLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/BeamShearSectionLogic.cs @@ -17,6 +17,8 @@ namespace StructureHelperLogics.Models.BeamShears private IGetLongitudinalForceFactorLogic getLongitudinalForceFactorLogic; private string sectionMessage; private ICheckInputDataLogic checkInputDataLogic; + private double concreteStrength; + private double stirrupStrength; private ShiftTraceLogger? localTraceLogger { get; set; } @@ -41,6 +43,7 @@ namespace StructureHelperLogics.Models.BeamShears InitializeStrategies(); try { + AddInclinedCrackToInputData(); CalculateResult(); } catch (Exception ex) @@ -50,6 +53,20 @@ namespace StructureHelperLogics.Models.BeamShears } } + private void AddInclinedCrackToInputData() + { + InclinedSection newSection = new(); + var updateStrategy = new InclinedSectionUpdateStrategy(); + updateStrategy.Update(newSection, InputData.InclinedSection); + double crackLength = newSection.EndCoord - newSection.StartCoord; + double maxCrackLength = 2 * newSection.EffectiveDepth; + if (crackLength > maxCrackLength) + { + newSection.StartCoord = newSection.EndCoord - maxCrackLength; + } + InputData.InclinedCrack = newSection; + } + private bool Check() { bool checkResult = true; @@ -71,8 +88,8 @@ namespace StructureHelperLogics.Models.BeamShears SetLongitudinalForce(); double factorOfLongitudinalForce = getLongitudinalForceFactorLogic.GetFactor(); localTraceLogger?.AddMessage($"Factor of longitudinal force = {factorOfLongitudinalForce}, (dimensionless)"); - double concreteStrength = concreteLogic.GetShearStrength(); - double stirrupStrength = stirrupLogic.GetShearStrength(); + concreteStrength = concreteLogic.GetShearStrength(); + stirrupStrength = stirrupLogic.GetShearStrength(); 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."); @@ -113,6 +130,7 @@ namespace StructureHelperLogics.Models.BeamShears }; double stirrupStrength = logic.GetShearStrength(); localTraceLogger?.AddMessage($"Stirrup strength was restricted as Qsw,restricted = {stirrupStrength}(N)"); + InputData.InclinedCrack = logic.InclinedCrack; return stirrupStrength; } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/GetBeamShearSectionIputDatasLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/GetBeamShearSectionIputDatasLogic.cs new file mode 100644 index 0000000..bdd1b1c --- /dev/null +++ b/StructureHelperLogics/Models/BeamShears/Logics/GetBeamShearSectionIputDatasLogic.cs @@ -0,0 +1,71 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; + +namespace StructureHelperLogics.Models.BeamShears +{ + public class GetBeamShearSectionIputDatasLogic : IGetBeamShearSectionIputDatasLogic + { + private const LimitStates CollapseLimitState = LimitStates.ULS; + private IDirectShearForceLogicInputData directShearForceLogicInputData; + private (double Compressive, double Tensile) strength; + + public IBeamShearAction Action { get; set; } + public CalcTerms CalcTerm { get; set; } + public IBeamShearSection Section { get; set; } + public IStirrup Stirrup { get; set; } + public List InclinedSectionList { get; set; } + + public List GetBeamShearSectionInputDatas() + { + List sectionInputDatas = new(); + var material = Section.ConcreteMaterial; + strength = material.GetStrength(CollapseLimitState, CalcTerm); + foreach (var inclinedSection in InclinedSectionList) + { + PrepareInclinedSection(inclinedSection); + BeamShearSectionLogicInputData newInputData = GetNewInputData(inclinedSection); + sectionInputDatas.Add(newInputData); + } + + return sectionInputDatas; + } + + private void PrepareInclinedSection(IInclinedSection inclinedSection) + { + inclinedSection.LimitState = CollapseLimitState; + inclinedSection.CalcTerm = CalcTerm; + inclinedSection.ConcreteCompressionStrength = strength.Compressive; + inclinedSection.ConcreteTensionStrength = strength.Tensile; + } + + private BeamShearSectionLogicInputData GetNewInputData(IInclinedSection inclinedSection) + { + IForceTuple forceTuple = GetForceTupleByShearAction(inclinedSection); + BeamShearSectionLogicInputData beamShearSectionLogicInputData = new(Guid.NewGuid()) + { + InclinedSection = inclinedSection, + BeamShearAction = Action, + BeamShearSection = Section, + Stirrup = Stirrup, + ForceTuple = forceTuple, + LimitState = CollapseLimitState, + CalcTerm = CalcTerm + }; + BeamShearSectionLogicInputData newInputData = beamShearSectionLogicInputData; + return newInputData; + } + + private IForceTuple GetForceTupleByShearAction(IInclinedSection inclinedSection) + { + directShearForceLogicInputData = new DirectShearForceLogicInputData() + { + BeamShearAction = Action, + InclinedSection = inclinedSection, + LimitState = CollapseLimitState, + CalcTerm = CalcTerm, + }; + IGetDirectShearForceLogic getDirectShearForceLogic = new GetDirectShearForceLogic(directShearForceLogicInputData, null); + return getDirectShearForceLogic.CalculateShearForceTuple(); + } + } +} diff --git a/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListInputData.cs b/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListInputData.cs deleted file mode 100644 index 429236d..0000000 --- a/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListInputData.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StructureHelperLogics.Models.BeamShears -{ - /// - public class GetInclinedSectionListInputData : IGetInclinedSectionListInputData - { - public IBeamShearDesignRangeProperty DesignRangeProperty { get; } - public IGetInclinedSectionLogic? GetInclinedSectionLogic { get; set; } - public IBeamShearSection BeamShearSection { get; set; } - - public GetInclinedSectionListInputData(IBeamShearDesignRangeProperty designRangeProperty, IBeamShearSection beamShearSection) - { - DesignRangeProperty = designRangeProperty; - BeamShearSection = beamShearSection; - } - } -} diff --git a/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListLogic.cs index 5f032e3..2d6c8fe 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/GetInclinedSectionListLogic.cs @@ -7,19 +7,18 @@ namespace StructureHelperLogics.Models.BeamShears { public class GetInclinedSectionListLogic : IGetInclinedSectionListLogic { - private readonly IGetInclinedSectionListInputData inputData; private IGetInclinedSectionLogic inclinedSectionLogic; private double depth; private double effectiveDepth; private List inclinedSections; private List coordinates; + + public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; } + public IBeamShearSection BeamShearSection { get; set; } public IShiftTraceLogger? TraceLogger { get; set; } - public GetInclinedSectionListLogic( - IGetInclinedSectionListInputData inputData, - IShiftTraceLogger? traceLogger) + public GetInclinedSectionListLogic(IShiftTraceLogger? traceLogger) { - this.inputData = inputData; TraceLogger = traceLogger; } @@ -29,14 +28,20 @@ namespace StructureHelperLogics.Models.BeamShears Check(); GetShapeParameters(); GetCoordinates(); + double minSectionLength = DesignRangeProperty.RelativeEffectiveDepthSectionLengthMinValue * effectiveDepth; + double maxSectionLength = DesignRangeProperty.RelativeEffectiveDepthSectionLengthMaxValue * effectiveDepth; foreach (var startCoord in coordinates) { var endCoordinates = coordinates.Where(x => x >= startCoord); foreach (var endCoord in endCoordinates) { - inclinedSectionLogic = InitializeInclinedSectionLogic(startCoord, endCoord); - IInclinedSection inclinedSection = inclinedSectionLogic.GetInclinedSection(); - inclinedSections.Add(inclinedSection); + double sectionLength = endCoord - startCoord; + if (sectionLength >= minSectionLength & sectionLength <= maxSectionLength) + { + inclinedSectionLogic = new GetInclinedSectionLogic(BeamShearSection, startCoord, endCoord, TraceLogger); + IInclinedSection inclinedSection = inclinedSectionLogic.GetInclinedSection(); + inclinedSections.Add(inclinedSection); + } } } return inclinedSections; @@ -44,8 +49,8 @@ namespace StructureHelperLogics.Models.BeamShears private void GetCoordinates() { - double maxSectionLength = GetMaxSectionLength(); - int stepCount = inputData.DesignRangeProperty.StepCount; + double maxSectionLength = GetMaxLengthOfInclinedSection(); + int stepCount = DesignRangeProperty.StepCount; double step = maxSectionLength / stepCount; inclinedSections = new(); coordinates = new(); @@ -57,41 +62,36 @@ namespace StructureHelperLogics.Models.BeamShears } } - private double GetMaxSectionLength() + private double GetMaxLengthOfInclinedSection() { - double relativeLength = inputData.DesignRangeProperty.RelativeEffectiveDepthRangeValue * effectiveDepth; - double length = Math.Max(relativeLength, inputData.DesignRangeProperty.AbsoluteRangeValue); + double minimumRelativeLength = DesignRangeProperty.RelativeEffectiveDepthRangeValue * effectiveDepth; + double minimumAbsoluteLength = DesignRangeProperty.AbsoluteRangeValue; + double length = Math.Max(minimumRelativeLength, minimumAbsoluteLength); return length; } private void Check() { - CheckObject.IsNull(inputData); - CheckObject.IsNull(inputData.BeamShearSection); - } - private IGetInclinedSectionLogic InitializeInclinedSectionLogic(double startCoord, double endCoord) - { - if (inputData.GetInclinedSectionLogic is not null) - { - return inputData.GetInclinedSectionLogic; - } - return new GetInclinedSectionLogic(inputData.BeamShearSection, startCoord, endCoord, TraceLogger); + CheckObject.IsNull(BeamShearSection); + CheckObject.IsNull(DesignRangeProperty); } + private void GetShapeParameters() { - if (inputData.BeamShearSection.Shape is IRectangleShape rectangle) + if (BeamShearSection.Shape is IRectangleShape rectangle) { depth = rectangle.Height; } - else if (inputData.BeamShearSection.Shape is ICircleShape circle) + else if (BeamShearSection.Shape is ICircleShape circle) { depth = circle.Diameter; } else { - throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(inputData.BeamShearSection.Shape)); + throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(BeamShearSection.Shape)); } - effectiveDepth = depth - inputData.BeamShearSection.CenterCover; + double coverLayerOfConcrete = BeamShearSection.CenterCover; + effectiveDepth = depth - coverLayerOfConcrete; } } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/IGetBeamShearSectionIputDatasLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/IGetBeamShearSectionIputDatasLogic.cs new file mode 100644 index 0000000..ae9b160 --- /dev/null +++ b/StructureHelperLogics/Models/BeamShears/Logics/IGetBeamShearSectionIputDatasLogic.cs @@ -0,0 +1,16 @@ + +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; + +namespace StructureHelperLogics.Models.BeamShears +{ + public interface IGetBeamShearSectionIputDatasLogic + { + public IBeamShearAction Action { get; set; } + public CalcTerms CalcTerm { get; set; } + public IBeamShearSection Section { get; set; } + public IStirrup Stirrup { get; set; } + public List InclinedSectionList { get; set; } + List GetBeamShearSectionInputDatas(); + } +} \ No newline at end of file diff --git a/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListInputData.cs b/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListInputData.cs deleted file mode 100644 index 32ba460..0000000 --- a/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListInputData.cs +++ /dev/null @@ -1,11 +0,0 @@ -using StructureHelperCommon.Models.Calculators; - -namespace StructureHelperLogics.Models.BeamShears -{ - public interface IGetInclinedSectionListInputData : IInputData - { - IBeamShearDesignRangeProperty DesignRangeProperty { get; } - IGetInclinedSectionLogic? GetInclinedSectionLogic { get; set; } - IBeamShearSection BeamShearSection { get; set; } - } -} diff --git a/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListLogic.cs index 5d59294..37a8aac 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/IGetInclinedSectionListLogic.cs @@ -7,6 +7,8 @@ namespace StructureHelperLogics.Models.BeamShears /// public interface IGetInclinedSectionListLogic : ILogic { + public IBeamShearDesignRangeProperty DesignRangeProperty { get; set; } + public IBeamShearSection BeamShearSection { get; set; } List GetInclinedSections(); } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/StirrupBySearchLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/StirrupBySearchLogic.cs index eaf5768..ba50b85 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/StirrupBySearchLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/StirrupBySearchLogic.cs @@ -8,7 +8,10 @@ namespace StructureHelperLogics.Models.BeamShears { private ConcreteStrengthLogic concreteLogic; private StirrupStrengthLogic stirrupLogic; + private IFindParameterCalculator parameterCalculator; + public IShiftTraceLogger? TraceLogger { get; set; } + public IInclinedSection InclinedCrack { get; private set; } public IBeamShearSectionLogicInputData InputData { get; internal set; } public ISectionEffectiveness SectionEffectiveness { get; internal set; } public StirrupBySearchLogic(IShiftTraceLogger? traceLogger) @@ -20,6 +23,7 @@ namespace StructureHelperLogics.Models.BeamShears { double parameter = GetCrackLengthRatio(); BeamShearSectionLogicInputData newInputData = GetNewInputDataByCrackLengthRatio(parameter); + InclinedCrack = newInputData.InclinedCrack; 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(); @@ -33,14 +37,18 @@ namespace StructureHelperLogics.Models.BeamShears /// private double GetCrackLengthRatio() { - var parameterCalculator = new FindParameterCalculator(); + if (GetPredicate(1) == false) + { + return 1; + } + parameterCalculator = new FindParameterCalculator(); parameterCalculator.InputData.Predicate = GetPredicate; parameterCalculator.Accuracy.IterationAccuracy = 0.0001d; parameterCalculator.Accuracy.MaxIterationCount = 1000; parameterCalculator.Run(); if (parameterCalculator.Result.IsValid == false) { - throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate error"); + throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Binary search error {parameterCalculator.Result.Description}"); } var result = parameterCalculator.Result as FindParameterResult; var crackLengthRatio = result.Parameter; @@ -59,25 +67,32 @@ namespace StructureHelperLogics.Models.BeamShears private bool GetPredicate(double crackLengthRatio) { BeamShearSectionLogicInputData newInputData = GetNewInputDataByCrackLengthRatio(crackLengthRatio); - concreteLogic = new(SectionEffectiveness, newInputData.InclinedSection, null); + concreteLogic = new(SectionEffectiveness, newInputData.InclinedCrack, null); stirrupLogic = new(newInputData, null); double concreteStrength = concreteLogic.GetShearStrength(); double stirrupStrength = stirrupLogic.GetShearStrength(); - return stirrupStrength > concreteStrength; + bool predicateResult = stirrupStrength > concreteStrength; + if (crackLengthRatio == 1 & predicateResult == false) + { + + } + return predicateResult; } private BeamShearSectionLogicInputData GetNewInputDataByCrackLengthRatio(double crackLengthRatio) { - double sourceCrackLength = InputData.InclinedSection.EndCoord - InputData.InclinedSection.StartCoord; + IInclinedSection inclinedSection = InputData.InclinedCrack; + double sourceCrackLength = inclinedSection.EndCoord - inclinedSection.StartCoord; double newCrackLength = sourceCrackLength * crackLengthRatio; - double newStartCoord = InputData.InclinedSection.EndCoord - newCrackLength; + double newStartCoord = inclinedSection.EndCoord - newCrackLength; InclinedSection newSection = new(); var updateStrategy = new InclinedSectionUpdateStrategy(); - updateStrategy.Update(newSection, InputData.InclinedSection); + updateStrategy.Update(newSection, inclinedSection); newSection.StartCoord = newStartCoord; BeamShearSectionLogicInputData newInputData = new(Guid.Empty) { InclinedSection = newSection, + InclinedCrack = newSection, LimitState = InputData.LimitState, CalcTerm = InputData.CalcTerm, Stirrup = InputData.Stirrup, diff --git a/StructureHelperLogics/Models/BeamShears/Logics/StirrupStrengthLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/StirrupStrengthLogic.cs index d7a6cf7..4d1b718 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/StirrupStrengthLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/StirrupStrengthLogic.cs @@ -8,7 +8,7 @@ namespace StructureHelperLogics.Models.BeamShears { private readonly IBeamShearSectionLogicInputData inputData; private IStirrup stirrup => inputData.Stirrup; - private IInclinedSection inclinedSection => inputData.InclinedSection; + private IInclinedSection inclinedSection => inputData.InclinedCrack; private IBeamShearStrenghLogic stirrupByDensityStrengthLogic; private IBeamShearStrenghLogic stirrupGroupStrengthLogic; private IBeamShearStrenghLogic stirrupByInclinedRebarStrengthLogic; diff --git a/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearDesignRangePropertyUpdateStrategy.cs b/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearDesignRangePropertyUpdateStrategy.cs index 1f7c31b..1b65e5b 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearDesignRangePropertyUpdateStrategy.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearDesignRangePropertyUpdateStrategy.cs @@ -14,6 +14,8 @@ namespace StructureHelperLogics.Models.BeamShears targetObject.AbsoluteRangeValue = sourceObject.AbsoluteRangeValue; targetObject.RelativeEffectiveDepthRangeValue = sourceObject.RelativeEffectiveDepthRangeValue; targetObject.StepCount = sourceObject.StepCount; + targetObject.RelativeEffectiveDepthSectionLengthMaxValue = sourceObject.RelativeEffectiveDepthSectionLengthMaxValue; + targetObject.RelativeEffectiveDepthSectionLengthMinValue = sourceObject.RelativeEffectiveDepthSectionLengthMinValue; } } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearSectionLogicInputDataUpdateStrategy.cs b/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearSectionLogicInputDataUpdateStrategy.cs index a3cffd1..48c789c 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearSectionLogicInputDataUpdateStrategy.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/UpdateLogics/BeamShearSectionLogicInputDataUpdateStrategy.cs @@ -12,6 +12,7 @@ namespace StructureHelperLogics.Models.BeamShears CheckObject.IsNull(targetObject, ErrorStrings.TargetObject); if (ReferenceEquals(targetObject, sourceObject)) { return; } targetObject.InclinedSection = sourceObject.InclinedSection; + targetObject.InclinedCrack = sourceObject.InclinedCrack; targetObject.Stirrup = sourceObject.Stirrup; targetObject.LimitState = sourceObject.LimitState; targetObject.CalcTerm = sourceObject.CalcTerm;