Force calculator was repaired for buckling calculations
This commit is contained in:
@@ -51,6 +51,20 @@
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ToolButton" TargetType="Button">
|
||||
<Style.Resources>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Width" Value="32"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.25"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Style.Resources>
|
||||
<Setter Property="Width" Value="32"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="Margin" Value="2,0,2,0"/>
|
||||
|
||||
@@ -61,21 +61,27 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
|
||||
public void ShowCracks()
|
||||
{
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
||||
|
||||
List<string> labels = GetCrackLabels(unitForce, unitMoment, unitCurvature);
|
||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
||||
CalculateWithCrack(ValidTupleList, NdmPrimitives, unitForce, unitMoment, unitCurvature);
|
||||
List<string> labels = GetCrackLabels();
|
||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels);
|
||||
CalculateWithCrack(ValidTupleList,
|
||||
NdmPrimitives,
|
||||
CommonOperation.GetUnit(UnitTypes.Force),
|
||||
CommonOperation.GetUnit(UnitTypes.Moment),
|
||||
CommonOperation.GetUnit(UnitTypes.Curvature));
|
||||
}
|
||||
|
||||
public void ShowWindow()
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
{
|
||||
var series = new Series(arrayParameter) { Name = "Forces and curvatures" };
|
||||
var vm = new GraphViewModel(new List<Series>() { series });
|
||||
var series = new Series(arrayParameter)
|
||||
{
|
||||
Name = "Forces and curvatures"
|
||||
};
|
||||
var vm = new GraphViewModel(new List<Series>()
|
||||
{
|
||||
series
|
||||
});
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
},
|
||||
@@ -132,11 +138,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
}
|
||||
}
|
||||
|
||||
private static List<string> GetCrackLabels(IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
||||
private static List<string> GetCrackLabels()
|
||||
{
|
||||
const string crc = "Crc";
|
||||
const string crcFactor = "CrcSofteningFactor";
|
||||
var labels = LabelsFactory.GetLabels();
|
||||
var labels = LabelsFactory.GetCommonLabels();
|
||||
IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
var crclabels = new List<string>
|
||||
{
|
||||
$"{crc}{GeometryNames.CurvFstName}, {unitCurvature.Name}",
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public static class LabelsFactory
|
||||
{
|
||||
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
||||
private static IUnit unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
private static IUnit unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
private static IUnit unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
private static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||
public static List<string> GetLabels()
|
||||
public static List<string> GetCommonLabels()
|
||||
{
|
||||
var labels = new List<string>
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models;
|
||||
@@ -17,12 +18,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
{
|
||||
internal class ShowDiagramLogic : ILongProcessLogic
|
||||
{
|
||||
ArrayParameter<double> arrayParameter;
|
||||
private IEnumerable<IForcesTupleResult> TupleList;
|
||||
private IEnumerable<INdmPrimitive> NdmPrimitives;
|
||||
private List<IForcesTupleResult> ValidTupleList;
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
private IEnumerable<IForcesTupleResult> tupleList;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private List<IForcesTupleResult> validTupleList;
|
||||
|
||||
public int StepCount => ValidTupleList.Count();
|
||||
public int StepCount => validTupleList.Count();
|
||||
|
||||
public Action<int> SetProgress { get; set; }
|
||||
public bool Result { get; set; }
|
||||
@@ -51,34 +52,30 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
var vm = new GraphViewModel(new List<Series>() { series });
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
},
|
||||
"Errors appeared during showing a graph, see detailed information");
|
||||
}, ErrorStrings.ErrorDuring("building chart"));
|
||||
}
|
||||
private void Show()
|
||||
{
|
||||
ValidTupleList = TupleList.Where(x => x.IsValid == true).ToList();
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force, "kN");
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment, "kNm");
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature, "1/m");
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
|
||||
var labels = LabelsFactory.GetLabels();
|
||||
arrayParameter = new ArrayParameter<double>(ValidTupleList.Count(), labels.Count(), labels);
|
||||
CalculateWithoutCrack(ValidTupleList, unitForce, unitMoment, unitCurvature);
|
||||
var labels = LabelsFactory.GetCommonLabels();
|
||||
arrayParameter = new ArrayParameter<double>(validTupleList.Count(), labels);
|
||||
Calculate();
|
||||
}
|
||||
|
||||
public ShowDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
{
|
||||
TupleList = tupleList;
|
||||
NdmPrimitives = ndmPrimitives;
|
||||
ValidTupleList = TupleList.Where(x => x.IsValid == true).ToList();
|
||||
this.tupleList = tupleList;
|
||||
this.ndmPrimitives = ndmPrimitives;
|
||||
validTupleList = tupleList.Where(x => x.IsValid == true).ToList();
|
||||
}
|
||||
|
||||
private void CalculateWithoutCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature)
|
||||
private void Calculate()
|
||||
{
|
||||
var data = arrayParameter.Data;
|
||||
for (int i = 0; i < resultList.Count(); i++)
|
||||
for (int i = 0; i < validTupleList.Count(); i++)
|
||||
{
|
||||
var valueList = ProcessResultWithouCrack(resultList, unitForce, unitMoment, unitCurvature, i);
|
||||
var valueList = ProcessResult(i);
|
||||
for (int j = 0; j < valueList.Count; j++)
|
||||
{
|
||||
data[i, j] = valueList[j];
|
||||
@@ -88,16 +85,20 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
}
|
||||
|
||||
|
||||
private static List<double> ProcessResultWithouCrack(List<IForcesTupleResult> resultList, IUnit unitForce, IUnit unitMoment, IUnit unitCurvature, int i)
|
||||
private List<double> ProcessResult(int i)
|
||||
{
|
||||
var unitForce = CommonOperation.GetUnit(UnitTypes.Force);
|
||||
var unitMoment = CommonOperation.GetUnit(UnitTypes.Moment);
|
||||
var unitCurvature = CommonOperation.GetUnit(UnitTypes.Curvature);
|
||||
|
||||
return new List<double>
|
||||
{
|
||||
resultList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||
resultList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||
resultList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||
resultList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.Mx * unitMoment.Multiplyer,
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Kx * unitCurvature.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.Ky * unitCurvature.Multiplyer,
|
||||
validTupleList[i].LoaderResults.ForceStrainPair.StrainMatrix.EpsZ
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,102 @@
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.ResultViewers;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelper.Windows.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
{
|
||||
public class ShowValuePointDiagramLogic
|
||||
public class ShowValuePointDiagramLogic : ILongProcessLogic
|
||||
{
|
||||
private ArrayParameter<double> arrayParameter;
|
||||
private IEnumerable<IForcesTupleResult> tupleList;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private List<IForcesTupleResult> validTupleList;
|
||||
private List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)> valuePoints;
|
||||
private List<IResultFunc> resultFuncList;
|
||||
|
||||
public ForceCalculator Calculator { get; set; }
|
||||
public PointPrimitiveLogic PrimitiveLogic { get; set; }
|
||||
public ValueDelegatesLogic ValueDelegatesLogic { get; set; }
|
||||
public void ShowGraph()
|
||||
|
||||
public int StepCount => throw new NotImplementedException();
|
||||
|
||||
public Action<int> SetProgress { get; set; }
|
||||
public bool Result { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public ShowValuePointDiagramLogic(IEnumerable<IForcesTupleResult> tupleList, IEnumerable<INdmPrimitive> ndmPrimitives)
|
||||
{
|
||||
this.tupleList = tupleList;
|
||||
this.ndmPrimitives = ndmPrimitives;
|
||||
validTupleList = this.tupleList.Where(x => x.IsValid == true).ToList();
|
||||
valuePoints = new List<(PrimitiveBase PrimitiveBase, List<NamedValue<IPoint2D>>)>();
|
||||
foreach (var item in PrimitiveLogic.Collection.CollectionItems)
|
||||
{
|
||||
var pointsCount = item.Item.ValuePoints.SelectedCount;
|
||||
if (pointsCount > 0)
|
||||
{
|
||||
var points = item.Item.ValuePoints.SelectedItems.ToList();
|
||||
var primitive = item.Item.PrimitiveBase;
|
||||
valuePoints.Add((primitive, points));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ShowWindow()
|
||||
{
|
||||
SafetyProcessor.RunSafeProcess(() =>
|
||||
{
|
||||
var series = new Series(arrayParameter)
|
||||
{
|
||||
Name = "Forces and curvatures"
|
||||
};
|
||||
var vm = new GraphViewModel(new List<Series>()
|
||||
{
|
||||
series
|
||||
});
|
||||
var wnd = new GraphView(vm);
|
||||
wnd.ShowDialog();
|
||||
}, ErrorStrings.ErrorDuring("building chart"));
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private List<string> GetColumnNames()
|
||||
{
|
||||
var columnNames = LabelsFactory.GetCommonLabels();
|
||||
|
||||
return columnNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Button Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_crack.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding ShowCrackResultCommand}" ToolTip="Show force of cracking">
|
||||
<Image 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 Style="{StaticResource ToolButton}" Command="{Binding InterpolateCommand}" ToolTip="Show result step by step">
|
||||
<Image 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 Style="{StaticResource ToolButton}" Command="{Binding ShowGraphsCommand}" ToolTip="Show diagram moment-curvature">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
</Button>
|
||||
<Button Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_2.png"/>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding GraphValuePointsCommand}" ToolTip="Show diagram by value points">
|
||||
<Image 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 Style="{StaticResource ToolButton}" Command="{Binding ShowInteractionDiagramCommand}" ToolTip="Show interaction diagram">
|
||||
<Image Source="/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/32px_graph_1.png"/>
|
||||
</Button>
|
||||
|
||||
</ToolBar>
|
||||
|
||||
@@ -176,8 +176,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
};
|
||||
showProgressLogic.Show();
|
||||
}
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid
|
||||
);
|
||||
}, o => SelectedResult != null);
|
||||
}
|
||||
public ICommand ShowCrackGraphsCommand
|
||||
{
|
||||
@@ -282,11 +281,16 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
|
||||
private void InterpolateValuePoints()
|
||||
{
|
||||
if (SelectedResult is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.NullReference + ": Nothing is selected");
|
||||
}
|
||||
var tuple = SelectedResult.DesignForceTuple ?? throw new StructureHelperException(ErrorStrings.NullReference + ": Design force combination");
|
||||
var inputData = new ValuePointsInterpolationInputData()
|
||||
{
|
||||
FinishDesignForce = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple,
|
||||
LimitState = SelectedResult.DesignForceTuple.LimitState,
|
||||
CalcTerm = SelectedResult.DesignForceTuple.CalcTerm,
|
||||
FinishDesignForce = tuple.Clone() as IDesignForceTuple,
|
||||
LimitState = tuple.LimitState,
|
||||
CalcTerm = tuple.CalcTerm,
|
||||
};
|
||||
inputData.PrimitiveBases.AddRange(PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(ndmPrimitives));
|
||||
var viewModel = new ValuePointsInterpolateViewModel(inputData);
|
||||
@@ -294,7 +298,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult != true) { return; }
|
||||
var interpolationLogic = new InterpolationProgressLogic(forceCalculator, viewModel.ForceInterpolationViewModel.Result);
|
||||
ShowValuePointDiagramLogic pointGraphLogic = new()
|
||||
ShowValuePointDiagramLogic pointGraphLogic = new(ForcesResults.ForcesResultList, ndmPrimitives)
|
||||
{
|
||||
Calculator = interpolationLogic.InterpolateCalculator,
|
||||
PrimitiveLogic = viewModel.PrimitiveLogic,
|
||||
@@ -303,7 +307,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
progressLogic = interpolationLogic;
|
||||
showProgressLogic = new(interpolationLogic)
|
||||
{
|
||||
ShowResult = pointGraphLogic.ShowGraph
|
||||
ShowResult = pointGraphLogic.ShowWindow
|
||||
};
|
||||
showProgressLogic.Show();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,27 @@
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="25" d:DesignWidth="120">
|
||||
<Grid>
|
||||
<Grid x:Name="ButtonGrid" Opacity="0.1">
|
||||
<Grid.Triggers>
|
||||
<EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="ButtonGrid">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="ButtonGrid"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1.0" Duration="0:0:0.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="UIElement.MouseLeave" SourceName="ButtonGrid">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="ButtonGrid"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.1" Duration="0:0:5.0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Grid.Triggers>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
|
||||
@@ -25,5 +25,7 @@
|
||||
public static string ExpectedWas(System.Type expected, object obj) => ExpectedWas(expected, obj.GetType());
|
||||
public static string NullReference => "#0018: Null reference";
|
||||
public static string ObjectNotFound => "#0018: Object not found";
|
||||
public static string ErrorDuring(string operation) => string.Format("Errors appeared during {0}, see detailed information", operation);
|
||||
public static string CalculationError => "#0019: Error of calculation";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,12 @@ using System.Windows.Forms;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface ILongProcessLogic
|
||||
public interface ILongProcessLogic : ILogic
|
||||
{
|
||||
int StepCount { get; }
|
||||
Action<int> SetProgress { get; set; }
|
||||
bool Result { get; set; }
|
||||
|
||||
IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
void WorkerDoWork(object sender, DoWorkEventArgs e);
|
||||
void WorkerProgressChanged(object sender, ProgressChangedEventArgs e);
|
||||
void WorkerRunWorkCompleted(object sender, RunWorkerCompletedEventArgs e);
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace StructureHelperCommon.Models.Loggers
|
||||
public static string DimensionLess => "(dimensionless)";
|
||||
public static string MethodBasedOn => "Method of calculation based on ";
|
||||
public static string CalculationHasDone => "Calculation has done succesfully";
|
||||
public static string Summary => "Summary";
|
||||
public static string Maximum => "Maximum";
|
||||
public static string Minimum => "Minimum";
|
||||
public static string CalculatorType(object obj) => string.Format("Calculator type: {0}", obj.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,5 +42,6 @@ namespace StructureHelperCommon.Models.Parameters
|
||||
ColumnLabels = columnLabels;
|
||||
}
|
||||
}
|
||||
public ArrayParameter(int rowCount, List<string> columnLabels) : this(rowCount, columnLabels.Count, columnLabels) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace StructureHelperCommon.Models.Sections
|
||||
{
|
||||
public class AccidentalEccentricityLogic : IAccidentalEccentricityLogic
|
||||
@@ -64,10 +67,10 @@ namespace StructureHelperCommon.Models.Sections
|
||||
minEccentricity, yEccentricity,
|
||||
yFullEccentricity);
|
||||
TraceLogger?.AddMessage(mesEy);
|
||||
var xSign = InitialForceTuple.Mx == 0 ? 1 : Math.Sign(InitialForceTuple.Mx);
|
||||
var ySign = InitialForceTuple.My == 0 ? 1 : Math.Sign(InitialForceTuple.My);
|
||||
var mx = InitialForceTuple.Nz * yFullEccentricity * xSign;
|
||||
var my = InitialForceTuple.Nz * xFullEccentricity * ySign;
|
||||
var xSign = InitialForceTuple.Mx == 0d ? -1d : Math.Sign(InitialForceTuple.Mx);
|
||||
var ySign = InitialForceTuple.My == 0d ? -1d : Math.Sign(InitialForceTuple.My);
|
||||
var mx = (-1d) * InitialForceTuple.Nz * yFullEccentricity * xSign;
|
||||
var my = (-1d) * InitialForceTuple.Nz * xFullEccentricity * ySign;
|
||||
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary X-axis Mx = {0} * {1} = {2}", InitialForceTuple.Nz, yFullEccentricity, mx), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(string.Format("Bending moment arbitrary Y-axis My = {0} * {1} = {2}", InitialForceTuple.Nz, xFullEccentricity, my), TraceLogStatuses.Debug);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Documents;
|
||||
|
||||
namespace StructureHelperCommon.Services.Units
|
||||
{
|
||||
@@ -47,11 +48,30 @@ namespace StructureHelperCommon.Services.Units
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect);
|
||||
}
|
||||
|
||||
public static IUnit GetUnit(UnitTypes unitType, string unitName)
|
||||
public static IUnit GetUnit(UnitTypes unitType, string unitName = null)
|
||||
{
|
||||
if (unitName is null)
|
||||
{
|
||||
var boolResult = DefaultUnitNames.TryGetValue(unitType, out unitName);
|
||||
if (boolResult == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": unit type{unitType} is unknown");
|
||||
}
|
||||
}
|
||||
return units.Where(u => u.UnitType == unitType & u.Name == unitName).Single();
|
||||
}
|
||||
|
||||
public static Dictionary<UnitTypes, string> DefaultUnitNames => new()
|
||||
{
|
||||
{ UnitTypes.Length, "m"},
|
||||
{ UnitTypes.Area, "m2"},
|
||||
{ UnitTypes.Force, "kN" },
|
||||
{ UnitTypes.Moment, "kNm"},
|
||||
{ UnitTypes.Stress, "MPa"},
|
||||
{ UnitTypes.Curvature, "1/m"},
|
||||
};
|
||||
|
||||
|
||||
public static string Convert(IUnit unit, string unitName, object value)
|
||||
{
|
||||
double val;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
@@ -17,6 +18,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
|
||||
private readonly IForceTupleCalculator forceTupleCalculator;
|
||||
private ForcesResults result;
|
||||
|
||||
public string Name { get; set; }
|
||||
public List<LimitStates> LimitStatesList { get; private set; }
|
||||
public List<CalcTerms> CalcTermsList { get; private set; }
|
||||
@@ -50,7 +53,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
private void CalculateResult()
|
||||
{
|
||||
var ndmResult = new ForcesResults() { IsValid = true };
|
||||
result = new ForcesResults()
|
||||
{
|
||||
IsValid = true
|
||||
};
|
||||
foreach (var combination in ForceCombinationLists)
|
||||
{
|
||||
foreach (var tuple in combination.DesignForces)
|
||||
@@ -59,15 +65,34 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
var calcTerm = tuple.CalcTerm;
|
||||
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
|
||||
{
|
||||
ProcessNdmResult(ndmResult, combination, tuple, limitState, calcTerm);
|
||||
|
||||
IForcesTupleResult tupleResult;
|
||||
try
|
||||
{
|
||||
tupleResult = ProcessNdmResult(combination, tuple);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
tupleResult = new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
Description = string.Empty + ex,
|
||||
DesignForceTuple = tuple
|
||||
};
|
||||
}
|
||||
result.ForcesResultList.Add(tupleResult);
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Result = ndmResult;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
private void ProcessNdmResult(ForcesResults ndmResult, IForceCombinationList combination, IDesignForceTuple tuple, LimitStates limitState, CalcTerms calcTerm)
|
||||
private IForcesTupleResult ProcessNdmResult(IForceCombinationList combination, IDesignForceTuple tuple)
|
||||
{
|
||||
IForcesTupleResult tupleResult;
|
||||
LimitStates limitState = tuple.LimitState;
|
||||
CalcTerms calcTerm = tuple.CalcTerm;
|
||||
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
|
||||
IPoint2D point2D;
|
||||
if (combination.SetInGravityCenter == true)
|
||||
@@ -89,9 +114,22 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
TraceLogger?.AddMessage("Get eccentricity for full load");
|
||||
newTuple = ProcessAccEccentricity(ndms, newTuple);
|
||||
newTuple = GetForceTupleByBuckling(ndmResult, combination, limitState, calcTerm, ndms, newTuple);
|
||||
var buckResult = GetForceTupleByBuckling(combination, limitState, calcTerm, ndms, newTuple);
|
||||
if (buckResult.isValid == true)
|
||||
{
|
||||
newTuple = buckResult.tuple;
|
||||
}
|
||||
GetForceResult(ndmResult, limitState, calcTerm, ndms, newTuple);
|
||||
else
|
||||
{
|
||||
return new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
DesignForceTuple = tuple,
|
||||
Description = buckResult.description,
|
||||
};
|
||||
}
|
||||
}
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,12 +138,14 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
string message = string.Format("Second order effect is not considered, despite force Nz={0}", newTuple.Nz);
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Warning);
|
||||
}
|
||||
GetForceResult(ndmResult, limitState, calcTerm, ndms, newTuple);
|
||||
tupleResult = GetForceResult(limitState, calcTerm, ndms, newTuple);
|
||||
}
|
||||
return tupleResult;
|
||||
}
|
||||
|
||||
private IForceTuple GetForceTupleByBuckling(ForcesResults ndmResult, IForceCombinationList combination, LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||
private (bool isValid, IForceTuple tuple, string description) GetForceTupleByBuckling(IForceCombinationList combination, LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
var tuple = newTuple.Clone() as IForceTuple;
|
||||
var inputData = new BucklingInputData()
|
||||
{
|
||||
Combination = combination,
|
||||
@@ -119,41 +159,31 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
if (bucklingResult.IsValid != true)
|
||||
{
|
||||
TraceLogger?.AddMessage(bucklingResult.Description, TraceLogStatuses.Error);
|
||||
var result = new ForcesTupleResult
|
||||
{
|
||||
IsValid = false,
|
||||
Description = $"Buckling result:\n{bucklingResult.Description}\n",
|
||||
DesignForceTuple = new DesignForceTuple()
|
||||
{
|
||||
ForceTuple = newTuple,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm
|
||||
}
|
||||
};
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
return (false, tuple, $"Buckling result:\n{bucklingResult.Description}");
|
||||
}
|
||||
else
|
||||
{
|
||||
newTuple = CalculateBuckling(newTuple, bucklingResult);
|
||||
TraceLogger?.AddMessage($"Force combination with considering of second order effects");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
|
||||
tuple = CalculateBuckling(tuple, bucklingResult);
|
||||
TraceLogger?.AddMessage(string.Intern("Force combination with considering of second order effects"));
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
|
||||
}
|
||||
|
||||
return newTuple;
|
||||
return (true, tuple, string.Empty);
|
||||
}
|
||||
|
||||
private void GetForceResult(ForcesResults ndmResult, LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||
private IForcesTupleResult GetForceResult(LimitStates limitState, CalcTerms calcTerm, List<INdm> ndms, IForceTuple newTuple)
|
||||
{
|
||||
var result = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||
result.DesignForceTuple.LimitState = limitState;
|
||||
result.DesignForceTuple.CalcTerm = calcTerm;
|
||||
result.DesignForceTuple.ForceTuple = newTuple;
|
||||
ndmResult.ForcesResultList.Add(result);
|
||||
ActionToOutputResults?.Invoke(ndmResult);
|
||||
var tupleResult = GetPrimitiveStrainMatrix(ndms, newTuple, Accuracy);
|
||||
tupleResult.DesignForceTuple.LimitState = limitState;
|
||||
tupleResult.DesignForceTuple.CalcTerm = calcTerm;
|
||||
tupleResult.DesignForceTuple.ForceTuple = newTuple;
|
||||
return tupleResult;
|
||||
|
||||
}
|
||||
|
||||
private IForceTuple ProcessAccEccentricity(List<INdm> ndms, IForceTuple newTuple)
|
||||
private IForceTuple ProcessAccEccentricity(List<INdm> ndms, IForceTuple tuple)
|
||||
{
|
||||
var newTuple = tuple.Clone() as IForceTuple;
|
||||
var accLogic = new AccidentalEccentricityLogic()
|
||||
{
|
||||
Length = CompressedMember.GeometryLength,
|
||||
@@ -161,7 +191,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
SizeY = ndms.Max(x => x.CenterY) - ndms.Min(x => x.CenterY),
|
||||
InitialForceTuple = newTuple,
|
||||
};
|
||||
if (TraceLogger is not null) { accLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50); }
|
||||
if (TraceLogger is not null)
|
||||
{
|
||||
accLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||
}
|
||||
newTuple = accLogic.GetForceTuple();
|
||||
return newTuple;
|
||||
}
|
||||
@@ -196,7 +229,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
IForceTuple longTuple;
|
||||
try
|
||||
{
|
||||
longTuple = designForces.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm).First().ForceTuple;
|
||||
longTuple = designForces
|
||||
.Where(x => x.LimitState == limitState & x.CalcTerm == CalcTerms.LongTerm)
|
||||
.Single()
|
||||
.ForceTuple;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
@@ -33,18 +34,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
private IForcesTupleResult CalculateResult()
|
||||
{
|
||||
TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage($"Calculator logic based on calculating strain in plain section by elementary parts of finished size");
|
||||
TraceLogger?.AddMessage(string.Intern($"Calculator type: {GetType()}"), TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage(string.Intern("Calculator logic based on calculating strain in plain section by elementary parts of finished size"));
|
||||
var ndmCollection = InputData.NdmCollection;
|
||||
TraceLogger?.AddMessage($"Collection of elementary parts contains {ndmCollection.Count()} parts");
|
||||
TraceLogger?.AddMessage($"Summary area of elementary part collection = {ndmCollection.Sum(x => x.Area * x.StressScale)}", TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage($"Minimum x = {ndmCollection.Min(x => x.CenterX)}", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Maximum x = {ndmCollection.Max(x => x.CenterX)}", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Minimum y = {ndmCollection.Min(x => x.CenterY)}", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage($"Maximum y = {ndmCollection.Max(x => x.CenterY)}", TraceLogStatuses.Debug);
|
||||
if (TraceLogger is not null)
|
||||
{
|
||||
TraceService.TraceNdmCollection(TraceLogger, ndmCollection);
|
||||
}
|
||||
var tuple = InputData.Tuple;
|
||||
var accuracy = InputData.Accuracy;
|
||||
TraceLogger?.AddMessage($"Input force combination");
|
||||
TraceLogger?.AddMessage(string.Intern("Input force combination"));
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
|
||||
var mx = tuple.Mx;
|
||||
var my = tuple.My;
|
||||
@@ -65,9 +64,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
TraceLogger?.AddMessage($"Calculation is started", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(string.Intern("Calculation is started"), TraceLogStatuses.Debug);
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
TraceLogger?.AddMessage($"Calculation result is obtained", TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(string.Intern("Calculation result is obtained"), TraceLogStatuses.Debug);
|
||||
var calcResult = calculator.Result;
|
||||
if (calcResult.AccuracyRate <= accuracy.IterationAccuracy)
|
||||
{
|
||||
@@ -83,12 +82,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLogger?.AddMessage($"Required accuracy rate has not achieved", TraceLogStatuses.Error);
|
||||
TraceLogger?.AddMessage(string.Intern("Required accuracy rate has not achieved"), TraceLogStatuses.Error);
|
||||
TraceLogger?.AddMessage($"Current accuracy {calcResult.AccuracyRate}, {calcResult.IterationCounter} iteration has done", TraceLogStatuses.Warning);
|
||||
return new ForcesTupleResult()
|
||||
{
|
||||
IsValid = false,
|
||||
Description = "Required accuracy rate has not achieved",
|
||||
Description = string.Intern("Required accuracy rate has not achieved"),
|
||||
LoaderResults = calcResult
|
||||
};
|
||||
}
|
||||
@@ -103,8 +102,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
};
|
||||
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero")
|
||||
{
|
||||
TraceLogger?.AddMessage($"Stiffness matrix is equal to zero\nProbably section was collapsed", TraceLogStatuses.Error);
|
||||
result.Description = "Stiffness matrix is equal to zero\nProbably section was collapsed";
|
||||
TraceLogger?.AddMessage(string.Intern("Stiffness matrix is equal to zero\nProbably section was collapsed"), TraceLogStatuses.Error);
|
||||
result.Description = string.Intern("Stiffness matrix is equal to zero\nProbably section was collapsed");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Logics;
|
||||
using LoaderCalculator.Logics.Geometry;
|
||||
using StructureHelperCommon.Models;
|
||||
@@ -9,6 +10,7 @@ using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.Services;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
@@ -28,7 +30,7 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
public IResult Result { get; private set; }
|
||||
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
|
||||
@@ -50,11 +52,9 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
Accuracy = accuracy;
|
||||
|
||||
var allPrimitives = options.Primitives;
|
||||
var concretePrimitives = GetConcretePrimitives();
|
||||
var otherPrimitives = allPrimitives.Except(concretePrimitives);
|
||||
ndmCollection = NdmPrimitivesService.GetNdms(allPrimitives, options.LimitState, options.CalcTerm);
|
||||
concreteNdms = NdmPrimitivesService.GetNdms(concretePrimitives, options.LimitState, options.CalcTerm);
|
||||
otherNdms = NdmPrimitivesService.GetNdms(otherPrimitives, options.LimitState, options.CalcTerm);
|
||||
concreteNdms = ndmCollection.Where(x => x.Material is ICrackMaterial).ToList();
|
||||
otherNdms = ndmCollection.Except(concreteNdms).ToList();
|
||||
}
|
||||
|
||||
private (IConcreteDeltaELogic DeltaLogicX, IConcreteDeltaELogic DeltaLogicY) GetDeltaLogics()
|
||||
@@ -78,35 +78,38 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
return (DeltaElogicAboutX, DeltaElogicAboutY);
|
||||
}
|
||||
|
||||
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
|
||||
{
|
||||
var primitives = options.Primitives.Where(x => x.HeadMaterial.HelperMaterial is IConcreteLibMaterial);
|
||||
return primitives;
|
||||
}
|
||||
|
||||
private (double DX, double DY) GetStiffness()
|
||||
{
|
||||
const string sumStif = "Summary stiffness";
|
||||
var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection);
|
||||
string message = string.Format("Gravity center, x = {0}, y = {1}", gravityCenter.Cx, gravityCenter.Cy);
|
||||
TraceLogger?.AddMessage(message);
|
||||
if (TraceLogger is not null)
|
||||
{
|
||||
TraceLogger.AddMessage(string.Intern("Concrete elementary parts"));
|
||||
TraceService.TraceNdmCollection(TraceLogger, concreteNdms);
|
||||
TraceLogger.AddMessage(string.Intern("Nonconcrete elementary parts"));
|
||||
TraceService.TraceNdmCollection(TraceLogger, otherNdms);
|
||||
}
|
||||
|
||||
var (EIx, EIy) = GeometryOperations.GetReducedMomentsOfInertia(concreteNdms, gravityCenter);
|
||||
TraceLogger.AddMessage(string.Format("Summary stiffness of concrete parts EIx,c = {0}", EIx));
|
||||
TraceLogger.AddMessage(string.Format("Summary stiffness of concrete parts EIy,c = {0}", EIy));
|
||||
TraceLogger?.AddMessage(string.Format("{0} of concrete parts EIx,c = {1}", sumStif, EIx));
|
||||
TraceLogger?.AddMessage(string.Format("{0} of concrete parts EIy,c = {1}", sumStif, EIy));
|
||||
var otherInertia = GeometryOperations.GetReducedMomentsOfInertia(otherNdms, gravityCenter);
|
||||
TraceLogger.AddMessage(string.Format("Summary stiffness of nonconcrete parts EIx,s = {0}", otherInertia.EIy));
|
||||
TraceLogger.AddMessage(string.Format("Summary stiffness of nonconcrete parts EIy,s = {0}", otherInertia.EIy));
|
||||
TraceLogger?.AddMessage(string.Format("{0} of nonconcrete parts EIx,s = {1}", sumStif, otherInertia.EIx));
|
||||
TraceLogger?.AddMessage(string.Format("{0} of nonconcrete parts EIy,s = {1}", sumStif, otherInertia.EIy));
|
||||
|
||||
var (Kc, Ks) = stiffnessLogicX.GetStiffnessCoeffitients();
|
||||
var dX = Kc * EIx + Ks * otherInertia.EIx;
|
||||
string mesDx = string.Format("Summary stiffness Dx = Kc * EIx,c + Ks * EIx,s = {0} * {1} + {2} * {3} = {4}",
|
||||
Kc, EIx, Ks, otherInertia.EIx, dX);
|
||||
TraceLogger.AddMessage(mesDx);
|
||||
string mesDx = string.Format("{0} Dx = Kc * EIx,c + Ks * EIx,s = {1} * {2} + {3} * {4} = {5}",
|
||||
sumStif, Kc, EIx, Ks, otherInertia.EIx, dX);
|
||||
TraceLogger?.AddMessage(mesDx);
|
||||
|
||||
var stiffnessY = stiffnessLogicY.GetStiffnessCoeffitients();
|
||||
var dY = stiffnessY.Kc * EIy + stiffnessY.Ks * otherInertia.EIy;
|
||||
string mesDy = string.Format("Summary stiffness Dy = Kc * EIy,c + Ks * EIy,s = {0} * {1} + {2} * {3} = {4}",
|
||||
stiffnessY.Kc, EIy, stiffnessY.Ks, otherInertia.EIy, dY);
|
||||
TraceLogger.AddMessage(mesDy);
|
||||
string mesDy = string.Format("{0} Dy = Kc * EIy,c + Ks * EIy,s = {1} * {2} + {3} * {4} = {5}",
|
||||
sumStif, stiffnessY.Kc, EIy, stiffnessY.Ks, otherInertia.EIy, dY);
|
||||
TraceLogger?.AddMessage(mesDy);
|
||||
return (dX, dY);
|
||||
}
|
||||
|
||||
@@ -132,8 +135,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
|
||||
point = new Point2D() { X = item.CenterX, Y = item.CenterY };
|
||||
}
|
||||
}
|
||||
TraceLogger.AddMessage(string.Format("Most tensioned (minimum compressed) point: x = {0}, y = {1}", point.X, point.Y));
|
||||
TraceLogger.AddMessage(string.Format("Strain: epsilon = {0}", maxStrain), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(string.Format("Most tensioned (minimum compressed) point: x = {0}, y = {1}", point.X, point.Y));
|
||||
TraceLogger?.AddMessage(string.Format("Strain: epsilon = {0}", maxStrain), TraceLogStatuses.Debug);
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
44
StructureHelperLogics/Services/TraceService.cs
Normal file
44
StructureHelperLogics/Services/TraceService.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Services
|
||||
{
|
||||
internal static class TraceService
|
||||
{
|
||||
public static void TraceNdmCollection(ITraceLogger traceLogger, IEnumerable<INdm> ndmCollection)
|
||||
{
|
||||
if (traceLogger is null)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.NullReference + ": trace logger");
|
||||
}
|
||||
if (ndmCollection is null)
|
||||
{
|
||||
traceLogger.AddMessage(string.Intern("Collection of elementary parts is null"), TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(ErrorStrings.NullReference + ": collection of elementary parts");
|
||||
}
|
||||
if (!ndmCollection.Any())
|
||||
{
|
||||
traceLogger.AddMessage("Collection of elementary parts is empty", TraceLogStatuses.Warning);
|
||||
}
|
||||
traceLogger.AddMessage(string.Format("Collection of elementary parts contains {0} parts", ndmCollection.Count()));
|
||||
var mes = "area of elementary part collection ";
|
||||
traceLogger.AddMessage(string.Format("{0} {1} A = {2}, {0} reduced {1} Ared = {3}",
|
||||
LoggerStrings.Summary,
|
||||
mes,
|
||||
ndmCollection.Sum(x => x.Area),
|
||||
ndmCollection.Sum(x => x.Area * x.StressScale)),
|
||||
TraceLogStatuses.Service);
|
||||
traceLogger.AddMessage($"Minimum x = {ndmCollection.Min(x => x.CenterX)}", TraceLogStatuses.Debug);
|
||||
traceLogger.AddMessage($"Maximum x = {ndmCollection.Max(x => x.CenterX)}", TraceLogStatuses.Debug);
|
||||
traceLogger.AddMessage($"Minimum y = {ndmCollection.Min(x => x.CenterY)}", TraceLogStatuses.Debug);
|
||||
traceLogger.AddMessage($"Maximum y = {ndmCollection.Max(x => x.CenterY)}", TraceLogStatuses.Debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user