Anchoring isofields has been added

This commit is contained in:
Evgeny Redikultsev
2023-03-25 19:38:40 +05:00
parent a88fa40f29
commit 3d22c3440e
23 changed files with 599 additions and 112 deletions

View File

@@ -1,10 +1,14 @@
using LoaderCalculator.Data.Materials; using FieldVisualizer.Entities.Values.Primitives;
using LoaderCalculator.Data.Materials;
using LoaderCalculator.Data.Matrix; using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Data.Ndms;
using LoaderCalculator.Logics; using LoaderCalculator.Logics;
using StructureHelper.Infrastructure.UI.Converters.Units;
using StructureHelper.Infrastructure.UI.DataContexts; using StructureHelper.Infrastructure.UI.DataContexts;
using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings; using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Services.Units;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.Models.Primitives; using StructureHelperLogics.Models.Primitives;
using StructureHelperLogics.NdmCalculations.Analyses.RC; using StructureHelperLogics.NdmCalculations.Analyses.RC;
@@ -12,6 +16,7 @@ using StructureHelperLogics.NdmCalculations.Primitives;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Intrinsics.Arm;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -19,53 +24,139 @@ namespace StructureHelper.Services.ResultViewers
{ {
public static class ShowAnchorageResult public static class ShowAnchorageResult
{ {
private static IStressLogic stressLogic => new StressLogic(); internal static List<IPrimitiveSet> GetPrimitiveSets(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives)
public static void ShowAnchorageField (IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<PrimitiveBase> primitives)
{ {
foreach (var item in primitives) var primitiveSets = new List<IPrimitiveSet>();
{ PrimitiveSet primitiveSet;
if (item is ReinforcementViewPrimitive) primitiveSet = GetBaseDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives);
{ primitiveSets.Add(primitiveSet);
var primitive = item as ReinforcementViewPrimitive; primitiveSet = GetDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives, true);
var ndmPrimitive = primitive.GetNdmPrimitive() as ReinforcementPrimitive; primitiveSet.Name = "Development length full strength";
var inputData = new AnchorageInputData(); primitiveSets.Add(primitiveSet);
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive); primitiveSet = GetDevelopmentLength(strainMatrix, limitState, calcTerm, ndmPrimitives,false);
inputData.ReinforcementStrength = GetReinforcementStrength(limitState, calcTerm, ndmPrimitive); primitiveSet.Name = "Development length actual stress";
inputData.CrossSectionArea = ndmPrimitive.Area; primitiveSets.Add(primitiveSet);
var diameter = Math.Sqrt(ndmPrimitive.Area / Math.PI) * 2d; primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 0.5d, true);
inputData.CrossSectionPerimeter = Math.PI * diameter; primitiveSet.Name = "Lapping length full strength, r=50%";
var material = ndmPrimitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm); primitiveSets.Add(primitiveSet);
var ndm = ndmPrimitive.GetNdms(material).Single(); primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 1d, true);
inputData.ReinforcementStress = stressLogic.GetStress(strainMatrix, ndm); primitiveSet.Name = "Lapping length full strength, r=100%";
inputData.LappedCountRate = 0.5d; primitiveSets.Add(primitiveSet);
} primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 0.5d, false);
} primitiveSet.Name = "Lapping length actual stress, r=50%";
} primitiveSets.Add(primitiveSet);
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive) primitiveSet = GetFullStrengthLapLength(strainMatrix, limitState, calcTerm, ndmPrimitives, 1d, false);
{ primitiveSet.Name = "Lapping length actual stress, r=100%";
if (primitive.HostPrimitive is not null) primitiveSets.Add(primitiveSet);
{ primitiveSet = GetStrength(strainMatrix, limitState, calcTerm, ndmPrimitives, true);
var host = primitive.HostPrimitive; primitiveSet.Name = "Full strength";
var hostMaterial = host.HeadMaterial.HelperMaterial; primitiveSets.Add(primitiveSet);
if (hostMaterial is IConcreteLibMaterial) primitiveSet = GetStrength(strainMatrix, limitState, calcTerm, ndmPrimitives, false);
{ primitiveSet.Name = "Actual stress";
var concreteMaterial = hostMaterial as IConcreteLibMaterial; primitiveSets.Add(primitiveSet);
var concreteStrength = concreteMaterial.GetStrength(limitState, calcTerm).Tensile; return primitiveSets;
return concreteStrength;
}
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null");
} }
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive) private static PrimitiveSet GetStrength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives, bool fullStrength)
{ {
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial) PrimitiveSet primitiveSet = new PrimitiveSet();
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{ {
var material = primitive.HeadMaterial.HelperMaterial as IReinforcementLibMaterial; if (item is ReinforcementPrimitive)
var strength = material.GetStrength(limitState, calcTerm).Tensile; {
return strength; var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
if (fullStrength == true)
{
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
}
var val = inputData.ReinforcementStress * UnitConstatnts.Stress;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
} }
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null"); primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static PrimitiveSet GetBaseDevelopmentLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives)
{
PrimitiveSet primitiveSet = new PrimitiveSet() { Name = "Base Development Length"};
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
var calculator = new AnchorageCalculator(inputData);
var val = calculator.GetBaseDevLength() * UnitConstatnts.Length;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static PrimitiveSet GetDevelopmentLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives, bool fullStrength)
{
PrimitiveSet primitiveSet = new PrimitiveSet();
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, 1d);
if (fullStrength == true)
{
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
}
var calculator = new AnchorageCalculator(inputData);
var val = calculator.GetDevLength() * UnitConstatnts.Length;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static PrimitiveSet GetFullStrengthLapLength(IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, IEnumerable<INdmPrimitive> ndmPrimitives, double lapperdCountRate, bool fullStrength)
{
PrimitiveSet primitiveSet = new PrimitiveSet();
List<IValuePrimitive> primitives = new List<IValuePrimitive>();
foreach (var item in ndmPrimitives)
{
if (item is ReinforcementPrimitive)
{
var primitive = item as ReinforcementPrimitive;
var inputData = InputDataFactory.GetInputData(primitive, strainMatrix, limitState, calcTerm, lapperdCountRate);
if (fullStrength == true)
{
inputData.ReinforcementStress = inputData.ReinforcementStrength * Math.Sign(inputData.ReinforcementStress);
}
var calculator = new AnchorageCalculator(inputData);
var val = calculator.GetLapLength() * UnitConstatnts.Length;
var valuePrimitive = GetValuePrimitive(primitive, val);
primitives.Add(valuePrimitive);
}
}
primitiveSet.ValuePrimitives = primitives;
return primitiveSet;
}
private static FieldVisualizer.Entities.Values.Primitives.CirclePrimitive GetValuePrimitive(IPointPrimitive primitive, double val)
{
var valuePrimitive = new FieldVisualizer.Entities.Values.Primitives.CirclePrimitive()
{
CenterX = primitive.CenterX,
CenterY = primitive.CenterY,
Diameter = Math.Sqrt(primitive.Area / Math.PI) * 2,
Value = val
};
return valuePrimitive;
} }
} }
} }

View File

@@ -9,6 +9,9 @@
</ApplicationDefinition> </ApplicationDefinition>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Windows\Errors\ErrorMessage.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs"> <Compile Update="Windows\Forces\ForceCombinationByFactorView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@@ -23,6 +26,9 @@
<Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml"> <Page Update="Infrastructure\UI\Resources\ForceTemplates.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Windows\Errors\ErrorMessage.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Forces\ForceCombinationByFactorView.xaml"> <Page Update="Windows\Forces\ForceCombinationByFactorView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>

View File

@@ -0,0 +1,37 @@
<Window x:Class="StructureHelper.Windows.Errors.ErrorMessage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.Errors"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Errors"
d:DataContext="{d:DesignInstance vm:ErrorProcessor}"
mc:Ignorable="d"
Title="Error Message" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Width="500" Height="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--<Image Source="IconBug128.png"/>-->
<TabControl Grid.Column="1" x:Name="tabControl">
<TabItem Header="Short information" Margin="0">
<Grid Background="#FFE5E5E5">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock x:Name="HeaderText" TextWrapping="Wrap" Text="Happened something wrong" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" FontWeight="Bold"/>
<TextBlock Grid.Row="1" x:Name="MainText" TextWrapping="Wrap" Text="{Binding ShortText}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</TabItem>
<TabItem Header="Detailed Information">
<Grid Background="#FFE5E5E5">
<ScrollViewer>
<TextBlock x:Name="ExtendedText" TextWrapping="Wrap" Text="{Binding DetailText}"/>
</ScrollViewer>
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>

View File

@@ -0,0 +1,31 @@
using StructureHelper.Windows.ViewModels.Errors;
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.Errors
{
/// <summary>
/// Логика взаимодействия для ErrorMessage.xaml
/// </summary>
public partial class ErrorMessage : Window
{
ErrorProcessor vm;
public ErrorMessage(ErrorProcessor errorProcessor)
{
vm = errorProcessor;
this.DataContext = vm;
InitializeComponent();
}
}
}

View File

@@ -7,16 +7,17 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels namespace StructureHelper.Windows.ViewModels
{ {
public abstract class CRUDViewModelBase<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class public abstract class CRUDViewModelBase<TItem> : ViewModelBase, ICRUDViewModel<TItem> where TItem : class
{ {
private RelayCommand addCommand; private ICommand addCommand;
private RelayCommand deleteCommand; private ICommand deleteCommand;
private RelayCommand copyCommand; private ICommand copyCommand;
private RelayCommand editCommand; private ICommand editCommand;
public List<TItem> Collection { get; set; } public List<TItem> Collection { get; set; }
@@ -25,7 +26,7 @@ namespace StructureHelper.Windows.ViewModels
public ObservableCollection<TItem> Items { get; private set; } public ObservableCollection<TItem> Items { get; private set; }
public RelayCommand Add public ICommand Add
{ {
get get
{ {
@@ -43,7 +44,7 @@ namespace StructureHelper.Windows.ViewModels
Collection.Add(NewItem); Collection.Add(NewItem);
Items.Add(NewItem); Items.Add(NewItem);
} }
public RelayCommand Delete public ICommand Delete
{ {
get get
{ {
@@ -61,7 +62,7 @@ namespace StructureHelper.Windows.ViewModels
Collection.Remove(SelectedItem); Collection.Remove(SelectedItem);
Items.Remove(SelectedItem); Items.Remove(SelectedItem);
} }
public RelayCommand Edit public ICommand Edit
{ {
get get
{ {
@@ -84,7 +85,7 @@ namespace StructureHelper.Windows.ViewModels
OnPropertyChanged(nameof(Items)); OnPropertyChanged(nameof(Items));
} }
public RelayCommand Copy public ICommand Copy
{ {
get get
{ {

View File

@@ -7,8 +7,10 @@ using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers; using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews; using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews; using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
using StructureHelper.Windows.Errors;
using StructureHelper.Windows.Forces; using StructureHelper.Windows.Forces;
using StructureHelper.Windows.PrimitivePropertiesWindow; using StructureHelper.Windows.PrimitivePropertiesWindow;
using StructureHelper.Windows.ViewModels.Errors;
using StructureHelper.Windows.ViewModels.Forces; using StructureHelper.Windows.ViewModels.Forces;
using StructureHelper.Windows.ViewModels.PrimitiveProperties; using StructureHelper.Windows.ViewModels.PrimitiveProperties;
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
@@ -74,7 +76,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
} }
} }
public RelayCommand ExportToCSVCommand public ICommand ExportToCSVCommand
{ {
get get
{ {
@@ -105,7 +107,12 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new StructureHelperException(ErrorStrings.FileCantBeDeleted + ex + filename); var vm = new ErrorProcessor()
{
ShortText = ErrorStrings.FileCantBeDeleted + ex + filename,
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
} }
} }
@@ -115,15 +122,21 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
logic.Export(forcesResults); logic.Export(forcesResults);
try try
{ {
Process filopener = new Process(); var filopener = new Process();
filopener.StartInfo.FileName = saveFileDialog.FileName; var startInfo = new ProcessStartInfo(saveFileDialog.FileName) { UseShellExecute = true};
filopener.StartInfo = startInfo;
filopener.Start(); filopener.Start();
} }
catch (Exception) { } catch (Exception) { }
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new StructureHelperException(ErrorStrings.FileCantBeSaved + ex + filename); var vm = new ErrorProcessor()
{
ShortText = ErrorStrings.FileCantBeSaved + ex + filename,
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
} }
} }
} }
@@ -209,7 +222,24 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private void showAnchorage() private void showAnchorage()
{ {
throw new NotImplementedException(); try
{
var strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
var limitState = SelectedResult.DesignForceTuple.LimitState;
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
var primitiveSets = ShowAnchorageResult.GetPrimitiveSets(strainMatrix, limitState, calcTerm, ndmPrimitives);
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
}
catch(Exception ex)
{
var vm = new ErrorProcessor()
{ ShortText = "Errors apearred during showing isofield, see detailed information",
DetailText = $"{ex}"};
new ErrorMessage(vm).ShowDialog();
}
} }
public ForcesResultsViewModel(IForceCalculator forceCalculator) public ForcesResultsViewModel(IForceCalculator forceCalculator)
@@ -221,10 +251,23 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private void ShowIsoField() private void ShowIsoField()
{ {
IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix; try
var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs()); {
isoFieldReport = new IsoFieldReport(primitiveSets); IStrainMatrix strainMatrix = SelectedResult.LoaderResults.ForceStrainPair.StrainMatrix;
isoFieldReport.Show(); var primitiveSets = ShowIsoFieldResult.GetPrimitiveSets(strainMatrix, ndms, ResultFuncFactory.GetResultFuncs());
isoFieldReport = new IsoFieldReport(primitiveSets);
isoFieldReport.Show();
}
catch (Exception ex)
{
var vm = new ErrorProcessor()
{
ShortText = "Errors apearred during showing isofield, see detailed information",
DetailText = $"{ex}"
};
new ErrorMessage(vm).ShowDialog();
}
} }
private void GetNdms() private void GetNdms()

View File

@@ -12,30 +12,30 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
public class SetPrestrainViewModel : ViewModelBase public class SetPrestrainViewModel : ViewModelBase
{ {
IStrainTuple SourceTuple; IStrainTuple SourceTuple;
private double coeffcient; private double coefficient;
public double Coefficient public double Coefficient
{ {
get get
{ {
return coeffcient; return coefficient;
} }
set set
{ {
SetProperty(ref coeffcient, value); SetProperty(ref coefficient, value);
} }
} }
public SetPrestrainViewModel(IStrainTuple sourceTuple) public SetPrestrainViewModel(IStrainTuple sourceTuple)
{ {
SourceTuple = sourceTuple; SourceTuple = sourceTuple;
coeffcient = 1d; coefficient = 1d;
} }
public IStrainTuple GetStrainTuple() public IStrainTuple GetStrainTuple()
{ {
var result = new StrainTuple(); var result = new StrainTuple();
StrainTupleService.CopyProperties(SourceTuple, result, coeffcient); StrainTupleService.CopyProperties(SourceTuple, result, coefficient);
return result; return result;
} }
} }

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelper.Windows.ViewModels.Errors
{
public class ErrorProcessor
{
public string? ShortText { get; set; }
public string? DetailText { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels namespace StructureHelper.Windows.ViewModels
{ {
@@ -13,10 +14,10 @@ namespace StructureHelper.Windows.ViewModels
{ {
TItem SelectedItem { get; set; } TItem SelectedItem { get; set; }
ObservableCollection<TItem> Items { get; } ObservableCollection<TItem> Items { get; }
RelayCommand Add { get; } ICommand Add { get; }
RelayCommand Delete { get; } ICommand Delete { get; }
RelayCommand Edit { get; } ICommand Edit { get; }
RelayCommand Copy { get; } ICommand Copy { get; }
void AddItems(IEnumerable<TItem> items); void AddItems(IEnumerable<TItem> items);
} }
} }

View File

@@ -23,8 +23,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public ObservableCollection<IForceAction> Items { get; private set; } public ObservableCollection<IForceAction> Items { get; private set; }
private RelayCommand addForceCombinationCommand; private ICommand addForceCombinationCommand;
public RelayCommand Add public ICommand Add
{ {
get get
{ {
@@ -43,8 +43,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
Items.Add(item); Items.Add(item);
repository.ForceActions.Add(item); repository.ForceActions.Add(item);
} }
private RelayCommand deleteForceCombinationCommand; private ICommand deleteForceCombinationCommand;
public RelayCommand Delete public ICommand Delete
{ {
get get
{ {
@@ -65,10 +65,10 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
repository.ForceActions.Remove(SelectedItem); repository.ForceActions.Remove(SelectedItem);
} }
} }
private RelayCommand editForceCombinationCommand; private ICommand editForceCombinationCommand;
private RelayCommand copyCommand; private ICommand copyCommand;
public RelayCommand Edit public ICommand Edit
{ {
get get
{ {
@@ -84,7 +84,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
} }
} }
public RelayCommand Copy public ICommand Copy
{ {
get get
{ {

View File

@@ -19,6 +19,7 @@ using System.Windows.Forms;
using System.Windows.Documents; using System.Windows.Documents;
using StructureHelper.Windows.PrimitiveProperiesWindow; using StructureHelper.Windows.PrimitiveProperiesWindow;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System.Windows.Input;
namespace StructureHelper.Windows.ViewModels.NdmCrossSections namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{ {
@@ -26,12 +27,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
{ {
private ICrossSection section; private ICrossSection section;
private ICrossSectionRepository repository => section.SectionRepository; private ICrossSectionRepository repository => section.SectionRepository;
private RelayCommand addCommand; private ICommand addCommand;
private RelayCommand deleteCommand; private ICommand deleteCommand;
private RelayCommand editCommand; private ICommand editCommand;
private RelayCommand copyCommand; private ICommand copyCommand;
private RelayCommand setToFront; private ICommand setToFront;
private RelayCommand setToBack; private ICommand setToBack;
public double CanvasWidth { get; set; } public double CanvasWidth { get; set; }
public double CanvasHeight { get; set; } public double CanvasHeight { get; set; }
@@ -40,7 +41,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public ObservableCollection<PrimitiveBase> Items { get; private set; } public ObservableCollection<PrimitiveBase> Items { get; private set; }
public RelayCommand Add public ICommand Add
{ {
get get
{ {
@@ -106,7 +107,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
OnPropertyChanged(nameof(PrimitivesCount)); OnPropertyChanged(nameof(PrimitivesCount));
} }
public RelayCommand Delete public ICommand Delete
{ {
get get
{ {
@@ -148,7 +149,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
OnPropertyChanged(nameof(PrimitivesCount)); OnPropertyChanged(nameof(PrimitivesCount));
} }
public RelayCommand Edit public ICommand Edit
{ {
get get
{ {
@@ -166,7 +167,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
wnd.ShowDialog(); wnd.ShowDialog();
} }
public RelayCommand Copy public ICommand Copy
{ {
get get
{ {
@@ -197,7 +198,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
public int PrimitivesCount => repository.Primitives.Count(); public int PrimitivesCount => repository.Primitives.Count();
public RelayCommand SetToFront public ICommand SetToFront
{ {
get get
{ {
@@ -226,7 +227,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
else return false; else return false;
} }
public RelayCommand SetToBack public ICommand SetToBack
{ {
get get
{ {

View File

@@ -10,6 +10,7 @@ using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.ColorServices; using StructureHelperCommon.Services.ColorServices;
using StructureHelperLogics.Models.CrossSections; using StructureHelperLogics.Models.CrossSections;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperLogics.NdmCalculations.Primitives;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -19,6 +20,7 @@ using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Xml.Linq; using System.Xml.Linq;
@@ -314,7 +316,33 @@ namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
foreach (var item in sectionRepository.Primitives) foreach (var item in sectionRepository.Primitives)
{ {
if (item is RectanglePrimitive || item is CirclePrimitive) if (item is RectanglePrimitive || item is CirclePrimitive)
{HostPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));} {
CheckHost(primitive, item);
HostPrimitives.Add(PrimitiveOperations.ConvertNdmPrimitiveToPrimitiveBase(item));
}
}
}
private void CheckHost(PrimitiveBase primitive, INdmPrimitive item)
{
var ndm = primitive.GetNdmPrimitive();
if (ndm is ReinforcementPrimitive)
{
var host = item as IHasDivisionSize;
var reinforcement = ndm as ReinforcementPrimitive;
if (host.IsPointInside(new Point2D() { X = reinforcement.CenterX, Y = reinforcement.CenterY })
&& reinforcement.HostPrimitive is null)
{
var dialogResult = MessageBox.Show($"Primitive {reinforcement.Name} is inside primitive {item.Name}",
"Assign new host?",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Yes)
{
reinforcement.HostPrimitive = item;
}
}
} }
} }

View File

@@ -2,15 +2,15 @@
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings; using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Materials.Libraries; using StructureHelperCommon.Models.Materials.Libraries;
using LCM = LoaderCalculator.Data.Materials; using LoaderMaterials = LoaderCalculator.Data.Materials;
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders; using LoaderMaterialBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Infrastructures.Settings;
using LCMBML = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics; using LoaderMaterialLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
namespace StructureHelperLogics.Models.Materials namespace StructureHelperLogics.Models.Materials
{ {
@@ -22,13 +22,13 @@ namespace StructureHelperLogics.Models.Materials
public bool TensionForSLS { get; set; } public bool TensionForSLS { get; set; }
private IMaterialOptionLogic optionLogic; private IMaterialOptionLogic optionLogic;
private LCMBML.ITrueStrengthLogic strengthLogic; private LoaderMaterialLogic.ITrueStrengthLogic strengthLogic;
public ConcreteLibMaterial() public ConcreteLibMaterial()
{ {
SafetyFactors = new List<IMaterialSafetyFactor>(); SafetyFactors = new List<IMaterialSafetyFactor>();
SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType)); SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType));
optionLogic = new MaterialOptionLogic(new LCMB.ConcreteOptions()); optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ConcreteOptions());
TensionForULS = false; TensionForULS = false;
TensionForSLS = true; TensionForSLS = true;
} }
@@ -38,9 +38,9 @@ namespace StructureHelperLogics.Models.Materials
return new ConcreteLibMaterial() { MaterialEntity = MaterialEntity, TensionForULS = TensionForULS, TensionForSLS = TensionForSLS }; return new ConcreteLibMaterial() { MaterialEntity = MaterialEntity, TensionForULS = TensionForULS, TensionForSLS = TensionForSLS };
} }
public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm) public LoaderMaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{ {
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm) as LCMB.ConcreteOptions; var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm) as LoaderMaterialBuilders.ConcreteOptions;
materialOptions.WorkInTension = false; materialOptions.WorkInTension = false;
if (limitState == LimitStates.ULS & TensionForULS == true) if (limitState == LimitStates.ULS & TensionForULS == true)
{ {
@@ -53,8 +53,8 @@ namespace StructureHelperLogics.Models.Materials
var strength = GetStrengthFactors(limitState, calcTerm); var strength = GetStrengthFactors(limitState, calcTerm);
materialOptions.ExternalFactor.Compressive = strength.Compressive; materialOptions.ExternalFactor.Compressive = strength.Compressive;
materialOptions.ExternalFactor.Tensile = strength.Tensile; materialOptions.ExternalFactor.Tensile = strength.Tensile;
LCMB.IMaterialBuilder builder = new LCMB.ConcreteBuilder(materialOptions); LoaderMaterialBuilders.IMaterialBuilder builder = new LoaderMaterialBuilders.ConcreteBuilder(materialOptions);
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder); LoaderMaterialBuilders.IBuilderDirector director = new LoaderMaterialBuilders.BuilderDirector(builder);
return director.BuildMaterial(); return director.BuildMaterial();
} }
@@ -72,9 +72,19 @@ namespace StructureHelperLogics.Models.Materials
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm) public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
{ {
strengthLogic = new LCMBML.TrueStrengthConcreteLogicSP63_2018(MaterialEntity.MainStrength); strengthLogic = new LoaderMaterialLogic.TrueStrengthConcreteLogicSP63_2018(MaterialEntity.MainStrength);
var strength = strengthLogic.GetTrueStrength(); var strength = strengthLogic.GetTrueStrength();
return (strength.Comressive, strength.Tensile); double compressionFactor = 1d;
double tensionFactor = 1d;
if (limitState == LimitStates.ULS)
{
compressionFactor /= 1.3d;
tensionFactor /= 1.5d;
var factors = GetStrengthFactors(limitState, calcTerm);
compressionFactor *= factors.Compressive;
tensionFactor *= factors.Tensile;
}
return (strength.Comressive * compressionFactor, strength.Tensile * tensionFactor);
} }
} }
} }

View File

@@ -16,6 +16,7 @@ namespace StructureHelperLogics.Models.Materials
{ {
Concrete40, Concrete40,
Reinforecement400, Reinforecement400,
Reinforecement500,
Elastic200 Elastic200
} }
@@ -30,10 +31,21 @@ namespace StructureHelperLogics.Models.Materials
codeType = code; codeType = code;
if (type == HeadmaterialType.Concrete40) { return GetConcrete40(); } if (type == HeadmaterialType.Concrete40) { return GetConcrete40(); }
if (type == HeadmaterialType.Reinforecement400) { return GetReinforcement400(); } if (type == HeadmaterialType.Reinforecement400) { return GetReinforcement400(); }
if (type == HeadmaterialType.Reinforecement500) { return GetReinforcement500(); }
if (type == HeadmaterialType.Elastic200) { return GetElastic200(); } if (type == HeadmaterialType.Elastic200) { return GetElastic200(); }
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(type)); else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + nameof(type));
} }
private static IHeadMaterial GetReinforcement500()
{
var material = new HeadMaterial() { Name = "New reinforcement" };
var libMaterial = LibReinforcementMaterials.Where(x => x.Name.Contains("500")).First();
var libMat = new ReinforcementLibMaterial();
libMat.MaterialEntity = libMaterial;
material.HelperMaterial = libMat;
return material;
}
private static IHeadMaterial GetElastic200() private static IHeadMaterial GetElastic200()
{ {
var material = new HeadMaterial(); var material = new HeadMaterial();

View File

@@ -5,9 +5,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using LCM = LoaderCalculator.Data.Materials; using Loadermaterials = LoaderCalculator.Data.Materials;
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders; using LoaderMaterialBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
using LCMBML = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics; using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
namespace StructureHelperLogics.Models.Materials namespace StructureHelperLogics.Models.Materials
{ {
@@ -17,12 +17,12 @@ namespace StructureHelperLogics.Models.Materials
public List<IMaterialSafetyFactor> SafetyFactors { get; } public List<IMaterialSafetyFactor> SafetyFactors { get; }
private IMaterialOptionLogic optionLogic; private IMaterialOptionLogic optionLogic;
private LCMBML.ITrueStrengthLogic strengthLogic; private LoaderMaterialLogics.ITrueStrengthLogic strengthLogic;
public ReinforcementLibMaterial() public ReinforcementLibMaterial()
{ {
SafetyFactors = new List<IMaterialSafetyFactor>(); SafetyFactors = new List<IMaterialSafetyFactor>();
optionLogic = new MaterialOptionLogic(new LCMB.ReinforcementOptions()); optionLogic = new MaterialOptionLogic(new LoaderMaterialBuilders.ReinforcementOptions());
} }
public object Clone() public object Clone()
@@ -30,14 +30,14 @@ namespace StructureHelperLogics.Models.Materials
return new ReinforcementLibMaterial() { MaterialEntity = MaterialEntity}; return new ReinforcementLibMaterial() { MaterialEntity = MaterialEntity};
} }
public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm) public Loadermaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{ {
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm); var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
var strength = GetStrengthFactors(limitState, calcTerm); var strength = GetStrengthFactors(limitState, calcTerm);
materialOptions.ExternalFactor.Compressive = strength.Compressive; materialOptions.ExternalFactor.Compressive = strength.Compressive;
materialOptions.ExternalFactor.Tensile = strength.Tensile; materialOptions.ExternalFactor.Tensile = strength.Tensile;
LCMB.IMaterialBuilder builder = new LCMB.ReinforcementBuilder(materialOptions); LoaderMaterialBuilders.IMaterialBuilder builder = new LoaderMaterialBuilders.ReinforcementBuilder(materialOptions);
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder); LoaderMaterialBuilders.IBuilderDirector director = new LoaderMaterialBuilders.BuilderDirector(builder);
return director.BuildMaterial(); return director.BuildMaterial();
} }
@@ -55,9 +55,32 @@ namespace StructureHelperLogics.Models.Materials
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm) public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
{ {
strengthLogic = new LCMBML.TrueStrengthReinforcementLogic(MaterialEntity.MainStrength); strengthLogic = new LoaderMaterialLogics.TrueStrengthReinforcementLogic(MaterialEntity.MainStrength);
var strength = strengthLogic.GetTrueStrength(); var strength = strengthLogic.GetTrueStrength();
return (strength.Comressive, strength.Tensile); double compressionFactor = 1d;
double tensionFactor = 1d;
if (limitState == LimitStates.ULS)
{
compressionFactor /= 1.15d;
tensionFactor /= 1.15d;
}
var factors = GetStrengthFactors(limitState, calcTerm);
compressionFactor *= factors.Compressive;
tensionFactor *= factors.Tensile;
var compressiveStrength = strength.Comressive * compressionFactor;
if (limitState == LimitStates.ULS)
{
if (calcTerm == CalcTerms.ShortTerm)
{
compressiveStrength = Math.Min(4e8, compressiveStrength);
}
else
{
compressiveStrength = Math.Min(5e8, compressiveStrength);
}
}
var tensileStrength = strength.Tensile * tensionFactor;
return (compressiveStrength, tensileStrength);
} }
} }
} }

View File

@@ -22,7 +22,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
public double GetBaseDevLength() public double GetBaseDevLength()
{ {
return anchorage.GetBaseDevLength(); var val = anchorage.GetBaseDevLength();
return val;
} }
public double GetDevLength() public double GetDevLength()
@@ -40,6 +41,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
var anchorageOptions = new AnchorageOptionsSP63(); var anchorageOptions = new AnchorageOptionsSP63();
anchorageOptions.ConcreteStrength = inputData.ConcreteStrength; anchorageOptions.ConcreteStrength = inputData.ConcreteStrength;
anchorageOptions.ReinforcementStrength = inputData.ReinforcementStrength; anchorageOptions.ReinforcementStrength = inputData.ReinforcementStrength;
anchorageOptions.FactorEta1 = inputData.FactorEta1;
anchorageOptions.ReinforcementStress = inputData.ReinforcementStress; anchorageOptions.ReinforcementStress = inputData.ReinforcementStress;
anchorageOptions.CrossSectionArea = inputData.CrossSectionArea; anchorageOptions.CrossSectionArea = inputData.CrossSectionArea;
anchorageOptions.CrossSectionPerimeter = inputData.CrossSectionPerimeter; anchorageOptions.CrossSectionPerimeter = inputData.CrossSectionPerimeter;

View File

@@ -14,5 +14,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
public double CrossSectionPerimeter { get; set; } public double CrossSectionPerimeter { get; set; }
public double ReinforcementStress { get; set; } public double ReinforcementStress { get; set; }
public double LappedCountRate { get; set; } public double LappedCountRate { get; set; }
public double FactorEta1 { get; set; }
public bool IsPrestressed { get; set; }
} }
} }

View File

@@ -10,10 +10,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.RC
{ {
double ConcreteStrength { get; set; } double ConcreteStrength { get; set; }
double ReinforcementStrength { get; set; } double ReinforcementStrength { get; set; }
double FactorEta1 { get; set; }
double CrossSectionArea { get; set; } double CrossSectionArea { get; set; }
double CrossSectionPerimeter { get; set; } double CrossSectionPerimeter { get; set; }
double ReinforcementStress { get; set; } double ReinforcementStress { get; set; }
double LappedCountRate { get; set; } double LappedCountRate { get; set; }
bool IsPrestressed { get; set; }
} }
} }

View File

@@ -0,0 +1,74 @@
using LoaderCalculator.Data.Matrix;
using LoaderCalculator.Logics;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.RC
{
public static class InputDataFactory
{
private static IStressLogic stressLogic => new StressLogic();
public static IAnchorageInputData GetInputData(ReinforcementPrimitive ndmPrimitive, IStrainMatrix strainMatrix, LimitStates limitState, CalcTerms calcTerm, double lappedCountRate)
{
var inputData = new AnchorageInputData();
inputData.ConcreteStrength = GetConcreteStrength(limitState, calcTerm, ndmPrimitive);
inputData.ReinforcementStrength = GetReinforcementStrength(limitState, calcTerm, ndmPrimitive);
inputData.FactorEta1 = 2.5d;
inputData.CrossSectionArea = ndmPrimitive.Area;
var diameter = Math.Sqrt(ndmPrimitive.Area / Math.PI) * 2d;
inputData.CrossSectionPerimeter = Math.PI * diameter;
if (ndmPrimitive.HeadMaterial is null)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": main material is incorrect or null");
}
var material = ndmPrimitive.HeadMaterial.GetLoaderMaterial(limitState, calcTerm);
var ndm = ndmPrimitive.GetNdms(material).Single();
if (strainMatrix is not null)
{
inputData.ReinforcementStress = stressLogic.GetStress(strainMatrix, ndm);
}
else
{
inputData.ReinforcementStress = inputData.ReinforcementStrength;
}
inputData.IsPrestressed = ndm.Prestrain > 0.0005d ? true : false;
inputData.LappedCountRate = lappedCountRate;
return inputData;
}
private static double GetConcreteStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
{
if (primitive.HostPrimitive is not null)
{
var host = primitive.HostPrimitive;
var hostMaterial = host.HeadMaterial.HelperMaterial;
if (hostMaterial is IConcreteLibMaterial)
{
var concreteMaterial = hostMaterial as IConcreteLibMaterial;
var concreteStrength = concreteMaterial.GetStrength(limitState, calcTerm).Tensile;
return concreteStrength;
}
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host material is incorrect or null");
}
private static double GetReinforcementStrength(LimitStates limitState, CalcTerms calcTerm, ReinforcementPrimitive primitive)
{
if (primitive.HeadMaterial.HelperMaterial is IReinforcementLibMaterial)
{
var material = primitive.HeadMaterial.HelperMaterial as IReinforcementLibMaterial;
var strength = material.GetStrength(limitState, calcTerm).Tensile;
return strength;
}
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": host's material is incorrect or null");
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using StructureHelperLogics.NdmCalculations.Analyses.RC;
namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.AnchorageCalculatorTest
{
public class AnchorageCalculatorTest
{
[TestCase(0.012d, 0d, 0.416d)]
[TestCase(0.025d, 0d, 0.867d)]
[TestCase(0.032d, 0d, 1.110d)]
[TestCase(0.036d, 0d, 1.388d)]
public void Run_ShouldPass(double diameter, double stress, double expectedBaseDevLength)
{
//Arrange
var inputData = new AnchorageInputData();
inputData.ConcreteStrength = 1e6; //Pa
inputData.ReinforcementStrength = 347e6; //Pa
inputData.FactorEta1 = 2.5d;
inputData.CrossSectionArea = Math.PI * diameter * diameter / 4d;
inputData.CrossSectionPerimeter = Math.PI * diameter;
inputData.ReinforcementStress = stress;
var calculator = new AnchorageCalculator(inputData);
//Act
var baseLength = calculator.GetBaseDevLength();
//Assert
Assert.AreEqual(expectedBaseDevLength, baseLength, 0.001d);
}
}
}

View File

@@ -1,9 +1,11 @@
using LoaderCalculator.Tests.Infrastructures.Logics; using LoaderCalculator.Tests.Infrastructures.Logics;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using StructureHelperCommon.Services.Forces;
using StructureHelperLogics.Models.Templates.CrossSections.RCs; using StructureHelperLogics.Models.Templates.CrossSections.RCs;
using StructureHelperLogics.Models.Templates.RCs; using StructureHelperLogics.Models.Templates.RCs;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorTests namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorTests
{ {
@@ -55,5 +57,37 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
Assert.True(calcResult == result.IsValid); Assert.True(calcResult == result.IsValid);
Assert.True(firstForceResult == result.ForcesResultList[0].IsValid); Assert.True(firstForceResult == result.ForcesResultList[0].IsValid);
} }
[TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, 0d, 0d, 0d)]
public void Run_ShouldPassPrestrain(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, double expectedKx, double expectedKy, double expectedEpsZ)
{
//Arrange
var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
var calculator = newSection.SectionRepository.CalculatorsList[0] as IForceCalculator;
calculator.CompressedMember.Buckling = false;
calculator.Run();
var ndmPrimitives = newSection.SectionRepository.Primitives;
var result = calculator.Result as IForcesResults;
var strainMatrix = result.ForcesResultList[0].LoaderResults.StrainMatrix;
var source = StrainTupleService.ConvertToStrainTuple(strainMatrix);
//Act
foreach (var item in ndmPrimitives)
{
StrainTupleService.CopyProperties(source, item.AutoPrestrain);
}
calculator.Run();
var result2 = calculator.Result as IForcesResults;
//Assert
Assert.IsNotNull(result2);
Assert.IsTrue(result2.IsValid);
var strainMatrix2 = result2.ForcesResultList[0].LoaderResults.StrainMatrix;
var kx = strainMatrix2.Kx;
var ky = strainMatrix2.Ky;
var epsz = strainMatrix2.EpsZ;
Assert.AreEqual(expectedKx, kx, 1e-10);
Assert.AreEqual(expectedKy, ky, 1e-10);
Assert.AreEqual(expectedEpsZ, epsz, 1e-10);
}
} }
} }

View File

@@ -29,4 +29,8 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="FunctionalTests\RCs\Anchorage\" />
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperLogics.Models.Materials;
namespace StructureHelperTests.UnitTests.MaterialTests
{
public class MaterialStrengthTest
{
[TestCase(HeadmaterialType.Reinforecement400, CodeTypes.SP63_13330_2018, LimitStates.ULS, CalcTerms.ShortTerm, 347826086.95652175d, 347826086.95652175d)]
[TestCase(HeadmaterialType.Reinforecement400, CodeTypes.SP63_13330_2018, LimitStates.SLS, CalcTerms.ShortTerm, 400000000d, 400000000d)]
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_13330_2018, LimitStates.ULS, CalcTerms.ShortTerm, 400000000.0d, 434782608.69565225d)]
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_13330_2018, LimitStates.ULS, CalcTerms.LongTerm, 434782608.69565225d, 434782608.69565225d)]
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_13330_2018, LimitStates.SLS, CalcTerms.ShortTerm, 5e8d, 5e8d)]
[TestCase(HeadmaterialType.Reinforecement500, CodeTypes.SP63_13330_2018, LimitStates.SLS, CalcTerms.ShortTerm, 5e8d, 5e8d)]
[TestCase(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018, LimitStates.ULS, CalcTerms.ShortTerm, 22461538.46153846d, 1395297.0017909051d)]
[TestCase(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018, LimitStates.ULS, CalcTerms.LongTerm, 20215384.615384616d, 1255767.3016118146d)]
[TestCase(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018, LimitStates.SLS, CalcTerms.ShortTerm, 29200000.0d, 2092945.5026863578d)]
[TestCase(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018, LimitStates.SLS, CalcTerms.LongTerm, 29200000.0d, 2092945.5026863578d)]
public void Run_ShouldPass(HeadmaterialType headmaterialType, CodeTypes code, LimitStates limitState, CalcTerms calcTerm, double expectedCompressive, double expectedTensile)
{
//Arrange
var material = HeadMaterialFactory.GetHeadMaterial(headmaterialType, code);
var libMaterial = material.HelperMaterial as ILibMaterial;
//Act
var compressive = libMaterial.GetStrength(limitState, calcTerm).Compressive;
var tensile = libMaterial.GetStrength(limitState, calcTerm).Tensile;
//Assert
Assert.AreEqual(expectedCompressive, compressive, 1d);
Assert.AreEqual(expectedTensile, tensile, 1d);
}
}
}