Logics of accidental eccentricity were separated and tested
This commit is contained in:
15
StructureHelperCommon/Models/Calculators/GenericResult.cs
Normal file
15
StructureHelperCommon/Models/Calculators/GenericResult.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Calculators
|
||||
{
|
||||
public class GenericResult<T> : IResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public T? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
private ConcreteLogicOptions options;
|
||||
private MaterialCommonOptionLogic optionLogic;
|
||||
private FactorLogic factorLogic;
|
||||
|
||||
|
||||
public ConcreteMaterialOptionLogic(ConcreteLogicOptions options)
|
||||
{
|
||||
@@ -32,10 +32,6 @@ namespace StructureHelperCommon.Models.Materials
|
||||
var concreteOptions = materialOptions as ConcreteOptions;
|
||||
optionLogic = new MaterialCommonOptionLogic(options);
|
||||
optionLogic.SetMaterialOptions(concreteOptions);
|
||||
factorLogic = new FactorLogic(options.SafetyFactors);
|
||||
var strength = factorLogic.GetTotalFactor(options.LimitState, options.CalcTerm);
|
||||
concreteOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
concreteOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
concreteOptions.WorkInTension = options.WorkInTension;
|
||||
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
||||
concreteOptions.Age = options.Age;
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
Code = code,
|
||||
Name = "A400",
|
||||
InitModulus = 2e11d,
|
||||
MainStrength = 400e6d
|
||||
MainStrength = 390e6d
|
||||
},
|
||||
new ReinforcementMaterialEntity(new Guid("045b54b1-0bbf-41fd-a27d-aeb20f600bb4"))
|
||||
{
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using SHEnums = StructureHelperCommon.Infrastructures.Enums;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
||||
{
|
||||
private IMaterialLogicOptions options;
|
||||
private FactorLogic factorLogic;
|
||||
|
||||
public MaterialCommonOptionLogic(IMaterialLogicOptions options)
|
||||
{
|
||||
@@ -17,6 +21,58 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
materialOptions.InitModulus = options.MaterialEntity.InitModulus;
|
||||
materialOptions.Strength = options.MaterialEntity.MainStrength;
|
||||
ProcessCodeType(materialOptions);
|
||||
ProcessLimitState(materialOptions);
|
||||
ProcessCalcTerm(materialOptions);
|
||||
ProcessExternalFactors(materialOptions);
|
||||
}
|
||||
|
||||
private void ProcessExternalFactors(IMaterialOptions materialOptions)
|
||||
{
|
||||
factorLogic = new FactorLogic(options.SafetyFactors);
|
||||
var strength = factorLogic.GetTotalFactor(options.LimitState, options.CalcTerm);
|
||||
materialOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
materialOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
}
|
||||
|
||||
private void ProcessCalcTerm(IMaterialOptions materialOptions)
|
||||
{
|
||||
if (options.CalcTerm == CalcTerms.ShortTerm)
|
||||
{
|
||||
materialOptions.IsShortTerm = true;
|
||||
}
|
||||
else if (options.CalcTerm == CalcTerms.LongTerm)
|
||||
{
|
||||
materialOptions.IsShortTerm = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessLimitState(IMaterialOptions materialOptions)
|
||||
{
|
||||
if (options.LimitState == SHEnums.LimitStates.ULS)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.Collapse;
|
||||
}
|
||||
else if (options.LimitState == SHEnums.LimitStates.SLS)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.ServiceAbility;
|
||||
}
|
||||
else if (options.LimitState == SHEnums.LimitStates.Special)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.Special;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCodeType(IMaterialOptions materialOptions)
|
||||
{
|
||||
if (options.MaterialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||
{
|
||||
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
||||
@@ -25,23 +81,10 @@ namespace StructureHelperCommon.Models.Materials
|
||||
{
|
||||
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
||||
}
|
||||
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
|
||||
if (options.LimitState == LimitStates.ULS)
|
||||
else
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.Collapse;
|
||||
throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}");
|
||||
}
|
||||
else if (options.LimitState == LimitStates.SLS)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.ServiceAbility;
|
||||
}
|
||||
else if (options.LimitState == LimitStates.Special)
|
||||
{
|
||||
materialOptions.LimitState = LCMB.LimitStates.Special;
|
||||
}
|
||||
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
|
||||
if (options.CalcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||
else if (options.CalcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,10 @@ namespace StructureHelperCommon.Models.Materials
|
||||
|
||||
private void GetLoaderOptions()
|
||||
{
|
||||
materialOptions = new ReinforcementOptions() { DiagramType = DiagramType};
|
||||
materialOptions = new ReinforcementOptions()
|
||||
{
|
||||
DiagramType = DiagramType
|
||||
};
|
||||
optionLogic = new MaterialCommonOptionLogic(options);
|
||||
optionLogic.SetMaterialOptions(materialOptions);
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public class AccidentalEccentricityLogic : IAccidentalEccentricityLogic
|
||||
{
|
||||
private double lengthFactor;
|
||||
private double sizeFactor;
|
||||
private double minEccentricity;
|
||||
|
||||
public double Length { get; set; }
|
||||
public double SizeX { get; set; }
|
||||
public double SizeY { get; set; }
|
||||
public IForceTuple InitialForceTuple { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public AccidentalEccentricityLogic()
|
||||
{
|
||||
lengthFactor = 600d;
|
||||
sizeFactor = 30d;
|
||||
minEccentricity = 0.01d;
|
||||
}
|
||||
public ForceTuple GetForceTuple()
|
||||
{
|
||||
var lengthEccetricity = Length / lengthFactor;
|
||||
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length ea = {0} / {1} = {2}", Length, lengthFactor, lengthEccetricity));
|
||||
var sizeXEccetricity = SizeX / sizeFactor;
|
||||
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeX ea ={0} / {1} = {2}", SizeX, sizeFactor, sizeXEccetricity));
|
||||
var sizeYEccetricity = SizeY / sizeFactor;
|
||||
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeY ea ={0} / {1} = {2}", SizeY, sizeFactor, sizeYEccetricity));
|
||||
TraceLogger?.AddMessage(string.Format("Minimum accidental eccentricity ea = {0}", minEccentricity));
|
||||
var xEccentricity = Math.Abs(InitialForceTuple.My / InitialForceTuple.Nz);
|
||||
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,x = {0}", xEccentricity));
|
||||
var yEccentricity = Math.Abs(InitialForceTuple.Mx / InitialForceTuple.Nz);
|
||||
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,y = {0}", yEccentricity));
|
||||
|
||||
var xFullEccentricity = new List<double>()
|
||||
{
|
||||
lengthEccetricity,
|
||||
sizeXEccetricity,
|
||||
minEccentricity,
|
||||
xEccentricity
|
||||
}
|
||||
.Max();
|
||||
string mesEx = string.Format("Eccentricity e,x = max({0}; {1}; {2}; {3}) = {4}",
|
||||
lengthEccetricity, sizeXEccetricity,
|
||||
minEccentricity, xEccentricity,
|
||||
xFullEccentricity);
|
||||
TraceLogger?.AddMessage(mesEx);
|
||||
var yFullEccentricity = new List<double>()
|
||||
{
|
||||
lengthEccetricity,
|
||||
sizeYEccetricity,
|
||||
minEccentricity,
|
||||
yEccentricity
|
||||
}
|
||||
.Max();
|
||||
string mesEy = string.Format("Eccentricity e,y = max({0}; {1}; {2}; {3}) = {4}",
|
||||
lengthEccetricity, sizeYEccetricity,
|
||||
minEccentricity, yEccentricity,
|
||||
yFullEccentricity);
|
||||
TraceLogger?.AddMessage(mesEy);
|
||||
var xSign = InitialForceTuple.Mx == 0d ? -1d : Math.Sign(InitialForceTuple.Mx);
|
||||
var ySign = InitialForceTuple.My == 0d ? -1d : Math.Sign(InitialForceTuple.My);
|
||||
var mx = (-1d) * InitialForceTuple.Nz * yFullEccentricity * xSign;
|
||||
var my = (-1d) * InitialForceTuple.Nz * xFullEccentricity * ySign;
|
||||
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary X-axis Mx = {0} * {1} = {2}", InitialForceTuple.Nz, yFullEccentricity, mx), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary Y-axis My = {0} * {1} = {2}", InitialForceTuple.Nz, xFullEccentricity, my), TraceLogStatuses.Debug);
|
||||
|
||||
var newTuple = new ForceTuple()
|
||||
{
|
||||
Mx = mx,
|
||||
My = my,
|
||||
Nz = InitialForceTuple.Nz,
|
||||
Qx = InitialForceTuple.Qx,
|
||||
Qy = InitialForceTuple.Qy,
|
||||
Mz = InitialForceTuple.Mz,
|
||||
};
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
return newTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public class ForceTupleCopier : IProcessorLogic<IForceTuple>
|
||||
{
|
||||
public IForceTuple InputForceTuple { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public ForceTupleCopier(IForceTuple forceTuple)
|
||||
{
|
||||
InputForceTuple = forceTuple;
|
||||
}
|
||||
public IForceTuple GetValue()
|
||||
{
|
||||
return InputForceTuple.Clone() as IForceTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public class ForceTupleMoveToPointDecorator : IProcessorDecorator<IForceTuple>
|
||||
{
|
||||
public IPoint2D Point2D { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
/// <summary>
|
||||
/// Internal source of ForceTuple
|
||||
/// </summary>
|
||||
public IProcessorLogic<IForceTuple> ForceTupleLogics { get; }
|
||||
public ForceTupleMoveToPointDecorator(IProcessorLogic<IForceTuple> procLogic)
|
||||
{
|
||||
ForceTupleLogics = procLogic;
|
||||
}
|
||||
public IForceTuple GetValue()
|
||||
{
|
||||
ForceTupleLogics.TraceLogger = TraceLogger;
|
||||
var newTuple = ForceTupleLogics.GetValue();
|
||||
newTuple.Mx += newTuple.Nz * Point2D.Y;
|
||||
newTuple.My -= newTuple.Nz * Point2D.X;
|
||||
return newTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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 StructureHelperCommon.Models.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic for calculating of value of accidental eccentricity
|
||||
/// </summary>
|
||||
public interface IAccidentalEccentricityLogic : ILogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties of compressed member
|
||||
/// </summary>
|
||||
double Length { get;set;}
|
||||
/// <summary>
|
||||
/// Size of cross-section along X-axis, m
|
||||
/// </summary>
|
||||
double SizeX { get; set; }
|
||||
/// <summary>
|
||||
/// Size of cross-section along Y-axis, m
|
||||
/// </summary>
|
||||
double SizeY { get; set; }
|
||||
/// <summary>
|
||||
/// Initial tuple of force
|
||||
/// </summary>
|
||||
IForceTuple InitialForceTuple { get; set; }
|
||||
/// <summary>
|
||||
/// Returns new force tuple with accidental eccentricity
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
ForceTuple GetForceTuple();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public interface IHasInputForce
|
||||
{
|
||||
/// <summary>
|
||||
/// Initial tuple of force
|
||||
/// </summary>
|
||||
IForceTuple InputForceTuple { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public interface IProcessorDecorator<T> : IProcessorLogic<T>
|
||||
{
|
||||
IProcessorLogic<T> ForceTupleLogics { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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 StructureHelperCommon.Models.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Logic for calculating of some value
|
||||
/// </summary>
|
||||
public interface IProcessorLogic<T> : ILogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns new value
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
T GetValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public interface IRcAccEccentricityLogic : IProcessorLogic<(double ex, double ey)>
|
||||
{
|
||||
double Length { get; set; }
|
||||
double SizeX { get; set; }
|
||||
double SizeY { get; set; }
|
||||
IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
(double ex, double ey) GetValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public interface IRcEccentricityAxisLogic : IProcessorLogic<double>
|
||||
{
|
||||
double Length { get; set; }
|
||||
double Size { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public class RcAccEccentricityLogic : IRcAccEccentricityLogic
|
||||
{
|
||||
private const string accEccMessage = "Accidental eccentricity along {0}-axis";
|
||||
/// <summary>
|
||||
/// Properties of compressed member
|
||||
/// </summary>
|
||||
public double Length { get; set; }
|
||||
/// <summary>
|
||||
/// Size of cross-section along X-axis, m
|
||||
/// </summary>
|
||||
public double SizeX { get; set; }
|
||||
/// <summary>
|
||||
/// Size of cross-section along Y-axis, m
|
||||
/// </summary>
|
||||
public double SizeY { get; set; }
|
||||
///<inheritdoc/>
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
private IRcEccentricityAxisLogic eccentricityLogic;
|
||||
public RcAccEccentricityLogic(IRcEccentricityAxisLogic eccentricityLogic)
|
||||
{
|
||||
this.eccentricityLogic = eccentricityLogic;
|
||||
}
|
||||
public RcAccEccentricityLogic() : this(new RcEccentricityAxisLogic())
|
||||
{
|
||||
|
||||
}
|
||||
public (double ex, double ey) GetValue()
|
||||
{
|
||||
eccentricityLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(string.Format(accEccMessage, "x"));
|
||||
eccentricityLogic.Length = Length;
|
||||
eccentricityLogic.Size = SizeX;
|
||||
var xFullEccentricity = eccentricityLogic.GetValue();
|
||||
TraceLogger?.AddMessage(string.Format(accEccMessage, "y"));
|
||||
eccentricityLogic.Size = SizeY;
|
||||
var yFullEccentricity = eccentricityLogic.GetValue();
|
||||
return (xFullEccentricity, yFullEccentricity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections.Logics
|
||||
{
|
||||
public class RcEccentricityAxisLogic : IRcEccentricityAxisLogic
|
||||
{
|
||||
private readonly double lengthFactor;
|
||||
private readonly double sizeFactor;
|
||||
private readonly double minEccentricity;
|
||||
|
||||
/// <summary>
|
||||
/// Properties of compressed member
|
||||
/// </summary>
|
||||
public double Length { get; set; }
|
||||
/// <summary>
|
||||
/// Size of cross-section along X-axis, m
|
||||
/// </summary>
|
||||
public double Size { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public RcEccentricityAxisLogic()
|
||||
{
|
||||
lengthFactor = 600d;
|
||||
sizeFactor = 30d;
|
||||
minEccentricity = 0.01d;
|
||||
}
|
||||
public double GetValue()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
var lengthEccetricity = Length / lengthFactor;
|
||||
TraceLogger?.AddMessage(string.Format("Length of member = {0}(m)", Length));
|
||||
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length e,a = {0}(m) / {1} = {2}(m)", Length, lengthFactor, lengthEccetricity));
|
||||
TraceLogger?.AddMessage(string.Format("Size of cross-section of member = {0}(m)", Size));
|
||||
var sizeXEccetricity = Size / sizeFactor;
|
||||
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by size e,a ={0}(m) / {1} = {2}(m)", Size, sizeFactor, sizeXEccetricity)); ;
|
||||
TraceLogger?.AddMessage(string.Format("In any case, minimum accidental eccentricity e,a = {0}(m)", minEccentricity));
|
||||
|
||||
var fullEccentricity = new List<double>()
|
||||
{
|
||||
lengthEccetricity,
|
||||
sizeXEccetricity,
|
||||
minEccentricity,
|
||||
}
|
||||
.Max();
|
||||
string mesEcc = string.Format("Maximum accidental eccentricity e,a = max({0}(m); {1}(m); {2}(m)) = {3}(m)",
|
||||
lengthEccetricity, sizeXEccetricity,
|
||||
minEccentricity,
|
||||
fullEccentricity);
|
||||
TraceLogger?.AddMessage(mesEcc);
|
||||
return fullEccentricity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Sections.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public class RcEccentricityLogic : IProcessorLogic<IForceTuple>, IHasInputForce
|
||||
{
|
||||
private const string fstAxisName = "x";
|
||||
private const string sndAxisName = "y";
|
||||
private const string actualEccMessage = "Actual eccentricity e0,{0} = {1}(m)";
|
||||
private const string maxEccentricityMessage = "Eccentricity e,{0} = max({1}(m); {2}(m)) = {3}(m)";
|
||||
private const string OutPutBendingMomentMessage = "Bending moment arbitrary {0}-axis M{0} = Nz * e,{0} = {1}(N) * {2}(m) = {3}(N*m)";
|
||||
|
||||
/// <summary>
|
||||
/// Properties of compressed member
|
||||
/// </summary>
|
||||
public double Length { get; set; }
|
||||
/// <summary>
|
||||
/// Size of cross-section along X-axis, m
|
||||
/// </summary>
|
||||
public double SizeX { get; set; }
|
||||
/// <summary>
|
||||
/// Size of cross-section along Y-axis, m
|
||||
/// </summary>
|
||||
public double SizeY { get; set; }
|
||||
///<inheritdoc/>
|
||||
public IForceTuple? InputForceTuple { get; set; }
|
||||
///<inheritdoc/>
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public IRcAccEccentricityLogic EccentricityLogic { get; private set; }
|
||||
|
||||
public RcEccentricityLogic(IRcAccEccentricityLogic eccentricityLogic)
|
||||
{
|
||||
EccentricityLogic = eccentricityLogic;
|
||||
}
|
||||
|
||||
public RcEccentricityLogic() : this(new RcAccEccentricityLogic())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IForceTuple GetValue()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
if (InputForceTuple is null)
|
||||
{
|
||||
string errorString = ErrorStrings.NullReference + $": {nameof(InputForceTuple)}";
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
|
||||
EccentricityLogic.Length = Length;
|
||||
EccentricityLogic.SizeX = SizeX;
|
||||
EccentricityLogic.SizeY = SizeY;
|
||||
EccentricityLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||
|
||||
var (ex, ey) = EccentricityLogic.GetValue();
|
||||
|
||||
var xEccentricity = Math.Abs(InputForceTuple.My / InputForceTuple.Nz);
|
||||
TraceLogger?.AddMessage(string.Format(actualEccMessage, fstAxisName, xEccentricity));
|
||||
var yEccentricity = Math.Abs(InputForceTuple.Mx / InputForceTuple.Nz);
|
||||
TraceLogger?.AddMessage(string.Format(actualEccMessage, sndAxisName, yEccentricity));
|
||||
|
||||
var xFullEccentricity = Math.Max(ex, xEccentricity);
|
||||
var yFullEccentricity = Math.Max(ey, yEccentricity);
|
||||
string mesEx = string.Format(maxEccentricityMessage, fstAxisName, ex, xEccentricity, xFullEccentricity);
|
||||
TraceLogger?.AddMessage(mesEx);
|
||||
string mesEy = string.Format(maxEccentricityMessage, sndAxisName, ey, yEccentricity, yFullEccentricity);
|
||||
TraceLogger?.AddMessage(mesEy);
|
||||
var xSign = InputForceTuple.Mx == 0d ? -1d : Math.Sign(InputForceTuple.Mx);
|
||||
var ySign = InputForceTuple.My == 0d ? -1d : Math.Sign(InputForceTuple.My);
|
||||
var mx = (-1d) * InputForceTuple.Nz * yFullEccentricity * xSign;
|
||||
var my = (-1d) * InputForceTuple.Nz * xFullEccentricity * ySign;
|
||||
TraceLogger?.AddMessage(string.Format(OutPutBendingMomentMessage, fstAxisName, InputForceTuple.Nz, yFullEccentricity, mx), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(string.Format(OutPutBendingMomentMessage, sndAxisName, InputForceTuple.Nz, xFullEccentricity, my), TraceLogStatuses.Debug);
|
||||
|
||||
var newTuple = new ForceTuple()
|
||||
{
|
||||
Mx = mx,
|
||||
My = my,
|
||||
Nz = InputForceTuple.Nz,
|
||||
Qx = InputForceTuple.Qx,
|
||||
Qy = InputForceTuple.Qy,
|
||||
Mz = InputForceTuple.Mz,
|
||||
};
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
return newTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user