Refactoring: add some button icons

This commit is contained in:
Evgeny Redikultsev
2024-11-16 22:34:34 +05:00
parent 28f031764c
commit 6ec68c6f49
42 changed files with 1140 additions and 369 deletions

View File

@@ -30,8 +30,8 @@ namespace DataAccess.DTOs
public IAccuracy Accuracy { get; set; } = new AccuracyDTO(); public IAccuracy Accuracy { get; set; } = new AccuracyDTO();
[JsonProperty("CompressedMember")] [JsonProperty("CompressedMember")]
public ICompressedMember CompressedMember { get; set; } = new CompressedMemberDTO(); public ICompressedMember CompressedMember { get; set; } = new CompressedMemberDTO();
[JsonIgnore] //[JsonIgnore]
public List<IForceCombinationList> ForceCombinationLists { get; set; } = new(); //public List<IForceCombinationList> ForceCombinationLists { get; set; } = new();
} }
} }

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using System; using System;
@@ -15,6 +16,10 @@ namespace DataAccess.DTOs
public Guid Id { get; set; } public Guid Id { get; set; }
[JsonProperty("Name")] [JsonProperty("Name")]
public string Name { get; set; } public string Name { get; set; }
[JsonProperty("LimitState")]
public LimitStates LimitState { get; set; } = LimitStates.SLS;
[JsonProperty("CalcTerm")]
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
[JsonProperty("FullSLSForces")] [JsonProperty("FullSLSForces")]
public IForceTuple FullSLSForces { get; set; } = new ForceTupleDTO(); public IForceTuple FullSLSForces { get; set; } = new ForceTupleDTO();
[JsonProperty("ULSFactor")] [JsonProperty("ULSFactor")]
@@ -26,13 +31,17 @@ namespace DataAccess.DTOs
[JsonProperty("ForcePoint")] [JsonProperty("ForcePoint")]
public IPoint2D ForcePoint { get; set; } = new Point2DDTO(); public IPoint2D ForcePoint { get; set; } = new Point2DDTO();
public object Clone() public object Clone()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public IForceCombinationList GetCombinations() public IForceCombinationList GetCombination()
{
throw new NotImplementedException();
}
public List<IForceCombinationList> GetCombinations()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@@ -27,7 +27,12 @@ namespace DataAccess.DTOs
throw new NotImplementedException(); throw new NotImplementedException();
} }
public IForceCombinationList GetCombinations() public IForceCombinationList GetCombination()
{
throw new NotImplementedException();
}
public List<IForceCombinationList> GetCombinations()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@@ -6,7 +6,7 @@
xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls" xmlns:FieldViewerControl="clr-namespace:FieldVisualizer.Windows.UserControls"
xmlns:local="clr-namespace:FieldVisualizer.Windows" xmlns:local="clr-namespace:FieldVisualizer.Windows"
mc:Ignorable="d" mc:Ignorable="d"
Title="FieldViewer" Height="800" Width="1200" MinHeight="400" MinWidth="800" MaxHeight="1000" MaxWidth="1500" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"> Title="FieldViewer" Height="800" Width="1200" MinHeight="400" MinWidth="800" MaxHeight="1000" MaxWidth="1500" WindowStartupLocation="CenterScreen">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/> <ColumnDefinition Width="300"/>

View File

@@ -201,6 +201,112 @@
</Canvas> </Canvas>
</DataTemplate> </DataTemplate>
<DataTemplate x:Key="CoordGrid">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
<Line X1="4" Y1="22" X2="28" Y2="22" Stroke="DarkGray"/>
<Line X1="10" Y1="4" X2="10" Y2="28" Stroke="DarkGray"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="StepSolution">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource CoordGrid}"/>
<Line X1="5" Y1="27" X2="26" Y2="6" Stroke="Black"/>
<Line X1="25.5" Y1="22" X2="25.5" Y2="6" Stroke="LightGray"/>
<Line X1="10" Y1="6" X2="25.5" Y2="6" Stroke="LightGray"/>
<Line X1="5.5" Y1="26" X2="5.5" Y2="22" Stroke="LightGray"/>
<Line X1="5.5" Y1="26" X2="10" Y2="26" Stroke="LightGray"/>
<Ellipse Margin="4, 25, 0, 0" Width="3" Height="3" Fill="Black"/>
<Ellipse Margin="11, 18, 0, 0" Width="3" Height="3" Fill="Black"/>
<Ellipse Margin="18, 11, 0, 0" Width="3" Height="3" Fill="Black"/>
<Ellipse Margin="24, 5, 0, 0" Width="3" Height="3" Fill="Black"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="MomentCurvatureDiagram">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource CoordGrid}"/>
<Path Margin="4" Data="M 3 18 l 4 -7 h 4 l 8 -7 h 5" Stroke="Black"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="ValuePointDiagram">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource CoordGrid}"/>
<Path Margin="4" Data="M 3 0 l 4 12 l 12 6 h 5" Stroke="Black"/>
<Rectangle Margin="15, 5, 0, 0" Width="10" Height="10" Fill="DarkGray"/>
<Ellipse Margin="23, 13, 0, 0" Width="3" Height="3" Fill="Black"/>
<Ellipse Margin="23, 4, 0, 0" Width="3" Height="3" Fill="Black"/>
<Ellipse Margin="14, 13, 0, 0" Width="3" Height="3" Fill="Black"/>
<Ellipse Margin="14, 4, 0, 0" Width="3" Height="3" Fill="Black"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="InteractionDiagram">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource CoordGrid}"/>
<Path Margin="4" Data="M 6 0 l 5 3 l 6 4 l 3 5 l 0 4 l -4 3 l -10 3 z" Stroke="Black"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="Table">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
<Line X1="4" Y1="13" X2="28" Y2="13" Stroke="Black"/>
<Line X1="4" Y1="16" X2="28" Y2="16" Stroke="Black"/>
<Line X1="4" Y1="19" X2="28" Y2="19" Stroke="DarkGray" StrokeThickness="0.5"/>
<Line X1="4" Y1="22" X2="28" Y2="22" Stroke="DarkGray" StrokeThickness="0.5"/>
<Line X1="4" Y1="25" X2="28" Y2="25" Stroke="DarkGray" StrokeThickness="0.5"/>
<Line X1="12" Y1="13" X2="12" Y2="28" Stroke="Black" StrokeThickness="0.5"/>
<Line X1="17" Y1="13" X2="17" Y2="28" Stroke="Black" StrokeThickness="0.5"/>
<Line X1="22" Y1="13" X2="22" Y2="28" Stroke="Black" StrokeThickness="0.5"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="GeometryTable">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
<ContentControl ContentTemplate="{DynamicResource Table}"/>
<TextBlock Text="Geom" FontSize="8" FontWeight="Bold" Margin="4,2,0,2"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="ForceTable">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
<ContentControl ContentTemplate="{DynamicResource Table}"/>
<TextBlock Text="Force" FontSize="8" FontWeight="Bold" Margin="4,2,0,2"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="ExportToXLS">
<Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children>
<ContentControl ContentTemplate="{DynamicResource ButtonResultRectangle}"/>
<ContentControl ContentTemplate="{DynamicResource Table}"/>
<TextBlock Text="CSV" FontSize="8" FontWeight="Bold" Margin="4,2,0,2"/>
<TextBlock Text="XLS" FontSize="12" FontWeight="Bold" FontStyle="Italic" Margin="6,14,0,2"/>
</Canvas.Children>
</Canvas>
</DataTemplate>
<DataTemplate x:Key="IsoFieldResult"> <DataTemplate x:Key="IsoFieldResult">
<Canvas Style="{DynamicResource ButtonResultCanvas}"> <Canvas Style="{DynamicResource ButtonResultCanvas}">
<Canvas.Children> <Canvas.Children>

View File

@@ -78,6 +78,9 @@
<Compile Update="Windows\Services\CopyByParameterView.xaml.cs"> <Compile Update="Windows\Services\CopyByParameterView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Windows\UserControls\ButtonToolTipEh.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs"> <Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@@ -176,6 +179,9 @@
<Page Update="Windows\Services\CopyByParameterView.xaml"> <Page Update="Windows\Services\CopyByParameterView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Windows\UserControls\ButtonToolTipEh.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\UserControls\MultiplyDouble.xaml"> <Page Update="Windows\UserControls\MultiplyDouble.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>

View File

@@ -8,7 +8,7 @@
mc:Ignorable="d" mc:Ignorable="d"
Title="{Binding WindowTitle}" Height="390" Width="400" MinHeight="300" MinWidth="400" Title="{Binding WindowTitle}" Height="390" Width="400" MinHeight="300" MinWidth="400"
ResizeMode="NoResize" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
Closing="Window_Closing" ShowInTaskbar="False" Icon="{Binding Mode=OneWay, Source={StaticResource CrackCalculator}}" Closing="Window_Closing" Icon="{Binding Mode=OneWay, Source={StaticResource CrackCalculator}}"
> >
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews" xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
d:DataContext="{d:DesignInstance local:CrackResultViewModel}" d:DataContext="{d:DesignInstance local:CrackResultViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"> Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews" xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
d:DataContext="{d:DesignInstance local:TupleCrackResultViewModel}" d:DataContext="{d:DesignInstance local:TupleCrackResultViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="{Binding WindowTitle}" Height="450" Width="900" MinHeight="300" MinWidth="500" MaxHeight="1000" MaxWidth="1400" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"> Title="{Binding WindowTitle}" Height="450" Width="900" MinHeight="300" MinWidth="500" MaxHeight="1000" MaxWidth="1400" WindowStartupLocation="CenterScreen">
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@@ -21,7 +21,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ValuePointsInterpolateViewModel viewModel; private ValuePointsInterpolateViewModel viewModel;
private IResult result; private IResult result;
private ValuePointsInterpolationInputData inputData; private ValuePointsInterpolationInputData inputData;
public ForcesTupleResult SelectedResult { get; set; } public IForcesTupleResult SelectedResult { get; set; }
public IEnumerable<INdmPrimitive> NdmPrimitives { get; set; } public IEnumerable<INdmPrimitive> NdmPrimitives { get; set; }
public ForceCalculator ForceCalculator { get; set; } public ForceCalculator ForceCalculator { get; set; }

View File

@@ -4,39 +4,109 @@
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.CalculationWindows.CalculatorsViews.ForceCalculatorViews" xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}" d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Calculation Results" Height="350" Width="850" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen" ShowInTaskbar="False"> Title="Calculation Results" Height="450" Width="850" MinHeight="400" MinWidth="650" WindowStartupLocation="CenterScreen">
<DockPanel> <DockPanel>
<ToolBarTray DockPanel.Dock="Top"> <ToolBarTray DockPanel.Dock="Top">
<ToolBar> <ToolBar Name="CrackResult">
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking"> <Button Style="{StaticResource ToolButton}" Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/> <Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
</Button> </Button>
<Button Style="{StaticResource ToolButton}" Command="{Binding InterpolateCommand}" ToolTip="Show result step by step"> </ToolBar>
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png"/> <ToolBar Name="InterpolatedResultToolBar">
<Button Style="{DynamicResource ToolButton}" Command="{Binding InterpolateCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show result step by step"
IconContent="{StaticResource StepSolution}"
DescriptionText="Show result step by step for selected load combination"/>
</Button.ToolTip>
<ContentControl ContentTemplate="{DynamicResource StepSolution}"/>
</Button> </Button>
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature"> <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowGraphsCommand}">
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/> <Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show moment-curvature diagram"
IconContent="{StaticResource MomentCurvatureDiagram}"
DescriptionText="Show moment-curvature diagram as result of stepped solution"/>
</Button.ToolTip>
<ContentControl ContentTemplate="{DynamicResource MomentCurvatureDiagram}"/>
</Button> </Button>
<Button Style="{StaticResource ToolButton}" Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points"> <Button Style="{DynamicResource ToolButton}" Command="{Binding GraphValuePointsCommand}">
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/> <Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show diagram by value points"
IconContent="{StaticResource ValuePointDiagram}"
DescriptionText="Show results for value point as result of stepped solution"/>
</Button.ToolTip>
<ContentControl ContentTemplate="{DynamicResource ValuePointDiagram}"/>
</Button> </Button>
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram"> </ToolBar>
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/> <ToolBar Name="InteractionDiagramToolBar">
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowInteractionDiagramCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show interaction diagram"
IconContent="{StaticResource InteractionDiagram}"
DescriptionText="Show interaction diagram, which means line of limit bearing capacity"/>
</Button.ToolTip>
<ContentControl ContentTemplate="{DynamicResource InteractionDiagram}"/>
</Button> </Button>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}" ToolTip="Show isofield results"> </ToolBar>
<ToolBar Name="IsoFieldToolBar">
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show isofield results"
IconContent="{StaticResource IsoFieldResult}"
DescriptionText="Show graphical results with color as function of result value"/>
</Button.ToolTip>
<Viewbox> <Viewbox>
<ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/> <ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
</Viewbox> </Viewbox>
</Button> </Button>
</ToolBar> </ToolBar>
<ToolBar>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowGeometryResultCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show Geometry Properties"
IconContent="{DynamicResource GeometryTable}"
DescriptionText="Show table of geometry properties of cross-section for selected load combination"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource GeometryTable}"/>
</Viewbox>
</Button>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowForceResultCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Show Force Properties"
IconContent="{StaticResource ForceTable}"
DescriptionText="Show table of force geometry properties of cross-section - values of forces, moments and their eccentricities"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource ForceTable}"/>
</Viewbox>
</Button>
</ToolBar>
<ToolBar>
<Button Style="{DynamicResource ToolButton}" Command="{Binding ExportToCSVCommand}">
<Button.ToolTip>
<uc:ButtonToolTipEh HeaderText="Export to *.csv"
IconContent="{StaticResource ExportToXLS}"
DescriptionText="Export all valid results to *.csv file"/>
</Button.ToolTip>
<Viewbox>
<ContentControl ContentTemplate="{DynamicResource ExportToXLS}"/>
</Viewbox>
</Button>
</ToolBar>
</ToolBarTray> </ToolBarTray>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition Width="90"/> <ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="22"/>
</Grid.RowDefinitions>
<DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding ForcesResults.ForcesResultList}" SelectedItem="{Binding SelectedResult}" > <DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding ForcesResults.ForcesResultList}" SelectedItem="{Binding SelectedResult}" >
<DataGrid.RowStyle> <DataGrid.RowStyle>
<Style TargetType="DataGridRow"> <Style TargetType="DataGridRow">
@@ -64,11 +134,29 @@
</DataGrid> </DataGrid>
<StackPanel Grid.Column="1"> <StackPanel Grid.Column="1">
<Button Margin="3" Content="CrcDiagrams" ToolTip="Show diagrams for cracked section" Command="{Binding ShowCrackGraphsCommand}"/> <Button Margin="3" Content="CrcDiagrams" ToolTip="Show diagrams for cracked section" Command="{Binding ShowCrackGraphsCommand}"/>
<Button Margin="3" Content="Export" ToolTip="Export results to *.csv" Command="{Binding ExportToCSVCommand}"/>
<Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/> <Button Margin="3" Content="Set Prestrain" ToolTip="Set strains as auto prestrain" Command="{Binding SetPrestrainCommand}"/>
<Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/> <Button Margin="3" Content="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
</StackPanel> </StackPanel>
<StatusBar Grid.Row="1">
<StatusBarItem>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Valid result: "/>
<TextBlock Text="{Binding ValidResultCount}"/>
</StackPanel>
</StatusBarItem>
<StatusBarItem>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Invalid result: "/>
<TextBlock Text="{Binding InvalidResultCount}"/>
</StackPanel>
</StatusBarItem>
<StatusBarItem>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Total: "/>
<TextBlock Text="{Binding TotalResultCount}"/>
</StackPanel>
</StatusBarItem>
</StatusBar>
</Grid> </Grid>
</DockPanel> </DockPanel>

View File

@@ -52,7 +52,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames; public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
public ForcesTupleResult SelectedResult { get; set; } public IForcesTupleResult? SelectedResult { get; set; }
private ICommand? showIsoFieldCommand; private ICommand? showIsoFieldCommand;
private ICommand? exportToCSVCommand; private ICommand? exportToCSVCommand;
private ICommand? interpolateCommand; private ICommand? interpolateCommand;
@@ -65,6 +65,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
private ICommand? showCrackWidthResult; private ICommand? showCrackWidthResult;
private ICommand? showInteractionDiagramCommand; private ICommand? showInteractionDiagramCommand;
private ICommand? graphValuepointsCommand; private ICommand? graphValuepointsCommand;
private ICommand showForceResultCommand;
public int ValidResultCount => forcesResults.ForcesResultList.Count(x => x.IsValid == true);
public int InvalidResultCount => forcesResults.ForcesResultList.Count(x => x.IsValid == false);
public int TotalResultCount => forcesResults.ForcesResultList.Count;
public IForcesResults ForcesResults public IForcesResults ForcesResults
{ {
@@ -176,7 +181,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
}; };
showProgressLogic.Show(); showProgressLogic.Show();
} }
}, o => SelectedResult != null); }, o => SelectedResult is not null);
} }
public ICommand ShowCrackGraphsCommand public ICommand ShowCrackGraphsCommand
{ {
@@ -206,8 +211,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
}; };
showProgressLogic.Show(); showProgressLogic.Show();
} }
}, o => SelectedResult != null && SelectedResult.IsValid }, o => SelectedResult != null && SelectedResult.IsValid);
);
} }
public ICommand ShowCrackResultCommand public ICommand ShowCrackResultCommand
{ {
@@ -225,22 +229,6 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
showCrackResultLogic.Show(SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple); showCrackResultLogic.Show(SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple);
} }
//public ICommand ShowCrackWidthResultCommand
//{
// get => showCrackWidthResult ??= new RelayCommand(o =>
// {
// SafetyProcessor.RunSafeProcess(ShowCrackWidthResult);
// }, o => SelectedResult != null && SelectedResult.IsValid);
//}
//private void ShowCrackWidthResult()
//{
// showCrackWidthLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
// showCrackWidthLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
// showCrackWidthLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple;
// showCrackWidthLogic.ndmPrimitives = ndmPrimitives.ToList();
// showCrackWidthLogic.Show();
//}
public ICommand InterpolateCommand public ICommand InterpolateCommand
{ {
get get
@@ -262,8 +250,10 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result); var interpolationLogic = new InterpolationProgressLogic(forceCalculator, interploateTuplesViewModel.ForceInterpolationViewModel.Result);
progressLogic = interpolationLogic; progressLogic = interpolationLogic;
showProgressLogic = new(interpolationLogic); showProgressLogic = new(interpolationLogic)
showProgressLogic.ShowResult = ShowInterpolationProgressDialog; {
ShowResult = ShowInterpolationProgressDialog
};
showProgressLogic.Show(); showProgressLogic.Show();
} }
@@ -275,7 +265,8 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
(graphValuepointsCommand = new RelayCommand(o => (graphValuepointsCommand = new RelayCommand(o =>
{ {
InterpolateValuePoints(); InterpolateValuePoints();
}, o => SelectedResult != null)); },
o => SelectedResult != null));
} }
} }
@@ -386,7 +377,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
try try
{ {
var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix; var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var textParametrsLogic = new TextParametersLogic(ndms, strainMatrix); var textParametrsLogic = new GeometryParametersLogic(ndms, strainMatrix);
var calculator = new GeometryCalculator(textParametrsLogic); var calculator = new GeometryCalculator(textParametrsLogic);
calculator.Run(); calculator.Run();
var result = calculator.Result as IGeometryResult; var result = calculator.Result as IGeometryResult;
@@ -404,6 +395,36 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
} }
} }
} }
public ICommand ShowForceResultCommand =>
showForceResultCommand ??= new RelayCommand(o =>
showForceResult(), o => SelectedResult != null && SelectedResult.IsValid);
private void showForceResult()
{
if (SelectPrimitives() == true)
{
try
{
var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var textParametrsLogic = new ForcesParametersLogic(ndms, strainMatrix);
var calculator = new GeometryCalculator(textParametrsLogic);
calculator.Run();
var result = calculator.Result as IGeometryResult;
var wnd = new GeometryCalculatorResultView(result);
wnd.ShowDialog();
}
catch (Exception ex)
{
var vm = new ErrorProcessor()
{
ShortText = "Errors apearred during showing isofield, see detailed information",
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
}
}
}
public ForcesResultsViewModel(ForceCalculator forceCalculator) public ForcesResultsViewModel(ForceCalculator forceCalculator)
{ {
this.forceCalculator = forceCalculator; this.forceCalculator = forceCalculator;

View File

@@ -4,6 +4,7 @@
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"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:AnalysesManagerViewModel}" d:DataContext="{d:DesignInstance local:AnalysesManagerViewModel}"
Title="Analyses Manager" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen"> Title="Analyses Manager" Height="450" Width="800" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
@@ -42,23 +43,9 @@
<ToolBar ToolTip="Cross-sections"> <ToolBar ToolTip="Cross-sections">
<Button Style="{DynamicResource ToolButton}" Command="{Binding AnalysesLogic.AddAnalysisCommand}"> <Button Style="{DynamicResource ToolButton}" Command="{Binding AnalysesLogic.AddAnalysisCommand}">
<Button.ToolTip> <Button.ToolTip>
<Grid> <uc:ButtonToolTipEh HeaderText="NDM Cross-Section Analysis"
<Grid.RowDefinitions> IconContent="{StaticResource NdmCrossSection}"
<RowDefinition Height="30"/> DescriptionText="Extended analysis of cross-section of bar elements for strength, strain and cracks"/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<TextBlock Text="NDM Cross-Section Analysis" FontWeight="Bold" Background="LightGray"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>
<Viewbox Width="64" Height="64" Stretch="Fill">
<ContentControl ContentTemplate="{DynamicResource NdmCrossSection}"/>
</Viewbox>
<TextBlock Grid.Column="1" Margin="3" TextWrapping="Wrap" Text="Extended analysis of cross-section of bar elements for strength, strain and cracks" FontStyle="Italic"/>
</Grid>
</Grid>
</Button.ToolTip> </Button.ToolTip>
<Viewbox> <Viewbox>
<ContentControl ContentTemplate="{DynamicResource NdmCrossSection}"/> <ContentControl ContentTemplate="{DynamicResource NdmCrossSection}"/>

View File

@@ -0,0 +1,33 @@
<UserControl x:Class="StructureHelper.Windows.UserControls.ButtonToolTipEh"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="250">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="120"/>
</Grid.RowDefinitions>
<!-- Bind HeaderText property -->
<TextBlock Text="{Binding HeaderText, RelativeSource={RelativeSource AncestorType=UserControl}}"
FontWeight="Bold" Background="LightGray"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>
<!-- Bind IconContent property -->
<Viewbox Width="64" Height="64" Stretch="Fill">
<ContentControl ContentTemplate="{Binding IconContent, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
</Viewbox>
<!-- Bind DescriptionText property -->
<TextBlock Grid.Column="1" Margin="3"
TextWrapping="Wrap"
Text="{Binding DescriptionText, RelativeSource={RelativeSource AncestorType=UserControl}}"
FontStyle="Italic"/>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,71 @@
using System.Windows;
using System.Windows.Controls;
namespace StructureHelper.Windows.UserControls
{
/// <summary>
/// Interaction logic for ButtonToolTipEh.xaml
/// </summary>
public partial class ButtonToolTipEh : UserControl
{
// Dependency property for HeaderText
public static readonly DependencyProperty HeaderTextProperty =
DependencyProperty.Register(
nameof(HeaderText),
typeof(string),
typeof(ButtonToolTipEh),
new PropertyMetadata("Default Header"));
public string HeaderText
{
get => (string)GetValue(HeaderTextProperty);
set => SetValue(HeaderTextProperty, value);
}
// Dependency property for DescriptionText
public static readonly DependencyProperty DescriptionTextProperty =
DependencyProperty.Register(
nameof(DescriptionText),
typeof(string),
typeof(ButtonToolTipEh),
new PropertyMetadata("Default description text"));
public string DescriptionText
{
get => (string)GetValue(DescriptionTextProperty);
set => SetValue(DescriptionTextProperty, value);
}
// Dependency property for IconContent
public static readonly DependencyProperty IconContentProperty =
DependencyProperty.Register(
nameof(IconContent),
typeof(object),
typeof(ButtonToolTipEh),
new PropertyMetadata(null));
public object IconContent
{
get => GetValue(IconContentProperty);
set => SetValue(IconContentProperty, value);
}
// Dependency property for IconTemplate
public static readonly DependencyProperty IconTemplateProperty =
DependencyProperty.Register(
nameof(IconTemplate),
typeof(DataTemplate),
typeof(ButtonToolTipEh),
new PropertyMetadata(null));
public DataTemplate IconTemplate
{
get => (DataTemplate)GetValue(IconTemplateProperty);
set => SetValue(IconTemplateProperty, value);
}
public ButtonToolTipEh()
{
InitializeComponent();
}
}
}

View File

@@ -30,7 +30,7 @@ namespace StructureHelperCommon.Models.Forces
public DesignForcePair() : this(Guid.NewGuid()) {} public DesignForcePair() : this(Guid.NewGuid()) {}
public IForceCombinationList GetCombinations() public IForceCombinationList GetCombination()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -41,5 +41,10 @@ namespace StructureHelperCommon.Models.Forces
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;
} }
public List<IForceCombinationList> GetCombinations()
{
throw new NotImplementedException();
}
} }
} }

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceColumnProperty : IForceColumnProperty
{
public Guid Id { get; private set; }
public string ColumnName { get; set; } = string.Empty;
public int ColumnIndex { get; set; } = 0;
public double ColumnFactor { get; set; } = 1d;
public ForceColumnProperty(Guid id, string columnName)
{
Id = id;
ColumnName = columnName;
}
public ForceColumnProperty(string columnName) : this(Guid.NewGuid(), columnName)
{
}
}
}

View File

@@ -14,52 +14,83 @@ namespace StructureHelperCommon.Models.Forces
public class ForceCombinationByFactor : IForceCombinationByFactor public class ForceCombinationByFactor : IForceCombinationByFactor
{ {
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy(); readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
private ForceCombinationList result;
private List<LimitStates> limitStates;
private List<CalcTerms> calcTerms;
/// <inheritdoc/> /// <inheritdoc/>
public Guid Id { get; } public Guid Id { get; }
/// <inheritdoc/> /// <inheritdoc/>
public string Name { get; set; } public string Name { get; set; } = "New Factored Load";
public bool SetInGravityCenter { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
public IPoint2D ForcePoint { get; set; } public LimitStates LimitState { get; set; } = LimitStates.SLS; //By default create characteristic value of forces
/// <inheritdoc/> /// <inheritdoc/>
public IForceTuple FullSLSForces { get; set; } public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; //By defult use full value of load
public bool SetInGravityCenter { get; set; } = true;
/// <inheritdoc/> /// <inheritdoc/>
public double ULSFactor { get; set; } public IPoint2D ForcePoint { get; set; } = new Point2D();
/// <inheritdoc/> /// <inheritdoc/>
public double LongTermFactor { get; set; } public IForceTuple FullSLSForces { get; set; } = new ForceTuple();
/// <inheritdoc/>
public double ULSFactor { get; set; } = 1.2d;
/// <inheritdoc/>
public double LongTermFactor { get; set; } = 1d;
public ForceCombinationByFactor(Guid id) public ForceCombinationByFactor(Guid id)
{ {
Id = id; Id = id;
Name = "New Factored Load";
SetInGravityCenter = true;
ForcePoint = new Point2D();
FullSLSForces = new ForceTuple();
LongTermFactor = 1d;
ULSFactor = 1.2d;
} }
public ForceCombinationByFactor() : this (Guid.NewGuid()) { } public ForceCombinationByFactor() : this (Guid.NewGuid()) { }
public IForceCombinationList GetCombinations() public IForceCombinationList GetCombination()
{
GetNewResult();
ProcessResult();
return result;
}
private void ProcessResult()
{ {
var result = new ForceCombinationList();
result.SetInGravityCenter = this.SetInGravityCenter;
result.ForcePoint = this.ForcePoint;
result.DesignForces.Clear();
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
foreach (var limitState in limitStates) foreach (var limitState in limitStates)
{ {
var stateFactor = limitState is LimitStates.SLS ? 1d : ULSFactor; ProcessLimitState(limitState);
foreach (var calcTerm in calcTerms)
{
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
var designForceTuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor) as ForceTuple;
result.DesignForces.Add(designForceTuple);
}
} }
return result; }
private void ProcessLimitState(LimitStates limitState)
{
var stateFactor = limitState is LimitStates.SLS ? 1d : ULSFactor;
foreach (var calcTerm in calcTerms)
{
ProcessCalcTerm(limitState, stateFactor, calcTerm);
}
}
private void ProcessCalcTerm(LimitStates limitState, double stateFactor, CalcTerms calcTerm)
{
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
var designForceTuple = new DesignForceTuple()
{
LimitState = limitState,
CalcTerm = calcTerm
};
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor) as ForceTuple;
result.DesignForces.Add(designForceTuple);
}
private void GetNewResult()
{
result = new ForceCombinationList();
result.SetInGravityCenter = SetInGravityCenter;
result.ForcePoint = ForcePoint;
result.DesignForces.Clear();
limitStates = new List<LimitStates>()
{
LimitStates.ULS, LimitStates.SLS
};
calcTerms = new List<CalcTerms>()
{
CalcTerms.ShortTerm, CalcTerms.LongTerm
};
} }
public object Clone() public object Clone()
@@ -68,5 +99,14 @@ namespace StructureHelperCommon.Models.Forces
updateStrategy.Update(newItem, this); updateStrategy.Update(newItem, this);
return newItem; return newItem;
} }
public List<IForceCombinationList> GetCombinations()
{
var listResult = new List<IForceCombinationList>
{
GetCombination()
};
return listResult;
}
} }
} }

View File

@@ -0,0 +1,34 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
internal class ForceCombinationFromFile : IForceCombinationFromFile
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public List<IForceFileProperty> ForceFiles { get; set; } = new();
public bool SetInGravityCenter { get; set; } = true;
public IPoint2D ForcePoint { get; set; } = new Point2D();
public object Clone()
{
throw new NotImplementedException();
}
public IForceCombinationList GetCombination()
{
throw new NotImplementedException();
}
public List<IForceCombinationList> GetCombinations()
{
throw new NotImplementedException();
}
}
}

View File

@@ -63,7 +63,7 @@ namespace StructureHelperCommon.Models.Forces
return newItem; return newItem;
} }
/// <inheritdoc/> /// <inheritdoc/>
public IForceCombinationList GetCombinations() public IForceCombinationList GetCombination()
{ {
var result = Clone() as IForceCombinationList; var result = Clone() as IForceCombinationList;
result.DesignForces.Clear(); result.DesignForces.Clear();
@@ -84,5 +84,14 @@ namespace StructureHelperCommon.Models.Forces
} }
return result; return result;
} }
public List<IForceCombinationList> GetCombinations()
{
var listResult = new List<IForceCombinationList>
{
GetCombination()
};
return listResult;
}
} }
} }

View File

@@ -0,0 +1,32 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceFileProperty : IForceFileProperty
{
public Guid Id { get; private set; }
public LimitStates LimitState { get; set; } = LimitStates.ULS;
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
public string FilePath { get; set; } = string.Empty;
public int SkipRowBeforeHeaderCount { get; set; } = 2;
public int SkipRowHeaderCount { get; set; } = 1;
public double GlobalFactor { get; set; } = 1d;
public IForceColumnProperty Mx { get; set; } = new ForceColumnProperty("N");
public IForceColumnProperty My { get; set; } = new ForceColumnProperty("My");
public IForceColumnProperty Nz { get; set; } = new ForceColumnProperty("Mz");
public ForceFileProperty(Guid id)
{
Id = id;
}
public ForceFileProperty() : this (Guid.NewGuid())
{
}
}
}

View File

@@ -24,6 +24,8 @@ namespace StructureHelperCommon.Models.Forces
/// Return combination of forces /// Return combination of forces
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
IForceCombinationList GetCombinations(); IForceCombinationList GetCombination();
List<IForceCombinationList> GetCombinations();
} }
} }

View File

@@ -0,0 +1,28 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Settingth for column reading from MSExcel file
/// </summary>
public interface IForceColumnProperty : ISaveable
{
/// <summary>
/// Name of column for searching
/// </summary>
string ColumnName { get; set; }
/// <summary>
/// Column index
/// </summary>
int ColumnIndex { get; set; }
/// <summary>
/// Factor for obtaining value from column
/// </summary>
double ColumnFactor { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Shapes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -9,6 +10,8 @@ namespace StructureHelperCommon.Models.Forces
{ {
public interface IForceCombinationByFactor : IForceAction public interface IForceCombinationByFactor : IForceAction
{ {
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
IForceTuple FullSLSForces { get; set; } IForceTuple FullSLSForces { get; set; }
double ULSFactor { get; set; } double ULSFactor { get; set; }
double LongTermFactor { get; set; } double LongTermFactor { get; set; }

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
internal interface IForceCombinationFromFile : IForceAction
{
List<IForceFileProperty> ForceFiles { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Settings for extracting force combination from MSExcel file
/// </summary>
public interface IForceFileProperty : ISaveable
{
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
string FilePath { get; set; }
int SkipRowBeforeHeaderCount { get; set; }
int SkipRowHeaderCount { get; set; }
double GlobalFactor { get; set; }
IForceColumnProperty Mx { get; set; }
IForceColumnProperty My { get; set; }
IForceColumnProperty Nz { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy<IForceColumnProperty>
{
public void Update(IForceColumnProperty targetObject, IForceColumnProperty sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.ColumnName = sourceObject.ColumnName;
targetObject.ColumnIndex = sourceObject.ColumnIndex;
targetObject.ColumnFactor = sourceObject.ColumnFactor;
}
}
}

View File

@@ -0,0 +1,42 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceCombinationFromFileUpdateStrategy : IUpdateStrategy<IForceCombinationFromFile>
{
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
private IUpdateStrategy<IForceFileProperty> fileUpdateStrategy;
public ForceCombinationFromFileUpdateStrategy(IUpdateStrategy<IForceAction> baseUpdateStrategy, IUpdateStrategy<IForceFileProperty> fileUpdateStrategy)
{
this.baseUpdateStrategy = baseUpdateStrategy;
this.fileUpdateStrategy = fileUpdateStrategy;
}
public ForceCombinationFromFileUpdateStrategy() : this (
new ForceActionUpdateStrategy(),
new ForceFilePropertyUpdateStrategy())
{
}
void IUpdateStrategy<IForceCombinationFromFile>.Update(IForceCombinationFromFile targetObject, IForceCombinationFromFile sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
baseUpdateStrategy.Update(targetObject, sourceObject);
targetObject.ForceFiles.Clear();
foreach (var file in sourceObject.ForceFiles)
{
throw new NotImplementedException();
}
}
}
}

View File

@@ -0,0 +1,41 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceFilePropertyUpdateStrategy : IUpdateStrategy<IForceFileProperty>
{
private IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy;
public ForceFilePropertyUpdateStrategy(IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy)
{
this.columnUpdateStrategy = columnUpdateStrategy;
}
public ForceFilePropertyUpdateStrategy() : this (new ForceColumnPropertyUpdateStrategy())
{
}
public void Update(IForceFileProperty targetObject, IForceFileProperty sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.LimitState = sourceObject.LimitState;
targetObject.CalcTerm = sourceObject.CalcTerm;
targetObject.FilePath = sourceObject.FilePath;
targetObject.GlobalFactor = sourceObject.GlobalFactor;
targetObject.SkipRowBeforeHeaderCount = sourceObject.SkipRowBeforeHeaderCount;
targetObject.SkipRowHeaderCount = sourceObject.SkipRowHeaderCount;
columnUpdateStrategy.Update(targetObject.Mx, sourceObject.Mx);
columnUpdateStrategy.Update(targetObject.My, sourceObject.My);
columnUpdateStrategy.Update(targetObject.Nz, sourceObject.Nz);
}
}
}

View File

@@ -22,7 +22,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public List<INdmPrimitive> Primitives { get; private set; } = new(); public List<INdmPrimitive> Primitives { get; private set; } = new();
public ICompressedMember CompressedMember { get; set; } = new CompressedMember() { Buckling = false}; public ICompressedMember CompressedMember { get; set; } = new CompressedMember() { Buckling = false};
public IAccuracy Accuracy { get; set; } = new Accuracy() {IterationAccuracy = 0.001d, MaxIterationCount = 1000}; public IAccuracy Accuracy { get; set; } = new Accuracy() {IterationAccuracy = 0.001d, MaxIterationCount = 1000};
public List<IForceCombinationList> ForceCombinationLists { get; set; } //public List<IForceCombinationList> ForceCombinationLists { get; set; }
public ForceCalculatorInputData(Guid id) public ForceCalculatorInputData(Guid id)
{ {

View File

@@ -12,12 +12,15 @@ using StructureHelperLogics.Services.NdmPrimitives;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
/// <inheritdoc/>
public class ForceCalculatorLogic : IForceCalculatorLogic public class ForceCalculatorLogic : IForceCalculatorLogic
{ {
private ForcesResults result; private ForcesResults result;
private IProcessorLogic<IForceTuple> eccentricityLogic; private IProcessorLogic<IForceTuple> eccentricityLogic;
private ForceTupleBucklingLogic bucklingLogic; private ForceTupleBucklingLogic bucklingLogic;
private ITriangulatePrimitiveLogic triangulateLogic; private ITriangulatePrimitiveLogic triangulateLogic;
private List<IForceCombinationList> combinationLists;
public IForceCalculatorInputData InputData { get; set; } public IForceCalculatorInputData InputData { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; } public IShiftTraceLogger? TraceLogger { get; set; }
public Action<IResult> ActionToOutputResults { get; set; } public Action<IResult> ActionToOutputResults { get; set; }
@@ -37,7 +40,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
IsValid = true IsValid = true
}; };
foreach (var combination in InputData.ForceCombinationLists) foreach (var combination in combinationLists)
{ {
foreach (var tuple in combination.DesignForces) foreach (var tuple in combination.DesignForces)
{ {
@@ -176,10 +179,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private void GetCombinations() private void GetCombinations()
{ {
InputData.ForceCombinationLists = new List<IForceCombinationList>(); combinationLists = new List<IForceCombinationList>();
foreach (var item in InputData.ForceActions) foreach (var item in InputData.ForceActions)
{ {
InputData.ForceCombinationLists.Add(item.GetCombinations()); combinationLists.AddRange(item.GetCombinations());
} }
} }

View File

@@ -14,9 +14,9 @@ using StructureHelperLogics.Services;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
/// <inheritdoc/>
public class ForceTupleCalculator : IForceTupleCalculator public class ForceTupleCalculator : IForceTupleCalculator
{ {
IForceTupleTraceResultLogic forceTupleTraceResultLogic;
IForcesTupleResult result; IForcesTupleResult result;
private ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic; private ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic;
private IForceTupleCalcLogic calcLogic; private IForceTupleCalcLogic calcLogic;

View File

@@ -7,12 +7,26 @@ using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
/// <summary>
/// Input data fo roce tuple calculator
/// </summary>
public interface IForceCalculatorInputData : IInputData, ISaveable, IHasPrimitives, IHasForceActions public interface IForceCalculatorInputData : IInputData, ISaveable, IHasPrimitives, IHasForceActions
{ {
/// <summary>
/// Accuracy of calculating
/// </summary>
IAccuracy Accuracy { get; set; } IAccuracy Accuracy { get; set; }
List<CalcTerms> CalcTermsList { get; } /// <summary>
ICompressedMember CompressedMember { get; set; } /// List of limit states, available for calculating
List<IForceCombinationList> ForceCombinationLists { get; set; } /// </summary>
List<LimitStates> LimitStatesList { get; } List<LimitStates> LimitStatesList { get; }
/// <summary>
/// List of type of duration, available for calculation
/// </summary>
List<CalcTerms> CalcTermsList { get; }
/// <summary>
/// Settings for calculating of stability fo compressed members
/// </summary>
ICompressedMember CompressedMember { get; set; }
} }
} }

View File

@@ -8,6 +8,9 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
/// <summary>
/// Logic for processing of calculation for ForceTuplaCalculator
/// </summary>
public interface IForceCalculatorLogic : ILogic, IHasActionByResult public interface IForceCalculatorLogic : ILogic, IHasActionByResult
{ {
IForceCalculatorInputData InputData { get; set; } IForceCalculatorInputData InputData { get; set; }

View File

@@ -7,8 +7,14 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
/// <summary>
/// Calculator for obtaining solution from loader calculator
/// </summary>
public interface IForceTupleCalculator : ICalculator, IHasActionByResult public interface IForceTupleCalculator : ICalculator, IHasActionByResult
{ {
/// <summary>
/// Input data for analysis
/// </summary>
IForceTupleInputData InputData {get;set;} IForceTupleInputData InputData {get;set;}
} }
} }

View File

@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public interface IForceTupleInputData : IInputData public interface IForceTupleInputData : IInputData
{ {
/// <summary> /// <summary>
/// Collection of ndma-parts for calculation /// Collection of ndm-parts for calculation
/// </summary> /// </summary>
IEnumerable<INdm> NdmCollection { get; set; } IEnumerable<INdm> NdmCollection { get; set; }
/// <summary> /// <summary>

View File

@@ -8,7 +8,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
{ {
public class GeometryCalculator : IGeometryCalculator public class GeometryCalculator : IGeometryCalculator
{ {
TextParametersLogic parametersLogic; IParametersLogic parametersLogic;
IGeometryResult geometryResult; IGeometryResult geometryResult;
public string Name { get; set; } public string Name { get; set; }
@@ -19,12 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Geometry
public Guid Id => throw new NotImplementedException(); public Guid Id => throw new NotImplementedException();
public GeometryCalculator(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix) public GeometryCalculator(IParametersLogic parametersLogic)
{
parametersLogic = new TextParametersLogic(ndms, strainMatrix);
}
public GeometryCalculator(TextParametersLogic parametersLogic)
{ {
this.parametersLogic = parametersLogic; this.parametersLogic = parametersLogic;
} }

View File

@@ -14,6 +14,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
namespace StructureHelperLogics.NdmCalculations.Cracking namespace StructureHelperLogics.NdmCalculations.Cracking
{ {
public class GetTupleInputDatasLogic : IGetTupleInputDatasLogic public class GetTupleInputDatasLogic : IGetTupleInputDatasLogic
{ {
public List<IForceAction> ForceActions { get; set; } public List<IForceAction> ForceActions { get; set; }
@@ -24,7 +25,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
public CalcTerms ShortTerm { get; set; } public CalcTerms ShortTerm { get; set; }
public IUserCrackInputData UserCrackInputData { get; set; } public IUserCrackInputData UserCrackInputData { get; set; }
public GetTupleInputDatasLogic(List<INdmPrimitive> primitives, List<IForceAction> forceActions, IUserCrackInputData userCrackInputData) public GetTupleInputDatasLogic(List<INdmPrimitive> primitives,
List<IForceAction> forceActions,
IUserCrackInputData userCrackInputData)
{ {
Primitives = primitives; Primitives = primitives;
ForceActions = forceActions; ForceActions = forceActions;
@@ -39,31 +42,42 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
CheckInputData(); CheckInputData();
foreach (var action in ForceActions) foreach (var action in ForceActions)
{ {
var tuple = GetTuplesByActions(action); var tuples = GetCrackTupleByActions(action);
if (tuple.isValid == false) foreach (var tuple in tuples)
{ {
resultList.Add(new TupleCrackInputData() var tupleCrackInputDatas = GetTupleCrackInputDatas(action, tuple);
{ resultList.AddRange(tupleCrackInputDatas);
IsValid = false,
});
}
else
{
resultList.Add(new TupleCrackInputData()
{
IsValid = true,
TupleName = action.Name,
LongTermTuple = tuple.LongTuple,
ShortTermTuple = tuple.ShortTuple,
Primitives = Primitives,
UserCrackInputData = UserCrackInputData
});
} }
} }
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone); TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
return resultList; return resultList;
} }
private List<TupleCrackInputData> GetTupleCrackInputDatas(IForceAction action, CrackTuple tuple)
{
List<TupleCrackInputData> resultList = new();
if (tuple.IsValid == false)
{
resultList.Add(new TupleCrackInputData()
{
IsValid = false,
});
}
else
{
resultList.Add(new TupleCrackInputData()
{
IsValid = true,
TupleName = action.Name,
LongTermTuple = tuple.LongTuple,
ShortTermTuple = tuple.ShortTuple,
Primitives = Primitives,
UserCrackInputData = UserCrackInputData
});
}
return resultList;
}
private void CheckInputData() private void CheckInputData()
{ {
if (ForceActions is null) if (ForceActions is null)
@@ -73,25 +87,47 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
} }
} }
private (bool isValid, IForceTuple? LongTuple, IForceTuple? ShortTuple) GetTuplesByActions(IForceAction action) private List<CrackTuple> GetCrackTupleByActions(IForceAction action)
{
var combinations = action.GetCombinations();
List<CrackTuple> crackTuples = new();
foreach (var item in combinations)
{
var crackTuple = GetCrackTupleByCombination(item.DesignForces);
crackTuples.Add(crackTuple);
}
return crackTuples;
}
private CrackTuple GetCrackTupleByCombination(List<IDesignForceTuple> combination)
{ {
IForceTuple longTuple, shortTuple; IForceTuple longTuple, shortTuple;
var combinations = action.GetCombinations().DesignForces;
try try
{ {
longTuple = GetTupleByCombination(combinations, LimitState, LongTerm); longTuple = GetTupleByCombination(combination, LimitState, LongTerm);
TraceLogger?.AddMessage("Long term force combination"); TraceLogger?.AddMessage("Long term force combination");
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(longTuple)); TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(longTuple));
shortTuple = GetTupleByCombination(combinations, LimitState, ShortTerm); shortTuple = GetTupleByCombination(combination, LimitState, ShortTerm);
TraceLogger?.AddMessage("Short term force combination"); TraceLogger?.AddMessage("Short term force combination");
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(shortTuple)); TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(shortTuple));
} }
catch (Exception ex) catch (Exception ex)
{ {
TraceLogger?.AddMessage("Force combination is not obtained: \n" + ex, TraceLogStatuses.Error); TraceLogger?.AddMessage("Force combination is not obtained: \n" + ex, TraceLogStatuses.Error);
return (false, null, null); return new CrackTuple()
{
IsValid = false
};
} }
return (true, longTuple, shortTuple);
var result = new CrackTuple()
{
IsValid = true,
LongTuple = longTuple,
ShortTuple = shortTuple
};
return result;
} }
private static IForceTuple GetTupleByCombination(List<IDesignForceTuple> combinations, LimitStates limitState, CalcTerms calcTerm) private static IForceTuple GetTupleByCombination(List<IDesignForceTuple> combinations, LimitStates limitState, CalcTerms calcTerm)
@@ -101,5 +137,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
.Single() .Single()
.ForceTuple; .ForceTuple;
} }
private class CrackTuple
{
public bool IsValid { get; set; }
public IForceTuple? LongTuple { get; set; }
public IForceTuple? ShortTuple { get; set; }
}
} }
} }

View File

@@ -5,12 +5,19 @@ using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperLogics.NdmCalculations.Cracking namespace StructureHelperLogics.NdmCalculations.Cracking
{ {
/// <summary>
/// Logic for preparing tuple data for crack calculator
/// </summary>
public interface IGetTupleInputDatasLogic : ILogic, IHasPrimitives, IHasForceActions public interface IGetTupleInputDatasLogic : ILogic, IHasPrimitives, IHasForceActions
{ {
LimitStates LimitState { get; set; } LimitStates LimitState { get; set; }
CalcTerms LongTerm { get; set; } CalcTerms LongTerm { get; set; }
CalcTerms ShortTerm { get; set; } CalcTerms ShortTerm { get; set; }
List<TupleCrackInputData> GetTupleInputDatas();
IUserCrackInputData UserCrackInputData { get; set; } IUserCrackInputData UserCrackInputData { get; set; }
/// <summary>
/// Returns collection of tuples for crack calculations
/// </summary>
/// <returns></returns>
List<TupleCrackInputData> GetTupleInputDatas();
} }
} }

View File

@@ -8,13 +8,12 @@ using StructureHelperCommon.Services.Units;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives namespace StructureHelperLogics.Services.NdmPrimitives
{ {
public class TextParametersLogic public class ForcesParametersLogic : IParametersLogic
{ {
const string prefixInitial = "Initial"; const string prefixInitial = "Initial";
const string prefixActual = "Actual"; const string prefixActual = "Actual";
@@ -27,242 +26,22 @@ namespace StructureHelperLogics.Services.NdmPrimitives
static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection(); static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
private IEnumerable<INdm> ndms; private IEnumerable<INdm> ndms;
private IStrainMatrix strainMatrix; private IStrainMatrix strainMatrix;
public ForcesParametersLogic(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
{
this.ndms = ndms;
this.strainMatrix = strainMatrix;
}
public List<IValueParameter<string>> GetTextParameters() public List<IValueParameter<string>> GetTextParameters()
{ {
var parameters = new List<IValueParameter<string>>(); var parameters = new List<IValueParameter<string>>();
parameters.AddRange(GetGravityCenter(prefixInitial, ndms));
parameters.AddRange(GetSimpleArea(ndms));
parameters.AddRange(GetArea(prefixInitial, ndms));
parameters.AddRange(GetMomentOfInertia(prefixInitial, ndms));
parameters.AddRange(GetGravityCenter(prefixActual, ndms, strainMatrix));
parameters.AddRange(GetArea(prefixActual, ndms, strainMatrix));
parameters.AddRange(GetMomentOfInertia(prefixActual, ndms, strainMatrix));
parameters.AddRange(GetAreaRatio(ndms, strainMatrix));
parameters.AddRange(GetMomentOfInertiaRatio(ndms, strainMatrix));
parameters.AddRange(GetSummaryForces(ndms, strainMatrix)); parameters.AddRange(GetSummaryForces(ndms, strainMatrix));
parameters.AddRange(GetSummaryMoments(ndms, strainMatrix)); parameters.AddRange(GetSummaryMoments(ndms, strainMatrix));
parameters.AddRange(GetForcesDistance(ndms, strainMatrix)); parameters.AddRange(GetForcesDistance(ndms, strainMatrix));
parameters.AddRange(GetLiverArms(ndms, strainMatrix)); parameters.AddRange(GetLiverArms(ndms, strainMatrix));
return parameters; return parameters;
} }
private IEnumerable<IValueParameter<string>> GetSimpleArea(IEnumerable<INdm> ndms)
{
const string name = "Summary Area";
const string shortName = "A";
var parameters = new List<IValueParameter<string>>();
var unitArea = unitLogic.GetUnit(UnitTypes.Area, "mm2");
var unitName = $"{unitArea.Name}";
var unitMultiPlayer = unitArea.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{name}",
ShortName = $"{shortName}",
Text = unitName,
Description = $"{name} of cross-section without reduction"
};
try
{
firstParameter.Value = (ndms.Sum(x => x.Area) * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetMomentOfInertia(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Bending stiffness";
const string shortName = "EI";
var parameters = new List<IValueParameter<string>>();
var unitArea = unitLogic.GetUnit(UnitTypes.Area, "mm2");
var unitStress = unitLogic.GetUnit(UnitTypes.Stress, "MPa");
var unitName = $"{unitStress.Name} * {unitArea.Name} * {unitArea.Name}";
var unitMultiPlayer = unitArea.Multiplyer * unitArea.Multiplyer * unitStress.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} {name} {firstAxisName.ToUpper()}",
ShortName = $"{shortName}{firstAxisName}",
Text = unitName,
Description = $"{prefix} {name} of cross-section arbitrary {firstAxisName}-axis multiplied by {prefix} modulus"
};
var secondParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} {name} {secondAxisName}",
ShortName = $"{shortName}{secondAxisName}",
Text = unitName,
Description = $"{prefix} {name} of cross-section arbitrary {secondAxisName}-axis multiplied by {prefix} modulus"
};
try
{
var gravityCenter = GeometryOperations.GetReducedMomentsOfInertia(locNdms, locStrainMatrix);
firstParameter.Value = (gravityCenter.EIx * unitMultiPlayer).ToString();
secondParameter.Value = (gravityCenter.EIy * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
secondParameter.IsValid = false;
secondParameter.Value = (double.NaN).ToString();
secondParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
parameters.Add(secondParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetMomentOfInertiaRatio(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Bending stiffness";
const string shortName = "EI";
var parameters = new List<IValueParameter<string>>();
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefixActual}/{prefixInitial} {name} {firstAxisName.ToUpper()} ratio",
ShortName = $"{shortName}{firstAxisName}-ratio",
Text = "-",
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {firstAxisName}-axis ratio"
};
var secondParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefixActual}/{prefixInitial} {name} {secondAxisName} ratio",
ShortName = $"{shortName}{secondAxisName}-ratio",
Text = "-",
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {secondAxisName}-axis ratio"
};
try
{
var actualMoments = GeometryOperations.GetSofteningsFactors(locNdms, locStrainMatrix);
firstParameter.Value = actualMoments.EIxFactor.ToString();
secondParameter.Value = actualMoments.EIy.ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
secondParameter.IsValid = false;
secondParameter.Value = (double.NaN).ToString();
secondParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
parameters.Add(secondParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Longitudinal stiffness";
const string shortName = "EA";
var parameters = new List<IValueParameter<string>>();
var unitArea = unitLogic.GetUnit(UnitTypes.Area, "mm2");
var unitStress = unitLogic.GetUnit(UnitTypes.Stress, "MPa");
var unitName = $"{unitStress.Name} * {unitArea.Name}" ;
var unitMultiPlayer = unitArea.Multiplyer * unitStress.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} {name}",
ShortName = $"{shortName}",
Text = unitName,
Description = $"{prefix} {name} of cross-section multiplied by {prefix} modulus"
};
try
{
firstParameter.Value = (GeometryOperations.GetReducedArea(locNdms, locStrainMatrix) * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetAreaRatio(IEnumerable<INdm> locNdms, IStrainMatrix locStrainMatrix)
{
const string name = "Longitudinal stiffness";
const string shortName = "EA";
var parameters = new List<IValueParameter<string>>();
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefixActual}/{prefixInitial} {name} ratio",
ShortName = $"{shortName}-ratio",
Text = "-",
Description = $"{prefixActual}/{prefixInitial} {name}-ratio of cross-section"
};
try
{
var actual = GeometryOperations.GetSofteningsFactors(locNdms, locStrainMatrix);
firstParameter.Value = actual.EAFactor.ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
return parameters;
}
public TextParametersLogic(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
{
this.ndms = ndms;
this.strainMatrix = strainMatrix;
}
private IEnumerable<IValueParameter<string>> GetGravityCenter(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
var parameters = new List<IValueParameter<string>>();
var unitType = UnitTypes.Length;
var unit = unitLogic.GetUnit(unitType, "mm");
var unitName = unit.Name;
var unitMultiPlayer = unit.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} Center{firstAxisName.ToUpper()}",
ShortName = $"{firstAxisName.ToUpper()}c",
Text = unitName,
Description = $"{prefix} Displacement of center of gravity of cross-section along {firstAxisName}-axis"
};
var secondParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} Center{secondAxisName.ToUpper()}",
ShortName = $"{secondAxisName.ToUpper()}c",
Text = unitName,
Description = $"{prefix} Displacement of center of gravity of cross-section along {secondAxisName}-axis"
};
try
{
var gravityCenter = GeometryOperations.GetGravityCenter(locNdms, locStrainMatrix);
firstParameter.Value = (gravityCenter.Cx * unitMultiPlayer).ToString();
secondParameter.Value = (gravityCenter.Cy * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
secondParameter.IsValid = false;
secondParameter.Value = (double.NaN).ToString();
secondParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
parameters.Add(secondParameter);
return parameters;
}
private List<IValueParameter<string>> GetSummaryForces(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix) private List<IValueParameter<string>> GetSummaryForces(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix)
{ {
var parameters = new List<IValueParameter<string>>(); var parameters = new List<IValueParameter<string>>();
@@ -495,7 +274,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
{ {
IsValid = true, IsValid = true,
Name = $"{excentricityName} {liverArm}", Name = $"{excentricityName} {liverArm}",
ShortName = $"z,{secondAxisName.ToLower()},sum", ShortName = $"z,{secondAxisName.ToLower()}",
Text = unitName, Text = unitName,
Description = $"{excentricityName} {liverArm} along {secondAxisName.ToUpper()}-axis" Description = $"{excentricityName} {liverArm} along {secondAxisName.ToUpper()}-axis"
}; };

View File

@@ -0,0 +1,262 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics.Geometry;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
using StructureHelperCommon.Models.Parameters;
using StructureHelperCommon.Services.Units;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public class GeometryParametersLogic : IParametersLogic
{
const string prefixInitial = "Initial";
const string prefixActual = "Actual";
IConvertUnitLogic operationLogic = new ConvertUnitLogic();
IGetUnitLogic unitLogic = new GetUnitLogic();
static string firstAxisName => ProgramSetting.GeometryNames.FstAxisName;
static string secondAxisName => ProgramSetting.GeometryNames.SndAxisName;
static string thirdAxisName => ProgramSetting.GeometryNames.TrdAxisName;
static IEnumerable<IUnit> units = UnitsFactory.GetUnitCollection();
private IEnumerable<INdm> ndms;
private IStrainMatrix strainMatrix;
public List<IValueParameter<string>> GetTextParameters()
{
var parameters = new List<IValueParameter<string>>();
parameters.AddRange(GetGravityCenter(prefixInitial, ndms));
parameters.AddRange(GetSimpleArea(ndms));
parameters.AddRange(GetArea(prefixInitial, ndms));
parameters.AddRange(GetMomentOfInertia(prefixInitial, ndms));
parameters.AddRange(GetGravityCenter(prefixActual, ndms, strainMatrix));
parameters.AddRange(GetArea(prefixActual, ndms, strainMatrix));
parameters.AddRange(GetMomentOfInertia(prefixActual, ndms, strainMatrix));
parameters.AddRange(GetAreaRatio(ndms, strainMatrix));
parameters.AddRange(GetMomentOfInertiaRatio(ndms, strainMatrix));
return parameters;
}
private IEnumerable<IValueParameter<string>> GetSimpleArea(IEnumerable<INdm> ndms)
{
const string name = "Summary Area";
const string shortName = "A";
var parameters = new List<IValueParameter<string>>();
var unitArea = unitLogic.GetUnit(UnitTypes.Area, "mm2");
var unitName = $"{unitArea.Name}";
var unitMultiPlayer = unitArea.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{name}",
ShortName = $"{shortName}",
Text = unitName,
Description = $"{name} of cross-section without reduction"
};
try
{
firstParameter.Value = (ndms.Sum(x => x.Area) * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetMomentOfInertia(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Bending stiffness";
const string shortName = "EI";
var parameters = new List<IValueParameter<string>>();
var unitArea = unitLogic.GetUnit(UnitTypes.Area, "mm2");
var unitStress = unitLogic.GetUnit(UnitTypes.Stress, "MPa");
var unitName = $"{unitStress.Name} * {unitArea.Name} * {unitArea.Name}";
var unitMultiPlayer = unitArea.Multiplyer * unitArea.Multiplyer * unitStress.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} {name} {firstAxisName.ToUpper()}",
ShortName = $"{shortName}{firstAxisName}",
Text = unitName,
Description = $"{prefix} {name} of cross-section arbitrary {firstAxisName}-axis multiplied by {prefix} modulus"
};
var secondParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} {name} {secondAxisName}",
ShortName = $"{shortName}{secondAxisName}",
Text = unitName,
Description = $"{prefix} {name} of cross-section arbitrary {secondAxisName}-axis multiplied by {prefix} modulus"
};
try
{
var gravityCenter = GeometryOperations.GetReducedMomentsOfInertia(locNdms, locStrainMatrix);
firstParameter.Value = (gravityCenter.EIx * unitMultiPlayer).ToString();
secondParameter.Value = (gravityCenter.EIy * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
secondParameter.IsValid = false;
secondParameter.Value = (double.NaN).ToString();
secondParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
parameters.Add(secondParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetMomentOfInertiaRatio(IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Bending stiffness";
const string shortName = "EI";
var parameters = new List<IValueParameter<string>>();
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefixActual}/{prefixInitial} {name} {firstAxisName.ToUpper()} ratio",
ShortName = $"{shortName}{firstAxisName}-ratio",
Text = "-",
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {firstAxisName}-axis ratio"
};
var secondParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefixActual}/{prefixInitial} {name} {secondAxisName} ratio",
ShortName = $"{shortName}{secondAxisName}-ratio",
Text = "-",
Description = $"{prefixActual}/{prefixInitial} {name} of cross-section arbitrary {secondAxisName}-axis ratio"
};
try
{
var actualMoments = GeometryOperations.GetSofteningsFactors(locNdms, locStrainMatrix);
firstParameter.Value = actualMoments.EIxFactor.ToString();
secondParameter.Value = actualMoments.EIy.ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
secondParameter.IsValid = false;
secondParameter.Value = (double.NaN).ToString();
secondParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
parameters.Add(secondParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetArea(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
const string name = "Longitudinal stiffness";
const string shortName = "EA";
var parameters = new List<IValueParameter<string>>();
var unitArea = unitLogic.GetUnit(UnitTypes.Area, "mm2");
var unitStress = unitLogic.GetUnit(UnitTypes.Stress, "MPa");
var unitName = $"{unitStress.Name} * {unitArea.Name}";
var unitMultiPlayer = unitArea.Multiplyer * unitStress.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} {name}",
ShortName = $"{shortName}",
Text = unitName,
Description = $"{prefix} {name} of cross-section multiplied by {prefix} modulus"
};
try
{
firstParameter.Value = (GeometryOperations.GetReducedArea(locNdms, locStrainMatrix) * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
return parameters;
}
private IEnumerable<IValueParameter<string>> GetAreaRatio(IEnumerable<INdm> locNdms, IStrainMatrix locStrainMatrix)
{
const string name = "Longitudinal stiffness";
const string shortName = "EA";
var parameters = new List<IValueParameter<string>>();
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefixActual}/{prefixInitial} {name} ratio",
ShortName = $"{shortName}-ratio",
Text = "-",
Description = $"{prefixActual}/{prefixInitial} {name}-ratio of cross-section"
};
try
{
var actual = GeometryOperations.GetSofteningsFactors(locNdms, locStrainMatrix);
firstParameter.Value = actual.EAFactor.ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
return parameters;
}
public GeometryParametersLogic(IEnumerable<INdm> ndms, IStrainMatrix strainMatrix)
{
this.ndms = ndms;
this.strainMatrix = strainMatrix;
}
private IEnumerable<IValueParameter<string>> GetGravityCenter(string prefix, IEnumerable<INdm> locNdms, IStrainMatrix? locStrainMatrix = null)
{
var parameters = new List<IValueParameter<string>>();
var unitType = UnitTypes.Length;
var unit = unitLogic.GetUnit(unitType, "mm");
var unitName = unit.Name;
var unitMultiPlayer = unit.Multiplyer;
var firstParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} Center{firstAxisName.ToUpper()}",
ShortName = $"{firstAxisName.ToUpper()}c",
Text = unitName,
Description = $"{prefix} Displacement of center of gravity of cross-section along {firstAxisName}-axis"
};
var secondParameter = new ValueParameter<string>()
{
IsValid = true,
Name = $"{prefix} Center{secondAxisName.ToUpper()}",
ShortName = $"{secondAxisName.ToUpper()}c",
Text = unitName,
Description = $"{prefix} Displacement of center of gravity of cross-section along {secondAxisName}-axis"
};
try
{
var gravityCenter = GeometryOperations.GetGravityCenter(locNdms, locStrainMatrix);
firstParameter.Value = (gravityCenter.Cx * unitMultiPlayer).ToString();
secondParameter.Value = (gravityCenter.Cy * unitMultiPlayer).ToString();
}
catch (Exception ex)
{
firstParameter.IsValid = false;
firstParameter.Value = (double.NaN).ToString();
firstParameter.Description += $": {ex}";
secondParameter.IsValid = false;
secondParameter.Value = (double.NaN).ToString();
secondParameter.Description += $": {ex}";
}
parameters.Add(firstParameter);
parameters.Add(secondParameter);
return parameters;
}
}
}

View File

@@ -0,0 +1,9 @@
using StructureHelperCommon.Models.Parameters;
namespace StructureHelperLogics.Services.NdmPrimitives
{
public interface IParametersLogic
{
List<IValueParameter<string>> GetTextParameters();
}
}