CrossSection view model was improved

This commit is contained in:
Evgeny Redikultsev
2024-02-02 22:27:18 +05:00
parent b1fc0c763f
commit 165a2846bb
22 changed files with 307 additions and 170 deletions

View File

@@ -25,12 +25,12 @@ namespace StructureHelper
builder.RegisterType<CrossSectionModel>().AsSelf().SingleInstance(); builder.RegisterType<CrossSectionModel>().AsSelf().SingleInstance();
builder.RegisterType<CrossSectionViewModel>().AsSelf().SingleInstance(); builder.RegisterType<CrossSectionViewModel>().AsSelf().SingleInstance();
builder.RegisterType<MainView>().AsSelf(); builder.RegisterType<CrossSectionView>().AsSelf();
Container = builder.Build(); Container = builder.Build();
Scope = Container.Resolve<ILifetimeScope>(); Scope = Container.Resolve<ILifetimeScope>();
var window = Scope.Resolve<MainView>(); var window = Scope.Resolve<CrossSectionView>();
window.Show(); window.Show();
} }

View File

@@ -1,4 +1,4 @@
<Window x:Class="StructureHelper.Windows.MainWindow.MainView" <Window x:Class="StructureHelper.Windows.MainWindow.CrossSectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -13,7 +13,7 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:MainViewModel}" d:DataContext="{d:DesignInstance local:CrossSectionViewModel}"
Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600"> Title="StructureHelper" Height="700" Width="1000" MinHeight="400" MinWidth="600">
<Window.Resources> <Window.Resources>
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}"> <DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
@@ -363,7 +363,7 @@
</i:EventTrigger> </i:EventTrigger>
</i:Interaction.Triggers> </i:Interaction.Triggers>
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"> <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
<Canvas Name="WorkPlane" ClipToBounds="True" Width="{Binding CanvasWidth}" Height="{Binding CanvasHeight}"> <Canvas Name="WorkPlane" ClipToBounds="True" Width="{Binding VisualProperty.WorkPlainWidth}" Height="{Binding VisualProperty.WorkPlainHeight}">
<Canvas.ContextMenu> <Canvas.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="Add" DataContext="{Binding PrimitiveLogic}"> <MenuItem Header="Add" DataContext="{Binding PrimitiveLogic}">
@@ -438,8 +438,10 @@
</VisualBrush.Visual> </VisualBrush.Visual>
</VisualBrush> </VisualBrush>
</Canvas.Background> </Canvas.Background>
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/> <!--Horizontal axis line-->
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/> <Line X1="0" X2="{Binding RightLimitX}" Y1="{Binding MiddleLimitY}" Y2="{Binding MiddleLimitY}" Stroke="Red" StrokeThickness="{Binding AxisLineThickness}"/>
<!--Vertical axis line-->
<Line X1="{Binding MiddleLimitX}" X2="{Binding MiddleLimitX}" Y1="0" Y2="{Binding BottomLimitY}" Stroke="ForestGreen" StrokeThickness="{Binding AxisLineThickness}"/>
<ItemsControl DataContext="{Binding PrimitiveLogic}" ItemsSource="{Binding Items}" ContextMenu="{StaticResource PrimitiveCRUD}"> <ItemsControl DataContext="{Binding PrimitiveLogic}" ItemsSource="{Binding Items}" ContextMenu="{StaticResource PrimitiveCRUD}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>

View File

@@ -6,12 +6,12 @@ using StructureHelper.Services.Primitives;
namespace StructureHelper.Windows.MainWindow namespace StructureHelper.Windows.MainWindow
{ {
public partial class MainView : Window public partial class CrossSectionView : Window
{ {
private CrossSectionViewModel viewModel; private CrossSectionViewModel viewModel;
public IPrimitiveRepository PrimitiveRepository { get; } public IPrimitiveRepository PrimitiveRepository { get; }
public MainView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel) public CrossSectionView(IPrimitiveRepository primitiveRepository, CrossSectionViewModel viewModel)
{ {
PrimitiveRepository = primitiveRepository; PrimitiveRepository = primitiveRepository;
this.viewModel = viewModel; this.viewModel = viewModel;

View File

@@ -27,21 +27,19 @@ namespace StructureHelper.Windows.MainWindow
{ {
public class CrossSectionViewModel : ViewModelBase public class CrossSectionViewModel : ViewModelBase
{ {
ICrossSection section; private ICrossSection section;
ICrossSectionRepository repository => section.SectionRepository; private ICrossSectionRepository repository => section.SectionRepository;
private CrossSectionViewVisualProperty visualProperty;
private readonly double scaleRate = 1.1d; private readonly double scaleRate = 1.1d;
public PrimitiveBase SelectedPrimitive { get; set; } public CrossSectionVisualPropertyVM VisualProperty { get; private set; }
//public IForceCombinationList SelectedForceCombinationList { get; set; }
private readonly AnalysisVewModelLogic calculatorsLogic;
public AnalysisVewModelLogic CalculatorsLogic { get => calculatorsLogic;} public PrimitiveBase SelectedPrimitive { get; set; }
public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
public MaterialsViewModel MaterialsLogic { get => materialsLogic; } public AnalysisVewModelLogic CalculatorsLogic { get; private set; }
public PrimitiveViewModelLogic PrimitiveLogic => primitiveLogic; public ActionsViewModel CombinationsLogic { get; }
public MaterialsViewModel MaterialsLogic { get; }
public PrimitiveViewModelLogic PrimitiveLogic { get; }
public HelpLogic HelpLogic => new HelpLogic(); public HelpLogic HelpLogic => new HelpLogic();
private CrossSectionModel Model { get; } private CrossSectionModel Model { get; }
@@ -84,37 +82,26 @@ namespace StructureHelper.Windows.MainWindow
public double AxisLineThickness public double AxisLineThickness
{ {
get => visualProperty.AxisLineThickness / scaleValue; get => VisualProperty.AxisLineThickness / scaleValue;
} }
public double GridLineThickness public double GridLineThickness
{ {
get => visualProperty.GridLineThickness / scaleValue; get => VisualProperty.GridLineThickness / scaleValue;
} }
private double xX2, xY1, yX1, yY2;
public double CanvasWidth
{
get => visualProperty.WorkPlainWidth;
}
public double CanvasHeight
{
get => visualProperty.WorkPlainHeight;
}
public string CanvasViewportSize public string CanvasViewportSize
{ {
get get
{ {
string s = visualProperty.GridSize.ToString(); string s = VisualProperty.GridSize.ToString();
s = s.Replace(',', '.'); s = s.Replace(',', '.');
return $"0,0,{s},{s}"; return $"0,0,{s},{s}";
} }
} }
public double GridSize { get => visualProperty.GridSize; } public double GridSize => VisualProperty.GridSize;
public ObservableCollection<IHeadMaterial> HeadMaterials public ObservableCollection<IHeadMaterial> HeadMaterials
{ {
@@ -129,26 +116,22 @@ namespace StructureHelper.Windows.MainWindow
} }
} }
public double XX2 /// <summary>
{ /// Right edge of work plane, coordinate X
get => xX2; /// </summary>
set => OnPropertyChanged(value, ref xX2); public double RightLimitX => VisualProperty.WorkPlainWidth;
} /// <summary>
public double XY1 /// Bottom edge of work plane Y
{ /// </summary>
get => xY1; public double BottomLimitY => VisualProperty.WorkPlainHeight;
set => OnPropertyChanged(value, ref xY1); /// <summary>
} /// Middle of coordinate X
public double YX1 /// </summary>
{ public double MiddleLimitX => VisualProperty.WorkPlainWidth / 2d;
get => yX1; /// <summary>
set => OnPropertyChanged(value, ref yX1); /// Middle of coordinate Y
} /// </summary>
public double YY2 public double MiddleLimitY => VisualProperty.WorkPlainHeight / 2d;
{
get => yY2;
set => OnPropertyChanged(value, ref yY2);
}
public ICommand Calculate { get; } public ICommand Calculate { get; }
public ICommand EditCalculationPropertyCommand { get; } public ICommand EditCalculationPropertyCommand { get; }
@@ -160,7 +143,7 @@ namespace StructureHelper.Windows.MainWindow
return new RelayCommand(o => return new RelayCommand(o =>
{ {
PrimitiveLogic.AddItems(GetRCCirclePrimitives()); PrimitiveLogic.AddItems(GetRCCirclePrimitives());
materialsLogic.Refresh(); MaterialsLogic.Refresh();
}); });
} }
} }
@@ -189,11 +172,18 @@ namespace StructureHelper.Windows.MainWindow
return showVisualProperty ?? return showVisualProperty ??
(showVisualProperty = new RelayCommand(o=> (showVisualProperty = new RelayCommand(o=>
{ {
var wnd = new VisualPropertyView(visualProperty); var wnd = new VisualPropertyView(VisualProperty);
wnd.ShowDialog(); wnd.ShowDialog();
OnPropertyChanged(nameof(AxisLineThickness)); OnPropertyChanged(nameof(AxisLineThickness));
OnPropertyChanged(nameof(CanvasViewportSize)); OnPropertyChanged(nameof(CanvasViewportSize));
OnPropertyChanged(nameof(GridSize)); OnPropertyChanged(nameof(GridSize));
OnPropertyChanged(nameof(RightLimitX));
OnPropertyChanged(nameof(BottomLimitY));
OnPropertyChanged(nameof(MiddleLimitX));
OnPropertyChanged(nameof(MiddleLimitY));
PrimitiveLogic.WorkPlaneWidth = VisualProperty.WorkPlainWidth;
PrimitiveLogic.WorkPlaneHeight = VisualProperty.WorkPlainHeight;
PrimitiveLogic.Refresh();
})); }));
} }
} }
@@ -214,27 +204,24 @@ namespace StructureHelper.Windows.MainWindow
} }
private double delta = 0.0005; private double delta = 0.0005;
private ActionsViewModel combinationsLogic;
private PrimitiveViewModelLogic primitiveLogic;
private RelayCommand showVisualProperty; private RelayCommand showVisualProperty;
private RelayCommand selectPrimitive; private RelayCommand selectPrimitive;
private MaterialsViewModel materialsLogic;
public CrossSectionViewModel(CrossSectionModel model) public CrossSectionViewModel(CrossSectionModel model)
{ {
visualProperty = new CrossSectionViewVisualProperty(); VisualProperty = new CrossSectionVisualPropertyVM();
Model = model; Model = model;
section = model.Section; section = model.Section;
combinationsLogic = new ActionsViewModel(repository); CombinationsLogic = new ActionsViewModel(repository);
materialsLogic = new MaterialsViewModel(repository); MaterialsLogic = new MaterialsViewModel(repository);
materialsLogic.AfterItemsEdit += afterMaterialEdit; MaterialsLogic.AfterItemsEdit += afterMaterialEdit;
calculatorsLogic = new AnalysisVewModelLogic(repository); CalculatorsLogic = new AnalysisVewModelLogic(repository);
primitiveLogic = new PrimitiveViewModelLogic(section) { CanvasWidth = CanvasWidth, CanvasHeight = CanvasHeight }; PrimitiveLogic = new PrimitiveViewModelLogic(section)
XX2 = CanvasWidth; {
XY1 = CanvasHeight / 2d; WorkPlaneWidth = VisualProperty.WorkPlainWidth,
YX1 = CanvasWidth / 2d; WorkPlaneHeight = VisualProperty.WorkPlainHeight
YY2 = CanvasHeight; };
scaleValue = 300d; scaleValue = 500d;
LeftButtonUp = new RelayCommand(o => LeftButtonUp = new RelayCommand(o =>
{ {
@@ -260,13 +247,6 @@ namespace StructureHelper.Windows.MainWindow
} }
}); });
//SetColor = new RelayCommand(o =>
//{
// var primitive = o as PrimitiveBase;
// var colorPickerView = new ColorPickerView(primitive);
// colorPickerView.ShowDialog();
//});
ScaleCanvasDown = new RelayCommand(o => ScaleCanvasDown = new RelayCommand(o =>
{ {
ScrollPanelX = PanelX; ScrollPanelX = PanelX;
@@ -284,19 +264,19 @@ namespace StructureHelper.Windows.MainWindow
AddBeamCase = new RelayCommand(o => AddBeamCase = new RelayCommand(o =>
{ {
PrimitiveLogic.AddItems(GetBeamCasePrimitives()); PrimitiveLogic.AddItems(GetBeamCasePrimitives());
materialsLogic.Refresh(); MaterialsLogic.Refresh();
}); });
AddColumnCase = new RelayCommand(o => AddColumnCase = new RelayCommand(o =>
{ {
PrimitiveLogic.AddItems(GetColumnCasePrimitives()); PrimitiveLogic.AddItems(GetColumnCasePrimitives());
materialsLogic.Refresh(); MaterialsLogic.Refresh();
}); });
AddSlabCase = new RelayCommand(o => AddSlabCase = new RelayCommand(o =>
{ {
PrimitiveLogic.AddItems(GetSlabCasePrimitives()); PrimitiveLogic.AddItems(GetSlabCasePrimitives());
materialsLogic.Refresh(); MaterialsLogic.Refresh();
}); });
MovePrimitiveToGravityCenterCommand = new RelayCommand(o => MovePrimitiveToGravityCenterCommand = new RelayCommand(o =>
@@ -328,7 +308,7 @@ namespace StructureHelper.Windows.MainWindow
private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e) private void afterMaterialEdit(SelectItemVM<IHeadMaterial> sender, CRUDVMEventArgs e)
{ {
foreach (var primitive in primitiveLogic.Items) foreach (var primitive in PrimitiveLogic.Items)
{ {
primitive.RefreshColor(); primitive.RefreshColor();
} }
@@ -336,7 +316,7 @@ namespace StructureHelper.Windows.MainWindow
private bool CheckMaterials() private bool CheckMaterials()
{ {
foreach (var item in primitiveLogic.Items) foreach (var item in PrimitiveLogic.Items)
{ {
if (item.HeadMaterial == null) if (item.HeadMaterial == null)
{ {
@@ -400,7 +380,7 @@ namespace StructureHelper.Windows.MainWindow
var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives); var primitives = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(newRepository.Primitives);
foreach (var item in primitives) foreach (var item in primitives)
{ {
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2); item.RegisterDeltas(VisualProperty.WorkPlainWidth / 2, VisualProperty.WorkPlainHeight / 2);
} }
PrimitiveLogic.Refresh(); PrimitiveLogic.Refresh();
foreach (var item in newRepository.HeadMaterials) foreach (var item in newRepository.HeadMaterials)

View File

@@ -0,0 +1,83 @@
using StructureHelper.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.MainWindow
{
public class CrossSectionVisualPropertyVM : ViewModelBase
{
private double axisLineThickness;
private double gridLineThickness;
private double gridSize;
private double workPlainWidth;
private double workPlainHeight;
/// <summary>
/// Thickness of x-, and y- axis line
/// </summary>
public double AxisLineThickness
{
get => axisLineThickness; set
{
axisLineThickness = value;
OnPropertyChanged(nameof(AxisLineThickness));
}
}
/// <summary>
/// Thickness of lines of coordinate mesh
/// </summary>
public double GridLineThickness
{
get => gridLineThickness; set
{
gridLineThickness = value;
OnPropertyChanged(nameof(GridLineThickness));
}
}
/// <summary>
/// Size of coordinate mesh
/// </summary>
public double GridSize
{
get => gridSize; set
{
gridSize = value;
OnPropertyChanged(nameof(GridSize));
}
}
/// <summary>
/// Width of work plane
/// </summary>
public double WorkPlainWidth
{
get => workPlainWidth; set
{
workPlainWidth = value;
OnPropertyChanged(nameof(WorkPlainWidth));
}
}
/// <summary>
/// Height of work plane
/// </summary>
public double WorkPlainHeight
{
get => workPlainHeight; set
{
workPlainHeight = value;
OnPropertyChanged(nameof(WorkPlainHeight));
}
}
public CrossSectionVisualPropertyVM()
{
AxisLineThickness = 2d;
GridLineThickness = 0.25d;
GridSize = 0.05d;
WorkPlainWidth = 1.2d;
WorkPlainHeight = 1.2d;
}
}
}

View File

@@ -4,10 +4,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow" xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow"
d:DataContext="{d:DesignInstance local:CrossSectionVisualPropertyVM}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> Title="Grid properies" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/>
<RowDefinition Height="22"/> <RowDefinition Height="22"/>
<RowDefinition Height="22"/> <RowDefinition Height="22"/>
<RowDefinition/> <RowDefinition/>
@@ -18,7 +22,13 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="Axis grid thickness"/> <TextBlock Text="Axis grid thickness"/>
<TextBox Grid.Column="1" Text="{Binding AxisLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/> <TextBox Grid.Column="1" Text="{Binding AxisLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="1" Text="Mesh size"/> <TextBlock Grid.Row="1" Text="Grid size"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GridSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/> <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding GridSize, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="2" Text="Grid line thickness"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding GridLineThickness, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="3" Text="Work plane width"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding WorkPlainWidth, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="4" Text="Work plane height"/>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding WorkPlainHeight, Converter={StaticResource LengthConverter}, ValidatesOnExceptions=True}"/>
</Grid> </Grid>
</Window> </Window>

View File

@@ -1,5 +1,4 @@
using StructureHelper.Windows.ViewModels.NdmCrossSections; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -20,7 +19,7 @@ namespace StructureHelper.Windows.MainWindow
/// </summary> /// </summary>
public partial class VisualPropertyView : Window public partial class VisualPropertyView : Window
{ {
public VisualPropertyView(CrossSectionViewVisualProperty vm) public VisualPropertyView(CrossSectionVisualPropertyVM vm)
{ {
InitializeComponent(); InitializeComponent();
DataContext = vm; DataContext = vm;

View File

@@ -81,7 +81,7 @@ namespace StructureHelper.Windows.Services
} }
private void RefreshAngle() private void RefreshAngle()
{ {
Angle = Math.Atan2(deltaX, deltaY) * 180d / Math.PI - 90d; Angle = Math.Atan2(deltaX, deltaY * (-1)) * 180d / Math.PI - 90d;
Angle = Math.Round(Angle, 1); Angle = Math.Round(Angle, 1);
Distance = Math.Sqrt(deltaX * deltaX + deltaY * deltaY); Distance = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
Distance = Math.Round(Distance, 3); Distance = Math.Round(Distance, 3);

View File

@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{
public class CrossSectionViewVisualProperty
{
public double AxisLineThickness { get; set; }
public double GridLineThickness { get; set; }
public double GridSize { get; set; }
public double WorkPlainWidth { get; set; }
public double WorkPlainHeight { get; set; }
public CrossSectionViewVisualProperty()
{
AxisLineThickness = 2d;
GridLineThickness = 0.25d;
GridSize = 0.05d;
WorkPlainWidth = 2.4d;
WorkPlainHeight = 2.0d;
}
}
}

View File

@@ -1,26 +1,21 @@
using FieldVisualizer.ViewModels; using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.Enums;
using StructureHelper.Infrastructure.UI.DataContexts; using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelper.Windows.PrimitiveProperiesWindow;
using StructureHelper.Windows.Services;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperLogics.Models.CrossSections; using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelper.Services.Primitives;
using StructureHelper.Infrastructure;
using StructureHelper.Infrastructure.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperLogics.Models.Primitives;
using ViewModelBase = StructureHelper.Infrastructure.ViewModelBase;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Documents;
using StructureHelper.Windows.PrimitiveProperiesWindow;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System.Windows.Input; using System.Windows.Input;
using StructureHelper.Windows.Services;
using StructureHelperCommon.Models.Shapes; //Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
//All rights reserved.
namespace StructureHelper.Windows.ViewModels.NdmCrossSections namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{ {
@@ -36,8 +31,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private ICommand setToBack; private ICommand setToBack;
private ICommand copyToCommand; private ICommand copyToCommand;
public double CanvasWidth { get; set; } public double WorkPlaneWidth { get; set; }
public double CanvasHeight { get; set; } public double WorkPlaneHeight { get; set; }
public PrimitiveBase SelectedItem { get; set; } public PrimitiveBase SelectedItem { get; set; }
@@ -101,7 +96,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
viewPrimitive = new CircleViewPrimitive(primitive); viewPrimitive = new CircleViewPrimitive(primitive);
} }
else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); } else { throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(primitiveType)); }
viewPrimitive.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2); viewPrimitive.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
repository.Primitives.Add(ndmPrimitive); repository.Primitives.Add(ndmPrimitive);
ndmPrimitive.CrossSection = section; ndmPrimitive.CrossSection = section;
Items.Add(viewPrimitive); Items.Add(viewPrimitive);
@@ -244,7 +239,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
} }
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
primitiveBase.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2); primitiveBase.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
Items.Add(primitiveBase); Items.Add(primitiveBase);
OnPropertyChanged(nameof(Items)); OnPropertyChanged(nameof(Items));
OnPropertyChanged(nameof(PrimitivesCount)); OnPropertyChanged(nameof(PrimitivesCount));
@@ -306,6 +301,11 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public void Refresh() public void Refresh()
{ {
foreach (var item in Items)
{
item.RegisterDeltas(WorkPlaneWidth / 2, WorkPlaneHeight / 2);
item.Refresh();
}
OnPropertyChanged(nameof(PrimitivesCount)); OnPropertyChanged(nameof(PrimitivesCount));
} }

View File

@@ -24,8 +24,8 @@ namespace StructureHelperCommon.Models
{ {
var table = new TableLogEntry(2); var table = new TableLogEntry(2);
table.Priority = Priority; table.Priority = Priority;
table.Table.AddRow(GetPointHeaderRow()); table.Table.AddRow(GetPoint2DHeaderRow());
table.Table.AddRow(GetPointRow(point2D)); table.Table.AddRow(GetPoint2DRow(point2D));
return table; return table;
} }
/// <summary> /// <summary>
@@ -50,10 +50,10 @@ namespace StructureHelperCommon.Models
{ {
var table = new TableLogEntry(2); var table = new TableLogEntry(2);
table.Priority = Priority; table.Priority = Priority;
table.Table.AddRow(GetPointHeaderRow()); table.Table.AddRow(GetPoint2DHeaderRow());
foreach (var item in points) foreach (var item in points)
{ {
table.Table.AddRow(GetPointRow(item)); table.Table.AddRow(GetPoint2DRow(item));
} }
return table; return table;
} }
@@ -182,7 +182,7 @@ namespace StructureHelperCommon.Models
return forceTupleRow; return forceTupleRow;
} }
private ShTableRow<ITraceLoggerEntry> GetPointHeaderRow() private ShTableRow<ITraceLoggerEntry> GetPoint2DHeaderRow()
{ {
const CellRole cellRole = CellRole.Header; const CellRole cellRole = CellRole.Header;
@@ -213,7 +213,7 @@ namespace StructureHelperCommon.Models
headerRow.Elements[1] = tableCell; headerRow.Elements[1] = tableCell;
return headerRow; return headerRow;
} }
private ShTableRow<ITraceLoggerEntry> GetPointRow(IPoint2D point2D) private ShTableRow<ITraceLoggerEntry> GetPoint2DRow(IPoint2D point2D)
{ {
var pointRow = new ShTableRow<ITraceLoggerEntry>(2); var pointRow = new ShTableRow<ITraceLoggerEntry>(2);
pointRow.Elements[0].Value = new StringLogEntry() pointRow.Elements[0].Value = new StringLogEntry()

View File

@@ -11,5 +11,6 @@ namespace StructureHelperCommon.Models
List<ITraceLoggerEntry> TraceLoggerEntries { get; } List<ITraceLoggerEntry> TraceLoggerEntries { get; }
void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPriority = 0); void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPriority = 0);
void AddMessage(string message, int priority); void AddMessage(string message, int priority);
bool KeepErrorStatus { get; set; }
} }
} }

View File

@@ -12,15 +12,18 @@ namespace StructureHelperCommon.Models
public int ShiftPriority { get; set; } public int ShiftPriority { get; set; }
public List<ITraceLoggerEntry> TraceLoggerEntries => Logger.TraceLoggerEntries; public List<ITraceLoggerEntry> TraceLoggerEntries => Logger.TraceLoggerEntries;
public bool KeepErrorStatus { get => Logger.KeepErrorStatus; set => Logger.KeepErrorStatus = value; }
public ShiftTraceLogger(ITraceLogger logger) public ShiftTraceLogger(ITraceLogger logger)
{ {
Logger = logger; Logger = logger;
KeepErrorStatus = true;
} }
public ShiftTraceLogger() : this(new TraceLogger()) { } public ShiftTraceLogger() : this(new TraceLogger()) { }
public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0) public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0)
{ {
// if status in (fatal, error, warning) they must be kept as they are // if status in (fatal, error, warning) they must be kept as they are
if (status <= TraceLogStatuses.Warning) if (status <= TraceLogStatuses.Warning & KeepErrorStatus == true)
{ {
Logger.AddMessage(message, status); Logger.AddMessage(message, status);
} }

View File

@@ -11,10 +11,12 @@ namespace StructureHelperCommon.Models
public class TraceLogger : ITraceLogger public class TraceLogger : ITraceLogger
{ {
public List<ITraceLoggerEntry> TraceLoggerEntries { get; } public List<ITraceLoggerEntry> TraceLoggerEntries { get; }
public bool KeepErrorStatus { get; set; }
public TraceLogger() public TraceLogger()
{ {
TraceLoggerEntries = new(); TraceLoggerEntries = new();
KeepErrorStatus = true;
} }
public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0) public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0)

View File

@@ -12,7 +12,7 @@ namespace StructureHelperCommon.Models.Shapes
{ {
private Directions constDirections; private Directions constDirections;
/// <summary> /// <summary>
/// Direction, for which canstant value is assigned /// Direction, for which constant value is assigned
/// </summary> /// </summary>
public Directions ConstDirections public Directions ConstDirections
{ {
@@ -31,6 +31,8 @@ namespace StructureHelperCommon.Models.Shapes
/// Constant value for assigned direction /// Constant value for assigned direction
/// </summary> /// </summary>
public double ConstDirectionValue { get; set; } public double ConstDirectionValue { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public ConstOneDirectionLogic(Directions constDirection, double constValue) public ConstOneDirectionLogic(Directions constDirection, double constValue)
{ {
ConstDirections = constDirection; ConstDirections = constDirection;
@@ -39,18 +41,46 @@ namespace StructureHelperCommon.Models.Shapes
/// <inheritdoc/> /// <inheritdoc/>
public IPoint3D GetPoint3D(IPoint2D point2D) public IPoint3D GetPoint3D(IPoint2D point2D)
{ {
TraceLogger?.AddMessage($"Logic convert point from 2D-space to 3D-space");
IPoint3D point; IPoint3D point;
if (ConstDirections == Directions.X) if (ConstDirections == Directions.X)
{ {
point = new Point3D() { X = ConstDirectionValue, Y = - point2D.X, Z = point2D.Y }; point = new Point3D()
{
X = ConstDirectionValue,
Y = - point2D.X,
Z = point2D.Y
};
TraceLogger?.AddMessage($"Constant direction is x-direction, so X = {point.X}");
TraceLogger?.AddMessage($"X = ConstantValue = {point.X}");
TraceLogger?.AddMessage($"Y = - point2D.X = {point.Y}");
TraceLogger?.AddMessage($"Z = point2D.Y = {point.Z}");
} }
else if (ConstDirections == Directions.Y) else if (ConstDirections == Directions.Y)
{ {
point = new Point3D() { X = point2D.X, Y = ConstDirectionValue, Z = point2D.Y }; point = new Point3D()
{
X = point2D.X,
Y = ConstDirectionValue,
Z = point2D.Y
};
TraceLogger?.AddMessage($"Constant direction is Y-direction");
TraceLogger?.AddMessage($"X = point2D.X = {point.X}");
TraceLogger?.AddMessage($"Y = ConstantValue = {point.Y}");
TraceLogger?.AddMessage($"Z = point2D.Y = {point.Z}");
} }
else if (ConstDirections == Directions.Z) else if (ConstDirections == Directions.Z)
{ {
point = new Point3D() { X = point2D.Y, Y = point2D.X, Z = ConstDirectionValue }; point = new Point3D()
{
X = point2D.Y,
Y = point2D.X,
Z = ConstDirectionValue
};
TraceLogger?.AddMessage($"Constant direction is Z-direction");
TraceLogger?.AddMessage($"X = point2D.Y = {point.X}");
TraceLogger?.AddMessage($"Y = point2D.X = {point.Y}");
TraceLogger?.AddMessage($"Z = ConstantValue = {point.Z}");
} }
else else
{ {

View File

@@ -1,4 +1,5 @@
using System; using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -13,7 +14,7 @@ namespace StructureHelperCommon.Models.Shapes
/// <summary> /// <summary>
/// Logic for convert 2DPoint of some plane to point of 3DSpace /// Logic for convert 2DPoint of some plane to point of 3DSpace
/// </summary> /// </summary>
public interface IConvert2DPointTo3DPointLogic public interface IConvert2DPointTo3DPointLogic : ILogic
{ {
/// <summary> /// <summary>
/// Returns point in 3D-space by 2D point in some workplane /// Returns point in 3D-space by 2D point in some workplane

View File

@@ -1,4 +1,5 @@
using LoaderCalculator.Data.Ndms; using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
@@ -10,7 +11,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve.Fac
public PredicateTypes PredicateType { get; set; } public PredicateTypes PredicateType { get; set; }
public IConvert2DPointTo3DPointLogic ConvertLogic { get; set; } public IConvert2DPointTo3DPointLogic ConvertLogic { get; set; }
public string Name { get; set; } public string Name { get; set; }
public ITraceLogger? TraceLogger { get; set; } public IShiftTraceLogger? TraceLogger { get; set; }
public object Clone()
{
throw new NotImplementedException();
}
public Predicate<IPoint2D> GetPredicate() public Predicate<IPoint2D> GetPredicate()
{ {
@@ -19,6 +25,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve.Fac
Ndms = Ndms, Ndms = Ndms,
ConvertLogic = ConvertLogic ConvertLogic = ConvertLogic
}; };
if (TraceLogger is not null)
{
factory.TraceLogger = TraceLogger;
}
TraceLogger?.AddMessage($"Predicate factory was obtained succsefully", TraceLogStatuses.Debug);
var predicateType = PredicateType; var predicateType = PredicateType;
var predicate = factory.GetPredicate(predicateType); var predicate = factory.GetPredicate(predicateType);
return predicate; return predicate;

View File

@@ -1,12 +1,12 @@
using StructureHelperCommon.Models; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve.Factories namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve.Factories
{ {
public interface IGetPredicateLogic public interface IGetPredicateLogic : ILogic, ICloneable
{ {
string Name { get; set; } string Name { get; set; }
Predicate<IPoint2D> GetPredicate(); Predicate<IPoint2D> GetPredicate();
ITraceLogger? TraceLogger { get; set; }
} }
} }

View File

@@ -1,5 +1,8 @@
using LoaderCalculator.Data.Ndms; using LoaderCalculator;
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.NdmCalculations.Cracking; using StructureHelperLogics.NdmCalculations.Cracking;
@@ -14,13 +17,17 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
Strength, Strength,
Cracking Cracking
} }
public class PredicateFactory public class PredicateFactory : ILogic
{ {
private ForceTupleCalculator calculator; private ForceTupleCalculator calculator;
private ForceTuple tuple; private ForceTuple tuple;
private ForceTupleInputData inputData; private ForceTupleInputData inputData;
private IShiftTraceLogger logger;
public IEnumerable<INdm> Ndms { get; set; } public IEnumerable<INdm> Ndms { get; set; }
public IConvert2DPointTo3DPointLogic ConvertLogic { get; set; } public IConvert2DPointTo3DPointLogic ConvertLogic { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public PredicateFactory() public PredicateFactory()
{ {
inputData = new(); inputData = new();
@@ -28,6 +35,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
} }
public Predicate<IPoint2D> GetPredicate(PredicateTypes predicateType) public Predicate<IPoint2D> GetPredicate(PredicateTypes predicateType)
{ {
if (TraceLogger is not null)
{
logger = new ShiftTraceLogger() { ShiftPriority = 500, KeepErrorStatus = false };
//calculator.TraceLogger = logger; // too much results
//ConvertLogic.TraceLogger = logger; //wrong work in different threads
}
if (predicateType == PredicateTypes.Strength) if (predicateType == PredicateTypes.Strength)
{ {
return point2D => IsSectionFailure(point2D); return point2D => IsSectionFailure(point2D);
@@ -44,6 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private bool IsSectionFailure(IPoint2D point2D) private bool IsSectionFailure(IPoint2D point2D)
{ {
logger?.TraceLoggerEntries.Clear();
var point3D = ConvertLogic.GetPoint3D(point2D); var point3D = ConvertLogic.GetPoint3D(point2D);
tuple = new() tuple = new()
{ {
@@ -54,12 +68,17 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
inputData.Tuple = tuple; inputData.Tuple = tuple;
inputData.NdmCollection = Ndms; inputData.NdmCollection = Ndms;
calculator.Run(); calculator.Run();
if (logger is not null)
{
TraceLogger?.TraceLoggerEntries.AddRange(logger.TraceLoggerEntries);
}
var result = calculator.Result; var result = calculator.Result;
return !result.IsValid; return !result.IsValid;
} }
private bool IsSectionCracked(IPoint2D point2D) private bool IsSectionCracked(IPoint2D point2D)
{ {
logger?.TraceLoggerEntries.Clear();
var logic = new HoleSectionCrackedLogic(); var logic = new HoleSectionCrackedLogic();
var point3D = ConvertLogic.GetPoint3D(point2D); var point3D = ConvertLogic.GetPoint3D(point2D);
tuple = new() tuple = new()
@@ -72,6 +91,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
logic.NdmCollection = Ndms; logic.NdmCollection = Ndms;
try try
{ {
if (logger is not null)
{
TraceLogger?.TraceLoggerEntries.AddRange(logger.TraceLoggerEntries);
}
var result = logic.IsSectionCracked(); var result = logic.IsSectionCracked();
return result; return result;
} }

View File

@@ -33,7 +33,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
/// <inheritdoc/> /// <inheritdoc/>
public List<IPoint2D> GetPoints(IEnumerable<IPoint2D> points) public List<IPoint2D> GetPoints(IEnumerable<IPoint2D> points)
{ {
if (TraceLogger is not null) { ParameterLogic.TraceLogger = TraceLogger; } if (TraceLogger is not null)
{
ParameterLogic.TraceLogger = TraceLogger;
}
result = new(); result = new();
resultList = new(); resultList = new();
TraceLogger?.AddMessage($"Predicate name is {GetPredicateLogic.Name}"); TraceLogger?.AddMessage($"Predicate name is {GetPredicateLogic.Name}");
@@ -74,12 +77,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private Point2D FindResultPoint(IPoint2D point) private Point2D FindResultPoint(IPoint2D point)
{ {
Predicate<IPoint2D> limitPredicate; var resultPoint = FindResultPointByPredicate(point);
lock (lockObject)
{
limitPredicate = GetPredicateLogic.GetPredicate();
}
var resultPoint = FindResultPointByPredicate(point, limitPredicate);
lock (lockObject) lock (lockObject)
{ {
pointCount++; pointCount++;
@@ -89,14 +87,23 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
return resultPoint; return resultPoint;
} }
private Point2D FindResultPointByPredicate(IPoint2D point, Predicate<IPoint2D> limitPredicate) private Point2D FindResultPointByPredicate(IPoint2D point)
{ {
ShiftTraceLogger newLogger;
Predicate<IPoint2D> limitPredicate;
lock (lockObject)
{
newLogger = new ShiftTraceLogger()
{
ShiftPriority = 100
};
GetPredicateLogic.TraceLogger = newLogger;
limitPredicate = GetPredicateLogic.GetPredicate();
}
var localCurrentPoint = point.Clone() as IPoint2D; var localCurrentPoint = point.Clone() as IPoint2D;
var logic = ParameterLogic.Clone() as ILimitCurveParameterLogic; var logic = ParameterLogic.Clone() as ILimitCurveParameterLogic;
logic.TraceLogger = new ShiftTraceLogger() logic.TraceLogger = newLogger;
{
ShiftPriority=100
};
logic.CurrentPoint = localCurrentPoint; logic.CurrentPoint = localCurrentPoint;
logic.LimitPredicate = limitPredicate; logic.LimitPredicate = limitPredicate;
double parameter; double parameter;
@@ -119,7 +126,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
TraceLogger?.AddMessage($"Source point"); TraceLogger?.AddMessage($"Source point");
TraceLogger?.AddEntry(new TraceTablesFactory(TraceLogStatuses.Info).GetByPoint2D(localCurrentPoint)); TraceLogger?.AddEntry(new TraceTablesFactory(TraceLogStatuses.Info).GetByPoint2D(localCurrentPoint));
TraceLogger?.TraceLoggerEntries.AddRange(logic.TraceLogger.TraceLoggerEntries); TraceLogger?.TraceLoggerEntries.AddRange(newLogger.TraceLoggerEntries);
TraceLogger?.AddMessage($"Parameter value {parameter} was obtained"); TraceLogger?.AddMessage($"Parameter value {parameter} was obtained");
TraceLogger?.AddMessage($"Calculated point\n(X={localCurrentPoint.X} * {parameter} = {resultPoint.X},\nY={localCurrentPoint.Y} * {parameter} = {resultPoint.Y})"); TraceLogger?.AddMessage($"Calculated point\n(X={localCurrentPoint.X} * {parameter} = {resultPoint.X},\nY={localCurrentPoint.Y} * {parameter} = {resultPoint.Y})");
TraceLogger?.AddEntry(new TraceTablesFactory(TraceLogStatuses.Info).GetByPoint2D(resultPoint)); TraceLogger?.AddEntry(new TraceTablesFactory(TraceLogStatuses.Info).GetByPoint2D(resultPoint));

View File

@@ -106,7 +106,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
ConvertLogic = InputData.SurroundData.ConvertLogicEntity.ConvertLogic, ConvertLogic = InputData.SurroundData.ConvertLogicEntity.ConvertLogic,
PredicateType = predicateType PredicateType = predicateType
}; };
if (TraceLogger is not null) { getPredicateLogic.TraceLogger = TraceLogger; } if (TraceLogger is not null)
{
//getPredicateLogic.TraceLogger = TraceLogger;
}
var logic = new LimitCurveLogic(getPredicateLogic); var logic = new LimitCurveLogic(getPredicateLogic);
var calculator = new LimitCurveCalculator(logic) var calculator = new LimitCurveCalculator(logic)
{ {

View File

@@ -6,6 +6,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
//All rights reserved.
namespace StructureHelperLogics.NdmCalculations.Cracking namespace StructureHelperLogics.NdmCalculations.Cracking
{ {
public class ExpSofteningLogic : ICrackSofteningLogic public class ExpSofteningLogic : ICrackSofteningLogic
@@ -25,6 +28,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
powerFactor = value; powerFactor = value;
} }
} }
/// <summary>
/// Factor betta in exponential softening model of reinforced concrete
/// </summary>
public double BettaFactor { get; set; } public double BettaFactor { get; set; }
public double ForceRatio public double ForceRatio
{ {
@@ -42,6 +48,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
forceRatio = value; forceRatio = value;
} }
} }
/// <inheritdoc/>
public double PsiSMin {get;set;} public double PsiSMin {get;set;}
public IShiftTraceLogger? TraceLogger { get; set; } public IShiftTraceLogger? TraceLogger { get; set; }
@@ -51,6 +58,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
PowerFactor = 2d; PowerFactor = 2d;
BettaFactor = 0.8d; BettaFactor = 0.8d;
} }
/// <inheritdoc/>
public double GetSofteningFactor() public double GetSofteningFactor()
{ {
TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service); TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service);
@@ -59,7 +67,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
TraceLogger?.AddMessage($"But not less than psi_s_min = {PsiSMin}"); TraceLogger?.AddMessage($"But not less than psi_s_min = {PsiSMin}");
TraceLogger?.AddMessage($"BettaFactor = {BettaFactor}"); TraceLogger?.AddMessage($"BettaFactor = {BettaFactor}");
TraceLogger?.AddMessage($"ForceRatio = {ForceRatio}"); TraceLogger?.AddMessage($"ForceRatio = {ForceRatio}");
TraceLogger?.AddMessage($"PowerFactor = {BettaFactor}"); TraceLogger?.AddMessage($"PowerFactor = {PowerFactor}");
double psi; double psi;
psi = 1 - BettaFactor * Math.Pow(ForceRatio, PowerFactor); psi = 1 - BettaFactor * Math.Pow(ForceRatio, PowerFactor);
TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor = 1 - {BettaFactor} * {ForceRatio} ^ {PowerFactor} = {psi}"); TraceLogger?.AddMessage($"psi_s = 1 - BettaFactor * ForceRatio ^ PowerFactor = 1 - {BettaFactor} * {ForceRatio} ^ {PowerFactor} = {psi}");