Library material was added

This commit is contained in:
Evgeny Redikultsev
2022-11-06 18:55:01 +05:00
parent 1cf54603bc
commit 5d19958fd7
52 changed files with 1018 additions and 171 deletions

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
public class ElasticMaterial : IElasticMaterial
{
public double Modulus { get; set; }
public object Clone()
{
return new ElasticMaterial() { Modulus = Modulus };
}
public IPrimitiveMaterial GetPrimitiveMaterial()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,105 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials.Factories
{
public static class LibMaterialFactory
{
public static List<ILibMaterial> GetLibMaterials(CodeTypes code)
{
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
libMaterials.AddRange(GetConcrete(code));
libMaterials.AddRange(GetReinforcement(code));
return libMaterials;
}
private static IEnumerable<ILibMaterial> GetReinforcement(CodeTypes code)
{
if (code == CodeTypes.EuroCode_2_1990)
{
return GetReinforcementEurocode();
}
else if (code == CodeTypes.SP63_13330_2018)
{
return GetReinforcementSP63();
}
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
}
private static IEnumerable<ILibMaterial> GetConcrete(CodeTypes code)
{
if (code == CodeTypes.EuroCode_2_1990)
{
return GetConcreteEurocode();
}
else if (code == CodeTypes.SP63_13330_2018)
{
return GetConcreteSP63();
}
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); }
}
private static IEnumerable<ILibMaterial> GetConcreteEurocode()
{
var code = CodeTypes.EuroCode_2_1990;
var material = MaterialTypes.Concrete;
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
libMaterials.Add(new LibMaterial(material, code, "C12", 12e6));
libMaterials.Add(new LibMaterial(material, code, "C20", 20e6));
libMaterials.Add(new LibMaterial(material, code, "C30", 30e6));
libMaterials.Add(new LibMaterial(material, code, "C40", 40e6));
libMaterials.Add(new LibMaterial(material, code, "C50", 50e6));
libMaterials.Add(new LibMaterial(material, code, "C60", 60e6));
libMaterials.Add(new LibMaterial(material, code, "C70", 70e6));
libMaterials.Add(new LibMaterial(material, code, "C80", 80e6));
return libMaterials;
}
private static IEnumerable<ILibMaterial> GetReinforcementEurocode()
{
var code = CodeTypes.EuroCode_2_1990;
var material = MaterialTypes.Reinforcement;
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
libMaterials.Add(new LibMaterial(material, code, "S240", 240e6));
libMaterials.Add(new LibMaterial(material, code, "S400", 400e6));
libMaterials.Add(new LibMaterial(material, code, "S500", 500e6));
return libMaterials;
}
private static IEnumerable<ILibMaterial> GetConcreteSP63()
{
var code = CodeTypes.SP63_13330_2018;
var material = MaterialTypes.Concrete;
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
libMaterials.Add(new LibMaterial(material, code, "B5", 5e6));
libMaterials.Add(new LibMaterial(material, code, "B7,5", 7.5e6));
libMaterials.Add(new LibMaterial(material, code, "B10", 10e6));
libMaterials.Add(new LibMaterial(material, code, "B15", 15e6));
libMaterials.Add(new LibMaterial(material, code, "B20", 20e6));
libMaterials.Add(new LibMaterial(material, code, "B25", 25e6));
libMaterials.Add(new LibMaterial(material, code, "B30", 30e6));
libMaterials.Add(new LibMaterial(material, code, "B35", 35e6));
libMaterials.Add(new LibMaterial(material, code, "B40", 40e6));
libMaterials.Add(new LibMaterial(material, code, "B50", 50e6));
libMaterials.Add(new LibMaterial(material, code, "B60", 60e6));
return libMaterials;
}
private static IEnumerable<ILibMaterial> GetReinforcementSP63()
{
var code = CodeTypes.EuroCode_2_1990;
var material = MaterialTypes.Reinforcement;
List<ILibMaterial> libMaterials = new List<ILibMaterial>();
libMaterials.Add(new LibMaterial(material, code, "A240", 240e6));
libMaterials.Add(new LibMaterial(material, code, "A400", 400e6));
libMaterials.Add(new LibMaterial(material, code, "A500", 500e6));
return libMaterials;
}
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using StructureHelperCommon.Services.ColorServices;
using StructureHelperLogics.Models.Materials;
namespace StructureHelper.Models.Materials
{
public class HeadMaterial : IHeadMaterial
{
public string Name { get; set; }
public Color Color { get; set; }
public IHelperMaterial HelperMaterial {get; set;}
//public MaterialDefinitionBase Material { get; set; }
public HeadMaterial()
{
Color = ColorProcessor.GetRandomColor();
}
public object Clone()
{
IHeadMaterial material = new HeadMaterial
{
Name = Name,
Color = Color,
HelperMaterial = HelperMaterial.Clone() as IHelperMaterial
};
return material;
}
}
}

View File

@@ -0,0 +1,35 @@
using StructureHelper.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
public class HeadMaterialRepository : IHeadMaterialRepository
{
public object Parent { get; private set; }
public List<IHeadMaterial> HeadMaterials { get; set; }
public List<ILibMaterial> LibMaterials { get; set; }
public HeadMaterialRepository()
{
HeadMaterials = new List<IHeadMaterial>();
LibMaterials = new List<ILibMaterial>();
}
public HeadMaterialRepository(object parent)
{
Parent = parent;
HeadMaterials = new List<IHeadMaterial>();
LibMaterials = new List<ILibMaterial>();
}
public void RegisterParent(object obj)
{
Parent = obj;
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
public interface IElasticMaterial : IHelperMaterial
{
double Modulus { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace StructureHelper.Models.Materials
{
public interface IHeadMaterial : ICloneable
{
string Name { get; set; }
Color Color { get; set; }
IHelperMaterial HelperMaterial { get; set; }
//MaterialDefinitionBase Material { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using StructureHelper.Models.Materials;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace StructureHelperLogics.Models.Materials
{
public interface IHeadMaterialRepository
{
object Parent { get; }
List<IHeadMaterial> HeadMaterials { get; set; }
List<ILibMaterial> LibMaterials { get; set; }
void RegisterParent(object obj);
}
}

View File

@@ -0,0 +1,13 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Models.Materials;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Materials
{
public interface IHelperMaterial : ICloneable
{
IPrimitiveMaterial GetPrimitiveMaterial();
}
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Materials;
using StructureHelperLogics.Infrastructures.CommonEnums;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Materials
{
public interface ILibMaterial : IHelperMaterial
{
MaterialTypes MaterialType { get; set; }
CodeTypes CodeType { get; set; }
string Name { get; set; }
double MainStrength { get; set; }
}
}

View File

@@ -0,0 +1,73 @@
using LoaderCalculator.Data.Materials;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Materials;
using System;
using System.Collections.Generic;
using System.Text;
namespace StructureHelperLogics.Models.Materials
{
public class LibMaterial : ILibMaterial
{
public MaterialTypes MaterialType { get; set; }
public CodeTypes CodeType { get; set; }
public string Name { get; set; }
public double MainStrength { get; set; }
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
{
MaterialType = materialType;
CodeType = codeType;
Name = name;
MainStrength = mainStrength;
}
public IPrimitiveMaterial GetPrimitiveMaterial()
{
if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.EuroCode_2_1990)
{ return GetConcreteEurocode();}
else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.EuroCode_2_1990)
{ return GetReinfrocementeEurocode();}
if (MaterialType == MaterialTypes.Concrete & CodeType == CodeTypes.SP63_13330_2018)
{ return GetConcreteSP63(); }
else if (MaterialType == MaterialTypes.Reinforcement & CodeType == CodeTypes.SP63_13330_2018)
{ return GetReinfrocementeSP63(); }
else throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown}: material type = {MaterialType}, code type = {CodeType}");
}
private IPrimitiveMaterial GetReinfrocementeSP63()
{
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
{ MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Reinforcement {Name}", Strength = MainStrength };
return primitiveMaterial;
}
private IPrimitiveMaterial GetConcreteSP63()
{
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
{ MaterialType = MaterialType, CodeType = CodeTypes.SP63_13330_2018, ClassName = $"Concrete {Name}", Strength = MainStrength };
return primitiveMaterial;
}
private IPrimitiveMaterial GetReinfrocementeEurocode()
{
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
{ MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Reinforcement {Name}", Strength = MainStrength };
return primitiveMaterial;
}
private IPrimitiveMaterial GetConcreteEurocode()
{
IPrimitiveMaterial primitiveMaterial = new PrimitiveMaterial
{ MaterialType = MaterialType, CodeType = CodeTypes.EuroCode_2_1990, ClassName = $"Concrete {Name}", Strength = MainStrength };
return primitiveMaterial;
}
public object Clone()
{
return new LibMaterial(this.MaterialType, this.CodeType, this.Name, this.MainStrength);
}
}
}

View File

@@ -2,5 +2,8 @@
{
public interface ITriangulationLogicOptions
{
double PrestrainKx { get;}
double PrestrainKy { get;}
double PrestrainEpsZ { get;}
}
}

View File

@@ -3,6 +3,8 @@ using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using StructureHelperCommon.Models.Shapes;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms.Transformations;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -23,6 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
List<INdm> ndmCollection = new List<INdm>();
INdm ndm = new Ndm { CenterX = center.X, CenterY = center.Y, Area = area, Material = material };
ndmCollection.Add(ndm);
NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
return ndmCollection;
}

View File

@@ -1,4 +1,8 @@
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.NdmPrimitives;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -11,13 +15,31 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
///
/// </summary>
public ICenter Center { get; }
/// <inheritdoc />
public double Area { get; }
/// <inheritdoc />
public double PrestrainKx { get; }
/// <inheritdoc />
public double PrestrainKy { get; }
/// <inheritdoc />
public double PrestrainEpsZ { get; }
public PointTriangulationLogicOptions(ICenter center, double area)
{
Center = center;
Area = area;
}
public PointTriangulationLogicOptions(INdmPrimitive primitive)
{
if (!(primitive.Shape is IPoint)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
Center = primitive.Center;
IPoint point = primitive.Shape as IPoint;
Center = primitive.Center;
Area = point.Area;
PrestrainKx = primitive.PrestrainKx;
PrestrainKy = primitive.PrestrainKy;
PrestrainEpsZ = primitive.PrestrainEpsZ;
}
}
}

View File

@@ -3,6 +3,7 @@ using LoaderCalculator.Data.Ndms;
using System;
using System.Collections.Generic;
using LoaderCalculator.Data.Ndms.Transformations;
using LoaderCalculator.Data.Matrix;
namespace StructureHelperLogics.NdmCalculations.Triangulations
{
@@ -25,6 +26,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
NdmTransform.Move(ndmCollection, dX, dY);
double angle = rectangleOptions.Rectangle.Angle;
NdmTransform.Rotate(ndmCollection, angle);
NdmTransform.SetPrestrain(ndmCollection, new StrainMatrix() { Kx = Options.PrestrainKx, Ky = Options.PrestrainKy, EpsZ = Options.PrestrainEpsZ });
return ndmCollection;
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Shapes;
@@ -15,6 +17,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public double NdmMaxSize { get; }
/// <inheritdoc />
public int NdmMinDivision { get; }
/// <inheritdoc />
public double PrestrainKx { get;}
/// <inheritdoc />
public double PrestrainKy { get; }
/// <inheritdoc />
public double PrestrainEpsZ { get;}
public RectangleTriangulationLogicOptions(ICenter center, IRectangle rectangle, double ndmMaxSize, int ndmMinDivision)
{
@@ -26,11 +34,14 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
{
if (! (primitive.Shape is IRectangle)) { throw new Exception("Shape type is not valid"); }
if (! (primitive.Shape is IRectangle)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
Center = primitive.Center;
Rectangle = primitive.Shape as IRectangle;
NdmMaxSize = primitive.NdmMaxSize;
NdmMinDivision = primitive.NdmMinDivision;
PrestrainKx = primitive.PrestrainKx;
PrestrainKy = primitive.PrestrainKy;
PrestrainEpsZ = primitive.PrestrainEpsZ;
}
}
}

View File

@@ -3,6 +3,9 @@ using System.Collections.Generic;
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Materials.MaterialBuilders;
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Entities;
using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
@@ -67,12 +70,11 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
}
else if (shape is IPoint)
{
IPoint point = shape as IPoint;
options = new PointTriangulationLogicOptions(primitive.Center, point.Area);
options = new PointTriangulationLogicOptions(primitive);
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
ndms.AddRange(logic.GetNdmCollection(material));
}
else { throw new Exception("Primitive type is not valid"); }
else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
return ndms;
}
@@ -81,7 +83,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
IMaterial material;
if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); }
else { throw new Exception("Material type is invalid"); }
else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
return material;
}
@@ -106,14 +108,22 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
{
materialOptions.Strength = primitiveMaterial.Strength;
materialOptions.CodesType = CodesType.EC2_1990;
if (primitiveMaterial.CodeType == CodeTypes.EuroCode_2_1990)
{
materialOptions.CodesType = CodesType.EC2_1990;
}
else if (primitiveMaterial.CodeType == CodeTypes.SP63_13330_2018)
{
materialOptions.CodesType = CodesType.SP63_2018;
}
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {primitiveMaterial.CodeType}"); }
if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Collapse) { materialOptions.LimitState = LimitStates.Collapse; }
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.ServiceAbility) { materialOptions.LimitState = LimitStates.ServiceAbility; }
else if (options.LimiteState == Infrastructures.CommonEnums.LimitStates.Special) { materialOptions.LimitState = LimitStates.Special; }
else { throw new Exception("LimitStateType is not valid"); }
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
else if (options.CalcTerm == Infrastructures.CommonEnums.CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
else { throw new Exception("Calculation term is not valid"); }
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
}
}
}

View File

@@ -1,21 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="LoaderCalculator">
<HintPath>..\..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
<HintPath>..\Libraries\LoaderCalculator.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System.Windows" />
</ItemGroup>
</Project>
</Project>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StructureHelperCommon\StructureHelperCommon.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="LoaderCalculator">
<HintPath>..\..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>