Window of calcultion's property is added
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationProperties
|
||||
{
|
||||
public class CalculationProperty : ICalculationProperty
|
||||
{
|
||||
public List<IForceCombination> ForceCombinations { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public IIterationProperty IterationProperty { get; }
|
||||
|
||||
public CalculationProperty()
|
||||
{
|
||||
ForceCombinations = new List<IForceCombination>
|
||||
{
|
||||
new ForceCombination()
|
||||
};
|
||||
LimitState = LimitStates.Collapse;
|
||||
CalcTerm = CalcTerms.ShortTerm;
|
||||
IterationProperty = new IterationProperty() { Accuracy = 0.001d, MaxIterationCount = 100};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationProperties
|
||||
{
|
||||
public class ForceCombination : IForceCombination
|
||||
{
|
||||
public IForceMatrix ForceMatrix { get; private set; }
|
||||
public bool TakeInCalculate { get; set; }
|
||||
|
||||
public ForceCombination()
|
||||
{
|
||||
ForceMatrix = new ForceMatrix() { Mx = 0d, My = 0d, Nz = 0d};
|
||||
TakeInCalculate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationProperties
|
||||
{
|
||||
public interface ICalculationProperty
|
||||
{
|
||||
List<IForceCombination> ForceCombinations { get; set; }
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
IIterationProperty IterationProperty {get;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationProperties
|
||||
{
|
||||
public interface IForceCombination
|
||||
{
|
||||
IForceMatrix ForceMatrix { get; }
|
||||
bool TakeInCalculate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationProperties
|
||||
{
|
||||
public interface IIterationProperty
|
||||
{
|
||||
double Accuracy { get; set; }
|
||||
int MaxIterationCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationProperties
|
||||
{
|
||||
public class IterationProperty : IIterationProperty
|
||||
{
|
||||
public double Accuracy { get; set; }
|
||||
public int MaxIterationCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationsResults
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
class CalculationResult : ICalculationResult
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool IsValid { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Desctription { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public ILoaderResults LoaderResults { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using LoaderCalculator.Data.ResultData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.Models.Calculations.CalculationsResults
|
||||
{
|
||||
/// <summary>
|
||||
/// Represent result of calculation of ndm analisys
|
||||
/// </summary>
|
||||
public interface ICalculationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// True if result of calculation is valid
|
||||
/// </summary>
|
||||
bool IsValid { get; }
|
||||
/// <summary>
|
||||
/// Text of result of calculations
|
||||
/// </summary>
|
||||
string Desctription { get; }
|
||||
/// <summary>
|
||||
/// Keep result of calculations from ndm-library
|
||||
/// </summary>
|
||||
ILoaderResults LoaderResults { get; }
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ using LoaderCalculator.Data.SourceData;
|
||||
using StructureHelperCommon.Models.Entities;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Infrastructures.CommonEnums;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationsResults;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperLogics.Services
|
||||
{
|
||||
@@ -35,5 +38,42 @@ namespace StructureHelperLogics.Services
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
return calculator.Result.StrainMatrix;
|
||||
}
|
||||
|
||||
public List<ICalculationResult> GetCalculationResults(ICalculationProperty calculationProperty, IEnumerable<INdm> ndms)
|
||||
{
|
||||
List<ICalculationResult> results = new List<ICalculationResult>();
|
||||
foreach (var forceCombinations in calculationProperty.ForceCombinations)
|
||||
{
|
||||
var forceMatrix = forceCombinations.ForceMatrix;
|
||||
results.Add(GetCalculationResult(forceMatrix, ndms, calculationProperty.IterationProperty.Accuracy, calculationProperty.IterationProperty.MaxIterationCount));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public ICalculationResult GetCalculationResult(IForceMatrix forceMatrix, IEnumerable<INdm> ndmCollection, double accuracyRate, int maxIterationCount)
|
||||
{
|
||||
try
|
||||
{
|
||||
var loaderData = new LoaderOptions
|
||||
{
|
||||
Preconditions = new Preconditions
|
||||
{
|
||||
ConditionRate = accuracyRate,
|
||||
MaxIterationCount = maxIterationCount,
|
||||
StartForceMatrix = forceMatrix
|
||||
},
|
||||
NdmCollection = ndmCollection
|
||||
};
|
||||
var calculator = new Calculator();
|
||||
calculator.Run(loaderData, new CancellationToken());
|
||||
var result = calculator.Result;
|
||||
if (result.AccuracyRate <= accuracyRate) { return new CalculationResult() { IsValid = true, Desctription = "Analisys is done succsefully", LoaderResults=result };}
|
||||
else { return new CalculationResult() { IsValid = false, Desctription = "Required accuracy rate has not achived", LoaderResults = result }; }
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new CalculationResult() { IsValid = false, Desctription = $"Error is appeared due to analysis. Error: {ex}" };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user