Add BeamShearCalculator
This commit is contained in:
@@ -6,8 +6,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement effective depth for reinforced concrete section
|
||||
/// </summary>
|
||||
public interface IEffectiveDepth
|
||||
{
|
||||
/// <summary>
|
||||
/// Full depth of cross-section
|
||||
/// </summary>
|
||||
double FullDepth { get; set; }
|
||||
/// <summary>
|
||||
/// Effective depth of cross-section
|
||||
/// </summary>
|
||||
double EffectiveDepth { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IGetResultByInputDataLogic<T, V> : ILogic
|
||||
where T : IInputData
|
||||
where V : IResult
|
||||
{
|
||||
V GetResultByInputData(T inputData);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement collection of shear beams load
|
||||
/// </summary>
|
||||
public interface IHasBeamShearActions
|
||||
{
|
||||
List<IBeamShearAction> BeamShearActions { get; }
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class ConcentratedForce : IConcenratedForce
|
||||
{
|
||||
private double relativeLoadLevel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double ForceCoordinate { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double ForceValue { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double RelativeLoadLevel
|
||||
{
|
||||
get => relativeLoadLevel;
|
||||
set
|
||||
{
|
||||
if (value > 0.5d) { relativeLoadLevel = 0.5d; }
|
||||
if (value < -0.5d) { relativeLoadLevel = -0.5d; }
|
||||
relativeLoadLevel = value;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public double LoadRatio { get; set; } = 1;
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IBeamShearAction : IAction
|
||||
{
|
||||
|
||||
IBeamShearAxisAction XAxisSheaAction { get; }
|
||||
IBeamShearAxisAction YAxisSheaAction { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement properties of shear loads on beam
|
||||
/// </summary>
|
||||
public interface IBeamShearAxisAction : IAction
|
||||
{
|
||||
double SupportShearForce { get; set; }
|
||||
List<IBeamShearLoad> ShearLoads {get;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement properties for shear beam load
|
||||
/// </summary>
|
||||
public interface IBeamShearLoad : IAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Value of level where action is applyied at, 0.5 is top surface, -0.5 is bottom surface
|
||||
/// </summary>
|
||||
double RelativeLoadLevel { get; set; }
|
||||
/// <summary>
|
||||
/// Ratio of substraction load from total shear force
|
||||
/// </summary>
|
||||
double LoadRatio { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement properties for concentrated load in beam
|
||||
/// </summary>
|
||||
public interface IConcenratedForce : IBeamShearLoad
|
||||
{
|
||||
/// <summary>
|
||||
/// Coordinate of location of force along beam, m
|
||||
/// </summary>
|
||||
double ForceCoordinate { get; set; }
|
||||
/// <summary>
|
||||
/// Value of force, N
|
||||
/// </summary>
|
||||
double ForceValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement properties of
|
||||
/// </summary>
|
||||
public interface IUniformlyDistributedLoad : IBeamShearLoad
|
||||
{
|
||||
/// <summary>
|
||||
/// Value of uniformly distributed load, N/m
|
||||
/// </summary>
|
||||
double LoadValue { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate of start of load, m
|
||||
/// </summary>
|
||||
double StartCoordinate { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate of end of load, m
|
||||
/// </summary>
|
||||
double EndCoordinate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class UniformlyDistributedLoad : IUniformlyDistributedLoad
|
||||
{
|
||||
private double relativeLoadLevel;
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public double LoadValue { get; set; } = 0d;
|
||||
public double RelativeLoadLevel
|
||||
{
|
||||
get => relativeLoadLevel;
|
||||
set
|
||||
{
|
||||
if (value > 0.5d) { relativeLoadLevel = 0.5d; }
|
||||
if (value < -0.5d) { relativeLoadLevel = -0.5d; }
|
||||
relativeLoadLevel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double StartCoordinate { get; set; } = double.NegativeInfinity;
|
||||
public double EndCoordinate { get; set; } = double.PositiveInfinity;
|
||||
/// <inheritdoc/>
|
||||
public double LoadRatio { get; set; } = 1;
|
||||
|
||||
public UniformlyDistributedLoad(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class UniformlyDisributedLoadUpdateStrategy : IUpdateStrategy<IUniformlyDistributedLoad>
|
||||
{
|
||||
public void Update(IUniformlyDistributedLoad targetObject, IUniformlyDistributedLoad sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.LoadValue = sourceObject.LoadValue;
|
||||
targetObject.RelativeLoadLevel = sourceObject.RelativeLoadLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
internal class BeamShearCalculator : IBeamShearCalculator
|
||||
{
|
||||
private ICheckInputDataLogic<IBeamShearCalculatorInputData> checkInputDataLogic;
|
||||
IGetResultByInputDataLogic<IBeamShearCalculatorInputData, IBeamShearCalculatorResult> calculationLogic;
|
||||
private IBeamShearCalculatorResult result;
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public IBeamShearCalculatorInputData InputData { get; set; } = new BeamShearCalculatorInputData(Guid.NewGuid());
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
PrepareNewResult();
|
||||
PrepareInputData();
|
||||
try
|
||||
{
|
||||
InitializeStrategies();
|
||||
if (CheckInputData() == false) { return;}
|
||||
CalculateResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrepareInputData()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private bool CheckInputData()
|
||||
{
|
||||
var checkResult = checkInputDataLogic.Check();
|
||||
if (checkResult == false)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += checkInputDataLogic.CheckResult;
|
||||
TraceLogger?.AddMessage(checkInputDataLogic.CheckResult, TraceLogStatuses.Error);
|
||||
}
|
||||
return checkResult;
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
result = calculationLogic.GetResultByInputData(InputData);
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
checkInputDataLogic ??= new CheckBeamShearCalculatorInputDataLogic(InputData, TraceLogger);
|
||||
calculationLogic ??= new BeamShearCalculatorLogic(TraceLogger);
|
||||
}
|
||||
|
||||
private void PrepareNewResult()
|
||||
{
|
||||
result = new BeamShearCalculatorResult()
|
||||
{
|
||||
IsValid = true,
|
||||
Description = string.Empty
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class BeamShearCalculatorInputData : IBeamShearCalculatorInputData
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<IBeamShearAction> BeamShearActions { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
public List<IBeamShearSection> ShearSections { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
public BeamShearCalculatorInputData(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
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
|
||||
{
|
||||
public class BeamShearCalculatorLogic : IGetResultByInputDataLogic<IBeamShearCalculatorInputData, IBeamShearCalculatorResult>
|
||||
{
|
||||
private IBeamShearCalculatorResult result;
|
||||
private IBeamShearSectionCalculator beamShearSectionCalculator;
|
||||
private List<IBeamShearSectionCalculatorInputData> sectionInputDatas;
|
||||
|
||||
public BeamShearCalculatorLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public IBeamShearCalculatorResult GetResultByInputData(IBeamShearCalculatorInputData inputData)
|
||||
{
|
||||
PrepareNewResult();
|
||||
InitializeStrategies();
|
||||
try
|
||||
{
|
||||
GetSectionInputDatas(inputData);
|
||||
CalculateResult();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
result.IsValid = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
foreach (var sectionInputData in sectionInputDatas)
|
||||
{
|
||||
beamShearSectionCalculator.InputData = sectionInputData;
|
||||
beamShearSectionCalculator.Run();
|
||||
var sectionResult = beamShearSectionCalculator.Result as IBeamShearSectionCalculatorResult;
|
||||
result.SectionResults.Add(sectionResult);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
beamShearSectionCalculator ??= new BeamShearSectionCalculator();
|
||||
}
|
||||
|
||||
private void PrepareNewResult()
|
||||
{
|
||||
result = new BeamShearCalculatorResult()
|
||||
{
|
||||
IsValid = true,
|
||||
Description = string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
private void GetSectionInputDatas(IBeamShearCalculatorInputData inputData)
|
||||
{
|
||||
sectionInputDatas = new();
|
||||
foreach (var beamShearSection in inputData.ShearSections)
|
||||
{
|
||||
foreach (var stirrup in inputData.Stirrups)
|
||||
{
|
||||
foreach (var beamShearAction in inputData.BeamShearActions)
|
||||
{
|
||||
BeamShearSectionCalculatorInputData newInputData = new(Guid.NewGuid())
|
||||
{
|
||||
BeamShearSection = beamShearSection,
|
||||
Stirrup = stirrup,
|
||||
BeamShearAction = beamShearAction
|
||||
};
|
||||
sectionInputDatas.Add(newInputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearCalculatorResult : IBeamShearCalculatorResult
|
||||
{
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
public List<IBeamShearSectionCalculatorResult> SectionResults { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,33 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
public List<IBeamShearAction> BeamShearActions { get; }
|
||||
public List<IBeamShearAction> BeamShearActions {get;}
|
||||
|
||||
public List<ICalculator> Calculators { get; } = new();
|
||||
|
||||
public List<IBeamShearSection> ShearSections { get; } = new();
|
||||
|
||||
public List<IStirrup> Stirrups { get; } = new();
|
||||
|
||||
public List<ICalculator> Calculators { get; }
|
||||
|
||||
public BeamShearRepository(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public void DeleteBeamShearAction(IBeamShearAction beamShearAction)
|
||||
{
|
||||
foreach (var calculator in Calculators)
|
||||
{
|
||||
if (calculator is IBeamShearCalculator beamShearCalculator)
|
||||
{
|
||||
var inputData = beamShearCalculator.InputData;
|
||||
inputData.BeamShearActions.Remove(beamShearAction);
|
||||
}
|
||||
}
|
||||
BeamShearActions.Remove(beamShearAction);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearSectionCalculator : IBeamShearSectionCalculator
|
||||
{
|
||||
private IBeamShearSectionCalculatorResult result;
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; }
|
||||
public IBeamShearSectionCalculatorInputData InputData { get; set; }
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class BeamShearSectionCalculatorInputData : IBeamShearSectionCalculatorInputData
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public IBeamShearSection? BeamShearSection { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IBeamShearAction? BeamShearAction { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IStirrup? Stirrup { get; set; }
|
||||
public BeamShearSectionCalculatorInputData(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class BeamShearSectionCalculatorResult : IBeamShearSectionCalculatorResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearCalculator : ICalculator
|
||||
{
|
||||
IBeamShearCalculatorInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearCalculatorInputData : ISaveable, IInputData, IHasBeamShearActions, IHasBeamShearSections, IHasStirrups
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearCalculatorResult : IResult
|
||||
{
|
||||
List<IBeamShearSectionCalculatorResult> SectionResults { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearRepository : ISaveable, IHasBeamShearActions, IHasCalculators, ICloneable
|
||||
public interface IBeamShearRepository : ISaveable, IHasBeamShearActions, IHasCalculators, IHasBeamShearSections, IHasStirrups, ICloneable
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearSectionCalculator : ICalculator
|
||||
{
|
||||
IBeamShearSectionCalculatorInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearSectionCalculatorInputData : IInputData, ISaveable
|
||||
{
|
||||
IBeamShearSection? BeamShearSection { get; set; }
|
||||
IBeamShearAction? BeamShearAction { get; set; }
|
||||
IStirrup? Stirrup { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IBeamShearSectionCalculatorResult : IResult
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IHasBeamShearSections
|
||||
{
|
||||
List<IBeamShearSection> ShearSections { get; }
|
||||
}
|
||||
}
|
||||
13
StructureHelperLogics/Models/BeamShears/IHasStirrups.cs
Normal file
13
StructureHelperLogics/Models/BeamShears/IHasStirrups.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IHasStirrups
|
||||
{
|
||||
List<IStirrup> Stirrups { get; }
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,23 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement parameers of inclined cross-section for beam shear calculating
|
||||
/// </summary>
|
||||
public interface IInclinedSection : IEffectiveDepth
|
||||
{
|
||||
/// <summary>
|
||||
/// Width of cross-section
|
||||
/// </summary>
|
||||
double WebWidth { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate of start of inclined cross-section
|
||||
/// </summary>
|
||||
double StartCoord { get; set; }
|
||||
/// <summary>
|
||||
/// Coordinate of end of inclined cross-section
|
||||
/// </summary>
|
||||
double EndCoord { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class InclinedSection : IInclinedSection
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public double FullDepth { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double EffectiveDepth { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double WebWidth { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double StartCoord { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double EndCoord { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class CheckBeamShearCalculatorInputDataLogic : ICheckInputDataLogic<IBeamShearCalculatorInputData>
|
||||
{
|
||||
private bool result;
|
||||
private string checkResult;
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
public IBeamShearCalculatorInputData InputData { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public CheckBeamShearCalculatorInputDataLogic(IBeamShearCalculatorInputData inputData, IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
InputData = inputData;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
result = true;
|
||||
checkResult = string.Empty;
|
||||
if (InputData is null)
|
||||
{
|
||||
result = false;
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": Input data";
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
if (InputData.BeamShearActions is null || ! InputData.BeamShearActions.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of actions does not contain any action";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
if (InputData.ShearSections is null || ! InputData.ShearSections.Any())
|
||||
{
|
||||
result = false;
|
||||
string errorString = "Collection of sections does not contain any section";
|
||||
TraceMessage(errorString);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TraceMessage(string errorString)
|
||||
{
|
||||
checkResult += errorString;
|
||||
TraceLogger?.AddMessage(errorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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 int StepCount { get; set; } = 50;
|
||||
public double MaxInclinedSectionLegthFactor { get; set; } = 3d;
|
||||
public IGetInclinedSectionLogic? GetInclinedSectionLogic { get; set; }
|
||||
public IBeamShearSection BeamShearSection { get; set; }
|
||||
|
||||
public GetInclinedSectionListInputData(IBeamShearSection beamShearSection)
|
||||
{
|
||||
BeamShearSection = beamShearSection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class GetInclinedSectionListLogic : IGetInclinedSectionListLogic
|
||||
{
|
||||
private readonly GetInclinedSectionListInputData inputData;
|
||||
private IGetInclinedSectionLogic inclinedSectionLogic;
|
||||
private double depth;
|
||||
private double effectiveDepth;
|
||||
private List<IInclinedSection> inclinedSections;
|
||||
private List<double> coordinates;
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public GetInclinedSectionListLogic(
|
||||
GetInclinedSectionListInputData inputData,
|
||||
IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
this.inputData = inputData;
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
|
||||
public List<IInclinedSection> GetInclinedSections()
|
||||
{
|
||||
Check();
|
||||
GetShapeParameters();
|
||||
GetCoordinates();
|
||||
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);
|
||||
}
|
||||
}
|
||||
return inclinedSections;
|
||||
}
|
||||
|
||||
private void GetCoordinates()
|
||||
{
|
||||
double maxSectionLength = inputData.MaxInclinedSectionLegthFactor * effectiveDepth;
|
||||
double step = maxSectionLength / inputData.StepCount;
|
||||
inclinedSections = new();
|
||||
coordinates = new();
|
||||
for (int i = 0; i < inputData.StepCount + 1; i++)
|
||||
{
|
||||
double endCoord = step * i;
|
||||
coordinates.Add(endCoord);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
private void GetShapeParameters()
|
||||
{
|
||||
if (inputData.BeamShearSection.Shape is IRectangleShape rectangle)
|
||||
{
|
||||
depth = rectangle.Height;
|
||||
}
|
||||
else if (inputData.BeamShearSection.Shape is ICircleShape circle)
|
||||
{
|
||||
depth = circle.Diameter;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(inputData.BeamShearSection.Shape));
|
||||
}
|
||||
effectiveDepth = depth - inputData.BeamShearSection.CenterCover;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
@@ -17,6 +12,8 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
private double width;
|
||||
private double depth;
|
||||
private double effectiveDepth;
|
||||
private InclinedSection? inclinedSection;
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public GetInclinedSectionLogic(
|
||||
IBeamShearSection beamShearSection,
|
||||
@@ -31,14 +28,26 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
Check();
|
||||
}
|
||||
|
||||
public GetInclinedSectionLogic(IShiftTraceLogger? traceLogger)
|
||||
public IInclinedSection GetInclinedSection()
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
GetShapeParameters();
|
||||
GetSection();
|
||||
return inclinedSection;
|
||||
}
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public IInclinedSection GetInclinedSection()
|
||||
private void GetSection()
|
||||
{
|
||||
effectiveDepth = depth - beamShearSection.CenterCover;
|
||||
inclinedSection = new()
|
||||
{
|
||||
FullDepth = depth,
|
||||
EffectiveDepth = effectiveDepth,
|
||||
StartCoord = startCoord,
|
||||
EndCoord = endCoord,
|
||||
WebWidth = width
|
||||
};
|
||||
}
|
||||
private void GetShapeParameters()
|
||||
{
|
||||
if (beamShearSection.Shape is IRectangleShape rectangle)
|
||||
{
|
||||
@@ -54,17 +63,7 @@ namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(beamShearSection.Shape));
|
||||
}
|
||||
effectiveDepth = depth - beamShearSection.CenterCover;
|
||||
InclinedSection inclinedSection = new()
|
||||
{
|
||||
EffectiveDepth = effectiveDepth,
|
||||
StartCoord = startCoord,
|
||||
EndCoord = endCoord,
|
||||
WebWidth = width
|
||||
};
|
||||
return inclinedSection;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
if (beamShearSection is null)
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public class GetSumForceByShearActionLogic : IGetSumForceByShearActionLogic
|
||||
{
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public GetSumForceByShearActionLogic(IShiftTraceLogger? traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
}
|
||||
|
||||
public double GetSumShearForce(IBeamShearLoad beamShearAction, double startCoord, double endCoord)
|
||||
{
|
||||
if (beamShearAction is IUniformlyDistributedLoad distributedLoad)
|
||||
{
|
||||
return GetDistributedLoadSum(distributedLoad, startCoord, endCoord);
|
||||
}
|
||||
else if (beamShearAction is IConcenratedForce concenratedForce)
|
||||
{
|
||||
return GetConcentratedForceSum(concenratedForce, startCoord, endCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(beamShearAction));
|
||||
}
|
||||
}
|
||||
|
||||
private double GetConcentratedForceSum(IConcenratedForce concentratedForce, double startCoord, double endCoord)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Concentrated force Name = {concentratedForce.Name}, Value = {concentratedForce.ForceValue}(N/m) ");
|
||||
if (concentratedForce.ForceCoordinate > endCoord)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Force coordinate {concentratedForce.ForceCoordinate}(m) is bigger than section end {endCoord}(m), so total load is zero");
|
||||
return 0;
|
||||
}
|
||||
double totalLoad;
|
||||
double limitCoordinate = startCoord;
|
||||
if (concentratedForce.ForceCoordinate >= startCoord)
|
||||
{
|
||||
limitCoordinate = GetCoordinateByLevel(startCoord, endCoord, concentratedForce.RelativeLoadLevel);
|
||||
}
|
||||
if (concentratedForce.ForceCoordinate < limitCoordinate)
|
||||
{
|
||||
totalLoad = concentratedForce.ForceValue * concentratedForce.LoadRatio;
|
||||
TraceLogger?.AddMessage($"Total load Q,tot = {concentratedForce.ForceValue}(N) * {concentratedForce.LoadRatio} = {totalLoad}(N)");
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger?.AddMessage($"Force coordinate {concentratedForce.ForceCoordinate}(m) is bigger than limit coordinate {limitCoordinate}(m), so total load is zero");
|
||||
totalLoad = 0d;
|
||||
}
|
||||
return totalLoad;
|
||||
}
|
||||
|
||||
private double GetDistributedLoadSum(IUniformlyDistributedLoad distributedLoad, double startCoord, double endCoord)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Uniformly distributed load Name = {distributedLoad.Name}, Value = {distributedLoad.LoadValue}(N/m) ");
|
||||
double loadStartCoord = Math.Max(distributedLoad.StartCoordinate, 0d);
|
||||
if (loadStartCoord > endCoord)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Load start coordinate {loadStartCoord}(m) is bigger than section end {endCoord}(m), so total load is zero");
|
||||
return 0d;
|
||||
}
|
||||
double endCoordByLevel = GetCoordinateByLevel(startCoord, endCoord, distributedLoad.RelativeLoadLevel);
|
||||
double loadEndCoord = Math.Min(distributedLoad.EndCoordinate, endCoordByLevel);
|
||||
double loadLength = loadEndCoord - loadStartCoord;
|
||||
TraceLogger?.AddMessage($"Total length L,tot = {loadEndCoord}(m) - {loadStartCoord}(m) = {loadLength}(m)");
|
||||
double totalLoad = distributedLoad.LoadValue * distributedLoad.LoadRatio * loadLength;
|
||||
TraceLogger?.AddMessage($"Total load Q,tot = {distributedLoad.LoadValue}(N/m) * {distributedLoad.LoadRatio} * {loadLength}(m) = {totalLoad}(N)");
|
||||
return totalLoad;
|
||||
}
|
||||
|
||||
private double GetCoordinateByLevel(double startCoord, double endCoord, double relativeLevel)
|
||||
{
|
||||
CheckRelativeLevel(relativeLevel);
|
||||
double delta = endCoord - startCoord;
|
||||
double coordinate = startCoord + delta * (relativeLevel + 0.5d);
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
private void CheckRelativeLevel(double relativeLevel)
|
||||
{
|
||||
if (relativeLevel > 0.5d)
|
||||
{
|
||||
string errorString = ErrorStrings.IncorrectValue + ": relative level must not be greater than 0.5";
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
if (relativeLevel < -0.5d)
|
||||
{
|
||||
string errorString = ErrorStrings.IncorrectValue + ": relative level must not be less than -0.5";
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,15 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement logic for obtaining of inclined section
|
||||
/// </summary>
|
||||
public interface IGetInclinedSectionLogic : ILogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns inclined section
|
||||
/// </summary>
|
||||
/// <returns>Inclined section</returns>
|
||||
IInclinedSection GetInclinedSection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
public interface IGetInclinedSectionListInputData
|
||||
{
|
||||
int StepCount { get; set; }
|
||||
double MaxInclinedSectionLegthFactor { get; set; }
|
||||
IGetInclinedSectionLogic? GetInclinedSectionLogic { get; set; }
|
||||
IBeamShearSection BeamShearSection { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns collection of inclined section for beam shear calculating
|
||||
/// </summary>
|
||||
public interface IGetInclinedSectionListLogic : ILogic
|
||||
{
|
||||
List<IInclinedSection> GetInclinedSections();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.BeamShears
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement logic for obtaining of summary force of action from start to end
|
||||
/// </summary>
|
||||
public interface IGetSumForceByShearActionLogic : ILogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns summary force of action from start to end
|
||||
/// </summary>
|
||||
/// <param name="beamShearAction">Source action</param>
|
||||
/// <param name="startCoord">Coordinate of start point, m</param>
|
||||
/// <param name="endCoord">Coordinate of end point, m</param>
|
||||
/// <returns>Summary force, N</returns>
|
||||
double GetSumShearForce(IBeamShearLoad beamShearAction, double startCoord, double endCoord);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user