Add extended force tuple result

This commit is contained in:
Evgeny Redikultsev
2025-11-03 13:58:27 +05:00
parent 871be6cb46
commit b28606003a
24 changed files with 354 additions and 8 deletions

View File

@@ -15,7 +15,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:CrossSectionViewModel}"
Title="Cross-Section NDM Analysis" Height="700" Width="1000" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
Title="Cross-Section NDM Analysis" Height="700" Width="1100" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
<Window.Resources>
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
<dataTemplates:RectangleTemplate/>

View File

@@ -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 StructureHelperCommon.Models.Shapes
{
public interface IPoint2DRange : ISaveable
{
IPoint2D StartPoint { get; set; }
IPoint2D EndPoint { get; set; }
}
}

View File

@@ -74,7 +74,7 @@ namespace StructureHelperCommon.Models.Shapes
// compute angle from each criterion
double byAngle = options.AngleStepRadians;
double byCount = arcAngle / options.SegmentCount;
double byLength = 2 * Math.Asin(options.MaxSegmentLength / (2 * radius));
double byLength = 2 * Math.Asin(options.MaxSegmentLength * metresToMillimeters / (2 * radius));
return options.Mode switch
{

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Shapes
{
public class Point2DRange : IPoint2DRange
{
public Guid Id { get; }
public IPoint2D StartPoint { get; set; } = new Point2D();
public IPoint2D EndPoint { get; set; } = new Point2D();
public Point2DRange(Guid id)
{
Id = id;
}
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperCommon.Models.States
{
/// <summary>
/// Implements pair of limit state and calculeation term
/// </summary>
public interface IStateCalcTermPair
{
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperCommon.Models.States
{
/// <inheritdoc/>
public class StateCalcTermPair : IStateCalcTermPair
{
/// <inheritdoc/>
public LimitStates LimitState { get; set; }
/// <inheritdoc/>
public CalcTerms CalcTerm { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.States
{
public class StateCalcTermPairUpdateStrategy : IUpdateStrategy<IStateCalcTermPair>
{
public void Update(IStateCalcTermPair targetObject, IStateCalcTermPair sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.LimitState = sourceObject.LimitState;
targetObject.CalcTerm = sourceObject.CalcTerm;
}
}
}

View File

@@ -0,0 +1,10 @@
using StructureHelperCommon.Models.States;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public class ExtendedForceTupleResult : IExtendedForceTupleResult
{
public IStateCalcTermPair StateCalcTermPair { get; set; } = new StateCalcTermPair();
public IForcesTupleResult ForcesTupleResut { get; set; }
}
}

View File

@@ -60,6 +60,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
IsValid = true,
Description = string.Empty,
InputData = InputData,
};
}

View File

@@ -1,11 +1,6 @@
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
{

View File

@@ -22,6 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
/// </summary>
public ILoaderResults LoaderResults { get; set; }
public IForceTupleInputData InputData { get; set; }
public ForcesTupleResult()
{
DesignForceTuple = new DesignForceTuple();

View File

@@ -0,0 +1,10 @@
using StructureHelperCommon.Models.States;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IExtendedForceTupleResult
{
IStateCalcTermPair StateCalcTermPair { get; set; }
IForcesTupleResult ForcesTupleResut { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IForcesTupleResult : IResult
{
IForceTupleInputData InputData { get; set; }
IDesignForceTuple DesignForceTuple { get; set; }
ILoaderResults LoaderResults { get; set; }
}

View File

@@ -44,6 +44,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
IsValid = true,
Description = string.Empty,
InputData = InputData,
};
}

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Models.Calculators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public interface IValueDiagramCalculator : ICalculator
{
}
}

View File

@@ -0,0 +1,20 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.States;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
/// <summary>
/// Implements input data for Value diagram calculator
/// </summary>
public interface IValueDiagramCalculatorInputData : ISaveable, IHasForceActions, IHasPrimitives
{
IStateCalcTermPair StateTermPair { get; set; }
/// <summary>
/// Collection of diagram for calculation
/// </summary>
List<IValueDigram> Digrams { get; }
bool CheckStrainLimit { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public interface IValueDiagramCalculatorResult : IResult
{
IValueDiagramCalculatorInputData? InputData { get; set; }
List<IPoint2D> Points { get; set; }
List<IForcesTupleResult> ForceTupleResults { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public interface IValueDigram : ISaveable
{
IPoint2DRange Point2DRange { get; }
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public interface IValueDiagramCalculatorLogic : ILogic
{
IValueDiagramCalculatorInputData InputData { get; set; }
IValueDiagramCalculatorResult GetResult();
}
}

View File

@@ -0,0 +1,74 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
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 ITriangulatePrimitiveLogic triangulateLogic;
private IValueDiagramCalculatorResult result;
public IValueDiagramCalculatorInputData InputData { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public IValueDiagramCalculatorResult GetResult()
{
PrepareResult();
GetPoints();
CalculateTupleResults();
return result;
}
private void CalculateTupleResults()
{
triangulateLogic = new TriangulatePrimitiveLogic()
{
Primitives = InputData.Primitives,
LimitState = InputData.StateTermPair.LimitState,
CalcTerm = InputData.StateTermPair.CalcTerm,
TraceLogger = TraceLogger
};
var ndms = triangulateLogic.GetNdms();
foreach (var forceAction in InputData.ForceActions)
{
var combination = forceAction.GetCombinations();
List<IForceTuple> forceTuples = [];
foreach (var action in combination)
{
var actionCombination = action
.DesignForces
.Where(x => x.LimitState == InputData.StateTermPair.LimitState && x.CalcTerm == InputData.StateTermPair.CalcTerm);
}
ForceTupleInputData forceTupleInputData = new()
{
NdmCollection = ndms,
Accuracy = new Accuracy(),
CheckStrainLimit = true,
};
}
}
private void GetPoints()
{
throw new NotImplementedException();
}
private void PrepareResult()
{
result = new ValueDiagramCalculatorResult()
{
InputData = InputData,
};
}
}
}

View File

@@ -0,0 +1,38 @@
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public class ValueDiagramCalculator : IValueDiagramCalculator
{
public string Name { get; set; }
public bool ShowTraceData { get; set; }
public IResult Result => throw new NotImplementedException();
public IShiftTraceLogger? TraceLogger { get; set; }
public Guid Id { get; }
public ValueDiagramCalculator(Guid id)
{
Id = id;
}
public object Clone()
{
throw new NotImplementedException();
}
public void Run()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,34 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.States;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
/// <inheritdoc/>
public class ValueDiagramCalculatorInputData : IValueDiagramCalculatorInputData
{
/// <inheritdoc/>
public Guid Id { get; }
/// <inheritdoc/>
public List<IValueDigram> Digrams { get; } = [];
/// <inheritdoc/>
public List<IForceAction> ForceActions { get; } = [];
/// <inheritdoc/>
public List<INdmPrimitive> Primitives { get; } = [];
public IStateCalcTermPair StateTermPair { get; set; } = new StateCalcTermPair() { LimitState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm};
public bool CheckStrainLimit { get; set; } = true;
public ValueDiagramCalculatorInputData(Guid id)
{
Id = id;
}
}
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
{
public class ValueDiagramCalculatorResult : IValueDiagramCalculatorResult
{
public IValueDiagramCalculatorInputData? InputData { get; set; }
public List<IPoint2D> Points { get; set; } = [];
public List<IForcesTupleResult> ForceTupleResults { get; set; } = [];
public bool IsValid { get; set; } = true;
public string? Description { get; set; } = string.Empty;
}
}

View File

@@ -4,6 +4,7 @@ using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Exports;
using System.Runtime.CompilerServices;
namespace StructureHelperLogics.NdmCalculations.Primitives
{
@@ -35,7 +36,8 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(dxfEntity));
// just skip all types of primitives
// throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(dxfEntity));
}
}
}