Add steel material saving

This commit is contained in:
Evgeny Redikultsev
2025-12-20 21:32:02 +05:00
parent 68b15682bb
commit 7e82e5ee9d
47 changed files with 1160 additions and 381 deletions

View File

@@ -35,6 +35,12 @@ namespace StructureHelperCommon.Models.Materials
DiagramType = DiagramType.Curve
},
new SteelMaterialBuilderLogic(new Guid("C3BE4B92-DC61-43CF-A632-ADFC1AA57D8F"))
{
MaterialType = MaterialTypes.Steel,
Name="Bilinear",
DiagramType = DiagramType.Bilinear
},
new SteelMaterialBuilderLogic(new Guid("7D6F9280-4DDF-43CE-8FBB-56FAE26BDA75"))
{
MaterialType = MaterialTypes.Steel,
Name="Triplelinear",

View File

@@ -0,0 +1,26 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries.Factories
{
public enum SteelFactorTypes
{
WorkCondition = 0,
}
public class SteelFactorsFactory
{
public static IMaterialSafetyFactor GetFactor(SteelFactorTypes factorType)
{
if (factorType == SteelFactorTypes.WorkCondition) { return WorkCondition(); }
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
}
private static IMaterialSafetyFactor WorkCondition()
{
throw new NotImplementedException();
}
}
}

View File

@@ -15,6 +15,10 @@ namespace StructureHelperCommon.Models.Materials.Libraries
/// </summary>
double BaseStrength { get; set; }
/// <summary>
/// Strain of start of yielding under bilinear diagram
/// </summary>
double BaseStrain { get; set; }
/// <summary>
/// Stress at point of limit of proportionality, Pa
/// </summary>
double StressOfProportionality { get; set; }

View File

@@ -4,8 +4,12 @@ using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
internal interface ISteelMaterialLogicOption : IMaterialLogicOptions
public interface ISteelMaterialLogicOption : IMaterialLogicOptions
{
double MaxPlasticStrainRatio { get; set; }
double UlsFactor { get; set; }
double SlsFactor { get; set; }
double ThicknessFactor { get; set; }
double WorkConditionFactor { get; set; }
}
}

View File

@@ -4,6 +4,7 @@ using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Materials.Libraries.Logics;
using System;
using System.Collections.Generic;
@@ -11,9 +12,9 @@ namespace StructureHelperCommon.Models.Materials.Libraries
{
public class SteelMaterialBuilderLogic : IMaterialLogic
{
private const double safetyFactorForULS = 1.05;
private const double safetyFactorforSLS = 1.0;
private ISteelMaterialLogicOption option;
private ICheckEntityLogic<ISteelMaterialLogicOption> checkEntityLogic;
private ICheckEntityLogic<ISteelMaterialLogicOption> CheckEntityLogic => checkEntityLogic ??= new SteelMaterialLogicOptionCheckStrategy() { Entity = option};
IObjectConvertStrategy<ISteelDiagramAbsoluteProperty, ISteelDiagramRelativeProperty> convertStrategy;
private IMaterialFactorLogic factorLogic;
private double compressionStrength;
@@ -33,23 +34,29 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public IMaterial GetLoaderMaterial()
{
option = Options as ISteelMaterialLogicOption;
if (DiagramType == DiagramType.TripleLinear)
CheckOptions();
factorLogic = new MaterialFactorLogic(Options.SafetyFactors);
GetStrength();
Material material = new()
{
factorLogic = new MaterialFactorLogic(Options.SafetyFactors);
GetStrength();
Material material = new()
{
InitModulus = option.MaterialEntity.InitialModulus,
Diagram = GetDiagram(),
LimitPositiveStrain = GetMaxStrain(tensionStrength),
LimitNegativeStrain = -GetMaxStrain(compressionStrength),
};
return material;
InitModulus = option.MaterialEntity.InitialModulus,
Diagram = GetDiagram(),
LimitPositiveStrain = GetMaxStrain(tensionStrength),
LimitNegativeStrain = -GetMaxStrain(compressionStrength),
};
return material;
}
private void CheckOptions()
{
if (Options is not ISteelMaterialLogicOption steelOption)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(Options));
}
else
option = steelOption;
if (CheckEntityLogic.Check() == false)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(DiagramType));
throw new StructureHelperException("Option is not correct: \n" + CheckEntityLogic.CheckResult);
}
}
@@ -62,18 +69,61 @@ namespace StructureHelperCommon.Models.Materials.Libraries
private Func<double, double> GetDiagram()
{
MultiLinearStressStrainDiagram compressionDiagram = GetMultiLinearDiagram(compressionStrength);
MultiLinearStressStrainDiagram tensionDiagram = GetMultiLinearDiagram(tensionStrength);
IDiagram compressionDiagram = GetDiagram(compressionStrength);
IDiagram tensionDiagram = GetDiagram(tensionStrength);
var posNegDiagram = new PosNegDigramDecorator(tensionDiagram, compressionDiagram);
return posNegDiagram.GetStressByStrain;
}
private IDiagram GetDiagram(double strength)
{
if (strength == 0.0)
{
ConstantValueDiagram diagram = new() { ConstantValue = 0.0 };
return diagram;
}
MultiLinearStressStrainDiagram multiDiagram = GetMultiLinearDiagram(strength);
return multiDiagram;
}
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()
List<IStressStrainPair> stressStrainPairs;
if (DiagramType == DiagramType.Bilinear)
{
stressStrainPairs = GetBiLinearStressStrainPairs(absoluteProperty);
}
else if (DiagramType == DiagramType.TripleLinear)
{
stressStrainPairs = GetTripleLinearStressStrainPairs(absoluteProperty);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(DiagramType));
}
var multiDiagram = new MultiLinearStressStrainDiagram(stressStrainPairs);
return multiDiagram;
}
private static List<IStressStrainPair> GetBiLinearStressStrainPairs(ISteelDiagramAbsoluteProperty absoluteProperty)
{
return new()
{
new StressStrainPair() { Stress = 0, Strain = 0},
new StressStrainPair() { Stress = absoluteProperty.BaseStrength, Strain = absoluteProperty.BaseStrain},
new StressStrainPair() { Stress = absoluteProperty.BaseStrength, Strain = absoluteProperty.StrainOfEndOfYielding},
new StressStrainPair() { Stress = absoluteProperty.StressOfUltimateStrength, Strain = absoluteProperty.StrainOfUltimateStrength},
new StressStrainPair() { Stress = absoluteProperty.StressOfFracture, Strain = absoluteProperty.StrainOfFracture},
};
}
private static List<IStressStrainPair> GetTripleLinearStressStrainPairs(ISteelDiagramAbsoluteProperty absoluteProperty)
{
return new()
{
new StressStrainPair() { Stress = 0, Strain = 0},
new StressStrainPair() { Stress = absoluteProperty.StressOfProportionality, Strain = absoluteProperty.StrainOfProportionality},
@@ -83,8 +133,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
new StressStrainPair() { Stress = absoluteProperty.StressOfFracture, Strain = absoluteProperty.StrainOfFracture},
};
var multiDiagram = new MultiLinearStressStrainDiagram(stressStrainPairs);
return multiDiagram;
}
public void GetStrength()
@@ -98,17 +146,17 @@ namespace StructureHelperCommon.Models.Materials.Libraries
double factor;
if (Options.LimitState == Infrastructures.Enums.LimitStates.ULS)
{
factor = safetyFactorForULS;
factor = option.UlsFactor;
}
else if (Options.LimitState == Infrastructures.Enums.LimitStates.SLS)
{
factor = safetyFactorforSLS;
factor = option.SlsFactor;
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(Options.LimitState));
}
double strength = baseStength / factor;
double strength = baseStength * option.ThicknessFactor * option.WorkConditionFactor / factor;
compressionStrength = strength * compressionFactor;
tensionStrength = strength * tensionFactor;
}

View File

@@ -0,0 +1,46 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries.Logics
{
public class SteelMaterialLogicOptionCheckStrategy : CheckEntityLogic<ISteelMaterialLogicOption>
{
public override bool Check()
{
bool result = true;
if (Entity is null)
{
throw new StructureHelperNullReferenceException("Option is null");
}
if (Entity.SafetyFactors is null)
{
TraceMessage("Option safety factors collection is null");
result = false;
}
if (Entity.ThicknessFactor < 0 )
{
TraceMessage("Option thickness factor is null");
result = false;
}
if (Entity.WorkConditionFactor < 0)
{
TraceMessage("Option work condition factor is null");
result = false;
}
if (Entity.UlsFactor < 0)
{
TraceMessage("Option ULS factor is null");
result = false;
}
if (Entity.SlsFactor < 0)
{
TraceMessage("Option SLS factor is null");
result = false;
}
return result;
}
}
}

View File

@@ -27,6 +27,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
{
InitialYoungsModulus = initialYoungsModulus,
BaseStrength = baseStrength,
BaseStrain = absoluteYieldingStrain,
StressOfProportionality = baseStrength * source.StrainOfProportionality,
StrainOfProportionality = absoluteYieldingStrain * source.StrainOfProportionality,
StrainOfStartOfYielding = absoluteYieldingStrain * source.StrainOfStartOfYielding,

View File

@@ -27,5 +27,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public double StressOfUltimateStrength { get; set; }
/// <inheritdoc/>
public double StressOfFracture { get; set; }
public double BaseStrain { get; set; }
}
}

View File

@@ -14,5 +14,9 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public bool WorkInCompression { get; set; } = true;
public bool WorkInTension { get; set; } = true;
public double MaxPlasticStrainRatio { get; set; }
public double UlsFactor { get; set; }
public double SlsFactor { get; set; }
public double ThicknessFactor { get; set; }
public double WorkConditionFactor { get; set; }
}
}