SectionTemlate was added
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface ICalculatorLogic
|
||||
{
|
||||
IEnumerable<INdmCalculator> GetNdmCalculators();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
public interface ICrossSectionTemplate
|
||||
{
|
||||
ICrossSection GetCrossSection();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface IForceLogic
|
||||
{
|
||||
IEnumerable<IForceCombinationList> GetCombinationList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface IMaterialLogic
|
||||
{
|
||||
IEnumerable<IHeadMaterial> GetHeadMaterials();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
internal interface ISectionGeometryLogic
|
||||
{
|
||||
IEnumerable<INdmPrimitive> GetNdmPrimitives();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Templates.CrossSections
|
||||
{
|
||||
public class RCSectionTemplate : ICrossSectionTemplate
|
||||
{
|
||||
IForceLogic forceLogic;
|
||||
IMaterialLogic materialLogic;
|
||||
ISectionGeometryLogic geometryLogic;
|
||||
ICalculatorLogic calculatorLogic;
|
||||
IEnumerable<INdmPrimitive> primitives;
|
||||
IEnumerable<IForceCombinationList> combinations;
|
||||
IEnumerable<INdmCalculator> calculators;
|
||||
|
||||
public ICrossSection GetCrossSection()
|
||||
{
|
||||
ICrossSection section = new CrossSection();
|
||||
var repository = section.SectionRepository;
|
||||
var materials = materialLogic.GetHeadMaterials();
|
||||
primitives = geometryLogic.GetNdmPrimitives();
|
||||
#error
|
||||
repository.HeadMaterials.AddRange(materials);
|
||||
repository.Primitives.AddRange(primitives);
|
||||
combinations = forceLogic.GetCombinationList();
|
||||
repository.ForceCombinationLists.AddRange(combinations);
|
||||
calculators = calculatorLogic.GetNdmCalculators();
|
||||
ProcessCalculatorsSetForce();
|
||||
ProcessCalculatorsSetPrimitives();
|
||||
repository.CalculatorsList.AddRange(calculators);
|
||||
return section;
|
||||
}
|
||||
|
||||
private void ProcessCalculatorsSetForce()
|
||||
{
|
||||
foreach (var calculator in calculators)
|
||||
{
|
||||
if (calculator is IHasForceCombinations)
|
||||
{
|
||||
var forceCalculator = calculator as IHasForceCombinations;
|
||||
forceCalculator.ForceCombinationLists.AddRange(combinations);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ProcessCalculatorsSetPrimitives()
|
||||
{
|
||||
foreach (var calculator in calculators)
|
||||
{
|
||||
if (calculator is IHasPrimitives)
|
||||
{
|
||||
var primitiveCalculator = calculator as IHasPrimitives;
|
||||
primitiveCalculator.Primitives.AddRange(primitives);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Services.Forces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculator : INdmCalculator
|
||||
public class ForceCalculator : IForceCalculator
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public double IterationAccuracy { get; set; }
|
||||
@@ -15,10 +27,59 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public List<CalcTerms> CalcTermsList { get; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; }
|
||||
public List<INdmPrimitive> NdmPrimitives { get; }
|
||||
public INdmResult Result { get; }
|
||||
public INdmResult Result { get; private set; }
|
||||
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var checkResult = CheckInputData();
|
||||
if (checkResult != "")
|
||||
{
|
||||
Result = new ForcesResults() { IsValid = false, Desctription = checkResult };
|
||||
return;
|
||||
}
|
||||
else { CalculateResult(); }
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
var ndmResult = new ForcesResults() { IsValid = true };
|
||||
foreach (var combination in ForceCombinationLists)
|
||||
{
|
||||
foreach (var tuple in combination.DesignForces)
|
||||
{
|
||||
var limitState = tuple.LimitState;
|
||||
var calcTerm = tuple.CalcTerm;
|
||||
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
||||
{
|
||||
var ndms = NdmPrimitivesService.GetNdms(NdmPrimitives, limitState, calcTerm);
|
||||
IPoint2D point2D;
|
||||
if (combination.SetInGravityCenter == true)
|
||||
{
|
||||
var loaderPoint = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
point2D = new Point2D() { X = loaderPoint[0], Y = loaderPoint[1] };
|
||||
}
|
||||
else point2D = combination.ForcePoint;
|
||||
var newTuple = TupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
|
||||
var result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Result = ndmResult;
|
||||
}
|
||||
|
||||
private string CheckInputData()
|
||||
{
|
||||
string result = "";
|
||||
if (NdmPrimitives.Count == 0) { result += "Calculator does not contain any primitives \n"; }
|
||||
if (ForceCombinationLists.Count == 0) { result += "Calculator does not contain any forces \n"; }
|
||||
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; }
|
||||
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; }
|
||||
return result;
|
||||
}
|
||||
|
||||
public ForceCalculator()
|
||||
@@ -30,5 +91,47 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
LimitStatesList = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
CalcTermsList = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
}
|
||||
|
||||
private ForcesResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple)
|
||||
{
|
||||
var mx = tuple.Mx;
|
||||
var my = tuple.My;
|
||||
var nz = tuple.Nz;
|
||||
|
||||
try
|
||||
{
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = IterationAccuracy,
|
||||
MaxIterationCount = MaxIterationCount,
|
||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var calcResult = calculator.Result;
|
||||
if (calcResult.AccuracyRate <= IterationAccuracy)
|
||||
{
|
||||
return new ForcesResult() { IsValid = true, Desctription = "Analysis is done succsefully", LoaderResults = calcResult };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForcesResult() { IsValid = false, Desctription = "Required accuracy rate has not achived", LoaderResults = calcResult };
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var result = new ForcesResult() { IsValid = false };
|
||||
if (ex.Message == "") { result.Desctription = "Stiffness matrix is equal to zero"; }
|
||||
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,7 +11,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForcesResult : INdmResult
|
||||
{
|
||||
public bool IsValid { get; private set; }
|
||||
public bool IsValid { get; set; }
|
||||
public IDesignForceTuple DesignForceTuple { get; set; }
|
||||
/// <summary>
|
||||
/// Text of result of calculations
|
||||
/// </summary>
|
||||
@@ -17,6 +20,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// <summary>
|
||||
/// Keep result of calculations from ndm-library
|
||||
/// </summary>
|
||||
public ILoaderResults LoaderResults { get; }
|
||||
public ILoaderResults LoaderResults { get; set; }
|
||||
|
||||
public ForcesResult()
|
||||
{
|
||||
DesignForceTuple = new DesignForceTuple();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForcesResults : IForcesResults
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<ForcesResult> ForcesResultList { get; }
|
||||
public string Desctription { get; set; }
|
||||
|
||||
public ForcesResults()
|
||||
{
|
||||
ForcesResultList = new List<ForcesResult>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculator : INdmCalculator, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
double IterationAccuracy { get; set; }
|
||||
List<LimitStates> LimitStatesList { get; }
|
||||
int MaxIterationCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForcesResults : INdmResult
|
||||
{
|
||||
string Desctription { get; set; }
|
||||
List<ForcesResult> ForcesResultList { get; }
|
||||
bool IsValid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
/// <summary>
|
||||
/// True if result of calculation is valid
|
||||
/// </summary>
|
||||
bool IsValid { get; }
|
||||
bool IsValid { get; set; }
|
||||
string Desctription { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
21
StructureHelperLogics/Services/Forces/TupleService.cs
Normal file
21
StructureHelperLogics/Services/Forces/TupleService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services.Forces
|
||||
{
|
||||
internal static class TupleService
|
||||
{
|
||||
public static IForceTuple MoveTupleIntoPoint(IForceTuple forceTuple, IPoint2D point2D)
|
||||
{
|
||||
var newTuple = forceTuple.Clone() as IForceTuple;
|
||||
newTuple.Mx += newTuple.Nz * point2D.Y;
|
||||
newTuple.My -= newTuple.Nz * point2D.X;
|
||||
return newTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
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;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
|
||||
namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
internal static class NdmPrimitivesService
|
||||
public static class NdmPrimitivesService
|
||||
{
|
||||
public static void CopyNdmProperties (INdmPrimitive source, INdmPrimitive target)
|
||||
{
|
||||
@@ -25,5 +30,17 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
}
|
||||
|
||||
public static List<INdm> GetNdms(IEnumerable<INdmPrimitive> primitives, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
//Настройки триангуляции
|
||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = limitState, CalcTerm = calcTerm };
|
||||
|
||||
//Формируем коллекцию элементарных участков для расчета в библитеке (т.е. выполняем триангуляцию)
|
||||
List<INdm> ndmCollection = new List<INdm>();
|
||||
ndmCollection.AddRange(Triangulation.GetNdms(primitives, options));
|
||||
|
||||
return ndmCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user