Buckling calculator was changed, accidental eccentricity logic was added

This commit is contained in:
Evgeny Redikultsev
2024-02-25 15:31:09 +05:00
parent 541f23c0a8
commit bf72f6d347
28 changed files with 676 additions and 145 deletions

View File

@@ -0,0 +1,21 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
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.Buckling
{
public class BucklingInputData : IInputData
{
public IForceCombinationList Combination { get; set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public List<INdm> Ndms { get; set; }
public IForceTuple ForceTuple { get; set; }
}
}

View File

@@ -4,6 +4,7 @@ using LoaderCalculator.Logics.Geometry;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
@@ -28,16 +29,16 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public IAccuracy Accuracy { get; set; }
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public IShiftTraceLogger? TraceLogger { get; set; }
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
{
var stiffness = GetStiffness();
var (DX, DY) = GetStiffness();
criticalForceLogic.LongitudinalForce = options.CalcForceTuple.Nz;
criticalForceLogic.StiffnessEI = stiffness.DX;
criticalForceLogic.StiffnessEI = DX;
criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorY;
var etaAlongY = criticalForceLogic.GetEtaFactor();
criticalForceLogic.StiffnessEI = stiffness.DY;
criticalForceLogic.StiffnessEI = DY;
criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorX;
var etaAlongX = criticalForceLogic.GetEtaFactor();
return (etaAlongX, etaAlongY);
@@ -59,13 +60,21 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
private (IConcreteDeltaELogic DeltaLogicX, IConcreteDeltaELogic DeltaLogicY) GetDeltaLogics()
{
IForceTuple forceTuple = options.CalcForceTuple;
if (forceTuple.Nz >= 0) { return (new ConstDeltaELogic(), new ConstDeltaELogic()); }
if (forceTuple.Nz >= 0)
{
return (new ConstDeltaELogic(), new ConstDeltaELogic());
}
var eccentricityAlongX = options.CalcForceTuple.My / forceTuple.Nz;
var eccentricityAlongY = options.CalcForceTuple.Mx / forceTuple.Nz;
var sizeAlongX = ndmCollection.Max(x => x.CenterX) - ndmCollection.Min(x => x.CenterX);
var sizeAlongY = ndmCollection.Max(x => x.CenterY) - ndmCollection.Min(x => x.CenterY);
var DeltaElogicAboutX = new DeltaELogicSP63(eccentricityAlongY, sizeAlongY);
var DeltaElogicAboutY = new DeltaELogicSP63(eccentricityAlongX, sizeAlongX);
if (TraceLogger is not null)
{
DeltaElogicAboutX.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
DeltaElogicAboutY.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
return (DeltaElogicAboutX, DeltaElogicAboutY);
}
@@ -78,16 +87,26 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
private (double DX, double DY) GetStiffness()
{
var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection);
var concreteInertia = GeometryOperations.GetReducedMomentsOfInertia(concreteNdms, gravityCenter);
string message = string.Format("Gravity center, x = {0}, y = {1}", gravityCenter.Cx, gravityCenter.Cy);
TraceLogger?.AddMessage(message);
var (EIx, EIy) = GeometryOperations.GetReducedMomentsOfInertia(concreteNdms, gravityCenter);
TraceLogger.AddMessage(string.Format("Summary stiffness of concrete parts EIx,c = {0}", EIx));
TraceLogger.AddMessage(string.Format("Summary stiffness of concrete parts EIy,c = {0}", EIy));
var otherInertia = GeometryOperations.GetReducedMomentsOfInertia(otherNdms, gravityCenter);
TraceLogger.AddMessage(string.Format("Summary stiffness of nonconcrete parts EIx,s = {0}", otherInertia.EIy));
TraceLogger.AddMessage(string.Format("Summary stiffness of nonconcrete parts EIy,s = {0}", otherInertia.EIy));
var stiffnessX = stiffnessLogicX.GetStiffnessCoeffitients();
var dX = stiffnessX.Kc * concreteInertia.EIx + stiffnessX.Ks * otherInertia.EIx;
var (Kc, Ks) = stiffnessLogicX.GetStiffnessCoeffitients();
var dX = Kc * EIx + Ks * otherInertia.EIx;
string mesDx = string.Format("Summary stiffness Dx = Kc * EIx,c + Ks * EIx,s = {0} * {1} + {2} * {3} = {4}",
Kc, EIx, Ks, otherInertia.EIx, dX);
TraceLogger.AddMessage(mesDx);
var stiffnessY = stiffnessLogicY.GetStiffnessCoeffitients();
var dY = stiffnessY.Kc * concreteInertia.EIy + stiffnessY.Ks * otherInertia.EIy;
var dY = stiffnessY.Kc * EIy + stiffnessY.Ks * otherInertia.EIy;
string mesDy = string.Format("Summary stiffness Dy = Kc * EIy,c + Ks * EIy,s = {0} * {1} + {2} * {3} = {4}",
stiffnessY.Kc, EIy, stiffnessY.Ks, otherInertia.EIy, dY);
TraceLogger.AddMessage(mesDy);
return (dX, dY);
}
@@ -113,34 +132,63 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
point = new Point2D() { X = item.CenterX, Y = item.CenterY };
}
}
TraceLogger.AddMessage(string.Format("Most tensioned (minimum compressed) point: x = {0}, y = {1}", point.X, point.Y));
TraceLogger.AddMessage(string.Format("Strain: epsilon = {0}", maxStrain), TraceLogStatuses.Debug);
return point;
}
private IForceTupleCalculator GetForceCalculator()
{
var tuple = options.CalcForceTuple;
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = tuple, Accuracy = Accuracy };
IForceTupleInputData inputData = new ForceTupleInputData()
{
NdmCollection = ndmCollection,
Tuple = tuple, Accuracy = Accuracy
};
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
return calculator;
}
public void Run()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018");
var checkResult = CheckInputData();
if (checkResult != "")
{
Result = new ConcreteBucklingResult() { IsValid = false, Description = checkResult };
TraceLogger?.AddMessage(checkResult, TraceLogStatuses.Error);
Result = new ConcreteBucklingResult()
{
IsValid = false,
Description = checkResult,
EtaFactorAlongX = double.PositiveInfinity,
EtaFactorAlongY = double.PositiveInfinity
};
return;
}
else
{
IConcretePhiLLogic phiLLogic = GetPhiLogic();
var phiLLogic = GetPhiLogic();
var (DeltaLogicAboutX, DeltaLogicAboutY) = GetDeltaLogics();
stiffnessLogicX = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutX);
stiffnessLogicY = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutY);
if (TraceLogger is not null)
{
stiffnessLogicX.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
stiffnessLogicY.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
criticalForceLogic = new EilerCriticalForceLogic();
if (TraceLogger is not null)
{
criticalForceLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
var (EtaFactorX, EtaFactorY) = GetBucklingCoefficients();
var messageString = "Eta factor orbitrary {0} axis, Etta{0} = {1} (dimensionless)";
var messageStringX = string.Format(messageString, "X", EtaFactorX);
var messageStringY = string.Format(messageString, "Y", EtaFactorY);
TraceLogger?.AddMessage(messageStringX);
TraceLogger?.AddMessage(messageStringY);
Result = new ConcreteBucklingResult()
{
IsValid = true,
@@ -148,17 +196,26 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
EtaFactorAlongY = EtaFactorY
};
}
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
}
private string CheckInputData()
{
string result = "";
var tuple = options.CalcForceTuple;
if (tuple.Nz >= 0d)
{
result += $"Force Nz = {tuple.Nz} must negative in compression";
return result;
}
IForceTupleCalculator calculator = GetForceCalculator();
calculator.Run();
forcesResults = calculator.Result as IForcesTupleResult;
if (forcesResults.IsValid != true)
{
result += "Bearind capacity of crosssection is not enough for initial forces\n";
result += "Bearind capacity of cross-section is not enough for initial forces\n";
TraceLogger?.AddMessage("Initial forces", TraceLogStatuses.Error);
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
}
return result;
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,9 +10,15 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{
public class ConstDeltaELogic : IConcreteDeltaELogic
{
private const double deltaE = 1.5d;
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetDeltaE()
{
return 1.5d;
var message = string.Format("Simple method of calculatinf of effect of eccentricity, DeltaE = {0}, dimensionless", deltaE);
TraceLogger?.AddMessage(message);
return deltaE;
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,9 +9,15 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{
internal class ConstPhiLLogic : IConcretePhiLLogic
{
private const double phiL = 2.0d;
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetPhil()
{
return 2.0d;
var message = string.Format("Simple method of calculatinf of effect of long term load, PhiL = {0}, dimensionless", phiL);
TraceLogger?.AddMessage(message);
return phiL;
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,6 +11,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{
double concreteFactor, reinforcementFactor;
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public double GetCriticalForce()
{
throw new NotImplementedException();

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,21 +16,31 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
readonly double eccentricity;
readonly double size;
public IShiftTraceLogger? TraceLogger { get; set; }
public DeltaELogicSP63(double eccentricity, double size)
{
if (size <= 0 )
{
TraceLogger?.AddMessage(string.Format("Height of cross-section is less or equal to zero, h = {0}", size));
throw new StructureHelperException(ErrorStrings.SizeMustBeGreaterThanZero + $", actual size: {size}");
}
this.eccentricity = eccentricity;
this.size = size;
}
public double GetDeltaE()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(string.Format("Eccentricity e = {0}", eccentricity));
TraceLogger?.AddMessage(string.Format("Height h = {0}", size));
var deltaE = Math.Abs(eccentricity) / size;
string message = string.Format("Relative eccentricity DeltaE = eccentricity / height = {0} / {1} = {2} (dimensionless)", eccentricity, size, deltaE);
TraceLogger?.AddMessage(message);
deltaE = Math.Max(deltaE, deltaEMin);
deltaE = Math.Min(deltaE, deltaEMax);
TraceLogger?.AddMessage(string.Format("But not less than {0}, and not greater than {1}", deltaEMin, deltaEMax));
TraceLogger?.AddMessage(string.Format("Relative eccentricity DeltaE = {0}", deltaE));
return deltaE;
}
}

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,22 +14,30 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public double LongitudinalForce { get; set; }
public double StiffnessEI { get; set; }
public double DesignLength { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetCriticalForce()
{
double Ncr = - Math.Pow(Math.PI, 2) * StiffnessEI / (Math.Pow(DesignLength, 2));
double Ncr = - Math.Pow(Math.PI, 2) * StiffnessEI / Math.Pow(DesignLength, 2);
string message = string.Format("Ncr = - (PI ^ 2) * D / L0 ^2 = - ({0} * {1} / ({2} ^2)) = {3}, N", Math.PI, StiffnessEI, DesignLength, Ncr);
TraceLogger?.AddMessage(message);
return Ncr;
}
public double GetEtaFactor()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
if (LongitudinalForce >= 0d) return 1d;
var Ncr = GetCriticalForce();
if (LongitudinalForce <= Ncr)
{
string error = string.Format("Absolute value of longitudinalForce is greater or equal than critical force N = {0} => Ncr = {1}", Math.Abs(LongitudinalForce), Ncr);
TraceLogger?.AddMessage(error, TraceLogStatuses.Error);
throw new StructureHelperException(ErrorStrings.LongitudinalForceMustBeLessThanCriticalForce);
}
double eta = 1 / (1 - LongitudinalForce / Ncr);
string message = string.Format("Eta factor Eta = 1 / (1 - N / Ncr) = 1 / (1 - {0} / {1}) = {2}, {3}", (-1) * LongitudinalForce, (-1) * Ncr, eta, LoggerStrings.DimensionLess);
TraceLogger?.AddMessage(message);
return eta;
}
}

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{
internal interface IConcreteDeltaELogic
internal interface IConcreteDeltaELogic : ILogic
{
double GetDeltaE();
}

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{
public interface IConcretePhiLLogic
public interface IConcretePhiLLogic : ILogic
{
double GetPhil();
}

View File

@@ -1,4 +1,5 @@
using System;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{
internal interface ICriticalBucklingForceLogic
internal interface ICriticalBucklingForceLogic : ILogic
{
double GetCriticalForce();
double GetEtaFactor();

View File

@@ -1,4 +1,5 @@
using StructureHelperLogics.NdmCalculations.Primitives;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{
public interface IRCStiffnessLogic
public interface IRCStiffnessLogic : ILogic
{
(double Kc, double Ks) GetStiffnessCoeffitients();
}

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
using System;
@@ -11,6 +13,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{
public class PhiLogicSP63 : IConcretePhiLLogic
{
private const double maxValueOfPhiL = 2d;
private const double minValueOfPhiL = 1d;
readonly IForceTuple fullForceTuple;
readonly IForceTuple longForceTuple;
readonly IPoint2D point;
@@ -21,21 +25,43 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
this.point = point;
}
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetPhil()
{
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var distance = Math.Sqrt(point.X * point.X + point.Y * point.Y);
string distMessage = string.Format("Distance = Sqrt(dX ^2 + dY^2) = Sqrt(({0})^2 + ({1})^2) = {2}, m", point.X, point.Y, distance);
TraceLogger?.AddMessage(distMessage);
var fullMoment = GetMoment(fullForceTuple, distance);
string fullMomentMessage = string.Format("FullMoment = {0}, N*m", fullMoment);
TraceLogger?.AddMessage(fullMomentMessage);
var longMoment = GetMoment(longForceTuple, distance);
if (fullMoment == 0d) { return 2d; }
var phi = 1 + longMoment / fullMoment;
phi = Math.Max(1, phi);
phi = Math.Min(2, phi);
return phi;
string longMomentMessage = string.Format("LongMoment = {0}, N*m", longMoment);
TraceLogger?.AddMessage(longMomentMessage);
if (fullMoment == 0d)
{
return maxValueOfPhiL;
}
var phiL = 1 + longMoment / fullMoment;
string phiLMessage = string.Format("PhiL = 1 + LongMoment / FullMoment = 1+ {0} / {1} = {2}, (dimensionless)", longMoment, fullMoment, phiL);
TraceLogger?.AddMessage(phiLMessage);
TraceLogger?.AddMessage(string.Format("But not less than {0}, and not greater than {1}", minValueOfPhiL, maxValueOfPhiL));
phiL = Math.Max(minValueOfPhiL, phiL);
phiL = Math.Min(maxValueOfPhiL, phiL);
TraceLogger?.AddMessage(string.Format("PhiL = {0}, (dimensionless)", phiL));
return phiL;
}
private double GetMoment(IForceTuple forceTuple, double distance)
{
return Math.Abs(forceTuple.Nz) * distance + Math.Abs(forceTuple.Mx) + Math.Abs(forceTuple.My);
double nz = Math.Abs(forceTuple.Nz);
double mx = Math.Abs(forceTuple.Mx);
double my = Math.Abs(forceTuple.My);
double moment = nz * distance + mx + my;
string message = string.Format("Moment = Nz * distance + Abs(Mx) + Abs(My) = {0} * {1} + {2} + {3} = {4}, N *m", nz, distance, mx, my, moment);
TraceLogger?.AddMessage(message);
return moment;
}
}
}

View File

@@ -1,4 +1,6 @@
using System;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,8 +10,13 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{
internal class RCStiffnessLogicSP63 : IRCStiffnessLogic
{
const double initialKs = 0.7d;
const double initialKc = 0.15d;
const double deltaEAddition = 0.3d;
IConcretePhiLLogic phiLLogic { get; }
IConcreteDeltaELogic deltaELogic { get; }
public IShiftTraceLogger? TraceLogger { get; set; }
public RCStiffnessLogicSP63() : this(new ConstPhiLLogic(), new ConstDeltaELogic()) { }
@@ -21,12 +28,17 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public (double Kc, double Ks) GetStiffnessCoeffitients()
{
const double initialKs = 0.7d;
const double initialKc = 0.15d;
const double deltaEAddition = 0.3d;
if (TraceLogger is not null)
{
phiLLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
deltaELogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
double phiL = phiLLogic.GetPhil();
double deltaE = deltaELogic.GetDeltaE();
TraceLogger?.AddMessage(string.Format("Factor of relative eccentricity DeltaE = {0}", deltaE));
double kc = initialKc / (phiL * (deltaEAddition + deltaE));
var messageString = string.Format("Factor of stiffness of concrete Kc = {0} / ({1} * ({2} + {3})) = {4}, {5}", initialKc, phiL, deltaEAddition, deltaE, kc, LoggerStrings.DimensionLess);
TraceLogger?.AddMessage(messageString);
return (kc, initialKs);
}
}