New Icons and Zoom of graph were added
This commit is contained in:
@@ -4,6 +4,7 @@ using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LMLogic = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
using LM = LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
@@ -40,16 +41,27 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public LM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
optionLogic = new ConcreteMaterialOptionLogic(this, limitState);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
GetOptions(limitState, calcTerm, false);
|
||||
LMBuilders.IBuilderDirector director = GetMaterial(limitState, calcTerm);
|
||||
return director.BuildMaterial();
|
||||
}
|
||||
|
||||
private LMBuilders.IBuilderDirector GetMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
var strength = factorLogic.GetTotalFactor(limitState, calcTerm);
|
||||
lmOptions.ExternalFactor.Compressive = strength.Compressive;
|
||||
lmOptions.ExternalFactor.Tensile = strength.Tensile;
|
||||
LMBuilders.IMaterialBuilder builder = new LMBuilders.ConcreteBuilder(lmOptions);
|
||||
LMBuilders.IBuilderDirector director = new LMBuilders.BuilderDirector(builder);
|
||||
return director.BuildMaterial();
|
||||
return director;
|
||||
}
|
||||
|
||||
private void GetOptions(LimitStates limitState, CalcTerms calcTerm, bool isSectionCracked)
|
||||
{
|
||||
optionLogic = new MaterialCommonOptionLogic(MaterialEntity, limitState, calcTerm);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
optionLogic = new ConcreteMaterialOptionLogic(this, limitState, isSectionCracked);
|
||||
optionLogic.SetMaterialOptions(lmOptions);
|
||||
}
|
||||
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
@@ -68,5 +80,12 @@ namespace StructureHelperLogics.Models.Materials
|
||||
}
|
||||
return (strength.Compressive * compressionFactor, strength.Tensile * tensionFactor);
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
GetOptions(limitState, calcTerm, true);
|
||||
LMBuilders.IBuilderDirector director = GetMaterial(limitState, calcTerm);
|
||||
return director.BuildMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
return GetLoaderMaterial(limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,5 +64,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
var material = elasticMaterialLogic.GetLoaderMaterial(this, limitState, calcTerm, factor);
|
||||
return material;
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
return GetLoaderMaterial(limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,5 +61,10 @@ namespace StructureHelper.Models.Materials
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
return HelperMaterial.GetCrackedLoaderMaterial(limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ namespace StructureHelper.Models.Materials
|
||||
Color Color { get; set; }
|
||||
IHelperMaterial HelperMaterial { get; set; }
|
||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public interface IHelperMaterial : ICloneable
|
||||
{
|
||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System.Collections.Generic;
|
||||
@@ -91,5 +92,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,23 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
private IConcreteLibMaterial material;
|
||||
private LimitStates limitState;
|
||||
public ConcreteMaterialOptionLogic(IConcreteLibMaterial material, LimitStates limitState)
|
||||
bool IsMaterialCracked;
|
||||
public ConcreteMaterialOptionLogic(IConcreteLibMaterial material, LimitStates limitState, bool IsMaterialCracked)
|
||||
{
|
||||
this.material = material;
|
||||
this.limitState = limitState;
|
||||
this.IsMaterialCracked = IsMaterialCracked;
|
||||
}
|
||||
public void SetMaterialOptions(LCMB.IMaterialOptions materialOptions)
|
||||
{
|
||||
Check(materialOptions);
|
||||
var concreteOptions = materialOptions as LCMB.ConcreteOptions;
|
||||
concreteOptions.WorkInTension = false;
|
||||
if (IsMaterialCracked)
|
||||
{
|
||||
concreteOptions.WorkInTension = true;
|
||||
return;
|
||||
}
|
||||
if (limitState == LimitStates.ULS & material.TensionForULS == true)
|
||||
{
|
||||
concreteOptions.WorkInTension = true;
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
using Loadermaterials = LoaderCalculator.Data.Materials;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
|
||||
using LoaderCalculator.Data.Materials;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
@@ -76,5 +76,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
var tensileStrength = strength.Tensile * tensionFactor;
|
||||
return (compressiveStrength, tensileStrength);
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
return GetLoaderMaterial(limitState, calcTerm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
public StrainTuple GetSofteningFactors()
|
||||
{
|
||||
var strainTuple = new StrainTuple();
|
||||
var loaderStainMatrix = StrainTupleService.ConvertToLoaderStrainMatrix(StrainTuple);
|
||||
var loaderStainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(StrainTuple);
|
||||
var (MxFactor, MyFactor, NzFactor) = GeometryOperations.GetSofteningsFactors(NdmCollection, loaderStainMatrix);
|
||||
strainTuple.Mx = MxFactor;
|
||||
strainTuple.My = MyFactor;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportFrameWorkElementLogic : IExportResultLogic
|
||||
{
|
||||
private FrameworkElement visual;
|
||||
public string FileName { get; set; }
|
||||
|
||||
public void Export()
|
||||
{
|
||||
var encoder = new PngBitmapEncoder();
|
||||
EncodeVisual(visual, FileName, encoder);
|
||||
}
|
||||
|
||||
public ExportFrameWorkElementLogic(FrameworkElement visual)
|
||||
{
|
||||
this.visual = visual;
|
||||
}
|
||||
|
||||
private static void EncodeVisual(FrameworkElement visual, string fileName, BitmapEncoder encoder)
|
||||
{
|
||||
var bitmap = new RenderTargetBitmap((int)visual.ActualWidth, (int)visual.ActualHeight, 96, 96, PixelFormats.Pbgra32);
|
||||
|
||||
bitmap.Render(visual);
|
||||
var frame = BitmapFrame.Create(bitmap);
|
||||
encoder.Frames.Add(frame);
|
||||
using (var stream = File.Create(fileName)) encoder.Save(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
public class ExportResultToBitmapLogic : IExportResultLogic
|
||||
{
|
||||
private BitmapImage bitmapImage;
|
||||
|
||||
public ExportResultToBitmapLogic(BitmapImage bitmapImage)
|
||||
{
|
||||
this.bitmapImage = bitmapImage;
|
||||
}
|
||||
|
||||
public string FileName { get; set; }
|
||||
|
||||
public void Export()
|
||||
{
|
||||
using (var fileStream = new FileStream(FileName, FileMode.Create))
|
||||
{
|
||||
BitmapEncoder encoder = new BmpBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmapImage));
|
||||
encoder.Save(fileStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
forceTupleCalculator.Run();
|
||||
var result = forceTupleCalculator.Result as IForcesTupleResult;
|
||||
var loaderStrainMatrix = result.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
StrainTuple strainTuple = StrainTupleService.ConvertToStrainTuple(loaderStrainMatrix);
|
||||
StrainTuple strainTuple = TupleConverter.ConvertToStrainTuple(loaderStrainMatrix);
|
||||
return strainTuple;
|
||||
}
|
||||
private void Check()
|
||||
|
||||
@@ -1,23 +1,122 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CrackWidthCalculator : ICalculator
|
||||
{
|
||||
static readonly ILengthBetweenCracksLogic lengthLogic = new LengthBetweenCracksLogicSP63();
|
||||
CrackWidthCalculatorResult result;
|
||||
private IEnumerable<INdmPrimitive> ndmPrimitives;
|
||||
private List<RebarPrimitive>? rebarPrimitives;
|
||||
private IEnumerable<INdm> ndmCollection;
|
||||
private CrackForceResult crackForceResult;
|
||||
private StrainTuple strainTuple;
|
||||
|
||||
public string Name { get; set; }
|
||||
public ICrackWidthCalculatorInputData InputData { get; set; }
|
||||
public CrackWidthCalculatorInputData InputData { get; set; }
|
||||
public IResult Result => result;
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
result = new() { IsValid = true, Description = ""};
|
||||
try
|
||||
{
|
||||
ProcessCalculations();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ProcessCalculations()
|
||||
{
|
||||
CheckInputData();
|
||||
Triangulate();
|
||||
CalcStrainMatrix();
|
||||
CalcCrackForce();
|
||||
var crackInputData = GetCrackInputData();
|
||||
var calculator = new CrackWidthSimpleCalculator { InputData = crackInputData };
|
||||
foreach (var item in rebarPrimitives)
|
||||
{
|
||||
crackInputData.RebarPrimitive = item;
|
||||
calculator.Run();
|
||||
var rebarResult = calculator.Result as CrackWidthSimpleCalculatorResult;
|
||||
if (crackForceResult.IsSectionCracked == false)
|
||||
{
|
||||
rebarResult.CrackWidth = 0d;
|
||||
}
|
||||
result.RebarResults.Add(rebarResult);
|
||||
}
|
||||
}
|
||||
|
||||
private void CalcStrainMatrix()
|
||||
{
|
||||
IForceTupleInputData inputData = new ForceTupleInputData() { NdmCollection = ndmCollection, Tuple = InputData.ForceTuple};
|
||||
IForceTupleCalculator calculator = new ForceTupleCalculator(inputData);
|
||||
calculator.Run();
|
||||
var forceResult = calculator.Result as IForcesTupleResult;
|
||||
strainTuple = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||
}
|
||||
|
||||
private CrackWidthSimpleCalculatorInputData GetCrackInputData()
|
||||
{
|
||||
lengthLogic.NdmCollection = ndmCollection;
|
||||
lengthLogic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||
var length = lengthLogic.GetLength();
|
||||
var crackInputData = new CrackWidthSimpleCalculatorInputData
|
||||
{
|
||||
PsiSFactor = crackForceResult.PsiS,
|
||||
Length = length,
|
||||
LimitState = InputData.LimitState,
|
||||
StrainTuple = strainTuple
|
||||
};
|
||||
return crackInputData;
|
||||
}
|
||||
|
||||
private void Triangulate()
|
||||
{
|
||||
ndmPrimitives = InputData.NdmPrimitives;
|
||||
rebarPrimitives = new List<RebarPrimitive>();
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
if (item is RebarPrimitive)
|
||||
{
|
||||
rebarPrimitives.Add(item as RebarPrimitive);
|
||||
}
|
||||
}
|
||||
//rebarPrimitives = ndmPrimitives
|
||||
// .Select(x => x is RebarPrimitive) as IEnumerable<RebarPrimitive>;
|
||||
var options = new TriangulationOptions() { LimiteState = InputData.LimitState, CalcTerm = InputData.CalcTerm };
|
||||
ndmCollection = ndmPrimitives.SelectMany(x => x.GetNdms(options));
|
||||
}
|
||||
|
||||
private void CalcCrackForce()
|
||||
{
|
||||
var calculator = new CrackForceCalculator();
|
||||
calculator.EndTuple = InputData.ForceTuple;
|
||||
calculator.NdmCollection = ndmCollection;
|
||||
calculator.Run();
|
||||
crackForceResult = calculator.Result as CrackForceResult;
|
||||
}
|
||||
|
||||
private void CheckInputData()
|
||||
{
|
||||
if (InputData.NdmPrimitives is null || InputData.NdmPrimitives.Count == 0)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + ": input data doesn't have any primitives");
|
||||
}
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -9,11 +9,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public interface ICrackWidthCalculatorInputData
|
||||
public class CrackWidthCalculatorInputData
|
||||
{
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
StrainTuple StrainTuple { get; set; }
|
||||
IEnumerable<INdmPrimitive> NdmPrimitives {get;set;}
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public ForceTuple ForceTuple { get; set; }
|
||||
public List<INdmPrimitive> NdmPrimitives {get;set;}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,11 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Description { get; set; }
|
||||
IEnumerable<CrackWidthSimpleCalculatorResult> RebarResults { get; set; }
|
||||
public List<CrackWidthSimpleCalculatorResult> RebarResults { get; set; }
|
||||
|
||||
public CrackWidthCalculatorResult()
|
||||
{
|
||||
RebarResults = new List<CrackWidthSimpleCalculatorResult>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public class CrackWidthSimpleCalculatorInputData : ICrackWidthSimpleCalculatorInputData
|
||||
{
|
||||
public LimitStates LimitState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public StrainTuple StrainTuple { get; set; }
|
||||
public double PsiSFactor { get; set; }
|
||||
public double Length { get; set; }
|
||||
public SectionStressStates StressState { get; set; }
|
||||
public RebarPrimitive RebarPrimitive { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
else { data.TermFactor = 1d; }
|
||||
data.PsiSFactor = inputData.PsiSFactor;
|
||||
data.StressStateFactor = inputData.StressState is SectionStressStates.Tension ? 1.2d : 1.0d;
|
||||
data.BondFactor = 0.5;
|
||||
return data;
|
||||
}
|
||||
else
|
||||
@@ -39,12 +40,12 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
|
||||
private static void ProcessBaseProps(ICrackWidthSimpleCalculatorInputData inputData, ICrackWidthLogicInputData data)
|
||||
{
|
||||
var strainMatrix = StrainTupleService.ConvertToLoaderStrainMatrix(inputData.StrainTuple);
|
||||
var strainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(inputData.StrainTuple);
|
||||
var triangulationOptions = new TriangulationOptions { LimiteState = inputData.LimitState, CalcTerm = inputData.CalcTerm };
|
||||
var ndms = inputData.RebarPrimitive.GetNdms(triangulationOptions).ToArray();
|
||||
var concreteNdm = ndms[0];
|
||||
var rebarNdm = ndms[1];
|
||||
data.ConcreteStrain = stressLogic.GetTotalStrainWithPresrain(strainMatrix, concreteNdm);
|
||||
data.ConcreteStrain = concreteNdm.Prestrain;// stressLogic.GetTotalStrain(strainMatrix, concreteNdm) - stressLogic.GetTotalStrainWithPresrain(strainMatrix, concreteNdm);
|
||||
data.RebarStrain = stressLogic.GetTotalStrainWithPresrain(strainMatrix, rebarNdm);
|
||||
data.Length = inputData.Length;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
||||
};
|
||||
List<INdm> ndmCollection = new () { ndm};
|
||||
NdmTransform.SetPrestrain(ndmCollection, StrainTupleService.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
NdmTransform.SetPrestrain(ndmCollection, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
||||
};
|
||||
List<INdm> ndmCollection = new() { concreteNdm, rebarNdm};
|
||||
NdmTransform.SetPrestrain(ndmCollection, StrainTupleService.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
NdmTransform.SetPrestrain(ndmCollection, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user