Change excel reading process
This commit is contained in:
@@ -12,6 +12,9 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
internal class RestrictStrainDecorator : IMaterialBuilder
|
||||
{
|
||||
IMaterialBuilder builder;
|
||||
private double maxTensileStrain;
|
||||
private double maxCompressionStrain;
|
||||
|
||||
public IMaterialOption MaterialOption { get; set; }
|
||||
|
||||
public RestrictStrainDecorator(IMaterialBuilder builder)
|
||||
@@ -25,11 +28,8 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
var option = (RestrictStrainOption)MaterialOption;
|
||||
var material = new Material();
|
||||
material.InitModulus = builder.GetMaterial().InitModulus;
|
||||
material.DiagramParameters = new List<double>()
|
||||
{
|
||||
option.MaxTensileStrain,
|
||||
option.MaxCompessionStrain
|
||||
};
|
||||
maxTensileStrain = option.MaxTensileStrain;
|
||||
maxCompressionStrain = option.MaxCompessionStrain;
|
||||
material.Diagram = GetStressDiagram;
|
||||
return material;
|
||||
}
|
||||
@@ -39,10 +39,9 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
CheckObject.CompareTypes(typeof(RestrictStrainOption), MaterialOption.GetType());
|
||||
}
|
||||
|
||||
private double GetStressDiagram(IEnumerable<double> parameters, double strain)
|
||||
private double GetStressDiagram(double strain)
|
||||
{
|
||||
var maxTensileStrain = parameters.ToList()[0];
|
||||
var maxCompressionStrain = parameters.ToList()[1];
|
||||
|
||||
if (strain > maxTensileStrain || strain < maxCompressionStrain)
|
||||
{
|
||||
return 0d;
|
||||
@@ -50,7 +49,7 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
else
|
||||
{
|
||||
var material = builder.GetMaterial();
|
||||
return material.Diagram.Invoke(parameters, strain);
|
||||
return material.Diagram.Invoke(strain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ElasticMaterialLogic : IElasticMaterialLogic
|
||||
{
|
||||
private List<double> parameters;
|
||||
private double modulusOfElasticity;
|
||||
private double compressiveStrength;
|
||||
private double tensileStrength;
|
||||
|
||||
public IMaterial GetLoaderMaterial(IElasticMaterial elasticMaterial, LimitStates limitState, CalcTerms calcTerm, double factor = 1d)
|
||||
{
|
||||
@@ -20,23 +23,16 @@ namespace StructureHelperLogics.Models.Materials
|
||||
material.InitModulus = elasticMaterial.Modulus;
|
||||
IMaterialFactorLogic factorLogic = new MaterialFactorLogic(elasticMaterial.SafetyFactors);
|
||||
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
parameters = new List<double>()
|
||||
{
|
||||
elasticMaterial.Modulus,
|
||||
elasticMaterial.CompressiveStrength * factors.Compressive * factor,
|
||||
elasticMaterial.TensileStrength * factors.Tensile * factor
|
||||
};
|
||||
material.DiagramParameters = parameters;
|
||||
material.Diagram = GetStressByStrain;
|
||||
return material;
|
||||
modulusOfElasticity = elasticMaterial.Modulus;
|
||||
compressiveStrength = (-1d) * elasticMaterial.CompressiveStrength * factors.Compressive * factor;
|
||||
tensileStrength = elasticMaterial.TensileStrength * factors.Tensile * factor;
|
||||
material.Diagram = GetStressByStrain;
|
||||
return material;
|
||||
}
|
||||
|
||||
private double GetStressByStrain(IEnumerable<double> parameters1, double strain)
|
||||
private double GetStressByStrain(double strain)
|
||||
{
|
||||
double modulus = parameters.First();
|
||||
double stress = modulus * strain;
|
||||
double compressiveStrength = (-1d) * parameters.ElementAt(1);
|
||||
double tensileStrength = parameters.ElementAt(2);
|
||||
double stress = modulusOfElasticity * strain;
|
||||
if (stress > tensileStrength || stress < compressiveStrength) { return 0d; }
|
||||
else { return stress; }
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
var material = ndm.Material;
|
||||
var materialFunc = material.Diagram;
|
||||
var newMaterialFunc = (IEnumerable<double> parameters, double strain) => strain * material.InitModulus;
|
||||
var newMaterialFunc = (double strain) => strain * material.InitModulus;
|
||||
var existingPrestrain = ndm.PrestrainLogic.GetAll().Sum(x => x.PrestrainValue);
|
||||
var newPrestrain = materialFunc(null, existingPrestrain) / material.InitModulus;
|
||||
var newPrestrain = materialFunc(existingPrestrain) / material.InitModulus;
|
||||
ndm.Material.Diagram = newMaterialFunc;
|
||||
ndm.PrestrainLogic.DeleteAll();
|
||||
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, newPrestrain);
|
||||
|
||||
Reference in New Issue
Block a user