Add check logics for beam shear
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces.BeamShearActions
|
||||
{
|
||||
public class CheckBeamShearActionLogic : ICheckEntityLogic<IBeamShearAction>
|
||||
{
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
public IBeamShearAction Entity { get; set; }
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public CheckBeamShearActionLogic(IBeamShearAction entity, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
Entity = entity;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nInclined section is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.ExternalForce is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nExternal force is null");
|
||||
}
|
||||
if (Entity.SupportAction is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nSupport action is null");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,14 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
inclinedSection.ConcreteCompressionStrength = strength.Compressive;
|
||||
inclinedSection.ConcreteTensionStrength = strength.Tensile;
|
||||
IForceTuple forceTuple = GetForceTupleByShearAction(beamShearAction, inclinedSection, CollapseLimitState, calcTerm);
|
||||
DirectShearForceLogicInputData inputData = new()
|
||||
{
|
||||
BeamShearAction = beamShearAction,
|
||||
InclinedSection = inclinedSection,
|
||||
LimitState = CollapseLimitState,
|
||||
CalcTerm = calcTerm,
|
||||
};
|
||||
IForceTuple forceTuple = GetForceTupleByShearAction(inputData);
|
||||
BeamShearSectionLogicInputData newInputData = new(Guid.NewGuid())
|
||||
{
|
||||
InclinedSection = inclinedSection,
|
||||
@@ -166,10 +173,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
return getInclinedSectionListLogic.GetInclinedSections();
|
||||
}
|
||||
|
||||
private IForceTuple GetForceTupleByShearAction(IBeamShearAction beamShearAction, IInclinedSection inclinedSection, LimitStates limitState, CalcTerms calcTerm)
|
||||
private IForceTuple GetForceTupleByShearAction(IDirectShearForceLogicInputData inputData)
|
||||
{
|
||||
//IGetDirectShearForceLogic getDirectShearForceLogic = new GetDirectShearForceLogic(beamShearAction, inclinedSection, limitState, calcTerm, TraceLogger);
|
||||
IGetDirectShearForceLogic getDirectShearForceLogic = new GetDirectShearForceLogic(beamShearAction, inclinedSection, limitState, calcTerm, null);
|
||||
IGetDirectShearForceLogic getDirectShearForceLogic = new GetDirectShearForceLogic(inputData, null);
|
||||
return getDirectShearForceLogic.CalculateShearForceTuple();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.BeamShears.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,6 +15,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IBeamShearSection> checkSectionLogic;
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
public IBeamShearCalculatorInputData InputData { get; set; }
|
||||
@@ -40,13 +42,31 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
string errorString = "Collection of actions does not contain any action";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
CheckSections();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckSections()
|
||||
{
|
||||
if (InputData.Sections is null || !InputData.Sections.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of sections does not contain any section";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
return result;
|
||||
else
|
||||
{
|
||||
checkSectionLogic ??= new CheckBeamShearSectionLogic(TraceLogger);
|
||||
foreach (var item in InputData.Sections)
|
||||
{
|
||||
checkSectionLogic.Entity = item;
|
||||
if (checkSectionLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkSectionLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
{
|
||||
public class CheckBeamShearSectionLogic : ICheckEntityLogic<IBeamShearSection>
|
||||
{
|
||||
private const double minValueOfCenterCover = 0.01;
|
||||
private const double minValueOfCrossSectionWidth = 0.05;
|
||||
private const double minValueOfCrossSectionHeight = 0.05;
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
|
||||
public CheckBeamShearSectionLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IBeamShearSection Entity { get; set; }
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nSection is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.Material is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nMaterial of cross-section is not assigned");
|
||||
}
|
||||
if (Entity.CenterCover < minValueOfCenterCover)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nValue of center cover c = {Entity.CenterCover}(m) must not be less than cmin = {minValueOfCenterCover}(m)");
|
||||
}
|
||||
CheckShape();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckShape()
|
||||
{
|
||||
if (Entity.Shape is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nShape of cross-section is null");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.Shape is IRectangleShape rectangle)
|
||||
{
|
||||
CheckRectangleShape(rectangle);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nType of shape of cross-section is unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckRectangleShape(IRectangleShape rectangle)
|
||||
{
|
||||
if (rectangle.Width < minValueOfCrossSectionWidth)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nValue of cross-section width b = {rectangle.Width}(m) must not be less than bmin = {minValueOfCrossSectionWidth}(m)");
|
||||
}
|
||||
if (rectangle.Height < minValueOfCrossSectionHeight)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nValue of cross-section height h = {rectangle.Height}(m) must not be less than hmin = {minValueOfCrossSectionHeight}(m)");
|
||||
}
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class CheckDirectForceInputDataLogic : ICheckInputDataLogic<IDirectShearForceLogicInputData>
|
||||
{
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
private ICheckEntityLogic<IInclinedSection> checkInclinedSectionLogic;
|
||||
private ICheckEntityLogic<IBeamShearAction> checkBeamShearActionLogic;
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IDirectShearForceLogicInputData InputData { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckDirectForceInputDataLogic(IDirectShearForceLogicInputData inputData, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
InputData = inputData;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
InitializeStrategies();
|
||||
result = true;
|
||||
if (InputData is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nInput data is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckBeamShearAction();
|
||||
CheckInclinedSection();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
checkInclinedSectionLogic ??= new CheckInclinedSectionLogic(InputData.InclinedSection, TraceLogger);
|
||||
checkBeamShearActionLogic ??= new CheckBeamShearActionLogic(InputData.BeamShearAction, TraceLogger);
|
||||
}
|
||||
|
||||
private void CheckBeamShearAction()
|
||||
{
|
||||
if (InputData.BeamShearAction is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nBeam shear action is not assigned");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (checkBeamShearActionLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkBeamShearActionLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckInclinedSection()
|
||||
{
|
||||
if (InputData.InclinedSection is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nInclined section is not assigned");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (checkInclinedSectionLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkInclinedSectionLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class CheckInclinedSectionLogic : ICheckEntityLogic<IInclinedSection>
|
||||
{
|
||||
private const double minValueOfEffectiveDepth = 0.05;
|
||||
private const double minValueOfWebWidth = 0.05;
|
||||
private string checkResult;
|
||||
private bool result;
|
||||
|
||||
public IInclinedSection Entity { get; set; }
|
||||
public string CheckResult => checkResult;
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public CheckInclinedSectionLogic(IInclinedSection entity, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
Entity = entity;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = "\nInclined section is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.StartCoord < 0)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nCoordinate of start of inclined section Xstart = {Entity.StartCoord}(m) must not be less than zero");
|
||||
}
|
||||
if (Entity.EndCoord < Entity.StartCoord)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nCoordinate of end of inclined section Xend = {Entity.EndCoord}(m) must not be less than Xstart = {Entity.StartCoord}(m)");
|
||||
}
|
||||
if (Entity.EffectiveDepth < minValueOfEffectiveDepth)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nEffective depth of inclined section d = {Entity.EffectiveDepth}(m) must be grater than dmin = {minValueOfEffectiveDepth}(m)");
|
||||
}
|
||||
if (Entity.WebWidth < minValueOfWebWidth)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nWidth of web of inclined section b = {Entity.WebWidth}(m) must be grater than bmin = {minValueOfWebWidth}(m)");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class DirectShearForceLogicInputData : IDirectShearForceLogicInputData
|
||||
{
|
||||
public IBeamShearAction BeamShearAction { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public IInclinedSection InclinedSection { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||
@@ -15,48 +17,25 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
/// <inheritdoc/>
|
||||
public class GetDirectShearForceLogic : IGetDirectShearForceLogic
|
||||
{
|
||||
private IDirectShearForceLogicInputData inputData;
|
||||
private ISumForceByShearLoadLogic summaryForceLogic;
|
||||
private ICheckInputDataLogic<IDirectShearForceLogicInputData> checkInputDataLogic;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public IBeamShearAction AxisAction { get; set; }
|
||||
public IInclinedSection InclinedSection { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
|
||||
public GetDirectShearForceLogic(
|
||||
IBeamShearAction axisAction,
|
||||
IInclinedSection inclinedSection,
|
||||
LimitStates limitState,
|
||||
CalcTerms calcTerm,
|
||||
IShiftTraceLogger? traceLogger)
|
||||
public GetDirectShearForceLogic(IDirectShearForceLogicInputData inputData, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
AxisAction = axisAction;
|
||||
InclinedSection = inclinedSection;
|
||||
LimitState = limitState;
|
||||
CalcTerm = calcTerm;
|
||||
this.inputData = inputData;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public GetDirectShearForceLogic(
|
||||
IBeamShearAction axisAction,
|
||||
IInclinedSection inclinedSection,
|
||||
LimitStates limitState,
|
||||
CalcTerms calcTerm,
|
||||
IShiftTraceLogger? traceLogger,
|
||||
ISumForceByShearLoadLogic summaryForceLogic)
|
||||
{
|
||||
this.summaryForceLogic = summaryForceLogic;
|
||||
AxisAction = axisAction;
|
||||
InclinedSection = inclinedSection;
|
||||
LimitState = limitState;
|
||||
CalcTerm = calcTerm;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IForceTuple CalculateShearForceTuple()
|
||||
{
|
||||
Check();
|
||||
IForceTuple externalTuple = CalculateExternalForceTuple();
|
||||
IForceTuple internalTuple = CalculateInternalForceTuple();
|
||||
IForceTuple totalTuple = ForceTupleService.SumTuples(internalTuple, externalTuple);
|
||||
@@ -65,13 +44,22 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
return totalTuple;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
checkInputDataLogic = new CheckDirectForceInputDataLogic(inputData, TraceLogger);
|
||||
if (checkInputDataLogic.Check() == false)
|
||||
{
|
||||
throw new StructureHelperException(checkInputDataLogic.CheckResult);
|
||||
}
|
||||
}
|
||||
|
||||
private IForceTuple CalculateExternalForceTuple()
|
||||
{
|
||||
var forceTupleLogic = new GetForceTupleByFactoredTupleLogic()
|
||||
{
|
||||
FactoredForceTuple = AxisAction.ExternalForce,
|
||||
LimitState = LimitState,
|
||||
CalcTerm = CalcTerm
|
||||
FactoredForceTuple = inputData.BeamShearAction.ExternalForce,
|
||||
LimitState = inputData.LimitState,
|
||||
CalcTerm = inputData.CalcTerm
|
||||
};
|
||||
IForceTuple internalForceTuple = forceTupleLogic.GetForceTuple();
|
||||
return internalForceTuple;
|
||||
@@ -81,18 +69,18 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Service);
|
||||
InitializeStrategies();
|
||||
IBeamShearAxisAction beamShearAxisAction = AxisAction.SupportAction;
|
||||
IBeamShearAxisAction beamShearAxisAction = inputData.BeamShearAction.SupportAction;
|
||||
var forceTupleLogic = new GetForceTupleByFactoredTupleLogic()
|
||||
{
|
||||
FactoredForceTuple = beamShearAxisAction.SupportForce,
|
||||
LimitState = LimitState,
|
||||
CalcTerm = CalcTerm
|
||||
LimitState = inputData.LimitState,
|
||||
CalcTerm = inputData.CalcTerm
|
||||
};
|
||||
IForceTuple supportShearForce = forceTupleLogic.GetForceTuple();
|
||||
|
||||
TraceLogger?.AddMessage($"Shear force at support Qmax = {supportShearForce.Qy}(N)");
|
||||
TraceLogger?.AddMessage($"Start of inclined section a,start = {InclinedSection.StartCoord}(m)");
|
||||
TraceLogger?.AddMessage($"End of inclined section a,end = {InclinedSection.EndCoord}(m)");
|
||||
TraceLogger?.AddMessage($"Start of inclined section a,start = {inputData.InclinedSection.StartCoord}(m)");
|
||||
TraceLogger?.AddMessage($"End of inclined section a,end = {inputData.InclinedSection.EndCoord}(m)");
|
||||
ForceTuple summarySpanShearForce = GetSummarySpanShearForce(beamShearAxisAction.ShearLoads);
|
||||
TraceLogger?.AddMessage($"Summary span shear force deltaQ = {summarySpanShearForce.Qy}(N)");
|
||||
IForceTuple shearForce = ForceTupleService.SumTuples(supportShearForce, summarySpanShearForce);
|
||||
@@ -105,7 +93,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
ForceTuple summarySpanShearForce = new(Guid.NewGuid());
|
||||
foreach (var spanLoad in spanLoads)
|
||||
{
|
||||
IForceTuple summarySpanLoad = summaryForceLogic.GetSumShearForce(spanLoad, InclinedSection.StartCoord, InclinedSection.EndCoord);
|
||||
IForceTuple summarySpanLoad = summaryForceLogic.GetSumShearForce(spanLoad, inputData.InclinedSection.StartCoord, inputData.InclinedSection.EndCoord);
|
||||
ForceTupleService.SumTupleToTarget(summarySpanLoad, summarySpanShearForce);
|
||||
}
|
||||
return summarySpanShearForce;
|
||||
@@ -113,7 +101,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
summaryForceLogic ??= new SumForceByShearLoadLogic(TraceLogger) { LimitState = LimitState, CalcTerm = CalcTerm};
|
||||
summaryForceLogic ??= new SumForceByShearLoadLogic(TraceLogger)
|
||||
{
|
||||
LimitState = inputData.LimitState,
|
||||
CalcTerm = inputData.CalcTerm
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IDirectShearForceLogicInputData : IInputData
|
||||
{
|
||||
IBeamShearAction BeamShearAction { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
IInclinedSection InclinedSection { get; set; }
|
||||
LimitStates LimitState { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user