ConcreteBucklingCalculator was added
This commit is contained in:
@@ -10,10 +10,12 @@ using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Calculations;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperCommon.Services.Sections;
|
||||
using StructureHelperLogics.NdmCalculations.Buckling;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
@@ -27,7 +29,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public INdmResult Result { get; private set; }
|
||||
public ICompressedMember CompressedMember { get; }
|
||||
public IAccuracy Accuracy { get; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
|
||||
public void Run()
|
||||
{
|
||||
@@ -56,11 +58,42 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
if (combination.SetInGravityCenter == true)
|
||||
{
|
||||
var loaderPoint = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
point2D = new Point2D() { X = loaderPoint[0], Y = loaderPoint[1] };
|
||||
point2D = new Point2D() { X = loaderPoint.CenterX, Y = loaderPoint.CenterY };
|
||||
}
|
||||
else point2D = combination.ForcePoint;
|
||||
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
|
||||
var result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
||||
if (CompressedMember.Buckling == true)
|
||||
{
|
||||
IForceTuple longTuple;
|
||||
if (calcTerm == CalcTerms.LongTerm)
|
||||
{
|
||||
longTuple = newTuple;
|
||||
}
|
||||
else
|
||||
{
|
||||
longTuple = GetLongTuple(combination.DesignForces, limitState);
|
||||
}
|
||||
var bucklingCalculator = GetBucklingCalculator(CompressedMember, limitState, calcTerm, newTuple, longTuple);
|
||||
try
|
||||
{
|
||||
bucklingCalculator.Run();
|
||||
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
|
||||
if (bucklingResult.IsValid != true)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Desctription += $"Buckling result:\n{bucklingResult.Desctription}\n";
|
||||
}
|
||||
newTuple = CalculateBuckling(newTuple, bucklingResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Desctription = $"Buckling error:\n{ex}\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
@@ -71,6 +104,42 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
Result = ndmResult;
|
||||
}
|
||||
|
||||
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
||||
{
|
||||
IForceTuple longTuple;
|
||||
try
|
||||
{
|
||||
longTuple = designForces.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm).First().ForceTuple;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
longTuple = new ForceTuple();
|
||||
}
|
||||
return longTuple;
|
||||
}
|
||||
|
||||
private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
|
||||
{
|
||||
IConcreteBucklingOptions options = new ConcreteBucklingOptions()
|
||||
{ CompressedMember = compressedMember,
|
||||
LimitState = limitStates,
|
||||
CalcTerm = calcTerms,
|
||||
CalcForceTuple = calcTuple,
|
||||
LongTermTuple = longTuple,
|
||||
Primitives = Primitives };
|
||||
IConcreteBucklingCalculator bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
||||
return bucklingCalculator;
|
||||
}
|
||||
|
||||
private IForceTuple CalculateBuckling(IForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
||||
{
|
||||
var newTuple = calcTuple.Clone() as IForceTuple;
|
||||
newTuple.Mx *= bucklingResult.EtaFactorAlongY;
|
||||
newTuple.My *= bucklingResult.EtaFactorAlongX;
|
||||
return newTuple;
|
||||
}
|
||||
|
||||
|
||||
private string CheckInputData()
|
||||
{
|
||||
string result = "";
|
||||
@@ -85,51 +154,18 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
CompressedMember = new CompressedMember();
|
||||
CompressedMember = new CompressedMember() { Buckling = false };
|
||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
|
||||
LimitStatesList = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
CalcTermsList = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
}
|
||||
|
||||
private ForcesResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple)
|
||||
private IForcesTupleResult 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 = Accuracy.IterationAccuracy,
|
||||
MaxIterationCount = Accuracy.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 <= Accuracy.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 == "Calculation result is not valid: stiffness matrix is equal to zero") { result.Desctription = "Stiffness matrix is equal to zero \nProbably section was collapsed"; }
|
||||
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||
return result;
|
||||
}
|
||||
|
||||
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = tuple, Accuracy = Accuracy };
|
||||
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
|
||||
calculator.Run();
|
||||
return calculator.Result as IForcesTupleResult;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceTupleCalculator : IForceTupleCalculator
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public INdmResult Result { get; private set; }
|
||||
|
||||
private IForceTupleInputData inputData;
|
||||
|
||||
public ForceTupleCalculator(IForceTupleInputData inputData)
|
||||
{
|
||||
this.inputData = inputData;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
Result = CalculateResult();
|
||||
}
|
||||
|
||||
private IForcesTupleResult CalculateResult()
|
||||
{
|
||||
var ndmCollection = inputData.NdmCollection;
|
||||
var tuple = inputData.Tuple;
|
||||
var accuracy = inputData.Accuracy;
|
||||
|
||||
|
||||
var mx = tuple.Mx;
|
||||
var my = tuple.My;
|
||||
var nz = tuple.Nz;
|
||||
|
||||
try
|
||||
{
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = accuracy.IterationAccuracy,
|
||||
MaxIterationCount = accuracy.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 <= accuracy.IterationAccuracy)
|
||||
{
|
||||
return new ForcesTupleResult() { IsValid = true, Desctription = "Analysis is done succsefully", LoaderResults = calcResult };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForcesTupleResult() { IsValid = false, Desctription = "Required accuracy rate has not achived", LoaderResults = calcResult };
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var result = new ForcesTupleResult() { IsValid = false };
|
||||
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero") { result.Desctription = "Stiffness matrix is equal to zero \nProbably section was collapsed"; }
|
||||
else { result.Desctription = $"Error is appeared due to analysis. Error: {ex}"; }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceTupleInputData : IForceTupleInputData
|
||||
{
|
||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
||||
public IForceTuple Tuple { get; set; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public class ForcesResults : IForcesResults
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public List<ForcesResult> ForcesResultList { get; }
|
||||
public List<IForcesTupleResult> ForcesResultList { get; }
|
||||
public string Desctription { get; set; }
|
||||
|
||||
public ForcesResults()
|
||||
{
|
||||
ForcesResultList = new List<ForcesResult>();
|
||||
ForcesResultList = new List<IForcesTupleResult>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForcesResult : INdmResult
|
||||
public class ForcesTupleResult : IForcesTupleResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public IDesignForceTuple DesignForceTuple { get; set; }
|
||||
@@ -22,7 +22,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// </summary>
|
||||
public ILoaderResults LoaderResults { get; set; }
|
||||
|
||||
public ForcesResult()
|
||||
public ForcesTupleResult()
|
||||
{
|
||||
DesignForceTuple = new DesignForceTuple();
|
||||
}
|
||||
@@ -14,6 +14,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
List<LimitStates> LimitStatesList { get; }
|
||||
ICompressedMember CompressedMember { get; }
|
||||
IAccuracy Accuracy { get; }
|
||||
IAccuracy Accuracy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceTupleCalculator : INdmCalculator
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceTupleInputData
|
||||
{
|
||||
IEnumerable<INdm> NdmCollection { get; set; }
|
||||
IForceTuple Tuple { get; set; }
|
||||
IAccuracy Accuracy { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public interface IForcesResults : INdmResult
|
||||
{
|
||||
string Desctription { get; set; }
|
||||
List<ForcesResult> ForcesResultList { get; }
|
||||
List<IForcesTupleResult> ForcesResultList { get; }
|
||||
bool IsValid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForcesTupleResult : INdmResult
|
||||
{
|
||||
IDesignForceTuple DesignForceTuple { get; set; }
|
||||
ILoaderResults LoaderResults { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user