Logics of accidental eccentricity were separated and tested
This commit is contained in:
Binary file not shown.
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
-->
|
-->
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<History>True|2024-02-02T07:22:50.1454015Z;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
|
<History>True|2024-03-10T14:11:27.6834663Z;True|2024-02-02T12:22:50.1454015+05:00;True|2023-02-25T13:37:39.2738786+05:00;False|2023-02-25T13:37:24.0284261+05:00;True|2023-02-25T13:34:01.6858860+05:00;True|2023-02-25T13:31:18.8295711+05:00;False|2023-02-25T13:25:21.5807199+05:00;False|2023-02-25T13:24:41.7164398+05:00;</History>
|
||||||
<LastFailureDetails />
|
<LastFailureDetails />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
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 ConcreteLogicOptions options;
|
||||||
private MaterialCommonOptionLogic optionLogic;
|
private MaterialCommonOptionLogic optionLogic;
|
||||||
private FactorLogic factorLogic;
|
|
||||||
|
|
||||||
public ConcreteMaterialOptionLogic(ConcreteLogicOptions options)
|
public ConcreteMaterialOptionLogic(ConcreteLogicOptions options)
|
||||||
{
|
{
|
||||||
@@ -32,10 +32,6 @@ namespace StructureHelperCommon.Models.Materials
|
|||||||
var concreteOptions = materialOptions as ConcreteOptions;
|
var concreteOptions = materialOptions as ConcreteOptions;
|
||||||
optionLogic = new MaterialCommonOptionLogic(options);
|
optionLogic = new MaterialCommonOptionLogic(options);
|
||||||
optionLogic.SetMaterialOptions(concreteOptions);
|
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.WorkInTension = options.WorkInTension;
|
||||||
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
||||||
concreteOptions.Age = options.Age;
|
concreteOptions.Age = options.Age;
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
|||||||
Code = code,
|
Code = code,
|
||||||
Name = "A400",
|
Name = "A400",
|
||||||
InitModulus = 2e11d,
|
InitModulus = 2e11d,
|
||||||
MainStrength = 400e6d
|
MainStrength = 390e6d
|
||||||
},
|
},
|
||||||
new ReinforcementMaterialEntity(new Guid("045b54b1-0bbf-41fd-a27d-aeb20f600bb4"))
|
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.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using SHEnums = StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
|
||||||
namespace StructureHelperCommon.Models.Materials
|
namespace StructureHelperCommon.Models.Materials
|
||||||
{
|
{
|
||||||
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
||||||
{
|
{
|
||||||
private IMaterialLogicOptions options;
|
private IMaterialLogicOptions options;
|
||||||
|
private FactorLogic factorLogic;
|
||||||
|
|
||||||
public MaterialCommonOptionLogic(IMaterialLogicOptions options)
|
public MaterialCommonOptionLogic(IMaterialLogicOptions options)
|
||||||
{
|
{
|
||||||
@@ -17,6 +21,58 @@ namespace StructureHelperCommon.Models.Materials
|
|||||||
{
|
{
|
||||||
materialOptions.InitModulus = options.MaterialEntity.InitModulus;
|
materialOptions.InitModulus = options.MaterialEntity.InitModulus;
|
||||||
materialOptions.Strength = options.MaterialEntity.MainStrength;
|
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)
|
if (options.MaterialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||||
{
|
{
|
||||||
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
||||||
@@ -25,23 +81,10 @@ namespace StructureHelperCommon.Models.Materials
|
|||||||
{
|
{
|
||||||
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
||||||
}
|
}
|
||||||
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
|
else
|
||||||
if (options.LimitState == LimitStates.ULS)
|
|
||||||
{
|
{
|
||||||
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()
|
private void GetLoaderOptions()
|
||||||
{
|
{
|
||||||
materialOptions = new ReinforcementOptions() { DiagramType = DiagramType};
|
materialOptions = new ReinforcementOptions()
|
||||||
|
{
|
||||||
|
DiagramType = DiagramType
|
||||||
|
};
|
||||||
optionLogic = new MaterialCommonOptionLogic(options);
|
optionLogic = new MaterialCommonOptionLogic(options);
|
||||||
optionLogic.SetMaterialOptions(materialOptions);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,13 +20,6 @@ namespace StructureHelperCommon.Services.Forces
|
|||||||
target.Clear();
|
target.Clear();
|
||||||
SumTupleToTarget(source, target, factor);
|
SumTupleToTarget(source, target, factor);
|
||||||
}
|
}
|
||||||
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
|
|
||||||
{
|
|
||||||
var newTuple = forceTuple.Clone() as IForceTuple;
|
|
||||||
newTuple.Mx += newTuple.Nz * point2D.Y;
|
|
||||||
newTuple.My -= newTuple.Nz * point2D.X;
|
|
||||||
return newTuple;
|
|
||||||
}
|
|
||||||
public static IForceTuple SumTuples(IForceTuple first, IForceTuple second, double factor = 1d)
|
public static IForceTuple SumTuples(IForceTuple first, IForceTuple second, double factor = 1d)
|
||||||
{
|
{
|
||||||
CheckTuples(first, second);
|
CheckTuples(first, second);
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ using StructureHelperCommon.Infrastructures.Exceptions;
|
|||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using StructureHelperCommon.Models.Sections;
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperCommon.Models.Sections.Logics;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services.Forces;
|
using StructureHelperCommon.Services.Forces;
|
||||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
using StructureHelperLogics.NdmCalculations.Buckling;
|
using StructureHelperLogics.NdmCalculations.Buckling;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using StructureHelperLogics.Services.NdmPrimitives;
|
using StructureHelperLogics.Services.NdmPrimitives;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
@@ -19,6 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||||
private readonly IForceTupleCalculator forceTupleCalculator;
|
private readonly IForceTupleCalculator forceTupleCalculator;
|
||||||
private ForcesResults result;
|
private ForcesResults result;
|
||||||
|
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||||
|
private ForceTupleBucklingLogic bucklingLogic;
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<LimitStates> LimitStatesList { get; private set; }
|
public List<LimitStates> LimitStatesList { get; private set; }
|
||||||
@@ -34,6 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
var checkResult = CheckInputData();
|
var checkResult = CheckInputData();
|
||||||
if (checkResult != "")
|
if (checkResult != "")
|
||||||
{
|
{
|
||||||
@@ -95,13 +101,14 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
CalcTerms calcTerm = tuple.CalcTerm;
|
CalcTerms calcTerm = tuple.CalcTerm;
|
||||||
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
||||||
IPoint2D point2D;
|
IPoint2D point2D;
|
||||||
|
IProcessorLogic<IForceTuple> forcelogic = new ForceTupleCopier(tuple.ForceTuple);
|
||||||
if (combination.SetInGravityCenter == true)
|
if (combination.SetInGravityCenter == true)
|
||||||
{
|
{
|
||||||
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||||
point2D = new Point2D(){ X = Cx, Y = Cy };
|
point2D = new Point2D() { X = Cx, Y = Cy };
|
||||||
|
forcelogic = new ForceTupleMoveToPointDecorator(forcelogic) { Point2D = point2D};
|
||||||
}
|
}
|
||||||
else point2D = combination.ForcePoint;
|
var newTuple = forcelogic.GetValue();
|
||||||
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
|
|
||||||
TraceLogger?.AddMessage($"Input force combination");
|
TraceLogger?.AddMessage($"Input force combination");
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||||
if (CompressedMember.Buckling == true)
|
if (CompressedMember.Buckling == true)
|
||||||
@@ -109,27 +116,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
if (newTuple.Nz >= 0d)
|
if (newTuple.Nz >= 0d)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(string.Format("Second order effect is not considered as Nz={0} >= 0", newTuple.Nz));
|
TraceLogger?.AddMessage(string.Format("Second order effect is not considered as Nz={0} >= 0", newTuple.Nz));
|
||||||
|
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage("Get eccentricity for full load");
|
tupleResult = ProcessCompressedMember(combination, tuple, ndms, newTuple);
|
||||||
newTuple = ProcessAccEccentricity(ndms, newTuple);
|
}
|
||||||
var buckResult = GetForceTupleByBuckling(combination, limitState, calcTerm, ndms, newTuple);
|
|
||||||
if (buckResult.isValid == true)
|
|
||||||
{
|
|
||||||
newTuple = buckResult.tuple;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new ForcesTupleResult()
|
|
||||||
{
|
|
||||||
IsValid = false,
|
|
||||||
DesignForceTuple = tuple,
|
|
||||||
Description = buckResult.description,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,10 +135,19 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
return tupleResult;
|
return tupleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (bool isValid, IForceTuple tuple, string description) GetForceTupleByBuckling(IForceCombinationList combination, LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
private IForcesTupleResult ProcessCompressedMember(IForceCombinationList combination, IDesignForceTuple tuple, List<INdm> ndms, IForceTuple newTuple)
|
||||||
{
|
{
|
||||||
var tuple = newTuple.Clone() as IForceTuple;
|
IForcesTupleResult tupleResult;
|
||||||
var inputData = new BucklingInputData()
|
LimitStates limitState = tuple.LimitState;
|
||||||
|
CalcTerms calcTerm = tuple.CalcTerm;
|
||||||
|
|
||||||
|
TraceLogger?.AddMessage("Get eccentricity for full load");
|
||||||
|
eccentricityLogic = new ProcessEccentricity(CompressedMember, ndms, newTuple)
|
||||||
|
{
|
||||||
|
TraceLogger = TraceLogger ?? null
|
||||||
|
};
|
||||||
|
newTuple = eccentricityLogic.GetValue();
|
||||||
|
var buclingInputData = new BucklingInputData()
|
||||||
{
|
{
|
||||||
Combination = combination,
|
Combination = combination,
|
||||||
LimitState = limitState,
|
LimitState = limitState,
|
||||||
@@ -154,117 +155,42 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
Ndms = ndms,
|
Ndms = ndms,
|
||||||
ForceTuple = newTuple
|
ForceTuple = newTuple
|
||||||
};
|
};
|
||||||
var bucklingResult = ProcessBuckling(inputData);
|
bucklingLogic = new ForceTupleBucklingLogic(buclingInputData)
|
||||||
|
|
||||||
if (bucklingResult.IsValid != true)
|
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(bucklingResult.Description, TraceLogStatuses.Error);
|
CompressedMember = CompressedMember,
|
||||||
return (false, tuple, $"Buckling result:\n{bucklingResult.Description}");
|
Accuracy = Accuracy,
|
||||||
|
Primitives = Primitives,
|
||||||
|
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||||
|
};
|
||||||
|
var buckResult = bucklingLogic.GetForceTupleByBuckling();
|
||||||
|
if (buckResult.IsValid == true)
|
||||||
|
{
|
||||||
|
newTuple = buckResult.Value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tuple = CalculateBuckling(tuple, bucklingResult);
|
return new ForcesTupleResult()
|
||||||
TraceLogger?.AddMessage(string.Intern("Force combination with considering of second order effects"));
|
{
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
|
IsValid = false,
|
||||||
|
DesignForceTuple = tuple,
|
||||||
|
Description = buckResult.Description,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
TraceLogger?.AddMessage(string.Intern("Result of second order was obtained succesfully, new force combination was obtained"));
|
||||||
return (true, tuple, string.Empty);
|
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||||
|
return tupleResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IForcesTupleResult GetForceResult(LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
private IForcesTupleResult GetForceResult(LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||||
{
|
{
|
||||||
|
TraceLogger?.AddMessage("Calculation of cross-section is started");
|
||||||
var tupleResult = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
var tupleResult = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||||
tupleResult.DesignForceTuple.LimitState = limitState;
|
tupleResult.DesignForceTuple.LimitState = limitState;
|
||||||
tupleResult.DesignForceTuple.CalcTerm = calcTerm;
|
tupleResult.DesignForceTuple.CalcTerm = calcTerm;
|
||||||
tupleResult.DesignForceTuple.ForceTuple = newTuple;
|
tupleResult.DesignForceTuple.ForceTuple = newTuple;
|
||||||
return tupleResult;
|
return tupleResult;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IForceTuple ProcessAccEccentricity(List<INdm> ndms, IForceTuple tuple)
|
|
||||||
{
|
|
||||||
var newTuple = tuple.Clone() as IForceTuple;
|
|
||||||
var accLogic = new AccidentalEccentricityLogic()
|
|
||||||
{
|
|
||||||
Length = CompressedMember.GeometryLength,
|
|
||||||
SizeX = ndms.Max(x => x.CenterX) - ndms.Min(x => x.CenterX),
|
|
||||||
SizeY = ndms.Max(x => x.CenterY) - ndms.Min(x => x.CenterY),
|
|
||||||
InitialForceTuple = newTuple,
|
|
||||||
};
|
|
||||||
if (TraceLogger is not null)
|
|
||||||
{
|
|
||||||
accLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
|
||||||
}
|
|
||||||
newTuple = accLogic.GetForceTuple();
|
|
||||||
return newTuple;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IConcreteBucklingResult ProcessBuckling(BucklingInputData inputData)
|
|
||||||
{
|
|
||||||
IForceTuple resultTuple;
|
|
||||||
IForceTuple longTuple;
|
|
||||||
if (inputData.CalcTerm == CalcTerms.LongTerm)
|
|
||||||
{
|
|
||||||
longTuple = inputData.ForceTuple;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState);
|
|
||||||
}
|
|
||||||
TraceLogger?.AddMessage("Get eccentricity for long term load");
|
|
||||||
longTuple = ProcessAccEccentricity(inputData.Ndms, longTuple);
|
|
||||||
var bucklingCalculator = GetBucklingCalculator(CompressedMember, inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple);
|
|
||||||
if (TraceLogger is not null)
|
|
||||||
{
|
|
||||||
bucklingCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
|
||||||
}
|
|
||||||
bucklingCalculator.Run();
|
|
||||||
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
|
|
||||||
|
|
||||||
return bucklingResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
|
||||||
{
|
|
||||||
IForceTuple longTuple;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
longTuple = designForces
|
|
||||||
.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm)
|
|
||||||
.Single()
|
|
||||||
.ForceTuple;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
longTuple = new ForceTuple();
|
|
||||||
}
|
|
||||||
return longTuple;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
|
|
||||||
{
|
|
||||||
var options = new ConcreteBucklingOptions()
|
|
||||||
{
|
|
||||||
CompressedMember = compressedMember,
|
|
||||||
LimitState = limitStates,
|
|
||||||
CalcTerm = calcTerms,
|
|
||||||
CalcForceTuple = calcTuple,
|
|
||||||
LongTermTuple = longTuple,
|
|
||||||
Primitives = Primitives
|
|
||||||
};
|
|
||||||
var bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
|
||||||
return bucklingCalculator;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ForceTuple CalculateBuckling(IForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
|
||||||
{
|
|
||||||
var newTuple = calcTuple.Clone() as ForceTuple;
|
|
||||||
newTuple.Mx *= bucklingResult.EtaFactorAlongY;
|
|
||||||
newTuple.My *= bucklingResult.EtaFactorAlongX;
|
|
||||||
return newTuple;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private string CheckInputData()
|
private string CheckInputData()
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|||||||
@@ -57,6 +57,66 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
otherNdms = ndmCollection.Except(concreteNdms).ToList();
|
otherNdms = ndmCollection.Except(concreteNdms).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018");
|
||||||
|
var checkResult = CheckInputData();
|
||||||
|
if (checkResult != "")
|
||||||
|
{
|
||||||
|
ProcessFalseResult(checkResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ProcessValidResult();
|
||||||
|
}
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessValidResult()
|
||||||
|
{
|
||||||
|
var phiLLogic = GetPhiLogic();
|
||||||
|
var (DeltaLogicAboutX, DeltaLogicAboutY) = GetDeltaLogics();
|
||||||
|
stiffnessLogicX = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutX);
|
||||||
|
stiffnessLogicY = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutY);
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
stiffnessLogicX.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
|
stiffnessLogicY.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
|
}
|
||||||
|
criticalForceLogic = new EilerCriticalForceLogic();
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
criticalForceLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
var (EtaFactorX, EtaFactorY) = GetBucklingCoefficients();
|
||||||
|
var messageString = "Eta factor orbitrary {0} axis, Eta{0} = {1} (dimensionless)";
|
||||||
|
var messageStringX = string.Format(messageString, "X", EtaFactorX);
|
||||||
|
var messageStringY = string.Format(messageString, "Y", EtaFactorY);
|
||||||
|
TraceLogger?.AddMessage(messageStringX);
|
||||||
|
TraceLogger?.AddMessage(messageStringY);
|
||||||
|
Result = new ConcreteBucklingResult()
|
||||||
|
{
|
||||||
|
IsValid = true,
|
||||||
|
EtaFactorAlongX = EtaFactorX,
|
||||||
|
EtaFactorAlongY = EtaFactorY
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessFalseResult(string checkResult)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(checkResult, TraceLogStatuses.Error);
|
||||||
|
Result = new ConcreteBucklingResult()
|
||||||
|
{
|
||||||
|
IsValid = false,
|
||||||
|
Description = checkResult,
|
||||||
|
EtaFactorAlongX = double.PositiveInfinity,
|
||||||
|
EtaFactorAlongY = double.PositiveInfinity
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private (IConcreteDeltaELogic DeltaLogicX, IConcreteDeltaELogic DeltaLogicY) GetDeltaLogics()
|
private (IConcreteDeltaELogic DeltaLogicX, IConcreteDeltaELogic DeltaLogicY) GetDeltaLogics()
|
||||||
{
|
{
|
||||||
IForceTuple forceTuple = options.CalcForceTuple;
|
IForceTuple forceTuple = options.CalcForceTuple;
|
||||||
@@ -66,6 +126,15 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
}
|
}
|
||||||
var eccentricityAlongX = options.CalcForceTuple.My / forceTuple.Nz;
|
var eccentricityAlongX = options.CalcForceTuple.My / forceTuple.Nz;
|
||||||
var eccentricityAlongY = options.CalcForceTuple.Mx / forceTuple.Nz;
|
var eccentricityAlongY = options.CalcForceTuple.Mx / forceTuple.Nz;
|
||||||
|
const string eccMesssage = "Eccentricity along {0}-axis e{0} = {1}(N * m) / {2}(N) = {3}(m)";
|
||||||
|
TraceLogger?.AddMessage(string.Format(eccMesssage,
|
||||||
|
"x",
|
||||||
|
options.CalcForceTuple.My, forceTuple.Nz,
|
||||||
|
eccentricityAlongX));
|
||||||
|
TraceLogger?.AddMessage(string.Format(eccMesssage,
|
||||||
|
"y",
|
||||||
|
options.CalcForceTuple.Mx, forceTuple.Nz,
|
||||||
|
eccentricityAlongY));
|
||||||
var sizeAlongX = ndmCollection.Max(x => x.CenterX) - ndmCollection.Min(x => x.CenterX);
|
var sizeAlongX = ndmCollection.Max(x => x.CenterX) - ndmCollection.Min(x => x.CenterX);
|
||||||
var sizeAlongY = ndmCollection.Max(x => x.CenterY) - ndmCollection.Min(x => x.CenterY);
|
var sizeAlongY = ndmCollection.Max(x => x.CenterY) - ndmCollection.Min(x => x.CenterY);
|
||||||
var DeltaElogicAboutX = new DeltaELogicSP63(eccentricityAlongY, sizeAlongY);
|
var DeltaElogicAboutX = new DeltaELogicSP63(eccentricityAlongY, sizeAlongY);
|
||||||
@@ -82,7 +151,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
{
|
{
|
||||||
const string sumStif = "Summary stiffness";
|
const string sumStif = "Summary stiffness";
|
||||||
var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection);
|
var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection);
|
||||||
string message = string.Format("Gravity center, x = {0}, y = {1}", gravityCenter.Cx, gravityCenter.Cy);
|
string message = string.Format("Gravity center, x = {0}(m), y = {1}(m)", gravityCenter.Cx, gravityCenter.Cy);
|
||||||
TraceLogger?.AddMessage(message);
|
TraceLogger?.AddMessage(message);
|
||||||
if (TraceLogger is not null)
|
if (TraceLogger is not null)
|
||||||
{
|
{
|
||||||
@@ -152,55 +221,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
return calculator;
|
return calculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
|
||||||
TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018");
|
|
||||||
var checkResult = CheckInputData();
|
|
||||||
if (checkResult != "")
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage(checkResult, TraceLogStatuses.Error);
|
|
||||||
Result = new ConcreteBucklingResult()
|
|
||||||
{
|
|
||||||
IsValid = false,
|
|
||||||
Description = checkResult,
|
|
||||||
EtaFactorAlongX = double.PositiveInfinity,
|
|
||||||
EtaFactorAlongY = double.PositiveInfinity
|
|
||||||
};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var phiLLogic = GetPhiLogic();
|
|
||||||
var (DeltaLogicAboutX, DeltaLogicAboutY) = GetDeltaLogics();
|
|
||||||
stiffnessLogicX = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutX);
|
|
||||||
stiffnessLogicY = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutY);
|
|
||||||
if (TraceLogger is not null)
|
|
||||||
{
|
|
||||||
stiffnessLogicX.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
|
||||||
stiffnessLogicY.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
|
||||||
}
|
|
||||||
criticalForceLogic = new EilerCriticalForceLogic();
|
|
||||||
if (TraceLogger is not null)
|
|
||||||
{
|
|
||||||
criticalForceLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
var (EtaFactorX, EtaFactorY) = GetBucklingCoefficients();
|
|
||||||
var messageString = "Eta factor orbitrary {0} axis, Eta{0} = {1} (dimensionless)";
|
|
||||||
var messageStringX = string.Format(messageString, "X", EtaFactorX);
|
|
||||||
var messageStringY = string.Format(messageString, "Y", EtaFactorY);
|
|
||||||
TraceLogger?.AddMessage(messageStringX);
|
|
||||||
TraceLogger?.AddMessage(messageStringY);
|
|
||||||
Result = new ConcreteBucklingResult()
|
|
||||||
{
|
|
||||||
IsValid = true,
|
|
||||||
EtaFactorAlongX = EtaFactorX,
|
|
||||||
EtaFactorAlongY = EtaFactorY
|
|
||||||
};
|
|
||||||
}
|
|
||||||
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string CheckInputData()
|
private string CheckInputData()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||||
|
{
|
||||||
|
public class ForceTupleBucklingLogic : IForceTupleBucklingLogic
|
||||||
|
{
|
||||||
|
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||||
|
private BucklingInputData bucklingInputData;
|
||||||
|
|
||||||
|
public ICompressedMember CompressedMember { get; set; }
|
||||||
|
public IAccuracy Accuracy { get; set; }
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public IEnumerable<INdmPrimitive> Primitives { get; set; }
|
||||||
|
|
||||||
|
public ForceTupleBucklingLogic(BucklingInputData inputData)
|
||||||
|
{
|
||||||
|
bucklingInputData = inputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericResult<IForceTuple> GetForceTupleByBuckling()
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
|
|
||||||
|
var tuple = bucklingInputData.ForceTuple.Clone() as IForceTuple;
|
||||||
|
|
||||||
|
var bucklingResult = ProcessBuckling(bucklingInputData);
|
||||||
|
|
||||||
|
if (bucklingResult.IsValid != true)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(bucklingResult.Description, TraceLogStatuses.Error);
|
||||||
|
var tupleResult = new GenericResult<IForceTuple>()
|
||||||
|
{
|
||||||
|
IsValid = false,
|
||||||
|
Description = $"Buckling result:\n{bucklingResult.Description}",
|
||||||
|
Value = tuple
|
||||||
|
};
|
||||||
|
return tupleResult;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tuple = CalculateBuckling(tuple, bucklingResult);
|
||||||
|
TraceLogger?.AddMessage(string.Intern("Force combination with considering of second order effects"));
|
||||||
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
|
||||||
|
}
|
||||||
|
var trueTupleResult = new GenericResult<IForceTuple>()
|
||||||
|
{
|
||||||
|
IsValid = true,
|
||||||
|
Description = string.Empty,
|
||||||
|
Value = tuple
|
||||||
|
};
|
||||||
|
return trueTupleResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IConcreteBucklingResult ProcessBuckling(BucklingInputData inputData)
|
||||||
|
{
|
||||||
|
IForceTuple resultTuple;
|
||||||
|
IForceTuple longTuple;
|
||||||
|
if (inputData.CalcTerm == CalcTerms.LongTerm)
|
||||||
|
{
|
||||||
|
longTuple = inputData.ForceTuple;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState);
|
||||||
|
}
|
||||||
|
TraceLogger?.AddMessage("Get eccentricity for long term load");
|
||||||
|
eccentricityLogic = new ProcessEccentricity(CompressedMember, inputData.Ndms, longTuple)
|
||||||
|
{
|
||||||
|
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||||
|
};
|
||||||
|
longTuple = eccentricityLogic.GetValue();
|
||||||
|
var bucklingCalculator = GetBucklingCalculator(inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple);
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
bucklingCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
|
}
|
||||||
|
bucklingCalculator.Run();
|
||||||
|
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
|
||||||
|
|
||||||
|
return bucklingResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
||||||
|
{
|
||||||
|
IForceTuple longTuple;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
longTuple = designForces
|
||||||
|
.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm)
|
||||||
|
.Single()
|
||||||
|
.ForceTuple;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
longTuple = new ForceTuple();
|
||||||
|
}
|
||||||
|
return longTuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IConcreteBucklingCalculator GetBucklingCalculator(LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
|
||||||
|
{
|
||||||
|
var options = new ConcreteBucklingOptions()
|
||||||
|
{
|
||||||
|
CompressedMember = CompressedMember,
|
||||||
|
LimitState = limitStates,
|
||||||
|
CalcTerm = calcTerms,
|
||||||
|
CalcForceTuple = calcTuple,
|
||||||
|
LongTermTuple = longTuple,
|
||||||
|
Primitives = Primitives
|
||||||
|
};
|
||||||
|
var bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
||||||
|
return bucklingCalculator;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ForceTuple CalculateBuckling(IForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
||||||
|
{
|
||||||
|
var newTuple = calcTuple.Clone() as ForceTuple;
|
||||||
|
newTuple.Mx *= bucklingResult.EtaFactorAlongY;
|
||||||
|
newTuple.My *= bucklingResult.EtaFactorAlongX;
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||||
|
{
|
||||||
|
public interface IForceTupleBucklingLogic : ILogic
|
||||||
|
{
|
||||||
|
GenericResult<IForceTuple> GetForceTupleByBuckling();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||||
|
{
|
||||||
|
public class ProcessEccentricity : IProcessorLogic<IForceTuple>
|
||||||
|
{
|
||||||
|
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||||
|
|
||||||
|
public ICompressedMember CompressedMember { get; private set; }
|
||||||
|
public IEnumerable<INdm> Ndms { get; private set; }
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public IForceTuple InputForceTuple { get; set; }
|
||||||
|
|
||||||
|
private double sizeX;
|
||||||
|
private double sizeY;
|
||||||
|
|
||||||
|
public ProcessEccentricity(IProcessorLogic<IForceTuple> eccentricityLogic)
|
||||||
|
{
|
||||||
|
this.eccentricityLogic = eccentricityLogic;
|
||||||
|
}
|
||||||
|
public ProcessEccentricity(ICompressedMember compressedMember, IEnumerable<INdm> ndms, IForceTuple initialForceTuple)
|
||||||
|
{
|
||||||
|
CompressedMember = compressedMember;
|
||||||
|
Ndms = ndms;
|
||||||
|
InputForceTuple = initialForceTuple;
|
||||||
|
sizeX = ndms.Max(x => x.CenterX) - ndms.Min(x => x.CenterX);
|
||||||
|
sizeY = ndms.Max(x => x.CenterY) - ndms.Min(x => x.CenterY);
|
||||||
|
eccentricityLogic = new RcEccentricityLogic()
|
||||||
|
{
|
||||||
|
InputForceTuple = InputForceTuple,
|
||||||
|
Length = CompressedMember.GeometryLength,
|
||||||
|
SizeX = sizeX,
|
||||||
|
SizeY = sizeY,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public IForceTuple GetValue()
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
|
TraceLogger?.AddMessage("Get eccentricity taking into account accidental eccentricity");
|
||||||
|
TraceLogger?.AddMessage(string.Format("Cross-section size along x-axis dx = {0}, along y-axis dy = {1}", sizeX, sizeY));
|
||||||
|
|
||||||
|
eccentricityLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||||
|
var newTuple = eccentricityLogic.GetValue();
|
||||||
|
return newTuple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using StructureHelperCommon.Models.Sections.Logics;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.FunctionalTests.RCs.Eccentricitis
|
||||||
|
{
|
||||||
|
public class RcEccentricityAxisLogicTests
|
||||||
|
{
|
||||||
|
[TestCase(12d, 0.2d, 0.02d)]
|
||||||
|
[TestCase(3d, 0.9d, 0.03d)]
|
||||||
|
[TestCase(2, 0.2d, 0.01d)]
|
||||||
|
public void GetValue_ShouldCalculateCorrectly(double length, double size, double expectedEccentricity)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var loggerMock = new Mock<IShiftTraceLogger>();
|
||||||
|
|
||||||
|
var rcEccentricityAxisLogic = new RcEccentricityAxisLogic
|
||||||
|
{
|
||||||
|
Length = length,
|
||||||
|
Size = size,
|
||||||
|
TraceLogger = loggerMock.Object,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = rcEccentricityAxisLogic.GetValue();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
//loggerMock.Verify(logger => logger.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.Exactly(7)); // Adjust based on your actual calls
|
||||||
|
Assert.AreEqual(expectedEccentricity, result, 0.0001); // Adjust based on your expected result
|
||||||
|
// Add more assertions based on your expected behavior
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using StructureHelperCommon.Models.Sections.Logics;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.FunctionalTests.RCs.Eccentricitis
|
||||||
|
{
|
||||||
|
public class RcAccEccentricityLogicTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void GetValue_ShouldCalculateCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var eccentricityAxisLogicMock = new Mock<IRcEccentricityAxisLogic>();
|
||||||
|
eccentricityAxisLogicMock.Setup(el => el.GetValue()).Returns(3.0); // Adjust based on your expected result
|
||||||
|
|
||||||
|
var loggerMock = new Mock<IShiftTraceLogger>();
|
||||||
|
|
||||||
|
var rcAccEccentricityLogic = new RcAccEccentricityLogic(eccentricityAxisLogicMock.Object)
|
||||||
|
{
|
||||||
|
Length = 100.0,
|
||||||
|
SizeX = 5.0,
|
||||||
|
SizeY = 10.0,
|
||||||
|
TraceLogger = loggerMock.Object,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = rcAccEccentricityLogic.GetValue();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
eccentricityAxisLogicMock.Verify(el => el.GetValue(), Times.Exactly(2));
|
||||||
|
//loggerMock.Verify(logger => logger.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.Exactly(3)); // Adjust based on your actual calls
|
||||||
|
Assert.AreEqual(3.0, result.ex, 0.001); // Adjust based on your expected result
|
||||||
|
Assert.AreEqual(3.0, result.ey, 0.001); // Adjust based on your expected result
|
||||||
|
// Add more assertions based on your expected behavior
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Sections.Logics;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.FunctionalTests.RCs.Eccentricitis
|
||||||
|
{
|
||||||
|
public class RcEccentricityLogicTests
|
||||||
|
{
|
||||||
|
[TestCase(30, 1.0, 2.0, -60, -30)]
|
||||||
|
[TestCase(30, 2.0, 1.0, -30, -60)]
|
||||||
|
public void GetValue_ShouldCalculateCorrectly(double nz, double ex, double ey, double expectedMx, double expectedMy)
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var inputForceTuple = new ForceTuple
|
||||||
|
{
|
||||||
|
Mx = 10,
|
||||||
|
My = 20,
|
||||||
|
Nz = nz,
|
||||||
|
Qx = 40.0,
|
||||||
|
Qy = 50.0,
|
||||||
|
Mz = 60.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
var eccentricityLogicMock = new Mock<IRcAccEccentricityLogic>();
|
||||||
|
eccentricityLogicMock.Setup(el => el.GetValue()).Returns((ex, ey));
|
||||||
|
|
||||||
|
var loggerMock = new Mock<IShiftTraceLogger>();
|
||||||
|
|
||||||
|
var rcEccentricityLogic = new RcEccentricityLogic(eccentricityLogicMock.Object)
|
||||||
|
{
|
||||||
|
Length = 100.0,
|
||||||
|
SizeX = 5.0,
|
||||||
|
SizeY = 10.0,
|
||||||
|
InputForceTuple = inputForceTuple,
|
||||||
|
TraceLogger = loggerMock.Object,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = rcEccentricityLogic.GetValue();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
eccentricityLogicMock.Verify(el => el.GetValue(), Times.Once);
|
||||||
|
//loggerMock.Verify(logger => logger.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.Exactly(6)); // Adjust based on your actual calls
|
||||||
|
//loggerMock.Verify(logger => logger.AddEntry(It.IsAny<string>()), Times.Once); // Adjust based on your actual calls
|
||||||
|
Assert.AreEqual(expectedMx, result.Mx, 0.001); // Adjust based on your expected result
|
||||||
|
Assert.AreEqual(expectedMy, result.My, 0.001); // Adjust based on your expected result
|
||||||
|
// Add more assertions based on your expected behavior
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@ namespace StructureHelperTests.UnitTests.MaterialTests
|
|||||||
{
|
{
|
||||||
public class MaterialStrengthTest
|
public class MaterialStrengthTest
|
||||||
{
|
{
|
||||||
[TestCase(HeadmaterialType.Reinforcement400, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 347826086.95652175d, 347826086.95652175d)]
|
[TestCase(HeadmaterialType.Reinforcement400, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 339130434.78260875d, 339130434.78260875d)]
|
||||||
[TestCase(HeadmaterialType.Reinforcement400, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 400000000d, 400000000d)]
|
[TestCase(HeadmaterialType.Reinforcement400, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 390000000d, 390000000d)]
|
||||||
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 400000000.0d, 434782608.69565225d)]
|
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.ShortTerm, 400000000.0d, 434782608.69565225d)]
|
||||||
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.LongTerm, 434782608.69565225d, 434782608.69565225d)]
|
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.ULS, CalcTerms.LongTerm, 434782608.69565225d, 434782608.69565225d)]
|
||||||
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 5e8d, 5e8d)]
|
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_2018, LimitStates.SLS, CalcTerms.ShortTerm, 5e8d, 5e8d)]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelperTests.ViewModelTests
|
|||||||
var labels = new List<string>();
|
var labels = new List<string>();
|
||||||
for (int i = 0; i < columnCount; i++)
|
for (int i = 0; i < columnCount; i++)
|
||||||
{
|
{
|
||||||
labels[i] = $"Column{i}";
|
labels.Add($"Column{i}");
|
||||||
}
|
}
|
||||||
var array = new ArrayParameter<double>(rowCount, columnCount, labels);
|
var array = new ArrayParameter<double>(rowCount, columnCount, labels);
|
||||||
for (int i = 0; i < columnCount; i++)
|
for (int i = 0; i < columnCount; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user