Force calculator was repaired for buckling calculations
This commit is contained in:
@@ -51,6 +51,20 @@
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolButton" TargetType="Button">
|
||||
<Style.Resources>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Width" Value="32"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.25"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Style.Resources>
|
||||
<Setter Property="Width" Value="32"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="Margin" Value="2,0,2,0"/>
|
||||
|
||||
@@ -61,21 +61,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
|
||||
public void ShowCracks()
|
||||
{
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
||||
|
||||
List<string> labels = GetCrackLabels(unitForce, unitMoment, unitCurvature);
|
||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
||||
CalculateWithCrack(ValidTupleList, NdmPrimitives, unitForce, unitMoment, unitCurvature);
|
||||
List<string> labels = GetCrackLabels();
|
||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels);
|
||||
CalculateWithCrack(ValidTupleList,
|
||||
NdmPrimitives,
|
||||
CommonOperation.GetUnit(UnitTypes.Force),
|
||||
CommonOperation.GetUnit(UnitTypes.Moment),
|
||||
CommonOperation.GetUnit(UnitTypes.Curvature));
|
||||
}
|
||||
|
||||
public void ShowWindow()
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
{
|
||||
var series = new Series(arrayParameter) { Name = "Forces and curvatures" };
|
||||
var vm = new GraphViewModel(new List<Series>() { series });
|
||||
var series = new Series(arrayParameter)
|
||||
{
|
||||
Name = "Forces and curvatures"
|
||||
};
|
||||
var vm = new GraphViewModel(new List<Series>()
|
||||
{
|
||||
series
|
||||
});
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
},
|
||||
@@ -132,11 +138,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
}
|
||||
}
|
||||
|
||||
private static List<string> GetCrackLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
||||
private static List<string> GetCrackLabels()
|
||||
{
|
||||
const string crc = "Crc";
|
||||
const string crcFactor = "CrcSofteningFactor";
|
||||
var labels = LabelsFactory.GetLabels();
|
||||
var labels = LabelsFactory.GetCommonLabels();
|
||||
IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
var crclabels = new List<string>
|
||||
{
|
||||
$"{crc}{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public static class LabelsFactory
|
||||
{
|
||||
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
||||
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||
public static List<string> GetLabels()
|
||||
public static List<string> GetCommonLabels()
|
||||
{
|
||||
var labels = new List<string>
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models;
|
||||
@@ -17,12 +18,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
internal class ShowDiagramLogic : ILongProcessLogic
|
||||
{
|
||||
ArrayParameter<double> arrayParameter;
|
||||
private IEnumerable<IForcesTupleResult> TupleList;
|
||||
private IEnumerable<INdmPrimitive> NdmPrimitives;
|
||||
private List<IForcesTupleResult> ValidTupleList;
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
private IEnumerable<IForcesTupleResult> tupleList;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private List<IForcesTupleResult> validTupleList;
|
||||
|
||||
public int StepCount => ValidTupleList.Count();
|
||||
public int StepCount => validTupleList.Count();
|
||||
|
||||
public Action<int> SetProgress { get; set; }
|
||||
public bool Result { get; set; }
|
||||
@@ -48,37 +49,33 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
{
|
||||
var series = new Series(arrayParameter) { Name = "Forces and curvatures" };
|
||||
var vm = new GraphViewModel(new List<Series>() { series});
|
||||
var vm = new GraphViewModel(new List<Series>() { series });
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
},
|
||||
"Errors appeared during showing a graph, see detailed information");
|
||||
}, ErrorStrings.ErrorDuring("building chart"));
|
||||
}
|
||||
private void Show()
|
||||
{
|
||||
ValidTupleList = TupleList.Where(x => x.IsValid == true).ToList();
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
|
||||
var labels = LabelsFactory.GetLabels();
|
||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
||||
CalculateWithoutCrack(ValidTupleList, unitForce, unitMoment, unitCurvature);
|
||||
var labels = LabelsFactory.GetCommonLabels();
|
||||
arrayParameter = new ArrayParameter<double>(validTupleList.Count(), labels);
|
||||
Calculate();
|
||||
}
|
||||
|
||||
public ShowDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
{
|
||||
TupleList = tupleList;
|
||||
NdmPrimitives = ndmPrimitives;
|
||||
ValidTupleList = TupleList.Where(x => x.IsValid == true).ToList();
|
||||
this.tupleList = tupleList;
|
||||
this.ndmPrimitives = ndmPrimitives;
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
}
|
||||
|
||||
private void CalculateWithoutCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
||||
private void Calculate()
|
||||
{
|
||||
var data = arrayParameter.Data;
|
||||
for (int i = 0; i < resultList.Count(); i++)
|
||||
for (int i = 0; i < validTupleList.Count(); i++)
|
||||
{
|
||||
var valueList = ProcessResultWithouCrack(resultList, unitForce, unitMoment, unitCurvature, i);
|
||||
var valueList = ProcessResult(i);
|
||||
for (int j = 0; j < valueList.Count; j++)
|
||||
{
|
||||
data[i, j] = valueList[j];
|
||||
@@ -88,16 +85,20 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
}
|
||||
|
||||
|
||||
private static List<double> ProcessResultWithouCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature, int i)
|
||||
private List<double> ProcessResult(int i)
|
||||
{
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
|
||||
return new List<double>
|
||||
{
|
||||
resultList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||
resultList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||
resultList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,102 @@
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public class ShowValuePointDiagramLogic
|
||||
public class ShowValuePointDiagramLogic : ILongProcessLogic
|
||||
{
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
private IEnumerable<IForcesTupleResult> tupleList;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private List<IForcesTupleResult> validTupleList;
|
||||
private List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)> valuePoints;
|
||||
private List<IResultFunc> resultFuncList;
|
||||
|
||||
public ForceCalculator Calculator { get; set; }
|
||||
public PointPrimitiveLogic PrimitiveLogic { get; set; }
|
||||
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
|
||||
public void ShowGraph()
|
||||
|
||||
public int StepCount => throw new NotImplementedException();
|
||||
|
||||
public Action<int> SetProgress { get; set; }
|
||||
public bool Result { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public ShowValuePointDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
{
|
||||
this.tupleList = tupleList;
|
||||
this.ndmPrimitives = ndmPrimitives;
|
||||
validTupleList = this.tupleList.Where(x => x.IsValid == true).ToList();
|
||||
valuePoints = new List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)>();
|
||||
foreach (var item in PrimitiveLogic.Collection.CollectionItems)
|
||||
{
|
||||
var pointsCount = item.Item.ValuePoints.SelectedCount;
|
||||
if (pointsCount > 0)
|
||||
{
|
||||
var points = item.Item.ValuePoints.SelectedItems.ToList();
|
||||
var primitive = item.Item.PrimitiveBase;
|
||||
valuePoints.Add((primitive, points));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ShowWindow()
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
{
|
||||
var series = new Series(arrayParameter)
|
||||
{
|
||||
Name = "Forces and curvatures"
|
||||
};
|
||||
var vm = new GraphViewModel(new List<Series>()
|
||||
{
|
||||
series
|
||||
});
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
}, ErrorStrings.ErrorDuring("building chart"));
|
||||
}
|
||||
|
||||
public void WorkerDoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
Show();
|
||||
Result = true;
|
||||
}
|
||||
|
||||
public void WorkerProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
//Nothing to do
|
||||
}
|
||||
|
||||
public void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
//Nothing to do
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private List<string> GetColumnNames()
|
||||
{
|
||||
var columnNames = LabelsFactory.GetCommonLabels();
|
||||
|
||||
return columnNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding InterpolateCommand}" ToolTip="Show result step by step">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding InterpolateCommand}" ToolTip="Show result step by step">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
|
||||
</Button>
|
||||
|
||||
</ToolBar>
|
||||
|
||||
@@ -176,8 +176,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
};
|
||||
showProgressLogic.Show();
|
||||
}
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid
|
||||
);
|
||||
}, o => SelectedResult != null);
|
||||
}
|
||||
public ICommand ShowCrackGraphsCommand
|
||||
{
|
||||
@@ -282,11 +281,16 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
|
||||
private void InterpolateValuePoints()
|
||||
{
|
||||
if (SelectedResult is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.NullReference + ": Nothing is selected");
|
||||
}
|
||||
var tuple = SelectedResult.DesignForceTuple ?? throw new StructureHelperException(ErrorStrings.NullReference + ": Design force combination");
|
||||
var inputData = new ValuePointsInterpolationInputData()
|
||||
{
|
||||
FinishDesignForce = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple,
|
||||
LimitState = SelectedResult.DesignForceTuple.LimitState,
|
||||
CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
|
||||
FinishDesignForce = tuple.Clone() as IDesignForceTuple,
|
||||
LimitState = tuple.LimitState,
|
||||
CalcTerm = tuple.CalcTerm,
|
||||
};
|
||||
inputData.PrimitiveBases.AddRange(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(ndmPrimitives));
|
||||
var viewModel = new ValuePointsInterpolateViewModel(inputData);
|
||||
@@ -294,7 +298,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult != true) { return; }
|
||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, viewModel.ForceInterpolationViewModel.Result);
|
||||
ShowValuePointDiagramLogic pointGraphLogic = new()
|
||||
ShowValuePointDiagramLogic pointGraphLogic = new(ForcesResults.ForcesResultList, ndmPrimitives)
|
||||
{
|
||||
Calculator = interpolationLogic.InterpolateCalculator,
|
||||
PrimitiveLogic = viewModel.PrimitiveLogic,
|
||||
@@ -303,7 +307,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
progressLogic = interpolationLogic;
|
||||
showProgressLogic = new(interpolationLogic)
|
||||
{
|
||||
ShowResult = pointGraphLogic.ShowGraph
|
||||
ShowResult = pointGraphLogic.ShowWindow
|
||||
};
|
||||
showProgressLogic.Show();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,27 @@
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="25" d:DesignWidth="120">
|
||||
<Grid>
|
||||
<Grid x:Name="ButtonGrid" Opacity="0.1">
|
||||
<Grid.Triggers>
|
||||
<EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="ButtonGrid">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="ButtonGrid"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1.0" Duration="0:0:0.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="UIElement.MouseLeave" SourceName="ButtonGrid">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="ButtonGrid"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.1" Duration="0:0:5.0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Grid.Triggers>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
|
||||
Reference in New Issue
Block a user