User data for cracks were added
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
@@ -8,8 +10,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class RebarCrackCalculator : ICalculator
|
||||
{
|
||||
ICrackWidthLogic crackWidthLogic = new CrackWidthLogicSP63();
|
||||
RebarCrackResult result;
|
||||
private ICrackSofteningLogic crackSofteningLogic;
|
||||
private ICrackWidthLogic crackWidthLogic = new CrackWidthLogicSP63();
|
||||
private RebarCrackResult result;
|
||||
private RebarStressResult rebarStressResult;
|
||||
|
||||
public string Name { get; set; }
|
||||
public RebarCrackCalculatorInputData InputData { get; set; }
|
||||
public IResult Result => result;
|
||||
@@ -32,16 +37,36 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
crackWidthLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||
try
|
||||
{
|
||||
GetSofteningLogic(InputData.LongRebarData);
|
||||
rebarStressResult = GetRebarStressResult(InputData.LongRebarData);
|
||||
var dataAcrc1 = GetCrackWidthInputData(InputData.LongRebarData, CalcTerms.LongTerm);
|
||||
var dataAcrc2 = GetCrackWidthInputData(InputData.LongRebarData, CalcTerms.ShortTerm);
|
||||
var dataAcrc3 = GetCrackWidthInputData(InputData.ShortRebarData, CalcTerms.ShortTerm);
|
||||
|
||||
crackWidthLogic.InputData = dataAcrc1;
|
||||
crackWidthLogic.InputData = dataAcrc1;
|
||||
var acrc1 = crackWidthLogic.GetCrackWidth();
|
||||
|
||||
var longRebarResult = new CrackWidthTupleResult()
|
||||
{
|
||||
CrackWidth = acrc1,
|
||||
UltimateCrackWidth = InputData.UserCrackInputData.UltimateLongCrackWidth,
|
||||
RebarStrain = rebarStressResult.RebarStrain,
|
||||
ConcreteStrain = rebarStressResult.ConcreteStrain
|
||||
};
|
||||
|
||||
GetSofteningLogic(InputData.ShortRebarData);
|
||||
rebarStressResult = GetRebarStressResult(InputData.ShortRebarData);
|
||||
var dataAcrc3 = GetCrackWidthInputData(InputData.ShortRebarData, CalcTerms.ShortTerm);
|
||||
|
||||
crackWidthLogic.InputData = dataAcrc2;
|
||||
var acrc2 = crackWidthLogic.GetCrackWidth();
|
||||
crackWidthLogic.InputData = dataAcrc3;
|
||||
var acrc3 = crackWidthLogic.GetCrackWidth();
|
||||
|
||||
double acrcShort = acrc1 - acrc2 + acrc3;
|
||||
TraceLogger?.AddMessage($"Long crack width acrc = acrc,1 = {acrc1}(m)");
|
||||
TraceLogger?.AddMessage($"Short crack width acrc = acrc,1 - acrc,2 + acrc,3 = {acrc1} - {acrc2} + {acrc3} = {acrcShort}(m)");
|
||||
var shortRebarResult = new CrackWidthTupleResult()
|
||||
{
|
||||
CrackWidth = acrcShort,
|
||||
UltimateCrackWidth = InputData.UserCrackInputData.UltimateShortCrackWidth
|
||||
};
|
||||
result.LongTermResult = longRebarResult;
|
||||
}
|
||||
@@ -53,13 +78,35 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
result.RebarPrimitive = InputData.RebarPrimitive;
|
||||
}
|
||||
|
||||
private void GetSofteningLogic(RebarCrackInputData rebarData)
|
||||
{
|
||||
if (InputData.UserCrackInputData.SetSofteningFactor == true)
|
||||
{
|
||||
crackSofteningLogic = new StabSoftetingLogic(InputData.UserCrackInputData.SofteningFactor)
|
||||
{
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
crackSofteningLogic = new RebarStressSofteningLogic()
|
||||
{
|
||||
RebarPrimitive = InputData.RebarPrimitive,
|
||||
InputData = rebarData,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private ICrackWidthLogicInputData GetCrackWidthInputData(RebarCrackInputData inputData, CalcTerms calcTerm)
|
||||
{
|
||||
var factoryInputData = new CrackWidthLogicInputDataFactory()
|
||||
|
||||
var factoryInputData = new CrackWidthLogicInputDataFactory(crackSofteningLogic)
|
||||
{
|
||||
CalcTerm = calcTerm,
|
||||
InputData = inputData,
|
||||
RebarPrimitive = InputData.RebarPrimitive,
|
||||
RebarStrain = rebarStressResult.RebarStrain,
|
||||
ConcreteStrain = rebarStressResult.ConcreteStrain,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
var crackWidthInputData = factoryInputData.GetCrackWidthLogicInputData();
|
||||
@@ -70,5 +117,24 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private RebarStressResult GetRebarStressResult(RebarCrackInputData inputData)
|
||||
{
|
||||
var calculator = new RebarStressCalculator()
|
||||
{
|
||||
ForceTuple = inputData.ForceTuple,
|
||||
NdmCollection = inputData.CrackedNdmCollection,
|
||||
RebarPrimitive = InputData.RebarPrimitive
|
||||
};
|
||||
calculator.Run();
|
||||
var result = calculator.Result as RebarStressResult;
|
||||
if (result.IsValid == false)
|
||||
{
|
||||
string errorString = LoggerStrings.CalculationError + result.Description;
|
||||
TraceLogger?.AddMessage($"Rebar name: {InputData.RebarPrimitive.Name}\n" + errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user