CrackWidthCalculator has been added

This commit is contained in:
Evgeny Redikultsev
2023-08-13 19:32:02 +05:00
parent d718151280
commit 1ed2ba8cf1
15 changed files with 284 additions and 34 deletions

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Enums
{
public enum SectionStressStates
{
Tension,
Compressed,
Combined
}
}

View File

@@ -21,5 +21,6 @@
public static string ResultIsNotValid => "#0016: Result is not valid";
public static string ErrorOfExuting => "#0017: Error of executing";
public static string ExpectedWas(System.Type expected, System.Type was) => $"{DataIsInCorrect}: Expected {expected}, but was {was}";
public static string ExpectedWas(System.Type expected, object obj) => ExpectedWas(expected, obj.GetType());
}
}

View File

@@ -37,7 +37,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
var tuple = InputData.Tuple;
var accuracy = InputData.Accuracy;
var mx = tuple.Mx;
var my = tuple.My;
var nz = tuple.Nz;

View File

@@ -0,0 +1,26 @@
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthCalculator : ICalculator
{
CrackWidthCalculatorResult result;
public string Name { get; set; }
public ICrackWidthCalculatorInputData InputData { get; set; }
public IResult Result => result;
public void Run()
{
throw new NotImplementedException();
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthCalculatorResult : IResult
{
public bool IsValid { get; set; }
public string Description { get; set; }
IEnumerable<CrackWidthSimpleCalculatorResult> RebarResults { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthLogicInputDataSP63 : ICrackWidthLogicInputData
{
public double RebarStrain { get; set; }
public double ConcreteStrain { get; set; }
public double Length { get; set; }
public double TermFactor { get; set; }
public double BondFactor { get; set; }
public double StressStateFactor { get; set; }
public double PsiSFactor { get; set; }
}
}

View File

@@ -9,44 +9,45 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthLogicSP63 : ICrackWidthLogic
{
public double RebarStrain { get; set; }
public double ConcreteStrain { get; set; }
public double Length { get; set; }
public double TermFactor { get; set; }
public double BondFactor { get; set; }
public double StressStateFactor { get; set; }
public double PsiSFactor { get; set; }
CrackWidthLogicInputDataSP63 inputData;
public ICrackWidthLogicInputData InputData {get;set;}
public double GetCrackWidth()
{
CheckOptions();
//check if strain of concrete greater than strain of rebar
if (ConcreteStrain > RebarStrain) { return 0d; }
double width = (RebarStrain - ConcreteStrain) * Length;
width *= TermFactor * BondFactor * StressStateFactor * PsiSFactor;
if (inputData.ConcreteStrain > inputData.RebarStrain) { return 0d; }
double width = (inputData.RebarStrain - inputData.ConcreteStrain) * inputData.Length;
width *= inputData.TermFactor * inputData.BondFactor * inputData.StressStateFactor * inputData.PsiSFactor;
return width;
}
private void CheckOptions()
{
if (Length <=0d)
if (InputData is not CrackWidthLogicInputDataSP63)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": length between cracks L={Length} must be greate than zero");
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType()));
}
if (TermFactor <= 0d)
inputData = InputData as CrackWidthLogicInputDataSP63;
if (inputData.Length <=0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Term factor {TermFactor} must be greate than zero");
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": length between cracks L={inputData.Length} must be greate than zero");
}
if (BondFactor <= 0d)
if (inputData.TermFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {BondFactor} must be greate than zero");
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Term factor {inputData.TermFactor} must be greate than zero");
}
if (StressStateFactor <= 0d)
if (inputData.BondFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {StressStateFactor} must be greate than zero");
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.BondFactor} must be greate than zero");
}
if (PsiSFactor <= 0d)
if (inputData.StressStateFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": PsiS factor {PsiSFactor} must be greate than zero");
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.StressStateFactor} must be greate than zero");
}
if (inputData.PsiSFactor <= 0d)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": PsiS factor {inputData.PsiSFactor} must be greate than zero");
}
}
}

View File

@@ -0,0 +1,45 @@
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthSimpleCalculator : ICalculator
{
ICrackWidthLogic crackWidthLogic = new CrackWidthLogicSP63();
CrackWidthSimpleCalculatorResult result;
public string Name { get; set; }
public ICrackWidthSimpleCalculatorInputData InputData { get; set; }
public IResult Result => result;
public void Run()
{
result = new() { IsValid = true};
var crackWidthLogicType = CrackWidthLogicType.SP63;
var logicInputData = CrackWidthLogicInputDataFactory.GetCrackWidthLogicInputData(crackWidthLogicType, InputData);
crackWidthLogic.InputData = logicInputData;
double crackWidth = 0d;
try
{
crackWidth = crackWidthLogic.GetCrackWidth();
}
catch (Exception ex)
{
result.IsValid = false;
result.Description += "\n" + ex;
}
result.RebarPrimitive = InputData.RebarPrimitive;
result.CrackWidth = crackWidth;
result.RebarStrain = logicInputData.RebarStrain;
result.ConcreteStrain = logicInputData.ConcreteStrain;
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,20 @@
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public class CrackWidthSimpleCalculatorResult : IResult
{
public bool IsValid { get; set; }
public string Description { get; set; }
public RebarPrimitive RebarPrimitive { get; set; }
public double CrackWidth { get; set; }
public double RebarStrain { get; set; }
public double ConcreteStrain { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
using LoaderCalculator.Logics;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.NdmCalculations.Triangulations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
internal enum CrackWidthLogicType
{
SP63
}
internal static class CrackWidthLogicInputDataFactory
{
static IStressLogic stressLogic => new StressLogic();
public static ICrackWidthLogicInputData GetCrackWidthLogicInputData(CrackWidthLogicType logicType, ICrackWidthSimpleCalculatorInputData inputData)
{
if (logicType == CrackWidthLogicType.SP63)
{
CrackWidthLogicInputDataSP63 data = new();
ProcessBaseProps(inputData, data);
if (inputData.CalcTerm == CalcTerms.LongTerm) { data.TermFactor = 1.4d; }
else { data.TermFactor = 1d; }
data.PsiSFactor = inputData.PsiSFactor;
data.StressStateFactor = inputData.StressState is SectionStressStates.Tension ? 1.2d : 1.0d;
return data;
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
}
}
private static void ProcessBaseProps(ICrackWidthSimpleCalculatorInputData inputData, ICrackWidthLogicInputData data)
{
var strainMatrix = StrainTupleService.ConvertToLoaderStrainMatrix(inputData.StrainTuple);
var triangulationOptions = new TriangulationOptions { LimiteState = inputData.LimitState, CalcTerm = inputData.CalcTerm };
var ndms = inputData.RebarPrimitive.GetNdms(triangulationOptions).ToArray();
var concreteNdm = ndms[0];
var rebarNdm = ndms[1];
data.ConcreteStrain = stressLogic.GetTotalStrainWithPresrain(strainMatrix, concreteNdm);
data.RebarStrain = stressLogic.GetTotalStrainWithPresrain(strainMatrix, rebarNdm);
data.Length = inputData.Length;
}
}
}

View File

@@ -0,0 +1,19 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackWidthCalculatorInputData
{
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
StrainTuple StrainTuple { get; set; }
IEnumerable<INdmPrimitive> NdmPrimitives {get;set;}
}
}

View File

@@ -11,18 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
/// </summary>
public interface ICrackWidthLogic
{
/// <summary>
/// strain of rebar, dimensionless
/// </summary>
double RebarStrain { get; set; }
/// <summary>
/// strain of concrete, dimensionless
/// </summary>
double ConcreteStrain { get; set; }
/// <summary>
/// Length between cracks in meters
/// </summary>
double Length { get; set; }
ICrackWidthLogicInputData InputData { get; set; }
/// <summary>
/// return width of crack in meters
/// </summary>

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackWidthLogicInputData
{
/// <summary>
/// strain of rebar, dimensionless
/// </summary>
double RebarStrain { get; set; }
/// <summary>
/// strain of concrete, dimensionless
/// </summary>
double ConcreteStrain { get; set; }
/// <summary>
/// Length between cracks in meters
/// </summary>
double Length { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
public interface ICrackWidthSimpleCalculatorInputData
{
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
StrainTuple StrainTuple { get; set; }
double PsiSFactor { get; set; }
/// <summary>
/// Length between cracks in meters
/// </summary>
double Length { get; set; }
SectionStressStates StressState { get; set; }
RebarPrimitive RebarPrimitive { get; set; }
}
}

View File

@@ -39,7 +39,6 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
};
List<INdm> ndmCollection = new() { concreteNdm, rebarNdm};
//List<INdm> ndmCollection = new() { rebarNdm };
NdmTransform.SetPrestrain(ndmCollection, StrainTupleService.ConvertToLoaderStrainMatrix(options.Prestrain));
return ndmCollection;
}