Crack Calculator was added
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using LoaderCalculator.Tests.Infrastructures.Logics;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.CrackCalculatorTests
|
||||
|
||||
{
|
||||
internal class CrackCalculatorTest
|
||||
{
|
||||
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, 0.81d)]
|
||||
public void Run_ShouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, double expectedFactor)
|
||||
{
|
||||
//Arrange
|
||||
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var ndmPrimitives = newSection.SectionRepository.Primitives;
|
||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.SLS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var ndms = Triangulation.GetNdms(ndmPrimitives, options);
|
||||
var calculator = new CrackForceCalculator();
|
||||
calculator.EndTuple = new ForceTuple() { Mx = -50e3d, My = -50e3d, Nz = 0d };
|
||||
calculator.NdmCollection = ndms;
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = (CrackForceResult)calculator.Result;
|
||||
//Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.IsTrue(result.IsValid);
|
||||
Assert.AreEqual(expectedFactor, result.ActualFactor, 0.01d);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
{
|
||||
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new RectanglePrimitive(material) {CenterX = 0, CenterY = 0, Width = width, Height = height, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
var primitive = new RectanglePrimitive(material) {Width = width, Height = height, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
||||
return primitives;
|
||||
}
|
||||
@@ -81,16 +81,24 @@ namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||
INdmPrimitive primitive;
|
||||
//Right top bar
|
||||
primitive = new PointPrimitive(material) { Area = topArea, CenterX = centerRT.X, CenterY = centerRT.Y };
|
||||
primitive = new PointPrimitive(material) { Area = topArea};
|
||||
primitive.Center.X = centerRT.X;
|
||||
primitive.Center.Y = centerRT.Y;
|
||||
primitives.Add(primitive);
|
||||
//Left top bar
|
||||
primitive = new PointPrimitive(material) { Area = topArea, CenterX = centerLT.X, CenterY = centerLT.Y };
|
||||
primitive = new PointPrimitive(material) { Area = topArea};
|
||||
primitive.Center.X = centerLT.X;
|
||||
primitive.Center.Y = centerLT.Y;
|
||||
primitives.Add(primitive);
|
||||
//Right bottom bar
|
||||
primitive = new PointPrimitive(material) { Area = bottomArea, CenterX = centerRB.X, CenterY = centerRB.Y };
|
||||
primitive = new PointPrimitive(material) { Area = bottomArea};
|
||||
primitive.Center.X = centerRB.X;
|
||||
primitive.Center.Y = centerRB.Y;
|
||||
primitives.Add(primitive);
|
||||
//Left bottom bar
|
||||
primitive = new PointPrimitive(material) { Area = bottomArea, CenterX = centerLB.X, CenterY = centerLB.Y };
|
||||
primitive = new PointPrimitive(material) {Area = bottomArea };
|
||||
primitive.Center.X = centerLB.X;
|
||||
primitive.Center.Y = centerLB.Y;
|
||||
primitives.Add(primitive);
|
||||
return primitives;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
var options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitive = new RectanglePrimitive { CenterX = 0, CenterY = 0, Width = width, Height = height, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitive = new RectanglePrimitive { Width = width, Height = height, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitives = new List<INdmPrimitive>() { primitive};
|
||||
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
||||
var loaderData = new LoaderOptions
|
||||
@@ -62,7 +62,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
var options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitive = new CirclePrimitive { CenterX = 0, CenterY = 0, Diameter = diameter, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitive = new CirclePrimitive { Diameter = diameter, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitives = new List<INdmPrimitive>() { primitive };
|
||||
var ndmCollection = Triangulation.GetNdms(primitives, options);
|
||||
var loaderData = new LoaderOptions
|
||||
|
||||
Reference in New Issue
Block a user