Interactin diagram was added
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurveLogic
|
||||
public interface ILimitCurveLogic : IHasActionByResult
|
||||
{
|
||||
List<IPoint2D> GetPoints(List<IPoint2D> points);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public interface ILimitCurveParameterLogic
|
||||
public interface ILimitCurveParameterLogic : IHasActionByResult
|
||||
{
|
||||
IPoint2D CurrentPoint { get; set; }
|
||||
double GetParameter();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveCalculator : ICalculator
|
||||
public class LimitCurveCalculator : ICalculator, IHasActionByResult
|
||||
{
|
||||
private LimitCurveResult result;
|
||||
private List<IPoint2D> surroundList;
|
||||
@@ -50,14 +51,26 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
surroundList = SurroundProcLogic.GetPoints();
|
||||
try
|
||||
{
|
||||
limitCurveLogic.ActionToOutputResults = GetCurrentStepNumber;
|
||||
factoredList = limitCurveLogic.GetPoints(surroundList);
|
||||
result.Points = factoredList;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description = ex.Message;
|
||||
result.Description += ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetCurrentStepNumber(IResult calcResult)
|
||||
{
|
||||
if (calcResult is not FindParameterResult)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ExpectedWas(typeof(FindParameterResult), calcResult));
|
||||
}
|
||||
var parameterResult = calcResult as FindParameterResult;
|
||||
result.IterationNumber = parameterResult.IterationNumber;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
private FindParameterResult result;
|
||||
private IPoint2D currentPoint;
|
||||
private ILimitCurveParameterLogic parameterLogic;
|
||||
public Predicate<IPoint2D> LimitPredicate { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public LimitCurveLogic(ILimitCurveParameterLogic parameterLogic)
|
||||
{
|
||||
this.parameterLogic = parameterLogic;
|
||||
@@ -24,6 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
}
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
{
|
||||
result = new();
|
||||
List<IPoint2D> resultList = new();
|
||||
if (LimitPredicate(new Point2D()) == true)
|
||||
{
|
||||
@@ -48,6 +52,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
Y = currentPoint.Y * parameter
|
||||
};
|
||||
resultList.Add(resultPoint);
|
||||
result.IterationNumber = resultList.Count;
|
||||
ActionToOutputResults?.Invoke(result);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveParameterLogic : ILimitCurveParameterLogic
|
||||
{
|
||||
private FindParameterResult result;
|
||||
private Predicate<Point2D> limitPredicate;
|
||||
public IPoint2D CurrentPoint { get; set; }
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public LimitCurveParameterLogic(Predicate<Point2D> limitPredicate)
|
||||
{
|
||||
@@ -31,8 +33,16 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": predicate for point (x={CurrentPoint.X}, y={CurrentPoint.Y}) is not valid");
|
||||
}
|
||||
var result = parameterCalculator.Result as FindParameterResult;
|
||||
result = parameterCalculator.Result as FindParameterResult;
|
||||
var parameter = result.Parameter;
|
||||
if (parameter < 0.1d)
|
||||
{
|
||||
parameterCalculator.Accuracy.IterationAccuracy = 0.0001d;
|
||||
parameterCalculator.Run();
|
||||
result = parameterCalculator.Result as FindParameterResult;
|
||||
parameter = result.Parameter;
|
||||
}
|
||||
|
||||
return parameter;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class LimitCurveResult : IResult
|
||||
public class LimitCurveResult : IResult, IiterationResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<IPoint2D> Points { get; set; }
|
||||
public int IterationNumber { get; set; }
|
||||
|
||||
public LimitCurveResult()
|
||||
{
|
||||
Points = new List<IPoint2D>();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -12,17 +13,52 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class PredicateFactory
|
||||
{
|
||||
|
||||
private ForceTupleCalculator calculator;
|
||||
private ForceTuple tuple;
|
||||
private ForceTupleInputData inputData;
|
||||
public IEnumerable<INdm> Ndms { get; set; }
|
||||
public double My { get; set; }
|
||||
public bool GetResult(IPoint2D point)
|
||||
public PredicateFactory()
|
||||
{
|
||||
var calculator = new ForceTupleCalculator();
|
||||
var tuple = new ForceTuple() { Nz = point.Y, Mx = point.X, My = My };
|
||||
var inputData = new ForceTupleInputData() { Tuple = tuple, NdmCollection = Ndms };
|
||||
calculator.InputData = inputData;
|
||||
inputData = new();
|
||||
calculator = new() { InputData = inputData };
|
||||
}
|
||||
public bool IsSectionFailure(IPoint2D point)
|
||||
{
|
||||
tuple = new()
|
||||
{
|
||||
Nz = point.Y,
|
||||
Mx = point.X,
|
||||
My = My
|
||||
};
|
||||
inputData.Tuple = tuple;
|
||||
inputData.NdmCollection = Ndms;
|
||||
calculator.Run();
|
||||
var result = calculator.Result;
|
||||
return !result.IsValid;
|
||||
}
|
||||
|
||||
public bool IsSectionCracked(IPoint2D point)
|
||||
{
|
||||
var logic = new HoleSectionCrackedLogic();
|
||||
tuple = new()
|
||||
{
|
||||
Nz = point.Y,
|
||||
Mx = point.X,
|
||||
My = My
|
||||
};
|
||||
logic.Tuple = tuple;
|
||||
logic.NdmCollection = Ndms;
|
||||
try
|
||||
{
|
||||
var result = logic.IsSectionCracked();
|
||||
return result;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,6 +10,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
public class StabLimitCurveLogic : ILimitCurveLogic
|
||||
{
|
||||
public Action<IResult> ActionToOutputResults { get; set; }
|
||||
|
||||
public List<IPoint2D> GetPoints(List<IPoint2D> points)
|
||||
{
|
||||
var result = new List<IPoint2D>();
|
||||
|
||||
@@ -12,6 +12,15 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
public double XMin { get; set; }
|
||||
public double YMax { get; set; }
|
||||
public double YMin { get; set; }
|
||||
public double ConstZ { get; set; }
|
||||
public int PointCount { get; set; }
|
||||
public SurroundData()
|
||||
{
|
||||
XMax = 1e7d;
|
||||
XMin = -1e7d;
|
||||
YMax = 1e7d;
|
||||
YMin = -1e7d;
|
||||
PointCount = 80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user