Buckling calculator was changed, accidental eccentricity logic was added

This commit is contained in:
Evgeny Redikultsev
2024-02-25 15:31:09 +05:00
parent 541f23c0a8
commit bf72f6d347
28 changed files with 676 additions and 145 deletions

View File

@@ -22,26 +22,29 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
private FlowDocument document; private FlowDocument document;
private ICommand rebuildCommand; private ICommand rebuildCommand;
private ICommand printDocumentCommand; private ICommand printDocumentCommand;
private int maxPriority; private int priorityLimit;
private int tabGap; private int tabGap;
public FlowDocumentReader DocumentReader { get; set; } public FlowDocumentReader DocumentReader { get; set; }
public int MaxPriority public int PriorityLimit
{ {
get => maxPriority; set get => priorityLimit; set
{ {
var oldValue = maxPriority; var oldValue = priorityLimit;
try try
{ {
maxPriority = Math.Max(value, 0); priorityLimit = Math.Max(value, 0);
OnPropertyChanged(nameof(MaxPriority)); OnPropertyChanged(nameof(PriorityLimit));
} }
catch (Exception) catch (Exception)
{ {
maxPriority = oldValue; priorityLimit = oldValue;
} }
} }
} }
public int MaxPriority => loggerEntries.Max(x => x.Priority);
public int TabGap public int TabGap
{ {
get => tabGap; set get => tabGap; set
@@ -61,7 +64,7 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
public TraceDocumentVM(IEnumerable<ITraceLoggerEntry> loggerEntries) public TraceDocumentVM(IEnumerable<ITraceLoggerEntry> loggerEntries)
{ {
this.loggerEntries = loggerEntries; this.loggerEntries = loggerEntries;
maxPriority = 350; priorityLimit = 350;
tabGap = 30; tabGap = 30;
} }
@@ -81,7 +84,7 @@ namespace StructureHelper.Windows.CalculationWindows.ProgressViews
public void Prepare() public void Prepare()
{ {
document = new(); document = new();
selectedLoggerEntries = loggerEntries.Where(x => x.Priority <= MaxPriority); selectedLoggerEntries = loggerEntries.Where(x => x.Priority <= PriorityLimit);
var blocks = selectedLoggerEntries.Select(x => GetBlockByEntry(x)); var blocks = selectedLoggerEntries.Select(x => GetBlockByEntry(x));
document.Blocks.AddRange(blocks); document.Blocks.AddRange(blocks);
} }

View File

@@ -10,7 +10,7 @@
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="90"/> <ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<FlowDocumentReader Name="DocumentReader" ViewingMode="Scroll"/> <FlowDocumentReader Name="DocumentReader" ViewingMode="Scroll"/>
<StackPanel Grid.Column="1"> <StackPanel Grid.Column="1">
@@ -18,7 +18,13 @@
<TextBox Text="{Binding TabGap, ValidatesOnExceptions=True}" /> <TextBox Text="{Binding TabGap, ValidatesOnExceptions=True}" />
</GroupBox> </GroupBox>
<GroupBox Header="Max priority"> <GroupBox Header="Max priority">
<TextBox Text="{Binding MaxPriority, ValidatesOnExceptions=True}" /> <StackPanel>
<TextBox Text="{Binding PriorityLimit, ValidatesOnExceptions=True}" />
<StackPanel Orientation="Horizontal">
<Slider Width="88" Value="{Binding PriorityLimit}" Maximum="{Binding MaxPriority}" Minimum="0"/>
<TextBlock Width="20" FontSize="8" Text="{Binding MaxPriority}"/>
</StackPanel>
</StackPanel>
</GroupBox> </GroupBox>
<Button Margin="3" Content="Rebuild" ToolTip="Rebuild document" Command="{Binding RebuildCommand}"/> <Button Margin="3" Content="Rebuild" ToolTip="Rebuild document" Command="{Binding RebuildCommand}"/>
<Button Margin="3" Content="Print" ToolTip="Print document" Command="{Binding PrintDocumentCommand}"/> <Button Margin="3" Content="Print" ToolTip="Print document" Command="{Binding PrintDocumentCommand}"/>

View File

@@ -128,16 +128,14 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
private void RunCalculator() private void RunCalculator()
{ {
if (SelectedItem.TraceLogger is not null)
{
SelectedItem.TraceLogger.TraceLoggerEntries.Clear();
}
if (SelectedItem is LimitCurvesCalculator calculator) if (SelectedItem is LimitCurvesCalculator calculator)
{ {
if (calculator.TraceLogger is not null) { calculator.TraceLogger.TraceLoggerEntries.Clear(); }
var inputData = calculator.InputData; var inputData = calculator.InputData;
ShowInteractionDiagramByInputData(calculator); ShowInteractionDiagramByInputData(calculator);
if (calculator.TraceLogger is not null)
{
var wnd = new TraceDocumentView(calculator.TraceLogger.TraceLoggerEntries);
wnd.ShowDialog();
}
} }
else else
{ {
@@ -146,13 +144,17 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
if (result.IsValid == false) if (result.IsValid == false)
{ {
MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(result.Description, "Check data for analisys", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
} }
else else
{ {
ProcessResult(); ProcessResult();
} }
} }
if (SelectedItem.TraceLogger is not null)
{
var wnd = new TraceDocumentView(SelectedItem.TraceLogger.TraceLoggerEntries);
wnd.ShowDialog();
}
} }
private void ShowInteractionDiagramByInputData(LimitCurvesCalculator calculator) private void ShowInteractionDiagramByInputData(LimitCurvesCalculator calculator)

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Loggers
{
public static class LoggerStrings
{
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 CalculatorType(object obj) => string.Format("Calculator type: {0}", obj.GetType());
}
}

View File

@@ -1,13 +1,24 @@
namespace StructureHelperCommon.Models.Sections namespace StructureHelperCommon.Models.Sections
{ {
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
//All rights reserved.
/// <inheritdoc/>
public class CompressedMember : ICompressedMember public class CompressedMember : ICompressedMember
{ {
static readonly CompressedMemberUpdateStrategy updateStrategy = new(); static readonly CompressedMemberUpdateStrategy updateStrategy = new();
/// <inheritdoc/>
public bool Buckling { get; set; } public bool Buckling { get; set; }
/// <inheritdoc/>
public double GeometryLength { get; set; } public double GeometryLength { get; set; }
/// <inheritdoc/>
public double LengthFactorX { get; set; } public double LengthFactorX { get; set; }
/// <inheritdoc/>
public double DiagramFactorX { get; set; } public double DiagramFactorX { get; set; }
/// <inheritdoc/>
public double LengthFactorY { get; set; } public double LengthFactorY { get; set; }
/// <inheritdoc/>
public double DiagramFactorY { get; set; } public double DiagramFactorY { get; set; }

View File

@@ -2,12 +2,31 @@
namespace StructureHelperCommon.Models.Sections namespace StructureHelperCommon.Models.Sections
{ {
//Copyright (c) 2023 Redikultsev Evgeny, Ekaterinburg, Russia
//All rights reserved.
/// <summary>
/// Interface of properties for compressed strucrue members
/// </summary>
public interface ICompressedMember : ICloneable public interface ICompressedMember : ICloneable
{ {
/// <summary>
/// Flag of considering of buckling
/// </summary>
bool Buckling { get; set; } bool Buckling { get; set; }
/// <summary>
/// Geometry length of structure member, m
/// </summary>
double GeometryLength { get; set; } double GeometryLength { get; set; }
/// <summary>
/// Factor of design length in plane XOZ
/// </summary>
double LengthFactorX { get; set; } double LengthFactorX { get; set; }
double DiagramFactorX { get; set; } double DiagramFactorX { get; set; }
/// <summary>
/// Factor of design length in plane YOZ
/// </summary>
double LengthFactorY { get; set; } double LengthFactorY { get; set; }
double DiagramFactorY { get; set; } double DiagramFactorY { get; set; }
} }

View File

@@ -0,0 +1,85 @@
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Sections
{
public class AccidentalEccentricityLogic : IAccidentalEccentricityLogic
{
private double lengthFactor;
private double sizeFactor;
private double minEccentricity;
public ICompressedMember CompressedMember { get; set; }
public double SizeX { get; set; }
public double SizeY { get; set; }
public IForceTuple InitialForceTuple { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public AccidentalEccentricityLogic()
{
lengthFactor = 1d / 600d;
sizeFactor = 1d / 30d;
minEccentricity = 0.01d;
}
public ForceTuple GetForceTuple()
{
var lengthEccetricity = CompressedMember.GeometryLength * lengthFactor;
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by length ea = {0}", lengthEccetricity));
var sizeXEccetricity = SizeX * sizeFactor;
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeX = {0} ea = {1}", SizeX, sizeXEccetricity));
var sizeYEccetricity = SizeY * sizeFactor;
TraceLogger?.AddMessage(string.Format("Accidental eccentricity by SizeY = {0} ea = {1}", SizeY, sizeYEccetricity));
TraceLogger?.AddMessage(string.Format("Minimum accidental eccentricity ea = {0}", minEccentricity));
var xEccentricity = Math.Abs(InitialForceTuple.My / InitialForceTuple.Nz);
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,x = {0}", xEccentricity));
var yEccentricity = Math.Abs(InitialForceTuple.Mx / InitialForceTuple.Nz);
TraceLogger?.AddMessage(string.Format("Actual eccentricity e0,y = {0}", yEccentricity));
var xFullEccentricity = new List<double>()
{
lengthEccetricity,
sizeXEccetricity,
minEccentricity,
xEccentricity
}
.Max();
string mesEx = string.Format("Eccentricity e,x = max({0}; {1}; {2}; {3}) = {4}",
lengthEccetricity, sizeXEccetricity,
minEccentricity, xEccentricity,
xFullEccentricity);
TraceLogger?.AddMessage(mesEx);
var yFullEccentricity = new List<double>()
{
lengthEccetricity,
sizeYEccetricity,
minEccentricity,
yEccentricity
}
.Max();
string mesEy = string.Format("Eccentricity e,y = max({0}; {1}; {2}; {3}) = {4}",
lengthEccetricity, sizeYEccetricity,
minEccentricity, yEccentricity,
yFullEccentricity);
TraceLogger?.AddMessage(mesEy);
var mx = InitialForceTuple.Nz * yFullEccentricity * Math.Sign(InitialForceTuple.Mx);
var my = InitialForceTuple.Nz * xFullEccentricity * Math.Sign(InitialForceTuple.My);
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);
var newTuple = new ForceTuple()
{
Mx = mx,
My = my,
Nz = InitialForceTuple.Nz,
Qx = InitialForceTuple.Qx,
Qy = InitialForceTuple.Qy,
Mz = InitialForceTuple.Mz,
};
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
return newTuple;
}
}
}

View File

@@ -0,0 +1,38 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Sections
{
/// <summary>
/// Logic for calculating of value of accidental eccentricity
/// </summary>
public interface IAccidentalEccentricityLogic : ILogic
{
/// <summary>
/// Properties of compressed member
/// </summary>
ICompressedMember CompressedMember {get;set;}
/// <summary>
/// Size of cross-section along X-axis, m
/// </summary>
double SizeX { get; set; }
/// <summary>
/// Size of cross-section along Y-axis, m
/// </summary>
double SizeY { get; set; }
/// <summary>
/// Initial tuple of force
/// </summary>
IForceTuple InitialForceTuple { get; set; }
/// <summary>
/// Returns new force tuple with accidental eccentricity
/// </summary>
/// <returns></returns>
ForceTuple GetForceTuple();
}
}

View File

@@ -1,11 +1,6 @@
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models;
using StructureHelperLogics.NdmCalculations.Analyses; using StructureHelperCommon.Models.Calculators;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Templates.CrossSections namespace StructureHelperLogics.Models.Templates.CrossSections
{ {
@@ -13,8 +8,14 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
{ {
public IEnumerable<ICalculator> GetNdmCalculators() public IEnumerable<ICalculator> GetNdmCalculators()
{ {
var calculators = new List<ICalculator>(); var calculators = new List<ICalculator>
calculators.Add(new ForceCalculator() { Name = "New Force Calculator"}); {
new ForceCalculator()
{
Name = "New Force Calculator",
TraceLogger = new ShiftTraceLogger()
}
};
return calculators; return calculators;
} }
} }

View File

@@ -16,13 +16,14 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public class ForceCalculator : IForceCalculator, IHasActionByResult public class ForceCalculator : IForceCalculator, IHasActionByResult
{ {
static readonly ForceCalculatorUpdateStrategy updateStrategy = new(); static readonly ForceCalculatorUpdateStrategy updateStrategy = new();
private readonly IForceTupleCalculator forceTupleCalculator;
public string Name { get; set; } public string Name { get; set; }
public List<LimitStates> LimitStatesList { get; } public List<LimitStates> LimitStatesList { get; private set; }
public List<CalcTerms> CalcTermsList { get; } public List<CalcTerms> CalcTermsList { get; private set; }
public List<IForceAction> ForceActions { get; } public List<IForceAction> ForceActions { get; private set; }
public List<INdmPrimitive> Primitives { get; } public List<INdmPrimitive> Primitives { get; private set; }
public IResult Result { get; private set; } public IResult Result { get; private set; }
public ICompressedMember CompressedMember { get; } public ICompressedMember CompressedMember { get; private set; }
public IAccuracy Accuracy { get; set; } public IAccuracy Accuracy { get; set; }
public List<IForceCombinationList> ForceCombinationLists { get; private set; } public List<IForceCombinationList> ForceCombinationLists { get; private set; }
public Action<IResult> ActionToOutputResults { get; set; } public Action<IResult> ActionToOutputResults { get; set; }
@@ -58,66 +59,129 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
var calcTerm = tuple.CalcTerm; var calcTerm = tuple.CalcTerm;
if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm)) if (LimitStatesList.Contains(limitState) & CalcTermsList.Contains(calcTerm))
{ {
var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm); ProcessNdmResult(ndmResult, combination, tuple, limitState, calcTerm);
IPoint2D point2D;
if (combination.SetInGravityCenter == true)
{
var loaderPoint = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
point2D = new Point2D() { X = loaderPoint.Cx, Y = loaderPoint.Cy };
}
else point2D = combination.ForcePoint;
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D) as ForceTuple;
IForcesTupleResult result = GetPrimitiveStrainMatrix(ndms, newTuple);
if (CompressedMember.Buckling == true)
{
IForceTuple longTuple;
if (calcTerm == CalcTerms.LongTerm)
{
longTuple = newTuple;
}
else
{
longTuple = GetLongTuple(combination.DesignForces, limitState);
}
var bucklingCalculator = GetBucklingCalculator(CompressedMember, limitState, calcTerm, newTuple, longTuple);
try
{
bucklingCalculator.Run();
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
if (bucklingResult.IsValid != true)
{
result.IsValid = false;
result.Description += $"Buckling result:\n{bucklingResult.Description}\n";
}
newTuple = CalculateBuckling(newTuple, bucklingResult);
result = GetPrimitiveStrainMatrix(ndms, newTuple);
}
catch (Exception ex)
{
result.IsValid = false;
result.Description = $"Buckling error:\n{ex}\n";
}
}
result.DesignForceTuple.LimitState = limitState;
result.DesignForceTuple.CalcTerm = calcTerm;
result.DesignForceTuple.ForceTuple = newTuple;
ndmResult.ForcesResultList.Add(result);
ActionToOutputResults?.Invoke(ndmResult);
} }
} }
} }
Result = ndmResult; Result = ndmResult;
} }
private void ProcessNdmResult(ForcesResults ndmResult, IForceCombinationList combination, IDesignForceTuple tuple, LimitStates limitState, CalcTerms calcTerm)
private void GetCombinations()
{ {
ForceCombinationLists = new List<IForceCombinationList>(); var ndms = NdmPrimitivesService.GetNdms(Primitives, limitState, calcTerm);
foreach (var item in ForceActions) IPoint2D point2D;
if (combination.SetInGravityCenter == true)
{ {
ForceCombinationLists.Add(item.GetCombinations()); var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
point2D = new Point2D(){ X = Cx, Y = Cy };
} }
else point2D = combination.ForcePoint;
var newTuple = ForceTupleService.MoveTupleIntoPoint(tuple.ForceTuple, point2D);
TraceLogger?.AddMessage($"Input force combination");
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(newTuple));
if (CompressedMember.Buckling == true)
{
if (newTuple.Nz >= 0d)
{
TraceLogger.AddMessage(string.Format("Second order effect is not considered as Nz={0} >= 0", newTuple.Nz));
}
else
{
newTuple = ProcessAccEccentricity(ndms, newTuple);
var inputData = new BucklingInputData()
{
Combination = combination,
LimitState = limitState,
CalcTerm = calcTerm,
Ndms = ndms,
ForceTuple = newTuple
};
var bucklingResult = ProcessBuckling(inputData);
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);
}
else
{
newTuple = CalculateBuckling(newTuple, bucklingResult);
TraceLogger?.AddMessage($"Force combination with considering of second order effects");
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(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);
}
}
}
else
{
if (newTuple.Nz < 0d)
{
string message = string.Format("Second order effect is not considered, despite force Nz={0}", newTuple.Nz);
TraceLogger.AddMessage(message, TraceLogStatuses.Warning);
}
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);
}
}
private IForceTuple ProcessAccEccentricity(List<INdm> ndms, IForceTuple newTuple)
{
var accLogic = new AccidentalEccentricityLogic()
{
CompressedMember = CompressedMember,
SizeX = ndms.Max(x => x.CenterX) - ndms.Min(x => x.CenterX),
SizeY = ndms.Max(x => x.CenterY) - ndms.Min(x => x.CenterY),
InitialForceTuple = newTuple,
};
if (TraceLogger is not null) { accLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50); }
newTuple = accLogic.GetForceTuple();
return newTuple;
}
private IConcreteBucklingResult ProcessBuckling(BucklingInputData inputData)
{
IForceTuple resultTuple;
IForceTuple longTuple;
if (inputData.CalcTerm == CalcTerms.LongTerm)
{
longTuple = inputData.ForceTuple;
}
else
{
longTuple = GetLongTuple(inputData.Combination.DesignForces, inputData.LimitState);
}
longTuple = ProcessAccEccentricity(inputData.Ndms, longTuple);
var bucklingCalculator = GetBucklingCalculator(CompressedMember, inputData.LimitState, inputData.CalcTerm, inputData.ForceTuple, longTuple);
if (TraceLogger is not null)
{
bucklingCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
bucklingCalculator.Run();
var bucklingResult = bucklingCalculator.Result as IConcreteBucklingResult;
return bucklingResult;
} }
private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState) private IForceTuple GetLongTuple(List<IDesignForceTuple> designForces, LimitStates limitState)
@@ -136,18 +200,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple) private IConcreteBucklingCalculator GetBucklingCalculator(ICompressedMember compressedMember, LimitStates limitStates, CalcTerms calcTerms, IForceTuple calcTuple, IForceTuple longTuple)
{ {
IConcreteBucklingOptions options = new ConcreteBucklingOptions() var options = new ConcreteBucklingOptions()
{ CompressedMember = compressedMember, {
CompressedMember = compressedMember,
LimitState = limitStates, LimitState = limitStates,
CalcTerm = calcTerms, CalcTerm = calcTerms,
CalcForceTuple = calcTuple, CalcForceTuple = calcTuple,
LongTermTuple = longTuple, LongTermTuple = longTuple,
Primitives = Primitives }; Primitives = Primitives
IConcreteBucklingCalculator bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy); };
var bucklingCalculator = new ConcreteBucklingCalculator(options, Accuracy);
return bucklingCalculator; return bucklingCalculator;
} }
private ForceTuple CalculateBuckling(ForceTuple calcTuple, IConcreteBucklingResult bucklingResult) private ForceTuple CalculateBuckling(IForceTuple calcTuple, IConcreteBucklingResult bucklingResult)
{ {
var newTuple = calcTuple.Clone() as ForceTuple; var newTuple = calcTuple.Clone() as ForceTuple;
newTuple.Mx *= bucklingResult.EtaFactorAlongY; newTuple.Mx *= bucklingResult.EtaFactorAlongY;
@@ -159,27 +225,86 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private string CheckInputData() private string CheckInputData()
{ {
string result = ""; string result = "";
NdmPrimitivesService.CheckPrimitives(Primitives); try
if (ForceActions.Count == 0) { result += "Calculator does not contain any forces \n"; } {
if (LimitStatesList.Count == 0) { result += "Calculator does not contain any limit states \n"; } NdmPrimitivesService.CheckPrimitives(Primitives);
if (CalcTermsList.Count == 0) { result += "Calculator does not contain any duration \n"; } }
catch (Exception ex)
{
result += ex;
}
if (ForceActions.Count == 0)
{
result += "Calculator does not contain any forces \n";
}
if (LimitStatesList.Count == 0)
{
result += "Calculator does not contain any limit states \n";
}
if (CalcTermsList.Count == 0)
{
result += "Calculator does not contain any duration \n";
}
return result; return result;
} }
public ForceCalculator() public ForceCalculator(IForceTupleCalculator forceTupleCalculator)
{
this.forceTupleCalculator = forceTupleCalculator;
SetDefaultProperties();
}
public ForceCalculator() : this(new ForceTupleCalculator())
{
}
private void SetDefaultProperties()
{ {
ForceActions = new List<IForceAction>(); ForceActions = new List<IForceAction>();
Primitives = new List<INdmPrimitive>(); Primitives = new List<INdmPrimitive>();
CompressedMember = new CompressedMember() { Buckling = false }; CompressedMember = new CompressedMember()
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 }; {
LimitStatesList = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS }; Buckling = false
CalcTermsList = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm }; };
Accuracy = new Accuracy()
{
IterationAccuracy = 0.001d,
MaxIterationCount = 1000
};
LimitStatesList = new List<LimitStates>()
{
LimitStates.ULS,
LimitStates.SLS
};
CalcTermsList = new List<CalcTerms>()
{
CalcTerms.ShortTerm,
CalcTerms.LongTerm
};
}
private void GetCombinations()
{
ForceCombinationLists = new List<IForceCombinationList>();
foreach (var item in ForceActions)
{
ForceCombinationLists.Add(item.GetCombinations());
}
} }
private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple) private IForcesTupleResult GetPrimitiveStrainMatrix(IEnumerable<INdm> ndmCollection, IForceTuple tuple, IAccuracy accuracy)
{ {
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = tuple, Accuracy = Accuracy }; var inputData = new ForceTupleInputData()
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData); {
NdmCollection = ndmCollection,
Tuple = tuple,
Accuracy = accuracy
};
var calculator = forceTupleCalculator.Clone() as IForceTupleCalculator;
calculator.InputData = inputData;
if (TraceLogger is not null)
{
calculator.TraceLogger = TraceLogger.GetSimilarTraceLogger();
}
calculator.Run(); calculator.Run();
return calculator.Result as IForcesTupleResult; return calculator.Result as IForcesTupleResult;
} }

View File

@@ -4,6 +4,7 @@ using LoaderCalculator.Data.ResultData;
using LoaderCalculator.Data.SourceData; using LoaderCalculator.Data.SourceData;
using StructureHelperCommon.Models; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Loggers;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{ {
@@ -74,7 +75,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
return new ForcesTupleResult() return new ForcesTupleResult()
{ {
IsValid = true, IsValid = true,
Description = "Analysis is done succsefully", Description = LoggerStrings.CalculationHasDone,
LoaderResults = calcResult LoaderResults = calcResult
}; };
} }
@@ -113,7 +114,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
public object Clone() public object Clone()
{ {
throw new NotImplementedException(); var newItem = new ForceTupleCalculator();
return newItem;
} }
private static void ShowResultToConsole(ILoaderResults result) private static void ShowResultToConsole(ILoaderResults result)

View File

@@ -0,0 +1,22 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IProcessTupleInputData : IInputData
{
List<INdm> Ndms { get; set; }
IForceCombinationList Combination { get; set; }
IDesignForceTuple Tuple { get; set; }
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public interface IProcessTupleLogic : ILogic
{
IForceTupleInputData InputData { get; set; }
IForcesTupleResult ProcessNdmResult();
}
}

View File

@@ -0,0 +1,20 @@
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
{
public class ProcessTupleLogic : IProcessTupleLogic
{
public IShiftTraceLogger? TraceLogger { get; set; }
IForceTupleInputData IProcessTupleLogic.InputData { get; set; }
public IForcesTupleResult ProcessNdmResult()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,21 @@
using LoaderCalculator.Data.Ndms;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling
{
public class BucklingInputData : IInputData
{
public IForceCombinationList Combination { get; set; }
public LimitStates LimitState { get; set; }
public CalcTerms CalcTerm { get; set; }
public List<INdm> Ndms { get; set; }
public IForceTuple ForceTuple { get; set; }
}
}

View File

@@ -4,6 +4,7 @@ using LoaderCalculator.Logics.Geometry;
using StructureHelperCommon.Models; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Calculators; using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperLogics.Models.Materials; using StructureHelperLogics.Models.Materials;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces; using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
@@ -28,16 +29,16 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public IAccuracy Accuracy { get; set; } public IAccuracy Accuracy { get; set; }
public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public Action<IResult> ActionToOutputResults { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public IShiftTraceLogger? TraceLogger { get; set; }
private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients() private (double EtaAlongX, double EtaAlongY) GetBucklingCoefficients()
{ {
var stiffness = GetStiffness(); var (DX, DY) = GetStiffness();
criticalForceLogic.LongitudinalForce = options.CalcForceTuple.Nz; criticalForceLogic.LongitudinalForce = options.CalcForceTuple.Nz;
criticalForceLogic.StiffnessEI = stiffness.DX; criticalForceLogic.StiffnessEI = DX;
criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorY; criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorY;
var etaAlongY = criticalForceLogic.GetEtaFactor(); var etaAlongY = criticalForceLogic.GetEtaFactor();
criticalForceLogic.StiffnessEI = stiffness.DY; criticalForceLogic.StiffnessEI = DY;
criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorX; criticalForceLogic.DesignLength = options.CompressedMember.GeometryLength * options.CompressedMember.LengthFactorX;
var etaAlongX = criticalForceLogic.GetEtaFactor(); var etaAlongX = criticalForceLogic.GetEtaFactor();
return (etaAlongX, etaAlongY); return (etaAlongX, etaAlongY);
@@ -59,13 +60,21 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
private (IConcreteDeltaELogic DeltaLogicX, IConcreteDeltaELogic DeltaLogicY) GetDeltaLogics() private (IConcreteDeltaELogic DeltaLogicX, IConcreteDeltaELogic DeltaLogicY) GetDeltaLogics()
{ {
IForceTuple forceTuple = options.CalcForceTuple; IForceTuple forceTuple = options.CalcForceTuple;
if (forceTuple.Nz >= 0) { return (new ConstDeltaELogic(), new ConstDeltaELogic()); } if (forceTuple.Nz >= 0)
{
return (new ConstDeltaELogic(), new ConstDeltaELogic());
}
var eccentricityAlongX = options.CalcForceTuple.My / forceTuple.Nz; var eccentricityAlongX = options.CalcForceTuple.My / forceTuple.Nz;
var eccentricityAlongY = options.CalcForceTuple.Mx / forceTuple.Nz; var eccentricityAlongY = options.CalcForceTuple.Mx / forceTuple.Nz;
var sizeAlongX = ndmCollection.Max(x => x.CenterX) - ndmCollection.Min(x => x.CenterX); var sizeAlongX = ndmCollection.Max(x => x.CenterX) - ndmCollection.Min(x => x.CenterX);
var sizeAlongY = ndmCollection.Max(x => x.CenterY) - ndmCollection.Min(x => x.CenterY); var sizeAlongY = ndmCollection.Max(x => x.CenterY) - ndmCollection.Min(x => x.CenterY);
var DeltaElogicAboutX = new DeltaELogicSP63(eccentricityAlongY, sizeAlongY); var DeltaElogicAboutX = new DeltaELogicSP63(eccentricityAlongY, sizeAlongY);
var DeltaElogicAboutY = new DeltaELogicSP63(eccentricityAlongX, sizeAlongX); var DeltaElogicAboutY = new DeltaELogicSP63(eccentricityAlongX, sizeAlongX);
if (TraceLogger is not null)
{
DeltaElogicAboutX.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
DeltaElogicAboutY.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
return (DeltaElogicAboutX, DeltaElogicAboutY); return (DeltaElogicAboutX, DeltaElogicAboutY);
} }
@@ -78,16 +87,26 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
private (double DX, double DY) GetStiffness() private (double DX, double DY) GetStiffness()
{ {
var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection); var gravityCenter = GeometryOperations.GetGravityCenter(ndmCollection);
string message = string.Format("Gravity center, x = {0}, y = {1}", gravityCenter.Cx, gravityCenter.Cy);
var concreteInertia = GeometryOperations.GetReducedMomentsOfInertia(concreteNdms, gravityCenter); TraceLogger?.AddMessage(message);
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));
var otherInertia = GeometryOperations.GetReducedMomentsOfInertia(otherNdms, gravityCenter); 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));
var stiffnessX = stiffnessLogicX.GetStiffnessCoeffitients(); var (Kc, Ks) = stiffnessLogicX.GetStiffnessCoeffitients();
var dX = stiffnessX.Kc * concreteInertia.EIx + stiffnessX.Ks * otherInertia.EIx; 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);
var stiffnessY = stiffnessLogicY.GetStiffnessCoeffitients(); var stiffnessY = stiffnessLogicY.GetStiffnessCoeffitients();
var dY = stiffnessY.Kc * concreteInertia.EIy + stiffnessY.Ks * otherInertia.EIy; 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);
return (dX, dY); return (dX, dY);
} }
@@ -113,34 +132,63 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
point = new Point2D() { X = item.CenterX, Y = item.CenterY }; 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);
return point; return point;
} }
private IForceTupleCalculator GetForceCalculator() private IForceTupleCalculator GetForceCalculator()
{ {
var tuple = options.CalcForceTuple; var tuple = options.CalcForceTuple;
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = tuple, Accuracy = Accuracy }; IForceTupleInputData inputData = new ForceTupleInputData()
{
NdmCollection = ndmCollection,
Tuple = tuple, Accuracy = Accuracy
};
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData); IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
return calculator; return calculator;
} }
public void Run() public void Run()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(LoggerStrings.MethodBasedOn + "SP63.13330.2018");
var checkResult = CheckInputData(); var checkResult = CheckInputData();
if (checkResult != "") if (checkResult != "")
{ {
Result = new ConcreteBucklingResult() { IsValid = false, Description = checkResult }; TraceLogger?.AddMessage(checkResult, TraceLogStatuses.Error);
Result = new ConcreteBucklingResult()
{
IsValid = false,
Description = checkResult,
EtaFactorAlongX = double.PositiveInfinity,
EtaFactorAlongY = double.PositiveInfinity
};
return; return;
} }
else else
{ {
IConcretePhiLLogic phiLLogic = GetPhiLogic(); var phiLLogic = GetPhiLogic();
var (DeltaLogicAboutX, DeltaLogicAboutY) = GetDeltaLogics(); var (DeltaLogicAboutX, DeltaLogicAboutY) = GetDeltaLogics();
stiffnessLogicX = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutX); stiffnessLogicX = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutX);
stiffnessLogicY = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutY); stiffnessLogicY = new RCStiffnessLogicSP63(phiLLogic, DeltaLogicAboutY);
if (TraceLogger is not null)
{
stiffnessLogicX.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
stiffnessLogicY.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
criticalForceLogic = new EilerCriticalForceLogic(); criticalForceLogic = new EilerCriticalForceLogic();
if (TraceLogger is not null)
{
criticalForceLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
var (EtaFactorX, EtaFactorY) = GetBucklingCoefficients(); var (EtaFactorX, EtaFactorY) = GetBucklingCoefficients();
var messageString = "Eta factor orbitrary {0} axis, Etta{0} = {1} (dimensionless)";
var messageStringX = string.Format(messageString, "X", EtaFactorX);
var messageStringY = string.Format(messageString, "Y", EtaFactorY);
TraceLogger?.AddMessage(messageStringX);
TraceLogger?.AddMessage(messageStringY);
Result = new ConcreteBucklingResult() Result = new ConcreteBucklingResult()
{ {
IsValid = true, IsValid = true,
@@ -148,17 +196,26 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
EtaFactorAlongY = EtaFactorY EtaFactorAlongY = EtaFactorY
}; };
} }
TraceLogger?.AddMessage(LoggerStrings.CalculationHasDone);
} }
private string CheckInputData() private string CheckInputData()
{ {
string result = ""; string result = "";
var tuple = options.CalcForceTuple;
if (tuple.Nz >= 0d)
{
result += $"Force Nz = {tuple.Nz} must negative in compression";
return result;
}
IForceTupleCalculator calculator = GetForceCalculator(); IForceTupleCalculator calculator = GetForceCalculator();
calculator.Run(); calculator.Run();
forcesResults = calculator.Result as IForcesTupleResult; forcesResults = calculator.Result as IForcesTupleResult;
if (forcesResults.IsValid != true) if (forcesResults.IsValid != true)
{ {
result += "Bearind capacity of crosssection is not enough for initial forces\n"; result += "Bearind capacity of cross-section is not enough for initial forces\n";
TraceLogger?.AddMessage("Initial forces", TraceLogStatuses.Error);
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
} }
return result; return result;
} }

View File

@@ -1,4 +1,6 @@
using System; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -8,9 +10,15 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
public class ConstDeltaELogic : IConcreteDeltaELogic public class ConstDeltaELogic : IConcreteDeltaELogic
{ {
private const double deltaE = 1.5d;
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetDeltaE() public double GetDeltaE()
{ {
return 1.5d; var message = string.Format("Simple method of calculatinf of effect of eccentricity, DeltaE = {0}, dimensionless", deltaE);
TraceLogger?.AddMessage(message);
return deltaE;
} }
} }
} }

View File

@@ -1,4 +1,5 @@
using System; using StructureHelperCommon.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -8,9 +9,15 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
internal class ConstPhiLLogic : IConcretePhiLLogic internal class ConstPhiLLogic : IConcretePhiLLogic
{ {
private const double phiL = 2.0d;
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetPhil() public double GetPhil()
{ {
return 2.0d; var message = string.Format("Simple method of calculatinf of effect of long term load, PhiL = {0}, dimensionless", phiL);
TraceLogger?.AddMessage(message);
return phiL;
} }
} }
} }

View File

@@ -1,4 +1,5 @@
using System; using StructureHelperCommon.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -10,6 +11,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
double concreteFactor, reinforcementFactor; double concreteFactor, reinforcementFactor;
public IShiftTraceLogger? TraceLogger { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public double GetCriticalForce() public double GetCriticalForce()
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -14,21 +16,31 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
readonly double eccentricity; readonly double eccentricity;
readonly double size; readonly double size;
public IShiftTraceLogger? TraceLogger { get; set; }
public DeltaELogicSP63(double eccentricity, double size) public DeltaELogicSP63(double eccentricity, double size)
{ {
if (size <= 0 ) if (size <= 0 )
{ {
TraceLogger?.AddMessage(string.Format("Height of cross-section is less or equal to zero, h = {0}", size));
throw new StructureHelperException(ErrorStrings.SizeMustBeGreaterThanZero + $", actual size: {size}"); throw new StructureHelperException(ErrorStrings.SizeMustBeGreaterThanZero + $", actual size: {size}");
} }
this.eccentricity = eccentricity; this.eccentricity = eccentricity;
this.size = size; this.size = size;
} }
public double GetDeltaE() public double GetDeltaE()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
TraceLogger?.AddMessage(string.Format("Eccentricity e = {0}", eccentricity));
TraceLogger?.AddMessage(string.Format("Height h = {0}", size));
var deltaE = Math.Abs(eccentricity) / size; var deltaE = Math.Abs(eccentricity) / size;
string message = string.Format("Relative eccentricity DeltaE = eccentricity / height = {0} / {1} = {2} (dimensionless)", eccentricity, size, deltaE);
TraceLogger?.AddMessage(message);
deltaE = Math.Max(deltaE, deltaEMin); deltaE = Math.Max(deltaE, deltaEMin);
deltaE = Math.Min(deltaE, deltaEMax); deltaE = Math.Min(deltaE, deltaEMax);
TraceLogger?.AddMessage(string.Format("But not less than {0}, and not greater than {1}", deltaEMin, deltaEMax));
TraceLogger?.AddMessage(string.Format("Relative eccentricity DeltaE = {0}", deltaE));
return deltaE; return deltaE;
} }
} }

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -12,22 +14,30 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public double LongitudinalForce { get; set; } public double LongitudinalForce { get; set; }
public double StiffnessEI { get; set; } public double StiffnessEI { get; set; }
public double DesignLength { get; set; } public double DesignLength { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetCriticalForce() public double GetCriticalForce()
{ {
double Ncr = - Math.Pow(Math.PI, 2) * StiffnessEI / (Math.Pow(DesignLength, 2)); double Ncr = - Math.Pow(Math.PI, 2) * StiffnessEI / Math.Pow(DesignLength, 2);
string message = string.Format("Ncr = - (PI ^ 2) * D / L0 ^2 = - ({0} * {1} / ({2} ^2)) = {3}, N", Math.PI, StiffnessEI, DesignLength, Ncr);
TraceLogger?.AddMessage(message);
return Ncr; return Ncr;
} }
public double GetEtaFactor() public double GetEtaFactor()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
if (LongitudinalForce >= 0d) return 1d; if (LongitudinalForce >= 0d) return 1d;
var Ncr = GetCriticalForce(); var Ncr = GetCriticalForce();
if (LongitudinalForce <= Ncr) if (LongitudinalForce <= Ncr)
{ {
string error = string.Format("Absolute value of longitudinalForce is greater or equal than critical force N = {0} => Ncr = {1}", Math.Abs(LongitudinalForce), Ncr);
TraceLogger?.AddMessage(error, TraceLogStatuses.Error);
throw new StructureHelperException(ErrorStrings.LongitudinalForceMustBeLessThanCriticalForce); throw new StructureHelperException(ErrorStrings.LongitudinalForceMustBeLessThanCriticalForce);
} }
double eta = 1 / (1 - LongitudinalForce / Ncr); double eta = 1 / (1 - LongitudinalForce / Ncr);
string message = string.Format("Eta factor Eta = 1 / (1 - N / Ncr) = 1 / (1 - {0} / {1}) = {2}, {3}", (-1) * LongitudinalForce, (-1) * Ncr, eta, LoggerStrings.DimensionLess);
TraceLogger?.AddMessage(message);
return eta; return eta;
} }
} }

View File

@@ -1,4 +1,5 @@
using System; using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
internal interface IConcreteDeltaELogic internal interface IConcreteDeltaELogic : ILogic
{ {
double GetDeltaE(); double GetDeltaE();
} }

View File

@@ -1,4 +1,5 @@
using System; using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
public interface IConcretePhiLLogic public interface IConcretePhiLLogic : ILogic
{ {
double GetPhil(); double GetPhil();
} }

View File

@@ -1,4 +1,5 @@
using System; using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
internal interface ICriticalBucklingForceLogic internal interface ICriticalBucklingForceLogic : ILogic
{ {
double GetCriticalForce(); double GetCriticalForce();
double GetEtaFactor(); double GetEtaFactor();

View File

@@ -1,4 +1,5 @@
using StructureHelperLogics.NdmCalculations.Primitives; using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperLogics.NdmCalculations.Primitives;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperLogics.NdmCalculations.Buckling namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
public interface IRCStiffnessLogic public interface IRCStiffnessLogic : ILogic
{ {
(double Kc, double Ks) GetStiffnessCoeffitients(); (double Kc, double Ks) GetStiffnessCoeffitients();
} }

View File

@@ -1,4 +1,6 @@
using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Loggers;
using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces; using StructureHelperCommon.Services.Forces;
using System; using System;
@@ -11,6 +13,8 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
public class PhiLogicSP63 : IConcretePhiLLogic public class PhiLogicSP63 : IConcretePhiLLogic
{ {
private const double maxValueOfPhiL = 2d;
private const double minValueOfPhiL = 1d;
readonly IForceTuple fullForceTuple; readonly IForceTuple fullForceTuple;
readonly IForceTuple longForceTuple; readonly IForceTuple longForceTuple;
readonly IPoint2D point; readonly IPoint2D point;
@@ -21,21 +25,43 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
this.point = point; this.point = point;
} }
public IShiftTraceLogger? TraceLogger { get; set; }
public double GetPhil() public double GetPhil()
{ {
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
var distance = Math.Sqrt(point.X * point.X + point.Y * point.Y); var distance = Math.Sqrt(point.X * point.X + point.Y * point.Y);
string distMessage = string.Format("Distance = Sqrt(dX ^2 + dY^2) = Sqrt(({0})^2 + ({1})^2) = {2}, m", point.X, point.Y, distance);
TraceLogger?.AddMessage(distMessage);
var fullMoment = GetMoment(fullForceTuple, distance); var fullMoment = GetMoment(fullForceTuple, distance);
string fullMomentMessage = string.Format("FullMoment = {0}, N*m", fullMoment);
TraceLogger?.AddMessage(fullMomentMessage);
var longMoment = GetMoment(longForceTuple, distance); var longMoment = GetMoment(longForceTuple, distance);
if (fullMoment == 0d) { return 2d; } string longMomentMessage = string.Format("LongMoment = {0}, N*m", longMoment);
var phi = 1 + longMoment / fullMoment; TraceLogger?.AddMessage(longMomentMessage);
phi = Math.Max(1, phi); if (fullMoment == 0d)
phi = Math.Min(2, phi); {
return phi; return maxValueOfPhiL;
}
var phiL = 1 + longMoment / fullMoment;
string phiLMessage = string.Format("PhiL = 1 + LongMoment / FullMoment = 1+ {0} / {1} = {2}, (dimensionless)", longMoment, fullMoment, phiL);
TraceLogger?.AddMessage(phiLMessage);
TraceLogger?.AddMessage(string.Format("But not less than {0}, and not greater than {1}", minValueOfPhiL, maxValueOfPhiL));
phiL = Math.Max(minValueOfPhiL, phiL);
phiL = Math.Min(maxValueOfPhiL, phiL);
TraceLogger?.AddMessage(string.Format("PhiL = {0}, (dimensionless)", phiL));
return phiL;
} }
private double GetMoment(IForceTuple forceTuple, double distance) private double GetMoment(IForceTuple forceTuple, double distance)
{ {
return Math.Abs(forceTuple.Nz) * distance + Math.Abs(forceTuple.Mx) + Math.Abs(forceTuple.My); double nz = Math.Abs(forceTuple.Nz);
double mx = Math.Abs(forceTuple.Mx);
double my = Math.Abs(forceTuple.My);
double moment = nz * distance + mx + my;
string message = string.Format("Moment = Nz * distance + Abs(Mx) + Abs(My) = {0} * {1} + {2} + {3} = {4}, N *m", nz, distance, mx, my, moment);
TraceLogger?.AddMessage(message);
return moment;
} }
} }
} }

View File

@@ -1,4 +1,6 @@
using System; using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Loggers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -8,8 +10,13 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
{ {
internal class RCStiffnessLogicSP63 : IRCStiffnessLogic internal class RCStiffnessLogicSP63 : IRCStiffnessLogic
{ {
const double initialKs = 0.7d;
const double initialKc = 0.15d;
const double deltaEAddition = 0.3d;
IConcretePhiLLogic phiLLogic { get; } IConcretePhiLLogic phiLLogic { get; }
IConcreteDeltaELogic deltaELogic { get; } IConcreteDeltaELogic deltaELogic { get; }
public IShiftTraceLogger? TraceLogger { get; set; }
public RCStiffnessLogicSP63() : this(new ConstPhiLLogic(), new ConstDeltaELogic()) { } public RCStiffnessLogicSP63() : this(new ConstPhiLLogic(), new ConstDeltaELogic()) { }
@@ -21,12 +28,17 @@ namespace StructureHelperLogics.NdmCalculations.Buckling
public (double Kc, double Ks) GetStiffnessCoeffitients() public (double Kc, double Ks) GetStiffnessCoeffitients()
{ {
const double initialKs = 0.7d; if (TraceLogger is not null)
const double initialKc = 0.15d; {
const double deltaEAddition = 0.3d; phiLLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
deltaELogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
}
double phiL = phiLLogic.GetPhil(); double phiL = phiLLogic.GetPhil();
double deltaE = deltaELogic.GetDeltaE(); double deltaE = deltaELogic.GetDeltaE();
TraceLogger?.AddMessage(string.Format("Factor of relative eccentricity DeltaE = {0}", deltaE));
double kc = initialKc / (phiL * (deltaEAddition + deltaE)); double kc = initialKc / (phiL * (deltaEAddition + deltaE));
var messageString = string.Format("Factor of stiffness of concrete Kc = {0} / ({1} * ({2} + {3})) = {4}, {5}", initialKc, phiL, deltaEAddition, deltaE, kc, LoggerStrings.DimensionLess);
TraceLogger?.AddMessage(messageString);
return (kc, initialKs); return (kc, initialKs);
} }
} }

View File

@@ -34,8 +34,14 @@ namespace StructureHelperLogics.Services.NdmPrimitives
public static bool CheckPrimitives(IEnumerable<INdmPrimitive> primitives) public static bool CheckPrimitives(IEnumerable<INdmPrimitive> primitives)
{ {
if (primitives.Count() == 0) { throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero"); } if (!primitives.Any())
if (primitives.Count(x => x.Triangulate == true) == 0) { throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate"); } {
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Count of primitive must be greater than zero");
}
if (!primitives.Any(x => x.Triangulate == true))
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": There are not primitives to triangulate");
}
foreach (var item in primitives) foreach (var item in primitives)
{ {
if (item.Triangulate == true & if (item.Triangulate == true &