Templates was added

This commit is contained in:
Evgeny Redikultsev
2022-11-13 15:46:50 +05:00
parent ba609091aa
commit 1e98e2cc57
20 changed files with 550 additions and 161 deletions

View File

@@ -33,12 +33,12 @@ namespace StructureHelperLogics.Models.Materials
if (MaterialType == MaterialTypes.Concrete)
{ return GetConcrete();}
else if (MaterialType == MaterialTypes.Reinforcement)
{ return GetReinfrocemente();}
{ return GetReinfrocement();}
else throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown}: material type = {MaterialType}, code type = {codeType}");
}
private LCM.IMaterial GetReinfrocemente()
private LCM.IMaterial GetReinfrocement()
{
materialOptions = new LCMB.ReinforcementOptions();
SetMaterialOptions();

View File

@@ -0,0 +1,19 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Templates.RCs
{
public interface IRectangleBeamTemplate
{
IShape Shape { get; }
double CoverGap { get; set; }
double TopDiameter { get; set; }
double BottomDiameter { get; set; }
int WidthCount { get; set; }
int HeightCount { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Templates.RCs
{
public class RectangleBeamTemplate : IRectangleBeamTemplate
{
public IShape Shape { get; }
public double CoverGap { get; set; }
public double TopDiameter { get; set; }
public double BottomDiameter { get; set; }
public int WidthCount { get; set; }
public int HeightCount { get; set; }
public RectangleBeamTemplate()
{
Shape = new Rectangle() { Width = 0.4d, Height = 0.6d };
CoverGap = 0.05d;
TopDiameter = 0.016d;
BottomDiameter = 0.025d;
WidthCount = 2;
HeightCount = 2;
}
public RectangleBeamTemplate(double width, double height)
{
Shape = new Rectangle() { Width = width, Height = height };
CoverGap = 0.05d;
TopDiameter = 0.016d;
BottomDiameter = 0.025d;
WidthCount = 2;
HeightCount = 2;
}
}
}

View File

@@ -88,49 +88,5 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
return ndms;
}
//private static IMaterial GetMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
//{
// IMaterial material;
// if (primitiveMaterial.MaterialType == MaterialTypes.Concrete) { material = GetConcreteMaterial(primitiveMaterial, options); }
// else if (primitiveMaterial.MaterialType == MaterialTypes.Reinforcement) { material = GetReinforcementMaterial(primitiveMaterial, options); }
// else { throw new StructureHelperException(ErrorStrings.MaterialTypeIsUnknown); }
// return material;
//}
//private static IMaterial GetConcreteMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
//{
// IMaterialOptions materialOptions = new ConcreteOptions();
// SetMaterialOptions(materialOptions, primitiveMaterial, options);
// IMaterialBuilder builder = new ConcreteBuilder(materialOptions);
// IBuilderDirector director = new BuilderDirector(builder);
// return director.BuildMaterial();
//}
//private static IMaterial GetReinforcementMaterial(IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
//{
// IMaterialOptions materialOptions = new ReinforcementOptions();
// SetMaterialOptions(materialOptions, primitiveMaterial, options);
// IMaterialBuilder builder = new ReinforcementBuilder(materialOptions);
// IBuilderDirector director = new BuilderDirector(builder);
// return director.BuildMaterial();
//}
//private static void SetMaterialOptions(IMaterialOptions materialOptions, IPrimitiveMaterial primitiveMaterial, ITriangulationOptions options)
//{
// materialOptions.Strength = primitiveMaterial.Strength;
// 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 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 StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
//}
}
}

View File

@@ -1,35 +1,36 @@
using System.Collections.Generic;
using System.Threading;
using LoaderCalculator;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.SourceData;
using StructureHelperLogics.NdmCalculations.Triangulations;
using StructureHelperLogics.Models.Calculations.CalculationsResults;
using LoaderCalculator;
using StructureHelperLogics.Models.Calculations.CalculationProperties;
using System;
using StructureHelperLogics.Models.Calculations.CalculationsResults;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperLogics.Services
namespace StructureHelperLogics.Services.NdmCalculations
{
public class CalculationService
{
private ICalculationProperty calculationProperty;
public IStrainMatrix GetPrimitiveStrainMatrix(INdmPrimitive[] ndmPrimitives, double mx, double my, double nz)
{
//Коллекция для хранения элементарных участков
var ndmCollection = new List<INdm>();
//Настройки триангуляции, пока опции могут быть только такие
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.Collapse, CalcTerm = CalcTerms.ShortTerm };
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
ITriangulationOptions options = new TriangulationOptions { LimiteState = calculationProperty.LimitState, CalcTerm = calculationProperty.CalcTerm };
ndmCollection.AddRange(Triangulation.GetNdms(ndmPrimitives, options));
var loaderData = new LoaderOptions
{
Preconditions = new Preconditions
{
ConditionRate = 0.01,
MaxIterationCount = 100,
ConditionRate = calculationProperty.IterationProperty.Accuracy,
MaxIterationCount = calculationProperty.IterationProperty.MaxIterationCount,
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
},
NdmCollection = ndmCollection
@@ -39,7 +40,7 @@ namespace StructureHelperLogics.Services
return calculator.Result.StrainMatrix;
}
public List<ICalculationResult> GetCalculationResults(ICalculationProperty calculationProperty, IEnumerable<INdm> ndms)
public List<ICalculationResult> GetCalculationResults(IEnumerable<INdm> ndms)
{
List<ICalculationResult> results = new List<ICalculationResult>();
foreach (var forceCombinations in calculationProperty.ForceCombinations)
@@ -67,7 +68,7 @@ namespace StructureHelperLogics.Services
var calculator = new Calculator();
calculator.Run(loaderData, new CancellationToken());
var result = calculator.Result;
if (result.AccuracyRate <= accuracyRate) { return new CalculationResult() { IsValid = true, Desctription = "Analisys is done succsefully", LoaderResults=result };}
if (result.AccuracyRate <= accuracyRate) { return new CalculationResult() { IsValid = true, Desctription = "Analisys is done succsefully", LoaderResults = result }; }
else { return new CalculationResult() { IsValid = false, Desctription = "Required accuracy rate has not achived", LoaderResults = result }; }
}
catch (Exception ex)
@@ -75,5 +76,14 @@ namespace StructureHelperLogics.Services
return new CalculationResult() { IsValid = false, Desctription = $"Error is appeared due to analysis. Error: {ex}" };
}
}
public CalculationService(ICalculationProperty property)
{
calculationProperty = property;
}
public CalculationService()
{
}
}
}