Buckling calculator was changed, accidental eccentricity logic was added
This commit is contained in:
@@ -16,13 +16,14 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public class ForceCalculator : IForceCalculator, IHasActionByResult
|
||||
{
|
||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||
private readonly IForceTupleCalculator forceTupleCalculator;
|
||||
public string Name { get; set; }
|
||||
public List<LimitStates> LimitStatesList { get; }
|
||||
public List<CalcTerms> CalcTermsList { get; }
|
||||
public List<IForceAction> ForceActions { get; }
|
||||
public List<INdmPrimitive> Primitives { get; }
|
||||
public List<LimitStates> LimitStatesList { get; private set; }
|
||||
public List<CalcTerms> CalcTermsList { get; private set; }
|
||||
public List<IForceAction> ForceActions { get; private set; }
|
||||
public List<INdmPrimitive> Primitives { get; private set; }
|
||||
public IResult Result { get; private set; }
|
||||
public ICompressedMember CompressedMember { get; }
|
||||
public ICompressedMember CompressedMember { get; private set; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
@@ -58,66 +59,129 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
var calcTerm = tuple.CalcTerm;
|
||||
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
||||
{
|
||||
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
||||
IPoint2D point2D;
|
||||
if (combination.SetInGravityCenter == true)
|
||||
{
|
||||
var loaderPoint = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
point2D = new Point2D() { X = loaderPoint.Cx, Y = loaderPoint.Cy };
|
||||
}
|
||||
else point2D = combination.ForcePoint;
|
||||
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D) as ForceTuple;
|
||||
IForcesTupleResult 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.Description += $"Buckling result:\n{bucklingResult.Description}\n";
|
||||
}
|
||||
newTuple = CalculateBuckling(newTuple, bucklingResult);
|
||||
result = GetPrimitiveStrainMatrix(ndms, newTuple);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description = $"Buckling error:\n{ex}\n";
|
||||
}
|
||||
}
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
ActionToOutputResults?.Invoke(ndmResult);
|
||||
ProcessNdmResult(ndmResult, combination, tuple, limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
Result = ndmResult;
|
||||
}
|
||||
|
||||
|
||||
private void GetCombinations()
|
||||
private void ProcessNdmResult(ForcesResults ndmResult, IForceCombinationList combination, IDesignForceTuple tuple, LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
foreach (var item in ForceActions)
|
||||
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
||||
IPoint2D point2D;
|
||||
if (combination.SetInGravityCenter == true)
|
||||
{
|
||||
ForceCombinationLists.Add(item.GetCombinations());
|
||||
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
point2D = new Point2D(){ X = Cx, Y = Cy };
|
||||
}
|
||||
else point2D = combination.ForcePoint;
|
||||
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
|
||||
TraceLogger?.AddMessage($"Input force combination");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
if (CompressedMember.Buckling == true)
|
||||
{
|
||||
if (newTuple.Nz >= 0d)
|
||||
{
|
||||
TraceLogger.AddMessage(string.Format("Second order effect is not considered as Nz={0} >= 0", newTuple.Nz));
|
||||
}
|
||||
else
|
||||
{
|
||||
newTuple = ProcessAccEccentricity(ndms, newTuple);
|
||||
var inputData = new BucklingInputData()
|
||||
{
|
||||
Combination = combination,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
Ndms = ndms,
|
||||
ForceTuple = newTuple
|
||||
};
|
||||
var bucklingResult = ProcessBuckling(inputData);
|
||||
|
||||
if (bucklingResult.IsValid != true)
|
||||
{
|
||||
TraceLogger?.AddMessage(bucklingResult.Description, TraceLogStatuses.Error);
|
||||
var result = new ForcesTupleResult
|
||||
{
|
||||
IsValid = false,
|
||||
Description = $"Buckling result:\n{bucklingResult.Description}\n",
|
||||
DesignForceTuple = new DesignForceTuple()
|
||||
{
|
||||
ForceTuple = newTuple,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm
|
||||
}
|
||||
};
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
newTuple = CalculateBuckling(newTuple, bucklingResult);
|
||||
TraceLogger?.AddMessage($"Force combination with considering of second order effects");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
|
||||
var result = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
ActionToOutputResults?.Invoke(ndmResult);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newTuple.Nz < 0d)
|
||||
{
|
||||
string message = string.Format("Second order effect is not considered, despite force Nz={0}", newTuple.Nz);
|
||||
TraceLogger.AddMessage(message, TraceLogStatuses.Warning);
|
||||
}
|
||||
var result = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
ActionToOutputResults?.Invoke(ndmResult);
|
||||
}
|
||||
}
|
||||
|
||||
private IForceTuple ProcessAccEccentricity(List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
var accLogic = new AccidentalEccentricityLogic()
|
||||
{
|
||||
CompressedMember = CompressedMember,
|
||||
SizeX = ndms.Max(x => x.CenterX) - ndms.Min(x => x.CenterX),
|
||||
SizeY = ndms.Max(x => x.CenterY) - ndms.Min(x => x.CenterY),
|
||||
InitialForceTuple = newTuple,
|
||||
};
|
||||
if (TraceLogger is not null) { accLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50); }
|
||||
newTuple = accLogic.GetForceTuple();
|
||||
return newTuple;
|
||||
}
|
||||
|
||||
private IConcreteBucklingResult ProcessBuckling(BucklingInputData inputData)
|
||||
{
|
||||
IForceTuple resultTuple;
|
||||
IForceTuple longTuple;
|
||||
if (inputData.CalcTerm == CalcTerms.LongTerm)
|
||||
{
|
||||
longTuple = inputData.ForceTuple;
|
||||
}
|
||||
else
|
||||
{
|
||||
longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState);
|
||||
}
|
||||
longTuple = ProcessAccEccentricity(inputData.Ndms, longTuple);
|
||||
var bucklingCalculator = GetBucklingCalculator(CompressedMember, inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple);
|
||||
if (TraceLogger is not null)
|
||||
{
|
||||
bucklingCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||
}
|
||||
bucklingCalculator.Run();
|
||||
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
|
||||
|
||||
return bucklingResult;
|
||||
}
|
||||
|
||||
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
|
||||
@@ -136,18 +200,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
|
||||
{
|
||||
IConcreteBucklingOptions options = new ConcreteBucklingOptions()
|
||||
{ CompressedMember = compressedMember,
|
||||
var options = new ConcreteBucklingOptions()
|
||||
{
|
||||
CompressedMember = compressedMember,
|
||||
LimitState = limitStates,
|
||||
CalcTerm = calcTerms,
|
||||
CalcForceTuple = calcTuple,
|
||||
LongTermTuple = longTuple,
|
||||
Primitives = Primitives };
|
||||
IConcreteBucklingCalculator bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
||||
Primitives = Primitives
|
||||
};
|
||||
var bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
|
||||
return bucklingCalculator;
|
||||
}
|
||||
|
||||
private ForceTuple CalculateBuckling(ForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
||||
private ForceTuple CalculateBuckling(IForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
|
||||
{
|
||||
var newTuple = calcTuple.Clone() as ForceTuple;
|
||||
newTuple.Mx *= bucklingResult.EtaFactorAlongY;
|
||||
@@ -159,27 +225,86 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
private string CheckInputData()
|
||||
{
|
||||
string result = "";
|
||||
NdmPrimitivesService.CheckPrimitives(Primitives);
|
||||
if (ForceActions.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"; }
|
||||
try
|
||||
{
|
||||
NdmPrimitivesService.CheckPrimitives(Primitives);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result += ex;
|
||||
}
|
||||
if (ForceActions.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()
|
||||
public ForceCalculator(IForceTupleCalculator forceTupleCalculator)
|
||||
{
|
||||
this.forceTupleCalculator = forceTupleCalculator;
|
||||
SetDefaultProperties();
|
||||
}
|
||||
|
||||
public ForceCalculator() : this(new ForceTupleCalculator())
|
||||
{
|
||||
}
|
||||
|
||||
private void SetDefaultProperties()
|
||||
{
|
||||
ForceActions = new List<IForceAction>();
|
||||
Primitives = new List<INdmPrimitive>();
|
||||
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 };
|
||||
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 void GetCombinations()
|
||||
{
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
foreach (var item in ForceActions)
|
||||
{
|
||||
ForceCombinationLists.Add(item.GetCombinations());
|
||||
}
|
||||
}
|
||||
|
||||
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple)
|
||||
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple, IAccuracy accuracy)
|
||||
{
|
||||
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = tuple, Accuracy = Accuracy };
|
||||
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
|
||||
var inputData = new ForceTupleInputData()
|
||||
{
|
||||
NdmCollection = ndmCollection,
|
||||
Tuple = tuple,
|
||||
Accuracy = accuracy
|
||||
};
|
||||
var calculator = forceTupleCalculator.Clone() as IForceTupleCalculator;
|
||||
calculator.InputData = inputData;
|
||||
if (TraceLogger is not null)
|
||||
{
|
||||
calculator.TraceLogger = TraceLogger.GetSimilarTraceLogger();
|
||||
}
|
||||
calculator.Run();
|
||||
return calculator.Result as IForcesTupleResult;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using LoaderCalculator.Data.ResultData;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
@@ -74,7 +75,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
return new ForcesTupleResult()
|
||||
{
|
||||
IsValid = true,
|
||||
Description = "Analysis is done succsefully",
|
||||
Description = LoggerStrings.CalculationHasDone,
|
||||
LoaderResults = calcResult
|
||||
};
|
||||
}
|
||||
@@ -113,7 +114,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var newItem = new ForceTupleCalculator();
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private static void ShowResultToConsole(ILoaderResults result)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
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.Analyses.ByForces
|
||||
{
|
||||
public interface IProcessTupleInputData : IInputData
|
||||
{
|
||||
List<INdm> Ndms { get; set; }
|
||||
IForceCombinationList Combination { get; set; }
|
||||
IDesignForceTuple Tuple { get; set; }
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IProcessTupleLogic : ILogic
|
||||
{
|
||||
IForceTupleInputData InputData { get; set; }
|
||||
IForcesTupleResult ProcessNdmResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ProcessTupleLogic : IProcessTupleLogic
|
||||
{
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
IForceTupleInputData IProcessTupleLogic.InputData { get; set; }
|
||||
|
||||
public IForcesTupleResult ProcessNdmResult()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user