Material logic was changed
This commit is contained in:
Binary file not shown.
@@ -36,10 +36,10 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
|||||||
}
|
}
|
||||||
public double Humidity
|
public double Humidity
|
||||||
{
|
{
|
||||||
get => concreteMaterial.Humidity;
|
get => concreteMaterial.RelativeHumidity;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
concreteMaterial.Humidity = value;
|
concreteMaterial.RelativeHumidity = value;
|
||||||
OnPropertyChanged(nameof(Humidity));
|
OnPropertyChanged(nameof(Humidity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
{
|
{
|
||||||
public static string UnknownError => "#0000: Unknown error";
|
public static string UnknownError => "#0000: Unknown error";
|
||||||
public static string ObjectTypeIsUnknown => "#0001: Object type is unknown";
|
public static string ObjectTypeIsUnknown => "#0001: Object type is unknown";
|
||||||
|
public static string ObjectTypeIsUnknownObj(object obj) => $"{ObjectTypeIsUnknown}: {obj.GetType()}";
|
||||||
public static string MaterialTypeIsUnknown => "#0002: Material type is unknown";
|
public static string MaterialTypeIsUnknown => "#0002: Material type is unknown";
|
||||||
public static string DataIsInCorrect => "#0003: Data is not correct";
|
public static string DataIsInCorrect => "#0003: Data is not correct";
|
||||||
public static string ShapeIsNotCorrect => "#0004: Shape is not valid";
|
public static string ShapeIsNotCorrect => "#0004: Shape is not valid";
|
||||||
|
|||||||
55
StructureHelperLogics/Models/Materials/ConcreteCurveLogic.cs
Normal file
55
StructureHelperLogics/Models/Materials/ConcreteCurveLogic.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using System.Windows.Media.Media3D;
|
||||||
|
using static System.Windows.Forms.Design.AxImporter;
|
||||||
|
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public class ConcreteCurveLogic : IMaterialLogic
|
||||||
|
{
|
||||||
|
private ConcreteOptions concreteOptions;
|
||||||
|
private IMaterialOptionLogic optionLogic;
|
||||||
|
private ConcreteLogicOptions options;
|
||||||
|
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public IMaterialLogicOptions Options
|
||||||
|
{
|
||||||
|
get => options;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is not ConcreteLogicOptions)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException($"{ErrorStrings.ExpectedWas(typeof(ConcreteLogicOptions), value)}");
|
||||||
|
}
|
||||||
|
options = (ConcreteLogicOptions)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMaterial GetLoaderMaterial()
|
||||||
|
{
|
||||||
|
GetLoaderOptions();
|
||||||
|
IBuilderDirector director = GetMaterialDirector();
|
||||||
|
var material = director.BuildMaterial();
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IBuilderDirector GetMaterialDirector()
|
||||||
|
{
|
||||||
|
IMaterialBuilder builder = new ConcreteBuilder(concreteOptions);
|
||||||
|
IBuilderDirector director = new BuilderDirector(builder);
|
||||||
|
return director;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetLoaderOptions()
|
||||||
|
{
|
||||||
|
concreteOptions = new ConcreteOptions();
|
||||||
|
optionLogic = new ConcreteMaterialOptionLogic(options);
|
||||||
|
optionLogic.SetMaterialOptions(concreteOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
|||||||
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||||
using LM = LoaderCalculator.Data.Materials;
|
using LM = LoaderCalculator.Data.Materials;
|
||||||
using LoaderCalculator.Data.Materials;
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials
|
namespace StructureHelperLogics.Models.Materials
|
||||||
{
|
{
|
||||||
@@ -14,21 +15,32 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
private IMaterialOptionLogic optionLogic;
|
private IMaterialOptionLogic optionLogic;
|
||||||
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
private IFactorLogic factorLogic => new FactorLogic(SafetyFactors);
|
||||||
private LMLogic.ITrueStrengthLogic strengthLogic;
|
private LMLogic.ITrueStrengthLogic strengthLogic;
|
||||||
|
/// <inheritdoc/>
|
||||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool TensionForULS { get ; set; }
|
public bool TensionForULS { get ; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool TensionForSLS { get; set; }
|
public bool TensionForSLS { get; set; }
|
||||||
public double Humidity { get; set; }
|
/// <summary>
|
||||||
|
/// Humidity of concrete
|
||||||
|
/// </summary>
|
||||||
|
public double RelativeHumidity { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IMaterialLogic MaterialLogic { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public List<IMaterialLogic> MaterialLogics { get; }
|
||||||
|
|
||||||
public ConcreteLibMaterial()
|
public ConcreteLibMaterial()
|
||||||
{
|
{
|
||||||
|
MaterialLogic = new ConcreteCurveLogic();
|
||||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||||
lmOptions = new LMBuilders.ConcreteOptions();
|
lmOptions = new LMBuilders.ConcreteOptions();
|
||||||
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType));
|
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType));
|
||||||
TensionForULS = false;
|
TensionForULS = false;
|
||||||
TensionForSLS = true;
|
TensionForSLS = true;
|
||||||
Humidity = 0.55d;
|
RelativeHumidity = 0.55d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
@@ -39,30 +51,7 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
|
||||||
{
|
|
||||||
GetOptions(limitState, calcTerm, false);
|
|
||||||
LMBuilders.IBuilderDirector director = GetMaterial(limitState, calcTerm);
|
|
||||||
return director.BuildMaterial();
|
|
||||||
}
|
|
||||||
|
|
||||||
private LMBuilders.IBuilderDirector GetMaterial(LimitStates limitState, CalcTerms calcTerm)
|
|
||||||
{
|
|
||||||
var strength = factorLogic.GetTotalFactor(limitState, calcTerm);
|
|
||||||
lmOptions.ExternalFactor.Compressive = strength.Compressive;
|
|
||||||
lmOptions.ExternalFactor.Tensile = strength.Tensile;
|
|
||||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ConcreteBuilder(lmOptions);
|
|
||||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
|
||||||
return director;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetOptions(LimitStates limitState, CalcTerms calcTerm, bool isSectionCracked)
|
|
||||||
{
|
|
||||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
|
||||||
optionLogic.SetMaterialOptions(lmOptions);
|
|
||||||
optionLogic = new ConcreteMaterialOptionLogic(this, limitState, isSectionCracked);
|
|
||||||
optionLogic.SetMaterialOptions(lmOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
@@ -83,9 +72,56 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
|
|
||||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
GetOptions(limitState, calcTerm, true);
|
ConcreteLogicOptions options = SetOptions(limitState, calcTerm);
|
||||||
LMBuilders.IBuilderDirector director = GetMaterial(limitState, calcTerm);
|
options.WorkInTension = false;
|
||||||
return director.BuildMaterial();
|
MaterialLogic.Options = options;
|
||||||
|
var material = MaterialLogic.GetLoaderMaterial();
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
ConcreteLogicOptions options = SetOptions(limitState, calcTerm);
|
||||||
|
MaterialLogic.Options = options;
|
||||||
|
var material = MaterialLogic.GetLoaderMaterial();
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConcreteLogicOptions SetOptions(LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
var options = new ConcreteLogicOptions();
|
||||||
|
options.SafetyFactors = SafetyFactors;
|
||||||
|
options.MaterialEntity = MaterialEntity;
|
||||||
|
options.LimitState = limitState;
|
||||||
|
options.CalcTerm = calcTerm;
|
||||||
|
if (limitState == LimitStates.ULS)
|
||||||
|
{
|
||||||
|
if (TensionForULS == true)
|
||||||
|
{
|
||||||
|
options.WorkInTension = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options.WorkInTension = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (limitState == LimitStates.SLS)
|
||||||
|
{
|
||||||
|
if (TensionForSLS == true)
|
||||||
|
{
|
||||||
|
options.WorkInTension = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options.WorkInTension = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(limitState));
|
||||||
|
}
|
||||||
|
options.RelativeHumidity = RelativeHumidity;
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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 StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public class ConcreteLogicOptions : IMaterialLogicOptions
|
||||||
|
{
|
||||||
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||||
|
public LimitStates LimitState { get; set; }
|
||||||
|
public CalcTerms CalcTerm { get; set; }
|
||||||
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
|
public bool WorkInCompression { get; set; }
|
||||||
|
public bool WorkInTension { get; set; }
|
||||||
|
public double RelativeHumidity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,6 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
bool TensionForULS { get; set; }
|
bool TensionForULS { get; set; }
|
||||||
bool TensionForSLS { get; set; }
|
bool TensionForSLS { get; set; }
|
||||||
double Humidity { get; set; }
|
double RelativeHumidity { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
{
|
{
|
||||||
ILibMaterialEntity MaterialEntity { get; set; }
|
ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
List<IMaterialSafetyFactor> SafetyFactors { get; }
|
List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||||
|
IMaterialLogic MaterialLogic { get; set; }
|
||||||
|
List<IMaterialLogic> MaterialLogics { get; }
|
||||||
(double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm);
|
(double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
StructureHelperLogics/Models/Materials/IMaterialLogic.cs
Normal file
17
StructureHelperLogics/Models/Materials/IMaterialLogic.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IMaterialLogic
|
||||||
|
{
|
||||||
|
string Name { get; set; }
|
||||||
|
IMaterialLogicOptions Options { get; set; }
|
||||||
|
IMaterial GetLoaderMaterial();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
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 StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public interface IMaterialLogicOptions
|
||||||
|
{
|
||||||
|
public List<IMaterialSafetyFactor> SafetyFactors { get; set; }
|
||||||
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
|
LimitStates LimitState { get; set; }
|
||||||
|
CalcTerms CalcTerm { get; set; }
|
||||||
|
bool WorkInCompression { get; set; }
|
||||||
|
bool WorkInTension { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,9 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
|
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||||
|
public IMaterialLogic MaterialLogic { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||||
|
|
||||||
|
public List<IMaterialLogic> MaterialLogics => throw new NotImplementedException();
|
||||||
|
|
||||||
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
libUpdateStrategy.Update(targetObject, sourceObject);
|
libUpdateStrategy.Update(targetObject, sourceObject);
|
||||||
targetObject.TensionForULS = sourceObject.TensionForULS;
|
targetObject.TensionForULS = sourceObject.TensionForULS;
|
||||||
targetObject.TensionForSLS = sourceObject.TensionForSLS;
|
targetObject.TensionForSLS = sourceObject.TensionForSLS;
|
||||||
targetObject.Humidity = sourceObject.Humidity;
|
targetObject.RelativeHumidity = sourceObject.RelativeHumidity;
|
||||||
|
targetObject.MaterialLogic = sourceObject.MaterialLogic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,50 +7,37 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static System.Windows.Forms.Design.AxImporter;
|
using static System.Windows.Forms.Design.AxImporter;
|
||||||
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials
|
namespace StructureHelperLogics.Models.Materials
|
||||||
{
|
{
|
||||||
internal class ConcreteMaterialOptionLogic : IMaterialOptionLogic
|
internal class ConcreteMaterialOptionLogic : IMaterialOptionLogic
|
||||||
{
|
{
|
||||||
private IConcreteLibMaterial material;
|
private ConcreteLogicOptions options;
|
||||||
private LimitStates limitState;
|
private MaterialCommonOptionLogic optionLogic;
|
||||||
bool IsMaterialCracked;
|
private FactorLogic factorLogic;
|
||||||
public ConcreteMaterialOptionLogic(IConcreteLibMaterial material, LimitStates limitState, bool IsMaterialCracked)
|
|
||||||
|
public ConcreteMaterialOptionLogic(ConcreteLogicOptions options)
|
||||||
{
|
{
|
||||||
this.material = material;
|
this.options = options;
|
||||||
this.limitState = limitState;
|
|
||||||
this.IsMaterialCracked = IsMaterialCracked;
|
|
||||||
}
|
|
||||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
|
||||||
{
|
|
||||||
Check(materialOptions);
|
|
||||||
var concreteOptions = materialOptions as LCMB.ConcreteOptions;
|
|
||||||
concreteOptions.WorkInTension = false;
|
|
||||||
if (IsMaterialCracked)
|
|
||||||
{
|
|
||||||
concreteOptions.WorkInTension = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (limitState == LimitStates.ULS & material.TensionForULS == true)
|
|
||||||
{
|
|
||||||
concreteOptions.WorkInTension = true;
|
|
||||||
}
|
|
||||||
if (limitState == LimitStates.SLS & material.TensionForSLS == true)
|
|
||||||
{
|
|
||||||
concreteOptions.WorkInTension = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Check(LCMB.IMaterialOptions materialOptions)
|
public void SetMaterialOptions(IMaterialOptions materialOptions)
|
||||||
{
|
{
|
||||||
if (materialOptions is null)
|
if (materialOptions is not ConcreteOptions)
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": expected {typeof(LCMB.ConcreteOptions)}, but was null");
|
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(ConcreteOptions), materialOptions.GetType()));
|
||||||
}
|
|
||||||
if (materialOptions is not LCMB.ConcreteOptions)
|
|
||||||
{
|
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": expected {typeof(LCMB.ConcreteOptions)}, but was {materialOptions.GetType()}");
|
|
||||||
}
|
}
|
||||||
|
var concreteOptions = materialOptions as ConcreteOptions;
|
||||||
|
optionLogic = new MaterialCommonOptionLogic(options);
|
||||||
|
optionLogic.SetMaterialOptions(concreteOptions);
|
||||||
|
factorLogic = new FactorLogic(options.SafetyFactors);
|
||||||
|
var strength = factorLogic.GetTotalFactor(options.LimitState, options.CalcTerm);
|
||||||
|
concreteOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||||
|
concreteOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||||
|
concreteOptions.WorkInTension = options.WorkInTension;
|
||||||
|
concreteOptions.RelativeHumidity = options.RelativeHumidity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +1,45 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
|
||||||
namespace StructureHelperLogics.Models.Materials
|
namespace StructureHelperLogics.Models.Materials
|
||||||
{
|
{
|
||||||
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
public class MaterialCommonOptionLogic : IMaterialOptionLogic
|
||||||
{
|
{
|
||||||
private ILibMaterialEntity materialEntity;
|
private IMaterialLogicOptions options;
|
||||||
private LimitStates limitState;
|
|
||||||
private CalcTerms calcTerm;
|
|
||||||
|
|
||||||
public MaterialCommonOptionLogic(ILibMaterialEntity materialEntity, LimitStates limitState, CalcTerms calcTerm)
|
public MaterialCommonOptionLogic(IMaterialLogicOptions options)
|
||||||
{
|
{
|
||||||
this.materialEntity = materialEntity;
|
this.options = options;
|
||||||
this.limitState = limitState;
|
|
||||||
this.calcTerm = calcTerm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||||
{
|
{
|
||||||
materialOptions.Strength = materialEntity.MainStrength;
|
materialOptions.Strength = options.MaterialEntity.MainStrength;
|
||||||
if (materialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
if (options.MaterialEntity.CodeType == CodeTypes.EuroCode_2_1990)
|
||||||
{
|
{
|
||||||
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
materialOptions.CodesType = LCMB.CodesType.EC2_1990;
|
||||||
}
|
}
|
||||||
else if (materialEntity.CodeType == CodeTypes.SP63_2018)
|
else if (options.MaterialEntity.CodeType == CodeTypes.SP63_2018)
|
||||||
{
|
{
|
||||||
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
materialOptions.CodesType = LCMB.CodesType.SP63_2018;
|
||||||
}
|
}
|
||||||
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
|
else { throw new StructureHelperException($"{ErrorStrings.ObjectTypeIsUnknown} : {materialOptions.CodesType}"); }
|
||||||
if (limitState == LimitStates.ULS) { materialOptions.LimitState = LCMB.LimitStates.Collapse; }
|
if (options.LimitState == LimitStates.ULS)
|
||||||
else if (limitState == LimitStates.SLS) { materialOptions.LimitState = LCMB.LimitStates.ServiceAbility; }
|
{
|
||||||
else if (limitState == LimitStates.Special) { materialOptions.LimitState = LCMB.LimitStates.Special; }
|
materialOptions.LimitState = LCMB.LimitStates.Collapse;
|
||||||
|
}
|
||||||
|
else if (options.LimitState == LimitStates.SLS)
|
||||||
|
{
|
||||||
|
materialOptions.LimitState = LCMB.LimitStates.ServiceAbility;
|
||||||
|
}
|
||||||
|
else if (options.LimitState == LimitStates.Special)
|
||||||
|
{
|
||||||
|
materialOptions.LimitState = LCMB.LimitStates.Special;
|
||||||
|
}
|
||||||
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
|
else { throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); }
|
||||||
if (calcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
if (options.CalcTerm == CalcTerms.ShortTerm) { materialOptions.IsShortTerm = true; }
|
||||||
else if (calcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
else if (options.CalcTerm == CalcTerms.LongTerm) { materialOptions.IsShortTerm = false; }
|
||||||
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
else { throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static System.Windows.Forms.Design.AxImporter;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
public class ReinforcementBiLinearLogic : IMaterialLogic
|
||||||
|
{
|
||||||
|
private ReinforcementOptions materialOptions;
|
||||||
|
private IMaterialOptionLogic optionLogic;
|
||||||
|
private ReinforcementLogicOptions options;
|
||||||
|
private IMaterialLogicOptions options1;
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public IMaterialLogicOptions Options
|
||||||
|
{
|
||||||
|
get => options;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is not ReinforcementLogicOptions)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException($"{ErrorStrings.ExpectedWas(typeof(ReinforcementLogicOptions), value)}");
|
||||||
|
}
|
||||||
|
options = (ReinforcementLogicOptions)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMaterial GetLoaderMaterial()
|
||||||
|
{
|
||||||
|
GetLoaderOptions();
|
||||||
|
IBuilderDirector director = GetMaterialDirector();
|
||||||
|
var material = director.BuildMaterial();
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IBuilderDirector GetMaterialDirector()
|
||||||
|
{
|
||||||
|
IMaterialBuilder builder = new ReinforcementBuilder(materialOptions);
|
||||||
|
IBuilderDirector director = new BuilderDirector(builder);
|
||||||
|
return director;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetLoaderOptions()
|
||||||
|
{
|
||||||
|
materialOptions = new ReinforcementOptions();
|
||||||
|
optionLogic = new MaterialCommonOptionLogic(options);
|
||||||
|
optionLogic.SetMaterialOptions(materialOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,10 +20,13 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
|
||||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||||
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
public List<IMaterialSafetyFactor> SafetyFactors { get; }
|
||||||
|
public IMaterialLogic MaterialLogic { get; set; }
|
||||||
|
|
||||||
|
public List<IMaterialLogic> MaterialLogics { get; }
|
||||||
|
|
||||||
public ReinforcementLibMaterial()
|
public ReinforcementLibMaterial()
|
||||||
{
|
{
|
||||||
|
MaterialLogic = new ReinforcementBiLinearLogic();
|
||||||
SafetyFactors = new List<IMaterialSafetyFactor>();
|
SafetyFactors = new List<IMaterialSafetyFactor>();
|
||||||
lmOptions = new LMBuilders.ReinforcementOptions();
|
lmOptions = new LMBuilders.ReinforcementOptions();
|
||||||
}
|
}
|
||||||
@@ -36,17 +39,24 @@ namespace StructureHelperLogics.Models.Materials
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Loadermaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
ReinforcementLogicOptions options = SetOptions(limitState, calcTerm);
|
||||||
optionLogic.SetMaterialOptions(lmOptions);
|
MaterialLogic.Options = options;
|
||||||
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
|
var material = MaterialLogic.GetLoaderMaterial();
|
||||||
lmOptions.ExternalFactor.Compressive = factors.Compressive;
|
return material;
|
||||||
lmOptions.ExternalFactor.Tensile = factors.Tensile;
|
|
||||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ReinforcementBuilder(lmOptions);
|
|
||||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
|
||||||
return director.BuildMaterial();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ReinforcementLogicOptions SetOptions(LimitStates limitState, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
var options = new ReinforcementLogicOptions();
|
||||||
|
options.SafetyFactors = SafetyFactors;
|
||||||
|
options.MaterialEntity = MaterialEntity;
|
||||||
|
options.LimitState = limitState;
|
||||||
|
options.CalcTerm = calcTerm;
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||||
{
|
{
|
||||||
strengthLogic = new LoaderMaterialLogics.TrueStrengthReinforcementLogic(MaterialEntity.MainStrength);
|
strengthLogic = new LoaderMaterialLogics.TrueStrengthReinforcementLogic(MaterialEntity.MainStrength);
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
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 StructureHelperLogics.Models.Materials
|
||||||
|
{
|
||||||
|
internal class ReinforcementLogicOptions : 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; }
|
||||||
|
public bool WorkInTension { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user