Force calculator was changed

This commit is contained in:
Evgeny Redikultsev
2024-02-28 21:03:23 +05:00
parent 24c791c78f
commit 9469d53614
2 changed files with 82 additions and 4 deletions

View File

@@ -87,6 +87,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
} }
else else
{ {
TraceLogger?.AddMessage("Get eccentricity for full load");
newTuple = ProcessAccEccentricity(ndms, newTuple); newTuple = ProcessAccEccentricity(ndms, newTuple);
newTuple = GetForceTupleByBuckling(ndmResult, combination, limitState, calcTerm, ndms, newTuple); newTuple = GetForceTupleByBuckling(ndmResult, combination, limitState, calcTerm, ndms, newTuple);
} }
@@ -177,6 +178,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState); longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState);
} }
TraceLogger?.AddMessage("Get eccentricity for long term load");
longTuple = ProcessAccEccentricity(inputData.Ndms, longTuple); longTuple = ProcessAccEccentricity(inputData.Ndms, longTuple);
var bucklingCalculator = GetBucklingCalculator(CompressedMember, inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple); var bucklingCalculator = GetBucklingCalculator(CompressedMember, inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple);
if (TraceLogger is not null) if (TraceLogger is not null)

View File

@@ -1,10 +1,14 @@
using LoaderCalculator; using LoaderCalculator;
using LoaderCalculator.Data.Matrix; using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Data.ResultData; using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Data.SourceData; using LoaderCalculator.Data.SourceData;
using LoaderCalculator.Logics;
using StructureHelperCommon.Models; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers; using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
@@ -70,8 +74,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
var calcResult = calculator.Result; var calcResult = calculator.Result;
if (calcResult.AccuracyRate <= accuracy.IterationAccuracy) if (calcResult.AccuracyRate <= accuracy.IterationAccuracy)
{ {
TraceLogger?.AddMessage($"Analisis is done succsesfully"); TraceGoodResult(ndmCollection, calcResult);
TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate} has acheived in {calcResult.IterationCounter} iteration", TraceLogStatuses.Debug);
return new ForcesTupleResult() return new ForcesTupleResult()
{ {
IsValid = true, IsValid = true,
@@ -81,12 +84,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
} }
else else
{ {
TraceLogger?.AddMessage($"Required accuracy rate has not achived", TraceLogStatuses.Error); TraceLogger?.AddMessage($"Required accuracy rate has not achieved", TraceLogStatuses.Error);
TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate}, {calcResult.IterationCounter} iteration has done", TraceLogStatuses.Warning); TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate}, {calcResult.IterationCounter} iteration has done", TraceLogStatuses.Warning);
return new ForcesTupleResult() return new ForcesTupleResult()
{ {
IsValid = false, IsValid = false,
Description = "Required accuracy rate has not achived", Description = "Required accuracy rate has not achieved",
LoaderResults = calcResult LoaderResults = calcResult
}; };
} }
@@ -112,6 +115,79 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
} }
} }
private void TraceGoodResult(IEnumerable<INdm> ndmCollection, ILoaderResults calcResult)
{
TraceLogger?.AddMessage($"Analysis is done succsesfully");
TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate} has achieved in {calcResult.IterationCounter} iteration", TraceLogStatuses.Debug);
var strainMatrix = calcResult.ForceStrainPair.StrainMatrix;
var stiffness = new StiffnessLogic().GetStiffnessMatrix(ndmCollection, strainMatrix);
TraceLogger?.AddMessage(string.Format("Next strain were obtained kx = {0}, ky = {1}, epsz = {2}", strainMatrix.Kx, strainMatrix.Ky, strainMatrix.EpsZ));
TraceMinMaxStrain(ndmCollection, strainMatrix);
TraceStrainAndStiffness(strainMatrix, stiffness);
}
private void TraceMinMaxStrain(IEnumerable<INdm> ndmCollection, IStrainMatrix strainMatrix)
{
var stressLogic = new StressLogic();
double minStrain = double.PositiveInfinity, maxStrain = double.NegativeInfinity;
Point2D minPoint = new Point2D(), maxPoint = new Point2D();
foreach (var item in ndmCollection)
{
var strain = stressLogic.GetTotalStrain(strainMatrix, item);
if (strain < minStrain)
{
minStrain = strain;
minPoint = new Point2D() { X = item.CenterX, Y = item.CenterY };
}
if (strain > maxStrain)
{
maxStrain = strain;
maxPoint = new Point2D() { X = item.CenterX, Y = item.CenterY };
}
}
TraceLogger?.AddMessage(string.Format("Max strain EpsilonMax = {0}, at point x = {1}, y = {2}", maxStrain, maxPoint.X, maxPoint.Y), TraceLogStatuses.Debug);
TraceLogger?.AddMessage(string.Format("Min strain EpsilonMin = {0}, at point x = {1}, y = {2}", minStrain, minPoint.X, minPoint.Y), TraceLogStatuses.Debug);
}
private void TraceStrainAndStiffness(IStrainMatrix strain, IStiffnessMatrix stiffness)
{
TraceLogger?.AddMessage("Stiffness matrix");
TraceLogger?.AddMessage(string.Format("D11 = {0}, D12 = {1}, D13 = {2}", stiffness[0, 0], stiffness[0, 1], stiffness[0, 2]));
TraceLogger?.AddMessage(string.Format("D21 = {0}, D22 = {1}, D23 = {2}", stiffness[1, 0], stiffness[1, 1], stiffness[1, 2]));
TraceLogger?.AddMessage(string.Format("D31 = {0}, D32 = {1}, D33 = {2}", stiffness[2, 0], stiffness[2, 1], stiffness[2, 2]));
TraceLogger?.AddMessage("Checking equilibrium equations");
var exitMx = stiffness[0, 0] * strain.Kx + stiffness[0, 1] * strain.Ky + stiffness[0, 2] * strain.EpsZ;
var exitMy = stiffness[1, 0] * strain.Kx + stiffness[1, 1] * strain.Ky + stiffness[1, 2] * strain.EpsZ;
var exitNz = stiffness[2, 0] * strain.Kx + stiffness[2, 1] * strain.Ky + stiffness[2, 2] * strain.EpsZ;
TraceLogger?.AddMessage(string.Format("D11 * kx + D12 * ky + D13 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[0, 0], strain.Kx,
stiffness[0, 1], strain.Ky,
stiffness[0, 2], strain.EpsZ,
exitMx
));
TraceLogger?.AddMessage(string.Format("D12 * kx + D22 * ky + D23 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[1, 0], strain.Kx,
stiffness[1, 1], strain.Ky,
stiffness[1, 2], strain.EpsZ,
exitMy
));
TraceLogger?.AddMessage(string.Format("D31 * kx + D32 * ky + D33 * epsz =\n {0} * {1} + {2} * {3} + {4} * {5} = {6}",
stiffness[2, 0], strain.Kx,
stiffness[2, 1], strain.Ky,
stiffness[2, 2], strain.EpsZ,
exitNz
));
TraceLogger?.AddMessage($"Output force combination");
var outputTuple = new ForceTuple()
{
Mx = exitMx,
My = exitMy,
Nz = exitNz
};
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(outputTuple));
}
public object Clone() public object Clone()
{ {
var newItem = new ForceTupleCalculator(); var newItem = new ForceTupleCalculator();