Add steel Material

This commit is contained in:
Evgeny Redikultsev
2025-12-14 17:40:53 +05:00
parent 01cc3947bc
commit 68b15682bb
44 changed files with 1047 additions and 152 deletions

View File

@@ -0,0 +1,116 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.DiagramTemplates;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public class SteelMaterialBuilderLogic : IMaterialLogic
{
private const double safetyFactorForULS = 1.05;
private const double safetyFactorforSLS = 1.0;
private ISteelMaterialLogicOption option;
IObjectConvertStrategy<ISteelDiagramAbsoluteProperty, ISteelDiagramRelativeProperty> convertStrategy;
private IMaterialFactorLogic factorLogic;
private double compressionStrength;
private double tensionStrength;
public Guid Id { get; }
public string Name { get; set; }
public IMaterialLogicOptions Options { get; set; }
public MaterialTypes MaterialType { get; set; }
public DiagramType DiagramType { get; set; }
public SteelMaterialBuilderLogic(Guid id)
{
Id = id;
}
public IMaterial GetLoaderMaterial()
{
option = Options as ISteelMaterialLogicOption;
if (DiagramType == DiagramType.TripleLinear)
{
factorLogic = new MaterialFactorLogic(Options.SafetyFactors);
GetStrength();
Material material = new()
{
InitModulus = option.MaterialEntity.InitialModulus,
Diagram = GetDiagram(),
LimitPositiveStrain = GetMaxStrain(tensionStrength),
LimitNegativeStrain = -GetMaxStrain(compressionStrength),
};
return material;
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(DiagramType));
}
}
private double GetMaxStrain(double strength)
{
double elasticCompressionStrain = strength / Options.MaterialEntity.InitialModulus;
double fullCompressionStrain = elasticCompressionStrain * (1 + ((ISteelMaterialLogicOption)Options).MaxPlasticStrainRatio);
return fullCompressionStrain;
}
private Func<double, double> GetDiagram()
{
MultiLinearStressStrainDiagram compressionDiagram = GetMultiLinearDiagram(compressionStrength);
MultiLinearStressStrainDiagram tensionDiagram = GetMultiLinearDiagram(tensionStrength);
var posNegDiagram = new PosNegDigramDecorator(tensionDiagram, compressionDiagram);
return posNegDiagram.GetStressByStrain;
}
private MultiLinearStressStrainDiagram GetMultiLinearDiagram(double strength)
{
convertStrategy = new SteelRelativeToAbsoluteDiagramConvertLogic(Options.MaterialEntity.InitialModulus, strength);
var diagramProperty = SteelDiagramPropertyFactory.GetProperty(((ISteelMaterialEntity)Options.MaterialEntity).PropertyType);
var absoluteProperty = convertStrategy.Convert(diagramProperty);
List<IStressStrainPair> stressStrainPairs = new()
{
new StressStrainPair() { Stress = 0, Strain = 0},
new StressStrainPair() { Stress = absoluteProperty.StressOfProportionality, Strain = absoluteProperty.StrainOfProportionality},
new StressStrainPair() { Stress = absoluteProperty.BaseStrength, Strain = absoluteProperty.StrainOfStartOfYielding},
new StressStrainPair() { Stress = absoluteProperty.BaseStrength, Strain = absoluteProperty.StrainOfEndOfYielding},
new StressStrainPair() { Stress = absoluteProperty.StressOfUltimateStrength, Strain = absoluteProperty.StrainOfUltimateStrength},
new StressStrainPair() { Stress = absoluteProperty.StressOfFracture, Strain = absoluteProperty.StrainOfFracture},
};
var multiDiagram = new MultiLinearStressStrainDiagram(stressStrainPairs);
return multiDiagram;
}
public void GetStrength()
{
double baseStength = Options.MaterialEntity.MainStrength;
var factors = factorLogic.GetTotalFactor(Options.LimitState, Options.CalcTerm);
double compressionFactor = 1d;
double tensionFactor = 1d;
compressionFactor *= factors.Compressive;
tensionFactor *= factors.Tensile;
double factor;
if (Options.LimitState == Infrastructures.Enums.LimitStates.ULS)
{
factor = safetyFactorForULS;
}
else if (Options.LimitState == Infrastructures.Enums.LimitStates.SLS)
{
factor = safetyFactorforSLS;
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(Options.LimitState));
}
double strength = baseStength / factor;
compressionStrength = strength * compressionFactor;
tensionStrength = strength * tensionFactor;
}
}
}

View File

@@ -0,0 +1,54 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public class SteelRelativeToAbsoluteDiagramConvertLogic : IObjectConvertStrategy<ISteelDiagramAbsoluteProperty, ISteelDiagramRelativeProperty>
{
private readonly double initialYoungsModulus;
private readonly double baseStrength;
/// <summary>
/// Converts relatives properties of diagram of steel to absolute one
/// </summary>
/// <param name="initialYoungsModulus">Initial modulus of elasticity (Young's modulus), Pa</param>
/// <param name="baseStrength">Stress of yelding, Pa</param>
public SteelRelativeToAbsoluteDiagramConvertLogic(double initialYoungsModulus, double baseStrength)
{
this.initialYoungsModulus = initialYoungsModulus;
this.baseStrength = baseStrength;
}
public ISteelDiagramAbsoluteProperty Convert(ISteelDiagramRelativeProperty source)
{
CheckInputData(source);
double absoluteYieldingStrain = baseStrength / initialYoungsModulus;
SteelDiagramAbsoluteProperty result = new()
{
InitialYoungsModulus = initialYoungsModulus,
BaseStrength = baseStrength,
StressOfProportionality = baseStrength * source.StrainOfProportionality,
StrainOfProportionality = absoluteYieldingStrain * source.StrainOfProportionality,
StrainOfStartOfYielding = absoluteYieldingStrain * source.StrainOfStartOfYielding,
StrainOfEndOfYielding = absoluteYieldingStrain * source.StrainOfEndOfYielding,
StrainOfUltimateStrength = absoluteYieldingStrain * source.StrainOfUltimateStrength,
StrainOfFracture = absoluteYieldingStrain * source.StrainOfFracture,
StressOfUltimateStrength = baseStrength * source.StressOfUltimateStrength,
StressOfFracture = baseStrength * source.StressOfFracture,
};
return result;
}
private void CheckInputData(ISteelDiagramRelativeProperty source)
{
if (initialYoungsModulus <= 0.0)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Initial modulus is not correct, it must be positive, but was {initialYoungsModulus}");
}
if (baseStrength < 0.0)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Stress of yelding is not correct, it must be positive, but was {baseStrength}");
}
}
}
}