Add checks for beam shear
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces.BeamShearActions;
|
||||
using StructureHelperLogics.Models.BeamShears.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
@@ -15,7 +11,9 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IBeamShearAction> checkActionsLogic;
|
||||
private ICheckEntityLogic<IBeamShearSection> checkSectionLogic;
|
||||
private ICheckEntityLogic<IStirrup> checkStirrupLogic;
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
public IBeamShearCalculatorInputData InputData { get; set; }
|
||||
@@ -36,14 +34,55 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": Input data";
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
CheckActions();
|
||||
CheckSections();
|
||||
CheckStirrups();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckActions()
|
||||
{
|
||||
if (InputData.Actions is null || !InputData.Actions.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of actions does not contain any action";
|
||||
string errorString = "\nCollection of actions does not contain any action";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
CheckSections();
|
||||
return result;
|
||||
else
|
||||
{
|
||||
checkActionsLogic ??= new CheckBeamShearActionLogic(TraceLogger);
|
||||
foreach (var action in InputData.Actions)
|
||||
{
|
||||
checkActionsLogic.Entity = action;
|
||||
if (checkActionsLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkActionsLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckStirrups()
|
||||
{
|
||||
if (InputData.Stirrups is null)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage("\nCollection of stirrups is null");
|
||||
}
|
||||
else
|
||||
{
|
||||
checkStirrupLogic ??= new CheckStirrupsLogic(TraceLogger);
|
||||
foreach (var stirrup in InputData.Stirrups)
|
||||
{
|
||||
checkStirrupLogic.Entity = stirrup;
|
||||
if (checkStirrupLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkStirrupLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckSections()
|
||||
@@ -51,8 +90,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
if (InputData.Sections is null || !InputData.Sections.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of sections does not contain any section";
|
||||
TraceMessage(errorString);
|
||||
TraceMessage("\nCollection of sections does not contain any section");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -45,7 +45,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
checkInclinedSectionLogic ??= new CheckInclinedSectionLogic(InputData.InclinedSection, TraceLogger);
|
||||
checkBeamShearActionLogic ??= new CheckBeamShearActionLogic(InputData.BeamShearAction, TraceLogger);
|
||||
checkBeamShearActionLogic ??= new CheckBeamShearActionLogic(TraceLogger);
|
||||
}
|
||||
|
||||
private void CheckBeamShearAction()
|
||||
@@ -57,6 +57,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBeamShearActionLogic.Entity = InputData.BeamShearAction;
|
||||
if (checkBeamShearActionLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
@@ -19,6 +19,11 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public CheckInclinedSectionLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
checkResult = string.Empty;
|
||||
@@ -0,0 +1,56 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class CheckStirrupsByDensityLogic : ICheckEntityLogic<IStirrupByDensity>
|
||||
{
|
||||
private const int minDensity = 0;
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
|
||||
public CheckStirrupsByDensityLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IStirrupByDensity 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 = "\nStirrups by density is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.StirrupDensity < minDensity)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nStirrup {Entity.Name} density d = {Entity.StirrupDensity} must not be less than dmin = {minDensity}");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class CheckStirrupsByRebarLogic : ICheckEntityLogic<IStirrupByRebar>
|
||||
{
|
||||
private const double minDiameter = 0.003;
|
||||
private const double maxDiameter = 0.025;
|
||||
private const double minSpacing = 0.020;
|
||||
private const double maxSpacing = 0.500;
|
||||
private const int minLegCount = 0;
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
|
||||
public CheckStirrupsByRebarLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IStirrupByRebar 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 = "\nStirrups by density is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity.Diameter < minDiameter)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nStirrup {Entity.Name} diameter d = {Entity.Diameter} must not be less than dmin = {minDiameter}");
|
||||
}
|
||||
if (Entity.Diameter > maxDiameter)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nStirrup {Entity.Name} diameter d = {Entity.Diameter} must be less or equal than dmax = {maxDiameter}");
|
||||
}
|
||||
if (Entity.Spacing < minSpacing)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nStirrup {Entity.Name} spacing s = {Entity.Spacing} must not be less than smin = {minSpacing}");
|
||||
}
|
||||
if (Entity.Spacing > maxSpacing)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nStirrup {Entity.Name} spacing s = {Entity.Spacing} must be less or equal than smax = {maxSpacing}");
|
||||
}
|
||||
if (Entity.LegCount < minLegCount)
|
||||
{
|
||||
result = false;
|
||||
TraceMessage($"\nStirrup {Entity.Name} leg count n = {Entity.LegCount} must not be less than nmin = {minLegCount}");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class CheckStirrupsLogic : ICheckEntityLogic<IStirrup>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
private ICheckEntityLogic<IStirrupByDensity> checkDensityLogic;
|
||||
private ICheckEntityLogic<IStirrupByRebar> checkRebarLogic;
|
||||
|
||||
public CheckStirrupsLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IStirrup 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 = "\nStirrup is not assigned";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Entity is IStirrupByDensity density)
|
||||
{
|
||||
checkDensityLogic ??= new CheckStirrupsByDensityLogic(TraceLogger);
|
||||
checkDensityLogic.Entity = density;
|
||||
if (checkDensityLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkDensityLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
if (Entity is IStirrupByRebar rebar)
|
||||
{
|
||||
checkRebarLogic ??= new CheckStirrupsByRebarLogic(TraceLogger);
|
||||
checkRebarLogic.Entity = rebar;
|
||||
if (checkRebarLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
checkResult += checkRebarLogic.CheckResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(Entity) + $": name = {Entity.Name}, id = {Entity.Id}";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
getLongitudinalForceFactorLogic ??= new GetLogitudinalForceFactorLogic(TraceLogger?.GetSimilarTraceLogger(100));
|
||||
getLongitudinalForceFactorLogic ??= new GetLongitudinalForceFactorLogic(TraceLogger?.GetSimilarTraceLogger(100));
|
||||
}
|
||||
|
||||
private void SetLongitudinalForce()
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
{
|
||||
public class GetLogitudinalForceFactorLogic : IGetLongitudinalForceFactorLogic
|
||||
public class GetLongitudinalForceFactorLogic : IGetLongitudinalForceFactorLogic
|
||||
{
|
||||
private const double fstRatioInCompression = 1.25;
|
||||
private const double sndRationInCompression = 0.75;
|
||||
private const double fstRatioInCompression = 0.25;
|
||||
private const double sndRatioInCompression = 0.75;
|
||||
private double sectionArea;
|
||||
private ICheckEntityLogic<IInclinedSection> checkInclinedSectionLogic;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public IInclinedSection InclinedSection { get; set; }
|
||||
public double LongitudinalForce { get; set; }
|
||||
|
||||
public GetLogitudinalForceFactorLogic(IShiftTraceLogger? traceLogger)
|
||||
public GetLongitudinalForceFactorLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
@@ -51,15 +48,11 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
|
||||
private void Check()
|
||||
{
|
||||
if (InclinedSection is null)
|
||||
checkInclinedSectionLogic ??= new CheckInclinedSectionLogic(TraceLogger);
|
||||
checkInclinedSectionLogic.Entity = InclinedSection;
|
||||
if (checkInclinedSectionLogic.Check() == false)
|
||||
{
|
||||
string errorString = ErrorStrings.DataIsInCorrect + "Inclined section is null";
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
if (InclinedSection.WebWidth <= 0 || InclinedSection.FullDepth <= 0)
|
||||
{
|
||||
string errorString = ErrorStrings.DataIsInCorrect + $"Inclined section width = {InclinedSection.WebWidth}(m), and full depth = {InclinedSection.FullDepth}, but both of them must be greater than zero";
|
||||
string errorString = checkInclinedSectionLogic.CheckResult;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
@@ -93,14 +86,14 @@ namespace StructureHelperLogics.Models.BeamShears.Logics
|
||||
TraceLogger?.AddMessage($"Stress ratio rc = {stressRatio} < {fstRatioInCompression}");
|
||||
factor = 1 + stressRatio;
|
||||
}
|
||||
else if (stressRatio > sndRationInCompression)
|
||||
else if (stressRatio > sndRatioInCompression)
|
||||
{
|
||||
factor = 5 * (1 - stressRatio);
|
||||
factor = Math.Max(factor, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
factor = 1;
|
||||
factor = 1 + fstRatioInCompression;
|
||||
}
|
||||
TraceLogger?.AddMessage($"Factor value fi_n = {factor}(dimensionless)");
|
||||
return factor;
|
||||
Reference in New Issue
Block a user