From d108c52cac920275ea0ad26b1be2e0deb8e812b7 Mon Sep 17 00:00:00 2001 From: Evgeny Redikultsev Date: Sun, 18 May 2025 22:01:52 +0500 Subject: [PATCH] Add beam shear result view --- StructureHelper/App.xaml | 1 + .../UI/Resources/StatusBarStyles.xaml | 26 ++++++ StructureHelper/StructureHelper.csproj.user | 9 +++ .../BeamShears/BeamShearResultView.xaml | 60 ++++++++++++++ .../BeamShears/BeamShearResultView.xaml.cs | 36 +++++++++ .../BeamShears/BeamShearResultViewModel.cs | 24 ++++++ .../BeamShears/ConcentratedForceView.xaml | 72 +++++++++++------ .../BeamShears/ConcentratedForceViewModel.cs | 6 +- .../BeamShears/DistributedLoadView.xaml | 80 ++++++++++++------- .../BeamShears/DistributedLoadViewModel.cs | 5 +- .../ForcesResultsView.xaml | 25 +----- .../ForcesResultsViewModel.cs | 11 +-- .../CalculatorsViews/ValidResultCounterVM.cs | 35 ++++++++ .../Models/Forces/ConcentratedForce.cs | 4 + .../Models/Forces/DistributedLoad.cs | 12 +-- .../Models/Forces/IBeamSpanLoad.cs | 4 + .../BeamShears/BeamShearActionResult.cs | 22 +++++ .../BeamShears/BeamShearCalculatorLogic.cs | 2 +- .../BeamShears/BeamShearCalculatorResult.cs | 2 +- .../BeamShears/IBeamShearActionResult.cs | 20 +++++ .../BeamShears/IBeamShearCalculatorResult.cs | 2 +- .../Logics/GetDirectShearForceLogic.cs | 28 ++++--- .../Logics/ISumForceByShearLoadLogic.cs | 5 +- .../Logics/SumConcentratedForceLogic.cs | 23 +++++- .../Logics/SumDistributedLoadLogic.cs | 22 ++++- .../Logics/SumForceByShearLoadLogic.cs | 17 ++-- 26 files changed, 440 insertions(+), 113 deletions(-) create mode 100644 StructureHelper/Infrastructure/UI/Resources/StatusBarStyles.xaml create mode 100644 StructureHelper/Windows/BeamShears/BeamShearResultView.xaml create mode 100644 StructureHelper/Windows/BeamShears/BeamShearResultView.xaml.cs create mode 100644 StructureHelper/Windows/BeamShears/BeamShearResultViewModel.cs create mode 100644 StructureHelper/Windows/CalculationWindows/CalculatorsViews/ValidResultCounterVM.cs create mode 100644 StructureHelperLogics/Models/BeamShears/BeamShearActionResult.cs create mode 100644 StructureHelperLogics/Models/BeamShears/IBeamShearActionResult.cs diff --git a/StructureHelper/App.xaml b/StructureHelper/App.xaml index d64bbc2..1da3fb5 100644 --- a/StructureHelper/App.xaml +++ b/StructureHelper/App.xaml @@ -10,6 +10,7 @@ + diff --git a/StructureHelper/Infrastructure/UI/Resources/StatusBarStyles.xaml b/StructureHelper/Infrastructure/UI/Resources/StatusBarStyles.xaml new file mode 100644 index 0000000..e762f0c --- /dev/null +++ b/StructureHelper/Infrastructure/UI/Resources/StatusBarStyles.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user index 38327d8..013be9b 100644 --- a/StructureHelper/StructureHelper.csproj.user +++ b/StructureHelper/StructureHelper.csproj.user @@ -18,6 +18,9 @@ Code + + Code + Code @@ -161,6 +164,9 @@ Designer + + Designer + Designer @@ -170,6 +176,9 @@ Designer + + Designer + Designer diff --git a/StructureHelper/Windows/BeamShears/BeamShearResultView.xaml b/StructureHelper/Windows/BeamShears/BeamShearResultView.xaml new file mode 100644 index 0000000..cb3a808 --- /dev/null +++ b/StructureHelper/Windows/BeamShears/BeamShearResultView.xaml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/BeamShearResultView.xaml.cs b/StructureHelper/Windows/BeamShears/BeamShearResultView.xaml.cs new file mode 100644 index 0000000..61afa01 --- /dev/null +++ b/StructureHelper/Windows/BeamShears/BeamShearResultView.xaml.cs @@ -0,0 +1,36 @@ +using StructureHelperLogics.Models.BeamShears; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace StructureHelper.Windows.BeamShears +{ + /// + /// Interaction logic for BeamShearResultView.xaml + /// + public partial class BeamShearResultView : Window + { + private BeamShearResultViewModel viewModel; + + public BeamShearResultView(BeamShearResultViewModel viewModel) + { + this.viewModel = viewModel; + this.DataContext = this.viewModel; + InitializeComponent(); + } + + public BeamShearResultView(IBeamShearCalculatorResult result) : this(new BeamShearResultViewModel(result)) + { + } + } +} diff --git a/StructureHelper/Windows/BeamShears/BeamShearResultViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearResultViewModel.cs new file mode 100644 index 0000000..61309b7 --- /dev/null +++ b/StructureHelper/Windows/BeamShears/BeamShearResultViewModel.cs @@ -0,0 +1,24 @@ +using StructureHelper.Infrastructure; +using StructureHelper.Windows.CalculationWindows.CalculatorsViews; +using StructureHelperLogics.Models.BeamShears; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace StructureHelper.Windows.BeamShears +{ + public class BeamShearResultViewModel : ViewModelBase + { + private IBeamShearCalculatorResult result; + public IBeamShearActionResult SelectedResult { get; set; } + public List ActionResults => result.ActionResults; + public ValidResultCounterVM ValidResultCounter { get; } + + public BeamShearResultViewModel(IBeamShearCalculatorResult result) + { + this.result = result; + ValidResultCounter = new(this.result.ActionResults); + } + + } +} diff --git a/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml b/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml index dd9e297..cc79c79 100644 --- a/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml +++ b/StructureHelper/Windows/BeamShears/ConcentratedForceView.xaml @@ -4,6 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears" + xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" d:DataContext="{d:DesignInstance local:ConcentratedForceViewModel}" mc:Ignorable="d" Title="ConcentratedForceView" Height="200" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> @@ -12,30 +13,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs b/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs index 2edebb0..78dc6a2 100644 --- a/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs +++ b/StructureHelper/Windows/BeamShears/ConcentratedForceViewModel.cs @@ -1,4 +1,5 @@ -using StructureHelper.Windows.ViewModels; +using StructureHelper.Windows.Forces; +using StructureHelper.Windows.ViewModels; using StructureHelperCommon.Models.Forces; namespace StructureHelper.Windows.BeamShears @@ -57,9 +58,12 @@ namespace StructureHelper.Windows.BeamShears } } + public FactoredCombinationPropertyVM CombinationProperty { get; } + public ConcentratedForceViewModel(IConcentratedForce concenratedForce) { this.concenratedForce = concenratedForce; + CombinationProperty = new(this.concenratedForce.CombinationProperty); } } } diff --git a/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml b/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml index 73ba431..13023d5 100644 --- a/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml +++ b/StructureHelper/Windows/BeamShears/DistributedLoadView.xaml @@ -4,6 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:StructureHelper.Windows.BeamShears" + xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" d:DataContext="{d:DesignInstance local:DistributedLoadViewModel}" mc:Ignorable="d" Title="Uniformly Distributed Load" Height="250" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> @@ -12,33 +13,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs b/StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs index 7c5b8ef..8396326 100644 --- a/StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs +++ b/StructureHelper/Windows/BeamShears/DistributedLoadViewModel.cs @@ -1,4 +1,5 @@ -using StructureHelper.Windows.ViewModels; +using StructureHelper.Windows.Forces; +using StructureHelper.Windows.ViewModels; using StructureHelperCommon.Models.Forces; using System; using System.Collections.Generic; @@ -70,10 +71,12 @@ namespace StructureHelper.Windows.BeamShears distributedLoad.EndCoordinate = value; } } + public FactoredCombinationPropertyVM CombinationProperty { get; } public DistributedLoadViewModel(IDistributedLoad distributedLoad) { this.distributedLoad = distributedLoad; + CombinationProperty = new(this.distributedLoad.CombinationProperty); } } } diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml index 5f3611a..722b3f1 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsView.xaml @@ -148,10 +148,6 @@ - - - - @@ -181,26 +177,7 @@ - - - - - - - - - - - - - - - - - - - - + diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs index 1c84a89..df3a9d4 100644 --- a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForcesResultsViewModel.cs @@ -1,7 +1,6 @@ using LoaderCalculator.Data.Matrix; using LoaderCalculator.Data.Ndms; using StructureHelper.Infrastructure; -using StructureHelper.Infrastructure.UI.DataContexts; using StructureHelper.Services.Exports; using StructureHelper.Services.Reports; using StructureHelper.Services.Reports.CalculationReports; @@ -33,6 +32,9 @@ using System.Linq; using System.Windows; using System.Windows.Input; +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews { public class ForcesResultsViewModel : ViewModelBase @@ -62,14 +64,12 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu private ICommand? showGraphsCommand; private ICommand? showCrackResult; private ICommand? showCrackGraphsCommand; - private ICommand? showCrackWidthResult; + //private ICommand? showCrackWidthResult; private ICommand? showInteractionDiagramCommand; private ICommand? graphValuepointsCommand; private ICommand showForceResultCommand; - public int ValidResultCount => resultModel.ForcesResultList.Count(x => x.IsValid == true); - public int InvalidResultCount => resultModel.ForcesResultList.Count(x => x.IsValid == false); - public int TotalResultCount => resultModel.ForcesResultList.Count; + public ValidResultCounterVM ValidResultCounter { get; } public IForcesResults ForcesResults { @@ -430,6 +430,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu { this.forceCalculator = forceCalculator; resultModel = forceCalculator.Result as IForcesResults; + ValidResultCounter = new(resultModel.ForcesResultList); ndmPrimitives = forceCalculator.InputData.Primitives; } diff --git a/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ValidResultCounterVM.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ValidResultCounterVM.cs new file mode 100644 index 0000000..a2ed62b --- /dev/null +++ b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ValidResultCounterVM.cs @@ -0,0 +1,35 @@ +using StructureHelper.Infrastructure; +using StructureHelperCommon.Models.Calculators; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews +{ + /// + /// Summary status bar for collection of results + /// + public class ValidResultCounterVM : ViewModelBase + { + private IEnumerable results; + /// + /// Count of valid results in collection + /// + public int ValidResultCount => results.Count(x => x.IsValid == true); + /// + /// Count of invalid results in collection + /// + public int InvalidResultCount => results.Count(x => x.IsValid == false); + /// + /// Total count of results + /// + public int TotalResultCount => results.Count(); + public ValidResultCounterVM(IEnumerable results) + { + this.results = results; + } + + } +} diff --git a/StructureHelperCommon/Models/Forces/ConcentratedForce.cs b/StructureHelperCommon/Models/Forces/ConcentratedForce.cs index a0640cd..1abc18c 100644 --- a/StructureHelperCommon/Models/Forces/ConcentratedForce.cs +++ b/StructureHelperCommon/Models/Forces/ConcentratedForce.cs @@ -1,4 +1,5 @@ using NLog; +using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Forces.BeamShearActions; using System; @@ -38,6 +39,9 @@ namespace StructureHelperCommon.Models.Forces } /// public double LoadRatio { get; set; } = 1; + /// + public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationProperty(Guid.NewGuid()) { LimitState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm }; + public ConcentratedForce(Guid id) { Id = id; diff --git a/StructureHelperCommon/Models/Forces/DistributedLoad.cs b/StructureHelperCommon/Models/Forces/DistributedLoad.cs index ab4b834..92388e0 100644 --- a/StructureHelperCommon/Models/Forces/DistributedLoad.cs +++ b/StructureHelperCommon/Models/Forces/DistributedLoad.cs @@ -1,10 +1,10 @@ -using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Forces.BeamShearActions; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. namespace StructureHelperCommon.Models.Forces { @@ -32,6 +32,8 @@ namespace StructureHelperCommon.Models.Forces public double EndCoordinate { get; set; } = double.PositiveInfinity; /// public double LoadRatio { get; set; } = 1; + /// + public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationProperty(Guid.NewGuid()) { LimitState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm}; public DistributedLoad(Guid id) { diff --git a/StructureHelperCommon/Models/Forces/IBeamSpanLoad.cs b/StructureHelperCommon/Models/Forces/IBeamSpanLoad.cs index e0fd82e..836ab4e 100644 --- a/StructureHelperCommon/Models/Forces/IBeamSpanLoad.cs +++ b/StructureHelperCommon/Models/Forces/IBeamSpanLoad.cs @@ -19,5 +19,9 @@ namespace StructureHelperCommon.Models.Forces /// Ratio of substraction load from total shear force /// double LoadRatio { get; set; } + /// + /// Properties of combination of forces + /// + IFactoredCombinationProperty CombinationProperty { get; set; } } } diff --git a/StructureHelperLogics/Models/BeamShears/BeamShearActionResult.cs b/StructureHelperLogics/Models/BeamShears/BeamShearActionResult.cs new file mode 100644 index 0000000..423e885 --- /dev/null +++ b/StructureHelperLogics/Models/BeamShears/BeamShearActionResult.cs @@ -0,0 +1,22 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + +namespace StructureHelperLogics.Models.BeamShears +{ + /// + public class BeamShearActionResult : IBeamShearActionResult + { + /// + public bool IsValid { get; set; } + /// + public string? Description { get; set; } + /// + public LimitStates LimitState { get; set; } + public CalcTerms CalcTerm { get; set; } + public IBeamShearAction BeamShearAction { get; set; } + public List SectionResults { get; set; } = new(); + } +} diff --git a/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorLogic.cs b/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorLogic.cs index 66185fd..93c8ccd 100644 --- a/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorLogic.cs @@ -53,7 +53,7 @@ namespace StructureHelperLogics.Models.BeamShears beamShearSectionLogic.InputData = sectionInputData; beamShearSectionLogic.Run(); var sectionResult = beamShearSectionLogic.Result as IBeamShearSectionLogicResult; - result.SectionResults.Add(sectionResult); + //result.ActionResults.Add(sectionResult); } } diff --git a/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorResult.cs b/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorResult.cs index 2116485..6e841ba 100644 --- a/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorResult.cs +++ b/StructureHelperLogics/Models/BeamShears/BeamShearCalculatorResult.cs @@ -10,6 +10,6 @@ namespace StructureHelperLogics.Models.BeamShears { public bool IsValid { get; set; } = true; public string? Description { get; set; } = string.Empty; - public List SectionResults { get; set; } = new(); + public List ActionResults { get; set; } = new(); } } diff --git a/StructureHelperLogics/Models/BeamShears/IBeamShearActionResult.cs b/StructureHelperLogics/Models/BeamShears/IBeamShearActionResult.cs new file mode 100644 index 0000000..b14d91a --- /dev/null +++ b/StructureHelperLogics/Models/BeamShears/IBeamShearActionResult.cs @@ -0,0 +1,20 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Calculators; +using StructureHelperCommon.Models.Forces; +using StructureHelperLogics.NdmCalculations.Analyses.ByForces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperLogics.Models.BeamShears +{ + public interface IBeamShearActionResult : IResult + { + LimitStates LimitState { get; set; } + CalcTerms CalcTerm { get; set; } + IBeamShearAction BeamShearAction { get; set; } + List SectionResults { get; set; } + } +} diff --git a/StructureHelperLogics/Models/BeamShears/IBeamShearCalculatorResult.cs b/StructureHelperLogics/Models/BeamShears/IBeamShearCalculatorResult.cs index b902006..25dd9ce 100644 --- a/StructureHelperLogics/Models/BeamShears/IBeamShearCalculatorResult.cs +++ b/StructureHelperLogics/Models/BeamShears/IBeamShearCalculatorResult.cs @@ -9,6 +9,6 @@ namespace StructureHelperLogics.Models.BeamShears { public interface IBeamShearCalculatorResult : IResult { - List SectionResults { get; set; } + List ActionResults { get; set; } } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/GetDirectShearForceLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/GetDirectShearForceLogic.cs index 68f7ea2..b36472d 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/GetDirectShearForceLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/GetDirectShearForceLogic.cs @@ -15,7 +15,7 @@ namespace StructureHelperLogics.Models.BeamShears /// public class GetDirectShearForceLogic : IGetDirectShearForceLogic { - ISumForceByShearLoadLogic summaryForceLogic; + private ISumForceByShearLoadLogic summaryForceLogic; /// public IShiftTraceLogger? TraceLogger { get; set; } @@ -88,26 +88,32 @@ namespace StructureHelperLogics.Models.BeamShears LimitState = LimitState, CalcTerm = CalcTerm }; - IForceTuple supportShearForce= forceTupleLogic.GetForceTuple(); + IForceTuple supportShearForce = forceTupleLogic.GetForceTuple(); TraceLogger?.AddMessage($"Shear force at support Qmax = {supportShearForce.Qy}(N)"); TraceLogger?.AddMessage($"Start of inclined section a,start = {InclinedSection.StartCoord}(m)"); TraceLogger?.AddMessage($"End of inclined section a,end = {InclinedSection.EndCoord}(m)"); - ForceTuple summarySpanShearForce = new (Guid.NewGuid()); - foreach (var item in beamShearAxisAction.ShearLoads) - { - IForceTuple summarySpanLoad = summaryForceLogic.GetSumShearForce(item, InclinedSection.StartCoord, InclinedSection.EndCoord); - ForceTupleService.SumTupleToTarget(summarySpanLoad, summarySpanShearForce); - } - TraceLogger?.AddMessage($"Summary span force deltaQ = {summarySpanShearForce.Qy}(N)"); - IForceTuple shearForce = ForceTupleService.SumTuples(supportShearForce,summarySpanShearForce); + ForceTuple summarySpanShearForce = GetSummarySpanShearForce(beamShearAxisAction.ShearLoads); + TraceLogger?.AddMessage($"Summary span shear force deltaQ = {summarySpanShearForce.Qy}(N)"); + IForceTuple shearForce = ForceTupleService.SumTuples(supportShearForce, summarySpanShearForce); TraceLogger?.AddMessage($"Summary shear force at the end of inclined section Q = {shearForce.Qy}(N)"); return shearForce; } + private ForceTuple GetSummarySpanShearForce(IEnumerable spanLoads) + { + ForceTuple summarySpanShearForce = new(Guid.NewGuid()); + foreach (var spanLoad in spanLoads) + { + IForceTuple summarySpanLoad = summaryForceLogic.GetSumShearForce(spanLoad, InclinedSection.StartCoord, InclinedSection.EndCoord); + ForceTupleService.SumTupleToTarget(summarySpanLoad, summarySpanShearForce); + } + return summarySpanShearForce; + } + private void InitializeStrategies() { - summaryForceLogic ??= new SumForceByShearLoadLogic(TraceLogger); + summaryForceLogic ??= new SumForceByShearLoadLogic(TraceLogger) { LimitState = LimitState, CalcTerm = CalcTerm}; } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/ISumForceByShearLoadLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/ISumForceByShearLoadLogic.cs index e4852cf..eec4931 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/ISumForceByShearLoadLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/ISumForceByShearLoadLogic.cs @@ -1,4 +1,5 @@ -using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Forces; using System; using System.Collections.Generic; @@ -13,6 +14,8 @@ namespace StructureHelperLogics.Models.BeamShears /// public interface ISumForceByShearLoadLogic : ILogic { + LimitStates LimitState { get; set; } + CalcTerms CalcTerm { get; set; } /// /// Returns summary force of action from start to end /// diff --git a/StructureHelperLogics/Models/BeamShears/Logics/SumConcentratedForceLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/SumConcentratedForceLogic.cs index a17e8c5..a5a742d 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/SumConcentratedForceLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/SumConcentratedForceLogic.cs @@ -1,6 +1,8 @@ -using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Models; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.Logics; using StructureHelperCommon.Models.Loggers; using StructureHelperCommon.Services.Forces; @@ -10,6 +12,8 @@ namespace StructureHelperLogics.Models.BeamShears { private ICoordinateByLevelLogic coordinateByLevelLogic; public IShiftTraceLogger? TraceLogger { get; set; } + public LimitStates LimitState { get; set; } + public CalcTerms CalcTerm { get; set; } public SumConcentratedForceLogic(ICoordinateByLevelLogic coordinateByLevelLogic, IShiftTraceLogger? traceLogger) { @@ -64,8 +68,10 @@ namespace StructureHelperLogics.Models.BeamShears } if (concentratedForce.ForceCoordinate < limitCoordinate) { - totalLoad = ForceTupleService.MultiplyTupleByFactor(concentratedForce.ForceValue, concentratedForce.LoadRatio); - TraceLogger?.AddMessage($"Total load Q,tot = {concentratedForce.ForceValue.Qy}(N) * {concentratedForce.LoadRatio} = {totalLoad}(N)"); + double loadFactor = GetLoadFactor(concentratedForce); + double sumFactor = concentratedForce.LoadRatio * loadFactor; + totalLoad = ForceTupleService.MultiplyTupleByFactor(concentratedForce.ForceValue, sumFactor); + TraceLogger?.AddMessage($"Total load Q,tot = {concentratedForce.ForceValue.Qy}(N) * {concentratedForce.LoadRatio} * {loadFactor} = {totalLoad}(N)"); } else { @@ -74,5 +80,16 @@ namespace StructureHelperLogics.Models.BeamShears } return totalLoad; } + + private double GetLoadFactor(IBeamSpanLoad spanLoad) + { + var getFactorLogic = new GetFactorByFactoredCombinationProperty() + { + CombinationProperty = spanLoad.CombinationProperty, + LimitState = LimitState, + CalcTerm = CalcTerm + }; + return getFactorLogic.GetFactor(); + } } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/SumDistributedLoadLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/SumDistributedLoadLogic.cs index 9a148cf..3d17b34 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/SumDistributedLoadLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/SumDistributedLoadLogic.cs @@ -1,6 +1,8 @@ -using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Models; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.Logics; using StructureHelperCommon.Models.Loggers; using StructureHelperCommon.Services.Forces; @@ -10,6 +12,8 @@ namespace StructureHelperLogics.Models.BeamShears { private ICoordinateByLevelLogic coordinateByLevelLogic; public IShiftTraceLogger? TraceLogger { get; set; } + public LimitStates LimitState { get; set; } + public CalcTerms CalcTerm { get; set; } public SumDistributedLoadLogic(IShiftTraceLogger? traceLogger) { @@ -55,10 +59,22 @@ namespace StructureHelperLogics.Models.BeamShears double loadEndCoord = Math.Min(distributedLoad.EndCoordinate, endCoordByLevel); double loadLength = loadEndCoord - loadStartCoord; TraceLogger?.AddMessage($"Total length L,tot = {loadEndCoord}(m) - {loadStartCoord}(m) = {loadLength}(m)"); - double sumFactor = distributedLoad.LoadRatio * loadLength; + double loadFactor = GetLoadFactor(distributedLoad); + double sumFactor = distributedLoad.LoadRatio * loadLength * loadFactor; IForceTuple totalLoad = ForceTupleService.MultiplyTupleByFactor(distributedLoad.LoadValue, sumFactor); - TraceLogger?.AddMessage($"Total load Q,tot = {distributedLoad.LoadValue.Qy}(N/m) * {distributedLoad.LoadRatio} * {loadLength}(m) = {totalLoad.Qy}(N)"); + TraceLogger?.AddMessage($"Total load Q,tot = {distributedLoad.LoadValue.Qy}(N/m) * {distributedLoad.LoadRatio} * {loadLength}(m) * {loadFactor} = {totalLoad.Qy}(N)"); return totalLoad; } + + private double GetLoadFactor(IBeamSpanLoad spanLoad) + { + var getFactorLogic = new GetFactorByFactoredCombinationProperty() + { + CombinationProperty = spanLoad.CombinationProperty, + LimitState = LimitState, + CalcTerm = CalcTerm + }; + return getFactorLogic.GetFactor(); + } } } diff --git a/StructureHelperLogics/Models/BeamShears/Logics/SumForceByShearLoadLogic.cs b/StructureHelperLogics/Models/BeamShears/Logics/SumForceByShearLoadLogic.cs index 0a5dda9..5094dac 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/SumForceByShearLoadLogic.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/SumForceByShearLoadLogic.cs @@ -1,7 +1,10 @@ -using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Models; using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces.Logics; using StructureHelperCommon.Models.Loggers; +using StructureHelperCommon.Services.Forces; namespace StructureHelperLogics.Models.BeamShears { @@ -10,6 +13,8 @@ namespace StructureHelperLogics.Models.BeamShears private ISumForceByShearLoadLogic sumDistributedLoadLogic; private ISumForceByShearLoadLogic sumConcentratedForceLogic; public IShiftTraceLogger? TraceLogger { get; set; } + public LimitStates LimitState { get; set; } + public CalcTerms CalcTerm { get; set; } public SumForceByShearLoadLogic(IShiftTraceLogger? traceLogger) { @@ -46,17 +51,19 @@ namespace StructureHelperLogics.Models.BeamShears } } - private IForceTuple GetConcentratedForceSum(IConcentratedForce concenratedForce, double startCoord, double endCoord) + private IForceTuple GetConcentratedForceSum(IConcentratedForce concentratedForce, double startCoord, double endCoord) { - sumConcentratedForceLogic ??= new SumConcentratedForceLogic(TraceLogger); - IForceTuple sumForce = sumConcentratedForceLogic.GetSumShearForce(concenratedForce, startCoord, endCoord); + sumConcentratedForceLogic ??= new SumConcentratedForceLogic(TraceLogger) { LimitState = LimitState, CalcTerm = CalcTerm}; + IForceTuple sumForce = sumConcentratedForceLogic.GetSumShearForce(concentratedForce, startCoord, endCoord); TraceLogger?.AddMessage($"Sum of concentrated force Qcf = {sumForce.Qy}(N)"); return sumForce; } + + private IForceTuple GetDistributedLoadSum(IDistributedLoad distributedLoad, double startCoord, double endCoord) { - sumDistributedLoadLogic ??= new SumDistributedLoadLogic(TraceLogger); + sumDistributedLoadLogic ??= new SumDistributedLoadLogic(TraceLogger) { LimitState = LimitState, CalcTerm = CalcTerm }; IForceTuple sumForce = sumDistributedLoadLogic.GetSumShearForce(distributedLoad, startCoord, endCoord); TraceLogger?.AddMessage($"Sum of uniformly distributed load Qud = {sumForce.Qy}(N)"); return sumForce;