Change value diagram calculator

This commit is contained in:
Evgeny Redikultsev
2025-11-15 19:33:21 +05:00
parent 466b47f447
commit 43f46b83af
28 changed files with 563 additions and 66 deletions

View File

@@ -1,21 +1,21 @@
using StructureHelperCommon.Infrastructures.Enums;
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Sections;
using StructureHelperCommon.Models.Sections.Logics;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.Services.NdmPrimitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public class ValueDiagramCalculatorLogic : IValueDiagramCalculatorLogic
{
private readonly IValueDiagramEntityLogic entityLogic = new ValueDiagramEntityLogic();
private ITriangulatePrimitiveLogic triangulateLogic;
private List<INdm> ndms;
private IValueDiagramCalculatorResult result;
public IValueDiagramCalculatorInputData InputData { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
@@ -23,7 +23,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
public IValueDiagramCalculatorResult GetResult()
{
PrepareResult();
GetPoints();
GetEntitiesResults();
CalculateTupleResults();
return result;
}
@@ -37,30 +37,67 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
CalcTerm = InputData.StateTermPair.CalcTerm,
TraceLogger = TraceLogger
};
var ndms = triangulateLogic.GetNdms();
ndms = triangulateLogic.GetNdms();
foreach (var forceAction in InputData.ForceActions)
{
var combination = forceAction.GetCombinations();
List<IForceTuple> forceTuples = [];
foreach (var action in combination)
{
var actionCombination = action
var forceTuple = action
.DesignForces
.Where(x => x.LimitState == InputData.StateTermPair.LimitState && x.CalcTerm == InputData.StateTermPair.CalcTerm);
}
ForceTupleInputData forceTupleInputData = new()
{
NdmCollection = ndms,
Accuracy = new Accuracy(),
CheckStrainLimit = true,
.Single(x => x.LimitState == InputData.StateTermPair.LimitState && x.CalcTerm == InputData.StateTermPair.CalcTerm)
.ForceTuple;
IPoint2D point2D;
IProcessorLogic<IForceTuple> forcelogic = new ForceTupleCopier(forceTuple);
if (action.SetInGravityCenter == true)
{
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
point2D = new Point2D() { X = Cx, Y = Cy };
forcelogic = new ForceTupleMoveToPointDecorator(forcelogic) { Point2D = point2D };
}
var newTuple = forcelogic.GetValue();
GetForceTupleResult(forceAction, newTuple);
}
};
}
}
private void GetPoints()
private void GetForceTupleResult(IForceAction forceAction, IForceTuple forceTuple)
{
throw new NotImplementedException();
ForceTupleInputData forceTupleInputData = new()
{
ForceTuple = forceTuple,
NdmCollection = ndms,
Accuracy = new Accuracy() { IterationAccuracy = 0.001, MaxIterationCount = 1000},
CheckStrainLimit = InputData.CheckStrainLimit,
};
ForceTupleCalculator calculator = new ForceTupleCalculator()
{
InputData = forceTupleInputData,
TraceLogger = TraceLogger?.GetSimilarTraceLogger(100)
};
calculator.Run();
var tupleResult = calculator.Result as IForceTupleCalculatorResult;
if (tupleResult.IsValid == false)
{
TraceLogger?.AddMessage($"Result is not valid for action {forceAction.Name}: {tupleResult.Description}", TraceLogStatuses.Error);
}
result.ForceTupleResults.Add(tupleResult);
}
private void GetEntitiesResults()
{
var entities = InputData.Digrams
.Where(x => x.IsTaken == true);
foreach (var entity in entities)
{
entityLogic.ValueDiagramEntity = entity;
entityLogic.Run();
result.EntityResults.Add(entityLogic.Result);
}
}
private void PrepareResult()