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

@@ -8,10 +8,11 @@ namespace StructureHelper.Infrastructure.Enums
{
internal enum MaterialType
{
Concrete,
Reinforcement,
Elastic,
CarbonFiber,
GlassFiber
Concrete = 0,
Reinforcement = 1,
Elastic = 2,
CarbonFiber = 3,
GlassFiber = 4,
Steel = 5
}
}

View File

@@ -163,4 +163,12 @@
</Grid>
</DataTemplate>
<DataTemplate x:Key="SteelMaterial">
<StackPanel>
<ContentControl ContentTemplate="{StaticResource LibraryMaterial}" Content="{Binding}"/>
<Button Content="Show Safety Factors" Command="{Binding ShowSafetyFactors}"/>
<ContentControl ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding SafetyFactors}"/>
</StackPanel>
</DataTemplate>
</ResourceDictionary>

View File

@@ -244,6 +244,11 @@
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RFMaterial32.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Steel" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Steel}">
<MenuItem.Icon>
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RFMaterial32.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Elastic" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}">
<MenuItem.Icon>
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/ElasticMaterial32.png" />

View File

@@ -5,17 +5,9 @@ using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace StructureHelper.Windows.MainWindow.Materials
{
@@ -70,6 +62,10 @@ namespace StructureHelper.Windows.MainWindow.Materials
{
SetElasticMaterial();
}
else if (helperMaterial is ISteelLibMaterial)
{
SetSteelMaterial();
}
else
{
string errorString = ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(IHelperMaterial)}, but was: {helperMaterial.GetType()}";
@@ -77,6 +73,16 @@ namespace StructureHelper.Windows.MainWindow.Materials
}
}
private void SetSteelMaterial()
{
templateName = "SteelMaterial";
var binding = new Binding
{
Source = viewModel.HelperMaterialViewModel
};
bindings.Add(templateName, binding);
}
private void SetContentControls()
{
foreach (var item in bindings)

View File

@@ -73,6 +73,10 @@ namespace StructureHelper.Windows.ViewModels.Materials
{
helperMaterialViewModel = new LibMaterialViewModel<IReinforcementMaterialEntity>(reinforcementMaterial);
}
else if (helperMaterial is ISteelLibMaterial steelMaterial)
{
helperMaterialViewModel = new LibMaterialViewModel<ISteelMaterialEntity>(steelMaterial);
}
else if (helperMaterial is IElasticMaterial elasticMaterial)
{
if (helperMaterial is IFRMaterial fRMaterial)

View File

@@ -7,6 +7,7 @@ using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Linq;
using System.Windows.Forms;
using System.Windows.Input;
@@ -47,9 +48,18 @@ namespace StructureHelper.Windows.ViewModels.Materials
else if (parameterType == MaterialType.Elastic) { AddElastic(); }
else if (parameterType == MaterialType.CarbonFiber) { AddCarbonFiber(); }
else if (parameterType == MaterialType.GlassFiber) { AddGlassFiber(); }
else if (parameterType == MaterialType.Steel) { AddSteel(); }
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(MaterialType)}, Actual type: {nameof(parameterType)}");
base.AddMethod(parameter);
}
private void AddSteel()
{
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.SteelS345);
material.Name = "New Steel";
NewItem = material;
}
public override void DeleteMethod(object parameter)
{
var primitives = repository.Primitives;

View File

@@ -5,5 +5,6 @@
SP63_2018,
EuroCode_2_1990,
SP164_2014,
SP16_2017
}
}

View File

@@ -1,9 +1,6 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Codes.Factories
{
@@ -48,6 +45,12 @@ namespace StructureHelperCommon.Models.Codes.Factories
FullName = "Reinforced steel low-relaxation 7-wire strands. Specifications"
};
codeEntities.Add(codeEntity);
codeEntity = new CodeEntity(new Guid("2A43EDEC-8B1B-4B0B-B2E1-B7507518B8E7"), natSystem)
{
Name = "GOST 27772-2021",
FullName = "Rolled products for structural steel constructions.General specifications"
};
codeEntities.Add(codeEntity);
return (codeEntities, codeRevisions);
}

View File

@@ -1,10 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Codes
{

View File

@@ -1,6 +1,7 @@
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -33,6 +34,12 @@ namespace StructureHelperCommon.Models.Materials
Name = "Curve",
DiagramType = DiagramType.Curve
},
new SteelMaterialBuilderLogic(new Guid("C3BE4B92-DC61-43CF-A632-ADFC1AA57D8F"))
{
MaterialType = MaterialTypes.Steel,
Name="Triplelinear",
DiagramType = DiagramType.TripleLinear
},
};
return items;
}

View File

@@ -1,10 +1,6 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials
{

View File

@@ -11,16 +11,11 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public ICodeEntity Code { get; set; }
public string Name { get; set; }
public double MainStrength { get; set; }
public double InitModulus { get; set; }
public double InitialModulus { get; set; }
public ConcreteMaterialEntity(Guid id)
{
Id = id;
}
public void Save()
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,10 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries
{

View File

@@ -17,6 +17,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
{
libMaterials.AddRange(GetConcreteSP63());
libMaterials.AddRange(GetReinforcementSP63());
libMaterials.AddRange(GetSteelSP16());
}
else if (ProgramSetting.NatSystem == NatSystems.EU)
{
@@ -30,6 +31,97 @@ namespace StructureHelperCommon.Models.Materials.Libraries
return libMaterials;
}
private static IEnumerable<ILibMaterialEntity> GetSteelSP16()
{
var codeType = CodeTypes.SP16_2017;
List<ILibMaterialEntity> libMaterials = new List<ILibMaterialEntity>();
libMaterials.AddRange(AddGOST2772(codeType));
return libMaterials;
}
private static IEnumerable<ILibMaterialEntity> AddGOST2772(CodeTypes codeType)
{
var code = ProgramSetting.CodesList
.Where(x => x.Name == "GOST 27772-2021")
.Single();
List<ILibMaterialEntity> range = new List<ILibMaterialEntity>()
{
new SteelMaterialEntity(new Guid("14F7EEA1-E924-42A1-928A-076BC8EE34A8"))
{
CodeType = codeType,
Code = code,
Name = "S245",
PropertyType = SteelDiagramPropertyType.S245,
InitialModulus = 2.06e11d,
MainStrength = 245e6
},
new SteelMaterialEntity(new Guid("69142AEF-BCC4-409A-8BAD-90390143516E"))
{
CodeType = codeType,
Code = code,
Name = "S255",
PropertyType = SteelDiagramPropertyType.S245,
InitialModulus = 2.06e11d,
MainStrength = 255e6
},
new SteelMaterialEntity(new Guid("BAD0A2B6-CF02-4554-891D-BB34FC3B2430"))
{
CodeType = codeType,
Code = code,
Name = "S345",
PropertyType = SteelDiagramPropertyType.S345,
InitialModulus = 2.0e11d,
MainStrength = 345e6
},
new SteelMaterialEntity(new Guid("C97AE177-872B-4B77-BCF6-6519AAAE1D54"))
{
CodeType = codeType,
Code = code,
Name = "S355",
PropertyType = SteelDiagramPropertyType.S345,
InitialModulus = 2.0e11d,
MainStrength = 355e6
},
new SteelMaterialEntity(new Guid("73700688-08BA-4A35-8BE0-26CD971FE73F"))
{
CodeType = codeType,
Code = code,
Name = "S390",
PropertyType = SteelDiagramPropertyType.S390,
InitialModulus = 2.0e11d,
MainStrength = 390e6
},
new SteelMaterialEntity(new Guid("39C0A796-9031-444C-BD3A-FFB236C9C85C"))
{
CodeType = codeType,
Code = code,
Name = "S440",
PropertyType = SteelDiagramPropertyType.S440,
InitialModulus = 2.0e11d,
MainStrength = 440e6
},
new SteelMaterialEntity(new Guid("7EF0525A-9965-4C8E-B15B-F7BE493382D0"))
{
CodeType = codeType,
Code = code,
Name = "S550",
PropertyType = SteelDiagramPropertyType.S550,
InitialModulus = 2.0e11d,
MainStrength = 550e6
},
new SteelMaterialEntity(new Guid("C3BE4B92-DC61-43CF-A632-ADFC1AA57D8F"))
{
CodeType = codeType,
Code = code,
Name = "S590",
PropertyType = SteelDiagramPropertyType.S550,
InitialModulus = 2.0e11d,
MainStrength = 590e6
},
};
return range;
}
private static IEnumerable<ILibMaterialEntity> GetConcreteEurocode()
{
ICodeEntity code = ProgramSetting.CodesList.Where(x => x.Name == "EuroCode2-1990").Single();
@@ -260,7 +352,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "A240",
InitModulus = 2e11d,
InitialModulus = 2e11d,
MainStrength = 240e6d
},
new ReinforcementMaterialEntity(new Guid("ea422282-3465-433c-9b93-c5bbfba5a904"))
@@ -268,7 +360,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "A400",
InitModulus = 2e11d,
InitialModulus = 2e11d,
MainStrength = 390e6d
},
new ReinforcementMaterialEntity(new Guid("045b54b1-0bbf-41fd-a27d-aeb20f600bb4"))
@@ -276,7 +368,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "A500",
InitModulus = 2e11d,
InitialModulus = 2e11d,
MainStrength = 500e6d
},
new ReinforcementMaterialEntity(new Guid("e3cfc6fb-fbd0-47dd-ab4a-79c030704acf"))
@@ -284,7 +376,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "A600",
InitModulus = 2e11d,
InitialModulus = 2e11d,
MainStrength = 600e6d
},
new ReinforcementMaterialEntity(new Guid("6f0882ef-53bf-464e-acf7-da421a43a825"))
@@ -292,7 +384,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "A800",
InitModulus = 2e11d,
InitialModulus = 2e11d,
MainStrength = 800e6d
},
new ReinforcementMaterialEntity(new Guid("509fbaae-a3de-43c2-aae6-33387908dc43"))
@@ -300,7 +392,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "A1000",
InitModulus = 2e11d,
InitialModulus = 2e11d,
MainStrength = 1000e6d
}
};
@@ -318,7 +410,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "K1400/1670",
InitModulus = 1.95e11d,
InitialModulus = 1.95e11d,
MainStrength = 1400e6
},
new ReinforcementMaterialEntity(new Guid("93c48a27-ab37-4bd2-aeb8-2a7247e74a1b"))
@@ -326,7 +418,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "K1500/1770",
InitModulus = 1.95e11d,
InitialModulus = 1.95e11d,
MainStrength = 1500e6
},
new ReinforcementMaterialEntity(new Guid("6e0df35e-4839-4cf1-9182-c7ad7f81a548"))
@@ -334,7 +426,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "K1600/1860",
InitModulus = 1.95e11d,
InitialModulus = 1.95e11d,
MainStrength = 1600e6
},
new ReinforcementMaterialEntity(new Guid("29d7ef1b-bd30-471e-af0e-8b419eb9f043"))
@@ -342,7 +434,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "K1700/1960",
InitModulus = 1.95e11d,
InitialModulus = 1.95e11d,
MainStrength = 1700e6
},
new ReinforcementMaterialEntity(new Guid("494b959f-0194-4f02-9dcf-ff313c5e352b"))
@@ -350,7 +442,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "K1800/2060",
InitModulus = 1.95e11d,
InitialModulus = 1.95e11d,
MainStrength = 1800e6
},
new ReinforcementMaterialEntity(new Guid("02031332-fe1e-456d-b339-143eb9ca8293"))
@@ -358,7 +450,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
CodeType = codeType,
Code = code,
Name = "K1900/2160",
InitModulus = 1.95e11d,
InitialModulus = 1.95e11d,
MainStrength = 1900e6
}
};

View File

@@ -0,0 +1,97 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Forces.Logics;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public enum SteelDiagramPropertyType
{
S245 = 0, //S245, S255
S345 = 1, //S345, S345K, S355, S355-1, S355-P
S390 = 2, //S390, S390-1
S440 = 3, //S440
S550 = 4, //S550, S590
}
public static class SteelDiagramPropertyFactory
{
public static ISteelDiagramRelativeProperty GetProperty(SteelDiagramPropertyType type)
{
if (type == SteelDiagramPropertyType.S245)
{
SteelDiagramRelativeProperty property = new()
{
StrainOfProportionality = 0.8,
StrainOfStartOfYielding = 1.7,
StrainOfEndOfYielding = 14.0,
StrainOfUltimateStrength = 141.6,
StrainOfFracture = 251,
StressOfUltimateStrength = 1.653,
StressOfFracture = 1.35
};
return property;
}
else if (type == SteelDiagramPropertyType.S345)
{
SteelDiagramRelativeProperty property = new()
{
StrainOfProportionality = 0.8,
StrainOfStartOfYielding = 1.7,
StrainOfEndOfYielding = 16.0,
StrainOfUltimateStrength = 88.3,
StrainOfFracture = 153,
StressOfUltimateStrength = 1.415,
StressOfFracture = 1.26
};
return property;
}
else if (type == SteelDiagramPropertyType.S390)
{
SteelDiagramRelativeProperty property = new()
{
StrainOfProportionality = 0.9,
StrainOfStartOfYielding = 1.7,
StrainOfEndOfYielding = 17.0,
StrainOfUltimateStrength = 67.1,
StrainOfFracture = 115,
StressOfUltimateStrength = 1.345,
StressOfFracture = 1.23
};
return property;
}
else if (type == SteelDiagramPropertyType.S440)
{
SteelDiagramRelativeProperty property = new()
{
StrainOfProportionality = 0.9,
StrainOfStartOfYielding = 1.7,
StrainOfEndOfYielding = 17.0,
StrainOfUltimateStrength = 49.6,
StrainOfFracture = 87.2,
StressOfUltimateStrength = 1.33,
StressOfFracture = 1.20
};
return property;
}
else if (type == SteelDiagramPropertyType.S550)
{
SteelDiagramRelativeProperty property = new()
{
StrainOfProportionality = 0.9,
StrainOfStartOfYielding = 1.7,
StrainOfEndOfYielding = 18.0,
StrainOfUltimateStrength = 26.2,
StrainOfFracture = 51.1,
StressOfUltimateStrength = 1.16,
StressOfFracture = 1.10
};
return property;
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(type));
}
}
}
}

View File

@@ -1,32 +0,0 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Codes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries
{
internal class FiberMaterialEntity : IFiberMaterialEntity
{
///<inheritdoc/>
public Guid Id { get; }
public CodeTypes CodeType { get; }
public ICodeEntity Code { get; set; }
public string Name { get; }
///<inheritdoc/>
public double InitModulus { get; set; }
///<inheritdoc/>
public double MainStrength { get; }
public FiberMaterialEntity(Guid id)
{
Id = id;
Name = "";
}
public void Save()
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public interface IFiberMaterialEntity : ILibMaterialEntity
{
/// <summary>
/// Modulus of elasticity, Pa
/// </summary>
double InitModulus { get; set; }
}
}

View File

@@ -12,7 +12,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
/// <summary>
/// Initial Young's Modulus, Pa
/// </summary>
double InitModulus { get; set; }
double InitialModulus { get; set; }
/// <summary>
/// Strength of material, Pa
/// </summary>

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public interface ISteelDiagramAbsoluteProperty : ISteelDiagramProperty
{
/// <summary>
/// Initial modulus of elasticity (Young's modulus), Pa
/// </summary>
double InitialYoungsModulus { get; set; }
/// <summary>
/// Stress of yelding, Pa
/// </summary>
double BaseStrength { get; set; }
/// <summary>
/// Stress at point of limit of proportionality, Pa
/// </summary>
double StressOfProportionality { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
namespace StructureHelperCommon.Models.Materials.Libraries
{
public interface ISteelDiagramProperty
{
/// <summary>
/// Limit strain of proportionality, dimensionless
/// </summary>
double StrainOfProportionality { get; set; }
/// <summary>
/// Strain at point of start of yelding, dimensionless
/// </summary>
double StrainOfStartOfYielding { get; set; }
/// <summary>
/// Strain at point of end of yelding, dimensionless
/// </summary>
double StrainOfEndOfYielding { get; set; }
/// <summary>
/// Strain at point of ultimate strength, dimensionless
/// </summary>
double StrainOfUltimateStrength { get; set; }
/// <summary>
/// Strain at point of fracture
/// </summary>
double StrainOfFracture { get; set; }
/// <summary>
/// Stress at point of ultimate strength, Pa for absolute value, dimensionless for relative value
/// </summary>
double StressOfUltimateStrength { get; set; }
/// <summary>
/// Stress at point of fracture, Pa for absolute value, dimensionless for relative value
/// </summary>
double StressOfFracture { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public interface ISteelDiagramRelativeProperty
{
double StrainOfProportionality { get; set; }
double StrainOfStartOfYielding { get; set; }
double StrainOfEndOfYielding { get; set; }
double StrainOfUltimateStrength { get; set; }
double StressOfUltimateStrength { get; set; }
double StrainOfFracture { get; set; }
double StressOfFracture { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public interface ISteelMaterialEntity : ILibMaterialEntity
{
SteelDiagramPropertyType PropertyType { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
internal interface ISteelMaterialLogicOption : IMaterialLogicOptions
{
double MaxPlasticStrainRatio { get; set; }
}
}

View File

@@ -36,5 +36,15 @@ namespace StructureHelperCommon.Models.Materials.Libraries
.ToList();
return repository;
}
public static List<ILibMaterialEntity> GetSteelRepository()
{
var natCodes = ProgramSetting.CodesList;
var rep = GetRepository();
var repository = rep
.Where(x => natCodes.Contains(x.Code) & x is ISteelMaterialEntity)
.ToList();
return repository;
}
}
}

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}");
}
}
}
}

View File

@@ -11,7 +11,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
public ICodeEntity Code { get; set; }
public string Name { get; set; }
public double MainStrength { get; set; }
public double InitModulus { get; set; }
public double InitialModulus { get; set; }
public ReinforcementMaterialEntity(Guid id)
{

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
/// <inheritdoc/>
public class SteelDiagramAbsoluteProperty : ISteelDiagramAbsoluteProperty
{
/// <inheritdoc/>
public double InitialYoungsModulus { get; set; }
/// <inheritdoc/>
public double BaseStrength { get; set; }
/// <inheritdoc/>
public double StrainOfProportionality { get; set; }
/// <inheritdoc/>
public double StrainOfStartOfYielding { get; set; }
/// <inheritdoc/>
public double StrainOfEndOfYielding { get; set; }
/// <inheritdoc/>
public double StrainOfUltimateStrength { get; set; }
/// <inheritdoc/>
public double StrainOfFracture { get; set; }
/// <inheritdoc/>
public double StressOfProportionality { get; set; }
/// <inheritdoc/>
public double StressOfUltimateStrength { get; set; }
/// <inheritdoc/>
public double StressOfFracture { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public class SteelDiagramRelativeProperty : ISteelDiagramRelativeProperty
{
public double StrainOfProportionality { get; set; }
public double StrainOfStartOfYielding { get; set; }
public double StrainOfEndOfYielding { get; set; }
public double StrainOfUltimateStrength { get; set; }
public double StressOfUltimateStrength { get; set; }
public double StrainOfFracture { get; set; }
public double StressOfFracture { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Codes;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public class SteelMaterialEntity : ISteelMaterialEntity
{
public Guid Id { get; }
public CodeTypes CodeType { get; set; }
public SteelDiagramPropertyType PropertyType { get; set; }
public ICodeEntity Code { get; set; }
public string Name { get; set; } = string.Empty;
public double InitialModulus { get; set; }
public double MainStrength { get; set; }
public SteelMaterialEntity(Guid id)
{
Id = id;
}
}
}

View File

@@ -0,0 +1,18 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials.Libraries
{
public class SteelMaterialLogicOption : ISteelMaterialLogicOption
{
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
public ILibMaterialEntity MaterialEntity { get; set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public bool WorkInCompression { get; set; } = true;
public bool WorkInTension { get; set; } = true;
public double MaxPlasticStrainRatio { get; set; }
}
}

View File

@@ -19,7 +19,7 @@ namespace StructureHelperCommon.Models.Materials
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
{
materialOptions.InitModulus = options.MaterialEntity.InitModulus;
materialOptions.InitModulus = options.MaterialEntity.InitialModulus;
materialOptions.Strength = options.MaterialEntity.MainStrength;
ProcessCodeType(materialOptions);
ProcessLimitState(materialOptions);

View File

@@ -0,0 +1,18 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperCommon.Models.Materials
{
public class MaterialLogicOption : IMaterialLogicOptions
{
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
public ILibMaterialEntity MaterialEntity { get; set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public bool WorkInCompression { get; set; } = true;
public bool WorkInTension { get; set; } = true;
}
}

View File

@@ -1,7 +1,6 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services;
using System;

View File

@@ -7,12 +7,14 @@ namespace StructureHelperLogics.Models.Materials
{
public enum HeadmaterialType
{
Concrete40,
Reinforcement400,
Reinforcement500,
Elastic200,
Carbon1400,
Glass1200
Concrete40 = 0,
Reinforcement400 = 1,
Reinforcement500 = 2,
Elastic200 = 3,
Carbon1400 = 4,
Glass1200 = 5,
SteelS245 = 6,
SteelS345 = 7,
}
public static class HeadMaterialFactory
@@ -20,23 +22,46 @@ namespace StructureHelperLogics.Models.Materials
private static CodeTypes codeType;
private static IEnumerable<ILibMaterialEntity> LibConcreteMaterials => LibMaterialPepository.GetConcreteRepository();
private static IEnumerable<ILibMaterialEntity> LibReinforcementMaterials => LibMaterialPepository.GetReinforcementRepository();
private static IEnumerable<ILibMaterialEntity> LibSteelMaterials => LibMaterialPepository.GetSteelRepository();
public static IHeadMaterial GetHeadMaterial(HeadmaterialType type)
{
if (type == HeadmaterialType.Concrete40) { return GetConcrete40(); }
if (type == HeadmaterialType.Reinforcement400) { return GetReinforcement400(); }
if (type == HeadmaterialType.Reinforcement500) { return GetReinforcement500(); }
if (type == HeadmaterialType.Elastic200) { return GetElastic200(); }
if (type == HeadmaterialType.Carbon1400) { return GetCarbon1400(); }
if (type == HeadmaterialType.Glass1200) { return GetGlass1200(); }
else if (type == HeadmaterialType.Reinforcement400) { return GetReinforcement400(); }
else if (type == HeadmaterialType.Reinforcement500) { return GetReinforcement500(); }
else if (type == HeadmaterialType.Elastic200) { return GetElastic200(); }
else if (type == HeadmaterialType.Carbon1400) { return GetCarbon1400(); }
else if (type == HeadmaterialType.Glass1200) { return GetGlass1200(); }
else if (type == HeadmaterialType.SteelS245) { return GetSteelS245(); }
else if (type == HeadmaterialType.SteelS345) { return GetSteelS345(); }
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(type));
}
private static IHeadMaterial GetSteelS245()
{
var material = new HeadMaterial() { Name = "New steel" };
var libMaterial = LibSteelMaterials.Where(x => x.Name.Contains("245")).First();
var libMat = new SteelLibMaterial(Guid.NewGuid());
libMat.MaterialEntity = libMaterial;
material.HelperMaterial = libMat;
return material;
}
private static IHeadMaterial GetSteelS345()
{
var material = new HeadMaterial() { Name = "New steel" };
var libMaterial = LibSteelMaterials.Where(x => x.Name.Contains("345")).First();
var libMat = new SteelLibMaterial(Guid.NewGuid());
libMat.MaterialEntity = libMaterial;
material.HelperMaterial = libMat;
return material;
}
private static IHeadMaterial GetReinforcement500()
{
var material = new HeadMaterial() { Name = "New reinforcement" };
var libMaterial = LibReinforcementMaterials.Where(x => x.Name.Contains("500")).First();
var libMat = new ReinforcementLibMaterial();
var libMat = new ReinforcementLibMaterial(Guid.NewGuid());
libMat.MaterialEntity = libMaterial;
material.HelperMaterial = libMat;
return material;
@@ -77,7 +102,7 @@ namespace StructureHelperLogics.Models.Materials
{
var material = new HeadMaterial() { Name = "New reinforcement" };
var libMaterial = LibReinforcementMaterials.Where(x => x.Name.Contains("400")).First();
var libMat = new ReinforcementLibMaterial();
var libMat = new ReinforcementLibMaterial(Guid.NewGuid());
libMat.MaterialEntity = libMaterial;
material.HelperMaterial = libMat;
return material;

View File

@@ -0,0 +1,12 @@
using StructureHelperCommon.Models.Materials;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Materials
{
public interface ISteelLibMaterial : ILibMaterial
{
double MaxPlasticStrainRatio { get; set; }
}
}

View File

@@ -7,11 +7,12 @@ namespace StructureHelperLogics.Models.Materials
public class ConcreteLibUpdateStrategy : IUpdateStrategy<IConcreteLibMaterial>
{
private IUpdateStrategy<ILibMaterial> libUpdateStrategy;
private IUpdateStrategy<ILibMaterial> LibUpdateStrategy => libUpdateStrategy ??= new LibMaterialUpdateStrategy();
public ConcreteLibUpdateStrategy(IUpdateStrategy<ILibMaterial> libUpdateStrategy)
{
this.libUpdateStrategy = libUpdateStrategy;
}
public ConcreteLibUpdateStrategy() : this(new LibMaterialUpdateStrategy())
public ConcreteLibUpdateStrategy()
{
}
@@ -20,7 +21,7 @@ namespace StructureHelperLogics.Models.Materials
CheckObject.ThrowIfNull(sourceObject);
CheckObject.ThrowIfNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
libUpdateStrategy.Update(targetObject, sourceObject);
LibUpdateStrategy.Update(targetObject, sourceObject);
targetObject.TensionForULS = sourceObject.TensionForULS;
targetObject.TensionForSLS = sourceObject.TensionForSLS;
targetObject.RelativeHumidity = sourceObject.RelativeHumidity;

View File

@@ -0,0 +1,63 @@
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.DiagramTemplates;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Security.Policy;
using System.Text;
using System.Windows.Media.TextFormatting;
namespace StructureHelperLogics.Models.Materials.Logics
{
public class GetSteelLoaderMaterialLogic
{
IObjectConvertStrategy<ISteelDiagramAbsoluteProperty, ISteelDiagramRelativeProperty> convertStrategy;
public double InitialModulus { get; set; }
public double CompressionStrength { get; set; }
public double TensionStrength { get; internal set; }
public double MaxPlasticStrainRatio { get; set; }
public ISteelDiagramRelativeProperty DiagramProperty { get; set; }
public IMaterial GetMaterial()
{
double elasticCompressionStrain = CompressionStrength / InitialModulus;
double fullCompressionStrain = elasticCompressionStrain * (1 + MaxPlasticStrainRatio);
Material material = new()
{
Diagram = GetDiagram(),
LimitPositiveStrain = fullCompressionStrain,
LimitNegativeStrain = - fullCompressionStrain,
};
return material;
}
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(InitialModulus, strength);
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;
}
}
}

View File

@@ -14,10 +14,16 @@ namespace StructureHelperLogics.Models.Materials
{
public class HelperMaterialUpdateStrategy : IUpdateStrategy<IHelperMaterial>
{
private IUpdateStrategy<IElasticMaterial> elasticStrategy;
private IUpdateStrategy<IFRMaterial> frStrategy;
private IUpdateStrategy<IConcreteLibMaterial> concreteStrategy;
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy;
private IUpdateStrategy<IElasticMaterial> elasticUpdateStrategy;
private IUpdateStrategy<IFRMaterial> frUpdateStrategy;
private IUpdateStrategy<IConcreteLibMaterial> concreteUpdateStrategy;
private IUpdateStrategy<IReinforcementLibMaterial> reinforcementUpdateStrategy;
private IUpdateStrategy<ISteelLibMaterial> steelUpdateStrategy;
private IUpdateStrategy<IElasticMaterial> ElasticUpdateStrategy => elasticUpdateStrategy ??= new ElasticUpdateStrategy();
private IUpdateStrategy<IFRMaterial> FrUpdateStrategy => frUpdateStrategy ??= new FRUpdateStrategy();
private IUpdateStrategy<IConcreteLibMaterial> ConcreteUpdateStrategy => concreteUpdateStrategy ??= new ConcreteLibUpdateStrategy();
private IUpdateStrategy<IReinforcementLibMaterial> ReinforcementUpdateStrategy => reinforcementUpdateStrategy ??= new ReinforcementLibUpdateStrategy();
private IUpdateStrategy<ISteelLibMaterial> SteelUpdateStrategy => steelUpdateStrategy ??= new SteelLibMaterialUpdateStrategy();
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelpermaterialSafetyFactorsUpdateStrategy();
public HelperMaterialUpdateStrategy(IUpdateStrategy<IElasticMaterial> elasticStrategy,
IUpdateStrategy<IFRMaterial> frStrategy,
@@ -25,17 +31,12 @@ namespace StructureHelperLogics.Models.Materials
IUpdateStrategy<IReinforcementLibMaterial> reinforcementStrategy
)
{
this.elasticStrategy = elasticStrategy;
this.frStrategy = frStrategy;
this.concreteStrategy = concreteStrategy;
this.reinforcementStrategy = reinforcementStrategy;
this.elasticUpdateStrategy = elasticStrategy;
this.frUpdateStrategy = frStrategy;
this.concreteUpdateStrategy = concreteStrategy;
this.reinforcementUpdateStrategy = reinforcementStrategy;
}
public HelperMaterialUpdateStrategy() : this(
new ElasticUpdateStrategy(),
new FRUpdateStrategy(),
new ConcreteLibUpdateStrategy(),
new ReinforcementLibUpdateStrategy()
)
public HelperMaterialUpdateStrategy()
{ }
public void Update(IHelperMaterial targetObject, IHelperMaterial sourceObject)
@@ -50,11 +51,11 @@ namespace StructureHelperLogics.Models.Materials
}
else if (sourceObject is IElasticMaterial)
{
elasticStrategy.Update(targetObject as IElasticMaterial, sourceObject as IElasticMaterial);
ElasticUpdateStrategy.Update(targetObject as IElasticMaterial, sourceObject as IElasticMaterial);
}
else if (sourceObject is IFRMaterial)
{
frStrategy.Update(targetObject as IFRMaterial, sourceObject as IFRMaterial);
FrUpdateStrategy.Update(targetObject as IFRMaterial, sourceObject as IFRMaterial);
}
else
{
@@ -66,11 +67,15 @@ namespace StructureHelperLogics.Models.Materials
{
if (sourceObject is IConcreteLibMaterial concreteLibMaterial)
{
concreteStrategy.Update(targetObject as IConcreteLibMaterial, concreteLibMaterial);
concreteUpdateStrategy.Update(targetObject as IConcreteLibMaterial, concreteLibMaterial);
}
else if (sourceObject is IReinforcementLibMaterial reinforcementLibMaterial)
{
reinforcementStrategy.Update(targetObject as IReinforcementLibMaterial, reinforcementLibMaterial);
ReinforcementUpdateStrategy.Update(targetObject as IReinforcementLibMaterial, reinforcementLibMaterial);
}
else if (sourceObject is ISteelLibMaterial steelLibMaterial)
{
SteelUpdateStrategy.Update(targetObject as ISteelLibMaterial, steelLibMaterial);
}
else
{

View File

@@ -0,0 +1,34 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Materials
{
public class SteelLibMaterialUpdateStrategy : IUpdateStrategy<ISteelLibMaterial>
{
private IUpdateStrategy<ILibMaterial> libUpdateStrategy;
private IUpdateStrategy<ILibMaterial> LibUpdateStrategy => libUpdateStrategy ??= new LibMaterialUpdateStrategy();
public SteelLibMaterialUpdateStrategy(IUpdateStrategy<ILibMaterial> libUpdateStrategy)
{
this.libUpdateStrategy = libUpdateStrategy;
}
public SteelLibMaterialUpdateStrategy()
{
}
public void Update(ISteelLibMaterial targetObject, ISteelLibMaterial sourceObject)
{
CheckObject.ThrowIfNull(sourceObject);
CheckObject.ThrowIfNull(targetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
LibUpdateStrategy.Update(targetObject, sourceObject);
targetObject.MaxPlasticStrainRatio = sourceObject.MaxPlasticStrainRatio;
}
}
}

View File

@@ -1,16 +1,9 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Loadermaterials = LoaderCalculator.Data.Materials;
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Models.Materials;
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
namespace StructureHelperLogics.Models.Materials
{
@@ -24,7 +17,7 @@ namespace StructureHelperLogics.Models.Materials
public Guid Id { get; }
public ILibMaterialEntity MaterialEntity { get; set; }
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = new();
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = [];
public IMaterialLogic MaterialLogic { get; set; }
public List<IMaterialLogic> MaterialLogics => materialLogics;
@@ -36,14 +29,9 @@ namespace StructureHelperLogics.Models.Materials
MaterialLogic = materialLogics.First();
}
public ReinforcementLibMaterial() : this (Guid.NewGuid())
{
}
public object Clone()
{
var newItem = new ReinforcementLibMaterial();
var newItem = new ReinforcementLibMaterial(Guid.NewGuid());
var updateStrategy = new ReinforcementLibUpdateStrategy();
updateStrategy.Update(newItem, this);
return newItem;

View File

@@ -0,0 +1,89 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperLogics.Models.Materials.Logics;
namespace StructureHelperLogics.Models.Materials
{
public class SteelLibMaterial : ISteelLibMaterial
{
const MaterialTypes materialType = MaterialTypes.Steel;
private const double safetyFactorForULS = 1.05;
private const double safetyFactorforSLS = 1.0;
private IMaterialFactorLogic factorLogic => new MaterialFactorLogic(SafetyFactors);
private readonly List<IMaterialLogic> materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
public Guid Id { get; }
public ILibMaterialEntity MaterialEntity { get; set; }
public IMaterialLogic MaterialLogic { get; set; }
public List<IMaterialLogic> MaterialLogics => materialLogics;
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = [];
public double MaxPlasticStrainRatio { get; set; } = 3.0;
public SteelLibMaterial(Guid id)
{
Id = id;
MaterialLogic = materialLogics.First();
}
public object Clone()
{
SteelLibMaterial newItem = new(Guid.NewGuid());
var logic = new SteelLibMaterialUpdateStrategy();
logic.Update(newItem, this);
return newItem;
}
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{
return GetLoaderMaterial(limitState, calcTerm);
}
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{
SteelMaterialLogicOption options = new()
{
MaterialEntity = MaterialEntity,
SafetyFactors = SafetyFactors,
MaxPlasticStrainRatio = MaxPlasticStrainRatio,
LimitState = limitState,
CalcTerm = calcTerm,
};
MaterialLogic.Options = options;
var material = MaterialLogic.GetLoaderMaterial();
return material;
}
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
{
double baseStength = MaterialEntity.MainStrength;
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
double compressionFactor = 1d;
double tensionFactor = 1d;
compressionFactor *= factors.Compressive;
tensionFactor *= factors.Tensile;
double factor;
if (limitState == LimitStates.ULS)
{
factor = safetyFactorForULS;
}
else if (limitState == LimitStates.SLS)
{
factor = safetyFactorforSLS;
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(limitState));
}
double strength = baseStength / factor;
return (strength * compressionFactor, strength * tensionFactor);
}
}
}

View File

@@ -0,0 +1,124 @@
using NUnit.Framework;
using NUnit.Framework.Legacy;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Materials.Libraries;
namespace StructureHelperTests.UnitTests.MaterialTests
{
[TestFixture]
public class SteelRelativeToAbsoluteDiagramConvertLogicTests
{
private const double YoungsModulus = 200e9; // 200 GPa
private const double BaseStrength = 400e6; // 400 MPa
private SteelRelativeToAbsoluteDiagramConvertLogic logic;
[SetUp]
public void SetUp()
{
logic = new SteelRelativeToAbsoluteDiagramConvertLogic(
initialYoungsModulus: YoungsModulus,
baseStrength: BaseStrength);
}
[Test]
public void Convert_ValidRelativeDiagram_ReturnsCorrectAbsoluteDiagram()
{
// Arrange
var source = new SteelDiagramRelativeProperty
{
StrainOfProportionality = 0.5,
StrainOfStartOfYielding = 1.0,
StrainOfEndOfYielding = 1.2,
StrainOfUltimateStrength = 2.0,
StrainOfFracture = 3.0,
StressOfUltimateStrength = 1.1,
StressOfFracture = 0.8
};
double expectedYieldingStrain = BaseStrength / YoungsModulus;
// Act
var result = logic.Convert(source);
// Assert
Assert.That(result.InitialYoungsModulus, Is.EqualTo(YoungsModulus));
Assert.That(result.BaseStrength, Is.EqualTo(BaseStrength));
Assert.That(result.StressOfProportionality,
Is.EqualTo(BaseStrength * source.StrainOfProportionality));
Assert.That(result.StrainOfProportionality,
Is.EqualTo(expectedYieldingStrain * source.StrainOfProportionality));
Assert.That(result.StrainOfStartOfYielding,
Is.EqualTo(expectedYieldingStrain * source.StrainOfStartOfYielding));
Assert.That(result.StrainOfEndOfYielding,
Is.EqualTo(expectedYieldingStrain * source.StrainOfEndOfYielding));
Assert.That(result.StrainOfUltimateStrength,
Is.EqualTo(expectedYieldingStrain * source.StrainOfUltimateStrength));
Assert.That(result.StrainOfFracture,
Is.EqualTo(expectedYieldingStrain * source.StrainOfFracture));
Assert.That(result.StressOfUltimateStrength,
Is.EqualTo(BaseStrength * source.StressOfUltimateStrength));
Assert.That(result.StressOfFracture,
Is.EqualTo(BaseStrength * source.StressOfFracture));
}
[Test]
public void Convert_InitialYoungsModulusIsZero_ThrowsException()
{
// Arrange
var invalidLogic = new SteelRelativeToAbsoluteDiagramConvertLogic(
initialYoungsModulus: 0.0,
baseStrength: BaseStrength);
var source = CreateValidSource();
// Act + Assert
var ex = Assert.Throws<StructureHelperException>(
() => invalidLogic.Convert(source));
StringAssert.Contains("Initial modulus", ex.Message);
}
[Test]
public void Convert_BaseStrengthIsNegative_ThrowsException()
{
// Arrange
var invalidLogic = new SteelRelativeToAbsoluteDiagramConvertLogic(
initialYoungsModulus: YoungsModulus,
baseStrength: -1.0);
var source = CreateValidSource();
// Act + Assert
var ex = Assert.Throws<StructureHelperException>(
() => invalidLogic.Convert(source));
StringAssert.Contains("Stress of yelding", ex.Message);
}
private static SteelDiagramRelativeProperty CreateValidSource()
{
return new SteelDiagramRelativeProperty
{
StrainOfProportionality = 0.5,
StrainOfStartOfYielding = 1.0,
StrainOfEndOfYielding = 1.2,
StrainOfUltimateStrength = 2.0,
StrainOfFracture = 3.0,
StressOfUltimateStrength = 1.1,
StressOfFracture = 0.8
};
}
}
}