Tests of crack calculator were added
This commit is contained in:
@@ -1,8 +1,17 @@
|
|||||||
namespace StructureHelperCommon.Models.Calculators
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Rate of calculation which based on iteration of finished accuracy
|
||||||
|
/// </summary>
|
||||||
public interface IAccuracy
|
public interface IAccuracy
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Max accuracy of iteration
|
||||||
|
/// </summary>
|
||||||
double IterationAccuracy { get; set; }
|
double IterationAccuracy { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Limit iteration count for calculation
|
||||||
|
/// </summary>
|
||||||
int MaxIterationCount { get; set; }
|
int MaxIterationCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Calculators
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base interface of input data for calculation
|
||||||
|
/// </summary>
|
||||||
public interface IInputData
|
public interface IInputData
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,18 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Calculators
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base interface of result of calculation
|
||||||
|
/// </summary>
|
||||||
public interface IResult
|
public interface IResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if result of calculation is valid
|
/// True if result of calculation is valid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsValid { get; set; }
|
bool IsValid { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Description of result of calculation
|
||||||
|
/// </summary>
|
||||||
string? Description { get; set; }
|
string? Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ namespace StructureHelperCommon.Models
|
|||||||
public interface ITraceLogger
|
public interface ITraceLogger
|
||||||
{
|
{
|
||||||
List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
||||||
void AddMessage(string message, TraceLogStatuses status, int shiftPriority = 0);
|
void AddMessage(string message, TraceLogStatuses status, int shiftPriority);
|
||||||
|
void AddMessage(string message, TraceLogStatuses status);
|
||||||
void AddMessage(string message);
|
void AddMessage(string message);
|
||||||
void AddMessage(string message, int priority);
|
void AddMessage(string message, int priority);
|
||||||
bool KeepErrorStatus { get; set; }
|
bool KeepErrorStatus { get; set; }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace StructureHelperCommon.Models
|
|||||||
KeepErrorStatus = true;
|
KeepErrorStatus = true;
|
||||||
}
|
}
|
||||||
public ShiftTraceLogger() : this(new TraceLogger()) { }
|
public ShiftTraceLogger() : this(new TraceLogger()) { }
|
||||||
public void AddMessage(string message, TraceLogStatuses status, int shiftPrioriry = 0)
|
public void AddMessage(string message, TraceLogStatuses status, int shiftPrioriry)
|
||||||
{
|
{
|
||||||
// if status in (fatal, error, warning) they must be kept as they are
|
// if status in (fatal, error, warning) they must be kept as they are
|
||||||
if (status <= TraceLogStatuses.Warning & KeepErrorStatus == true)
|
if (status <= TraceLogStatuses.Warning & KeepErrorStatus == true)
|
||||||
@@ -62,5 +62,10 @@ namespace StructureHelperCommon.Models
|
|||||||
{
|
{
|
||||||
AddMessage(message, TraceLogStatuses.Info,0);
|
AddMessage(message, TraceLogStatuses.Info,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddMessage(string message, TraceLogStatuses status)
|
||||||
|
{
|
||||||
|
AddMessage(message, status, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace StructureHelperCommon.Models
|
|||||||
KeepErrorStatus = true;
|
KeepErrorStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMessage(string message, TraceLogStatuses status, int shiftPrioriry = 0)
|
public void AddMessage(string message, TraceLogStatuses status, int shiftPrioriry)
|
||||||
{
|
{
|
||||||
if (status == TraceLogStatuses.Fatal) { message = $"Fatal error! {message}"; }
|
if (status == TraceLogStatuses.Fatal) { message = $"Fatal error! {message}"; }
|
||||||
if (status == TraceLogStatuses.Error) { message = $"Error! {message}"; }
|
if (status == TraceLogStatuses.Error) { message = $"Error! {message}"; }
|
||||||
@@ -27,7 +27,7 @@ namespace StructureHelperCommon.Models
|
|||||||
TraceLoggerEntries.Add(new StringLogEntry()
|
TraceLoggerEntries.Add(new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = message,
|
Message = message,
|
||||||
Priority = LoggerService.GetPriorityByStatus(status)
|
Priority = LoggerService.GetPriorityByStatus(status) + shiftPrioriry,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void AddMessage(string message, int priority)
|
public void AddMessage(string message, int priority)
|
||||||
@@ -35,7 +35,7 @@ namespace StructureHelperCommon.Models
|
|||||||
TraceLoggerEntries.Add(new StringLogEntry()
|
TraceLoggerEntries.Add(new StringLogEntry()
|
||||||
{
|
{
|
||||||
Message = message,
|
Message = message,
|
||||||
Priority = priority
|
Priority = priority,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,5 +43,14 @@ namespace StructureHelperCommon.Models
|
|||||||
{
|
{
|
||||||
AddMessage(message, TraceLogStatuses.Info,0);
|
AddMessage(message, TraceLogStatuses.Info,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddMessage(string message, TraceLogStatuses status)
|
||||||
|
{
|
||||||
|
TraceLoggerEntries.Add(new StringLogEntry()
|
||||||
|
{
|
||||||
|
Message = message,
|
||||||
|
Priority = LoggerService.GetPriorityByStatus(status)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
namespace StructureHelperCommon.Models.Shapes
|
namespace StructureHelperCommon.Models.Shapes
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Geomentry primitive of point
|
||||||
|
/// </summary>
|
||||||
public interface IPointShape : IShape
|
public interface IPointShape : IShape
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Area of point
|
||||||
|
/// </summary>
|
||||||
double Area { get; set; }
|
double Area { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
var inputData = new ForceTupleInputData()
|
var inputData = new ForceTupleInputData()
|
||||||
{
|
{
|
||||||
NdmCollection = ndmCollection,
|
NdmCollection = ndmCollection,
|
||||||
Tuple = tuple,
|
ForceTuple = tuple,
|
||||||
Accuracy = accuracy
|
Accuracy = accuracy
|
||||||
};
|
};
|
||||||
var calculator = new ForceTupleCalculator();
|
var calculator = new ForceTupleCalculator();
|
||||||
|
|||||||
@@ -9,11 +9,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public class ForceTupleInputData : IForceTupleInputData
|
public class ForceTupleInputData : IForceTupleInputData
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
public IForceTuple Tuple { get; set; }
|
/// <inheritdoc/>
|
||||||
|
public IForceTuple ForceTuple { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public IAccuracy Accuracy { get; set; }
|
public IAccuracy Accuracy { get; set; }
|
||||||
|
|
||||||
public ForceTupleInputData()
|
public ForceTupleInputData()
|
||||||
{
|
{
|
||||||
Accuracy ??= new Accuracy() { IterationAccuracy = 0.01d, MaxIterationCount = 1000 };
|
Accuracy ??= new Accuracy() { IterationAccuracy = 0.01d, MaxIterationCount = 1000 };
|
||||||
|
|||||||
@@ -9,10 +9,22 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input data for Force Tuple Calculator
|
||||||
|
/// </summary>
|
||||||
public interface IForceTupleInputData : IInputData
|
public interface IForceTupleInputData : IInputData
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndma-parts for calculation
|
||||||
|
/// </summary>
|
||||||
IEnumerable<INdm> NdmCollection { get; set; }
|
IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
IForceTuple Tuple { get; set; }
|
/// <summary>
|
||||||
|
/// Force tuple which is used for calculation
|
||||||
|
/// </summary>
|
||||||
|
IForceTuple ForceTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Settings of iteration
|
||||||
|
/// </summary>
|
||||||
IAccuracy Accuracy { get; set; }
|
IAccuracy Accuracy { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
Mx = point3D.X,
|
Mx = point3D.X,
|
||||||
My = point3D.Y
|
My = point3D.Y
|
||||||
};
|
};
|
||||||
inputData.Tuple = tuple;
|
inputData.ForceTuple = tuple;
|
||||||
inputData.NdmCollection = Ndms;
|
inputData.NdmCollection = Ndms;
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
if (logger is not null)
|
if (logger is not null)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
string errorString = "\nNdm collection is null or empty";
|
string errorString = "\nNdm collection is null or empty";
|
||||||
TraceMessage(errorString);
|
TraceMessage(errorString);
|
||||||
}
|
}
|
||||||
if (InputData.Tuple is null)
|
if (InputData.ForceTuple is null)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
string errorString = "\nForce tuple is null";
|
string errorString = "\nForce tuple is null";
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
TraceService.TraceNdmCollection(TraceLogger, InputData.NdmCollection);
|
TraceService.TraceNdmCollection(TraceLogger, InputData.NdmCollection);
|
||||||
}
|
}
|
||||||
TraceLogger?.AddMessage(string.Intern("Input force combination"));
|
TraceLogger?.AddMessage(string.Intern("Input force combination"));
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(InputData.Tuple));
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(InputData.ForceTuple));
|
||||||
TraceLogger?.AddMessage($"Required accuracy rate {InputData.Accuracy.IterationAccuracy}");
|
TraceLogger?.AddMessage($"Required accuracy rate {InputData.Accuracy.IterationAccuracy}");
|
||||||
TraceLogger?.AddMessage($"Maximum iteration count {InputData.Accuracy.MaxIterationCount}");
|
TraceLogger?.AddMessage($"Maximum iteration count {InputData.Accuracy.MaxIterationCount}");
|
||||||
}
|
}
|
||||||
@@ -131,9 +131,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
MaxIterationCount = InputData.Accuracy.MaxIterationCount,
|
MaxIterationCount = InputData.Accuracy.MaxIterationCount,
|
||||||
StartForceMatrix = new ForceMatrix
|
StartForceMatrix = new ForceMatrix
|
||||||
{
|
{
|
||||||
Mx = InputData.Tuple.Mx,
|
Mx = InputData.ForceTuple.Mx,
|
||||||
My = InputData.Tuple.My,
|
My = InputData.ForceTuple.My,
|
||||||
Nz = InputData.Tuple.Nz
|
Nz = InputData.ForceTuple.Nz
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ActionToOutputResults = ShowResultToTrace,
|
ActionToOutputResults = ShowResultToTrace,
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
|||||||
IForceTupleInputData inputData = new ForceTupleInputData()
|
IForceTupleInputData inputData = new ForceTupleInputData()
|
||||||
{
|
{
|
||||||
NdmCollection = ndmCollection,
|
NdmCollection = ndmCollection,
|
||||||
Tuple = tuple, Accuracy = Accuracy
|
ForceTuple = tuple, Accuracy = Accuracy
|
||||||
};
|
};
|
||||||
IForceTupleCalculator calculator = new ForceTupleCalculator() { InputData = inputData };
|
IForceTupleCalculator calculator = new ForceTupleCalculator() { InputData = inputData };
|
||||||
return calculator;
|
return calculator;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class CheckCrackForceCalculatorInputData : ICheckInputDataLogic<ICrackForceCalculatorInputData>
|
public class CheckCrackForceCalculatorInputDataLogic : ICheckInputDataLogic<ICrackForceCalculatorInputData>
|
||||||
{
|
{
|
||||||
private string checkResult;
|
private string checkResult;
|
||||||
private bool result;
|
private bool result;
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
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 CheckCrackWidthSP63InputDataLogic : ICheckInputDataLogic<CrackWidthLogicInputDataSP63>
|
||||||
|
{
|
||||||
|
private string checkResult;
|
||||||
|
private bool result;
|
||||||
|
|
||||||
|
public CrackWidthLogicInputDataSP63 InputData { get; set; }
|
||||||
|
|
||||||
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public CheckCrackWidthSP63InputDataLogic(IShiftTraceLogger? traceLogger)
|
||||||
|
{
|
||||||
|
this.TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckCrackWidthSP63InputDataLogic() :this(null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
checkResult = string.Empty;
|
||||||
|
string errorString;
|
||||||
|
if (InputData.LengthBetweenCracks <= 0d)
|
||||||
|
{
|
||||||
|
errorString = ErrorStrings.DataIsInCorrect + $": length between cracks Lcrc={InputData.LengthBetweenCracks} must be greater than zero";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.TermFactor <= 0d)
|
||||||
|
{
|
||||||
|
errorString = ErrorStrings.DataIsInCorrect + $": Term factor fi1 {InputData.TermFactor} must be greater than zero";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.BondFactor <= 0d)
|
||||||
|
{
|
||||||
|
errorString = ErrorStrings.DataIsInCorrect + $": Bond factor fi2 {InputData.BondFactor} must be greater than zero";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.StressStateFactor <= 0d)
|
||||||
|
{
|
||||||
|
errorString = ErrorStrings.DataIsInCorrect + $": Stress factor fi3 factor {InputData.StressStateFactor} must be greater than zero";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.PsiSFactor <= 0d)
|
||||||
|
{
|
||||||
|
errorString = ErrorStrings.DataIsInCorrect + $": PsiS factor {InputData.PsiSFactor} must be greater than zero";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString + "\n";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CheckRebarCrackCalculatorInputDataLogic : ICheckInputDataLogic<IRebarCrackCalculatorInputData>
|
||||||
|
{
|
||||||
|
private string checkResult;
|
||||||
|
private bool result;
|
||||||
|
|
||||||
|
public IRebarCrackCalculatorInputData InputData { get; set; }
|
||||||
|
|
||||||
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
checkResult = string.Empty;
|
||||||
|
if (InputData is null)
|
||||||
|
{
|
||||||
|
TraceMessage(ErrorStrings.ParameterIsNull + ": input data");
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.LongRebarData is null)
|
||||||
|
{
|
||||||
|
TraceMessage(ErrorStrings.ParameterIsNull + ": long term input data for rebar");
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.ShortRebarData is null)
|
||||||
|
{
|
||||||
|
TraceMessage(ErrorStrings.ParameterIsNull + ": short term input data for rebar");
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.RebarPrimitive is null)
|
||||||
|
{
|
||||||
|
TraceMessage(ErrorStrings.ParameterIsNull + ": rebar primitive");
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (InputData.UserCrackInputData is null)
|
||||||
|
{
|
||||||
|
TraceMessage(ErrorStrings.ParameterIsNull + ": user crack input data");
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString + "\n";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
|||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public class CheckTupleCalculatorInputData : ICheckInputDataLogic<TupleCrackInputData>
|
public class CheckTupleCalculatorInputDataLogic : ICheckInputDataLogic<TupleCrackInputData>
|
||||||
{
|
{
|
||||||
const string userDataIsNull = "User crack input data is null";
|
const string userDataIsNull = "User crack input data is null";
|
||||||
private const string CollectionOfPrimitivesIsNull = "Collection does not have any primitives";
|
private const string CollectionOfPrimitivesIsNull = "Collection does not have any primitives";
|
||||||
@@ -45,7 +45,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
forceTupleCalculator = new ForceTupleCalculator();
|
forceTupleCalculator = new ForceTupleCalculator();
|
||||||
InputData = new CrackForceCalculatorInputData();
|
InputData = new CrackForceCalculatorInputData();
|
||||||
}
|
}
|
||||||
public CrackForceBynarySearchCalculator() : this(new IsSectionCrackedByFactorLogic(), new CheckCrackForceCalculatorInputData())
|
public CrackForceBynarySearchCalculator() : this(new IsSectionCrackedByFactorLogic(), new CheckCrackForceCalculatorInputDataLogic())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
ForceTupleInputData inputData = new();
|
ForceTupleInputData inputData = new();
|
||||||
inputData.NdmCollection = InputData.SectionNdmCollection;
|
inputData.NdmCollection = InputData.SectionNdmCollection;
|
||||||
inputData.Tuple = forceTuple;
|
inputData.ForceTuple = forceTuple;
|
||||||
forceTupleCalculator.InputData = inputData;
|
forceTupleCalculator.InputData = inputData;
|
||||||
forceTupleCalculator.Run();
|
forceTupleCalculator.Run();
|
||||||
var result = forceTupleCalculator.Result as IForcesTupleResult;
|
var result = forceTupleCalculator.Result as IForcesTupleResult;
|
||||||
|
|||||||
@@ -9,19 +9,54 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Result of crack calculation
|
||||||
|
/// </summary>
|
||||||
public class CrackForceResult : IResult
|
public class CrackForceResult : IResult
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool IsValid { get; set; }
|
public bool IsValid { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// True when section is cracked
|
||||||
|
/// </summary>
|
||||||
public bool IsSectionCracked { get; set; }
|
public bool IsSectionCracked { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Factor of load beetwen start tuple and end tuple when cracks are appeared
|
||||||
|
/// </summary>
|
||||||
public double FactorOfCrackAppearance { get; set; }
|
public double FactorOfCrackAppearance { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Start force tuple of range where force of cracking is looking for
|
||||||
|
/// </summary>
|
||||||
public IForceTuple StartTuple { get; set; }
|
public IForceTuple StartTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// End force tuple of range where force of cracking is looking for
|
||||||
|
/// </summary>
|
||||||
public IForceTuple EndTuple { get; set; }
|
public IForceTuple EndTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Force tuple which correspondent to first crack appearence
|
||||||
|
/// </summary>
|
||||||
public IForceTuple TupleOfCrackAppearance { get; set; }
|
public IForceTuple TupleOfCrackAppearance { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// General curvature in cracked section
|
||||||
|
/// </summary>
|
||||||
public StrainTuple CrackedStrainTuple { get; set; }
|
public StrainTuple CrackedStrainTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Average general curvature with considering of cracking
|
||||||
|
/// </summary>
|
||||||
public StrainTuple ReducedStrainTuple { get; set; }
|
public StrainTuple ReducedStrainTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Factor of softening of stifness with considering of cracks
|
||||||
|
/// </summary>
|
||||||
public StrainTuple SofteningFactors { get; set; }
|
public StrainTuple SofteningFactors { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndms which crack properties looking for
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Common softening factor
|
||||||
|
/// </summary>
|
||||||
public double PsiS { get; set; }
|
public double PsiS { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public class CrackInputDataUpdateStrategy : IUpdateStrategy<CrackCalculatorInputData>
|
public class CrackInputDataUpdateStrategy : IUpdateStrategy<CrackCalculatorInputData>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy;
|
private IUpdateStrategy<IUserCrackInputData> userCrackInputDataUpdateStrategy;
|
||||||
public CrackInputDataUpdateStrategy(IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy)
|
public CrackInputDataUpdateStrategy(IUpdateStrategy<IUserCrackInputData> userCrackInputDataUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.userCrackInputDataUpdateStrategy = userCrackInputDataUpdateStrategy;
|
this.userCrackInputDataUpdateStrategy = userCrackInputDataUpdateStrategy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,188 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CrackWidthCalculationLogic : ICrackWidthCalculationLogic
|
||||||
|
{
|
||||||
|
private ICrackWidthLogic crackWidthLogic;
|
||||||
|
private RebarCrackResult result;
|
||||||
|
private ICrackSofteningLogic crackSofteningLogic;
|
||||||
|
private RebarStressResult rebarStressResult;
|
||||||
|
private ICrackWidthLogicInputData acrc2InputData;
|
||||||
|
private ICrackWidthLogicInputData acrc1InputData;
|
||||||
|
private ICrackWidthLogicInputData acrc3InputData;
|
||||||
|
/// <summary>
|
||||||
|
/// Width of crack from long term loads with long term properties of concrete
|
||||||
|
/// </summary>
|
||||||
|
private double longTermLoadLongTermConcreteCrackWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Width of crack from full (include short term) loads with short term properties of concrete
|
||||||
|
/// </summary>
|
||||||
|
private double fullLoadShortConcreteCrackWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Width of crack from long term loads with short term properties of concrete
|
||||||
|
/// </summary>
|
||||||
|
private double longTermLoadShortConcreteWidth;
|
||||||
|
private IRebarStressCalculator rebarStressCalculator;
|
||||||
|
|
||||||
|
public IRebarCrackCalculatorInputData InputData { get; set; }
|
||||||
|
public RebarCrackResult Result => result;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public CrackWidthCalculationLogic(IRebarStressCalculator rebarStressCalculator, ICrackWidthLogic crackWidthLogic, IShiftTraceLogger? traceLogger)
|
||||||
|
{
|
||||||
|
this.rebarStressCalculator = rebarStressCalculator;
|
||||||
|
this.crackWidthLogic = crackWidthLogic;
|
||||||
|
this.TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackWidthCalculationLogic() : this (new RebarStressCalculator(), new CrackWidthLogicSP63(), null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
PrepareNewResult();
|
||||||
|
ProcessCrackWidthCalculation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareNewResult()
|
||||||
|
{
|
||||||
|
result = new()
|
||||||
|
{
|
||||||
|
IsValid = true,
|
||||||
|
Description = string.Empty,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessCrackWidthCalculation()
|
||||||
|
{
|
||||||
|
CrackWidthRebarTupleResult longRebarResult = ProcessLongTermCalculations();
|
||||||
|
CrackWidthRebarTupleResult shortRebarResult = ProcessShortTermCalculations();
|
||||||
|
result.LongTermResult = longRebarResult;
|
||||||
|
result.ShortTermResult = shortRebarResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackWidthRebarTupleResult ProcessShortTermCalculations()
|
||||||
|
{
|
||||||
|
crackSofteningLogic = GetSofteningLogic(InputData.ShortRebarData);
|
||||||
|
rebarStressResult = GetRebarStressResult(InputData.ShortRebarData);
|
||||||
|
acrc2InputData = GetCrackWidthInputData(crackSofteningLogic, InputData.ShortRebarData, CalcTerms.ShortTerm);
|
||||||
|
|
||||||
|
crackWidthLogic.InputData = acrc3InputData;
|
||||||
|
longTermLoadShortConcreteWidth = crackWidthLogic.GetCrackWidth();
|
||||||
|
crackWidthLogic.InputData = acrc2InputData;
|
||||||
|
fullLoadShortConcreteCrackWidth = crackWidthLogic.GetCrackWidth();
|
||||||
|
|
||||||
|
double acrcShort = longTermLoadLongTermConcreteCrackWidth + fullLoadShortConcreteCrackWidth - longTermLoadShortConcreteWidth;
|
||||||
|
TraceLogger?.AddMessage($"Short crack width acrc = acrc,1 + acrc,2 - acrc,3 = {longTermLoadLongTermConcreteCrackWidth} + {fullLoadShortConcreteCrackWidth} - {longTermLoadShortConcreteWidth} = {acrcShort}(m)");
|
||||||
|
var shortRebarResult = new CrackWidthRebarTupleResult()
|
||||||
|
{
|
||||||
|
CrackWidth = acrcShort,
|
||||||
|
UltimateCrackWidth = InputData.UserCrackInputData.UltimateShortCrackWidth,
|
||||||
|
RebarStressResult = rebarStressResult,
|
||||||
|
SofteningFactor = crackSofteningLogic.GetSofteningFactor()
|
||||||
|
};
|
||||||
|
TraceCrackResult(shortRebarResult);
|
||||||
|
return shortRebarResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackWidthRebarTupleResult ProcessLongTermCalculations()
|
||||||
|
{
|
||||||
|
crackSofteningLogic = GetSofteningLogic(InputData.LongRebarData);
|
||||||
|
rebarStressResult = GetRebarStressResult(InputData.LongRebarData);
|
||||||
|
acrc1InputData = GetCrackWidthInputData(crackSofteningLogic, InputData.LongRebarData, CalcTerms.LongTerm);
|
||||||
|
acrc3InputData = GetCrackWidthInputData(crackSofteningLogic, InputData.LongRebarData, CalcTerms.ShortTerm);
|
||||||
|
crackWidthLogic.InputData = acrc1InputData;
|
||||||
|
longTermLoadLongTermConcreteCrackWidth = crackWidthLogic.GetCrackWidth();
|
||||||
|
var longRebarResult = new CrackWidthRebarTupleResult()
|
||||||
|
{
|
||||||
|
CrackWidth = longTermLoadLongTermConcreteCrackWidth,
|
||||||
|
UltimateCrackWidth = InputData.UserCrackInputData.UltimateLongCrackWidth,
|
||||||
|
RebarStressResult = rebarStressResult,
|
||||||
|
SofteningFactor = crackSofteningLogic.GetSofteningFactor()
|
||||||
|
};
|
||||||
|
TraceLogger?.AddMessage($"Long crack width acrc = acrc,1 = {longTermLoadLongTermConcreteCrackWidth}(m)");
|
||||||
|
TraceLogger?.AddMessage($"Ultimate long crack width acrc,ult = {longRebarResult.UltimateCrackWidth}(m)");
|
||||||
|
TraceCrackResult(longRebarResult);
|
||||||
|
return longRebarResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceCrackResult(CrackWidthRebarTupleResult rebarResult)
|
||||||
|
{
|
||||||
|
if (rebarResult.IsCrackLessThanUltimate == false)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Checking crack width is failure, actual crack width acrc = {rebarResult.CrackWidth} > ultimate crack width acrc,ult = {rebarResult.UltimateCrackWidth}", TraceLogStatuses.Warning);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Checking crack width is ok, actual crack width acrc = {rebarResult.CrackWidth} <= ultimate crack width acrc,ult = {rebarResult.UltimateCrackWidth}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICrackSofteningLogic GetSofteningLogic(IRebarCrackInputData rebarData)
|
||||||
|
{
|
||||||
|
ICrackSofteningLogic crackSofteningLogic;
|
||||||
|
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)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return crackSofteningLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICrackWidthLogicInputData GetCrackWidthInputData(ICrackSofteningLogic crackSofteningLogic, IRebarCrackInputData inputData, CalcTerms calcTerm)
|
||||||
|
{
|
||||||
|
|
||||||
|
var factoryInputData = new CrackWidthLogicInputDataFactory(crackSofteningLogic)
|
||||||
|
{
|
||||||
|
CalcTerm = calcTerm,
|
||||||
|
InputData = inputData,
|
||||||
|
RebarStrain = rebarStressResult.RebarStrain,
|
||||||
|
ConcreteStrain = rebarStressResult.ConcreteStrain,
|
||||||
|
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||||
|
};
|
||||||
|
var crackWidthInputData = factoryInputData.GetCrackWidthLogicInputData();
|
||||||
|
return crackWidthInputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RebarStressResult GetRebarStressResult(IRebarCrackInputData inputData)
|
||||||
|
{
|
||||||
|
rebarStressCalculator.InputData.ForceTuple = inputData.ForceTuple;
|
||||||
|
rebarStressCalculator.InputData.NdmCollection = inputData.CrackedNdmCollection;
|
||||||
|
rebarStressCalculator.InputData.RebarPrimitive = InputData.RebarPrimitive;
|
||||||
|
rebarStressCalculator.Run();
|
||||||
|
var result = rebarStressCalculator.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public double RebarStrain { get; set; }
|
public double RebarStrain { get; set; }
|
||||||
public double ConcreteStrain { get; set; }
|
public double ConcreteStrain { get; set; }
|
||||||
public double Length { get; set; }
|
public double LengthBetweenCracks { get; set; }
|
||||||
public double TermFactor { get; set; }
|
public double TermFactor { get; set; }
|
||||||
public double BondFactor { get; set; }
|
public double BondFactor { get; set; }
|
||||||
public double StressStateFactor { get; set; }
|
public double StressStateFactor { get; set; }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
using StructureHelperCommon.Models.Loggers;
|
||||||
using System;
|
using System;
|
||||||
@@ -6,76 +7,85 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class CrackWidthLogicSP63 : ICrackWidthLogic
|
public class CrackWidthLogicSP63 : ICrackWidthLogic
|
||||||
{
|
{
|
||||||
CrackWidthLogicInputDataSP63 inputData;
|
CrackWidthLogicInputDataSP63 inputData;
|
||||||
|
private double widthOfCrack;
|
||||||
|
private ICheckInputDataLogic<CrackWidthLogicInputDataSP63> checkInputDataLogic;
|
||||||
|
|
||||||
public ICrackWidthLogicInputData InputData {get;set;}
|
public ICrackWidthLogicInputData InputData {get;set;}
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public CrackWidthLogicSP63(ICheckInputDataLogic<CrackWidthLogicInputDataSP63> checkInputDataLogic, IShiftTraceLogger? traceLogger)
|
||||||
|
{
|
||||||
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
|
this.TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrackWidthLogicSP63() : this (new CheckCrackWidthSP63InputDataLogic(), null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public double GetCrackWidth()
|
public double GetCrackWidth()
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018");
|
|
||||||
CheckOptions();
|
CheckOptions();
|
||||||
TraceLogger?.AddMessage($"Term factor fi1 = {inputData.TermFactor}", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018");
|
||||||
TraceLogger?.AddMessage($"Bond factor fi2 = {inputData.BondFactor}", TraceLogStatuses.Service);
|
TraceInputData();
|
||||||
TraceLogger?.AddMessage($"Stress state factor fi3 = {inputData.StressStateFactor}", TraceLogStatuses.Service);
|
|
||||||
TraceLogger?.AddMessage($"PsiS factor PsiS = {inputData.PsiSFactor}", TraceLogStatuses.Service);
|
|
||||||
TraceLogger?.AddMessage($"Length between cracks Ls = {inputData.Length}", TraceLogStatuses.Service);
|
|
||||||
//check if strain of concrete greater than strain of rebar
|
//check if strain of concrete greater than strain of rebar
|
||||||
|
CalculateWidthOfCrack();
|
||||||
|
return widthOfCrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalculateWidthOfCrack()
|
||||||
|
{
|
||||||
double rebarElongation = inputData.RebarStrain - inputData.ConcreteStrain;
|
double rebarElongation = inputData.RebarStrain - inputData.ConcreteStrain;
|
||||||
if (rebarElongation < 0d)
|
if (rebarElongation < 0d)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Elongation of rebar is negative, may be rebar is under compression, width of crack a,crc = 0");
|
TraceLogger?.AddMessage($"Elongation of rebar is negative, may be rebar is under compression, width of crack a,crc = 0");
|
||||||
return 0d;
|
widthOfCrack = 0d;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
TraceLogger?.AddMessage($"Rebar elongation Epsilon = {inputData.RebarStrain} - {inputData.ConcreteStrain} = {rebarElongation}(dimensionless)");
|
TraceLogger?.AddMessage($"Rebar elongation Epsilon = {inputData.RebarStrain} - {inputData.ConcreteStrain} = {rebarElongation}(dimensionless)");
|
||||||
double width = rebarElongation * inputData.Length;
|
widthOfCrack = rebarElongation * inputData.LengthBetweenCracks;
|
||||||
width *= inputData.TermFactor * inputData.BondFactor * inputData.StressStateFactor * inputData.PsiSFactor;
|
widthOfCrack *= inputData.TermFactor * inputData.BondFactor * inputData.StressStateFactor * inputData.PsiSFactor;
|
||||||
TraceLogger?.AddMessage($"Width of crack a,crc = {inputData.TermFactor} * {inputData.BondFactor} * {inputData.StressStateFactor} * {inputData.PsiSFactor} * {rebarElongation} * {inputData.Length}(m) = {width}(m)");
|
TraceLogger?.AddMessage($"Width of crack a,crc = {inputData.TermFactor} * {inputData.BondFactor} * {inputData.StressStateFactor} * {inputData.PsiSFactor} * {rebarElongation} * {inputData.LengthBetweenCracks}(m) = {widthOfCrack}(m)");
|
||||||
return width;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckOptions()
|
private void TraceInputData()
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Term factor fi1 = {inputData.TermFactor}", TraceLogStatuses.Service);
|
||||||
|
TraceLogger?.AddMessage($"Bond factor fi2 = {inputData.BondFactor}", TraceLogStatuses.Service);
|
||||||
|
TraceLogger?.AddMessage($"Stress state factor fi3 = {inputData.StressStateFactor}", TraceLogStatuses.Service);
|
||||||
|
TraceLogger?.AddMessage($"PsiS factor PsiS = {inputData.PsiSFactor}", TraceLogStatuses.Service);
|
||||||
|
TraceLogger?.AddMessage($"Length between cracks Ls = {inputData.LengthBetweenCracks}", TraceLogStatuses.Service);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckOptions()
|
||||||
{
|
{
|
||||||
string errorString = string.Empty;
|
string errorString = string.Empty;
|
||||||
if (InputData is not CrackWidthLogicInputDataSP63)
|
if (InputData is not CrackWidthLogicInputDataSP63)
|
||||||
{
|
{
|
||||||
errorString = ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType());
|
errorString = ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType());
|
||||||
}
|
|
||||||
inputData = InputData as CrackWidthLogicInputDataSP63;
|
|
||||||
if (inputData.Length <=0d)
|
|
||||||
{
|
|
||||||
errorString = ErrorStrings.DataIsInCorrect + $": length between cracks Lcrc={inputData.Length} must be greater than zero";
|
|
||||||
}
|
|
||||||
if (inputData.TermFactor <= 0d)
|
|
||||||
{
|
|
||||||
errorString = ErrorStrings.DataIsInCorrect + $": Term factor fi1 {inputData.TermFactor} must be greater than zero";
|
|
||||||
|
|
||||||
}
|
|
||||||
if (inputData.BondFactor <= 0d)
|
|
||||||
{
|
|
||||||
errorString = ErrorStrings.DataIsInCorrect + $": Bond factor fi2 {inputData.BondFactor} must be greater than zero";
|
|
||||||
|
|
||||||
}
|
|
||||||
if (inputData.StressStateFactor <= 0d)
|
|
||||||
{
|
|
||||||
errorString = ErrorStrings.DataIsInCorrect + $": Stress factor fi3 factor {inputData.StressStateFactor} must be greater than zero";
|
|
||||||
|
|
||||||
}
|
|
||||||
if (inputData.PsiSFactor <= 0d)
|
|
||||||
{
|
|
||||||
errorString = ErrorStrings.DataIsInCorrect + $": PsiS factor {inputData.PsiSFactor} must be greater than zero";
|
|
||||||
}
|
|
||||||
if (errorString != string.Empty)
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
|
||||||
throw new StructureHelperException(errorString);
|
throw new StructureHelperException(errorString);
|
||||||
}
|
}
|
||||||
|
inputData = InputData as CrackWidthLogicInputDataSP63;
|
||||||
|
checkInputDataLogic.InputData = inputData;
|
||||||
|
checkInputDataLogic.TraceLogger = TraceLogger;
|
||||||
|
if (checkInputDataLogic.Check() != true)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
TraceLogger?.AddMessage($"Checking parameters has done succefully", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage($"Checking parameters has done succefully", TraceLogStatuses.Service);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public double ConcreteStrain { get; set;}
|
public double ConcreteStrain { get; set;}
|
||||||
|
|
||||||
public CalcTerms CalcTerm { get; set; }
|
public CalcTerms CalcTerm { get; set; }
|
||||||
public RebarCrackInputData InputData { get; set; }
|
public IRebarCrackInputData InputData { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public CrackWidthLogicInputDataFactory(ICrackSofteningLogic softeningLogic)
|
public CrackWidthLogicInputDataFactory(ICrackSofteningLogic softeningLogic)
|
||||||
@@ -58,7 +58,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
data.PsiSFactor = softeningLogic.GetSofteningFactor();
|
data.PsiSFactor = softeningLogic.GetSofteningFactor();
|
||||||
data.StressStateFactor = stressStateFactorLogic.GetStressStateFactor();
|
data.StressStateFactor = stressStateFactorLogic.GetStressStateFactor();
|
||||||
data.BondFactor = 0.5d;
|
data.BondFactor = 0.5d;
|
||||||
data.Length = InputData.LengthBeetwenCracks;
|
data.LengthBetweenCracks = InputData.LengthBeetwenCracks;
|
||||||
data.ConcreteStrain = ConcreteStrain;
|
data.ConcreteStrain = ConcreteStrain;
|
||||||
data.RebarStrain = RebarStrain;
|
data.RebarStrain = RebarStrain;
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public interface ICrackWidthCalculationLogic : ILogic
|
||||||
|
{
|
||||||
|
IRebarCrackCalculatorInputData InputData { get; set; }
|
||||||
|
RebarCrackResult Result { get; }
|
||||||
|
|
||||||
|
void Run();
|
||||||
|
CrackWidthRebarTupleResult ProcessLongTermCalculations();
|
||||||
|
CrackWidthRebarTupleResult ProcessShortTermCalculations();
|
||||||
|
RebarStressResult GetRebarStressResult(IRebarCrackInputData inputData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public interface ICrackWidthLogicInputData
|
public interface ICrackWidthLogicInputData : IInputData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// strain of rebar, dimensionless
|
/// strain of rebar, dimensionless
|
||||||
@@ -19,6 +20,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Length between cracks in meters
|
/// Length between cracks in meters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double Length { get; set; }
|
double LengthBetweenCracks { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input data for rebar crack calculator
|
||||||
|
/// </summary>
|
||||||
|
public interface IRebarCrackCalculatorInputData : IInputData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Long term rebar data
|
||||||
|
/// </summary>
|
||||||
|
IRebarCrackInputData? LongRebarData { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Short term rebar data
|
||||||
|
/// </summary>
|
||||||
|
IRebarCrackInputData? ShortRebarData { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Rebar primitive
|
||||||
|
/// </summary>
|
||||||
|
IRebarPrimitive RebarPrimitive { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// User settings for crack calculations
|
||||||
|
/// </summary>
|
||||||
|
IUserCrackInputData UserCrackInputData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input data for calculating of width of crack by ndm collection
|
||||||
|
/// </summary>
|
||||||
|
public interface IRebarCrackInputData : IInputData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndms where work of crackable material in tension was assigned according to material properties
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<INdm> CrackableNdmCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndms where work of concrete is disabled
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<INdm> CrackedNdmCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Force tuple for calculation
|
||||||
|
/// </summary>
|
||||||
|
ForceTuple ForceTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Base length beetwen cracks
|
||||||
|
/// </summary>
|
||||||
|
double LengthBeetwenCracks { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public interface IRebarStressCalculator : ICalculator
|
||||||
|
{
|
||||||
|
IRebarStressCalculatorInputData InputData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input data for rebar stress calculator
|
||||||
|
/// </summary>
|
||||||
|
public interface IRebarStressCalculatorInputData : IInputData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Force tuple for calculting
|
||||||
|
/// </summary>
|
||||||
|
ForceTuple ForceTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndms of cross-section (as usual without concrete tensile strength)
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Rebar which stress and strain will be obtained for
|
||||||
|
/// </summary>
|
||||||
|
IRebarPrimitive RebarPrimitive { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public interface IUserCrackInputData : IInputData
|
||||||
|
{
|
||||||
|
double LengthBetweenCracks { get; set; }
|
||||||
|
bool SetLengthBetweenCracks { get; set; }
|
||||||
|
bool SetSofteningFactor { get; set; }
|
||||||
|
double SofteningFactor { get; set; }
|
||||||
|
double UltimateLongCrackWidth { get; set; }
|
||||||
|
double UltimateShortCrackWidth { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
var inputData = new ForceTupleInputData()
|
var inputData = new ForceTupleInputData()
|
||||||
{
|
{
|
||||||
Accuracy = Accuracy,
|
Accuracy = Accuracy,
|
||||||
Tuple = Tuple,
|
ForceTuple = Tuple,
|
||||||
NdmCollection = SectionNdmCollection
|
NdmCollection = SectionNdmCollection
|
||||||
};
|
};
|
||||||
var calculator = new ForceTupleCalculator() { InputData = inputData };
|
var calculator = new ForceTupleCalculator() { InputData = inputData };
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
@@ -10,10 +11,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public class RebarCrackCalculator : IRebarCrackCalculator
|
public class RebarCrackCalculator : IRebarCrackCalculator
|
||||||
{
|
{
|
||||||
private ICrackSofteningLogic crackSofteningLogic;
|
private ICrackWidthCalculationLogic crackWidthCalculationLogic;
|
||||||
private ICrackWidthLogic crackWidthLogic = new CrackWidthLogicSP63();
|
|
||||||
private RebarCrackResult result;
|
private RebarCrackResult result;
|
||||||
private RebarStressResult rebarStressResult;
|
private ICheckInputDataLogic<IRebarCrackCalculatorInputData> checkInputDataLogic;
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public RebarCrackCalculatorInputData InputData { get; set; }
|
public RebarCrackCalculatorInputData InputData { get; set; }
|
||||||
@@ -22,139 +22,89 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public RebarCrackCalculator(ICheckInputDataLogic<IRebarCrackCalculatorInputData> checkInputDataLogic,
|
||||||
|
ICrackWidthCalculationLogic crackWidthCalculationLogic,
|
||||||
|
IShiftTraceLogger? traceLogger)
|
||||||
|
{
|
||||||
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
|
this.crackWidthCalculationLogic = crackWidthCalculationLogic;
|
||||||
|
this.TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RebarCrackCalculator()
|
||||||
|
: this(new CheckRebarCrackCalculatorInputDataLogic(),
|
||||||
|
new CrackWidthCalculationLogic(),
|
||||||
|
null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Debug);
|
||||||
result = new()
|
|
||||||
{
|
|
||||||
IsValid = true
|
|
||||||
};
|
|
||||||
TraceLogger?.AddMessage($"Rebar primitive {InputData.RebarPrimitive.Name}");
|
TraceLogger?.AddMessage($"Rebar primitive {InputData.RebarPrimitive.Name}");
|
||||||
|
PrepareNewResult();
|
||||||
|
if (CheckInputData() != true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//double acrc1 = GetCrackWidth()
|
|
||||||
|
|
||||||
|
|
||||||
crackWidthLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GetSofteningLogic(InputData.LongRebarData);
|
ProcessCrackWidthCalculation();
|
||||||
rebarStressResult = GetRebarStressResult(InputData.LongRebarData);
|
|
||||||
var dataAcrc1 = GetCrackWidthInputData(InputData.LongRebarData, CalcTerms.LongTerm);
|
|
||||||
var dataAcrc3 = GetCrackWidthInputData(InputData.LongRebarData, CalcTerms.ShortTerm);
|
|
||||||
crackWidthLogic.InputData = dataAcrc1;
|
|
||||||
var acrc1 = crackWidthLogic.GetCrackWidth();
|
|
||||||
var longRebarResult = new CrackWidthRebarTupleResult()
|
|
||||||
{
|
|
||||||
CrackWidth = acrc1,
|
|
||||||
UltimateCrackWidth = InputData.UserCrackInputData.UltimateLongCrackWidth,
|
|
||||||
RebarStressResult = rebarStressResult,
|
|
||||||
SofteningFactor = crackSofteningLogic.GetSofteningFactor()
|
|
||||||
};
|
|
||||||
TraceLogger?.AddMessage($"Long crack width acrc = acrc,1 = {acrc1}(m)");
|
|
||||||
TraceLogger?.AddMessage($"Ultimate long crack width acrc,ult = {longRebarResult.UltimateCrackWidth}(m)");
|
|
||||||
TraceCrackResult(longRebarResult);
|
|
||||||
|
|
||||||
|
|
||||||
GetSofteningLogic(InputData.ShortRebarData);
|
|
||||||
rebarStressResult = GetRebarStressResult(InputData.ShortRebarData);
|
|
||||||
var dataAcrc2 = GetCrackWidthInputData(InputData.ShortRebarData, CalcTerms.ShortTerm);
|
|
||||||
|
|
||||||
crackWidthLogic.InputData = dataAcrc3;
|
|
||||||
var acrc3 = crackWidthLogic.GetCrackWidth();
|
|
||||||
crackWidthLogic.InputData = dataAcrc2;
|
|
||||||
var acrc2 = crackWidthLogic.GetCrackWidth();
|
|
||||||
|
|
||||||
double acrcShort = acrc1 + acrc2 - acrc3;
|
|
||||||
TraceLogger?.AddMessage($"Short crack width acrc = acrc,1 + acrc,2 - acrc,3 = {acrc1} + {acrc2} - {acrc3} = {acrcShort}(m)");
|
|
||||||
var shortRebarResult = new CrackWidthRebarTupleResult()
|
|
||||||
{
|
|
||||||
CrackWidth = acrcShort,
|
|
||||||
UltimateCrackWidth = InputData.UserCrackInputData.UltimateShortCrackWidth,
|
|
||||||
RebarStressResult = rebarStressResult,
|
|
||||||
SofteningFactor = crackSofteningLogic.GetSofteningFactor()
|
|
||||||
};
|
|
||||||
TraceCrackResult(shortRebarResult);
|
|
||||||
result.LongTermResult = longRebarResult;
|
|
||||||
result.ShortTermResult = shortRebarResult;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ProcessIncorrectCalculation(ex);
|
||||||
|
}
|
||||||
|
result.RebarPrimitive = InputData.RebarPrimitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckInputData()
|
||||||
|
{
|
||||||
|
checkInputDataLogic.InputData = InputData;
|
||||||
|
checkInputDataLogic.TraceLogger = TraceLogger;
|
||||||
|
if (checkInputDataLogic.Check() == true)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description += checkInputDataLogic.CheckResult;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessIncorrectCalculation(Exception ex)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Error of crack width calculation {ex}", TraceLogStatuses.Error);
|
TraceLogger?.AddMessage($"Error of crack width calculation {ex}", TraceLogStatuses.Error);
|
||||||
result.IsValid = false;
|
result.IsValid = false;
|
||||||
result.Description += "\n" + ex;
|
result.Description += "\n" + ex;
|
||||||
}
|
}
|
||||||
result.RebarPrimitive = InputData.RebarPrimitive;
|
|
||||||
|
private void ProcessCrackWidthCalculation()
|
||||||
|
{
|
||||||
|
crackWidthCalculationLogic.TraceLogger = TraceLogger;
|
||||||
|
crackWidthCalculationLogic.InputData = InputData;
|
||||||
|
crackWidthCalculationLogic.Run();
|
||||||
|
if (crackWidthCalculationLogic.Result.IsValid == true)
|
||||||
|
{
|
||||||
|
result = crackWidthCalculationLogic.Result;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description += crackWidthCalculationLogic.Result.Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TraceCrackResult(CrackWidthRebarTupleResult rebarResult)
|
private void PrepareNewResult()
|
||||||
{
|
{
|
||||||
if (rebarResult.IsCrackLessThanUltimate == false)
|
result = new()
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Checking crack width is failure, actual crack width acrc = {rebarResult.CrackWidth} > ultimate crack width acrc,ult = {rebarResult.UltimateCrackWidth}", TraceLogStatuses.Warning);
|
IsValid = true,
|
||||||
}
|
Description = string.Empty,
|
||||||
else
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage($"Checking crack width is ok, actual crack width acrc = {rebarResult.CrackWidth} <= ultimate crack width acrc,ult = {rebarResult.UltimateCrackWidth}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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(crackSofteningLogic)
|
|
||||||
{
|
|
||||||
CalcTerm = calcTerm,
|
|
||||||
InputData = inputData,
|
|
||||||
RebarStrain = rebarStressResult.RebarStrain,
|
|
||||||
ConcreteStrain = rebarStressResult.ConcreteStrain,
|
|
||||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
|
||||||
};
|
|
||||||
var crackWidthInputData = factoryInputData.GetCrackWidthLogicInputData();
|
|
||||||
return crackWidthInputData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,15 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class of input data for rebar crack calculator
|
/// Class of input data for rebar crack calculator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RebarCrackCalculatorInputData : IInputData
|
public class RebarCrackCalculatorInputData : IRebarCrackCalculatorInputData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Long term rebar data
|
public IRebarCrackInputData? LongRebarData { get; set; }
|
||||||
/// </summary>
|
/// <inheritdoc/>
|
||||||
public RebarCrackInputData? LongRebarData { get; set; }
|
public IRebarCrackInputData? ShortRebarData { get; set; }
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Short term rebar data
|
public IRebarPrimitive RebarPrimitive { get; set; }
|
||||||
/// </summary>
|
/// <inheritdoc/>
|
||||||
public RebarCrackInputData? ShortRebarData { get; set; }
|
public IUserCrackInputData? UserCrackInputData { get; set; }
|
||||||
public RebarPrimitive RebarPrimitive { get; set; }
|
|
||||||
public UserCrackInputData UserCrackInputData { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,23 +11,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class RebarCrackInputData : IInputData
|
/// <inheritdoc/>
|
||||||
|
public class RebarCrackInputData : IRebarCrackInputData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Collection of ndms where work of crackable material in tension was assigned according to material properties
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<INdm> CrackableNdmCollection { get; set; }
|
public IEnumerable<INdm> CrackableNdmCollection { get; set; }
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Collection of ndms where work of concrete is disabled
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<INdm> CrackedNdmCollection { get; set; }
|
public IEnumerable<INdm> CrackedNdmCollection { get; set; }
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Force tuple for calculation
|
|
||||||
/// </summary>
|
|
||||||
public ForceTuple ForceTuple { get; set; }
|
public ForceTuple ForceTuple { get; set; }
|
||||||
/// <summary>
|
/// <inheritdoc/>
|
||||||
/// Base length beetwen cracks
|
|
||||||
/// </summary>
|
|
||||||
public double LengthBeetwenCracks { get; set; }
|
public double LengthBeetwenCracks { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specific rebar primitive
|
/// Specific rebar primitive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RebarPrimitive RebarPrimitive { get; set; }
|
public IRebarPrimitive RebarPrimitive { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Result of calculation of crack for long term
|
/// Result of calculation of crack for long term
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,28 +12,75 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class RebarStressCalculator : ICalculator
|
public class RebarStressCalculator : IRebarStressCalculator
|
||||||
{
|
{
|
||||||
|
private const CalcTerms termOfLoadForCrackCalculation = CalcTerms.ShortTerm;
|
||||||
|
private const LimitStates limitStateForCrackCalcultion = LimitStates.SLS;
|
||||||
private IStressLogic stressLogic;
|
private IStressLogic stressLogic;
|
||||||
private Ndm concreteNdm;
|
private Ndm concreteNdm;
|
||||||
private RebarNdm rebarNdm;
|
private RebarNdm rebarNdm;
|
||||||
private RebarStressResult result;
|
private RebarStressResult result;
|
||||||
|
|
||||||
public ForceTuple ForceTuple { get; set; }
|
public IRebarStressCalculatorInputData InputData { get; set; }
|
||||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
|
||||||
public RebarPrimitive RebarPrimitive { get; set; }
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public IResult Result => result;
|
public IResult Result => result;
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public StrainTuple GetStrainTuple()
|
|
||||||
|
public RebarStressCalculator(IStressLogic stressLogic)
|
||||||
|
{
|
||||||
|
this.stressLogic = stressLogic;
|
||||||
|
InputData = new RebarStressCalculatorInputData();
|
||||||
|
}
|
||||||
|
public RebarStressCalculator() : this(new StressLogic())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
PrepareNewResult();
|
||||||
|
if (CheckInputData() != true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GetNdmCollectionByPrimitives();
|
||||||
|
ProcessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckInputData()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessResult()
|
||||||
|
{
|
||||||
|
var strainTuple = GetStrainTuple();
|
||||||
|
result.StrainTuple = strainTuple;
|
||||||
|
var strainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||||
|
result.RebarStrain = stressLogic.GetSectionStrain(strainMatrix, rebarNdm);
|
||||||
|
result.RebarStress = stressLogic.GetStress(strainMatrix, rebarNdm);
|
||||||
|
result.ConcreteStrain = -concreteNdm.Prestrain;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareNewResult()
|
||||||
|
{
|
||||||
|
result = new RebarStressResult()
|
||||||
|
{
|
||||||
|
IsValid = true,
|
||||||
|
Description = string.Empty
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private StrainTuple GetStrainTuple()
|
||||||
{
|
{
|
||||||
IForceTupleInputData inputData = new ForceTupleInputData()
|
IForceTupleInputData inputData = new ForceTupleInputData()
|
||||||
{
|
{
|
||||||
NdmCollection = NdmCollection,
|
NdmCollection = InputData.NdmCollection,
|
||||||
Tuple = ForceTuple
|
ForceTuple = InputData.ForceTuple
|
||||||
};
|
};
|
||||||
IForceTupleCalculator calculator = new ForceTupleCalculator()
|
IForceTupleCalculator calculator = new ForceTupleCalculator()
|
||||||
{
|
{
|
||||||
@@ -50,45 +97,19 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||||
return strain;
|
return strain;
|
||||||
}
|
}
|
||||||
public RebarStressCalculator(IStressLogic stressLogic)
|
|
||||||
{
|
|
||||||
this.stressLogic = stressLogic;
|
|
||||||
}
|
|
||||||
public RebarStressCalculator() : this(new StressLogic())
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
private void GetNdmCollectionByPrimitives()
|
||||||
|
|
||||||
|
|
||||||
public void Run()
|
|
||||||
{
|
|
||||||
GetNdmCollectionFromPrimitives();
|
|
||||||
result = new RebarStressResult()
|
|
||||||
{
|
|
||||||
IsValid = true,
|
|
||||||
Description = string.Empty
|
|
||||||
};
|
|
||||||
var strainTuple = GetStrainTuple();
|
|
||||||
result.StrainTuple = strainTuple;
|
|
||||||
var strainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
|
||||||
result.RebarStrain = stressLogic.GetSectionStrain(strainMatrix, rebarNdm);
|
|
||||||
result.RebarStress = stressLogic.GetStress(strainMatrix, rebarNdm);
|
|
||||||
result.ConcreteStrain = - concreteNdm.Prestrain;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void GetNdmCollectionFromPrimitives()
|
|
||||||
{
|
{
|
||||||
var options = new TriangulationOptions()
|
var options = new TriangulationOptions()
|
||||||
{
|
{
|
||||||
CalcTerm = CalcTerms.ShortTerm,
|
CalcTerm = termOfLoadForCrackCalculation,
|
||||||
LimiteState = LimitStates.SLS,
|
LimiteState = limitStateForCrackCalcultion,
|
||||||
};
|
};
|
||||||
concreteNdm = RebarPrimitive.GetConcreteNdm(options);
|
concreteNdm = InputData.RebarPrimitive.GetConcreteNdm(options);
|
||||||
concreteNdm.StressScale = 1d;
|
concreteNdm.StressScale = 1d;
|
||||||
rebarNdm = RebarPrimitive.GetRebarNdm(options);
|
rebarNdm = InputData.RebarPrimitive.GetRebarNdm(options);
|
||||||
}
|
}
|
||||||
|
/// <inheritdoc/>
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public class RebarStressCalculatorInputData : IRebarStressCalculatorInputData
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public ForceTuple ForceTuple { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IRebarPrimitive RebarPrimitive { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,15 +8,30 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Result of calculation of stress and strain in rebar
|
||||||
|
/// </summary>
|
||||||
public class RebarStressResult : IResult
|
public class RebarStressResult : IResult
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool IsValid { get; set; }
|
public bool IsValid { get; set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Strain tuple which stress and strain is obtained for
|
||||||
|
/// </summary>
|
||||||
public StrainTuple StrainTuple { get; set; }
|
public StrainTuple StrainTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Stress in rebar, Pa
|
||||||
|
/// </summary>
|
||||||
public double RebarStress { get; set; }
|
public double RebarStress { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Strain in rebar, dimensionless
|
||||||
|
/// </summary>
|
||||||
public double RebarStrain { get; set; }
|
public double RebarStrain { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Strain in fake concrete ndm-part which rounds rebas and locatade at axis of rebar (refrence strain in concrete)
|
||||||
|
/// </summary>
|
||||||
public double ConcreteStrain { get; set; }
|
public double ConcreteStrain { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// Rebar resul for actual force combination
|
/// Rebar resul for actual force combination
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private RebarStressResult actualRebarResult;
|
private RebarStressResult actualRebarResult;
|
||||||
|
private TriangulationOptions options;
|
||||||
|
|
||||||
private INdm? concreteNdm;
|
private INdm? concreteNdm;
|
||||||
private INdm? rebarNdm;
|
private INdm? rebarNdm;
|
||||||
|
|
||||||
@@ -38,8 +37,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private double rebarActualStress;
|
private double rebarActualStress;
|
||||||
private double softeningFactor;
|
private double softeningFactor;
|
||||||
private double minValueOfFactor = 0.2d;
|
private double minValueOfFactor = 0.2d;
|
||||||
private RebarPrimitive rebarPrimitive;
|
private IRebarPrimitive rebarPrimitive;
|
||||||
private RebarCrackInputData inputData;
|
private IRebarCrackInputData inputData;
|
||||||
|
|
||||||
public double MinValueOfFactor
|
public double MinValueOfFactor
|
||||||
{
|
{
|
||||||
@@ -49,7 +48,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
IsResultActual = false;
|
IsResultActual = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public RebarPrimitive RebarPrimitive
|
public IRebarPrimitive RebarPrimitive
|
||||||
{
|
{
|
||||||
get => rebarPrimitive; set
|
get => rebarPrimitive; set
|
||||||
{
|
{
|
||||||
@@ -57,7 +56,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
IsResultActual = false;
|
IsResultActual = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public RebarCrackInputData InputData
|
public IRebarCrackInputData InputData
|
||||||
{
|
{
|
||||||
get => inputData; set
|
get => inputData; set
|
||||||
{
|
{
|
||||||
@@ -72,7 +71,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
if (IsResultActual == false)
|
if (IsResultActual == false)
|
||||||
{
|
{
|
||||||
GetNdms();
|
GetRebarAndConcreteNdms();
|
||||||
softeningFactor = GetPsiSFactor(InputData.ForceTuple, InputData.CrackableNdmCollection);
|
softeningFactor = GetPsiSFactor(InputData.ForceTuple, InputData.CrackableNdmCollection);
|
||||||
IsResultActual = true;
|
IsResultActual = true;
|
||||||
}
|
}
|
||||||
@@ -80,9 +79,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetNdms()
|
private void GetRebarAndConcreteNdms()
|
||||||
{
|
{
|
||||||
var options = new TriangulationOptions()
|
options = new TriangulationOptions()
|
||||||
{
|
{
|
||||||
CalcTerm = CalcTerms.ShortTerm,
|
CalcTerm = CalcTerms.ShortTerm,
|
||||||
LimiteState = LimitStates.SLS,
|
LimiteState = LimitStates.SLS,
|
||||||
@@ -92,10 +91,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
rebarNdm = RebarPrimitive.GetRebarNdm(options);
|
rebarNdm = RebarPrimitive.GetRebarNdm(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double GetPsiSFactor(ForceTuple forceTuple, IEnumerable<INdm> crackableNndms)
|
private double GetPsiSFactor(ForceTuple forceTuple, IEnumerable<INdm> crackableNdms)
|
||||||
{
|
{
|
||||||
|
|
||||||
var crackResult = calculateCrackTuples(forceTuple, crackableNndms);
|
var crackResult = calculateCrackTuples(forceTuple, crackableNdms);
|
||||||
if (crackResult.IsValid == false)
|
if (crackResult.IsValid == false)
|
||||||
{
|
{
|
||||||
string errorString = LoggerStrings.CalculationError + crackResult.Description;
|
string errorString = LoggerStrings.CalculationError + crackResult.Description;
|
||||||
@@ -103,7 +102,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
throw new StructureHelperException(errorString);
|
throw new StructureHelperException(errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
actualRebarResult = GetRebarStressResult(forceTuple);
|
actualRebarResult = GetRebarStressResultByForceTuple(forceTuple);
|
||||||
rebarActualStrain = actualRebarResult.RebarStrain;
|
rebarActualStrain = actualRebarResult.RebarStrain;
|
||||||
rebarActualStress = actualRebarResult.RebarStress;
|
rebarActualStress = actualRebarResult.RebarStress;
|
||||||
TraceLogger?.AddMessage($"Actual strain of rebar EpsilonS = {rebarActualStrain}(dimensionless)");
|
TraceLogger?.AddMessage($"Actual strain of rebar EpsilonS = {rebarActualStrain}(dimensionless)");
|
||||||
@@ -120,7 +119,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
TraceLogger?.AddMessage($"Section is cracked in start force combination, PsiS = 1.0");
|
TraceLogger?.AddMessage($"Section is cracked in start force combination, PsiS = 1.0");
|
||||||
return 1d;
|
return 1d;
|
||||||
}
|
}
|
||||||
crackRebarResult = GetRebarStressResult(crackResult.TupleOfCrackAppearance as ForceTuple);
|
crackRebarResult = GetRebarStressResultByForceTuple(crackResult.TupleOfCrackAppearance as ForceTuple);
|
||||||
|
|
||||||
var stressInCracking = crackRebarResult.RebarStress;
|
var stressInCracking = crackRebarResult.RebarStress;
|
||||||
TraceLogger?.AddMessage($"Stress in rebar immediately after cracking Sigma,scrc = {stressInCracking}(Pa)");
|
TraceLogger?.AddMessage($"Stress in rebar immediately after cracking Sigma,scrc = {stressInCracking}(Pa)");
|
||||||
@@ -165,14 +164,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
return calculator.Result as CrackForceResult;
|
return calculator.Result as CrackForceResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RebarStressResult GetRebarStressResult(ForceTuple forceTuple)
|
private RebarStressResult GetRebarStressResultByForceTuple(ForceTuple forceTuple)
|
||||||
{
|
{
|
||||||
var calculator = new RebarStressCalculator()
|
var calculator = new RebarStressCalculator();
|
||||||
{
|
calculator.InputData.ForceTuple = forceTuple;
|
||||||
ForceTuple = forceTuple,
|
calculator.InputData.NdmCollection = InputData.CrackedNdmCollection;
|
||||||
NdmCollection = InputData.CrackedNdmCollection,
|
calculator.InputData.RebarPrimitive = RebarPrimitive;
|
||||||
RebarPrimitive = RebarPrimitive
|
|
||||||
};
|
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = calculator.Result as RebarStressResult;
|
var result = calculator.Result as RebarStressResult;
|
||||||
if (result.IsValid == false)
|
if (result.IsValid == false)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
this.checkInputDataLogic = checkInputDataLogic;
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TupleCrackCalculator() : this (new CheckTupleCalculatorInputData())
|
public TupleCrackCalculator() : this (new CheckTupleCalculatorInputDataLogic())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
IForceTupleInputData inputData = new ForceTupleInputData()
|
IForceTupleInputData inputData = new ForceTupleInputData()
|
||||||
{
|
{
|
||||||
NdmCollection = ndms,
|
NdmCollection = ndms,
|
||||||
Tuple = forceTuple
|
ForceTuple = forceTuple
|
||||||
};
|
};
|
||||||
IForceTupleCalculator calculator = new ForceTupleCalculator()
|
IForceTupleCalculator calculator = new ForceTupleCalculator()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,24 +10,24 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Settings for crack calculations assigned by user
|
/// Settings for crack calculations assigned by user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserCrackInputData : IInputData
|
public class UserCrackInputData : IUserCrackInputData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag of assigning of user value of softening factor
|
/// Flag of assigning of user value of softening factor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SetSofteningFactor {get;set;}
|
public bool SetSofteningFactor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User value of softening factor, dimensionless
|
/// User value of softening factor, dimensionless
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double SofteningFactor {get;set;}
|
public double SofteningFactor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flag of assigning of user value of length between cracks
|
/// Flag of assigning of user value of length between cracks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SetLengthBetweenCracks {get;set;}
|
public bool SetLengthBetweenCracks { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Length between cracks, m
|
/// Length between cracks, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double LengthBetweenCracks {get;set;}
|
public double LengthBetweenCracks { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ultimate long-term crack width, m
|
/// Ultimate long-term crack width, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
internal class UserCrackInputDataUpdateStrategy : IUpdateStrategy<UserCrackInputData>
|
internal class UserCrackInputDataUpdateStrategy : IUpdateStrategy<IUserCrackInputData>
|
||||||
{
|
{
|
||||||
public void Update(UserCrackInputData targetObject, UserCrackInputData sourceObject)
|
public void Update(IUserCrackInputData targetObject, IUserCrackInputData sourceObject)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Geometry primitive of point
|
||||||
|
/// </summary>
|
||||||
public interface IPointPrimitive : INdmPrimitive, IPointShape
|
public interface IPointPrimitive : INdmPrimitive, IPointShape
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Geometry primitive of rebar (bar of reinforcement)
|
||||||
|
/// </summary>
|
||||||
public interface IRebarPrimitive : IPointPrimitive, IHasHostPrimitive
|
public interface IRebarPrimitive : IPointPrimitive, IHasHostPrimitive
|
||||||
{
|
{
|
||||||
Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions);
|
Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
|||||||
{
|
{
|
||||||
public class RCSectionsTest
|
public class RCSectionsTest
|
||||||
{
|
{
|
||||||
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, false, -0.00068654617067958799d, -0.0030411189808055242d, 0.00034289928716916179d)]
|
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, false, -0.00068471024318306586d, -0.0030411189808055242d, 0.00034289928716916179d)]
|
||||||
public void Run_ShouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, bool isBuckling, double expectedKx, double expectedKy, double expectedEpsZ)
|
public void Run_ShouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, bool isBuckling, double expectedKx, double expectedKy, double expectedEpsZ)
|
||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace StructureHelperTests.UnitTests.Calcuators
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
||||||
_mockInputData.Setup(x => x.Tuple).Returns((IForceTuple)null);
|
_mockInputData.Setup(x => x.ForceTuple).Returns((IForceTuple)null);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = _checkLogic.Check();
|
var result = _checkLogic.Check();
|
||||||
@@ -78,7 +78,7 @@ namespace StructureHelperTests.UnitTests.Calcuators
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
||||||
_mockInputData.Setup(x => x.Tuple).Returns(new ForceTuple());
|
_mockInputData.Setup(x => x.ForceTuple).Returns(new ForceTuple());
|
||||||
_mockInputData.Setup(x => x.Accuracy).Returns((IAccuracy)null);
|
_mockInputData.Setup(x => x.Accuracy).Returns((IAccuracy)null);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -99,7 +99,7 @@ namespace StructureHelperTests.UnitTests.Calcuators
|
|||||||
mockAccuracy.Setup(x => x.MaxIterationCount).Returns(0);
|
mockAccuracy.Setup(x => x.MaxIterationCount).Returns(0);
|
||||||
|
|
||||||
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
||||||
_mockInputData.Setup(x => x.Tuple).Returns(new ForceTuple());
|
_mockInputData.Setup(x => x.ForceTuple).Returns(new ForceTuple());
|
||||||
_mockInputData.Setup(x => x.Accuracy).Returns(mockAccuracy.Object);
|
_mockInputData.Setup(x => x.Accuracy).Returns(mockAccuracy.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -121,7 +121,7 @@ namespace StructureHelperTests.UnitTests.Calcuators
|
|||||||
mockAccuracy.Setup(x => x.MaxIterationCount).Returns(10);
|
mockAccuracy.Setup(x => x.MaxIterationCount).Returns(10);
|
||||||
|
|
||||||
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm> { new Mock<INdm>().Object });
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm> { new Mock<INdm>().Object });
|
||||||
_mockInputData.Setup(x => x.Tuple).Returns(new ForceTuple());
|
_mockInputData.Setup(x => x.ForceTuple).Returns(new ForceTuple());
|
||||||
_mockInputData.Setup(x => x.Accuracy).Returns(mockAccuracy.Object);
|
_mockInputData.Setup(x => x.Accuracy).Returns(mockAccuracy.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using Moq;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
public class CrackWidthCalculationLogicTests
|
||||||
|
{
|
||||||
|
private Mock<IRebarStressCalculator> _calculator;
|
||||||
|
private Mock<ICrackWidthLogic> _mockCrackWidthLogic;
|
||||||
|
private Mock<IShiftTraceLogger> _mockTraceLogger;
|
||||||
|
private CrackWidthCalculationLogic _logic;
|
||||||
|
private IRebarCrackCalculatorInputData _inputData;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_calculator = new Mock<IRebarStressCalculator>();
|
||||||
|
_mockCrackWidthLogic = new Mock<ICrackWidthLogic>();
|
||||||
|
_mockTraceLogger = new Mock<IShiftTraceLogger>();
|
||||||
|
_inputData = new RebarCrackCalculatorInputData
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
_inputData.UserCrackInputData = new UserCrackInputData();
|
||||||
|
|
||||||
|
_logic = new CrackWidthCalculationLogic(_calculator.Object, _mockCrackWidthLogic.Object, _mockTraceLogger.Object)
|
||||||
|
{
|
||||||
|
InputData = _inputData
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Run_ShouldPrepareNewResultAndProcessCalculations()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_mockCrackWidthLogic.Setup(m => m.GetCrackWidth())
|
||||||
|
.Returns(0.5); // Mock the GetCrackWidth method
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_logic.Run();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.NotNull(_logic.Result);
|
||||||
|
Assert.IsTrue(_logic.Result.IsValid);
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>()), Times.AtLeastOnce);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLongTermCalculation_ShouldReturnExpectedResult()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_mockCrackWidthLogic.SetupSequence(m => m.GetCrackWidth())
|
||||||
|
.Returns(0.5) // longTermLoadLongTermConcreteCrackWidth
|
||||||
|
.Returns(0.2); // longTermLoadShortConcreteWidth
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _logic.ProcessLongTermCalculations();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.NotNull(result);
|
||||||
|
Assert.AreEqual(0.5, result.CrackWidth);
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>()), Times.AtLeastOnce);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessShortTermCalculations_ShouldReturnExpectedResult()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_mockCrackWidthLogic.SetupSequence(m => m.GetCrackWidth())
|
||||||
|
.Returns(0.2) // longTermLoadShortConcreteWidth
|
||||||
|
.Returns(0.3); // fullLoadShortConcreteCrackWidth
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _logic.ProcessShortTermCalculations();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.NotNull(result);
|
||||||
|
Assert.AreEqual(0.0, result.CrackWidth); // Assuming acrcShort would be 0 in this scenario
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>()), Times.AtLeastOnce);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetRebarStressResult_ShouldReturnValidResult()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var mockRebarStressCalculator = new Mock<IRebarStressCalculator>();
|
||||||
|
var expectedResult = new RebarStressResult { IsValid = true };
|
||||||
|
mockRebarStressCalculator.Setup(c => c.Run());
|
||||||
|
mockRebarStressCalculator.Setup(c => c.Result).Returns(expectedResult);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _logic.GetRebarStressResult(_inputData.ShortRebarData);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.NotNull(result);
|
||||||
|
Assert.IsTrue(result.IsValid);
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage(It.IsAny<string>(), TraceLogStatuses.Error), Times.Never);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks
|
|||||||
PsiSFactor = 1d,
|
PsiSFactor = 1d,
|
||||||
RebarStrain = rebarStrain,
|
RebarStrain = rebarStrain,
|
||||||
ConcreteStrain = concreteStrain,
|
ConcreteStrain = concreteStrain,
|
||||||
Length = length
|
LengthBetweenCracks = length
|
||||||
};
|
};
|
||||||
var logic = new CrackWidthLogicSP63() { InputData = inputData };
|
var logic = new CrackWidthLogicSP63() { InputData = inputData };
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using Moq;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.UnitTests.Ndms.Cracks.InputDataTests
|
||||||
|
{
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
public class CrackWidthCalculationLogicTests
|
||||||
|
{
|
||||||
|
private Mock<IRebarStressCalculator> _calculator;
|
||||||
|
private Mock<ICrackWidthLogic> mockCrackWidthLogic;
|
||||||
|
private Mock<IShiftTraceLogger> mockTraceLogger;
|
||||||
|
private Mock<IRebarCrackCalculatorInputData> mockInputData;
|
||||||
|
private Mock<IUserCrackInputData> mockUserCrackInputData;
|
||||||
|
private Mock<IRebarPrimitive> mockRebarPrimitive;
|
||||||
|
private Mock<IRebarStressCalculator> mockRebarStressCalculator;
|
||||||
|
private CrackWidthCalculationLogic crackWidthCalculationLogic;
|
||||||
|
private Mock<IRebarCrackInputData> mockRebarCrackInputData;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_calculator = new Mock<IRebarStressCalculator>();
|
||||||
|
mockCrackWidthLogic = new Mock<ICrackWidthLogic>();
|
||||||
|
mockTraceLogger = new Mock<IShiftTraceLogger>();
|
||||||
|
mockInputData = new Mock<IRebarCrackCalculatorInputData>();
|
||||||
|
mockUserCrackInputData = new Mock<IUserCrackInputData>();
|
||||||
|
mockRebarPrimitive = new Mock<IRebarPrimitive>();
|
||||||
|
mockRebarStressCalculator = new Mock<IRebarStressCalculator>();
|
||||||
|
mockRebarCrackInputData = new Mock<IRebarCrackInputData>();
|
||||||
|
|
||||||
|
mockInputData.Setup(x => x.UserCrackInputData).Returns(mockUserCrackInputData.Object);
|
||||||
|
mockInputData.Setup(x => x.LongRebarData).Returns(mockRebarCrackInputData.Object);
|
||||||
|
mockInputData.Setup(x => x.ShortRebarData).Returns(mockRebarCrackInputData.Object);
|
||||||
|
mockInputData.Setup(x => x.RebarPrimitive).Returns(mockRebarPrimitive.Object);
|
||||||
|
|
||||||
|
mockRebarCrackInputData.Setup(x => x.ForceTuple).Returns(new ForceTuple());
|
||||||
|
|
||||||
|
crackWidthCalculationLogic = new CrackWidthCalculationLogic(_calculator.Object, mockCrackWidthLogic.Object, mockTraceLogger.Object)
|
||||||
|
{
|
||||||
|
InputData = mockInputData.Object
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Run_ShouldPrepareNewResultAndProcessCalculations()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
mockCrackWidthLogic.Setup(x => x.GetCrackWidth()).Returns(0.5);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
crackWidthCalculationLogic.Run();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
mockCrackWidthLogic.Verify(x => x.GetCrackWidth(), Times.AtLeastOnce);
|
||||||
|
Assert.IsNotNull(crackWidthCalculationLogic.Result);
|
||||||
|
Assert.IsTrue(crackWidthCalculationLogic.Result.IsValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessShortTermCalculations_ShouldCalculateCorrectShortTermCrackWidth()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
mockUserCrackInputData.Setup(x => x.UltimateShortCrackWidth).Returns(1.0);
|
||||||
|
mockCrackWidthLogic.SetupSequence(x => x.GetCrackWidth())
|
||||||
|
.Returns(0.6) // longTermLoadShortConcreteWidth
|
||||||
|
.Returns(0.8); // fullLoadShortConcreteCrackWidth
|
||||||
|
|
||||||
|
crackWidthCalculationLogic.InputData = mockInputData.Object;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var shortTermResult = crackWidthCalculationLogic.ProcessShortTermCalculations();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(1.2, shortTermResult.CrackWidth);
|
||||||
|
Assert.AreEqual(1.0, shortTermResult.UltimateCrackWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLongTermCalculations_ShouldCalculateCorrectLongTermCrackWidth()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
mockUserCrackInputData.Setup(x => x.UltimateLongCrackWidth).Returns(1.2);
|
||||||
|
mockCrackWidthLogic.Setup(x => x.GetCrackWidth()).Returns(0.9);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var longTermResult = crackWidthCalculationLogic.ProcessLongTermCalculations();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(0.9, longTermResult.CrackWidth);
|
||||||
|
Assert.AreEqual(1.2, longTermResult.UltimateCrackWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,12 +10,12 @@ namespace StructureHelperTests.UnitTests.Ndms.Cracks.InputDataTests;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CheckTupleCalculatorInputDataTests
|
public class CheckTupleCalculatorInputDataTests
|
||||||
{
|
{
|
||||||
private CheckTupleCalculatorInputData _checkTupleCalculatorInputData;
|
private CheckTupleCalculatorInputDataLogic _checkTupleCalculatorInputData;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
_checkTupleCalculatorInputData = new CheckTupleCalculatorInputData();
|
_checkTupleCalculatorInputData = new CheckTupleCalculatorInputDataLogic();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
Reference in New Issue
Block a user