Force calculator was changed
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,23 +12,10 @@
|
||||
<Style x:Key="cbStyle" TargetType="CheckBox">
|
||||
<Setter Property="Margin" Value="0,5,0,5"/>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataTemplate x:Key="InputDataTemplate">
|
||||
<TabControl>
|
||||
<TabItem Header="General">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="300"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Name"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
<GroupBox Header="Limit States">
|
||||
<StackPanel>
|
||||
<CheckBox Style="{StaticResource cbStyle}" Content="Ultimate Limit State" IsChecked="{Binding ULS}"/>
|
||||
@@ -92,6 +79,28 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="300"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Name"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Name}"/>
|
||||
</Grid>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource InputDataTemplate}" Content="{Binding InputData}" />
|
||||
</Grid>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -408,7 +408,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
this.forceCalculator = forceCalculator;
|
||||
forcesResults = forceCalculator.Result as IForcesResults;
|
||||
ndmPrimitives = forceCalculator.Primitives;
|
||||
ndmPrimitives = forceCalculator.InputData.Primitives;
|
||||
}
|
||||
|
||||
private void ShowIsoField()
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
public class ForceCalculatorInputDataVM : ViewModelBase
|
||||
{
|
||||
private ForceInputData inputData;
|
||||
SecondOrderViewModel secondOrderViewModel;
|
||||
|
||||
public double IterationAccuracy
|
||||
{
|
||||
get { return inputData.Accuracy.IterationAccuracy; }
|
||||
set { inputData.Accuracy.IterationAccuracy = value; }
|
||||
}
|
||||
|
||||
public int MaxIterationCount
|
||||
{
|
||||
get { return inputData.Accuracy.MaxIterationCount; }
|
||||
set { inputData.Accuracy.MaxIterationCount = value; }
|
||||
}
|
||||
|
||||
public SecondOrderViewModel SecondOrder => secondOrderViewModel;
|
||||
|
||||
public bool ULS { get; set; }
|
||||
public bool SLS { get; set; }
|
||||
public bool ShortTerm { get; set; }
|
||||
public bool LongTerm { get; set; }
|
||||
|
||||
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; private set; }
|
||||
|
||||
|
||||
public ForceCalculatorInputDataVM(ForceInputData inputData, IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations)
|
||||
{
|
||||
this.inputData = inputData;
|
||||
secondOrderViewModel = new SecondOrderViewModel(this.inputData.CompressedMember);
|
||||
CombinationViewModel = SourceTargetFactory.GetSourceTargetVM(allowedCombinations, this.inputData.ForceActions);
|
||||
PrimitivesViewModel = SourceTargetFactory.GetSourceTargetVM(allowedPrimitives, this.inputData.Primitives);
|
||||
InputRefresh();
|
||||
}
|
||||
|
||||
public void InputRefresh()
|
||||
{
|
||||
ULS = inputData.LimitStatesList.Contains(LimitStates.ULS);
|
||||
SLS = inputData.LimitStatesList.Contains(LimitStates.SLS);
|
||||
ShortTerm = inputData.CalcTermsList.Contains(CalcTerms.ShortTerm);
|
||||
LongTerm = inputData.CalcTermsList.Contains(CalcTerms.LongTerm);
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
var combinations = CombinationViewModel.GetTargetItems();
|
||||
inputData.ForceActions.Clear();
|
||||
foreach (var item in combinations)
|
||||
{
|
||||
inputData.ForceActions.Add(item);
|
||||
}
|
||||
inputData.Primitives.Clear();
|
||||
foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||
{
|
||||
inputData.Primitives.Add(item.GetNdmPrimitive());
|
||||
}
|
||||
inputData.LimitStatesList.Clear();
|
||||
if (ULS == true) { inputData.LimitStatesList.Add(LimitStates.ULS); }
|
||||
if (SLS == true) { inputData.LimitStatesList.Add(LimitStates.SLS); }
|
||||
inputData.CalcTermsList.Clear();
|
||||
if (ShortTerm == true) { inputData.CalcTermsList.Add(CalcTerms.ShortTerm); }
|
||||
if (LongTerm == true) { inputData.CalcTermsList.Add(CalcTerms.LongTerm); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
@@ -16,7 +17,6 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
public class ForceCalculatorViewModel : OkCancelViewModelBase
|
||||
{
|
||||
ForceCalculator forcesCalculator;
|
||||
SecondOrderViewModel secondOrderViewModel;
|
||||
|
||||
public string Name
|
||||
{
|
||||
@@ -24,64 +24,17 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
set { forcesCalculator.Name = value; }
|
||||
}
|
||||
|
||||
public double IterationAccuracy
|
||||
{
|
||||
get { return forcesCalculator.Accuracy.IterationAccuracy; }
|
||||
set { forcesCalculator.Accuracy.IterationAccuracy = value;}
|
||||
}
|
||||
|
||||
public int MaxIterationCount
|
||||
{
|
||||
get { return forcesCalculator.Accuracy.MaxIterationCount; }
|
||||
set { forcesCalculator.Accuracy.MaxIterationCount = value; }
|
||||
}
|
||||
|
||||
public SecondOrderViewModel SecondOrder => secondOrderViewModel;
|
||||
|
||||
public bool ULS { get; set; }
|
||||
public bool SLS { get; set; }
|
||||
public bool ShortTerm { get; set; }
|
||||
public bool LongTerm { get; set; }
|
||||
|
||||
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; private set; }
|
||||
public ForceCalculatorInputDataVM InputData { get; }
|
||||
|
||||
public ForceCalculatorViewModel(IEnumerable<INdmPrimitive> allowedPrimitives, IEnumerable<IForceAction> allowedCombinations, ForceCalculator forcesCalculator)
|
||||
{
|
||||
this.forcesCalculator = forcesCalculator;
|
||||
secondOrderViewModel = new SecondOrderViewModel(this.forcesCalculator.CompressedMember);
|
||||
CombinationViewModel = SourceTargetFactory.GetSourceTargetVM(allowedCombinations, this.forcesCalculator.ForceActions);
|
||||
PrimitivesViewModel = SourceTargetFactory.GetSourceTargetVM(allowedPrimitives, this.forcesCalculator.Primitives);
|
||||
InputRefresh();
|
||||
InputData = new ForceCalculatorInputDataVM(this.forcesCalculator.InputData, allowedPrimitives, allowedCombinations);
|
||||
}
|
||||
|
||||
public void InputRefresh()
|
||||
internal void Refresh()
|
||||
{
|
||||
ULS = forcesCalculator.LimitStatesList.Contains(LimitStates.ULS);
|
||||
SLS = forcesCalculator.LimitStatesList.Contains(LimitStates.SLS);
|
||||
ShortTerm = forcesCalculator.CalcTermsList.Contains(CalcTerms.ShortTerm);
|
||||
LongTerm = forcesCalculator.CalcTermsList.Contains(CalcTerms.LongTerm);
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
var combinations = CombinationViewModel.GetTargetItems();
|
||||
forcesCalculator.ForceActions.Clear();
|
||||
foreach (var item in combinations)
|
||||
{
|
||||
forcesCalculator.ForceActions.Add(item);
|
||||
}
|
||||
forcesCalculator.Primitives.Clear();
|
||||
foreach (var item in PrimitivesViewModel.GetTargetItems())
|
||||
{
|
||||
forcesCalculator.Primitives.Add(item.GetNdmPrimitive());
|
||||
}
|
||||
forcesCalculator.LimitStatesList.Clear();
|
||||
if (ULS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.ULS); }
|
||||
if (SLS == true) { forcesCalculator.LimitStatesList.Add(LimitStates.SLS); }
|
||||
forcesCalculator.CalcTermsList.Clear();
|
||||
if (ShortTerm == true) { forcesCalculator.CalcTermsList.Add(CalcTerms.ShortTerm); }
|
||||
if (LongTerm == true) { forcesCalculator.CalcTermsList.Add(CalcTerms.LongTerm); }
|
||||
InputData.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
var calcRepository = repository.CalculatorsList;
|
||||
foreach (var calc in calcRepository)
|
||||
{
|
||||
if (calc is IForceCalculator)
|
||||
if (calc is ForceCalculator forceCalculator)
|
||||
{
|
||||
var forceCombinations = calc as IHasForceCombinations;
|
||||
var forceCombinations = forceCalculator.InputData as IHasForceCombinations;
|
||||
result = DeleteActionFromHost(result, calc, forceCombinations);
|
||||
}
|
||||
else if (calc is CrackCalculator calculator)
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
private void AddCrackCalculator()
|
||||
{
|
||||
var inputData = new CrackInputData();
|
||||
var calculator = new CrackCalculator(inputData, new CheckCrackCalculatorInputDataLogic(inputData))
|
||||
var calculator = new CrackCalculator(inputData)
|
||||
{
|
||||
Name = "New crack calculator",
|
||||
TraceLogger = new ShiftTraceLogger(),
|
||||
|
||||
@@ -136,9 +136,9 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
repository.Primitives.Remove(ndmPrimitive);
|
||||
foreach (var calc in repository.CalculatorsList)
|
||||
{
|
||||
if (calc is IForceCalculator)
|
||||
if (calc is ForceCalculator forceCalculator)
|
||||
{
|
||||
var forceCalc = calc as IHasPrimitives;
|
||||
var forceCalc = forceCalculator.InputData as IHasPrimitives;
|
||||
forceCalc.Primitives.Remove(ndmPrimitive);
|
||||
}
|
||||
else if (calc is LimitCurvesCalculator calculator)
|
||||
|
||||
@@ -7,8 +7,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface ICheckInputDataLogic : ICheckLogic
|
||||
public interface ICheckInputDataLogic<TInputData> : ICheckLogic where TInputData : IInputData
|
||||
{
|
||||
IInputData InputData { get; set; }
|
||||
TInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IDecorator<T> where T : class
|
||||
{
|
||||
T SourceValue { get; }
|
||||
T GetModifiedValue();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
@@ -58,10 +59,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
{
|
||||
foreach (var calculator in calculators)
|
||||
{
|
||||
if (calculator is IHasForceCombinations)
|
||||
if (calculator is ForceCalculator forceCalculator)
|
||||
{
|
||||
var forceCalculator = calculator as IHasForceCombinations;
|
||||
forceCalculator.ForceActions.AddRange(combinations);
|
||||
forceCalculator.InputData.ForceActions.AddRange(combinations);
|
||||
}
|
||||
if (calculator is CrackCalculator crackCalculator)
|
||||
{
|
||||
@@ -73,10 +73,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
|
||||
{
|
||||
foreach (var calculator in calculators)
|
||||
{
|
||||
if (calculator is IHasPrimitives)
|
||||
if (calculator is ForceCalculator forceCalculator)
|
||||
{
|
||||
var primitiveCalculator = calculator as IHasPrimitives;
|
||||
primitiveCalculator.Primitives.AddRange(primitives);
|
||||
forceCalculator.InputData.Primitives.AddRange(primitives);
|
||||
}
|
||||
if (calculator is CrackCalculator crackCalculator)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models;
|
||||
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
|
||||
{
|
||||
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<ForceInputData>
|
||||
{
|
||||
|
||||
public ForceInputData InputData { get; set; }
|
||||
|
||||
public string CheckResult { get; private set; }
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckForceCalculatorInputData(ForceInputData inputData)
|
||||
{
|
||||
InputData = inputData;
|
||||
CheckResult = string.Empty;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
bool result = true;
|
||||
CheckResult = string.Empty;
|
||||
if (!InputData.Primitives.Any())
|
||||
{
|
||||
CheckResult += "Calculator does not contain any primitives \n";
|
||||
result = false;
|
||||
}
|
||||
if (!InputData.ForceActions.Any())
|
||||
{
|
||||
CheckResult += "Calculator does not contain any forces \n";
|
||||
result = false;
|
||||
}
|
||||
if (!InputData.LimitStatesList.Any())
|
||||
{
|
||||
CheckResult += "Calculator does not contain any limit states \n";
|
||||
result = false;
|
||||
}
|
||||
if (!InputData.CalcTermsList.Any())
|
||||
{
|
||||
CheckResult += "Calculator does not contain any calc term \n";
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,297 +1,76 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Models.Sections.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Buckling;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculator : IForceCalculator, IHasActionByResult
|
||||
public class ForceCalculator : ICalculator, IHasActionByResult
|
||||
{
|
||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||
private readonly IForceTupleCalculator forceTupleCalculator;
|
||||
private ForcesResults result;
|
||||
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||
private ForceTupleBucklingLogic bucklingLogic;
|
||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||
private IUpdateStrategy<ForceCalculator> updateStrategy = new ForceCalculatorUpdateStrategy();
|
||||
private ICheckInputDataLogic<ForceInputData> checkInputDataLogic;
|
||||
private IForceCalculatorLogic forceCalculatorLogic;
|
||||
|
||||
|
||||
public string Name { get; set; }
|
||||
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; private set; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; private set; }
|
||||
public ForceInputData InputData {get;set;}
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public IResult Result { get; private set; }
|
||||
|
||||
public void Run()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
var checkResult = CheckInputData();
|
||||
if (checkResult != string.Empty)
|
||||
checkInputDataLogic = new CheckForceCalculatorInputData(InputData);
|
||||
checkInputDataLogic.TraceLogger?.GetSimilarTraceLogger(50);
|
||||
if (checkInputDataLogic.Check() != true)
|
||||
{
|
||||
Result = new ForcesResults()
|
||||
{
|
||||
IsValid = false,
|
||||
Description = checkResult
|
||||
Description = checkInputDataLogic.CheckResult
|
||||
};
|
||||
return;
|
||||
}
|
||||
GetCombinations();
|
||||
CalculateResult();
|
||||
if (ActionToOutputResults is not null)
|
||||
{
|
||||
forceCalculatorLogic.ActionToOutputResults = ActionToOutputResults;
|
||||
}
|
||||
forceCalculatorLogic.TraceLogger = TraceLogger?.GetSimilarTraceLogger(50);
|
||||
Result = forceCalculatorLogic.GetForcesResults();
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
private void GetResult()
|
||||
{
|
||||
result = new ForcesResults()
|
||||
{
|
||||
IsValid = true
|
||||
};
|
||||
foreach (var combination in ForceCombinationLists)
|
||||
{
|
||||
foreach (var tuple in combination.DesignForces)
|
||||
{
|
||||
var limitState = tuple.LimitState;
|
||||
var calcTerm = tuple.CalcTerm;
|
||||
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
||||
{
|
||||
|
||||
IForcesTupleResult tupleResult;
|
||||
try
|
||||
{
|
||||
tupleResult = ProcessNdmResult(combination, tuple);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
tupleResult = new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
Description = string.Empty + ex,
|
||||
DesignForceTuple = tuple
|
||||
};
|
||||
}
|
||||
result.ForcesResultList.Add(tupleResult);
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Result = result;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private IForcesTupleResult ProcessNdmResult(IForceCombinationList combination, IDesignForceTuple tuple)
|
||||
public ForceCalculator(ForceInputData inputData,
|
||||
ICheckInputDataLogic<ForceInputData> checkInputDataLogic,
|
||||
IForceCalculatorLogic forceCalculatorLogic,
|
||||
IUpdateStrategy<ForceCalculator> updateStrategy
|
||||
)
|
||||
{
|
||||
IForcesTupleResult tupleResult;
|
||||
LimitStates limitState = tuple.LimitState;
|
||||
CalcTerms calcTerm = tuple.CalcTerm;
|
||||
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
{
|
||||
Primitives = Primitives,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
var ndms = triangulateLogic.GetNdms();
|
||||
IPoint2D point2D;
|
||||
IProcessorLogic<IForceTuple> forcelogic = new ForceTupleCopier(tuple.ForceTuple);
|
||||
if (combination.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();
|
||||
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));
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
}
|
||||
else
|
||||
{
|
||||
tupleResult = ProcessCompressedMember(combination, tuple, ndms, newTuple);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
}
|
||||
return tupleResult;
|
||||
this.InputData = inputData;
|
||||
this.checkInputDataLogic = checkInputDataLogic;
|
||||
this.forceCalculatorLogic = forceCalculatorLogic;
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
private IForcesTupleResult ProcessCompressedMember(IForceCombinationList combination, IDesignForceTuple tuple, List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
IForcesTupleResult tupleResult;
|
||||
LimitStates limitState = tuple.LimitState;
|
||||
CalcTerms calcTerm = tuple.CalcTerm;
|
||||
|
||||
TraceLogger?.AddMessage("Get eccentricity for full load");
|
||||
eccentricityLogic = new ProcessEccentricity(CompressedMember, ndms, newTuple)
|
||||
{
|
||||
TraceLogger = TraceLogger ?? null
|
||||
};
|
||||
newTuple = eccentricityLogic.GetValue();
|
||||
var buclingInputData = new BucklingInputData()
|
||||
{
|
||||
Combination = combination,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
Ndms = ndms,
|
||||
ForceTuple = newTuple
|
||||
};
|
||||
bucklingLogic = new ForceTupleBucklingLogic(buclingInputData)
|
||||
{
|
||||
CompressedMember = CompressedMember,
|
||||
Accuracy = Accuracy,
|
||||
Primitives = Primitives,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
var buckResult = bucklingLogic.GetForceTupleByBuckling();
|
||||
if (buckResult.IsValid == true)
|
||||
{
|
||||
newTuple = buckResult.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
DesignForceTuple = tuple,
|
||||
Description = buckResult.Description,
|
||||
};
|
||||
}
|
||||
TraceLogger?.AddMessage(string.Intern("Result of second order was obtained succesfully, new force combination was obtained"));
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
return tupleResult;
|
||||
}
|
||||
|
||||
private IForcesTupleResult GetForceResult(LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
TraceLogger?.AddMessage("Calculation of cross-section is started");
|
||||
var tupleResult = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||
tupleResult.DesignForceTuple.LimitState = limitState;
|
||||
tupleResult.DesignForceTuple.CalcTerm = calcTerm;
|
||||
tupleResult.DesignForceTuple.ForceTuple = newTuple;
|
||||
return tupleResult;
|
||||
}
|
||||
|
||||
private string CheckInputData()
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (! Primitives.Any())
|
||||
{
|
||||
result += "Calculator does not contain any primitives \n";
|
||||
}
|
||||
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 calc term \n";
|
||||
}
|
||||
//try
|
||||
//{
|
||||
// triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
// {
|
||||
// Primitives = Primitives
|
||||
// };
|
||||
// triangulateLogic.CheckPrimitives(Primitives);
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// result += ex;
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ForceCalculator(IForceTupleCalculator forceTupleCalculator)
|
||||
{
|
||||
this.forceTupleCalculator = forceTupleCalculator;
|
||||
SetDefaultProperties();
|
||||
}
|
||||
|
||||
public ForceCalculator() : this(new ForceTupleCalculator())
|
||||
public ForceCalculator(ForceInputData inputData) :
|
||||
this(inputData,
|
||||
new CheckForceCalculatorInputData(inputData),
|
||||
new ForceCalculatorLogic(inputData),
|
||||
new ForceCalculatorUpdateStrategy())
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
private void GetCombinations()
|
||||
{
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
foreach (var item in ForceActions)
|
||||
{
|
||||
ForceCombinationLists.Add(item.GetCombinations());
|
||||
}
|
||||
}
|
||||
|
||||
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple, IAccuracy accuracy)
|
||||
{
|
||||
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;
|
||||
}
|
||||
public ForceCalculator() : this(new ForceInputData()) { }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newCalculator = new ForceCalculator();
|
||||
var newCalculator = new ForceCalculator(new ForceInputData());
|
||||
updateStrategy.Update(newCalculator, this);
|
||||
return newCalculator;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculatorInputDataUpdateStrategy : IUpdateStrategy<ForceInputData>
|
||||
{
|
||||
private IUpdateStrategy<IAccuracy> accuracyUpdateStrategy;
|
||||
private IUpdateStrategy<ICompressedMember> compressedMemberUpdateStrategy;
|
||||
public ForceCalculatorInputDataUpdateStrategy(IUpdateStrategy<IAccuracy> accuracyUpdateStrategy, IUpdateStrategy<ICompressedMember> compressedMemberUpdateStrategy)
|
||||
{
|
||||
this.accuracyUpdateStrategy = accuracyUpdateStrategy;
|
||||
this.compressedMemberUpdateStrategy = compressedMemberUpdateStrategy;
|
||||
}
|
||||
|
||||
public ForceCalculatorInputDataUpdateStrategy() : this(new AccuracyUpdateStrategy(), new CompressedMemberUpdateStrategy()) { }
|
||||
public void Update(ForceInputData targetObject, ForceInputData sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
targetObject.Accuracy ??= new Accuracy();
|
||||
accuracyUpdateStrategy.Update(targetObject.Accuracy, sourceObject.Accuracy);
|
||||
targetObject.CompressedMember ??= new CompressedMember();
|
||||
compressedMemberUpdateStrategy.Update(targetObject.CompressedMember, sourceObject.CompressedMember);
|
||||
targetObject.LimitStatesList.Clear();
|
||||
targetObject.LimitStatesList.AddRange(sourceObject.LimitStatesList);
|
||||
targetObject.CalcTermsList.Clear();
|
||||
targetObject.CalcTermsList.AddRange(sourceObject.CalcTermsList);
|
||||
targetObject.Primitives.Clear();
|
||||
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||
targetObject.ForceActions.Clear();
|
||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Models.Sections.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Buckling;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceCalculatorLogic : IForceCalculatorLogic
|
||||
{
|
||||
private ForcesResults result;
|
||||
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||
private ForceTupleBucklingLogic bucklingLogic;
|
||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||
public ForceInputData InputData { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public ForceCalculatorLogic(ForceInputData inputData)
|
||||
{
|
||||
InputData = inputData;
|
||||
}
|
||||
public ForcesResults GetForcesResults()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
GetCombinations();
|
||||
CalculateResult();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
result = new ForcesResults()
|
||||
{
|
||||
IsValid = true
|
||||
};
|
||||
foreach (var combination in InputData.ForceCombinationLists)
|
||||
{
|
||||
foreach (var tuple in combination.DesignForces)
|
||||
{
|
||||
var limitState = tuple.LimitState;
|
||||
var calcTerm = tuple.CalcTerm;
|
||||
if (InputData.LimitStatesList.Contains(limitState) & InputData.CalcTermsList.Contains(calcTerm))
|
||||
{
|
||||
|
||||
IForcesTupleResult tupleResult;
|
||||
try
|
||||
{
|
||||
tupleResult = ProcessNdmResult(combination, tuple);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tupleResult = new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
Description = string.Empty + ex,
|
||||
DesignForceTuple = tuple
|
||||
};
|
||||
}
|
||||
result.ForcesResultList.Add(tupleResult);
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IForcesTupleResult ProcessNdmResult(IForceCombinationList combination, IDesignForceTuple tuple)
|
||||
{
|
||||
IForcesTupleResult tupleResult;
|
||||
LimitStates limitState = tuple.LimitState;
|
||||
CalcTerms calcTerm = tuple.CalcTerm;
|
||||
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
{
|
||||
Primitives = InputData.Primitives,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
var ndms = triangulateLogic.GetNdms();
|
||||
IPoint2D point2D;
|
||||
IProcessorLogic<IForceTuple> forcelogic = new ForceTupleCopier(tuple.ForceTuple);
|
||||
if (combination.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();
|
||||
TraceLogger?.AddMessage("Input force combination");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
if (InputData.CompressedMember.Buckling == true)
|
||||
{
|
||||
if (newTuple.Nz >= 0d)
|
||||
{
|
||||
TraceLogger?.AddMessage(string.Format("Second order effect is not considered as Nz={0} >= 0", newTuple.Nz));
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
}
|
||||
else
|
||||
{
|
||||
tupleResult = ProcessCompressedMember(combination, tuple, ndms, newTuple);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
}
|
||||
return tupleResult;
|
||||
}
|
||||
|
||||
private IForcesTupleResult ProcessCompressedMember(IForceCombinationList combination, IDesignForceTuple tuple, List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
IForcesTupleResult tupleResult;
|
||||
LimitStates limitState = tuple.LimitState;
|
||||
CalcTerms calcTerm = tuple.CalcTerm;
|
||||
|
||||
TraceLogger?.AddMessage("Get eccentricity for full load");
|
||||
eccentricityLogic = new ProcessEccentricity(InputData.CompressedMember, ndms, newTuple)
|
||||
{
|
||||
TraceLogger = TraceLogger ?? null
|
||||
};
|
||||
newTuple = eccentricityLogic.GetValue();
|
||||
var buclingInputData = new BucklingInputData()
|
||||
{
|
||||
Combination = combination,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
Ndms = ndms,
|
||||
ForceTuple = newTuple
|
||||
};
|
||||
bucklingLogic = new ForceTupleBucklingLogic(buclingInputData)
|
||||
{
|
||||
CompressedMember = InputData.CompressedMember,
|
||||
Accuracy = InputData.Accuracy,
|
||||
Primitives = InputData.Primitives,
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
var buckResult = bucklingLogic.GetForceTupleByBuckling();
|
||||
if (buckResult.IsValid == true)
|
||||
{
|
||||
newTuple = buckResult.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
DesignForceTuple = tuple,
|
||||
Description = buckResult.Description,
|
||||
};
|
||||
}
|
||||
|
||||
string message = string.Intern("Result of second order was obtained succesfully, new force combination was obtained");
|
||||
TraceLogger?.AddMessage(message);
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
return tupleResult;
|
||||
}
|
||||
|
||||
private IForcesTupleResult GetForceResult(LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
TraceLogger?.AddMessage("Calculation of cross-section is started");
|
||||
var tupleResult = GetPrimitiveStrainMatrix(ndms, newTuple, InputData.Accuracy);
|
||||
tupleResult.DesignForceTuple.LimitState = limitState;
|
||||
tupleResult.DesignForceTuple.CalcTerm = calcTerm;
|
||||
tupleResult.DesignForceTuple.ForceTuple = newTuple;
|
||||
return tupleResult;
|
||||
}
|
||||
|
||||
|
||||
private void GetCombinations()
|
||||
{
|
||||
InputData.ForceCombinationLists = new List<IForceCombinationList>();
|
||||
foreach (var item in InputData.ForceActions)
|
||||
{
|
||||
InputData.ForceCombinationLists.Add(item.GetCombinations());
|
||||
}
|
||||
}
|
||||
|
||||
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple, IAccuracy accuracy)
|
||||
{
|
||||
var inputData = new ForceTupleInputData()
|
||||
{
|
||||
NdmCollection = ndmCollection,
|
||||
Tuple = tuple,
|
||||
Accuracy = accuracy
|
||||
};
|
||||
var calculator = new ForceTupleCalculator();
|
||||
calculator.InputData = inputData;
|
||||
if (TraceLogger is not null)
|
||||
{
|
||||
calculator.TraceLogger = TraceLogger.GetSimilarTraceLogger();
|
||||
}
|
||||
calculator.Run();
|
||||
return calculator.Result as IForcesTupleResult;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,11 +13,40 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class ForceInputData : IForceInputData
|
||||
public class ForceInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
public IEnumerable<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||
public IEnumerable<LimitStates> LimitStates { get; set; }
|
||||
public IEnumerable<CalcTerms> CalcTerms { get; set; }
|
||||
public IIterationProperty IterationProperty { 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 ICompressedMember CompressedMember { get; set; }
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public List<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||
|
||||
public ForceInputData()
|
||||
{
|
||||
ForceActions = new List<IForceAction>();
|
||||
ForceCombinationLists = new List<IForceCombinationList>();
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculator : ICalculator, IHasPrimitives, IHasForceCombinations
|
||||
{
|
||||
List<CalcTerms> CalcTermsList { get; }
|
||||
List<LimitStates> LimitStatesList { get; }
|
||||
ICompressedMember CompressedMember { get; }
|
||||
IAccuracy Accuracy { get; set; }
|
||||
List<IForceCombinationList> ForceCombinationLists { get;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceCalculatorLogic : ILogic, IHasActionByResult
|
||||
{
|
||||
ForceInputData InputData { get; set; }
|
||||
ForcesResults GetForcesResults();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface IForceInputData
|
||||
{
|
||||
IEnumerable<CalcTerms> CalcTerms { get; set; }
|
||||
IEnumerable<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||
IIterationProperty IterationProperty { get; }
|
||||
IEnumerable<LimitStates> LimitStates { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,24 +4,20 @@ using StructureHelperCommon.Models.Sections;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
{
|
||||
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<IForceCalculator>
|
||||
public class ForceCalculatorUpdateStrategy : IUpdateStrategy<ForceCalculator>
|
||||
{
|
||||
static readonly AccuracyUpdateStrategy accuracyUpdateStrategy = new();
|
||||
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
|
||||
public void Update(IForceCalculator targetObject, IForceCalculator sourceObject)
|
||||
private readonly IUpdateStrategy<ForceInputData> inputDataUpdateStrategy;
|
||||
public ForceCalculatorUpdateStrategy(IUpdateStrategy<ForceInputData> inputDataUpdateStrategy)
|
||||
{
|
||||
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
||||
}
|
||||
public ForceCalculatorUpdateStrategy() : this(new ForceCalculatorInputDataUpdateStrategy()) { }
|
||||
public void Update(ForceCalculator targetObject, ForceCalculator sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.LimitStatesList.Clear();
|
||||
targetObject.LimitStatesList.AddRange(sourceObject.LimitStatesList);
|
||||
targetObject.CalcTermsList.Clear();
|
||||
targetObject.CalcTermsList.AddRange(sourceObject.CalcTermsList);
|
||||
accuracyUpdateStrategy.Update(targetObject.Accuracy, sourceObject.Accuracy);
|
||||
compressedMemberUpdateStrategy.Update(targetObject.CompressedMember, sourceObject.CompressedMember);
|
||||
targetObject.Primitives.Clear();
|
||||
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||
targetObject.ForceActions.Clear();
|
||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||
targetObject.InputData ??= new ForceInputData();
|
||||
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Logics
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||
if (targetObject is IForceCalculator target)
|
||||
if (targetObject is ForceCalculator target)
|
||||
{
|
||||
new ForceCalculatorUpdateStrategy().Update(target, (IForceCalculator)sourceObject);
|
||||
new ForceCalculatorUpdateStrategy().Update(target, (ForceCalculator)sourceObject);
|
||||
}
|
||||
else if (targetObject is LimitCurvesCalculator limitCurves)
|
||||
{
|
||||
|
||||
@@ -10,31 +10,23 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CheckTupleCalculatorInputData : ICheckInputDataLogic
|
||||
public class CheckTupleCalculatorInputData : ICheckInputDataLogic<TupleCrackInputData>
|
||||
{
|
||||
private string checkResult;
|
||||
private TupleCrackInputData inputData;
|
||||
private bool result;
|
||||
|
||||
public IInputData InputData
|
||||
{
|
||||
get => inputData; set
|
||||
{
|
||||
if (value is TupleCrackInputData data)
|
||||
{
|
||||
inputData = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
public TupleCrackInputData InputData { get; set; }
|
||||
|
||||
|
||||
public string CheckResult => checkResult;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckTupleCalculatorInputData(TupleCrackInputData inputData)
|
||||
{
|
||||
InputData = inputData;
|
||||
}
|
||||
|
||||
public bool Check()
|
||||
{
|
||||
result = true;
|
||||
|
||||
@@ -23,19 +23,22 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
private CrackResult result;
|
||||
private IGetTupleInputDatasLogic datasLogic;
|
||||
private CrackCalculatorUpdateStrategy updateStrategy = new();
|
||||
private ICheckInputDataLogic checkInputDataLogic;
|
||||
private ICheckInputDataLogic<CrackInputData> checkInputDataLogic;
|
||||
|
||||
public string Name { get; set; }
|
||||
public CrackInputData InputData { get; set; }
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public CrackCalculator(CrackInputData inputData, ICheckInputDataLogic checkInputDataLogic)
|
||||
public CrackCalculator(CrackInputData inputData, ICheckInputDataLogic<CrackInputData> checkInputDataLogic)
|
||||
{
|
||||
InputData = inputData;
|
||||
this.checkInputDataLogic = checkInputDataLogic;
|
||||
Name = string.Empty;
|
||||
}
|
||||
|
||||
public CrackCalculator(CrackInputData inputData) : this(inputData, new CheckCrackCalculatorInputDataLogic(inputData)) { }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
CrackInputData crackInputData = new CrackInputData();
|
||||
|
||||
@@ -10,7 +10,13 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CrackCalculatorUpdateStrategy : IUpdateStrategy<CrackCalculator>
|
||||
{
|
||||
private CrackInputDataUpdateStrategy crackInputDataUpdateStrategy => new();
|
||||
private IUpdateStrategy<CrackInputData> inputDataUpdateStrategy;
|
||||
|
||||
public CrackCalculatorUpdateStrategy(IUpdateStrategy<CrackInputData> inputDataUpdateStrategy)
|
||||
{
|
||||
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
||||
}
|
||||
public CrackCalculatorUpdateStrategy() : this(new CrackInputDataUpdateStrategy()) { }
|
||||
public void Update(CrackCalculator targetObject, CrackCalculator sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
@@ -18,7 +24,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.InputData ??= new();
|
||||
crackInputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||
inputDataUpdateStrategy.Update(targetObject.InputData, sourceObject.InputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
public List<INdmPrimitive> Primitives { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public List<IForceAction> ForceActions { get; private set; }
|
||||
public UserCrackInputData UserCrackInputData { get; private set; }
|
||||
public UserCrackInputData UserCrackInputData { get; set; }
|
||||
public CrackInputData()
|
||||
{
|
||||
Primitives = new();
|
||||
|
||||
@@ -10,7 +10,16 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CrackInputDataUpdateStrategy : IUpdateStrategy<CrackInputData>
|
||||
{
|
||||
private UserCrackInputDataUpdateStrategy userCrackInputDataUpdateStrategy => new();
|
||||
private IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy;
|
||||
public CrackInputDataUpdateStrategy(IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy)
|
||||
{
|
||||
this.userCrackInputDataUpdateStrategy = userCrackInputDataUpdateStrategy;
|
||||
}
|
||||
|
||||
public CrackInputDataUpdateStrategy() : this(new UserCrackInputDataUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
public void Update(CrackInputData targetObject, CrackInputData sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
@@ -19,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||
targetObject.Primitives.Clear();
|
||||
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||
|
||||
targetObject.UserCrackInputData ??= new UserCrackInputData();
|
||||
userCrackInputDataUpdateStrategy.Update(targetObject.UserCrackInputData, sourceObject.UserCrackInputData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class CrackedSectionTriangulationLogic : ICrackedSectionTriangulationLogic
|
||||
{
|
||||
const LimitStates limitState = LimitStates.SLS;
|
||||
@@ -35,6 +36,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
TraceLogger = TraceLogger?.GetSimilarTraceLogger(50)
|
||||
};
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public List<INdm> GetNdmCollection()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
@@ -48,6 +50,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
};
|
||||
return triangulateLogic.GetNdms();
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public List<INdm> GetCrackedNdmCollection()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
@@ -62,6 +65,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
return triangulateLogic.GetNdms();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<RebarPrimitive> GetRebarPrimitives()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
@@ -79,6 +83,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
return rebarPrimitives;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<INdm> GetElasticNdmCollection()
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage($"Error of crack width calculation {ex}", TraceLogStatuses.Error);
|
||||
result.IsValid = false;
|
||||
result.Description += "\n" + ex;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
//Copyright (c) 2024 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
@@ -18,6 +19,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class TupleCrackCalculator : ICalculator
|
||||
{
|
||||
private const CalcTerms crackingTerm = CalcTerms.ShortTerm;
|
||||
private const LimitStates crackingLimitState = LimitStates.SLS;
|
||||
private static readonly ILengthBetweenCracksLogic lengthLogic = new LengthBetweenCracksLogicSP63();
|
||||
private TupleCrackResult result;
|
||||
private ICrackedSectionTriangulationLogic triangulationLogic;
|
||||
@@ -143,6 +146,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
IEnumerable<INdm> crackableNdmsLoc = null;
|
||||
IEnumerable<INdm> crackedNdmsLoc = null;
|
||||
INdm concreteNdmUnderRebar;
|
||||
RebarPrimitive rebarCopy = null;
|
||||
lock (locker)
|
||||
{
|
||||
@@ -151,6 +155,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
var triangulationLogicLoc = new CrackedSectionTriangulationLogic(InputData.Primitives);
|
||||
crackableNdmsLoc = triangulationLogicLoc.GetNdmCollection();
|
||||
crackedNdmsLoc = triangulationLogicLoc.GetCrackedNdmCollection();
|
||||
//concreteNdmUnderRebar = rebarCopy.GetConcreteNdm(new TriangulationOptions()
|
||||
//{ CalcTerm = crackingTerm,
|
||||
// LimiteState = crackingLimitState });
|
||||
//concreteNdmUnderRebar.StressScale = 1d;
|
||||
//crackableNdmsLoc = new List<INdm>() { concreteNdmUnderRebar};
|
||||
}
|
||||
|
||||
var longRebarData = new RebarCrackInputData()
|
||||
@@ -162,7 +171,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
};
|
||||
var shortRebarData = new RebarCrackInputData()
|
||||
{
|
||||
CrackableNdmCollection = crackableNdms,
|
||||
CrackableNdmCollection = crackableNdmsLoc,
|
||||
CrackedNdmCollection = crackedNdms,
|
||||
ForceTuple = InputData.ShortTermTuple.Clone() as ForceTuple,
|
||||
Length = shortLength
|
||||
|
||||
@@ -8,17 +8,17 @@ namespace StructureHelperLogics.Services.NdmCalculations
|
||||
public static class InterpolateService
|
||||
{
|
||||
static readonly CompressedMemberUpdateStrategy compressedMemberUpdateStrategy = new();
|
||||
public static ForceCalculator InterpolateForceCalculator(IForceCalculator source, InterpolateTuplesResult interpolateTuplesResult)
|
||||
public static ForceCalculator InterpolateForceCalculator(ForceCalculator source, InterpolateTuplesResult interpolateTuplesResult)
|
||||
{
|
||||
ForceCalculator calculator = new ForceCalculator();
|
||||
calculator.LimitStatesList.Clear();
|
||||
calculator.LimitStatesList.Add(interpolateTuplesResult.StartTuple.LimitState);
|
||||
calculator.CalcTermsList.Clear();
|
||||
calculator.CalcTermsList.Add(interpolateTuplesResult.FinishTuple.CalcTerm);
|
||||
compressedMemberUpdateStrategy.Update(calculator.CompressedMember, source.CompressedMember);
|
||||
calculator.Accuracy = source.Accuracy;
|
||||
calculator.Primitives.AddRange(source.Primitives);
|
||||
calculator.ForceActions.Clear();
|
||||
calculator.InputData.LimitStatesList.Clear();
|
||||
calculator.InputData.LimitStatesList.Add(interpolateTuplesResult.StartTuple.LimitState);
|
||||
calculator.InputData.CalcTermsList.Clear();
|
||||
calculator.InputData.CalcTermsList.Add(interpolateTuplesResult.FinishTuple.CalcTerm);
|
||||
compressedMemberUpdateStrategy.Update(calculator.InputData.CompressedMember, source.InputData.CompressedMember);
|
||||
calculator.InputData.Accuracy = source.InputData.Accuracy;
|
||||
calculator.InputData.Primitives.AddRange(source.InputData.Primitives);
|
||||
calculator.InputData.ForceActions.Clear();
|
||||
var forceTuples = ForceTupleService.InterpolateDesignTuple(interpolateTuplesResult.FinishTuple, interpolateTuplesResult.StartTuple, interpolateTuplesResult.StepCount);
|
||||
foreach (var forceTuple in forceTuples)
|
||||
{
|
||||
@@ -31,12 +31,12 @@ namespace StructureHelperLogics.Services.NdmCalculations
|
||||
combination.DesignForces.Add(forceTuple);
|
||||
combination.ForcePoint.X = 0;
|
||||
combination.ForcePoint.Y = 0;
|
||||
calculator.ForceActions.Add(combination);
|
||||
calculator.InputData.ForceActions.Add(combination);
|
||||
}
|
||||
return calculator;
|
||||
}
|
||||
|
||||
public static IForceCalculator InterpolateForceCalculator(IForceCalculator forceCalculator, IDesignForceTuple finishDesignTuple, object startDesignTuple, object stepCount)
|
||||
public static ForceCalculator InterpolateForceCalculator(ForceCalculator forceCalculator, IDesignForceTuple finishDesignTuple, object startDesignTuple, object stepCount)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
HeightCount = heightCount
|
||||
};
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as IForceCalculator;
|
||||
calculator.CompressedMember.Buckling = isBuckling;
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as ForceCalculator;
|
||||
calculator.InputData.CompressedMember.Buckling = isBuckling;
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = calculator.Result as IForcesResults;
|
||||
@@ -48,8 +48,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
//Arrange
|
||||
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as IForceCalculator;
|
||||
calculator.CompressedMember.Buckling = isBuckling;
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as ForceCalculator;
|
||||
calculator.InputData.CompressedMember.Buckling = isBuckling;
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = calculator.Result as IForcesResults;
|
||||
@@ -65,8 +65,8 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
//Arrange
|
||||
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
|
||||
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as IForceCalculator;
|
||||
calculator.CompressedMember.Buckling = false;
|
||||
var calculator = newSection.SectionRepository.CalculatorsList[0] as ForceCalculator;
|
||||
calculator.InputData.CompressedMember.Buckling = false;
|
||||
calculator.Run();
|
||||
var ndmPrimitives = newSection.SectionRepository.Primitives;
|
||||
var result = calculator.Result as IForcesResults;
|
||||
|
||||
Reference in New Issue
Block a user