Force crack calculator was fixed
This commit is contained in:
@@ -23,7 +23,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
{
|
{
|
||||||
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
static IConvertUnitLogic operationLogic = new ConvertUnitLogic();
|
||||||
static IGetUnitLogic unitLogic = new GetUnitLogic();
|
static IGetUnitLogic unitLogic = new GetUnitLogic();
|
||||||
static readonly CrackForceCalculator calculator = new();
|
static readonly CrackForceBynarySearchCalculator calculator = new();
|
||||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
private List<IForcesTupleResult> ValidTupleList { get; set; }
|
private List<IForcesTupleResult> ValidTupleList { get; set; }
|
||||||
@@ -103,7 +103,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
validTupleList[i].DesignForceTuple.ForceTuple.My * unitMoment.Multiplyer,
|
||||||
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer
|
validTupleList[i].DesignForceTuple.ForceTuple.Nz * unitForce.Multiplyer
|
||||||
};
|
};
|
||||||
calculator.EndTuple = validTupleList[i].DesignForceTuple.ForceTuple;
|
calculator.InputData.EndTuple = validTupleList[i].DesignForceTuple.ForceTuple;
|
||||||
var limitState = validTupleList[i].DesignForceTuple.LimitState;
|
var limitState = validTupleList[i].DesignForceTuple.LimitState;
|
||||||
var calcTerm = validTupleList[i].DesignForceTuple.CalcTerm;
|
var calcTerm = validTupleList[i].DesignForceTuple.CalcTerm;
|
||||||
triangulateLogic = new TriangulatePrimitiveLogic()
|
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
@@ -114,7 +114,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
TraceLogger = TraceLogger
|
TraceLogger = TraceLogger
|
||||||
};
|
};
|
||||||
var ndms = triangulateLogic.GetNdms();
|
var ndms = triangulateLogic.GetNdms();
|
||||||
calculator.NdmCollection = ndms;
|
calculator.InputData.CheckedNdmCollection = calculator.InputData.SectionNdmCollection = ndms;
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = (CrackForceResult)calculator.Result;
|
var result = (CrackForceResult)calculator.Result;
|
||||||
if (result.IsValid == false)
|
if (result.IsValid == false)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
|||||||
public class CrackCalculatorInputDataViewModel : OkCancelViewModelBase
|
public class CrackCalculatorInputDataViewModel : OkCancelViewModelBase
|
||||||
{
|
{
|
||||||
private CrackCalculator calculator;
|
private CrackCalculator calculator;
|
||||||
CrackInputData crackInputData;
|
CrackCalculatorInputData crackInputData;
|
||||||
private bool setUserValueSofteningFactor;
|
private bool setUserValueSofteningFactor;
|
||||||
private double softeningFactor;
|
private double softeningFactor;
|
||||||
private string name;
|
private string name;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
{
|
{
|
||||||
internal class ShowCrackResultLogic
|
internal class ShowCrackResultLogic
|
||||||
{
|
{
|
||||||
private CrackForceCalculator calculator;
|
private CrackForceBynarySearchCalculator calculator;
|
||||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
|
|
||||||
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
public static GeometryNames GeometryNames => ProgramSetting.GeometryNames;
|
||||||
@@ -39,17 +39,18 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
|||||||
|
|
||||||
private void FindCrackFactor(IForceTuple finishDesignTuple, IForceTuple startDesignTuple)
|
private void FindCrackFactor(IForceTuple finishDesignTuple, IForceTuple startDesignTuple)
|
||||||
{
|
{
|
||||||
calculator = new CrackForceCalculator();
|
calculator = new CrackForceBynarySearchCalculator();
|
||||||
calculator.TraceLogger = new ShiftTraceLogger();
|
calculator.TraceLogger = new ShiftTraceLogger();
|
||||||
calculator.StartTuple = startDesignTuple;
|
calculator.InputData.StartTuple = startDesignTuple;
|
||||||
calculator.EndTuple = finishDesignTuple;
|
calculator.InputData.EndTuple = finishDesignTuple;
|
||||||
triangulateLogic = new TriangulatePrimitiveLogic()
|
triangulateLogic = new TriangulatePrimitiveLogic()
|
||||||
{
|
{
|
||||||
Primitives = ndmPrimitives,
|
Primitives = ndmPrimitives,
|
||||||
LimitState = LimitState,
|
LimitState = LimitState,
|
||||||
CalcTerm = CalcTerm
|
CalcTerm = CalcTerm
|
||||||
};
|
};
|
||||||
calculator.NdmCollection = triangulateLogic.GetNdms();
|
var ndms = triangulateLogic.GetNdms();
|
||||||
|
calculator.InputData.CheckedNdmCollection = calculator.InputData.SectionNdmCollection = ndms;
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = (CrackForceResult)calculator.Result;
|
var result = (CrackForceResult)calculator.Result;
|
||||||
if (result.IsValid)
|
if (result.IsValid)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
|||||||
|
|
||||||
private void AddCrackCalculator()
|
private void AddCrackCalculator()
|
||||||
{
|
{
|
||||||
var inputData = new CrackInputData();
|
var inputData = new CrackCalculatorInputData();
|
||||||
var calculator = new CrackCalculator(inputData)
|
var calculator = new CrackCalculator(inputData)
|
||||||
{
|
{
|
||||||
Name = "New crack calculator",
|
Name = "New crack calculator",
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICheckEntityLogic<TEntity> : ICheckLogic
|
||||||
|
{
|
||||||
|
TEntity Entity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,9 +6,19 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Logic for checking entities
|
||||||
|
/// </summary>
|
||||||
public interface ICheckLogic : ILogic
|
public interface ICheckLogic : ILogic
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Text result of checking
|
||||||
|
/// </summary>
|
||||||
string CheckResult { get; }
|
string CheckResult { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Start checking process
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
bool Check();
|
bool Check();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
public class CheckAccuracyLogic : ICheckEntityLogic<IAccuracy>
|
||||||
|
{
|
||||||
|
private string checkResult;
|
||||||
|
private bool result;
|
||||||
|
|
||||||
|
public IAccuracy Entity { get; set; }
|
||||||
|
|
||||||
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public CheckAccuracyLogic(IShiftTraceLogger traceLogger)
|
||||||
|
{
|
||||||
|
TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckAccuracyLogic() : this (null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
if (Entity is null)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
string errorString = "\nAccuracy requirements is not assigned";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Entity.IterationAccuracy <= 0)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage($"\nValue of accuracy {Entity.IterationAccuracy} must be grater than zero");
|
||||||
|
}
|
||||||
|
if (Entity.MaxIterationCount <= 0)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage($"\nMax number of iteration {Entity.MaxIterationCount} must be grater than zero");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString;
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,14 +10,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperCommon.Models.Calculators
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
{
|
{
|
||||||
public class FindParameterCalculator : ICalculator, IHasActionByResult
|
public class FindParameterCalculator : IFindParameterCalculator
|
||||||
{
|
{
|
||||||
FindParameterResult result;
|
FindParameterResult result;
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public double StartValue { get; set; }
|
public IFindParameterCalculatorInputData InputData { get; set; }
|
||||||
public double EndValue { get; set; }
|
public IAccuracy Accuracy { get; set; }
|
||||||
public Predicate<double> Predicate { get; set; }
|
|
||||||
public IAccuracy Accuracy {get;set;}
|
|
||||||
public IResult Result => result;
|
public IResult Result => result;
|
||||||
|
|
||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
@@ -25,18 +23,21 @@ namespace StructureHelperCommon.Models.Calculators
|
|||||||
|
|
||||||
public FindParameterCalculator()
|
public FindParameterCalculator()
|
||||||
{
|
{
|
||||||
StartValue = 0d;
|
InputData = new FindParameterCalculatorInputData();
|
||||||
EndValue = 1d;
|
Accuracy = new Accuracy()
|
||||||
Accuracy = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 1000 };
|
{
|
||||||
|
IterationAccuracy = 0.001d,
|
||||||
|
MaxIterationCount = 1000
|
||||||
|
};
|
||||||
}
|
}
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
result = new();
|
result = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FindMinimumValue(StartValue, EndValue, Predicate);
|
FindMinimumValue(InputData.StartValue, InputData.EndValue, InputData.Predicate);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
result.IsValid = false;
|
result.IsValid = false;
|
||||||
result.Description += ex;
|
result.Description += ex;
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public class FindParameterCalculatorInputData : IFindParameterCalculatorInputData
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public double StartValue { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public double EndValue { get; set; }
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public Predicate<double> Predicate { get; set; }
|
||||||
|
public FindParameterCalculatorInputData()
|
||||||
|
{
|
||||||
|
StartValue = 0d;
|
||||||
|
EndValue = 1d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
public interface IFindParameterCalculator : ICalculator, IHasActionByResult
|
||||||
|
{
|
||||||
|
IAccuracy Accuracy { get; set; }
|
||||||
|
IFindParameterCalculatorInputData InputData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace StructureHelperCommon.Models.Calculators
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input data for calculators of finding parameters
|
||||||
|
/// </summary>
|
||||||
|
public interface IFindParameterCalculatorInputData : IInputData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Start value of range where parameter looking for
|
||||||
|
/// </summary>
|
||||||
|
double StartValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// End value of range where parameter looking for
|
||||||
|
/// </summary>
|
||||||
|
double EndValue { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Predicate for checking parameter for true;
|
||||||
|
/// </summary>
|
||||||
|
Predicate<double> Predicate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,8 @@ namespace StructureHelperCommon.Models
|
|||||||
public interface ITraceLogger
|
public interface ITraceLogger
|
||||||
{
|
{
|
||||||
List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
List<ITraceLoggerEntry> TraceLoggerEntries { get; }
|
||||||
void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPriority = 0);
|
void AddMessage(string message, TraceLogStatuses status, int shiftPriority = 0);
|
||||||
|
void AddMessage(string message);
|
||||||
void AddMessage(string message, int priority);
|
void AddMessage(string message, int priority);
|
||||||
bool KeepErrorStatus { get; set; }
|
bool KeepErrorStatus { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace StructureHelperCommon.Models
|
|||||||
KeepErrorStatus = true;
|
KeepErrorStatus = true;
|
||||||
}
|
}
|
||||||
public ShiftTraceLogger() : this(new TraceLogger()) { }
|
public ShiftTraceLogger() : this(new TraceLogger()) { }
|
||||||
public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0)
|
public void AddMessage(string message, TraceLogStatuses status, int shiftPrioriry = 0)
|
||||||
{
|
{
|
||||||
// if status in (fatal, error, warning) they must be kept as they are
|
// if status in (fatal, error, warning) they must be kept as they are
|
||||||
if (status <= TraceLogStatuses.Warning & KeepErrorStatus == true)
|
if (status <= TraceLogStatuses.Warning & KeepErrorStatus == true)
|
||||||
@@ -57,5 +57,10 @@ namespace StructureHelperCommon.Models
|
|||||||
}
|
}
|
||||||
Logger.TraceLoggerEntries.Add(loggerEntry);
|
Logger.TraceLoggerEntries.Add(loggerEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddMessage(string message)
|
||||||
|
{
|
||||||
|
AddMessage(message, TraceLogStatuses.Info,0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace StructureHelperCommon.Models
|
|||||||
KeepErrorStatus = true;
|
KeepErrorStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMessage(string message, TraceLogStatuses status = TraceLogStatuses.Info, int shiftPrioriry = 0)
|
public void AddMessage(string message, TraceLogStatuses status, int shiftPrioriry = 0)
|
||||||
{
|
{
|
||||||
if (status == TraceLogStatuses.Fatal) { message = $"Fatal error! {message}"; }
|
if (status == TraceLogStatuses.Fatal) { message = $"Fatal error! {message}"; }
|
||||||
if (status == TraceLogStatuses.Error) { message = $"Error! {message}"; }
|
if (status == TraceLogStatuses.Error) { message = $"Error! {message}"; }
|
||||||
@@ -38,5 +38,10 @@ namespace StructureHelperCommon.Models
|
|||||||
Priority = priority
|
Priority = priority
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddMessage(string message)
|
||||||
|
{
|
||||||
|
AddMessage(message, TraceLogStatuses.Info,0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
|
|||||||
TraceLogger = new ShiftTraceLogger()
|
TraceLogger = new ShiftTraceLogger()
|
||||||
};
|
};
|
||||||
calculators.Add(forceCalculator);
|
calculators.Add(forceCalculator);
|
||||||
CrackInputData newInputData = new CrackInputData();
|
CrackCalculatorInputData newInputData = new CrackCalculatorInputData();
|
||||||
var checkLogic = new CheckCrackCalculatorInputDataLogic
|
var checkLogic = new CheckCrackCalculatorInputDataLogic
|
||||||
{
|
{
|
||||||
InputData = newInputData
|
InputData = newInputData
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -10,46 +13,77 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<ForceInputData>
|
internal class CheckForceCalculatorInputData : ICheckInputDataLogic<IForceInputData>
|
||||||
{
|
{
|
||||||
|
private bool result;
|
||||||
|
private string checkResult;
|
||||||
|
private ICheckEntityLogic<IAccuracy> checkAccuracyLogic;
|
||||||
|
|
||||||
public ForceInputData InputData { get; set; }
|
public IForceInputData InputData { get; set; }
|
||||||
|
|
||||||
public string CheckResult { get; private set; }
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public CheckForceCalculatorInputData(ForceInputData inputData)
|
public CheckForceCalculatorInputData(ICheckEntityLogic<IAccuracy> checkAccuracyLogic)
|
||||||
{
|
{
|
||||||
InputData = inputData;
|
this.checkAccuracyLogic = checkAccuracyLogic;
|
||||||
CheckResult = string.Empty;
|
}
|
||||||
|
|
||||||
|
public CheckForceCalculatorInputData() : this(new CheckAccuracyLogic())
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Check()
|
public bool Check()
|
||||||
{
|
{
|
||||||
bool result = true;
|
result = true;
|
||||||
CheckResult = string.Empty;
|
checkResult = string.Empty;
|
||||||
if (!InputData.Primitives.Any())
|
if (InputData is null)
|
||||||
{
|
{
|
||||||
CheckResult += "Calculator does not contain any primitives \n";
|
string errorString = ErrorStrings.ParameterIsNull + ": input data";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
}
|
||||||
|
if (InputData.Primitives is null || !InputData.Primitives.Any())
|
||||||
|
{
|
||||||
|
TraceMessage("Calculator does not contain any primitives");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (!InputData.ForceActions.Any())
|
if (InputData.ForceActions is null || !InputData.ForceActions.Any())
|
||||||
{
|
{
|
||||||
CheckResult += "Calculator does not contain any forces \n";
|
TraceMessage("Calculator does not contain any forces");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (!InputData.LimitStatesList.Any())
|
if (InputData.LimitStatesList is null || !InputData.LimitStatesList.Any())
|
||||||
{
|
{
|
||||||
CheckResult += "Calculator does not contain any limit states \n";
|
TraceMessage("Calculator does not contain any limit states");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (!InputData.CalcTermsList.Any())
|
if (InputData.CalcTermsList is null || !InputData.CalcTermsList.Any())
|
||||||
{
|
{
|
||||||
CheckResult += "Calculator does not contain any calc term \n";
|
TraceMessage("Calculator does not contain any calc term");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
CheckAccuracy();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckAccuracy()
|
||||||
|
{
|
||||||
|
checkAccuracyLogic.Entity = InputData.Accuracy;
|
||||||
|
checkAccuracyLogic.TraceLogger = TraceLogger;
|
||||||
|
if (checkAccuracyLogic.Check() == false)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
TraceMessage(checkAccuracyLogic.CheckResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString + "\n";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
{
|
{
|
||||||
public class ForceCalculator : ICalculator, IHasActionByResult
|
public class ForceCalculator : ICalculator, IHasActionByResult
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<ForceCalculator> updateStrategy = new ForceCalculatorUpdateStrategy();
|
private IUpdateStrategy<ForceCalculator> updateStrategy;
|
||||||
private ICheckInputDataLogic<ForceInputData> checkInputDataLogic;
|
private ICheckInputDataLogic<IForceInputData> checkInputDataLogic;
|
||||||
private IForceCalculatorLogic forceCalculatorLogic;
|
private IForceCalculatorLogic forceCalculatorLogic;
|
||||||
|
|
||||||
|
|
||||||
@@ -19,11 +19,30 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
public IResult Result { get; private set; }
|
public IResult Result { get; private set; }
|
||||||
|
|
||||||
|
public ForceCalculator(ICheckInputDataLogic<IForceInputData> checkInputDataLogic,
|
||||||
|
IForceCalculatorLogic forceCalculatorLogic,
|
||||||
|
IUpdateStrategy<ForceCalculator> updateStrategy
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
|
this.forceCalculatorLogic = forceCalculatorLogic;
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
|
||||||
|
InputData = new ForceInputData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceCalculator() :
|
||||||
|
this(new CheckForceCalculatorInputData(),
|
||||||
|
new ForceCalculatorLogic(),
|
||||||
|
new ForceCalculatorUpdateStrategy())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
checkInputDataLogic = new CheckForceCalculatorInputData(InputData);
|
checkInputDataLogic.InputData = InputData;
|
||||||
checkInputDataLogic.TraceLogger?.GetSimilarTraceLogger(50);
|
checkInputDataLogic.TraceLogger = TraceLogger;
|
||||||
if (checkInputDataLogic.Check() != true)
|
if (checkInputDataLogic.Check() != true)
|
||||||
{
|
{
|
||||||
Result = new ForcesResults()
|
Result = new ForcesResults()
|
||||||
@@ -33,6 +52,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
forceCalculatorLogic.InputData = InputData;
|
||||||
if (ActionToOutputResults is not null)
|
if (ActionToOutputResults is not null)
|
||||||
{
|
{
|
||||||
forceCalculatorLogic.ActionToOutputResults = ActionToOutputResults;
|
forceCalculatorLogic.ActionToOutputResults = ActionToOutputResults;
|
||||||
@@ -46,31 +66,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForceCalculator(ForceInputData inputData,
|
|
||||||
ICheckInputDataLogic<ForceInputData> checkInputDataLogic,
|
|
||||||
IForceCalculatorLogic forceCalculatorLogic,
|
|
||||||
IUpdateStrategy<ForceCalculator> updateStrategy
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this.InputData = inputData;
|
|
||||||
this.checkInputDataLogic = checkInputDataLogic;
|
|
||||||
this.forceCalculatorLogic = forceCalculatorLogic;
|
|
||||||
this.updateStrategy = updateStrategy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForceCalculator(ForceInputData inputData) :
|
|
||||||
this(inputData,
|
|
||||||
new CheckForceCalculatorInputData(inputData),
|
|
||||||
new ForceCalculatorLogic(inputData),
|
|
||||||
new ForceCalculatorUpdateStrategy())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ForceCalculator() : this(new ForceInputData()) { }
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var newCalculator = new ForceCalculator(new ForceInputData());
|
var newCalculator = new ForceCalculator();
|
||||||
updateStrategy.Update(newCalculator, this);
|
updateStrategy.Update(newCalculator, this);
|
||||||
return newCalculator;
|
return newCalculator;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,11 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
private IProcessorLogic<IForceTuple> eccentricityLogic;
|
||||||
private ForceTupleBucklingLogic bucklingLogic;
|
private ForceTupleBucklingLogic bucklingLogic;
|
||||||
private ITriangulatePrimitiveLogic triangulateLogic;
|
private ITriangulatePrimitiveLogic triangulateLogic;
|
||||||
public ForceInputData InputData { get; set; }
|
public IForceInputData InputData { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
|
|
||||||
public ForceCalculatorLogic(ForceInputData inputData)
|
|
||||||
{
|
|
||||||
InputData = inputData;
|
|
||||||
}
|
|
||||||
public ForcesResults GetForcesResults()
|
public ForcesResults GetForcesResults()
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
TraceLogger?.AddMessage(LoggerStrings.CalculatorType(this), TraceLogStatuses.Service);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public class ForceInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
public class ForceInputData : IForceInputData
|
||||||
{
|
{
|
||||||
public List<LimitStates> LimitStatesList { get; private set; }
|
public List<LimitStates> LimitStatesList { get; private set; }
|
||||||
public List<CalcTerms> CalcTermsList { get; private set; }
|
public List<CalcTerms> CalcTermsList { get; private set; }
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using LoaderCalculator.Data.Ndms;
|
|||||||
using LoaderCalculator.Data.ResultData;
|
using LoaderCalculator.Data.ResultData;
|
||||||
using LoaderCalculator.Data.SourceData;
|
using LoaderCalculator.Data.SourceData;
|
||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
@@ -13,122 +14,78 @@ using StructureHelperLogics.Services;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public class ForceTupleCalculator : IForceTupleCalculator, IHasActionByResult
|
public class ForceTupleCalculator : IForceTupleCalculator
|
||||||
{
|
{
|
||||||
IForceTupleTraceResultLogic forceTupleTraceResultLogic;
|
IForceTupleTraceResultLogic forceTupleTraceResultLogic;
|
||||||
|
IForcesTupleResult result;
|
||||||
|
private ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic;
|
||||||
|
private IForceTupleCalcLogic calcLogic;
|
||||||
|
|
||||||
public IForceTupleInputData InputData { get; set; }
|
public IForceTupleInputData InputData { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IResult Result { get; private set; }
|
public IResult Result => result;
|
||||||
|
|
||||||
public Action<IResult> ActionToOutputResults { get; set; }
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public ForceTupleCalculator()
|
public ForceTupleCalculator(ICheckInputDataLogic<IForceTupleInputData> checkInputDataLogic, IForceTupleCalcLogic calcLogic)
|
||||||
|
{
|
||||||
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
|
this.calcLogic = calcLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForceTupleCalculator() : this(new CheckForceTupleInputDataLogic(), new ForceTupleCalcLogic())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
Result = CalculateResult();
|
PrepareNewResult();
|
||||||
|
if (CheckInputData() == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
CalculateResult();
|
||||||
private IForcesTupleResult CalculateResult()
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
if (TraceLogger is not null)
|
|
||||||
{
|
|
||||||
TraceService.TraceNdmCollection(TraceLogger, ndmCollection);
|
|
||||||
}
|
}
|
||||||
var tuple = InputData.Tuple;
|
|
||||||
var accuracy = InputData.Accuracy;
|
|
||||||
TraceLogger?.AddMessage(string.Intern("Input force combination"));
|
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tuple));
|
|
||||||
var mx = tuple.Mx;
|
|
||||||
var my = tuple.My;
|
|
||||||
var nz = tuple.Nz;
|
|
||||||
TraceLogger?.AddMessage($"Required accuracy rate {accuracy.IterationAccuracy}");
|
|
||||||
TraceLogger?.AddMessage($"Maximum iteration count {accuracy.MaxIterationCount}");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var loaderData = new LoaderOptions
|
|
||||||
{
|
|
||||||
Preconditions = new Preconditions
|
|
||||||
{
|
|
||||||
ConditionRate = accuracy.IterationAccuracy,
|
|
||||||
MaxIterationCount = accuracy.MaxIterationCount,
|
|
||||||
StartForceMatrix = new ForceMatrix { Mx = mx, My = my, Nz = nz }
|
|
||||||
},
|
|
||||||
ActionToOutputResults = ShowResultToTrace,
|
|
||||||
NdmCollection = ndmCollection
|
|
||||||
};
|
|
||||||
var calculator = new Calculator();
|
|
||||||
TraceLogger?.AddMessage(string.Intern("Calculation is started"), TraceLogStatuses.Debug);
|
|
||||||
calculator.Run(loaderData, new CancellationToken());
|
|
||||||
TraceLogger?.AddMessage(string.Intern("Calculation result is obtained"), TraceLogStatuses.Debug);
|
|
||||||
var calcResult = calculator.Result;
|
|
||||||
if (calcResult.AccuracyRate <= accuracy.IterationAccuracy)
|
|
||||||
{
|
|
||||||
var result = new ForcesTupleResult()
|
|
||||||
{
|
|
||||||
IsValid = true,
|
|
||||||
Description = LoggerStrings.CalculationHasDone,
|
|
||||||
LoaderResults = calcResult
|
|
||||||
};
|
|
||||||
forceTupleTraceResultLogic = new ForceTupleTraceResultLogic(ndmCollection) { TraceLogger = TraceLogger };
|
|
||||||
forceTupleTraceResultLogic.TraceResult(result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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 = string.Intern("Required accuracy rate has not achieved"),
|
|
||||||
LoaderResults = calcResult
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage($"Critical error ocured during calculation\n{ex}", TraceLogStatuses.Error);
|
|
||||||
var result = new ForcesTupleResult()
|
|
||||||
{
|
|
||||||
IsValid = false
|
|
||||||
};
|
|
||||||
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero")
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
result.Description = $"Error is appeared due to analysis. Error: {ex}";
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
var newItem = new ForceTupleCalculator();
|
var newItem = new ForceTupleCalculator();
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ShowResultToConsole(ILoaderResults result)
|
private void CalculateResult()
|
||||||
{
|
{
|
||||||
var strain = result.StrainMatrix;
|
calcLogic.InputData = InputData;
|
||||||
//MessageBox.Show($" Текущие результаты в {result.IterationCounter} итерации:");
|
calcLogic.ActionToOutputResults = ActionToOutputResults;
|
||||||
|
calcLogic.TraceLogger = TraceLogger;
|
||||||
|
calcLogic.Calculate();
|
||||||
|
result = calcLogic.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowResultToTrace(ILoaderResults result)
|
private void PrepareNewResult()
|
||||||
{
|
{
|
||||||
var strain = result.StrainMatrix;
|
result = new ForcesTupleResult()
|
||||||
TraceLogger?.AddMessage($"Iteration {result.IterationCounter}, current accuracy rate {result.AccuracyRate}", TraceLogStatuses.Debug,100);
|
{
|
||||||
|
IsValid = true,
|
||||||
|
Description = string.Empty,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckInputData()
|
||||||
|
{
|
||||||
|
checkInputDataLogic.InputData = InputData;
|
||||||
|
checkInputDataLogic.TraceLogger = TraceLogger;
|
||||||
|
if (checkInputDataLogic.Check() == false)
|
||||||
|
{
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description += checkInputDataLogic.CheckResult;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
{
|
{
|
||||||
public interface IForceCalculatorLogic : ILogic, IHasActionByResult
|
public interface IForceCalculatorLogic : ILogic, IHasActionByResult
|
||||||
{
|
{
|
||||||
ForceInputData InputData { get; set; }
|
IForceInputData InputData { get; set; }
|
||||||
ForcesResults GetForcesResults();
|
ForcesResults GetForcesResults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Sections;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public interface IForceInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
||||||
|
{
|
||||||
|
IAccuracy Accuracy { get; set; }
|
||||||
|
List<CalcTerms> CalcTermsList { get; }
|
||||||
|
ICompressedMember CompressedMember { get; set; }
|
||||||
|
List<IForceCombinationList> ForceCombinationLists { get; set; }
|
||||||
|
List<LimitStates> LimitStatesList { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForceTupleCalculator : ICalculator
|
public interface IForceTupleCalculator : ICalculator, IHasActionByResult
|
||||||
{
|
{
|
||||||
IForceTupleInputData InputData {get;set;}
|
IForceTupleInputData InputData {get;set;}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
{
|
{
|
||||||
public interface IForceTupleInputData
|
public interface IForceTupleInputData : IInputData
|
||||||
{
|
{
|
||||||
IEnumerable<INdm> NdmCollection { get; set; }
|
IEnumerable<INdm> NdmCollection { get; set; }
|
||||||
IForceTuple Tuple { get; set; }
|
IForceTuple Tuple { get; set; }
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
private bool IsSectionCracked(IPoint2D point2D)
|
private bool IsSectionCracked(IPoint2D point2D)
|
||||||
{
|
{
|
||||||
logger?.TraceLoggerEntries.Clear();
|
logger?.TraceLoggerEntries.Clear();
|
||||||
var logic = new SectionCrackedLogic();
|
var logic = new IsSectionCrackedByForceLogic();
|
||||||
var point3D = ConvertLogic.GetPoint3D(point2D);
|
var point3D = ConvertLogic.GetPoint3D(point2D);
|
||||||
tuple = new()
|
tuple = new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,10 +20,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
|||||||
|
|
||||||
public double GetParameter()
|
public double GetParameter()
|
||||||
{
|
{
|
||||||
var parameterCalculator = new FindParameterCalculator()
|
var parameterCalculator = new FindParameterCalculator();
|
||||||
{
|
parameterCalculator.InputData.Predicate = GetFactorPredicate;
|
||||||
Predicate = GetFactorPredicate,
|
|
||||||
};
|
|
||||||
if (TraceLogger is not null)
|
if (TraceLogger is not null)
|
||||||
{
|
{
|
||||||
parameterCalculator.TraceLogger = TraceLogger;
|
parameterCalculator.TraceLogger = TraceLogger;
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
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 CheckForceTupleInputDataLogic : ICheckInputDataLogic<IForceTupleInputData>
|
||||||
|
{
|
||||||
|
private bool result;
|
||||||
|
private string checkResult;
|
||||||
|
|
||||||
|
public IForceTupleInputData InputData { get; set; }
|
||||||
|
|
||||||
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public CheckForceTupleInputDataLogic(IForceTupleInputData inputData, IShiftTraceLogger traceLogger)
|
||||||
|
{
|
||||||
|
InputData = inputData;
|
||||||
|
TraceLogger = traceLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckForceTupleInputDataLogic()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
checkResult = string.Empty;
|
||||||
|
if (InputData is null)
|
||||||
|
{
|
||||||
|
string errorString = ErrorStrings.ParameterIsNull + ": Input data";
|
||||||
|
TraceLogger?.AddMessage(errorString);
|
||||||
|
throw new StructureHelperException(errorString);
|
||||||
|
}
|
||||||
|
if (InputData.NdmCollection is null || ! InputData.NdmCollection.Any())
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
string errorString = "\nNdm collection is null or empty";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
}
|
||||||
|
if (InputData.Tuple is null)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
string errorString = "\nForce tuple is null";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
}
|
||||||
|
if (InputData.Accuracy is null)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
string errorString = "\nAccuracy requirements is not assigned";
|
||||||
|
TraceMessage(errorString);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (InputData.Accuracy.IterationAccuracy <= 0)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage($"\nValue of accuracy {InputData.Accuracy.IterationAccuracy} must be grater than zero");
|
||||||
|
}
|
||||||
|
if (InputData.Accuracy.MaxIterationCount <= 0)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage($"\nMax number of iteration {InputData.Accuracy.MaxIterationCount} must be grater than zero");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString;
|
||||||
|
TraceLogger?.AddMessage(errorString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
using LoaderCalculator.Data.Matrix;
|
||||||
|
using LoaderCalculator;
|
||||||
|
using LoaderCalculator.Data.ResultData;
|
||||||
|
using LoaderCalculator.Data.SourceData;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models.Loggers;
|
||||||
|
using StructureHelperLogics.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public class ForceTupleCalcLogic : IForceTupleCalcLogic
|
||||||
|
{
|
||||||
|
private IForcesTupleResult result;
|
||||||
|
private ForceTupleTraceResultLogic forceTupleTraceResultLogic;
|
||||||
|
private LoaderOptions loaderData;
|
||||||
|
private Calculator calculator;
|
||||||
|
private ILoaderResults calcResult;
|
||||||
|
|
||||||
|
public IForceTupleInputData InputData { get; set; }
|
||||||
|
|
||||||
|
public IForcesTupleResult Result => result;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
public Action<IResult> ActionToOutputResults { get; set; }
|
||||||
|
|
||||||
|
public void Calculate()
|
||||||
|
{
|
||||||
|
PrepareNewResult();
|
||||||
|
CalculateResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareNewResult()
|
||||||
|
{
|
||||||
|
result = new ForcesTupleResult()
|
||||||
|
{
|
||||||
|
IsValid = true,
|
||||||
|
Description = string.Empty,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalculateResult()
|
||||||
|
{
|
||||||
|
TraceStartOfCalculation();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetLoaderResult();
|
||||||
|
ProcessLoaderResult();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ProcessCalculationException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceStartOfCalculation()
|
||||||
|
{
|
||||||
|
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"));
|
||||||
|
if (TraceLogger is not null)
|
||||||
|
{
|
||||||
|
TraceService.TraceNdmCollection(TraceLogger, InputData.NdmCollection);
|
||||||
|
}
|
||||||
|
TraceLogger?.AddMessage(string.Intern("Input force combination"));
|
||||||
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(InputData.Tuple));
|
||||||
|
TraceLogger?.AddMessage($"Required accuracy rate {InputData.Accuracy.IterationAccuracy}");
|
||||||
|
TraceLogger?.AddMessage($"Maximum iteration count {InputData.Accuracy.MaxIterationCount}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessCalculationException(Exception ex)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"Critical error ocured during calculation\n{ex}", TraceLogStatuses.Error);
|
||||||
|
result.IsValid = false;
|
||||||
|
if (ex.Message == "Calculation result is not valid: stiffness matrix is equal to zero")
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
result.Description = $"Error is appeared due to analysis. Error: {ex}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessLoaderResult()
|
||||||
|
{
|
||||||
|
if (calcResult.AccuracyRate <= InputData.Accuracy.IterationAccuracy)
|
||||||
|
{
|
||||||
|
ProcessCorrectLoaderResult();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ProcessInCorrectLoaderResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessInCorrectLoaderResult()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
result.IsValid = false;
|
||||||
|
result.Description = string.Intern("Required accuracy rate has not achieved");
|
||||||
|
result.LoaderResults = calcResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessCorrectLoaderResult()
|
||||||
|
{
|
||||||
|
result.IsValid = true;
|
||||||
|
result.Description = LoggerStrings.CalculationHasDone;
|
||||||
|
result.LoaderResults = calcResult;
|
||||||
|
forceTupleTraceResultLogic = new ForceTupleTraceResultLogic(InputData.NdmCollection)
|
||||||
|
{
|
||||||
|
TraceLogger = TraceLogger
|
||||||
|
};
|
||||||
|
forceTupleTraceResultLogic.TraceResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetLoaderResult()
|
||||||
|
{
|
||||||
|
loaderData = new LoaderOptions
|
||||||
|
{
|
||||||
|
Preconditions = new Preconditions
|
||||||
|
{
|
||||||
|
ConditionRate = InputData.Accuracy.IterationAccuracy,
|
||||||
|
MaxIterationCount = InputData.Accuracy.MaxIterationCount,
|
||||||
|
StartForceMatrix = new ForceMatrix
|
||||||
|
{
|
||||||
|
Mx = InputData.Tuple.Mx,
|
||||||
|
My = InputData.Tuple.My,
|
||||||
|
Nz = InputData.Tuple.Nz
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ActionToOutputResults = ShowResultToTrace,
|
||||||
|
NdmCollection = InputData.NdmCollection
|
||||||
|
};
|
||||||
|
calculator = new Calculator();
|
||||||
|
TraceLogger?.AddMessage(string.Intern("Calculation is started"), TraceLogStatuses.Debug);
|
||||||
|
calculator.Run(loaderData, new CancellationToken());
|
||||||
|
TraceLogger?.AddMessage(string.Intern("Calculation result is obtained"), TraceLogStatuses.Debug);
|
||||||
|
calcResult = calculator.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowResultToTrace(ILoaderResults result)
|
||||||
|
{
|
||||||
|
var strain = result.StrainMatrix;
|
||||||
|
TraceLogger?.AddMessage($"Iteration {result.IterationCounter}, current accuracy rate {result.AccuracyRate}", TraceLogStatuses.Debug, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||||
|
{
|
||||||
|
public interface IForceTupleCalcLogic: ILogic, IHasActionByResult
|
||||||
|
{
|
||||||
|
IForceTupleInputData InputData { get; set; }
|
||||||
|
IForcesTupleResult Result { get; }
|
||||||
|
void Calculate();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,12 +18,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logic of checking of input data for crack calcultor
|
/// Logic of checking of input data for crack calcultor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<CrackInputData>
|
public class CheckCrackCalculatorInputDataLogic : ICheckInputDataLogic<CrackCalculatorInputData>
|
||||||
{
|
{
|
||||||
private bool result;
|
private bool result;
|
||||||
private ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic;
|
private ICheckPrimitiveCollectionLogic checkPrimitiveCollectionLogic;
|
||||||
|
|
||||||
public CrackInputData InputData { get; set; }
|
public CrackCalculatorInputData InputData { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string CheckResult { get; private set; }
|
public string CheckResult { get; private set; }
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CheckCrackForceCalculatorInputData : ICheckInputDataLogic<ICrackForceCalculatorInputData>
|
||||||
|
{
|
||||||
|
private string checkResult;
|
||||||
|
private bool result;
|
||||||
|
public ICrackForceCalculatorInputData InputData { get; set; }
|
||||||
|
|
||||||
|
public string CheckResult => checkResult;
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public bool Check()
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
if (InputData is null)
|
||||||
|
{
|
||||||
|
TraceMessage("InputData is null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (InputData.CheckedNdmCollection is null || ! InputData.CheckedNdmCollection.Any())
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage("Checked ndm collection is null or empty");
|
||||||
|
}
|
||||||
|
if (InputData.SectionNdmCollection is null || !InputData.SectionNdmCollection.Any())
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage("Section ndm collection is null or empty");
|
||||||
|
}
|
||||||
|
if (InputData.StartTuple is null)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage("Start force tuple is null");
|
||||||
|
}
|
||||||
|
if (InputData.EndTuple is null)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage("End force tuple is null");
|
||||||
|
}
|
||||||
|
if (InputData.StartTuple == InputData.EndTuple)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
TraceMessage("Start tuple is equal to end tuple");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TraceMessage(string errorString)
|
||||||
|
{
|
||||||
|
checkResult += errorString + "\n";
|
||||||
|
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,21 +23,21 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private CrackResult result;
|
private CrackResult result;
|
||||||
private IGetTupleInputDatasLogic datasLogic;
|
private IGetTupleInputDatasLogic datasLogic;
|
||||||
private CrackCalculatorUpdateStrategy updateStrategy = new();
|
private CrackCalculatorUpdateStrategy updateStrategy = new();
|
||||||
private ICheckInputDataLogic<CrackInputData> checkInputDataLogic;
|
private ICheckInputDataLogic<CrackCalculatorInputData> checkInputDataLogic;
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public CrackInputData InputData { get; set; }
|
public CrackCalculatorInputData InputData { get; set; }
|
||||||
public IResult Result => result;
|
public IResult Result => result;
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
public CrackCalculator(CrackInputData inputData, ICheckInputDataLogic<CrackInputData> checkInputDataLogic)
|
public CrackCalculator(CrackCalculatorInputData inputData, ICheckInputDataLogic<CrackCalculatorInputData> checkInputDataLogic)
|
||||||
{
|
{
|
||||||
InputData = inputData;
|
InputData = inputData;
|
||||||
this.checkInputDataLogic = checkInputDataLogic;
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
Name = string.Empty;
|
Name = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrackCalculator(CrackInputData inputData)
|
public CrackCalculator(CrackCalculatorInputData inputData)
|
||||||
: this(inputData,
|
: this(inputData,
|
||||||
new CheckCrackCalculatorInputDataLogic()
|
new CheckCrackCalculatorInputDataLogic()
|
||||||
{ InputData = inputData}
|
{ InputData = inputData}
|
||||||
@@ -45,7 +45,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
CrackInputData crackInputData = new CrackInputData();
|
CrackCalculatorInputData crackInputData = new CrackCalculatorInputData();
|
||||||
var checkDataLogic = new CheckCrackCalculatorInputDataLogic()
|
var checkDataLogic = new CheckCrackCalculatorInputDataLogic()
|
||||||
{
|
{
|
||||||
InputData = InputData
|
InputData = InputData
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class CrackInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
public class CrackCalculatorInputData : IInputData, IHasPrimitives, IHasForceCombinations
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<INdmPrimitive> Primitives { get; private set; }
|
public List<INdmPrimitive> Primitives { get; private set; }
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public List<IForceAction> ForceActions { get; private set; }
|
public List<IForceAction> ForceActions { get; private set; }
|
||||||
public UserCrackInputData UserCrackInputData { get; set; }
|
public UserCrackInputData UserCrackInputData { get; set; }
|
||||||
public CrackInputData()
|
public CrackCalculatorInputData()
|
||||||
{
|
{
|
||||||
Primitives = new();
|
Primitives = new();
|
||||||
ForceActions = new();
|
ForceActions = new();
|
||||||
@@ -10,9 +10,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public class CrackCalculatorUpdateStrategy : IUpdateStrategy<CrackCalculator>
|
public class CrackCalculatorUpdateStrategy : IUpdateStrategy<CrackCalculator>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<CrackInputData> inputDataUpdateStrategy;
|
private IUpdateStrategy<CrackCalculatorInputData> inputDataUpdateStrategy;
|
||||||
|
|
||||||
public CrackCalculatorUpdateStrategy(IUpdateStrategy<CrackInputData> inputDataUpdateStrategy)
|
public CrackCalculatorUpdateStrategy(IUpdateStrategy<CrackCalculatorInputData> inputDataUpdateStrategy)
|
||||||
{
|
{
|
||||||
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
this.inputDataUpdateStrategy = inputDataUpdateStrategy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Infrastructures.Settings;
|
using StructureHelperCommon.Infrastructures.Settings;
|
||||||
using StructureHelperCommon.Models;
|
using StructureHelperCommon.Models;
|
||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
@@ -11,9 +12,10 @@ using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class CrackForceCalculator : ICalculator
|
public class CrackForceBynarySearchCalculator : ICrackForceCalculator
|
||||||
{
|
{
|
||||||
private CrackedLogic crackedLogic;
|
private IIsSectionCrackedByFactorLogic crackedByFactorLogic;
|
||||||
|
private ICheckInputDataLogic<ICrackForceCalculatorInputData> checkInputDataLogic;
|
||||||
ExpSofteningLogic softeningLogic = new();
|
ExpSofteningLogic softeningLogic = new();
|
||||||
static readonly CrackStrainLogic crackStrainLogic = new();
|
static readonly CrackStrainLogic crackStrainLogic = new();
|
||||||
static readonly SofteningFactorLogic softeningFactorLogic = new();
|
static readonly SofteningFactorLogic softeningFactorLogic = new();
|
||||||
@@ -22,64 +24,72 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private FindParameterCalculator parameterCalculator;
|
private FindParameterCalculator parameterCalculator;
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IForceTuple StartTuple { get; set; }
|
public ICrackForceCalculatorInputData InputData { get; set; }
|
||||||
public IForceTuple EndTuple { get; set; }
|
public Accuracy Accuracy { get; set; }
|
||||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
|
||||||
public Accuracy Accuracy {get;set; }
|
|
||||||
public IResult Result => result;
|
public IResult Result => result;
|
||||||
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public CrackForceCalculator(CrackedLogic crackedLogic)
|
public CrackForceBynarySearchCalculator(
|
||||||
|
IIsSectionCrackedByFactorLogic crackedByFactorLogic,
|
||||||
|
ICheckInputDataLogic<ICrackForceCalculatorInputData> checkInputDataLogic
|
||||||
|
)
|
||||||
{
|
{
|
||||||
StartTuple ??= new ForceTuple();
|
this.crackedByFactorLogic = crackedByFactorLogic;
|
||||||
Accuracy ??= new Accuracy() { IterationAccuracy = 0.0001d, MaxIterationCount = 10000 };
|
this.checkInputDataLogic = checkInputDataLogic;
|
||||||
|
Accuracy ??= new Accuracy()
|
||||||
|
{
|
||||||
|
IterationAccuracy = 0.0001d,
|
||||||
|
MaxIterationCount = 10000
|
||||||
|
};
|
||||||
forceTupleCalculator = new ForceTupleCalculator();
|
forceTupleCalculator = new ForceTupleCalculator();
|
||||||
this.crackedLogic = crackedLogic;
|
InputData = new CrackForceCalculatorInputData();
|
||||||
}
|
}
|
||||||
public CrackForceCalculator() : this(new CrackedLogic())
|
public CrackForceBynarySearchCalculator() : this(new IsSectionCrackedByFactorLogic(), new CheckCrackForceCalculatorInputData())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
parameterCalculator = new FindParameterCalculator()
|
PrepareNewResult();
|
||||||
{
|
if (CheckInputData() == false) { return; }
|
||||||
Accuracy = Accuracy,
|
parameterCalculator = new FindParameterCalculator();
|
||||||
Predicate = crackedLogic.IsSectionCracked
|
parameterCalculator.InputData.Predicate = crackedByFactorLogic.IsSectionCracked;
|
||||||
};
|
|
||||||
if (TraceLogger is not null)
|
if (TraceLogger is not null)
|
||||||
{
|
{
|
||||||
forceTupleCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(100);
|
forceTupleCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(100);
|
||||||
parameterCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
parameterCalculator.TraceLogger = TraceLogger.GetSimilarTraceLogger(50);
|
||||||
crackedLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(150);
|
crackedByFactorLogic.TraceLogger = TraceLogger.GetSimilarTraceLogger(150);
|
||||||
}
|
}
|
||||||
TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service);
|
TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service);
|
||||||
result = new CrackForceResult();
|
|
||||||
TraceLogger?.AddMessage($"Start force combination");
|
TraceLogger?.AddMessage($"Start force combination");
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(StartTuple));
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(InputData.StartTuple));
|
||||||
TraceLogger?.AddMessage($"Actual (end) force combination");
|
TraceLogger?.AddMessage($"Actual (end) force combination");
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(EndTuple));
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(InputData.EndTuple));
|
||||||
crackedLogic.StartTuple = StartTuple;
|
crackedByFactorLogic.IsSectionCrackedByForceLogic = new IsSectionCrackedByForceLogic()
|
||||||
crackedLogic.EndTuple = EndTuple;
|
{
|
||||||
crackedLogic.NdmCollection = NdmCollection;
|
CheckedNdmCollection = InputData.CheckedNdmCollection,
|
||||||
|
SectionNdmCollection = InputData.SectionNdmCollection,
|
||||||
|
};
|
||||||
|
crackedByFactorLogic.StartTuple = InputData.StartTuple;
|
||||||
|
crackedByFactorLogic.EndTuple = InputData.EndTuple;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Check();
|
CheckInputData();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
result.IsValid = false;
|
result.IsValid = false;
|
||||||
result.Description += ex;
|
result.Description += ex;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (crackedLogic.IsSectionCracked(0d) == true)
|
if (crackedByFactorLogic.IsSectionCracked(0d) == true)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Crack is appeared in start corce combination", TraceLogStatuses.Warning);
|
TraceLogger?.AddMessage($"Crack is appeared in start force combination", TraceLogStatuses.Warning);
|
||||||
SectionCrackedAtStart();
|
SectionCrackedAtStart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (crackedLogic.IsSectionCracked(1d) == false)
|
if (crackedByFactorLogic.IsSectionCracked(1d) == false)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Crack is not appeared from actual (end) force combination", TraceLogStatuses.Warning);
|
TraceLogger?.AddMessage($"Crack is not appeared from actual (end) force combination", TraceLogStatuses.Warning);
|
||||||
SectionIsNotCracked();
|
SectionIsNotCracked();
|
||||||
@@ -100,6 +110,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PrepareNewResult()
|
||||||
|
{
|
||||||
|
result = new CrackForceResult();
|
||||||
|
}
|
||||||
|
|
||||||
private void SectionIsCrackedBetween(FindParameterResult? paramResult)
|
private void SectionIsCrackedBetween(FindParameterResult? paramResult)
|
||||||
{
|
{
|
||||||
var factorOfCrackAppearance = paramResult.Parameter;
|
var factorOfCrackAppearance = paramResult.Parameter;
|
||||||
@@ -111,11 +126,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
}
|
}
|
||||||
softeningLogic.ForceRatio = factorOfCrackAppearance;
|
softeningLogic.ForceRatio = factorOfCrackAppearance;
|
||||||
var psiS = softeningLogic.GetSofteningFactor();
|
var psiS = softeningLogic.GetSofteningFactor();
|
||||||
var tupleOfCrackApeearence = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factorOfCrackAppearance);
|
var tupleOfCrackApeearence = ForceTupleService.InterpolateTuples(InputData.EndTuple, InputData.StartTuple, factorOfCrackAppearance);
|
||||||
TraceLogger?.AddMessage($"Crack is appeared in force combination");
|
TraceLogger?.AddMessage($"Crack is appeared in force combination");
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tupleOfCrackApeearence));
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(tupleOfCrackApeearence));
|
||||||
var reducedStrainTuple = GetReducedStrainTuple(factorOfCrackAppearance, psiS);
|
var reducedStrainTuple = GetReducedStrainTuple(factorOfCrackAppearance, psiS);
|
||||||
var crackedStrainTuple = GetStrainTuple(EndTuple);
|
var crackedStrainTuple = GetStrainTuple(InputData.EndTuple);
|
||||||
TraceLogger?.AddMessage($"Strains in cracked section from actual (end) force");
|
TraceLogger?.AddMessage($"Strains in cracked section from actual (end) force");
|
||||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(crackedStrainTuple));
|
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(crackedStrainTuple));
|
||||||
TraceLogger?.AddMessage($"Average strains of cracked part of element");
|
TraceLogger?.AddMessage($"Average strains of cracked part of element");
|
||||||
@@ -129,14 +144,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
result.TupleOfCrackAppearance = tupleOfCrackApeearence;
|
result.TupleOfCrackAppearance = tupleOfCrackApeearence;
|
||||||
result.CrackedStrainTuple = crackedStrainTuple;
|
result.CrackedStrainTuple = crackedStrainTuple;
|
||||||
result.ReducedStrainTuple = reducedStrainTuple;
|
result.ReducedStrainTuple = reducedStrainTuple;
|
||||||
result.SofteningFactors= softeningFactors;
|
result.SofteningFactors = softeningFactors;
|
||||||
result.PsiS = psiS;
|
result.PsiS = psiS;
|
||||||
TraceLogger?.AddMessage($"Valid result was obtained", TraceLogStatuses.Debug);
|
TraceLogger?.AddMessage($"Valid result was obtained", TraceLogStatuses.Debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
private StrainTuple GetSofteningFactors(StrainTuple reducedStrainTuple)
|
private StrainTuple GetSofteningFactors(StrainTuple reducedStrainTuple)
|
||||||
{
|
{
|
||||||
softeningFactorLogic.NdmCollection = NdmCollection;
|
softeningFactorLogic.NdmCollection = InputData.SectionNdmCollection;
|
||||||
softeningFactorLogic.StrainTuple = reducedStrainTuple;
|
softeningFactorLogic.StrainTuple = reducedStrainTuple;
|
||||||
return softeningFactorLogic.GetSofteningFactors();
|
return softeningFactorLogic.GetSofteningFactors();
|
||||||
}
|
}
|
||||||
@@ -144,9 +159,9 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
private StrainTuple GetReducedStrainTuple(double factorOfCrackAppearance, double softeningFactor)
|
private StrainTuple GetReducedStrainTuple(double factorOfCrackAppearance, double softeningFactor)
|
||||||
{
|
{
|
||||||
const double notCrackedForceFactor = 0.99d;
|
const double notCrackedForceFactor = 0.99d;
|
||||||
var notCrackedForceTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factorOfCrackAppearance * notCrackedForceFactor) as ForceTuple;
|
var notCrackedForceTuple = ForceTupleService.InterpolateTuples(InputData.EndTuple, InputData.StartTuple, factorOfCrackAppearance * notCrackedForceFactor) as ForceTuple;
|
||||||
var crackAppearanceStrainTuple = GetStrainTuple(notCrackedForceTuple);
|
var crackAppearanceStrainTuple = GetStrainTuple(notCrackedForceTuple);
|
||||||
var actualStrainTuple = GetStrainTuple(EndTuple);
|
var actualStrainTuple = GetStrainTuple(InputData.EndTuple);
|
||||||
crackStrainLogic.BeforeCrackingTuple = crackAppearanceStrainTuple;
|
crackStrainLogic.BeforeCrackingTuple = crackAppearanceStrainTuple;
|
||||||
crackStrainLogic.AfterCrackingTuple = actualStrainTuple;
|
crackStrainLogic.AfterCrackingTuple = actualStrainTuple;
|
||||||
crackStrainLogic.SofteningFactor = softeningFactor;
|
crackStrainLogic.SofteningFactor = softeningFactor;
|
||||||
@@ -160,10 +175,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
result.IsValid = true;
|
result.IsValid = true;
|
||||||
result.FactorOfCrackAppearance = 0d;
|
result.FactorOfCrackAppearance = 0d;
|
||||||
result.TupleOfCrackAppearance = (IForceTuple)StartTuple.Clone();
|
result.TupleOfCrackAppearance = (IForceTuple)InputData.StartTuple.Clone();
|
||||||
softeningLogic.ForceRatio = result.FactorOfCrackAppearance;
|
softeningLogic.ForceRatio = result.FactorOfCrackAppearance;
|
||||||
result.PsiS = softeningLogic.GetSofteningFactor();
|
result.PsiS = softeningLogic.GetSofteningFactor();
|
||||||
result.CrackedStrainTuple = result.ReducedStrainTuple = GetStrainTuple(EndTuple);
|
result.CrackedStrainTuple = result.ReducedStrainTuple = GetStrainTuple(InputData.EndTuple);
|
||||||
result.SofteningFactors = GetSofteningFactors(result.ReducedStrainTuple);
|
result.SofteningFactors = GetSofteningFactors(result.ReducedStrainTuple);
|
||||||
result.IsSectionCracked = true;
|
result.IsSectionCracked = true;
|
||||||
result.Description += "Section cracked in start tuple";
|
result.Description += "Section cracked in start tuple";
|
||||||
@@ -172,14 +187,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
result.IsValid = true;
|
result.IsValid = true;
|
||||||
result.IsSectionCracked = false;
|
result.IsSectionCracked = false;
|
||||||
result.CrackedStrainTuple = result.ReducedStrainTuple = GetStrainTuple(EndTuple);
|
result.CrackedStrainTuple = result.ReducedStrainTuple = GetStrainTuple(InputData.EndTuple);
|
||||||
result.SofteningFactors = GetSofteningFactors(result.ReducedStrainTuple);
|
result.SofteningFactors = GetSofteningFactors(result.ReducedStrainTuple);
|
||||||
result.Description = "Section is not cracked";
|
result.Description = "Section is not cracked";
|
||||||
}
|
}
|
||||||
private StrainTuple GetStrainTuple(IForceTuple forceTuple)
|
private StrainTuple GetStrainTuple(IForceTuple forceTuple)
|
||||||
{
|
{
|
||||||
ForceTupleInputData inputData = new();
|
ForceTupleInputData inputData = new();
|
||||||
inputData.NdmCollection = NdmCollection;
|
inputData.NdmCollection = InputData.SectionNdmCollection;
|
||||||
inputData.Tuple = forceTuple;
|
inputData.Tuple = forceTuple;
|
||||||
forceTupleCalculator.InputData = inputData;
|
forceTupleCalculator.InputData = inputData;
|
||||||
forceTupleCalculator.Run();
|
forceTupleCalculator.Run();
|
||||||
@@ -188,13 +203,16 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
StrainTuple strainTuple = TupleConverter.ConvertToStrainTuple(loaderStrainMatrix);
|
StrainTuple strainTuple = TupleConverter.ConvertToStrainTuple(loaderStrainMatrix);
|
||||||
return strainTuple;
|
return strainTuple;
|
||||||
}
|
}
|
||||||
private void Check()
|
private bool CheckInputData()
|
||||||
{
|
{
|
||||||
CheckObject.IsNull(EndTuple);
|
checkInputDataLogic.InputData = InputData;
|
||||||
if (StartTuple == EndTuple)
|
if (checkInputDataLogic.Check() == false)
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": Section is not cracked");
|
result.IsValid = false;
|
||||||
|
result.Description += checkInputDataLogic.CheckResult;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CrackForceCalculatorInputData : ICrackForceCalculatorInputData
|
||||||
|
{
|
||||||
|
public IForceTuple StartTuple { get; set; }
|
||||||
|
public IForceTuple EndTuple { get; set; }
|
||||||
|
public IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
||||||
|
public IEnumerable<INdm> SectionNdmCollection { get; set; }
|
||||||
|
|
||||||
|
public CrackForceCalculatorInputData()
|
||||||
|
{
|
||||||
|
StartTuple = new ForceTuple();
|
||||||
|
EndTuple = new ForceTuple();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public class CrackForceSteppedSearchCalculator : ICrackForceCalculator
|
||||||
|
{
|
||||||
|
public ICrackForceCalculatorInputData InputData { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public IResult Result => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Run()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class CrackInputDataUpdateStrategy : IUpdateStrategy<CrackInputData>
|
public class CrackInputDataUpdateStrategy : IUpdateStrategy<CrackCalculatorInputData>
|
||||||
{
|
{
|
||||||
private IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy;
|
private IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy;
|
||||||
public CrackInputDataUpdateStrategy(IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy)
|
public CrackInputDataUpdateStrategy(IUpdateStrategy<UserCrackInputData> userCrackInputDataUpdateStrategy)
|
||||||
@@ -20,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Update(CrackInputData targetObject, CrackInputData sourceObject)
|
public void Update(CrackCalculatorInputData targetObject, CrackCalculatorInputData sourceObject)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
CheckObject.CompareTypes(targetObject, sourceObject);
|
CheckObject.CompareTypes(targetObject, sourceObject);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
|||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public class CrackedConcreteNdmLogic : ISectionCrackedLogic
|
public class CrackedConcreteNdmLogic : IIsSectionCrackedByForceLogic
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public INdm ConcreteNdm { get; set; }
|
public INdm ConcreteNdm { get; set; }
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
data.PsiSFactor = softeningLogic.GetSofteningFactor();
|
data.PsiSFactor = softeningLogic.GetSofteningFactor();
|
||||||
data.StressStateFactor = stressStateFactorLogic.GetStressStateFactor();
|
data.StressStateFactor = stressStateFactorLogic.GetStressStateFactor();
|
||||||
data.BondFactor = 0.5d;
|
data.BondFactor = 0.5d;
|
||||||
data.Length = InputData.Length;
|
data.Length = InputData.LengthBeetwenCracks;
|
||||||
data.ConcreteStrain = ConcreteStrain;
|
data.ConcreteStrain = ConcreteStrain;
|
||||||
data.RebarStrain = RebarStrain;
|
data.RebarStrain = RebarStrain;
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
public interface ICrackForceCalculator : ICalculator
|
||||||
|
{
|
||||||
|
ICrackForceCalculatorInputData InputData { get; set; }
|
||||||
|
string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using LoaderCalculator.Data.Ndms;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -9,11 +9,12 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
internal interface ICrackedLogic : ILogic
|
public interface ICrackForceCalculatorInputData: IInputData
|
||||||
{
|
{
|
||||||
|
|
||||||
IForceTuple StartTuple { get; set; }
|
IForceTuple StartTuple { get; set; }
|
||||||
IForceTuple EndTuple { get; set; }
|
IForceTuple EndTuple { get; set; }
|
||||||
IEnumerable<INdm> NdmCollection { get; set; }
|
IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
||||||
bool IsSectionCracked(double factor);
|
IEnumerable<INdm> SectionNdmCollection { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,23 @@
|
|||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface ICrackWidthTupleResult
|
public interface ICrackWidthTupleResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculated crack width
|
/// Calculated crack width, m
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double CrackWidth { get; set; }
|
double CrackWidth { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// True if actual crack width less than limit one
|
||||||
|
/// </summary>
|
||||||
bool IsCrackLessThanUltimate { get; }
|
bool IsCrackLessThanUltimate { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Limit crack width, m
|
||||||
|
/// </summary>
|
||||||
double UltimateCrackWidth { get; set; }
|
double UltimateCrackWidth { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
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 StructureHelperLogics.NdmCalculations.Cracking
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Check crack appearence beetwen start force tuple and end force tuple
|
||||||
|
/// </summary>
|
||||||
|
public interface IIsSectionCrackedByFactorLogic : ILogic
|
||||||
|
{
|
||||||
|
IIsSectionCrackedByForceLogic IsSectionCrackedByForceLogic { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Start force tupple
|
||||||
|
/// </summary>
|
||||||
|
IForceTuple StartTuple { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// End force tuple
|
||||||
|
/// </summary>
|
||||||
|
IForceTuple EndTuple { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns result of checking of crack appearence
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="factor">factor beetwen start and end tuple, 0 is start tuple, 1 is end tuple</param>
|
||||||
|
/// <returns>true when section is cracked</returns>
|
||||||
|
bool IsSectionCracked(double factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,14 +12,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logic for checking collection of ndms for appearance of crack
|
/// Logic for checking collection of ndms for appearance of crack
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISectionCrackedLogic : ILogic
|
public interface IIsSectionCrackedByForceLogic : ILogic
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Force tuple for checking of cracks appearence
|
/// Force tuple for checking of cracks appearence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IForceTuple Tuple { get; set; }
|
IForceTuple Tuple { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Collection of ndms which is checking fo cracking
|
/// Collection of ndms which is checking for cracking
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -11,30 +11,29 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
public class CrackedLogic : ICrackedLogic
|
public class IsSectionCrackedByFactorLogic : IIsSectionCrackedByFactorLogic
|
||||||
{
|
{
|
||||||
private ISectionCrackedLogic sectionCrackedLogic;
|
public IIsSectionCrackedByForceLogic IsSectionCrackedByForceLogic { get; set; }
|
||||||
public IForceTuple StartTuple { get; set; }
|
public IForceTuple StartTuple { get; set; }
|
||||||
public IForceTuple EndTuple { get; set; }
|
public IForceTuple EndTuple { get; set; }
|
||||||
public IEnumerable<INdm> NdmCollection { get; set; }
|
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public CrackedLogic(ISectionCrackedLogic sectionLogic)
|
public IsSectionCrackedByFactorLogic(IIsSectionCrackedByForceLogic sectionLogic)
|
||||||
{
|
{
|
||||||
sectionCrackedLogic = sectionLogic;
|
IsSectionCrackedByForceLogic = sectionLogic;
|
||||||
}
|
}
|
||||||
public CrackedLogic() : this (new SectionCrackedLogic())
|
|
||||||
|
public IsSectionCrackedByFactorLogic() : this(new IsSectionCrackedByForceLogic())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSectionCracked(double factor)
|
public bool IsSectionCracked(double factor)
|
||||||
{
|
{
|
||||||
sectionCrackedLogic.TraceLogger ??= TraceLogger?.GetSimilarTraceLogger(50);
|
IsSectionCrackedByForceLogic.TraceLogger ??= TraceLogger?.GetSimilarTraceLogger(50);
|
||||||
|
|
||||||
var actualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factor);
|
var actualTuple = ForceTupleService.InterpolateTuples(EndTuple, StartTuple, factor);
|
||||||
sectionCrackedLogic.Tuple = actualTuple;
|
IsSectionCrackedByForceLogic.Tuple = actualTuple;
|
||||||
sectionCrackedLogic.SectionNdmCollection = NdmCollection;
|
return IsSectionCrackedByForceLogic.IsSectionCracked();
|
||||||
return sectionCrackedLogic.IsSectionCracked();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,16 +10,17 @@ using System.Diagnostics.Eventing.Reader;
|
|||||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
internal class SectionCrackedLogic : ISectionCrackedLogic
|
internal class IsSectionCrackedByForceLogic : IIsSectionCrackedByForceLogic
|
||||||
{
|
{
|
||||||
static readonly IStressLogic stressLogic = new StressLogic();
|
static readonly IStressLogic stressLogic = new StressLogic();
|
||||||
|
/// <inheritdoc/>
|
||||||
public IForceTuple Tuple { get; set; }
|
public IForceTuple Tuple { get; set; }
|
||||||
public IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
public IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
||||||
public IEnumerable<INdm> SectionNdmCollection { get; set; }
|
public IEnumerable<INdm> SectionNdmCollection { get; set; }
|
||||||
public Accuracy Accuracy { get; set; }
|
public Accuracy Accuracy { get; set; }
|
||||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||||
|
|
||||||
public SectionCrackedLogic()
|
public IsSectionCrackedByForceLogic()
|
||||||
{
|
{
|
||||||
if (Accuracy is null)
|
if (Accuracy is null)
|
||||||
{
|
{
|
||||||
@@ -56,15 +57,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
}
|
}
|
||||||
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
var strainMatrix = calcResult.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||||
IEnumerable<INdm> checkedNdmCollection;
|
IEnumerable<INdm> checkedNdmCollection;
|
||||||
if (CheckedNdmCollection is null)
|
var isSectionCracked = stressLogic.IsSectionCracked(strainMatrix, CheckedNdmCollection);
|
||||||
{
|
|
||||||
checkedNdmCollection = SectionNdmCollection;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
checkedNdmCollection = CheckedNdmCollection;
|
|
||||||
}
|
|
||||||
var isSectionCracked = stressLogic.IsSectionCracked(strainMatrix, checkedNdmCollection);
|
|
||||||
if (isSectionCracked == true)
|
if (isSectionCracked == true)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage($"Cracks are appeared in cross-section for current force combination");
|
TraceLogger?.AddMessage($"Cracks are appeared in cross-section for current force combination");
|
||||||
@@ -13,9 +13,21 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
{
|
{
|
||||||
public class RebarCrackInputData : IInputData
|
public class RebarCrackInputData : IInputData
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndms where work of crackable material in tension was assigned according to material properties
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<INdm> CrackableNdmCollection { get; set; }
|
public IEnumerable<INdm> CrackableNdmCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of ndms where work of concrete is disabled
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<INdm> CrackedNdmCollection { get; set; }
|
public IEnumerable<INdm> CrackedNdmCollection { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Force tuple for calculation
|
||||||
|
/// </summary>
|
||||||
public ForceTuple ForceTuple { get; set; }
|
public ForceTuple ForceTuple { get; set; }
|
||||||
public double Length { get; set; }
|
/// <summary>
|
||||||
|
/// Base length beetwen cracks
|
||||||
|
/// </summary>
|
||||||
|
public double LengthBeetwenCracks { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,14 +54,14 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
CrackableNdmCollection = crackableNdmsLoc,
|
CrackableNdmCollection = crackableNdmsLoc,
|
||||||
CrackedNdmCollection = crackedNdmsLoc,
|
CrackedNdmCollection = crackedNdmsLoc,
|
||||||
ForceTuple = InputData.LongTermTuple.Clone() as ForceTuple,
|
ForceTuple = InputData.LongTermTuple.Clone() as ForceTuple,
|
||||||
Length = LongLength
|
LengthBeetwenCracks = LongLength
|
||||||
};
|
};
|
||||||
var shortRebarData = new RebarCrackInputData()
|
var shortRebarData = new RebarCrackInputData()
|
||||||
{
|
{
|
||||||
CrackableNdmCollection = crackableNdmsLoc,
|
CrackableNdmCollection = crackableNdmsLoc,
|
||||||
CrackedNdmCollection = crackedNdmsLoc,
|
CrackedNdmCollection = crackedNdmsLoc,
|
||||||
ForceTuple = InputData.ShortTermTuple.Clone() as ForceTuple,
|
ForceTuple = InputData.ShortTermTuple.Clone() as ForceTuple,
|
||||||
Length = ShortLength
|
LengthBeetwenCracks = ShortLength
|
||||||
};
|
};
|
||||||
var rebarCalculatorData = new RebarCrackCalculatorInputData()
|
var rebarCalculatorData = new RebarCrackCalculatorInputData()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -148,22 +148,8 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
|
|
||||||
private CrackForceResult calculateCrackTuples(ForceTuple forceTuple, IEnumerable<INdm> ndms)
|
private CrackForceResult calculateCrackTuples(ForceTuple forceTuple, IEnumerable<INdm> ndms)
|
||||||
{
|
{
|
||||||
var sectionCrackedLogic = new SectionCrackedLogic()
|
var calculator = new CrackForceBynarySearchCalculator()
|
||||||
{
|
{
|
||||||
SectionNdmCollection = ndms,
|
|
||||||
CheckedNdmCollection = new List<INdm>() { concreteNdm },
|
|
||||||
//TraceLogger = TraceLogger?.GetSimilarTraceLogger(100)
|
|
||||||
};
|
|
||||||
var crackedLogis = new CrackedLogic(sectionCrackedLogic)
|
|
||||||
{
|
|
||||||
StartTuple = new ForceTuple(),
|
|
||||||
EndTuple = forceTuple,
|
|
||||||
//TraceLogger = TraceLogger?.GetSimilarTraceLogger(100)
|
|
||||||
};
|
|
||||||
var calculator = new CrackForceCalculator(crackedLogis)
|
|
||||||
{
|
|
||||||
NdmCollection = ndms,
|
|
||||||
EndTuple = forceTuple,
|
|
||||||
Accuracy = new Accuracy()
|
Accuracy = new Accuracy()
|
||||||
{
|
{
|
||||||
IterationAccuracy = 0.01d,
|
IterationAccuracy = 0.01d,
|
||||||
@@ -171,6 +157,10 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
|||||||
},
|
},
|
||||||
//TraceLogger = TraceLogger?.GetSimilarTraceLogger(150)
|
//TraceLogger = TraceLogger?.GetSimilarTraceLogger(150)
|
||||||
};
|
};
|
||||||
|
calculator.InputData.StartTuple = new ForceTuple();
|
||||||
|
calculator.InputData.EndTuple = forceTuple;
|
||||||
|
calculator.InputData.CheckedNdmCollection = new List<INdm>() { concreteNdm };
|
||||||
|
calculator.InputData.SectionNdmCollection = ndms;
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
return calculator.Result as CrackForceResult;
|
return calculator.Result as CrackForceResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,9 +66,11 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
{
|
{
|
||||||
CenterX = options.Center.X,
|
CenterX = options.Center.X,
|
||||||
CenterY = options.Center.Y,
|
CenterY = options.Center.Y,
|
||||||
Area = options.Area,
|
//Area = options.Area, //to do solve problem with additional concrete ndm
|
||||||
|
Area = 0,//options.Area, //to do solve problem with additional concrete ndm
|
||||||
Material = material,
|
Material = material,
|
||||||
StressScale = -1d
|
//StressScale = -1d
|
||||||
|
StressScale = 1d//-1d
|
||||||
};
|
};
|
||||||
NdmTransform.SetPrestrain(concreteNdm, TupleConverter.ConvertToLoaderStrainMatrix(prestrain));
|
NdmTransform.SetPrestrain(concreteNdm, TupleConverter.ConvertToLoaderStrainMatrix(prestrain));
|
||||||
return concreteNdm;
|
return concreteNdm;
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.CrackCalculatorT
|
|||||||
CalcTerm = CalcTerms.ShortTerm
|
CalcTerm = CalcTerms.ShortTerm
|
||||||
};
|
};
|
||||||
var ndms = triangulateLogic.GetNdms();
|
var ndms = triangulateLogic.GetNdms();
|
||||||
var calculator = new CrackForceCalculator();
|
var calculator = new CrackForceBynarySearchCalculator();
|
||||||
calculator.EndTuple = new ForceTuple() { Mx = -50e3d, My = -50e3d, Nz = 0d };
|
calculator.InputData.EndTuple = new ForceTuple() { Mx = -50e3d, My = -50e3d, Nz = 0d };
|
||||||
calculator.NdmCollection = ndms;
|
calculator.InputData.CheckedNdmCollection = calculator.InputData.SectionNdmCollection = ndms;
|
||||||
//Act
|
//Act
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = (CrackForceResult)calculator.Result;
|
var result = (CrackForceResult)calculator.Result;
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using Moq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Calculators;
|
||||||
|
using StructureHelperCommon.Models;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
|
||||||
|
namespace StructureHelperTests.UnitTests.Calcuators
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
public class CheckForceTupleInputDataLogicTests
|
||||||
|
{
|
||||||
|
private Mock<IForceTupleInputData> _mockInputData;
|
||||||
|
private Mock<IShiftTraceLogger> _mockTraceLogger;
|
||||||
|
private CheckForceTupleInputDataLogic _checkLogic;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_mockInputData = new Mock<IForceTupleInputData>();
|
||||||
|
_mockTraceLogger = new Mock<IShiftTraceLogger>();
|
||||||
|
|
||||||
|
_checkLogic = new CheckForceTupleInputDataLogic(_mockInputData.Object, _mockTraceLogger.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Check_InputDataIsNull_ThrowsStructureHelperException()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_checkLogic = new CheckForceTupleInputDataLogic(null, _mockTraceLogger.Object);
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
var ex = Assert.Throws<StructureHelperException>(() => _checkLogic.Check());
|
||||||
|
Assert.That(ex.Message, Is.EqualTo(ErrorStrings.ParameterIsNull + ": Input data"));
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage(ErrorStrings.ParameterIsNull + ": Input data"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Check_NdmCollectionIsNullOrEmpty_ReturnsFalseAndLogsError()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_mockInputData.Setup(x => x.NdmCollection).Returns((IEnumerable<INdm>)null);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _checkLogic.Check();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
//Assert.That(_checkLogic.CheckResult, Is.EqualTo("Ndm collection is null or empty"));
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage("\nNdm collection is null or empty"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Check_TupleIsNull_ReturnsFalseAndLogsError()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
||||||
|
_mockInputData.Setup(x => x.Tuple).Returns((IForceTuple)null);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _checkLogic.Check();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
//Assert.That(_checkLogic.CheckResult, Is.EqualTo("Force tuple is null"));
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage("\nForce tuple is null"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Check_AccuracyIsNull_ReturnsFalseAndLogsError()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
||||||
|
_mockInputData.Setup(x => x.Tuple).Returns(new ForceTuple());
|
||||||
|
_mockInputData.Setup(x => x.Accuracy).Returns((IAccuracy)null);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _checkLogic.Check();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
//Assert.That(_checkLogic.CheckResult, Is.EqualTo("Accuracy requirements is not assigned"));
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage("\nAccuracy requirements is not assigned"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Check_AccuracyValuesAreInvalid_ReturnsFalseAndLogsErrors()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var mockAccuracy = new Mock<IAccuracy>();
|
||||||
|
mockAccuracy.Setup(x => x.IterationAccuracy).Returns(0);
|
||||||
|
mockAccuracy.Setup(x => x.MaxIterationCount).Returns(0);
|
||||||
|
|
||||||
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm>());
|
||||||
|
_mockInputData.Setup(x => x.Tuple).Returns(new ForceTuple());
|
||||||
|
_mockInputData.Setup(x => x.Accuracy).Returns(mockAccuracy.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _checkLogic.Check();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
//Assert.That(_checkLogic.CheckResult, Is.EqualTo("Value of accuracy 0 must be grater than zeroMax number of iteration 0 must be grater than zero"));
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage("\nValue of accuracy 0 must be grater than zero"), Times.Once);
|
||||||
|
_mockTraceLogger.Verify(x => x.AddMessage("\nMax number of iteration 0 must be grater than zero"), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Check_AllConditionsMet_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var mockAccuracy = new Mock<IAccuracy>();
|
||||||
|
mockAccuracy.Setup(x => x.IterationAccuracy).Returns(1);
|
||||||
|
mockAccuracy.Setup(x => x.MaxIterationCount).Returns(10);
|
||||||
|
|
||||||
|
_mockInputData.Setup(x => x.NdmCollection).Returns(new List<INdm> { new Mock<INdm>().Object });
|
||||||
|
_mockInputData.Setup(x => x.Tuple).Returns(new ForceTuple());
|
||||||
|
_mockInputData.Setup(x => x.Accuracy).Returns(mockAccuracy.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _checkLogic.Check();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
Assert.That(_checkLogic.CheckResult, Is.EqualTo(string.Empty));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,15 +7,14 @@ namespace StructureHelperTests.UnitTests.Calcuators
|
|||||||
{
|
{
|
||||||
[TestCase(0d, 1d, 0.5d, 0.5d)]
|
[TestCase(0d, 1d, 0.5d, 0.5d)]
|
||||||
[TestCase(0d, 10d, 5d, 5d)]
|
[TestCase(0d, 10d, 5d, 5d)]
|
||||||
public void Run_ShouldPass_Valid(double startValue, double EndValue, double predicateValue, double expectedValue)
|
public void Run_ShouldPass_Valid(double startValue, double endValue, double predicateValue, double expectedValue)
|
||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
var calculator = new FindParameterCalculator()
|
var calculator = new FindParameterCalculator();
|
||||||
{
|
calculator.InputData.StartValue = startValue;
|
||||||
StartValue = startValue,
|
calculator.InputData.EndValue = endValue; ;
|
||||||
EndValue = EndValue,
|
calculator.InputData.Predicate = x => x > predicateValue;
|
||||||
Predicate = x => x > predicateValue
|
|
||||||
};
|
|
||||||
//Act
|
//Act
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = calculator.Result as FindParameterResult;
|
var result = calculator.Result as FindParameterResult;
|
||||||
@@ -26,15 +25,13 @@ namespace StructureHelperTests.UnitTests.Calcuators
|
|||||||
}
|
}
|
||||||
[TestCase(0d, 1d, 5d, 5d, false)]
|
[TestCase(0d, 1d, 5d, 5d, false)]
|
||||||
[TestCase(0d, 10d, 15d, 15d, false)]
|
[TestCase(0d, 10d, 15d, 15d, false)]
|
||||||
public void Run_ShouldPass_NotValid(double startValue, double EndValue, double predicateValue, double expectedValue, bool isValid)
|
public void Run_ShouldPass_NotValid(double startValue, double endValue, double predicateValue, double expectedValue, bool isValid)
|
||||||
{
|
{
|
||||||
//Arrange
|
//Arrange
|
||||||
var calculator = new FindParameterCalculator()
|
var calculator = new FindParameterCalculator();
|
||||||
{
|
calculator.InputData.StartValue = startValue;
|
||||||
StartValue = startValue,
|
calculator.InputData.EndValue = endValue; ;
|
||||||
EndValue = EndValue,
|
calculator.InputData.Predicate = x => x > predicateValue;
|
||||||
Predicate = x => x > predicateValue
|
|
||||||
};
|
|
||||||
//Act
|
//Act
|
||||||
calculator.Run();
|
calculator.Run();
|
||||||
var result = calculator.Result as FindParameterResult;
|
var result = calculator.Result as FindParameterResult;
|
||||||
|
|||||||
Reference in New Issue
Block a user