Change excel reading process
This commit is contained in:
@@ -18,7 +18,9 @@ namespace DataAccess.DTOs
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
[JsonProperty("ForcePoint")]
|
||||
public IPoint2D ForcePoint { get; set; } = new Point2DDTO();
|
||||
|
||||
[JsonProperty("SkipWrongRows")]
|
||||
public bool SkipWrongRows { get; set; } = false;
|
||||
|
||||
public ForceCombinationFromFileDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$id": "1",
|
||||
"$type": "RootObject",
|
||||
"FileVersion": {
|
||||
"Id": "0e4e721a-1df3-4693-999d-3670b14f7113",
|
||||
"Id": "f5247ddd-f79f-4943-9e09-764e2a47d0d3",
|
||||
"VersionNumber": 1,
|
||||
"SubVersionNumber": 4
|
||||
},
|
||||
@@ -20,7 +20,7 @@
|
||||
"$id": "4",
|
||||
"$type": "CrossSectionNdmAnalysis",
|
||||
"Id": "4027079c-d866-4266-b15e-e2a59bb69bfa",
|
||||
"Name": "New NDM Analysis",
|
||||
"Name": "Materials",
|
||||
"Tags": "#New group",
|
||||
"VersionProcessor": {
|
||||
"$id": "5",
|
||||
@@ -1579,6 +1579,158 @@
|
||||
"TensionForSLS": true,
|
||||
"MaterialLogicId": "b97e8168-76a1-4e24-ae98-9aa38edd1e9a"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "165",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "a975c01f-2028-4aa7-93b1-0ef1cfc73580",
|
||||
"Name": "A240",
|
||||
"Color": "#FF6ACF46",
|
||||
"HelperMaterial": {
|
||||
"$id": "166",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "6ec6f688-21ea-4d7a-83a0-66ec7d2ef268",
|
||||
"MaterialEntityId": "c47ebbd7-2e0c-4247-81b6-dc3fbd064bab",
|
||||
"SafetyFactors": {
|
||||
"$id": "167",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "168",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "257fe163-585d-4f7a-a96a-3634e9b6861e",
|
||||
"Name": "A400",
|
||||
"Color": "#FF61881E",
|
||||
"HelperMaterial": {
|
||||
"$id": "169",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "a0547d68-4b5a-42c6-bf20-cc1f9caa8157",
|
||||
"MaterialEntityId": "ea422282-3465-433c-9b93-c5bbfba5a904",
|
||||
"SafetyFactors": {
|
||||
"$id": "170",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "171",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "d5dd42c1-372f-4217-a85f-e3eaaa753b6c",
|
||||
"Name": "A500",
|
||||
"Color": "#FFECAA46",
|
||||
"HelperMaterial": {
|
||||
"$id": "172",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "ca7ce2f8-7bbc-4379-8166-8fc7a4adefc0",
|
||||
"MaterialEntityId": "045b54b1-0bbf-41fd-a27d-aeb20f600bb4",
|
||||
"SafetyFactors": {
|
||||
"$id": "173",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "174",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "e4245f23-f51a-4ed1-a4e5-5f7133028a27",
|
||||
"Name": "A600",
|
||||
"Color": "#FF3B68D7",
|
||||
"HelperMaterial": {
|
||||
"$id": "175",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "4479ec6e-8cf6-48ec-94b7-8645f6aa7ac5",
|
||||
"MaterialEntityId": "e3cfc6fb-fbd0-47dd-ab4a-79c030704acf",
|
||||
"SafetyFactors": {
|
||||
"$id": "176",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "177",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "14b73c38-249d-4c0f-afcc-a1b2ef7268f3",
|
||||
"Name": "A800",
|
||||
"Color": "#FFCA9F48",
|
||||
"HelperMaterial": {
|
||||
"$id": "178",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "b626d13f-f754-411e-8092-1e92e9a27161",
|
||||
"MaterialEntityId": "6f0882ef-53bf-464e-acf7-da421a43a825",
|
||||
"SafetyFactors": {
|
||||
"$id": "179",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "180",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "bab99d80-6773-492c-ad88-1ad8cb948d58",
|
||||
"Name": "A1000",
|
||||
"Color": "#FFF5812A",
|
||||
"HelperMaterial": {
|
||||
"$id": "181",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "b05e32ce-38ae-44f2-bb2c-428d92876544",
|
||||
"MaterialEntityId": "509fbaae-a3de-43c2-aae6-33387908dc43",
|
||||
"SafetyFactors": {
|
||||
"$id": "182",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "183",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "31b4492a-bfe7-4fcf-8f1d-b2f3df11e837",
|
||||
"Name": "K1400",
|
||||
"Color": "#FFF150B3",
|
||||
"HelperMaterial": {
|
||||
"$id": "184",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "0693f06e-f1c6-4e00-acfc-11047344052a",
|
||||
"MaterialEntityId": "1b44e9eb-d19d-4fd5-9755-33ae01683dc1",
|
||||
"SafetyFactors": {
|
||||
"$id": "185",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "186",
|
||||
"$type": "HeadMaterial",
|
||||
"Id": "1c1a7ca3-aae7-4ca8-b5bd-dea1b9753e12",
|
||||
"Name": "K1500",
|
||||
"Color": "#FFC98453",
|
||||
"HelperMaterial": {
|
||||
"$id": "187",
|
||||
"$type": "ReinforcementLibMaterial",
|
||||
"Id": "6a3ac6d5-7c5c-42d5-a49e-66e267e8cbd2",
|
||||
"MaterialEntityId": "93c48a27-ab37-4bd2-aeb8-2a7247e74a1b",
|
||||
"SafetyFactors": {
|
||||
"$id": "188",
|
||||
"$type": "ListOfMaterialSafetyFactor",
|
||||
"$values": []
|
||||
},
|
||||
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1596,7 +1748,7 @@
|
||||
}
|
||||
},
|
||||
"WorkPlaneProperty": {
|
||||
"$id": "165",
|
||||
"$id": "189",
|
||||
"$type": "WorkPlanePropertyDTO",
|
||||
"Id": "31ec91ea-d0bc-4426-9ca4-e22e17889457",
|
||||
"GridSize": 0.05,
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
|
||||
public CircleViewPrimitive(IEllipseNdmPrimitive primitive) : base(primitive)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
DivisionViewModel = new HasDivisionViewModel(primitive.DivisionSize);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -19,7 +19,8 @@ namespace StructureHelper.Windows.Forces
|
||||
public ForceTupleVM ForceTupleVM => forceTupleVM;
|
||||
public FactoredCombinationPropertyVM CombinationProperty
|
||||
{
|
||||
get => combinationProperty; set
|
||||
get => combinationProperty;
|
||||
set
|
||||
{
|
||||
combinationProperty = value;
|
||||
OnPropertyChanged(nameof(CombinationProperty));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
@@ -6,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.Forces
|
||||
{
|
||||
@@ -14,16 +17,44 @@ namespace StructureHelper.Windows.Forces
|
||||
private readonly IForceCombinationFromFile model;
|
||||
private ListOfFilesVM files;
|
||||
private FactoredCombinationPropertyVM combinationProperty;
|
||||
private RelayCommand showCombinationViewerCommand;
|
||||
|
||||
public FactoredCombinationPropertyVM CombinationProperty
|
||||
{
|
||||
get => combinationProperty; set
|
||||
get => combinationProperty;
|
||||
set
|
||||
{
|
||||
combinationProperty = value;
|
||||
OnPropertyChanged(nameof(CombinationProperty));
|
||||
}
|
||||
}
|
||||
|
||||
public bool SkipWrongRows
|
||||
{
|
||||
get
|
||||
{
|
||||
return model.SkipWrongRows;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
model.SkipWrongRows = value;
|
||||
OnPropertyChanged(nameof(SkipWrongRows));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ShowCombinationViewerCommand
|
||||
{
|
||||
get => showCombinationViewerCommand ??= new RelayCommand(
|
||||
o =>SafetyProcessor.RunSafeProcess(ShowCombinationViewer, "Combination viewer"));
|
||||
}
|
||||
|
||||
private void ShowCombinationViewer()
|
||||
{
|
||||
var wnd = new ForceCombinationViewerView(model);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
public ListOfFilesVM Files
|
||||
{
|
||||
get => files; set
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:ForceCombinationFromFileVM}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination By Files" Height="330" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Force Combination By Files" Height="380" Width="350" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
@@ -18,6 +18,8 @@
|
||||
<StackPanel>
|
||||
<!--ForceTemplates.xaml-->
|
||||
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionNameTemplate}" Content="{Binding}"/>
|
||||
<CheckBox Content="Skip wrong rows" Margin="4" IsChecked="{Binding SkipWrongRows}"/>
|
||||
<Button Content="Show combination" Margin="4" Command="{Binding ShowCombinationViewerCommand}"/>
|
||||
<TextBlock Text="List of Files"/>
|
||||
<Grid>
|
||||
<uc:ListOfFileControl Height="130" DataContext="{Binding Files}"/>
|
||||
|
||||
@@ -1,22 +1,68 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.Forces
|
||||
{
|
||||
public class ForceCombinationViewerVM : ViewModelBase
|
||||
{
|
||||
private IForceAction model;
|
||||
private LimitStates limitState = LimitStates.ULS;
|
||||
private CalcTerms calcTerm = CalcTerms.ShortTerm;
|
||||
private RelayCommand refreshCommand;
|
||||
|
||||
public List<IForceCombinationList> Combinations => model.GetCombinations();
|
||||
public List<LimitStates> LimitStateList { get; set; } = [LimitStates.ULS, LimitStates.SLS];
|
||||
public List<CalcTerms> CalcTermList { get; set; } = [CalcTerms.LongTerm, CalcTerms.ShortTerm];
|
||||
public LimitStates LimitState
|
||||
{
|
||||
get => limitState;
|
||||
set
|
||||
{
|
||||
limitState = value;
|
||||
OnPropertyChanged(nameof(limitState));
|
||||
}
|
||||
}
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
Combinations.Clear();
|
||||
var combinations = model.GetCombinations();
|
||||
foreach (var combination in combinations)
|
||||
{
|
||||
var combinationList = combination.DesignForces.Where(x => x.LimitState == limitState && x.CalcTerm == calcTerm).ToList();
|
||||
combinationList.ForEach(x => Combinations.Add(x));
|
||||
}
|
||||
}
|
||||
|
||||
public CalcTerms CalcTerm
|
||||
{
|
||||
get => calcTerm;
|
||||
set
|
||||
{
|
||||
calcTerm = value;
|
||||
OnPropertyChanged(nameof (calcTerm));
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand RefreshCommand =>
|
||||
refreshCommand ??=
|
||||
new RelayCommand(o => SafetyProcessor.RunSafeProcess(Refresh, "Refresh combination errror"));
|
||||
|
||||
public ObservableCollection<IDesignForceTuple> Combinations { get; } = [];
|
||||
|
||||
public ForceCombinationViewerVM(IForceAction model)
|
||||
{
|
||||
this.model = model;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,37 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:ForceCombinationViewerVM}"
|
||||
mc:Ignorable="d"
|
||||
Title="Force Combination Viewer" Height="250" Width="400" MinHeight="250" MinWidth="400" MaxHeight="600" MaxWidth="1000" ResizeMode="CanResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResourceKey=CombinationListTemplate}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
Title="Force Combination Viewer" Height="450" Width="550" MinHeight="450" MinWidth="400" MaxHeight="800" MaxWidth="1000" ResizeMode="CanResize" WindowStartupLocation="CenterScreen">
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding RefreshCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Refresh combination"
|
||||
IconContent="{StaticResource Renew}"
|
||||
DescriptionText="Refreshes combination according to selected filters"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource Renew}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding LimitStateList}" SelectedItem="{Binding LimitState}" Width="100"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding CalcTermList}" SelectedItem="{Binding CalcTerm}" Width="100"/>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
<DataGrid x:Name="ForceGrid" Style="{StaticResource ItemsDataGrid}" ItemsSource="{Binding Combinations}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Limit state" Width="80" MinWidth="70" Binding="{Binding LimitState}"/>
|
||||
<DataGridTextColumn Header="Duration" Width="80" MinWidth="70" Binding="{Binding CalcTerm}"/>
|
||||
<DataGridTextColumn Header="Moment Mx" Width="100" Binding="{Binding ForceTuple.Mx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Moment My" Width="100" Binding="{Binding ForceTuple.My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
|
||||
<DataGridTextColumn Header="Force Nz" Width="100" Binding="{Binding ForceTuple.Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace StructureHelper.Windows.Forces
|
||||
{
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace StructureHelper.Windows.Graphs
|
||||
for (double s = minValue; s < maxValue; s += step)
|
||||
{
|
||||
double strain = s * factor;
|
||||
double diagramValue = loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters, strain) * factor;
|
||||
double diagramValue = loaderMaterial.Diagram.Invoke(strain) * factor;
|
||||
StressEntity stressEntity = new()
|
||||
{
|
||||
LimitState = limitState,
|
||||
@@ -255,11 +255,12 @@ namespace StructureHelper.Windows.Graphs
|
||||
GraphService.SetVisualProps(lineSeries, VisualProps);
|
||||
}
|
||||
var chartValues = new ChartValues<double>();
|
||||
for (double s = minValue; s < maxValue; s += step)
|
||||
for (double strain = minValue; strain < maxValue; strain += step)
|
||||
{
|
||||
double diagramValue = Math.Round(loaderMaterial.Diagram.Invoke(loaderMaterial.DiagramParameters, s * factor)) * factor * UnitConstants.Stress;
|
||||
double factoredStrain = strain * factor;
|
||||
double diagramValue = Math.Round(loaderMaterial.Diagram.Invoke(factoredStrain)) * factor * UnitConstants.Stress;
|
||||
chartValues.Add(diagramValue);
|
||||
labels.Add(Convert.ToString(Math.Round(s, 4)));
|
||||
labels.Add(Convert.ToString(Math.Round(strain, 4)));
|
||||
}
|
||||
lineSeries.Values = chartValues;
|
||||
SeriesCollection.Add(lineSeries);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public double GlobalFactor { get; set; } = 1d;
|
||||
/// <inheritdoc/>
|
||||
public List<IColumnFileProperty> ColumnProperties { get; } = new();
|
||||
public bool SkipWrongRows { get; set; } = false;
|
||||
|
||||
public ColumnedFileProperty(Guid id)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public IPoint2D ForcePoint { get; set; } = new Point2D();
|
||||
|
||||
public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationProperty(Guid.NewGuid());
|
||||
public bool SkipWrongRows { get; set; } = false;
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
@@ -46,7 +47,11 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public List<IForceCombinationList> GetCombinations()
|
||||
{
|
||||
getTupleFromFileLogic ??= new GetTuplesFromFileLogic() { TraceLogger = new ShiftTraceLogger()};
|
||||
getTupleFromFileLogic = new GetTuplesFromFileLogic()
|
||||
{
|
||||
TraceLogger = new ShiftTraceLogger(),
|
||||
SkipWrongRows = SkipWrongRows,
|
||||
};
|
||||
factoredCombination = new ForceFactoredList();
|
||||
factoredCombination.ForceTuples.Clear();
|
||||
propertyUpdateStrategy ??= new FactoredCombinationPropertyUpdateStrategy();
|
||||
|
||||
@@ -15,5 +15,6 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// List of file properties for import combination
|
||||
/// </summary>
|
||||
List<IColumnedFileProperty> ForceFiles { get; set; }
|
||||
bool SkipWrongRows { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
InitializeLogics();
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.SkipWrongRows = sourceObject.SkipWrongRows;
|
||||
CheckObject.IsNull(targetObject.CombinationProperty, "Target object combination property");
|
||||
CheckObject.IsNull(sourceObject.CombinationProperty, "Source object combination property");
|
||||
combinationPropertyUpdateStrategy.Update(targetObject.CombinationProperty, sourceObject.CombinationProperty);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public IColumnedFileProperty ForceFileProperty { get; set; }
|
||||
public bool SkipWrongRows { get; internal set; }
|
||||
|
||||
public IForceTuple GetForceTuple(IExcelDataReader? reader)
|
||||
{
|
||||
@@ -38,10 +39,24 @@ namespace StructureHelperCommon.Models.Forces
|
||||
throw new StructureHelperException(ErrorStrings.NullReference + $": reader value for column {item.Name} in file {ForceFileProperty.FilePath}");
|
||||
}
|
||||
var readerValue = reader.GetValue(item.Index);
|
||||
if (readerValue is null)
|
||||
{
|
||||
if (SkipWrongRows == true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.NullReference + $": wrong row in file {ForceFileProperty.FilePath}, total row number n = {reader.RowCount}");
|
||||
}
|
||||
}
|
||||
var strValue = readerValue.ToString();
|
||||
double factor = ForceFileProperty.GlobalFactor * item.Factor * 1000d;
|
||||
var doubleValue = Convert.ToDouble(strValue) * factor;
|
||||
fillArrayLogic ??= new FillTupleArrayByColumnNameLogic() { TraceLogger = TraceLogger };
|
||||
fillArrayLogic ??= new FillTupleArrayByColumnNameLogic()
|
||||
{
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
fillArrayLogic.ProceeForceTupleArray(nDouble, doubleValue, item.Name, ForceFileProperty.FilePath);
|
||||
}
|
||||
TraceLogger?.AddMessage($"String values: Nz = {nDouble[0]}, Mx = {nDouble[1]}, My = {nDouble[2]} were gained", TraceLogStatuses.Debug);
|
||||
|
||||
@@ -4,6 +4,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
@@ -35,6 +36,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public IColumnedFileProperty ForceFileProperty { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public bool SkipWrongRows { get; set; } = false;
|
||||
|
||||
public List<IForceTuple> GetTuples()
|
||||
{
|
||||
@@ -56,7 +58,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
// Create an Excel reader
|
||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
||||
{
|
||||
// Skip the first two header rows if necessary (adjust based on structure)
|
||||
// Skip the first header rows if necessary (adjust based on structure)
|
||||
for (int i = 0; i < skipRows; i++)
|
||||
{
|
||||
reader.Read(); // Skip row
|
||||
@@ -65,7 +67,8 @@ namespace StructureHelperCommon.Models.Forces
|
||||
excelReaderLogic ??= new GetTupleByExcelReaderLogic()
|
||||
{
|
||||
ForceFileProperty = ForceFileProperty,
|
||||
TraceLogger = TraceLogger
|
||||
TraceLogger = TraceLogger,
|
||||
SkipWrongRows = SkipWrongRows
|
||||
};
|
||||
|
||||
// Loop through the rows
|
||||
@@ -74,11 +77,13 @@ namespace StructureHelperCommon.Models.Forces
|
||||
try
|
||||
{
|
||||
IForceTuple newTuple = excelReaderLogic.GetForceTuple(reader);
|
||||
result.Add(newTuple);
|
||||
if (! result.Any(x => x.Mx == newTuple.Mx && x.My == newTuple.My && x.Nz == newTuple.Nz))
|
||||
{
|
||||
result.Add(newTuple);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//to do implement case when file has a data in the row, but thus date is not correct
|
||||
string errorString = ErrorStrings.DataIsInCorrect + $": incorrect data in file {ForceFileProperty.FilePath}, " + ex.Message;
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IGetTuplesFromFileLogic : ILogic
|
||||
{
|
||||
bool SkipWrongRows { get; set; }
|
||||
IColumnedFileProperty ForceFileProperty { get; set; }
|
||||
|
||||
List<IForceTuple> GetTuples();
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
internal class RestrictStrainDecorator : IMaterialBuilder
|
||||
{
|
||||
IMaterialBuilder builder;
|
||||
private double maxTensileStrain;
|
||||
private double maxCompressionStrain;
|
||||
|
||||
public IMaterialOption MaterialOption { get; set; }
|
||||
|
||||
public RestrictStrainDecorator(IMaterialBuilder builder)
|
||||
@@ -25,11 +28,8 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
var option = (RestrictStrainOption)MaterialOption;
|
||||
var material = new Material();
|
||||
material.InitModulus = builder.GetMaterial().InitModulus;
|
||||
material.DiagramParameters = new List<double>()
|
||||
{
|
||||
option.MaxTensileStrain,
|
||||
option.MaxCompessionStrain
|
||||
};
|
||||
maxTensileStrain = option.MaxTensileStrain;
|
||||
maxCompressionStrain = option.MaxCompessionStrain;
|
||||
material.Diagram = GetStressDiagram;
|
||||
return material;
|
||||
}
|
||||
@@ -39,10 +39,9 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
CheckObject.CompareTypes(typeof(RestrictStrainOption), MaterialOption.GetType());
|
||||
}
|
||||
|
||||
private double GetStressDiagram(IEnumerable<double> parameters, double strain)
|
||||
private double GetStressDiagram(double strain)
|
||||
{
|
||||
var maxTensileStrain = parameters.ToList()[0];
|
||||
var maxCompressionStrain = parameters.ToList()[1];
|
||||
|
||||
if (strain > maxTensileStrain || strain < maxCompressionStrain)
|
||||
{
|
||||
return 0d;
|
||||
@@ -50,7 +49,7 @@ namespace StructureHelperLogics.MaterialBuilders
|
||||
else
|
||||
{
|
||||
var material = builder.GetMaterial();
|
||||
return material.Diagram.Invoke(parameters, strain);
|
||||
return material.Diagram.Invoke(strain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ElasticMaterialLogic : IElasticMaterialLogic
|
||||
{
|
||||
private List<double> parameters;
|
||||
private double modulusOfElasticity;
|
||||
private double compressiveStrength;
|
||||
private double tensileStrength;
|
||||
|
||||
public IMaterial GetLoaderMaterial(IElasticMaterial elasticMaterial, LimitStates limitState, CalcTerms calcTerm, double factor = 1d)
|
||||
{
|
||||
@@ -20,23 +23,16 @@ namespace StructureHelperLogics.Models.Materials
|
||||
material.InitModulus = elasticMaterial.Modulus;
|
||||
IMaterialFactorLogic factorLogic = new MaterialFactorLogic(elasticMaterial.SafetyFactors);
|
||||
var factors = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
parameters = new List<double>()
|
||||
{
|
||||
elasticMaterial.Modulus,
|
||||
elasticMaterial.CompressiveStrength * factors.Compressive * factor,
|
||||
elasticMaterial.TensileStrength * factors.Tensile * factor
|
||||
};
|
||||
material.DiagramParameters = parameters;
|
||||
material.Diagram = GetStressByStrain;
|
||||
return material;
|
||||
modulusOfElasticity = elasticMaterial.Modulus;
|
||||
compressiveStrength = (-1d) * elasticMaterial.CompressiveStrength * factors.Compressive * factor;
|
||||
tensileStrength = elasticMaterial.TensileStrength * factors.Tensile * factor;
|
||||
material.Diagram = GetStressByStrain;
|
||||
return material;
|
||||
}
|
||||
|
||||
private double GetStressByStrain(IEnumerable<double> parameters1, double strain)
|
||||
private double GetStressByStrain(double strain)
|
||||
{
|
||||
double modulus = parameters.First();
|
||||
double stress = modulus * strain;
|
||||
double compressiveStrength = (-1d) * parameters.ElementAt(1);
|
||||
double tensileStrength = parameters.ElementAt(2);
|
||||
double stress = modulusOfElasticity * strain;
|
||||
if (stress > tensileStrength || stress < compressiveStrength) { return 0d; }
|
||||
else { return stress; }
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
{
|
||||
var material = ndm.Material;
|
||||
var materialFunc = material.Diagram;
|
||||
var newMaterialFunc = (IEnumerable<double> parameters, double strain) => strain * material.InitModulus;
|
||||
var newMaterialFunc = (double strain) => strain * material.InitModulus;
|
||||
var existingPrestrain = ndm.PrestrainLogic.GetAll().Sum(x => x.PrestrainValue);
|
||||
var newPrestrain = materialFunc(null, existingPrestrain) / material.InitModulus;
|
||||
var newPrestrain = materialFunc(existingPrestrain) / material.InitModulus;
|
||||
ndm.Material.Diagram = newMaterialFunc;
|
||||
ndm.PrestrainLogic.DeleteAll();
|
||||
ndm.PrestrainLogic.Add(PrestrainTypes.Prestrain, newPrestrain);
|
||||
|
||||
Reference in New Issue
Block a user