TripleLinear Material Diagram was added
This commit is contained in:
@@ -28,6 +28,14 @@
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<TextBlock Text="Material Model"/>
|
||||
<ComboBox Height="25" VerticalAlignment="Top" ItemsSource="{Binding MaterialLogics}" SelectedItem="{Binding MaterialLogic}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
Binary file not shown.
@@ -55,6 +55,7 @@
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResourceKey=LineVisualProperties}" Content="{Binding VisualProps}"/>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<Button Margin="3" Content="Draw Lines" ToolTip="Draw lines" Command="{Binding RedrawLinesCommand}"/>
|
||||
<Button Margin="3" Content="Show Areas" ToolTip="Area under lines" Command="{Binding GetAreaCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<lvc:CartesianChart Grid.Column="1" Series="{Binding SeriesCollection}" LegendLocation="Bottom" Zoom="Xy">
|
||||
|
||||
@@ -4,10 +4,12 @@ using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
@@ -15,12 +17,22 @@ namespace StructureHelper.Windows.Graphs
|
||||
{
|
||||
public class MaterialDiagramViewModel : ViewModelBase
|
||||
{
|
||||
class StressEntity
|
||||
{
|
||||
public LimitStateEntity LimitState { get; set; }
|
||||
public CalcTermEntity CalcTerm { get; set; }
|
||||
public IHeadMaterial Material { get; set; }
|
||||
public double Strain { get; set; }
|
||||
public double Stress { get; set; }
|
||||
}
|
||||
|
||||
private IHeadMaterial material;
|
||||
private ICommand redrawLinesCommand;
|
||||
double minValue;
|
||||
double maxValue;
|
||||
int stepCount;
|
||||
bool positiveInTension;
|
||||
private ICommand getAreaCommand;
|
||||
|
||||
public string MaterialName => material.Name;
|
||||
public GraphVisualProps VisualProps { get; }
|
||||
@@ -79,6 +91,15 @@ namespace StructureHelper.Windows.Graphs
|
||||
get => redrawLinesCommand ??= new RelayCommand(o => DrawLines(), b => IsDrawPossible());
|
||||
}
|
||||
|
||||
public ICommand GetAreaCommand
|
||||
{
|
||||
get => getAreaCommand ??= new RelayCommand(o =>
|
||||
{
|
||||
var str = GetAreas();
|
||||
MessageBox.Show(str);
|
||||
}, b => IsDrawPossible());
|
||||
}
|
||||
|
||||
public MaterialDiagramViewModel(IEnumerable<IHeadMaterial> headMaterials, IHeadMaterial material)
|
||||
{
|
||||
MaterialsModel = new SelectItemsViewModel<IHeadMaterial>(headMaterials) { ShowButtons = true };
|
||||
@@ -100,12 +121,80 @@ namespace StructureHelper.Windows.Graphs
|
||||
VisualProps = new();
|
||||
SetLines();
|
||||
}
|
||||
private string GetAreas()
|
||||
{
|
||||
var materials = MaterialsModel.SelectedItems;
|
||||
var limitStates = LimitStatesModel.SelectedItems;
|
||||
var calcTerms = CalcTermsModel.SelectedItems;
|
||||
double step = (maxValue - minValue) / stepCount;
|
||||
var factor = positiveInTension ? 1d : -1d;
|
||||
|
||||
var values = GetValueList();
|
||||
|
||||
string str = string.Empty;
|
||||
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
foreach (var material in materials)
|
||||
{
|
||||
double sumStress = 0d;
|
||||
var stressList = values
|
||||
.Where(x => x.LimitState == limitState & x.CalcTerm == calcTerm & x.Material == material).ToList();
|
||||
for (int i = 1; i < stressList.Count(); i++)
|
||||
{
|
||||
double midStress = (stressList[i - 1].Stress + stressList[i].Stress) / 2;
|
||||
sumStress += midStress * UnitConstants.Stress * step;
|
||||
}
|
||||
str += $"{material.Name}, {limitState.Name}, {calcTerm.Name}: {sumStress} \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private List<StressEntity> GetValueList()
|
||||
{
|
||||
var materials = MaterialsModel.SelectedItems;
|
||||
var limitStates = LimitStatesModel.SelectedItems;
|
||||
var calcTerms = CalcTermsModel.SelectedItems;
|
||||
double step = (maxValue - minValue) / stepCount;
|
||||
var factor = positiveInTension ? 1d : -1d;
|
||||
|
||||
var result = new List<StressEntity>();
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
foreach (var material in materials)
|
||||
{
|
||||
var loaderMaterial = material.GetLoaderMaterial(limitState.LimitState, calcTerm.CalcTerm);
|
||||
for (double s = minValue; s < maxValue; s += step)
|
||||
{
|
||||
double strain = s * factor;
|
||||
double diagramValue = loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters, strain) * factor;
|
||||
StressEntity stressEntity = new()
|
||||
{
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
Material = material,
|
||||
Strain = strain,
|
||||
Stress = diagramValue
|
||||
};
|
||||
result.Add(stressEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SetLines()
|
||||
{
|
||||
var materials = MaterialsModel.SelectedItems;
|
||||
var limitStates = LimitStatesModel.SelectedItems;
|
||||
var calcTerms = CalcTermsModel.SelectedItems; ;
|
||||
var calcTerms = CalcTermsModel.SelectedItems;
|
||||
var labels = new List<string>();
|
||||
var factor = positiveInTension ? 1d : -1d;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
@@ -4,6 +4,7 @@ using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
@@ -22,6 +23,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
ICommand showSafetyFactors;
|
||||
SafetyFactorsViewModel safetyFactorsViewModel;
|
||||
private ICodeEntity codeEntity;
|
||||
private IMaterialLogic materialLogic;
|
||||
|
||||
public ILibMaterialEntity MaterialEntity
|
||||
{
|
||||
@@ -47,6 +49,9 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
}
|
||||
|
||||
public List<IMaterialLogic> MaterialLogics => material.MaterialLogics;
|
||||
public IMaterialLogic MaterialLogic { get => material.MaterialLogic; set => material.MaterialLogic = value; }
|
||||
|
||||
private void FillMaterialKinds()
|
||||
{
|
||||
var materialKinds = ProgramSetting
|
||||
|
||||
Reference in New Issue
Block a user