diff --git a/App.xaml b/App.xaml index c984ac3..92ce395 100644 --- a/App.xaml +++ b/App.xaml @@ -11,6 +11,10 @@ + + + + diff --git a/Documentation/2021-06-14 10-46-38.JPG b/Documentation/2021-06-14 10-46-38.JPG new file mode 100644 index 0000000..31a0451 Binary files /dev/null and b/Documentation/2021-06-14 10-46-38.JPG differ diff --git a/Infrastructure/UI/Resources/ButtonStyles.xaml b/Infrastructure/UI/Resources/ButtonStyles.xaml new file mode 100644 index 0000000..c3744c2 --- /dev/null +++ b/Infrastructure/UI/Resources/ButtonStyles.xaml @@ -0,0 +1,53 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Infrastructure/UI/Resources/CommonEnums.xaml b/Infrastructure/UI/Resources/CommonEnums.xaml new file mode 100644 index 0000000..e6a976a --- /dev/null +++ b/Infrastructure/UI/Resources/CommonEnums.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Infrastructure/UI/Resources/DataGridStyles.xaml b/Infrastructure/UI/Resources/DataGridStyles.xaml new file mode 100644 index 0000000..e5fe7dd --- /dev/null +++ b/Infrastructure/UI/Resources/DataGridStyles.xaml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/Infrastructure/UI/Resources/DataGridTemplates.xaml b/Infrastructure/UI/Resources/DataGridTemplates.xaml new file mode 100644 index 0000000..8c9d75f --- /dev/null +++ b/Infrastructure/UI/Resources/DataGridTemplates.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StructureHelper.csproj b/StructureHelper.csproj index 7d5e8e6..6934552 100644 --- a/StructureHelper.csproj +++ b/StructureHelper.csproj @@ -178,6 +178,15 @@ App.xaml Code + + InterpolateTuplesView.xaml + + + PartialFactorsView.xaml + + + SafetyFactorsView.xaml + CalculationPropertyView.xaml @@ -232,14 +241,27 @@ PrimitivePropertiesView.xaml + + SelectPrimitivesView.xaml + RectangleBeamView.xaml + + + + + + + + + + @@ -273,10 +295,26 @@ + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -305,6 +343,18 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -361,6 +411,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -395,6 +449,8 @@ false - + + + \ No newline at end of file diff --git a/StructureHelperCommon/Infrastructures/Enums/StressStates.cs b/StructureHelperCommon/Infrastructures/Enums/StressStates.cs new file mode 100644 index 0000000..e02d0a6 --- /dev/null +++ b/StructureHelperCommon/Infrastructures/Enums/StressStates.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Infrastructures.Enums +{ + public enum StressStates + { + Tension, + Compression + } +} diff --git a/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs b/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs index 907bd90..1b5ba2a 100644 --- a/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs +++ b/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs @@ -19,5 +19,6 @@ namespace StructureHelperCommon.Infrastructures.Strings public static string FileCantBeDeleted => "#0008: File can't be deleted"; public static string FileCantBeSaved => "#0009: File can't be saved"; public static string VisualPropertyIsNotRight => "#0010: VisualPropertyIsNotRight"; + public static string FactorMustBeGraterThanZero => "#0011: Partial factor must not be less than zero"; } } diff --git a/StructureHelperCommon/Models/Materials/Libraries/Factories/ConcreteFactorsFactory.cs b/StructureHelperCommon/Models/Materials/Libraries/Factories/ConcreteFactorsFactory.cs new file mode 100644 index 0000000..b4c2f35 --- /dev/null +++ b/StructureHelperCommon/Models/Materials/Libraries/Factories/ConcreteFactorsFactory.cs @@ -0,0 +1,112 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Strings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials.Libraries +{ + public enum FactorType + { + LongTermFactor, + BleedingFactor, + PlainConcreteFactor + } + + public static class ConcreteFactorsFactory + { + public static IMaterialSafetyFactor GetFactor(FactorType factorType) + { + if (factorType == FactorType.LongTermFactor) { return LongTerm(); } + else if (factorType == FactorType.BleedingFactor) { return Bleeding(); } + else if (factorType == FactorType.PlainConcreteFactor) { return PlainConcrete(); } + else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown); + } + + private static IMaterialSafetyFactor LongTerm() + { + IMaterialSafetyFactor safetyFactor = new MaterialSafetyFactor() + { + Name = "Gamma_b1", + Description = "Coefficient for considering long term calculations", + }; + IMaterialPartialFactor partialFactor; + partialFactor = new MaterialPartialFactor + { + StressState = StressStates.Tension, + CalcTerm = CalcTerms.LongTerm, + LimitState = LimitStates.ULS, + FactorValue = 0.9d + }; + safetyFactor.PartialFactors.Add(partialFactor); + partialFactor = new MaterialPartialFactor + { + StressState = StressStates.Compression, + CalcTerm = CalcTerms.LongTerm, + LimitState = LimitStates.ULS, + FactorValue = 0.9d + }; + safetyFactor.PartialFactors.Add(partialFactor); + return safetyFactor; + } + + private static IMaterialSafetyFactor Bleeding() + { + IMaterialSafetyFactor safetyFactor = new MaterialSafetyFactor() + { + Name = "Gamma_b3", + Description = "Coefficient for considering bleeding in vertical placement conditionals", + }; + IMaterialPartialFactor partialFactor; + partialFactor = new MaterialPartialFactor + { + StressState = StressStates.Compression, + CalcTerm = CalcTerms.ShortTerm, + LimitState = LimitStates.ULS, + FactorValue = 0.85d + }; + safetyFactor.PartialFactors.Add(partialFactor); + partialFactor = new MaterialPartialFactor + { + StressState = StressStates.Compression, + CalcTerm = CalcTerms.LongTerm, + LimitState = LimitStates.ULS, + FactorValue = 0.85d + }; + safetyFactor.PartialFactors.Add(partialFactor); + return safetyFactor; + } + + private static IMaterialSafetyFactor PlainConcrete() + { + IMaterialSafetyFactor safetyFactor = new MaterialSafetyFactor() + { + Name = "Gamma_b2", + Description = "Coefficient for plain concrete structures", + }; + IMaterialPartialFactor partialFactor; + partialFactor = new MaterialPartialFactor + { + StressState = StressStates.Compression, + CalcTerm = CalcTerms.ShortTerm, + LimitState = LimitStates.ULS, + FactorValue = 0.9d + }; + safetyFactor.PartialFactors.Add(partialFactor); + partialFactor = new MaterialPartialFactor + { + StressState = StressStates.Compression, + CalcTerm = CalcTerms.LongTerm, + LimitState = LimitStates.ULS, + FactorValue = 0.9d + }; + safetyFactor.PartialFactors.Add(partialFactor); + return safetyFactor; + } + + + } +} diff --git a/StructureHelperCommon/Models/Materials/Libraries/IMaterialPartialFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/IMaterialPartialFactor.cs new file mode 100644 index 0000000..51aeffa --- /dev/null +++ b/StructureHelperCommon/Models/Materials/Libraries/IMaterialPartialFactor.cs @@ -0,0 +1,16 @@ +using StructureHelperCommon.Infrastructures.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials.Libraries +{ + public interface IMaterialPartialFactor : IPartialFactor + { + StressStates StressState { get; set; } + CalcTerms CalcTerm { get; set; } + LimitStates LimitState { get; set; } + } +} diff --git a/StructureHelperCommon/Models/Materials/Libraries/IMaterialSafetyFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/IMaterialSafetyFactor.cs new file mode 100644 index 0000000..4542fa2 --- /dev/null +++ b/StructureHelperCommon/Models/Materials/Libraries/IMaterialSafetyFactor.cs @@ -0,0 +1,18 @@ +using StructureHelperCommon.Infrastructures.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials.Libraries +{ + public interface IMaterialSafetyFactor : ICloneable + { + string Name { get; set; } + bool Take { get; set; } + string Description { get; set; } + List PartialFactors { get; } + double GetFactor(StressStates stressState, CalcTerms calcTerm, LimitStates limitStates); + } +} diff --git a/StructureHelperCommon/Models/Materials/Libraries/IPartialFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/IPartialFactor.cs new file mode 100644 index 0000000..6aaf89c --- /dev/null +++ b/StructureHelperCommon/Models/Materials/Libraries/IPartialFactor.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials.Libraries +{ + public interface IPartialFactor : ICloneable + { + double FactorValue {get;set;} + } +} diff --git a/StructureHelperCommon/Models/Materials/Libraries/MaterialPartialFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/MaterialPartialFactor.cs new file mode 100644 index 0000000..8e90e1f --- /dev/null +++ b/StructureHelperCommon/Models/Materials/Libraries/MaterialPartialFactor.cs @@ -0,0 +1,52 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Strings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials.Libraries +{ + public class MaterialPartialFactor : IMaterialPartialFactor + { + private double factorValue; + + public StressStates StressState { get; set; } + public CalcTerms CalcTerm { get; set; } + public LimitStates LimitState { get; set; } + public double FactorValue + { + get => factorValue; + set + { + if (value < 0 ) + { + throw new StructureHelperException(ErrorStrings.FactorMustBeGraterThanZero); + } + factorValue = value; + } + } + + public MaterialPartialFactor() + { + StressState = StressStates.Compression; + LimitState = LimitStates.ULS; + CalcTerm = CalcTerms.LongTerm; + FactorValue = 1d; + } + + public object Clone() + { + var newItem = new MaterialPartialFactor() + { + StressState = StressState, + CalcTerm = CalcTerm, + LimitState = LimitState, + FactorValue = FactorValue, + }; + return newItem; + } + } +} diff --git a/StructureHelperCommon/Models/Materials/Libraries/MaterialSafetyFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/MaterialSafetyFactor.cs new file mode 100644 index 0000000..c49d904 --- /dev/null +++ b/StructureHelperCommon/Models/Materials/Libraries/MaterialSafetyFactor.cs @@ -0,0 +1,46 @@ +using StructureHelperCommon.Infrastructures.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Materials.Libraries +{ + public class MaterialSafetyFactor : IMaterialSafetyFactor + { + public string Name {get; set; } + public bool Take { get; set; } + public string Description { get; set; } + public List PartialFactors { get; } + + public MaterialSafetyFactor() + { + Take = true; + Name = "New factor"; + Description = "Material safety factor for ..."; + PartialFactors = new List(); + } + + public double GetFactor(StressStates stressState, CalcTerms calcTerm, LimitStates limitStates) + { + double result = 1d; + var coefficients = PartialFactors.Where(x => (x.StressState == stressState & x.CalcTerm == calcTerm & x.LimitState == limitStates)); + foreach (var item in coefficients) { result *= item.FactorValue;} + return result; + } + + public object Clone() + { + var newItem = new MaterialSafetyFactor(); + newItem.Take = Take; + newItem.Name = Name; + newItem.Description = Description; + foreach (var item in PartialFactors) + { + newItem.PartialFactors.Add(item.Clone() as IMaterialPartialFactor); + } + return newItem; + } + } +} diff --git a/StructureHelperCommon/Services/Forces/TupleService.cs b/StructureHelperCommon/Services/Forces/TupleService.cs index 00f69a6..3f76628 100644 --- a/StructureHelperCommon/Services/Forces/TupleService.cs +++ b/StructureHelperCommon/Services/Forces/TupleService.cs @@ -1,4 +1,6 @@ -using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Strings; +using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Shapes; using System; using System.Collections.Generic; @@ -18,8 +20,9 @@ namespace StructureHelperCommon.Services.Forces return newTuple; } - public static IForceTuple InterpolateTuples(IForceTuple startTuple, IForceTuple endTuple, double coefficient) + public static IForceTuple InterpolateTuples(IForceTuple endTuple, IForceTuple startTuple = null, double coefficient = 0.5d) { + if (startTuple == null) startTuple = new ForceTuple(); double dMx, dMy, dNz; dMx = endTuple.Mx - startTuple.Mx; dMy = endTuple.My - startTuple.My; @@ -32,20 +35,17 @@ namespace StructureHelperCommon.Services.Forces }; } - public static IForceTuple InterpolateTuples(IForceTuple endTuple, double coefficient) - { - IForceTuple startTuple = new ForceTuple(); - return InterpolateTuples(startTuple, endTuple, coefficient); - } - public static List InterpolateDesignTuple(IDesignForceTuple endTuple, int stepCount) + public static List InterpolateDesignTuple(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce = null, int stepCount = 10) { + if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid); + if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid); var tuples =new List(); double step = 1d / stepCount; for (int i = 0; i <= stepCount; i++) { - var currentTuple = InterpolateTuples(endTuple.ForceTuple, i * step); - var currentDesignTuple = new DesignForceTuple() { LimitState = endTuple.LimitState, CalcTerm = endTuple.CalcTerm, ForceTuple = currentTuple }; + var currentTuple = InterpolateTuples(finishDesignForce.ForceTuple, startDesignForce.ForceTuple, i * step); + var currentDesignTuple = new DesignForceTuple() { LimitState = finishDesignForce.LimitState, CalcTerm = finishDesignForce.CalcTerm, ForceTuple = currentTuple }; tuples.Add(currentDesignTuple); } return tuples; diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj index 33f49bc..e1bcd1c 100644 --- a/StructureHelperCommon/StructureHelperCommon.csproj +++ b/StructureHelperCommon/StructureHelperCommon.csproj @@ -49,6 +49,7 @@ + @@ -68,11 +69,17 @@ + + + + + + diff --git a/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs b/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs index 251bae5..1d6a5d3 100644 --- a/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs +++ b/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs @@ -9,12 +9,14 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using StructureHelperCommon.Infrastructures.Settings; namespace StructureHelperLogics.Models.Materials { public class ConcreteLibMaterial : IConcreteLibMaterial { public ILibMaterialEntity MaterialEntity { get; set; } + public List SafetyFactors { get; } public bool TensionForULS { get ; set; } public bool TensionForSLS { get; set; } @@ -22,6 +24,8 @@ namespace StructureHelperLogics.Models.Materials public ConcreteLibMaterial() { + SafetyFactors = new List(); + SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType)); optionLogic = new MaterialOptionLogic(new LCMB.ConcreteOptions()); } @@ -33,6 +37,15 @@ namespace StructureHelperLogics.Models.Materials public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm) { var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm); + double compressionVal = 1d; + double tensionVal = 1d; + foreach (var item in SafetyFactors.Where(x => x.Take == true)) + { + compressionVal *= item.GetFactor(StressStates.Compression, calcTerm, limitState); + tensionVal *= item.GetFactor(StressStates.Tension, calcTerm, limitState); + } + materialOptions.ExternalFactor.Compressive = compressionVal; + materialOptions.ExternalFactor.Tensile = tensionVal; LCMB.IMaterialBuilder builder = new LCMB.ConcreteBuilder(materialOptions); LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder); return director.BuildMaterial(); diff --git a/StructureHelperLogics/Models/Materials/Factories/PartialCoefficientFactory.cs b/StructureHelperLogics/Models/Materials/Factories/PartialCoefficientFactory.cs new file mode 100644 index 0000000..175d93d --- /dev/null +++ b/StructureHelperLogics/Models/Materials/Factories/PartialCoefficientFactory.cs @@ -0,0 +1,44 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Strings; +using StructureHelperCommon.Models.Materials.Libraries; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperLogics.Models.Materials +{ + public static class PartialCoefficientFactory + { + public static List GetDefaultConcreteSafetyFactors(CodeTypes codeType) + { + if (codeType == CodeTypes.SP63_13330_2018) return GetConcreteFactorsSP63_2018(); + else if (codeType == CodeTypes.EuroCode_2_1990) return GetConcreteFactorsEC2_1990(); + else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + ": " + codeType); + } + + private static List GetConcreteFactorsEC2_1990() + { + List factors = new List(); + return factors; + } + + private static List GetConcreteFactorsSP63_2018() + { + List factors = new List(); + IMaterialSafetyFactor coefficient; + coefficient = ConcreteFactorsFactory.GetFactor(FactorType.LongTermFactor); + coefficient.Take = true; + factors.Add(coefficient); + coefficient = ConcreteFactorsFactory.GetFactor(FactorType.PlainConcreteFactor); + coefficient.Take = false; + factors.Add(coefficient); + coefficient = ConcreteFactorsFactory.GetFactor(FactorType.BleedingFactor); + coefficient.Take = false; + factors.Add(coefficient); + return factors; + } + } +} diff --git a/StructureHelperLogics/Models/Materials/ILibMaterial.cs b/StructureHelperLogics/Models/Materials/ILibMaterial.cs index 5a881ee..b162bce 100644 --- a/StructureHelperLogics/Models/Materials/ILibMaterial.cs +++ b/StructureHelperLogics/Models/Materials/ILibMaterial.cs @@ -10,5 +10,6 @@ namespace StructureHelperLogics.Models.Materials public interface ILibMaterial : IHelperMaterial { ILibMaterialEntity MaterialEntity { get; set; } + List SafetyFactors { get; } } } diff --git a/StructureHelperLogics/Models/Materials/LibMaterial.cs b/StructureHelperLogics/Models/Materials/LibMaterial.cs index cbec179..87302dc 100644 --- a/StructureHelperLogics/Models/Materials/LibMaterial.cs +++ b/StructureHelperLogics/Models/Materials/LibMaterial.cs @@ -2,6 +2,7 @@ using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Strings; using StructureHelperCommon.Models.Materials.Libraries; +using System.Collections.Generic; using LCM = LoaderCalculator.Data.Materials; using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders; @@ -18,7 +19,10 @@ namespace StructureHelperLogics.Models.Materials private CalcTerms calcTerm; public string Name { get; set; } public double MainStrength { get; set; } - public ILibMaterialEntity MaterialEntity { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } + + public ILibMaterialEntity MaterialEntity { get; set; } + + public List SafetyFactors { get; } public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength) { diff --git a/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs b/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs index d3ff225..94f86fc 100644 --- a/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs +++ b/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs @@ -13,11 +13,13 @@ namespace StructureHelperLogics.Models.Materials public class ReinforcementLibMaterial : IReinforcementLibMaterial { public ILibMaterialEntity MaterialEntity { get; set; } + public List SafetyFactors { get; } private IMaterialOptionLogic optionLogic; public ReinforcementLibMaterial() { + SafetyFactors = new List(); optionLogic = new MaterialOptionLogic(new LCMB.ReinforcementOptions()); } @@ -29,6 +31,15 @@ namespace StructureHelperLogics.Models.Materials public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm) { var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm); + double compressionVal = 1d; + double tensionVal = 1d; + foreach (var item in SafetyFactors.Where(x => x.Take == true)) + { + compressionVal *= item.GetFactor(StressStates.Compression, calcTerm, limitState); + tensionVal *= item.GetFactor(StressStates.Tension, calcTerm, limitState); + } + materialOptions.ExternalFactor.Compressive = compressionVal; + materialOptions.ExternalFactor.Tensile = tensionVal; LCMB.IMaterialBuilder builder = new LCMB.ReinforcementBuilder(materialOptions); LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder); return director.BuildMaterial(); diff --git a/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs b/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs index cd76681..f957c0e 100644 --- a/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs +++ b/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs @@ -1,5 +1,6 @@ using StructureHelper.Models.Materials; using StructureHelperCommon.Infrastructures.Settings; +using StructureHelperCommon.Models.Materials.Libraries; using StructureHelperLogics.Models.Materials; using System; using System.Collections.Generic; diff --git a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs index 87abf07..53b663b 100644 --- a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs +++ b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs @@ -39,6 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives NdmMaxSize = 0.01d; NdmMinDivision = 10; VisualProperty = new VisualProperty(); + VisualProperty.Opacity = 0.8; } public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; } diff --git a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs index 4584d1c..7688fc6 100644 --- a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs +++ b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs @@ -12,13 +12,13 @@ namespace StructureHelperLogics.Services.NdmCalculations { public static class InterpolateService { - public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple sourceTuple, int stepCount) + public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple finishDesignForce,IDesignForceTuple startDesignForce, int stepCount) { IForceCalculator calculator = new ForceCalculator(); calculator.LimitStatesList.Clear(); - calculator.LimitStatesList.Add(sourceTuple.LimitState); + calculator.LimitStatesList.Add(finishDesignForce.LimitState); calculator.CalcTermsList.Clear(); - calculator.CalcTermsList.Add(sourceTuple.CalcTerm); + calculator.CalcTermsList.Add(finishDesignForce.CalcTerm); calculator.IterationAccuracy = source.IterationAccuracy; calculator.MaxIterationCount = source.MaxIterationCount; calculator.Primitives.AddRange(source.Primitives); @@ -29,7 +29,7 @@ namespace StructureHelperLogics.Services.NdmCalculations SetInGravityCenter = false }; combination.DesignForces.Clear(); - combination.DesignForces.AddRange(TupleService.InterpolateDesignTuple(sourceTuple, stepCount)); + combination.DesignForces.AddRange(TupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount)); combination.ForcePoint.X = 0; combination.ForcePoint.Y = 0; calculator.ForceCombinationLists.Add(combination); diff --git a/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs b/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs new file mode 100644 index 0000000..07c92a1 --- /dev/null +++ b/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs @@ -0,0 +1,53 @@ +using LoaderCalculator.Tests.Infrastructures.Logics; +using NUnit.Framework; +using StructureHelperLogics.Models.Templates.CrossSections.RCs; +using StructureHelperLogics.Models.Templates.RCs; +using StructureHelperLogics.NdmCalculations.Analyses.ByForces; + +namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorTests +{ + public class RCSectionsTest + { + [TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, -0.00062544561815463693d, -0.0029292919541166911d, 0.00035383082501577246d)] + [TestCase(0.4d, 0.6d, 0.012d, 0.025d, 3, 2, -0.00046762265275279838d, -0.0025101896869558888d, 0.00027185795017719519d)] + [TestCase(0.5d, 0.5d, 0.025d, 0.025d, 3, 3, -0.00080914991212906239d, -0.00080914991212906184d, 0.00011900072665826425d)] + public void Run_SouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, double expectedKx, double expectedKy, double expectedEpsZ) + { + //Arrange + var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount}; + var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection(); + var calculator = newSection.SectionRepository.CalculatorsList[0]; + //Act + calculator.Run(); + var result = calculator.Result as IForcesResults; + //Assert + Assert.IsNotNull(result); + Assert.IsTrue(result.IsValid); + var strainMatrix = result.ForcesResultList[0].LoaderResults.StrainMatrix; + var kx = strainMatrix.Kx; + var ky = strainMatrix.Ky; + var epsz = strainMatrix.EpsZ; + Assert.AreEqual(expectedKx, kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx)); + Assert.AreEqual(expectedKy, ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy)); + Assert.AreEqual(expectedEpsZ, epsz, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsZ)); + } + + [TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, true, true)] + [TestCase(1d, 0.2d, 0.012d, 0.012d, 5, 2, true, false)] + [TestCase(1d, 0.2d, 0.012d, 0.025d, 5, 2, true, true)] + public void Run_SouldPass_Result_IsNotValid(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, bool calcResult, bool firstForceResult) + { + //Arrange + var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount }; + var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection(); + var calculator = newSection.SectionRepository.CalculatorsList[0]; + //Act + calculator.Run(); + var result = calculator.Result as IForcesResults; + //Assert + Assert.IsNotNull(result); + Assert.True(calcResult == result.IsValid); + Assert.True(firstForceResult == result.ForcesResultList[0].IsValid); + } + } +} diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj index ab35ac9..3c234b3 100644 --- a/StructureHelperTests/StructureHelperTests.csproj +++ b/StructureHelperTests/StructureHelperTests.csproj @@ -42,6 +42,7 @@ + diff --git a/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs b/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs index 9b056eb..a614d8d 100644 --- a/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs +++ b/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs @@ -21,7 +21,7 @@ namespace StructureHelperTests.ViewModelTests public class NdmPrimitiveTests { [Test] - public void Run_ShouldPass() + public void Rectangle_Run_ShouldPass() { //Arrange var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018); @@ -32,5 +32,18 @@ namespace StructureHelperTests.ViewModelTests //Assert Assert.NotNull(vm); } + + [Test] + public void Point_Run_ShouldPass() + { + //Arrange + var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018); + var primitive = new PointPrimitive(material); + var primitiveBase = new PointViewPrimitive(primitive); + //Act + var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository()); + //Assert + Assert.NotNull(vm); + } } } diff --git a/Windows/Forces/ForceCombinationView.xaml b/Windows/Forces/ForceCombinationView.xaml index 7d0b300..9a0081c 100644 --- a/Windows/Forces/ForceCombinationView.xaml +++ b/Windows/Forces/ForceCombinationView.xaml @@ -7,43 +7,58 @@ xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces" d:DataContext="{d:DesignInstance vm:ForceCombinationViewModel}" mc:Ignorable="d" - Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen"> + Title="Force Combination" Height="250" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen"> - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - + + + + + + + + + + +