diff --git a/StructureHelper/Libraries/LoaderCalculator.dll b/StructureHelper/Libraries/LoaderCalculator.dll
index d31e226..53f5bf2 100644
Binary files a/StructureHelper/Libraries/LoaderCalculator.dll and b/StructureHelper/Libraries/LoaderCalculator.dll differ
diff --git a/StructureHelperCommon/Models/Materials/ICrackedMaterial.cs b/StructureHelperCommon/Models/Materials/ICrackedMaterial.cs
new file mode 100644
index 0000000..0643713
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/ICrackedMaterial.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials
+{
+ public interface ICrackedMaterial
+ {
+ bool TensionForULS { get; set; }
+ bool TensionForSLS { get; set; }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/IConcreteLibMaterial.cs b/StructureHelperLogics/Models/Materials/IConcreteLibMaterial.cs
index ee1fd73..1b8c339 100644
--- a/StructureHelperLogics/Models/Materials/IConcreteLibMaterial.cs
+++ b/StructureHelperLogics/Models/Materials/IConcreteLibMaterial.cs
@@ -1,4 +1,5 @@
-using StructureHelperCommon.Models.Materials.Libraries;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperCommon.Models.Materials.Libraries;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,10 +8,8 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Materials
{
- public interface IConcreteLibMaterial : ILibMaterial
+ public interface IConcreteLibMaterial : ILibMaterial, ICrackedMaterial
{
- bool TensionForULS { get; set; }
- bool TensionForSLS { get; set; }
///
/// Humidity of concrete
///
diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
index 6d4803d..1101562 100644
--- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
+++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/ForceCalculator.cs
@@ -40,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var checkResult = CheckInputData();
- if (checkResult != "")
+ if (checkResult != string.Empty)
{
Result = new ForcesResults()
{
@@ -49,11 +49,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
};
return;
}
- else
- {
- GetCombinations();
- CalculateResult();
- }
+ GetCombinations();
+ CalculateResult();
}
private void CalculateResult()
@@ -199,18 +196,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private string CheckInputData()
{
- string result = "";
- try
+ string result = string.Empty;
+ if (! Primitives.Any())
{
- triangulateLogic = new TriangulatePrimitiveLogic()
- {
- Primitives = Primitives
- };
- triangulateLogic.CheckPrimitives(Primitives);
- }
- catch (Exception ex)
- {
- result += ex;
+ result += "Calculator does not contain any primitives \n";
}
if (ForceActions.Count == 0)
{
@@ -222,8 +211,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
}
if (CalcTermsList.Count == 0)
{
- result += "Calculator does not contain any duration \n";
+ result += "Calculator does not contain any calc term \n";
}
+ //try
+ //{
+ // triangulateLogic = new TriangulatePrimitiveLogic()
+ // {
+ // Primitives = Primitives
+ // };
+ // triangulateLogic.CheckPrimitives(Primitives);
+ //}
+ //catch (Exception ex)
+ //{
+ // result += ex;
+ //}
return result;
}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/AverageDiameterLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/AverageDiameterLogic.cs
index 23cde59..5cade83 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/AverageDiameterLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/AverageDiameterLogic.cs
@@ -1,5 +1,7 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,22 +13,30 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public class AverageDiameterLogic : IAverageDiameterLogic
{
public IEnumerable Rebars { get; set; }
+ public IShiftTraceLogger? TraceLogger { get; set; }
public double GetAverageDiameter()
{
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
Check();
var rebarArea = Rebars
.Sum(x => x.Area);
+ TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
var rebarCount = Rebars.Count();
+ TraceLogger?.AddMessage($"Rebar count n = {rebarCount}");
var averageArea = rebarArea / rebarCount;
+ TraceLogger?.AddMessage($"Average rebar area As = {averageArea}");
var diameter = Math.Sqrt(averageArea / Math.PI);
+ TraceLogger?.AddMessage($"Average rebar diameter ds = {diameter}");
return diameter;
}
private void Check()
{
if (!Rebars.Any())
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": rebars count must be greater then zero");
+ string errorString = ErrorStrings.DataIsInCorrect + $": rebars count must be greater then zero";
+ TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorString);
}
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/CrackWidthLogicSP63.cs b/StructureHelperLogics/NdmCalculations/Cracking/CrackWidthLogicSP63.cs
index 3a9637f..371cf48 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/CrackWidthLogicSP63.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/CrackWidthLogicSP63.cs
@@ -1,4 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,9 +13,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
CrackWidthLogicInputDataSP63 inputData;
public ICrackWidthLogicInputData InputData {get;set;}
+ public IShiftTraceLogger? TraceLogger { get; set; }
public double GetCrackWidth()
{
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ TraceLogger?.AddMessage("Method of crack width calculation based on SP 63.13330.2018");
CheckOptions();
//check if strain of concrete greater than strain of rebar
if (inputData.ConcreteStrain > inputData.RebarStrain) { return 0d; }
@@ -24,31 +29,42 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private void CheckOptions()
{
+ string errorString = string.Empty;
if (InputData is not CrackWidthLogicInputDataSP63)
{
- throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType()));
+ errorString = ErrorStrings.ExpectedWas(typeof(CrackWidthLogicInputDataSP63), InputData.GetType());
}
inputData = InputData as CrackWidthLogicInputDataSP63;
if (inputData.Length <=0d)
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": length between cracks L={inputData.Length} must be greate than zero");
+ errorString = ErrorStrings.DataIsInCorrect + $": length between cracks L={inputData.Length} must be greate than zero";
}
if (inputData.TermFactor <= 0d)
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Term factor {inputData.TermFactor} must be greate than zero");
+ errorString = ErrorStrings.DataIsInCorrect + $": Term factor {inputData.TermFactor} must be greate than zero";
+
}
if (inputData.BondFactor <= 0d)
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.BondFactor} must be greate than zero");
+ errorString = ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.BondFactor} must be greate than zero";
+
}
if (inputData.StressStateFactor <= 0d)
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.StressStateFactor} must be greate than zero");
+ errorString = ErrorStrings.DataIsInCorrect + $": Bond factor {inputData.StressStateFactor} must be greate than zero";
+
}
if (inputData.PsiSFactor <= 0d)
{
- throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": PsiS factor {inputData.PsiSFactor} must be greate than zero");
+ errorString = ErrorStrings.DataIsInCorrect + $": PsiS factor {inputData.PsiSFactor} must be greate than zero";
+
}
+ if (errorString != string.Empty)
+ {
+ TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorString);
+ }
+
}
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/CrackedSectionTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/CrackedSectionTriangulationLogic.cs
new file mode 100644
index 0000000..b4dd4c5
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Cracking/CrackedSectionTriangulationLogic.cs
@@ -0,0 +1,82 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperLogics.Models.Primitives;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using StructureHelperLogics.Services.NdmPrimitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.NdmCalculations.Cracking
+{
+ public class CrackedSectionTriangulationLogic : ICrackedSectionTriangulationLogic
+ {
+ const LimitStates limitState = LimitStates.SLS;
+ const CalcTerms shortTerm = CalcTerms.ShortTerm;
+
+ private ITriangulatePrimitiveLogic triangulateLogic;
+ private string ndmPrimitiveCountMessage;
+
+ public IEnumerable NdmPrimitives { get; private set; }
+ public IShiftTraceLogger? TraceLogger { get; set; }
+ public CrackedSectionTriangulationLogic(IEnumerable ndmPrimitives)
+ {
+ NdmPrimitives = ndmPrimitives;
+ ndmPrimitiveCountMessage = $"Source collection containes {NdmPrimitives.Count()} primitives";
+ triangulateLogic = new TriangulatePrimitiveLogic
+ {
+ Primitives = NdmPrimitives,
+ LimitState = limitState,
+ CalcTerm = shortTerm,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
+ }
+ public List GetNdmCollection()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
+ triangulateLogic = new TriangulatePrimitiveLogic()
+ {
+ LimitState = limitState,
+ CalcTerm = shortTerm,
+ Primitives = NdmPrimitives,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
+ return triangulateLogic.GetNdms();
+ }
+ public List GetCrackedNdmCollection()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
+ triangulateLogic = new TriangulatePrimitiveLogic(new MeshCrackedConcreteLogic())
+ {
+ LimitState = limitState,
+ CalcTerm = shortTerm,
+ Primitives = NdmPrimitives,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
+ return triangulateLogic.GetNdms();
+ }
+
+ public List GetRebarPrimitives()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ TraceLogger?.AddMessage(ndmPrimitiveCountMessage, TraceLogStatuses.Debug);
+ List rebarPrimitives = new();
+ foreach (var item in NdmPrimitives)
+ {
+ if (item is RebarPrimitive rebar)
+ {
+ TraceLogger?.AddMessage($"Primitive {rebar.Name} is rebar primitive", TraceLogStatuses.Service);
+ rebarPrimitives.Add(rebar);
+ }
+ }
+ TraceLogger?.AddMessage($"Obtained {rebarPrimitives.Count} rebar primitives");
+ return rebarPrimitives;
+ }
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/IAverageDiameterLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/IAverageDiameterLogic.cs
index 8ff8be3..573d15e 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/IAverageDiameterLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/IAverageDiameterLogic.cs
@@ -1,4 +1,5 @@
using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Cracking
{
- public interface IAverageDiameterLogic
+ public interface IAverageDiameterLogic : ILogic
{
IEnumerable Rebars { get; set; }
double GetAverageDiameter();
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/ICrackWidthLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/ICrackWidthLogic.cs
index 532995f..df024c5 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/ICrackWidthLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/ICrackWidthLogic.cs
@@ -1,4 +1,5 @@
-using System;
+using StructureHelperCommon.Infrastructures.Interfaces;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -9,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
///
/// Logic for calculating width of crack
///
- public interface ICrackWidthLogic
+ public interface ICrackWidthLogic : ILogic
{
ICrackWidthLogicInputData InputData { get; set; }
///
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/ICrackedSectionTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/ICrackedSectionTriangulationLogic.cs
new file mode 100644
index 0000000..2dd8afb
--- /dev/null
+++ b/StructureHelperLogics/NdmCalculations/Cracking/ICrackedSectionTriangulationLogic.cs
@@ -0,0 +1,37 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.NdmCalculations.Cracking
+{
+ ///
+ /// Logic for obtaining of collection of nms elementary part for regular and fully cracked section
+ ///
+ public interface ICrackedSectionTriangulationLogic : ILogic
+ {
+ ///
+ /// Source collection of ndm primitives
+ ///
+ IEnumerable NdmPrimitives { get; }
+ ///
+ /// Returns collection of ndm elementary parts
+ ///
+ ///
+ List GetNdmCollection();
+ ///
+ /// Returns collection of ndm elementary parts where concrete doesn't work in tension
+ ///
+ ///
+ List GetCrackedNdmCollection();
+ ///
+ /// Return collection of primitives which contain only rebars
+ ///
+ ///
+ List GetRebarPrimitives();
+ }
+}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/ITensileAreaLogic.cs b/StructureHelperLogics/NdmCalculations/Cracking/ITensileAreaLogic.cs
index 47eab43..fc422aa 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/ITensileAreaLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/ITensileAreaLogic.cs
@@ -1,5 +1,6 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
@@ -12,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
///
/// Logic fo calculating of tensile area of RC crosssection
///
- public interface ITensileAreaLogic
+ public interface ITensileAreaLogic : ILogic
{
IEnumerable NdmCollection { get; set; }
IStrainMatrix StrainMatrix { get; set; }
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/LengthBetweenCracksLogicSP63.cs b/StructureHelperLogics/NdmCalculations/Cracking/LengthBetweenCracksLogicSP63.cs
index 59376ef..bd6487e 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/LengthBetweenCracksLogicSP63.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/LengthBetweenCracksLogicSP63.cs
@@ -1,6 +1,10 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
+using LoaderCalculator.Logics;
+using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperLogics.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -18,6 +22,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
readonly IAverageDiameterLogic diameterLogic;
readonly ITensileAreaLogic tensileAreaLogic;
+ IStressLogic stressLogic;
public IEnumerable NdmCollection { get; set; }
public IStrainMatrix StrainMatrix { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
@@ -26,6 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
this.diameterLogic = diameterLogic;
this.tensileAreaLogic = tensileAreaLogic;
+ stressLogic = new StressLogic();
}
public LengthBetweenCracksLogicSP63() :
this
@@ -34,18 +40,43 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{ }
public double GetLength()
{
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var rebars = NdmCollection
- .Where(x => x is RebarNdm)
+ .Where(x => x is RebarNdm & stressLogic.GetTotalStrain(StrainMatrix, x) > 0d)
.Select(x => x as RebarNdm);
+ if (! rebars.Any())
+ {
+ string errorString = ErrorStrings.DataIsInCorrect + ": Collection of rebars does not contain any tensile rebars";
+ TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorString);
+ }
+ if (TraceLogger is not null)
+ {
+ TraceService.TraceNdmCollection(TraceLogger, rebars);
+ }
var rebarArea = rebars.Sum(x => x.Area * x.StressScale);
+ TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
+ diameterLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
diameterLogic.Rebars = rebars;
var rebarDiameter = diameterLogic.GetAverageDiameter();
+ TraceLogger?.AddMessage($"Average rebar diameter ds = {rebarDiameter}");
+ tensileAreaLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
tensileAreaLogic.NdmCollection = NdmCollection;
tensileAreaLogic.StrainMatrix = StrainMatrix;
var concreteArea = tensileAreaLogic.GetTensileArea();
+ TraceLogger?.AddMessage($"Concrete effective area Ac,eff = {concreteArea}(m^2)");
var length = concreteArea / rebarArea * rebarDiameter;
- length = new List { length, minDiameterFactor * rebarDiameter, minLength }.Max();
- length = new List { length, maxDiameterFactor * rebarDiameter, maxLength }.Min();
+ TraceLogger?.AddMessage($"Base length between cracks Lcrc = {concreteArea} / {rebarArea} * {rebarDiameter} = {length}(m)");
+ double minLengthByDiameter = minDiameterFactor * rebarDiameter;
+ TraceLogger?.AddMessage($"Minimum length by diameter Lcrc = {minDiameterFactor} * {rebarDiameter} = {minLengthByDiameter}(m)");
+ TraceLogger?.AddMessage($"Minimum length Lcrc = {minLength}");
+ length = new List { length, minLengthByDiameter, minLength }.Max();
+ TraceLogger?.AddMessage($"Minimum length Lcrc = max({length}, {minLengthByDiameter}, {minLength}) = {length}(m)");
+ double maxLengthByDiameter = maxDiameterFactor * rebarDiameter;
+ TraceLogger?.AddMessage($"Maximum length by diameter Lcrc = {maxDiameterFactor} * {rebarDiameter} = {maxLengthByDiameter}(m)");
+ TraceLogger?.AddMessage($"Maximum length Lcrc = {maxLength}");
+ length = new List { length, maxLengthByDiameter, maxLength }.Min();
+ TraceLogger?.AddMessage($"Maximun length Lcrc = min({length}, {maxLengthByDiameter}, {maxLength}) = {length}(m)");
return length;
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/TensileAreaLogicSP63.cs b/StructureHelperLogics/NdmCalculations/Cracking/TensileAreaLogicSP63.cs
index 3c7324c..d9dc76e 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/TensileAreaLogicSP63.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/TensileAreaLogicSP63.cs
@@ -2,7 +2,9 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics;
+using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
+using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
@@ -16,29 +18,44 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
const double maxConcreteFactor = 0.5d;
const double minConcreteFactor = 0.1d;
- const double minRebarFactor = 3d;
+ const double minRebarFactor = 9d;
private static IStressLogic stressLogic => new StressLogic();
public IEnumerable NdmCollection { get; set; }
public IStrainMatrix StrainMatrix { get; set; }
+ public IShiftTraceLogger? TraceLogger { get; set; }
public double GetTensileArea()
{
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+
var rebarCollection = NdmCollection
- .Where(x => x is RebarNdm);
+ .Where(x => x is RebarNdm & stressLogic.GetTotalStrain(StrainMatrix, x) > 0d);
var rebarArea = rebarCollection.
Sum(x => x.Area * x.StressScale);
+ TraceLogger?.AddMessage($"Summary rebar area As = {rebarArea}");
var concreteCollection = NdmCollection
.Where(x => x.Material is ConcreteMaterial);
var concreteArea = concreteCollection
.Sum(x => x.Area * x.StressScale);
+ TraceLogger?.AddMessage($"Concrete area Ac = {concreteArea}");
var concreteTensileArea = concreteCollection
.Where(x => stressLogic.GetTotalStrainWithPrestrain(StrainMatrix, x) > 0d)
.Sum(x => x.Area * x.StressScale);
-
- concreteTensileArea = Math.Max(concreteTensileArea, rebarArea * minRebarFactor);
- concreteTensileArea = Math.Max(concreteTensileArea, concreteArea * minConcreteFactor);
- concreteTensileArea = Math.Min(concreteTensileArea, concreteArea * maxConcreteFactor);
+ TraceLogger?.AddMessage($"Concrete tensile area Ac,t = {concreteTensileArea}");
+ double areaByRebar = rebarArea * minRebarFactor;
+ TraceLogger?.AddMessage($"Concrete area is considered not less than {minRebarFactor} of area of rebars");
+ TraceLogger?.AddMessage($"Minimum concrete effective area from area of rebar Ac,eff = {rebarArea} * {minRebarFactor} = {areaByRebar}");
+ concreteTensileArea = Math.Max(concreteTensileArea, areaByRebar);
+ double areaByMinConcreteFactor = concreteArea * minConcreteFactor;
+ TraceLogger?.AddMessage($"Concrete area is considered not less than {minConcreteFactor} of area of rebars");
+ TraceLogger?.AddMessage($"Minimum concrete effective area Ac,eff = {concreteArea} * {minConcreteFactor} = {areaByMinConcreteFactor}");
+ concreteTensileArea = Math.Max(concreteTensileArea, areaByMinConcreteFactor);
+ double areaByMaxConcreteFactor = concreteArea * maxConcreteFactor;
+ TraceLogger?.AddMessage($"Concrete area is considered not greater than {maxConcreteFactor} of area of rebars");
+ TraceLogger?.AddMessage($"Maximum concrete effective area Ac,eff = {concreteArea} * {maxConcreteFactor} = {areaByMaxConcreteFactor}");
+ concreteTensileArea = Math.Min(concreteTensileArea, areaByMaxConcreteFactor);
+ TraceLogger?.AddMessage($"Concrete effective area Ac,eff = {concreteTensileArea}");
return concreteTensileArea;
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackCalculator.cs b/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackCalculator.cs
index 43ecc4f..0ad489b 100644
--- a/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackCalculator.cs
+++ b/StructureHelperLogics/NdmCalculations/Cracking/TupleCrackCalculator.cs
@@ -17,11 +17,13 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
private static readonly ILengthBetweenCracksLogic lengthLogic = new LengthBetweenCracksLogicSP63();
private TupleCrackResult result;
private IEnumerable ndmPrimitives;
+ private ICrackedSectionTriangulationLogic triangulationLogic;
private List? rebarPrimitives;
- private IEnumerable defaultNdm;
- private IEnumerable fulyCrackedNdm;
+ private IEnumerable defaultNdms;
+ private IEnumerable fulyCrackedNdms;
private CrackForceResult crackForceResult;
- private StrainTuple strainTuple;
+ private StrainTuple longDefaultStrainTuple;
+ private StrainTuple shortDefaultStrainTuple;
private ITriangulatePrimitiveLogic triangulateLogic;
public string Name { get; set; }
@@ -37,6 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
try
{
+ TraceLogger?.AddMessage($"Calculation of crack width by force combination");
ProcessCalculations();
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
@@ -46,7 +49,6 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
result.IsValid = false;
result.Description += ex;
TraceLogger?.AddMessage(LoggerStrings.CalculationError + ex, TraceLogStatuses.Error);
-
}
}
@@ -64,7 +66,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
{
CheckInputData();
Triangulate();
- CalcStrainMatrix();
+ longDefaultStrainTuple = CalcStrainMatrix(InputData.LongTermTuple, defaultNdms);
+ shortDefaultStrainTuple = CalcStrainMatrix(InputData.LongTermTuple, defaultNdms);
+ var longLength = GetLengthBetweenCracks(longDefaultStrainTuple);
+ var shortLength = GetLengthBetweenCracks(shortDefaultStrainTuple);
CalcCrackForce();
var crackInputData = GetCrackInputData();
var calculator = new RebarCrackCalculator
@@ -77,63 +82,69 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
crackInputData.RebarPrimitive = item;
calculator.Run();
var rebarResult = calculator.Result as RebarCrackResult;
- //if (crackForceResult.IsSectionCracked == false)
- //{
- // rebarResult.CrackWidth = 0d;
- //}
result.RebarResults.Add(rebarResult);
}
}
- private void CalcStrainMatrix()
+ private StrainTuple CalcStrainMatrix(IForceTuple forceTuple, IEnumerable ndms)
{
- IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = defaultNdm, Tuple = InputData.LongTermTuple};
- IForceTupleCalculator calculator = new ForceTupleCalculator() { InputData = inputData };
+ IForceTupleInputData inputData = new ForceTupleInputData()
+ {
+ NdmCollection = ndms,
+ Tuple = forceTuple
+ };
+ IForceTupleCalculator calculator = new ForceTupleCalculator()
+ {
+ InputData = inputData,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
calculator.Run();
var forceResult = calculator.Result as IForcesTupleResult;
- strainTuple = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
+ var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
+ return strain;
}
private RebarCrackInputData GetCrackInputData()
{
- lengthLogic.NdmCollection = defaultNdm;
- lengthLogic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
+ lengthLogic.NdmCollection = defaultNdms;
+ lengthLogic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(longDefaultStrainTuple);
var length = lengthLogic.GetLength();
var crackInputData = new RebarCrackInputData
{
PsiSFactor = crackForceResult.PsiS,
Length = length,
- StrainTuple = strainTuple
+ StrainTuple = longDefaultStrainTuple
};
return crackInputData;
}
+ private double GetLengthBetweenCracks(StrainTuple strainTuple)
+ {
+ var logic = new LengthBetweenCracksLogicSP63()
+ {
+ NdmCollection = defaultNdms,
+ TraceLogger = TraceLogger
+ };
+ logic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
+ return logic.GetLength();
+ }
+
private void Triangulate()
{
- ndmPrimitives = InputData.NdmPrimitives;
- rebarPrimitives = new List();
- foreach (var item in ndmPrimitives)
+ triangulationLogic = new CrackedSectionTriangulationLogic(InputData.NdmPrimitives)
{
- if (item is RebarPrimitive)
- {
- rebarPrimitives.Add(item as RebarPrimitive);
- }
- }
- triangulateLogic = new TriangulatePrimitiveLogic()
- {
- Primitives = ndmPrimitives,
- LimitState = LimitStates.SLS,
- CalcTerm = CalcTerms.ShortTerm,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
- };
- defaultNdm = triangulateLogic.GetNdms();
+ };
+ rebarPrimitives = triangulationLogic.GetRebarPrimitives();
+ defaultNdms = triangulationLogic.GetNdmCollection();
+ fulyCrackedNdms = triangulationLogic.GetCrackedNdmCollection();
}
private void CalcCrackForce()
{
var calculator = new CrackForceCalculator();
calculator.EndTuple = InputData.LongTermTuple;
- calculator.NdmCollection = defaultNdm;
+ calculator.NdmCollection = defaultNdms;
calculator.Run();
crackForceResult = calculator.Result as CrackForceResult;
}
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
index ad6de4f..e3621b3 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/INdmPrimitive.cs
@@ -14,18 +14,42 @@ using StructureHelperCommon.Models.Parameters;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
+ ///
+ /// Geometrical primitive which generates ndm elemtntary part
+ ///
public interface INdmPrimitive : ISaveable, ICloneable
{
+ ///
+ /// Name of primitive
+ ///
string? Name { get; set; }
+ ///
+ /// Base point of primitive
+ ///
IPoint2D Center { get; }
+ ///
+ /// Host cross-section for primitive
+ ///
ICrossSection? CrossSection { get; set; }
+ ///
+ /// Material of primitive
+ ///
IHeadMaterial? HeadMaterial { get; set; }
///
/// Flag of triangulation
///
bool Triangulate { get; set; }
+ ///
+ /// Prestrain assigned from user
+ ///
StrainTuple UsersPrestrain { get; }
+ ///
+ /// Prestrain assigned from calculations
+ ///
StrainTuple AutoPrestrain { get; }
+ ///
+ /// Visual settings
+ ///
IVisualProperty VisualProperty {get; }
IEnumerable GetNdms(ITriangulationOptions triangulationOptions);
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/IVisualProperty.cs b/StructureHelperLogics/NdmCalculations/Primitives/IVisualProperty.cs
index c93eda5..b0727f1 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/IVisualProperty.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/IVisualProperty.cs
@@ -9,10 +9,22 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
{
public interface IVisualProperty
{
+ ///
+ /// Flag of visibility
+ ///
bool IsVisible { get; set; }
Color Color { get; set; }
+ ///
+ /// Flag of assigning of color from material or from primitive's settings
+ ///
bool SetMaterialColor { get; set; }
+ ///
+ /// Index by z-coordinate
+ ///
int ZIndex { get; set; }
+ ///
+ /// Opacity of filling
+ ///
double Opacity { get; set; }
}
}
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/RebarPrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/RebarPrimitive.cs
index 7a0690f..b0e40a1 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/RebarPrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/RebarPrimitive.cs
@@ -68,13 +68,35 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
}
public IEnumerable GetNdms(ITriangulationOptions triangulationOptions)
+ {
+ List ndms = new()
+ {
+ GetConcreteNdm(triangulationOptions),
+ GetRebarNdm(triangulationOptions)
+ };
+ return ndms;
+ }
+
+ public RebarNdm GetRebarNdm(ITriangulationOptions triangulationOptions)
{
var options = new RebarTriangulationLogicOptions(this)
{
triangulationOptions = triangulationOptions
};
var logic = new RebarTriangulationLogic(options);
- return logic.GetNdmCollection();
+ var rebar = logic.GetRebarNdm();
+ return rebar;
+ }
+
+ public Ndm GetConcreteNdm(ITriangulationOptions triangulationOptions)
+ {
+ var options = new RebarTriangulationLogicOptions(this)
+ {
+ triangulationOptions = triangulationOptions
+ };
+ var logic = new RebarTriangulationLogic(options);
+ var concrete = logic.GetConcreteNdm();
+ return concrete;
}
public List GetValuePoints()
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogic.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogic.cs
index b63607c..53e4380 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogic.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogic.cs
@@ -3,8 +3,10 @@ using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.Ndms.Transformations;
using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
+using StructureHelperLogics.Models.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,14 +25,20 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
}
public IEnumerable GetNdmCollection()
{
- var concreteNdm = new Ndm
+ List ndmCollection = new();
+ if (options.HostPrimitive is not null)
{
- CenterX = options.Center.X,
- CenterY = options.Center.Y,
- Area = options.Area,
- Material = options.HostMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm),
- StressScale = -1d
- };
+ var concreteNdm = GetConcreteNdm();
+ ndmCollection.Add(concreteNdm);
+ }
+
+ var rebarNdm = GetRebarNdm();
+ ndmCollection.Add(rebarNdm);
+ return ndmCollection;
+ }
+
+ public RebarNdm GetRebarNdm()
+ {
var rebarNdm = new RebarNdm
{
CenterX = options.Center.X,
@@ -38,9 +46,32 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Area = options.Area,
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
};
- List ndmCollection = new() { concreteNdm, rebarNdm};
- NdmTransform.SetPrestrain(ndmCollection, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
- return ndmCollection;
+ ;
+ NdmTransform.SetPrestrain(rebarNdm, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
+ return rebarNdm;
+ }
+
+ public Ndm GetConcreteNdm()
+ {
+ var hostPrimitive = options.HostPrimitive;
+ var material = hostPrimitive
+ .HeadMaterial
+ .GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm);
+
+ var prestrain = ForceTupleService.SumTuples(hostPrimitive.UsersPrestrain,
+ hostPrimitive.AutoPrestrain)
+ as StrainTuple;
+
+ var concreteNdm = new Ndm
+ {
+ CenterX = options.Center.X,
+ CenterY = options.Center.Y,
+ Area = options.Area,
+ Material = material,
+ StressScale = -1d
+ };
+ NdmTransform.SetPrestrain(concreteNdm, TupleConverter.ConvertToLoaderStrainMatrix(prestrain));
+ return concreteNdm;
}
public void ValidateOptions(ITriangulationLogicOptions options)
diff --git a/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogicOptions.cs b/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogicOptions.cs
index e3d13d6..685b7b0 100644
--- a/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogicOptions.cs
+++ b/StructureHelperLogics/NdmCalculations/Triangulations/RebarTriangulationLogicOptions.cs
@@ -22,7 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
public double Area { get; }
public StrainTuple Prestrain { get; set; }
public IHeadMaterial HeadMaterial { get; set; }
- public IHeadMaterial HostMaterial { get; set; }
+ public INdmPrimitive HostPrimitive { get; set; }
+
///
public RebarTriangulationLogicOptions(RebarPrimitive primitive)
@@ -30,7 +31,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
Center = primitive.Center.Clone() as Point2D;
Area = primitive.Area;
HeadMaterial = primitive.HeadMaterial;
- HostMaterial = primitive.HostPrimitive.HeadMaterial;
+ HostPrimitive = primitive.HostPrimitive;
Prestrain = ForceTupleService.SumTuples(primitive.UsersPrestrain, primitive.AutoPrestrain) as StrainTuple;
}
}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/CheckPrimitivesForMeshingLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/CheckPrimitivesForMeshingLogic.cs
new file mode 100644
index 0000000..b1901da
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/CheckPrimitivesForMeshingLogic.cs
@@ -0,0 +1,47 @@
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ public class CheckPrimitivesForMeshingLogic : ICheckPrimitivesForMeshingLogic
+ {
+ public IEnumerable Primitives { get; set; }
+
+ public IShiftTraceLogger? TraceLogger { get; set; }
+
+ public bool Check()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ if (!Primitives.Any())
+ {
+ string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero");
+ TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorMessage);
+ }
+ if (!Primitives.Any(x => x.Triangulate == true))
+ {
+ string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate");
+ TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorMessage);
+ }
+ foreach (var item in Primitives)
+ {
+ if (item.Triangulate == true &
+ item.HeadMaterial is null)
+ {
+ string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
+ TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorMessage);
+ }
+ }
+ return true;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/ICheckPrimitivesForMeshingLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/ICheckPrimitivesForMeshingLogic.cs
new file mode 100644
index 0000000..4a2bb3f
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/ICheckPrimitivesForMeshingLogic.cs
@@ -0,0 +1,16 @@
+using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ public interface ICheckPrimitivesForMeshingLogic : ILogic
+ {
+ IEnumerable Primitives { get; set; }
+ bool Check();
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/IMeshHasDivisionLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/IMeshHasDivisionLogic.cs
new file mode 100644
index 0000000..e8094a7
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/IMeshHasDivisionLogic.cs
@@ -0,0 +1,18 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ public interface IMeshHasDivisionLogic : ILogic
+ {
+ List NdmCollection { get; set; }
+ IHasDivisionSize Primitive { get; set; }
+ void MeshHasDivision();
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/IMeshPrimitiveLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/IMeshPrimitiveLogic.cs
new file mode 100644
index 0000000..47e61cd
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/IMeshPrimitiveLogic.cs
@@ -0,0 +1,19 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Interfaces;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ public interface IMeshPrimitiveLogic : ILogic
+ {
+ INdmPrimitive Primitive { get; set; }
+ ITriangulationOptions TriangulationOptions { get; set; }
+ List MeshPrimitive();
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/ITriangulatePrimitiveLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/ITriangulatePrimitiveLogic.cs
index 43c6ecd..acc8bf8 100644
--- a/StructureHelperLogics/Services/NdmPrimitives/ITriangulatePrimitiveLogic.cs
+++ b/StructureHelperLogics/Services/NdmPrimitives/ITriangulatePrimitiveLogic.cs
@@ -11,6 +11,5 @@ namespace StructureHelperLogics.Services.NdmPrimitives
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
List GetNdms();
- bool CheckPrimitives(IEnumerable primitives);
}
}
\ No newline at end of file
diff --git a/StructureHelperLogics/Services/NdmPrimitives/MeshCrackedConcreteLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/MeshCrackedConcreteLogic.cs
new file mode 100644
index 0000000..157f089
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/MeshCrackedConcreteLogic.cs
@@ -0,0 +1,98 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperLogics.Models.Materials;
+using StructureHelperLogics.Models.Primitives;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ internal class MeshCrackedConcreteLogic : IMeshPrimitiveLogic
+ {
+ private IMeshPrimitiveLogic regularMeshLogic;
+ public List NdmCollection { get; set; }
+ public INdmPrimitive Primitive { get; set; }
+ public ITriangulationOptions TriangulationOptions { get; set; }
+ public IShiftTraceLogger? TraceLogger { get; set; }
+
+ List IMeshPrimitiveLogic.MeshPrimitive()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ CheckPrimitive();
+ List ndmCollection = new();
+ if (Primitive.HeadMaterial.HelperMaterial is ICrackedMaterial)
+ {
+ TraceLogger?.AddMessage($"Primitive {Primitive.Name} is crackable primitive", TraceLogStatuses.Service);
+ var newPrimititve = Primitive.Clone() as INdmPrimitive;
+ SetNewMaterial(newPrimititve);
+ List ndms = GetNdms(newPrimititve);
+ ndmCollection.AddRange(ndms);
+ }
+ else if (Primitive is RebarPrimitive rebar)
+ {
+ TraceLogger?.AddMessage($"Primitive {Primitive.Name} is rebar primitive", TraceLogStatuses.Service);
+ var newPrimititve = rebar.Clone() as RebarPrimitive;
+ var newHostPrimitive = rebar.HostPrimitive.Clone() as INdmPrimitive;
+ SetNewMaterial(newHostPrimitive);
+ newPrimititve.HostPrimitive = newHostPrimitive;
+ List ndms = GetNdms(newPrimititve);
+ ndmCollection.AddRange(ndms);
+ }
+ else
+ {
+ TraceLogger?.AddMessage($"Primitive {Primitive.Name} is non-crackable primitive", TraceLogStatuses.Service);
+ List ndms = GetNdms(Primitive);
+ ndmCollection.AddRange(ndms);
+ }
+ return ndmCollection;
+ }
+
+ private void SetNewMaterial(INdmPrimitive? newPrimititve)
+ {
+ TraceLogger?.AddMessage($"Process material {newPrimititve.HeadMaterial.Name} has started");
+ var newMaterial = newPrimititve.HeadMaterial.HelperMaterial.Clone() as ICrackedMaterial;
+ TraceLogger?.AddMessage($"Set work in tension zone for material {newPrimititve.HeadMaterial.Name}");
+ newMaterial.TensionForSLS = false;
+ newPrimititve.HeadMaterial.HelperMaterial = newMaterial as IHelperMaterial;
+ }
+
+ private List GetNdms(INdmPrimitive primitive)
+ {
+ TraceLogger?.AddMessage($"Triangulation primitive has started");
+ regularMeshLogic = new MeshPrimitiveLogic()
+ {
+ Primitive = primitive,
+ TriangulationOptions = TriangulationOptions,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
+ List ndms = regularMeshLogic.MeshPrimitive();
+ return ndms;
+ }
+
+ private void CheckPrimitive()
+ {
+ if (TriangulationOptions.LimiteState is not LimitStates.SLS)
+ {
+ string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Limit state for cracking must correspondent limit state of serviceability");
+ TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorMessage);
+ }
+ if (TriangulationOptions.CalcTerm is not CalcTerms.ShortTerm)
+ {
+ string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Calc term for cracked concrete must correspondent short term");
+ TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
+ throw new StructureHelperException(errorMessage);
+ }
+ TraceLogger?.AddMessage($"Primitive check is ok");
+ }
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/MeshHasDivisionLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/MeshHasDivisionLogic.cs
new file mode 100644
index 0000000..c2d9bf0
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/MeshHasDivisionLogic.cs
@@ -0,0 +1,41 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperCommon.Models.Shapes;
+using StructureHelperLogics.Models.Primitives;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ public class MeshHasDivisionLogic : IMeshHasDivisionLogic
+ {
+ public List NdmCollection { get; set; }
+ public IHasDivisionSize Primitive { get; set; }
+ public IShiftTraceLogger? TraceLogger { get; set; }
+
+ public void MeshHasDivision()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ if (Primitive is IHasDivisionSize hasDivision)
+ {
+ if (hasDivision.ClearUnderlying == true)
+ {
+ TraceLogger?.AddMessage("Removing of background part has started", TraceLogStatuses.Service);
+ NdmCollection
+ .RemoveAll(x =>
+ hasDivision
+ .IsPointInside(new Point2D()
+ {
+ X = x.CenterX,
+ Y = x.CenterY
+ }) == true);
+ }
+ }
+ }
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/MeshPrimitiveLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/MeshPrimitiveLogic.cs
new file mode 100644
index 0000000..7790dc0
--- /dev/null
+++ b/StructureHelperLogics/Services/NdmPrimitives/MeshPrimitiveLogic.cs
@@ -0,0 +1,34 @@
+using LoaderCalculator.Data.Ndms;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperCommon.Models.Materials;
+using StructureHelperLogics.Models.Materials;
+using StructureHelperLogics.Models.Primitives;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using StructureHelperLogics.NdmCalculations.Triangulations;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Services.NdmPrimitives
+{
+ public class MeshPrimitiveLogic : IMeshPrimitiveLogic
+ {
+ public INdmPrimitive Primitive { get; set; }
+ public IShiftTraceLogger? TraceLogger { get; set; }
+ public ITriangulationOptions TriangulationOptions { get; set; }
+
+ public List MeshPrimitive()
+ {
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ List ndmCollection = new();
+ var itemNdms = Primitive.GetNdms(TriangulationOptions);
+ ndmCollection.AddRange(itemNdms);
+ TraceLogger?.AddMessage($"Triangulation of primitive {Primitive.Name} has finished, {itemNdms.Count()} part(s) were obtained", TraceLogStatuses.Service);
+ return ndmCollection;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Services/NdmPrimitives/TriangulatePrimitiveLogic.cs b/StructureHelperLogics/Services/NdmPrimitives/TriangulatePrimitiveLogic.cs
index be98af4..4b24777 100644
--- a/StructureHelperLogics/Services/NdmPrimitives/TriangulatePrimitiveLogic.cs
+++ b/StructureHelperLogics/Services/NdmPrimitives/TriangulatePrimitiveLogic.cs
@@ -2,7 +2,10 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
+using StructureHelperCommon.Models.Loggers;
+using StructureHelperCommon.Models.Materials;
using StructureHelperCommon.Models.Shapes;
+using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperLogics.NdmCalculations.Triangulations;
@@ -10,49 +13,85 @@ namespace StructureHelperLogics.Services.NdmPrimitives
{
public class TriangulatePrimitiveLogic : ITriangulatePrimitiveLogic
{
+ private IMeshHasDivisionLogic divisionLogic;
+ private IMeshPrimitiveLogic meshLogic;
private List ndmCollection;
+ private ICheckPrimitivesForMeshingLogic checkLogic;
public IEnumerable Primitives { get; set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
- public bool ConsiderCracking { get; set; }
+
public IShiftTraceLogger? TraceLogger { get; set; }
- public TriangulatePrimitiveLogic()
+
+ public TriangulatePrimitiveLogic(IMeshPrimitiveLogic meshPrimitiveLogic)
{
- ConsiderCracking = false;
+ meshLogic = meshPrimitiveLogic;
}
+
+ public TriangulatePrimitiveLogic() : this (new MeshPrimitiveLogic()) { }
+
public List GetNdms()
{
- TraceLogger?.AddMessage($"Total count of primitives n = {Primitives.Count()}", TraceLogStatuses.Service);
- TraceLogger?.AddMessage($"Limit state is {LimitState}", TraceLogStatuses.Service);
- TraceLogger?.AddMessage($"Calc term is {CalcTerm}", TraceLogStatuses.Service);
- var orderedNdmPrimitives = Primitives.OrderBy(x => x.VisualProperty.ZIndex);
+ TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
+ CheckPrimitives();
ndmCollection = new List();
- foreach (var item in orderedNdmPrimitives)
+ SetLogics();
+ TraceInitialSettings();
+ TriangulatePrimitives();
+ return ndmCollection;
+ }
+
+ private void TriangulatePrimitives()
+ {
+ var orderedNdmPrimitives = Primitives.OrderBy(x => x.VisualProperty.ZIndex);
+ foreach (var primitive in orderedNdmPrimitives)
{
- TraceLogger?.AddMessage($"Triangulation of primitive {item.Name} has started", TraceLogStatuses.Service);
- ProcessHasDivision(item);
- TriangulatePrimitive(item);
+ TriangulatePrimitive(primitive);
}
if (TraceLogger is not null)
{
TraceService.TraceNdmCollection(TraceLogger, ndmCollection);
}
- return ndmCollection;
+ TraceLogger?.AddMessage($"Triangulation of primitives has finished, {ndmCollection.Count} part(s) were obtained", TraceLogStatuses.Service);
}
- private void TriangulatePrimitive(INdmPrimitive item)
+ private void TraceInitialSettings()
{
- if (item.Triangulate == true)
+ TraceLogger?.AddMessage($"Total count of primitives n = {Primitives.Count()}", TraceLogStatuses.Service);
+ TraceLogger?.AddMessage($"Limit state is {LimitState}", TraceLogStatuses.Service);
+ TraceLogger?.AddMessage($"Calc term is {CalcTerm}", TraceLogStatuses.Service);
+ }
+
+ private void SetLogics()
+ {
+ divisionLogic = new MeshHasDivisionLogic()
{
- var triangulationOptions = new TriangulationOptions()
- {
- LimiteState = LimitState,
- CalcTerm = CalcTerm
- };
- var itemNdms = item.GetNdms(triangulationOptions);
- ndmCollection.AddRange(itemNdms);
- TraceLogger?.AddMessage($"Triangulation of primitive {item.Name} was finished, {itemNdms.Count()} part(s) were obtained", TraceLogStatuses.Service);
+ NdmCollection = ndmCollection,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
+ var triangulationOptions = new TriangulationOptions()
+ {
+ LimiteState = LimitState,
+ CalcTerm = CalcTerm
+ };
+ meshLogic.TriangulationOptions = triangulationOptions;
+ meshLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
+ }
+
+ private void TriangulatePrimitive(INdmPrimitive primitive)
+ {
+ TraceLogger?.AddMessage($"Triangulation of primitive {primitive.Name} has started", TraceLogStatuses.Service);
+ if (primitive is IHasDivisionSize hasDivision)
+ {
+ divisionLogic.Primitive = hasDivision;
+ divisionLogic.MeshHasDivision();
+ }
+ if (primitive.Triangulate == true)
+ {
+ meshLogic.Primitive = primitive;
+ var ndms = meshLogic.MeshPrimitive();
+ ndmCollection.AddRange(ndms);
}
else
{
@@ -60,45 +99,14 @@ namespace StructureHelperLogics.Services.NdmPrimitives
}
}
- private void ProcessHasDivision(INdmPrimitive? item)
+ private bool CheckPrimitives()
{
- if (item is IHasDivisionSize hasDivision)
+ checkLogic = new CheckPrimitivesForMeshingLogic()
{
- if (hasDivision.ClearUnderlying == true)
- {
- TraceLogger?.AddMessage("Removing of background part has started", TraceLogStatuses.Service);
- ndmCollection
- .RemoveAll(x =>
- hasDivision
- .IsPointInside(new Point2D() { X = x.CenterX, Y = x.CenterY }) == true);
- }
- }
- }
-
- public bool CheckPrimitives(IEnumerable primitives)
- {
- if (!primitives.Any())
- {
- string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero");
- TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
- throw new StructureHelperException(errorMessage);
- }
- if (!primitives.Any(x => x.Triangulate == true))
- {
- string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate");
- TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
- throw new StructureHelperException(errorMessage);
- }
- foreach (var item in primitives)
- {
- if (item.Triangulate == true &
- item.HeadMaterial is null)
- {
- string errorMessage = string.Intern(ErrorStrings.DataIsInCorrect + $": Primitive: {item.Name} can't be triangulated since material is null");
- TraceLogger?.AddMessage(errorMessage, TraceLogStatuses.Error);
- throw new StructureHelperException(errorMessage);
- }
- }
+ Primitives = Primitives,
+ TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
+ };
+ checkLogic.Check();
return true;
}
}
diff --git a/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs b/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs
index 24f06db..98eb362 100644
--- a/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs
+++ b/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs
@@ -15,7 +15,13 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
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
- var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount};
+ var template = new RectangleBeamTemplate(width, height)
+ {
+ TopDiameter = topDiametr,
+ BottomDiameter = bottomDiametr,
+ WidthCount = widthCount,
+ HeightCount = heightCount
+ };
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
var calculator = newSection.SectionRepository.CalculatorsList[0] as IForceCalculator;
calculator.CompressedMember.Buckling = isBuckling;