Icons for force result were added
BIN
StructureHelper/Infrastructure/UI/Icons/Graphs/32px_crack.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
StructureHelper/Infrastructure/UI/Icons/Graphs/32px_fire.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_1.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
StructureHelper/Infrastructure/UI/Icons/Graphs/32px_graph_2.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
@@ -23,6 +23,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_crack.png" />
|
||||
<None Remove="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_graph_1.png" />
|
||||
<None Remove="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_graph_2.png" />
|
||||
<None Remove="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_interpolation_1_1.png" />
|
||||
<None Remove="Windows\MainWindow\Analysis32.png" />
|
||||
<None Remove="Windows\MainWindow\Beam32.png" />
|
||||
<None Remove="Windows\MainWindow\Calculator32.png" />
|
||||
@@ -86,6 +90,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_crack.png" />
|
||||
<Resource Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_graph_1.png" />
|
||||
<Resource Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_graph_2.png" />
|
||||
<Resource Include="Windows\CalculationWindows\CalculatorsViews\ForceCalculatorViews\32px_interpolation_1_1.png" />
|
||||
<Resource Include="Windows\MainWindow\Analysis32.png" />
|
||||
<Resource Include="Windows\MainWindow\Beam32.png" />
|
||||
<Resource Include="Windows\MainWindow\Calculator32.png" />
|
||||
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,125 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
internal class InteractionDiagramLogic : ILongProcessLogic
|
||||
{
|
||||
const double xmax = 0.7e6d;
|
||||
const double xmin = -0.7e6d;
|
||||
const double ymax = 1.5e6d;
|
||||
const double ymin = -9e6d;
|
||||
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||
|
||||
public int StepCount { get; }
|
||||
|
||||
public Action<int> SetProgress { get; set; }
|
||||
public bool Result { get; set; }
|
||||
public IEnumerable<INdmPrimitive> NdmPrimitives { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public ForceTuple ForceTuple { get; set; }
|
||||
|
||||
private void Show()
|
||||
{
|
||||
var options = new TriangulationOptions() { LimiteState = LimitState, CalcTerm = CalcTerm };
|
||||
var ndmCollection = NdmPrimitives.SelectMany(x => x.GetNdms(options));
|
||||
//var ndmCollection = NdmPrimitivesService.GetNdms(NdmPrimitives, LimitState, CalcTerm);
|
||||
|
||||
var predicateFactory = new PredicateFactory()
|
||||
{
|
||||
My = ForceTuple.My,
|
||||
Ndms = ndmCollection
|
||||
};
|
||||
Predicate<IPoint2D> predicate = predicateFactory.GetResult;
|
||||
//var logic = new StabLimitCurveLogic();
|
||||
var logic = new LimitCurveLogic(predicate);
|
||||
var calculator = new LimitCurveCalculator(logic);
|
||||
calculator.SurroundData.XMax = xmax;
|
||||
calculator.SurroundData.XMin = xmin;
|
||||
calculator.SurroundData.YMax = ymax;
|
||||
calculator.SurroundData.YMin = ymin;
|
||||
calculator.SurroundData.PointCount = 40;
|
||||
calculator.Run();
|
||||
var result = calculator.Result;
|
||||
if (result.IsValid = false) { return; }
|
||||
var interactionResult = result as LimitCurveResult;
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
string[] labels = GetLabels(unitForce, unitMoment);
|
||||
var items = interactionResult.Points;
|
||||
arrayParameter = new ArrayParameter<double>(items.Count(), labels.Count(), labels);
|
||||
var data = arrayParameter.Data;
|
||||
for (int i = 0; i < items.Count(); i++)
|
||||
{
|
||||
var valueList = new List<double>
|
||||
{
|
||||
items[i].X * unitForce.Multiplyer,
|
||||
items[i].Y * unitMoment.Multiplyer
|
||||
};
|
||||
for (int j = 0; j < valueList.Count; j++)
|
||||
{
|
||||
data[i, j] = valueList[j];
|
||||
}
|
||||
SetProgress?.Invoke(i);
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] GetLabels(IUnit unitForce, IUnit unitMoment)
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
$"{GeometryNames.MomFstName}, {unitMoment.Name}",
|
||||
$"{GeometryNames.LongForceName}, {unitForce.Name}"
|
||||
};
|
||||
}
|
||||
|
||||
public void ShowWindow()
|
||||
{
|
||||
Show();
|
||||
Result = true;
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
{
|
||||
var wnd = new GraphView(arrayParameter);
|
||||
wnd.ShowDialog();
|
||||
},
|
||||
"Errors appeared during showing a graph, see detailed information");
|
||||
}
|
||||
|
||||
public void WorkerDoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
Show();
|
||||
Result = true;
|
||||
}
|
||||
|
||||
public void WorkerProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
public void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
//nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,16 @@
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators.ForceResultLogic
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
internal class ShowCrackResultLogic
|
||||
{
|
||||
@@ -8,7 +8,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
internal class ShowCrackWidthLogic
|
||||
{
|
||||
@@ -12,7 +12,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
internal class ShowDiagramLogic : ILongProcessLogic
|
||||
{
|
||||
@@ -9,7 +9,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
internal class ShowProgressLogic
|
||||
{
|
||||
@@ -4,16 +4,25 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews"
|
||||
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Calculations.Calculators"
|
||||
d:DataContext="{d:DesignInstance vm:ForcesResultsViewModel}"
|
||||
d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Calculation Results" Height="350" Width="850" MinHeight="300" MinWidth="400" WindowStartupLocation="CenterScreen">
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Style="{StaticResource ToolButton}"
|
||||
Command="{Binding ShowCrackResultCommand}"
|
||||
Content="Fcrc" ToolTip="Calc crack forces"/>
|
||||
<Button Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding InterpolateCommand}" ToolTip="Show result step by step">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_interpolation_1_1.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
|
||||
</Button>
|
||||
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
@@ -48,14 +57,11 @@
|
||||
</DataGrid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Margin="3" Content="Graphic" ToolTip="Show graphic results" Command="{Binding ShowIsoFieldCommand}"/>
|
||||
<Button Margin="3" Content="Diagrams" ToolTip="Show diagrams" Command="{Binding ShowGraphsCommand}"/>
|
||||
<Button Margin="3" Content="CrcDiagrams" ToolTip="Show diagrams for cracked section" Command="{Binding ShowCrackGraphsCommand}"/>
|
||||
<Button Margin="3" Content="Interpolate" ToolTip="Create analysis by substep" Command="{Binding InterpolateCommand}"/>
|
||||
<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="Anchorage" ToolTip="Set strains as auto prestrain" Command="{Binding ShowAnchorageCommand}"/>
|
||||
<Button Margin="3" Content="Geometry" ToolTip="Show Geometry Properties" Command="{Binding ShowGeometryResultCommand}"/>
|
||||
<Button Margin="3" Content="Fcrc" ToolTip="Show crack force" Command="{Binding ShowCrackResultCommand}"/>
|
||||
<Button Margin="3" Content="Acrc" ToolTip="Show crack width" Command="{Binding ShowCrackWidthResultCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -5,13 +5,11 @@ using StructureHelper.Services.Exports;
|
||||
using StructureHelper.Services.Reports;
|
||||
using StructureHelper.Services.Reports.CalculationReports;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.GeometryCalculatorViews;
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators.ForceResultLogic;
|
||||
using StructureHelper.Windows.ViewModels.Calculations.Calculators;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
@@ -32,7 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
public class ForcesResultsViewModel : ViewModelBase
|
||||
{
|
||||
@@ -40,6 +38,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
private ForceCalculator forceCalculator;
|
||||
private ILongProcessLogic progressLogic;
|
||||
private ShowProgressLogic showProgressLogic;
|
||||
private InteractionDiagramLogic interactionDiagramLogic = new();
|
||||
private static readonly ShowCrackResultLogic showCrackResultLogic = new();
|
||||
private static readonly ShowCrackWidthLogic showCrackWidthLogic = new();
|
||||
private IForcesResults forcesResults;
|
||||
@@ -61,11 +60,27 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
private ICommand showCrackResult;
|
||||
private ICommand showCrackGraphsCommand;
|
||||
private RelayCommand showCrackWidthResult;
|
||||
private ICommand showInteractionDiagramCommand;
|
||||
|
||||
public IForcesResults ForcesResults
|
||||
{
|
||||
get => forcesResults;
|
||||
}
|
||||
public ICommand ShowInteractionDiagramCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return showInteractionDiagramCommand ??
|
||||
(showInteractionDiagramCommand = new RelayCommand(o =>
|
||||
{
|
||||
interactionDiagramLogic.ForceTuple = SelectedResult.DesignForceTuple.ForceTuple.Clone() as ForceTuple;
|
||||
interactionDiagramLogic.LimitState = SelectedResult.DesignForceTuple.LimitState;
|
||||
interactionDiagramLogic.CalcTerm = SelectedResult.DesignForceTuple.CalcTerm;
|
||||
interactionDiagramLogic.NdmPrimitives = ndmPrimitives;
|
||||
interactionDiagramLogic.ShowWindow();
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid));
|
||||
}
|
||||
}
|
||||
public ICommand ShowIsoFieldCommand
|
||||
{
|
||||
get
|
||||
@@ -77,7 +92,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
{
|
||||
ShowIsoField();
|
||||
}
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid));
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid));
|
||||
}
|
||||
}
|
||||
public ICommand ExportToCSVCommand
|
||||
@@ -169,7 +184,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
get => showCrackResult ??= new RelayCommand(o =>
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(ShowCrackResult);
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid);
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid);
|
||||
}
|
||||
private void ShowCrackResult()
|
||||
{
|
||||
@@ -185,7 +200,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
get => showCrackWidthResult ??= new RelayCommand(o =>
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(ShowCrackWidthResult);
|
||||
}, o => (SelectedResult != null) && SelectedResult.IsValid);
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid);
|
||||
}
|
||||
|
||||
private void ShowCrackWidthResult()
|
||||
@@ -295,8 +310,10 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
catch (Exception ex)
|
||||
{
|
||||
var vm = new ErrorProcessor()
|
||||
{ ShortText = "Errors apearred during showing isofield, see detailed information",
|
||||
DetailText = $"{ex}"};
|
||||
{
|
||||
ShortText = "Errors apearred during showing isofield, see detailed information",
|
||||
DetailText = $"{ex}"
|
||||
};
|
||||
new ErrorMessage(vm).ShowDialog();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,8 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using System.Windows;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurveLogic
|
||||
{
|
||||
List<IPoint2D> GetPoints(List<IPoint2D> points);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurveParameterLogic
|
||||
{
|
||||
IPoint2D CurrentPoint { get; set; }
|
||||
double GetParameter();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ISurroundProc
|
||||
{
|
||||
SurroundData SurroundData { get; set; }
|
||||
List<IPoint2D> GetPoints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveCalculator : ICalculator
|
||||
{
|
||||
private LimitCurveResult result;
|
||||
private List<IPoint2D> surroundList;
|
||||
private List<IPoint2D> factoredList;
|
||||
private ILimitCurveLogic limitCurveLogic;
|
||||
|
||||
public string Name { get; set; }
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public ISurroundProc SurroundProcLogic { get; set; }
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public LimitCurveCalculator(ILimitCurveLogic limitCurveLogic)
|
||||
{
|
||||
this.limitCurveLogic = limitCurveLogic;
|
||||
SurroundData = new();
|
||||
//SurroundProcLogic = new RoundSurroundProc();
|
||||
SurroundProcLogic = new RectSurroundProc();
|
||||
}
|
||||
|
||||
public LimitCurveCalculator(Predicate<IPoint2D> limitPredicate)
|
||||
: this(new LimitCurveLogic(limitPredicate))
|
||||
{
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
result = new LimitCurveResult();
|
||||
result.IsValid = true;
|
||||
SurroundProcLogic.SurroundData = SurroundData;
|
||||
surroundList = SurroundProcLogic.GetPoints();
|
||||
try
|
||||
{
|
||||
factoredList = limitCurveLogic.GetPoints(surroundList);
|
||||
result.Points = factoredList;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description = ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
private IPoint2D currentPoint;
|
||||
private ILimitCurveParameterLogic parameterLogic;
|
||||
public Predicate<IPoint2D> LimitPredicate { get; set; }
|
||||
public LimitCurveLogic(ILimitCurveParameterLogic parameterLogic)
|
||||
{
|
||||
this.parameterLogic = parameterLogic;
|
||||
}
|
||||
public LimitCurveLogic(Predicate<IPoint2D> limitPredicate) : this (new LimitCurveParameterLogic(limitPredicate))
|
||||
{
|
||||
LimitPredicate = limitPredicate;
|
||||
}
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
{
|
||||
List<IPoint2D> resultList = new();
|
||||
if (LimitPredicate(new Point2D()) == true)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": predicate for zero value is not valid");
|
||||
}
|
||||
foreach (var point in points)
|
||||
{
|
||||
double parameter;
|
||||
currentPoint = point.Clone() as IPoint2D;
|
||||
parameterLogic.CurrentPoint = currentPoint;
|
||||
if (LimitPredicate(point) == false)
|
||||
{
|
||||
parameter = 1d;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter = parameterLogic.GetParameter();
|
||||
}
|
||||
var resultPoint = new Point2D()
|
||||
{
|
||||
X = currentPoint.X * parameter,
|
||||
Y = currentPoint.Y * parameter
|
||||
};
|
||||
resultList.Add(resultPoint);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveParameterLogic : ILimitCurveParameterLogic
|
||||
{
|
||||
private Predicate<Point2D> limitPredicate;
|
||||
public IPoint2D CurrentPoint { get; set; }
|
||||
|
||||
public LimitCurveParameterLogic(Predicate<Point2D> limitPredicate)
|
||||
{
|
||||
this.limitPredicate = limitPredicate;
|
||||
}
|
||||
|
||||
public double GetParameter()
|
||||
{
|
||||
var parameterCalculator = new FindParameterCalculator()
|
||||
{
|
||||
Predicate = GetFactorPredicate,
|
||||
};
|
||||
parameterCalculator.Accuracy.IterationAccuracy = 0.001d;
|
||||
parameterCalculator.Run();
|
||||
if (parameterCalculator.Result.IsValid == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate for point (x={CurrentPoint.X}, y={CurrentPoint.Y}) is not valid");
|
||||
}
|
||||
var result = parameterCalculator.Result as FindParameterResult;
|
||||
var parameter = result.Parameter;
|
||||
return parameter;
|
||||
}
|
||||
|
||||
private bool GetFactorPredicate(double factor)
|
||||
{
|
||||
var newPoint = new Point2D() { X = CurrentPoint.X * factor, Y = CurrentPoint.Y * factor };
|
||||
return limitPredicate(newPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveResult : IResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<IPoint2D> Points { get; set; }
|
||||
public LimitCurveResult()
|
||||
{
|
||||
Points = new List<IPoint2D>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class PredicateFactory
|
||||
{
|
||||
public IEnumerable<INdm> Ndms { get; set; }
|
||||
public double My { get; set; }
|
||||
public bool GetResult(IPoint2D point)
|
||||
{
|
||||
var calculator = new ForceTupleCalculator();
|
||||
var tuple = new ForceTuple() { Nz = point.Y, Mx = point.X, My = My };
|
||||
var inputData = new ForceTupleInputData() { Tuple = tuple, NdmCollection = Ndms };
|
||||
calculator.InputData = inputData;
|
||||
calculator.Run();
|
||||
var result = calculator.Result;
|
||||
return !result.IsValid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class RectSurroundProc : ISurroundProc
|
||||
{
|
||||
private List<IPoint2D> surroundList;
|
||||
|
||||
public SurroundData SurroundData { get; set; }
|
||||
|
||||
public List<IPoint2D> GetPoints()
|
||||
{
|
||||
var xRadius = (SurroundData.XMax - SurroundData.XMin) / 2;
|
||||
var yRadius = (SurroundData.YMax - SurroundData.YMin) / 2;
|
||||
surroundList = new();
|
||||
var pointCount = Convert.ToInt32(Math.Ceiling(SurroundData.PointCount / 8d));
|
||||
double xStep = xRadius / pointCount;
|
||||
double yStep = yRadius / pointCount;
|
||||
double x, y;
|
||||
x = SurroundData.XMax;
|
||||
for (int i = 0; i < pointCount * 2; i++)
|
||||
{
|
||||
y = SurroundData.YMin + yStep * i;
|
||||
surroundList.Add(new Point2D() { X = x, Y = y });
|
||||
}
|
||||
y = SurroundData.YMax;
|
||||
for (int i = 0; i < pointCount * 2; i++)
|
||||
{
|
||||
x = SurroundData.XMax - xStep * i;
|
||||
surroundList.Add(new Point2D() { X = x, Y = y });
|
||||
}
|
||||
x = SurroundData.XMin;
|
||||
for (int i = 0; i < pointCount * 2; i++)
|
||||
{
|
||||
y = SurroundData.YMax - yStep * i;
|
||||
surroundList.Add(new Point2D() { X = x, Y = y });
|
||||
}
|
||||
y = SurroundData.YMin;
|
||||
for (int i = 0; i < pointCount * 2; i++)
|
||||
{
|
||||
x = SurroundData.XMin + xStep * i;
|
||||
surroundList.Add(new Point2D() { X = x, Y = y });
|
||||
}
|
||||
surroundList.Add(surroundList[0].Clone() as IPoint2D);
|
||||
return surroundList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class RoundSurroundProc : ISurroundProc
|
||||
{
|
||||
private List<IPoint2D> surroundList;
|
||||
|
||||
public SurroundData SurroundData { get; set; }
|
||||
public RoundSurroundProc()
|
||||
{
|
||||
SurroundData = new();
|
||||
}
|
||||
public List<IPoint2D> GetPoints()
|
||||
{
|
||||
var xRadius = (SurroundData.XMax - SurroundData.XMin) / 2;
|
||||
var yRadius = (SurroundData.YMax - SurroundData.YMin) / 2;
|
||||
var xCenter = (SurroundData.XMax + SurroundData.XMin) / 2;
|
||||
var yCenter = (SurroundData.YMax + SurroundData.YMin) / 2;
|
||||
surroundList = new();
|
||||
var pointCount = Convert.ToInt32(Math.Ceiling(SurroundData.PointCount / 4d) * 4d);
|
||||
double angleStep = 2d * Math.PI / pointCount;
|
||||
double angle;
|
||||
for (int i = 0; i < pointCount; i++)
|
||||
{
|
||||
double x, y;
|
||||
angle = angleStep * i;
|
||||
x = xRadius * Math.Cos(angle) + xCenter;
|
||||
y = yRadius * Math.Sin(angle) + yCenter;
|
||||
surroundList.Add(new Point2D() { X = x, Y = y });
|
||||
}
|
||||
surroundList.Add(surroundList[0].Clone() as IPoint2D);
|
||||
return surroundList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class StabLimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
{
|
||||
var result = new List<IPoint2D>();
|
||||
foreach (var item in points)
|
||||
{
|
||||
result.Add(new Point2D() { X = item.X * 0.5d, Y = item.Y * 0.5d });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class SurroundData
|
||||
{
|
||||
public double XMax { get; set; }
|
||||
public double XMin { get; set; }
|
||||
public double YMax { get; set; }
|
||||
public double YMin { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
{
|
||||
public class RCSectionsTest
|
||||
{
|
||||
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, false, -0.00062729176929923703d, -0.0029292919541166911d, 0.00035383082501577246d)]
|
||||
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 3, 2, false, -0.00046857734823565632d, -0.0025101896869558888d, 0.00027185795017719519d)]
|
||||
[TestCase(0.5d, 0.5d, 0.025d, 0.025d, 3, 3, false, -0.00081656737668168479d, -0.00081656737668168414d, 0.00011865117209051567d)]
|
||||
[TestCase(0.5d, 0.5d, 0.025d, 0.025d, 3, 3, true, -0.00081971887286298598d, -0.00081971887286298544d, 0.00011922273439756063d)]
|
||||
[TestCase(0.5d, 0.6d, 0.025d, 0.025d, 3, 3, true, -0.00048146233319312662d, -0.00077822315770951882d, 0.00010599549196849429d)]
|
||||
[TestCase(0.6d, 0.5d, 0.025d, 0.025d, 3, 3, true, -0.00077822315770951947d, -0.00048146233319312478d, 0.00010599549196849413d)]
|
||||
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, false, -0.00068654617067958799d, -0.0030411189808055242d, 0.00034289928716916179d)]
|
||||
public void Run_ShouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, bool isBuckling, double expectedKx, double expectedKy, double expectedEpsZ)
|
||||
{
|
||||
//Arrange
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator.Tests.Infrastructures.Logics;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
|
||||
namespace StructureHelperTests.FunctionalTests.Ndms.RCSections
|
||||
{
|
||||
public class RCSectionTest
|
||||
{
|
||||
//Theoretical limit momemt Mx = 43kN*m
|
||||
[TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)]
|
||||
[TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)]
|
||||
[TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)]
|
||||
//Theoretical limit momemt Mx = -187kN*m
|
||||
[TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)]
|
||||
[TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)]
|
||||
[TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)]
|
||||
public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
double width = 0.4;
|
||||
double height = 0.6;
|
||||
var ndmCollection = new List<INdm>();
|
||||
ITriangulationOptions options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitives = new List<INdmPrimitive>();
|
||||
primitives.AddRange(GetConcreteNdms(width, height));
|
||||
primitives.AddRange(GetReinforcementNdms(width, height, topArea, bottomArea));
|
||||
ndmCollection.AddRange(primitives.SelectMany(x => x.GetNdms(options)));
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = 0.01,
|
||||
MaxIterationCount = 100,
|
||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
//Act
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var results = calculator.Result;
|
||||
//Assert
|
||||
Assert.NotNull(results);
|
||||
var strainMatrix = results.StrainMatrix;
|
||||
Assert.NotNull(strainMatrix);
|
||||
Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
|
||||
Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
|
||||
Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
|
||||
}
|
||||
|
||||
private IEnumerable<INdmPrimitive> GetConcreteNdms(double width, double height)
|
||||
{
|
||||
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40);
|
||||
var primitive = new RectanglePrimitive(material) {Width = width, Height = height, NdmMaxSize = 1, NdmMinDivision = 20 };
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive> {primitive};
|
||||
return primitives;
|
||||
}
|
||||
|
||||
private IEnumerable<INdmPrimitive> GetReinforcementNdms(double width, double height, double topArea, double bottomArea)
|
||||
{
|
||||
double gap = 0.05d;
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
IPoint2D centerRT = new Point2D { X = width / 2 - gap, Y = height / 2 - gap };
|
||||
IPoint2D centerLT = new Point2D { X = - (width / 2 - gap), Y = height / 2 - gap };
|
||||
IPoint2D centerRB = new Point2D { X = width / 2 - gap, Y = - (height / 2 - gap) };
|
||||
IPoint2D centerLB = new Point2D { X = -(width / 2 - gap), Y = - (height / 2 - gap) };
|
||||
List<INdmPrimitive> primitives = new List<INdmPrimitive>();
|
||||
INdmPrimitive primitive;
|
||||
//Right top bar
|
||||
primitive = new PointPrimitive(material) { Area = topArea};
|
||||
primitive.Center.X = centerRT.X;
|
||||
primitive.Center.Y = centerRT.Y;
|
||||
primitives.Add(primitive);
|
||||
//Left top bar
|
||||
primitive = new PointPrimitive(material) { Area = topArea};
|
||||
primitive.Center.X = centerLT.X;
|
||||
primitive.Center.Y = centerLT.Y;
|
||||
primitives.Add(primitive);
|
||||
//Right bottom bar
|
||||
primitive = new PointPrimitive(material) { Area = bottomArea};
|
||||
primitive.Center.X = centerRB.X;
|
||||
primitive.Center.Y = centerRB.Y;
|
||||
primitives.Add(primitive);
|
||||
//Left bottom bar
|
||||
primitive = new PointPrimitive(material) {Area = bottomArea };
|
||||
primitive.Center.X = centerLB.X;
|
||||
primitive.Center.Y = centerLB.Y;
|
||||
primitives.Add(primitive);
|
||||
return primitives;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using LoaderCalculator;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using LoaderCalculator.Data.SourceData;
|
||||
using LoaderCalculator.Tests.Infrastructures.Logics;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelper.Models.Materials;
|
||||
|
||||
namespace StructureHelperTests.FunctionalTests.Ndms.SteelSections
|
||||
{
|
||||
public class ReinforcementTest
|
||||
{
|
||||
[TestCase(0.3, 0.6, 4e8, 0, 0, 1800000, 0d, 0d, 5e-5d)]
|
||||
[TestCase(0.3, 0.6, 4e8, 0, 0, -1800000, 0d, 0d, -5e-5d)]
|
||||
[TestCase(0.3, 0.6, 4e8, 7000000, 0, 0, 0.0065882684745345067d, 0d, 0d)]
|
||||
//[TestCase(0.3, 0.6, 6e8, 10000000, 0, 0, 0.010485801788961743d, 0d, -0.00011114996218404612d)]
|
||||
public void Run_ShouldPass_Rectangle(double width, double height, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
var options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitive = new RectanglePrimitive { Width = width, Height = height, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitives = new List<INdmPrimitive>() { primitive};
|
||||
var ndmCollection = primitives.SelectMany(x => x.GetNdms(options));
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = 0.01,
|
||||
MaxIterationCount = 100,
|
||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
//Act
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var results = calculator.Result;
|
||||
//Assert
|
||||
Assert.NotNull(results);
|
||||
var strainMatrix = results.StrainMatrix;
|
||||
Assert.NotNull(strainMatrix);
|
||||
Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
|
||||
Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
|
||||
Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
|
||||
}
|
||||
|
||||
[TestCase(0.3, 4e8, 0, 0, 706850.84713269188d, 0d, 0d, 5e-5d)]
|
||||
[TestCase(0.3, 4e8, 0, 0, -706850.84713269188d, 0d, 0d, -5e-5d)]
|
||||
[TestCase(0.3, 4e8, 700000, 0, 0, 0.0088353506243542181d, 0d, 0d)]
|
||||
public void Run_ShouldPass_Circle(double diameter, double strength, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
ProgramSetting.NatSystem = NatSystems.EU;
|
||||
var headMaterial = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Reinforcement400);
|
||||
var options = new TriangulationOptions { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm };
|
||||
var primitive = new CirclePrimitive { Diameter = diameter, HeadMaterial = headMaterial, NdmMaxSize = 1, NdmMinDivision = 100 };
|
||||
var primitives = new List<INdmPrimitive>() { primitive };
|
||||
var ndmCollection = primitives.SelectMany(x => x.GetNdms(options));
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = 0.01,
|
||||
MaxIterationCount = 100,
|
||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
//Act
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var results = calculator.Result;
|
||||
//Assert
|
||||
Assert.NotNull(results);
|
||||
var strainMatrix = results.StrainMatrix;
|
||||
Assert.NotNull(strainMatrix);
|
||||
Assert.AreEqual(expectedKx, strainMatrix.Kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
|
||||
Assert.AreEqual(expectedKy, strainMatrix.Ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
|
||||
Assert.AreEqual(expectedEpsilonZ, strainMatrix.EpsZ, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsilonZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,9 @@ namespace LoaderCalculator.Tests.FunctionalTests.SectionTests
|
||||
_concreteDirector = new BuilderDirector(_concreteBuilder);
|
||||
}
|
||||
//Theoretical limit momemt Mx = 43kN*m
|
||||
[TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00084665917358052976d, 0.0d, 0.00020754144937701132d)]
|
||||
[TestCase(0.000113, 0.000494, 40e3, 0d, 0d, 0.0033939850380287412d, 0d, 0.00082989880025069202d)]
|
||||
[TestCase(0.000113, 0.000494, 42e3, 0d, 0d, 0.0056613831873867241d, 0d, 0.0014291081844183839d)]
|
||||
[TestCase(0.000113, 0.000494, 10e3, 0d, 0d, 0.00086859958095297091d, 0.0d, 0.00020547463647966653d)]
|
||||
//Theoretical limit momemt Mx = -187kN*m
|
||||
[TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011229555729294297d, 0d, 0.00021353225742956321d)]
|
||||
[TestCase(0.000113, 0.000494, -180e3, 0d, 0d, -0.0098365950945499738d, 0d, 0.0022035516889170013d)]
|
||||
[TestCase(0.000113, 0.000494, -183e3, 0d, 0d, -0.021718635290382458d, 0d, 0.0053526701372818789d)]
|
||||
[TestCase(0.000113, 0.000494, -50e3, 0d, 0d, -0.0011886813170062767d, 0d, 0.00020300578582187044d)]
|
||||
public void Run_ShouldPass(double topArea, double bottomArea, double mx, double my, double nz, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
@@ -71,18 +67,10 @@ namespace LoaderCalculator.Tests.FunctionalTests.SectionTests
|
||||
}
|
||||
//Longitudenal prestrain only
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0.0d, 0d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.001d, 0d, 0.0d, -4.410e-05d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.0015d, 0d, 0.0d, -6.666e-05d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.002d, 0d, 0.0d, -8.131e-05d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, 0.003d, 0d, 0.0d, -8.131e-05d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, -0.001d, 0d, 0.0d, 0.001d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, 0d, 0d, -0.002d, 0d, 0.0d, 0.002d)]
|
||||
//Curvature prestrain only
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, -1e-5d, 0d, 0d, 5.4638e-6d, 0.0d, 1.069e-06d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 0d, -1e-5d, 0d, 0d, 5.7463904747165557E-06d, 0.0d, 1.0286547851301493E-06d)]
|
||||
//Test shows that prestrain and external forces are neglegiate one by another
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 3.952e5d, 0d, 0d, 0.001d, 0d, 0.0d, 0d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 6.873e5d, 0d, 0d, 0.002d, 0d, 0.0d, -1.703e-8d)]
|
||||
[TestCase(0.000494, 0.000494, 0d, 0d, 6.873e5d, 0d, 0d, 0.003d, 0d, 0.0d, -3.796e-8d)]
|
||||
public void Run_ShouldPassPrestrain(double topArea, double bottomArea, double mx, double my, double nz, double prestrainKx, double prestrainKy, double prestrainEpsZ, double expectedKx, double expectedKy, double expectedEpsilonZ)
|
||||
{
|
||||
//Arrange
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="FunctionalTests\Ndms\SteelSections\" />
|
||||
<Folder Include="FunctionalTests\RCs\Anchorage\" />
|
||||
<Folder Include="UnitTests\WindowTests\Calculations\CalculationProperties\" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Calcuators
|
||||
{
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Calcuators
|
||||
{
|
||||
[TestFixture]
|
||||
public class LimitCurveCalculatorTest
|
||||
{
|
||||
[TestCase(10d, 20d)]
|
||||
public void Run_ShouldPass(double xmax, double ymax)
|
||||
{
|
||||
//Arrange
|
||||
var calculator = new LimitCurveCalculator(new StabLimitCurveLogic())
|
||||
{
|
||||
XMax = xmax,
|
||||
Ymax = ymax
|
||||
};
|
||||
//Act
|
||||
calculator.Run();
|
||||
var result = calculator.Result;
|
||||
//Assert
|
||||
Assert.IsNotNull(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
|
||||
namespace StructureHelperTests.UnitTests.Calcuators
|
||||
{
|
||||
[TestFixture]
|
||||
public class LimitCurveLogicTests
|
||||
{
|
||||
[Test]
|
||||
public void GetPoints_ValidPoints_ReturnsTransformedPoints()
|
||||
{
|
||||
// Arrange
|
||||
var parameterLogicMock = new Mock<ILimitCurveParameterLogic>();
|
||||
parameterLogicMock.Setup(p => p.GetParameter()).Returns(2.0); // Mocking the GetParameter method
|
||||
|
||||
var limitCurveLogic = new LimitCurveLogic(parameterLogicMock.Object);
|
||||
limitCurveLogic.LimitPredicate = point => point.X <= 0.5d; // Example predicate
|
||||
|
||||
var inputPoints = new List<IPoint2D>
|
||||
{
|
||||
new Point2D { X = 1, Y = 2 },
|
||||
new Point2D { X = 3, Y = 4 }
|
||||
// Add more points as needed
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = limitCurveLogic.GetPoints(inputPoints);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(inputPoints.Count, result.Count);
|
||||
|
||||
for (int i = 0; i < inputPoints.Count; i++)
|
||||
{
|
||||
Assert.AreEqual(inputPoints[i].X * 2.0, result[i].X);
|
||||
Assert.AreEqual(inputPoints[i].Y * 2.0, result[i].Y);
|
||||
}
|
||||
|
||||
// Verify that GetParameter was called
|
||||
parameterLogicMock.Verify(p => p.GetParameter(), Times.Exactly(inputPoints.Count));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetPoints_InvalidPredicate_ThrowsException()
|
||||
{
|
||||
// Arrange
|
||||
var parameterLogicMock = new Mock<ILimitCurveParameterLogic>();
|
||||
parameterLogicMock.Setup(p => p.GetParameter()).Returns(2.0);
|
||||
|
||||
var limitCurveLogic = new LimitCurveLogic(parameterLogicMock.Object);
|
||||
limitCurveLogic.LimitPredicate = point => false; // Invalid predicate
|
||||
|
||||
var inputPoints = new List<IPoint2D>
|
||||
{
|
||||
new Point2D { X = 1, Y = 2 },
|
||||
new Point2D { X = 3, Y = 4 }
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
Assert.Throws<StructureHelperException>(() => limitCurveLogic.GetPoints(inputPoints));
|
||||
}
|
||||
}
|
||||
}
|
||||