Add curvature calculator DTOs
This commit is contained in:
@@ -4,6 +4,7 @@ using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
|
||||
@@ -65,11 +66,26 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
return ProcessValueDiagramCalcualtor(valueDiagramCalculator);
|
||||
}
|
||||
if (source is CurvatureCalculator curvatureCalculator)
|
||||
{
|
||||
return ProcessCurvatureCalcualtor(curvatureCalculator);
|
||||
}
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||
TraceLogger?.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
|
||||
private ICalculator ProcessCurvatureCalcualtor(CurvatureCalculator calculator)
|
||||
{
|
||||
var convertStrategy = new CurvatureCalculatorToDTOConvertStrategy()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
TraceLogger = TraceLogger,
|
||||
};
|
||||
var dictionaryConvertStrategy = new DictionaryConvertStrategy<CurvatureCalculatorDTO, ICurvatureCalculator>(this, convertStrategy);
|
||||
return dictionaryConvertStrategy.Convert(calculator);
|
||||
}
|
||||
|
||||
private ValueDiagramCalculatorDTO ProcessValueDiagramCalcualtor(IValueDiagramCalculator valueDiagramCalculator)
|
||||
{
|
||||
var convertStrategy = new ValueDiagramCalculatorToDTOConvertStrategy()
|
||||
@@ -78,7 +94,7 @@ namespace DataAccess.DTOs
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
var dictionaryConvertStrategy = new DictionaryConvertStrategy<ValueDiagramCalculatorDTO, IValueDiagramCalculator>(this, convertStrategy);
|
||||
return convertStrategy.Convert(valueDiagramCalculator);
|
||||
return dictionaryConvertStrategy.Convert(valueDiagramCalculator);
|
||||
}
|
||||
|
||||
private CrackCalculatorDTO ProcessCrackCalculator(ICrackCalculator crackCalculator)
|
||||
|
||||
@@ -3,6 +3,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
@@ -45,11 +46,26 @@ namespace DataAccess.DTOs
|
||||
TraceLogger?.AddMessage($"{CalculatorIs} value digram calculator");
|
||||
return GetValueDiagramCalculator(valueDiagramCalculator);
|
||||
}
|
||||
if (source is CurvatureCalculatorDTO curvatureCalculator)
|
||||
{
|
||||
TraceLogger?.AddMessage($"{CalculatorIs} curvature calculator");
|
||||
return GetCurvatureCalculator(curvatureCalculator);
|
||||
}
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
|
||||
private CurvatureCalculator GetCurvatureCalculator(CurvatureCalculatorDTO calculator)
|
||||
{
|
||||
var convertStrategy = new CurvatureCalculatorFromDTOConvertStrategy()
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
TraceLogger = TraceLogger,
|
||||
};
|
||||
return convertStrategy.Convert(calculator);
|
||||
}
|
||||
|
||||
private ValueDiagramCalculator GetValueDiagramCalculator(ValueDiagramCalculatorDTO valueDiagramCalculator)
|
||||
{
|
||||
var convertStrategy = new ValueDiagramCalcualtorFromDTOConvertStrategy()
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CurvatureCalculatorFromDTOConvertStrategy : ConvertStrategy<CurvatureCalculator, CurvatureCalculatorDTO>
|
||||
{
|
||||
IUpdateStrategy<ICurvatureCalculator> updateStrategy;
|
||||
IConvertStrategy<CurvatureCalculatorInputData, CurvatureCalculatorInputDataDTO> inputDataConvertStrategy;
|
||||
IUpdateStrategy<ICurvatureCalculator> UpdateStrategy => updateStrategy ??= new CurvatureCalculatorUpdateStrategy() { UpdateChildren = false };
|
||||
IConvertStrategy<CurvatureCalculatorInputData, CurvatureCalculatorInputDataDTO> InputDataConvertStrategy => inputDataConvertStrategy ??= new CurvatureCalculatorInputDataFromDTOConvertStrategy(this);
|
||||
|
||||
public override CurvatureCalculator GetNewItem(CurvatureCalculatorDTO source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
if (source.InputData is not CurvatureCalculatorInputDataDTO inputData)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.InputData) + ": deflection factor");
|
||||
}
|
||||
NewItem.InputData = InputDataConvertStrategy.Convert(inputData);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CurvatureCalculatorInputDataFromDTOConvertStrategy : ConvertStrategy<CurvatureCalculatorInputData, CurvatureCalculatorInputDataDTO>
|
||||
{
|
||||
private IHasPrimitivesProcessLogic primitivesProcessLogic;
|
||||
private IHasForceActionsProcessLogic actionsProcessLogic;
|
||||
private IUpdateStrategy<ICurvatureCalculatorInputData> updateStrategy;
|
||||
private IConvertStrategy<DeflectionFactor, DeflectionFactorDTO> deflectionConvertStrategy;
|
||||
|
||||
public CurvatureCalculatorInputDataFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
private IHasPrimitivesProcessLogic PrimitivesProcessLogic => primitivesProcessLogic ??= new HasPrimitivesProcessLogic(ConvertDirection.FromDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
||||
private IHasForceActionsProcessLogic ActionsProcessLogic => actionsProcessLogic ??= new HasForceActionsProcessLogic(ConvertDirection.FromDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
||||
private IUpdateStrategy<ICurvatureCalculatorInputData> UpdateStrategy => updateStrategy ??= new CurvatureCalculatorInputDataUpdateStrategy() { UpdateChildren = false };
|
||||
private IConvertStrategy<DeflectionFactor, DeflectionFactorDTO> DeflectionConvertStrategy => deflectionConvertStrategy ??= new DeflectionFactorFromDTOConvertStrategy(this);
|
||||
public override CurvatureCalculatorInputData GetNewItem(CurvatureCalculatorInputDataDTO source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
if (source.DeflectionFactor is not DeflectionFactorDTO deflectionFactorDTO)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.DeflectionFactor) + ": deflection factor");
|
||||
}
|
||||
NewItem.DeflectionFactor = DeflectionConvertStrategy.Convert(deflectionFactorDTO);
|
||||
ProcessPrimitives(source);
|
||||
ProcessActions(source);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void ProcessPrimitives(IHasPrimitives source)
|
||||
{
|
||||
PrimitivesProcessLogic.Source = source;
|
||||
PrimitivesProcessLogic.Target = NewItem;
|
||||
PrimitivesProcessLogic.Process();
|
||||
}
|
||||
private void ProcessActions(IHasForceActions source)
|
||||
{
|
||||
ActionsProcessLogic.Source = source;
|
||||
ActionsProcessLogic.Target = NewItem;
|
||||
ActionsProcessLogic.Process();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CurvatureCalculatorInputDataToDTOConvertStrategy : ConvertStrategy<CurvatureCalculatorInputDataDTO, ICurvatureCalculatorInputData>
|
||||
{
|
||||
private IHasPrimitivesProcessLogic primitivesProcessLogic;
|
||||
private IHasForceActionsProcessLogic actionsProcessLogic;
|
||||
private IUpdateStrategy<ICurvatureCalculatorInputData> updateStrategy;
|
||||
private IConvertStrategy<DeflectionFactorDTO, IDeflectionFactor> deflectionConvertStrategy;
|
||||
|
||||
private IHasPrimitivesProcessLogic PrimitivesProcessLogic => primitivesProcessLogic ??= new HasPrimitivesProcessLogic(ConvertDirection.ToDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger};
|
||||
private IHasForceActionsProcessLogic ActionsProcessLogic => actionsProcessLogic ??= new HasForceActionsProcessLogic(ConvertDirection.ToDTO) { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger};
|
||||
private IUpdateStrategy<ICurvatureCalculatorInputData> UpdateStrategy => updateStrategy ??= new CurvatureCalculatorInputDataUpdateStrategy() { UpdateChildren = false};
|
||||
private IConvertStrategy<DeflectionFactorDTO, IDeflectionFactor> DeflectionConvertStrategy => deflectionConvertStrategy ??= new DeflectionFactorToDTOConvertStrategy(this);
|
||||
|
||||
public CurvatureCalculatorInputDataToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
public override CurvatureCalculatorInputDataDTO GetNewItem(ICurvatureCalculatorInputData source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
NewItem.DeflectionFactor = DeflectionConvertStrategy.Convert(source.DeflectionFactor);
|
||||
ProcessPrimitives(source);
|
||||
ProcessActions(source);
|
||||
return NewItem;
|
||||
}
|
||||
|
||||
private void ProcessPrimitives(IHasPrimitives source)
|
||||
{
|
||||
PrimitivesProcessLogic.Source = source;
|
||||
PrimitivesProcessLogic.Target = NewItem;
|
||||
PrimitivesProcessLogic.Process();
|
||||
}
|
||||
private void ProcessActions(IHasForceActions source)
|
||||
{
|
||||
ActionsProcessLogic.Source = source;
|
||||
ActionsProcessLogic.Target = NewItem;
|
||||
ActionsProcessLogic.Process();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CurvatureCalculatorToDTOConvertStrategy : ConvertStrategy<CurvatureCalculatorDTO, ICurvatureCalculator>
|
||||
{
|
||||
IUpdateStrategy<ICurvatureCalculator> updateStrategy;
|
||||
IConvertStrategy<CurvatureCalculatorInputDataDTO, ICurvatureCalculatorInputData> inputDataConvertStrategy;
|
||||
IUpdateStrategy<ICurvatureCalculator> UpdateStrategy => updateStrategy ??= new CurvatureCalculatorUpdateStrategy() { UpdateChildren = false};
|
||||
IConvertStrategy<CurvatureCalculatorInputDataDTO, ICurvatureCalculatorInputData> InputDataConvertStrategy => inputDataConvertStrategy ??= new CurvatureCalculatorInputDataToDTOConvertStrategy(this);
|
||||
|
||||
|
||||
public override CurvatureCalculatorDTO GetNewItem(ICurvatureCalculator source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
NewItem.InputData = InputDataConvertStrategy.Convert(source.InputData);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class DeflectionFactorFromDTOConvertStrategy : ConvertStrategy<DeflectionFactor, DeflectionFactorDTO>
|
||||
{
|
||||
private IUpdateStrategy<IDeflectionFactor> updateStrategy;
|
||||
private IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy;
|
||||
|
||||
public DeflectionFactorFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
|
||||
private IUpdateStrategy<IDeflectionFactor> UpdateStrategy => updateStrategy ??= new DeflectionFactorUpdateStrategy() { UpdateChildren = false };
|
||||
private IConvertStrategy<ForceTuple, ForceTupleDTO> ForceTupleConvertStrategy => forceTupleConvertStrategy ??= new ForceTupleFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||
|
||||
public override DeflectionFactor GetNewItem(DeflectionFactorDTO source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
if (source.DeflectionFactors is not ForceTupleDTO deflectionFactor)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.DeflectionFactors) + ": deflection factor");
|
||||
}
|
||||
NewItem.DeflectionFactors = ForceTupleConvertStrategy.Convert(deflectionFactor);
|
||||
if (source.MaxDeflections is not ForceTupleDTO maxDeflections)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.MaxDeflections) + ": maximum deflections");
|
||||
}
|
||||
NewItem.MaxDeflections = ForceTupleConvertStrategy.Convert(maxDeflections);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class DeflectionFactorToDTOConvertStrategy : ConvertStrategy<DeflectionFactorDTO, IDeflectionFactor>
|
||||
{
|
||||
private IUpdateStrategy<IDeflectionFactor> updateStrategy;
|
||||
private IConvertStrategy<ForceTupleDTO, IForceTuple> forceTupleConvertStrategy;
|
||||
private IUpdateStrategy<IDeflectionFactor> UpdateStrategy => updateStrategy??= new DeflectionFactorUpdateStrategy() { UpdateChildren = false};
|
||||
private IConvertStrategy<ForceTupleDTO, IForceTuple> ForceTupleConvertStrategy => forceTupleConvertStrategy ??= new ForceTupleToDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||
|
||||
public DeflectionFactorToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||
{
|
||||
}
|
||||
public override DeflectionFactorDTO GetNewItem(IDeflectionFactor source)
|
||||
{
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
NewItem.DeflectionFactors = ForceTupleConvertStrategy.Convert(source.DeflectionFactors);
|
||||
NewItem.MaxDeflections = ForceTupleConvertStrategy.Convert(source.MaxDeflections);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CurvatureCalculatorDTO : ICurvatureCalculator
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("Name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("InputData")]
|
||||
public ICurvatureCalculatorInputData InputData { get; set; }
|
||||
[JsonProperty("ShowTraceData")]
|
||||
public bool ShowTraceData { get; set; }
|
||||
[JsonIgnore]
|
||||
public IResult Result => throw new NotImplementedException();
|
||||
[JsonIgnore]
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
public CurvatureCalculatorDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CurvatureCalculatorInputDataDTO : ICurvatureCalculatorInputData
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("DesignFactor")]
|
||||
public IDeflectionFactor DeflectionFactor { get; set; }
|
||||
[JsonProperty("ForceActions")]
|
||||
public List<IForceAction> ForceActions { get; } = [];
|
||||
[JsonProperty("Primitives")]
|
||||
public List<INdmPrimitive> Primitives { get; } = [];
|
||||
public CurvatureCalculatorInputDataDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class DeflectionFactorDTO : IDeflectionFactor
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("DeflectionFactors")]
|
||||
public IForceTuple DeflectionFactors { get; set; }
|
||||
[JsonProperty("SpanLength")]
|
||||
public double SpanLength { get; set; }
|
||||
[JsonProperty("MaxDeflections")]
|
||||
public IForceTuple MaxDeflections { get; set; }
|
||||
|
||||
|
||||
public DeflectionFactorDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,18 @@ namespace DataAccess.DTOs
|
||||
newList.AddRange(GetNdmPrimitiveList());
|
||||
newList.AddRange(GetBeamShearList());
|
||||
newList.AddRange(GetValueDiagramList());
|
||||
newList.AddRange(GetCurvatureList());
|
||||
return newList;
|
||||
}
|
||||
|
||||
private static IEnumerable<(Type type, string name)> GetCurvatureList()
|
||||
{
|
||||
List<(Type type, string name)> newList = new()
|
||||
{
|
||||
{ (typeof(CurvatureCalculatorDTO), "CurvatureCalculator") },
|
||||
{ (typeof(CurvatureCalculatorInputDataDTO), "CurvatureCalculatorInputData") },
|
||||
{ (typeof(DeflectionFactorDTO), "DeflectionFactor") },
|
||||
};
|
||||
return newList;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Cracks\TupleCrackResultView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Curvatures\CurvatureCalculatorResultView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\CalculationWindows\CalculatorsViews\Curvatures\CurvatureCalculatorView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -1,41 +1,19 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorInputDataViewModel : ViewModelBase
|
||||
{
|
||||
private ICurvatureCalculatorInputData inputData;
|
||||
private double deflectionFactor;
|
||||
private double spanLength;
|
||||
|
||||
public double DeflectionFactor
|
||||
{
|
||||
get => inputData.DeflectionFactor;
|
||||
set
|
||||
{
|
||||
inputData.DeflectionFactor = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(DeflectionFactor));
|
||||
}
|
||||
}
|
||||
|
||||
public double SpanLength
|
||||
{
|
||||
get => inputData.SpanLength;
|
||||
set
|
||||
{
|
||||
inputData.SpanLength = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(SpanLength));
|
||||
}
|
||||
}
|
||||
public DeflectionFactorViewModel DeflectionFactor { get; }
|
||||
|
||||
public SourceTargetVM<IForceAction> CombinationViewModel { get; }
|
||||
public SourceTargetVM<PrimitiveBase> PrimitivesViewModel { get; }
|
||||
@@ -45,6 +23,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
this.inputData = inputData;
|
||||
CombinationViewModel = SourceTargetFactory.GetSourceTargetVM(repository.ForceActions, inputData.ForceActions);
|
||||
PrimitivesViewModel = SourceTargetFactory.GetSourceTargetVM(repository.Primitives, inputData.Primitives);
|
||||
DeflectionFactor = new(inputData.DeflectionFactor);
|
||||
}
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures.CurvatureCalculatorResultView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:CurvatureCalculatorResultViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Result of calculation of curvatures and deflections" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
|
||||
<DockPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding ForcesResult}" SelectedItem="{Binding SelectedResult}">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsValid}" Value="false">
|
||||
<Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
|
||||
<DataGridTextColumn Header="Action name" Binding="{Binding InputData.TupleName}" Width="120"/>
|
||||
<DataGridTemplateColumn Header="Combination term" Width="120">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Long-term"/>
|
||||
<TextBlock Grid.Row="1" Text="Short-term"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Moment Mx" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Moment My" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Force Nz" Width="90">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding InputData.LongTermTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
|
||||
<TextBlock Grid.Row="1" Text="{Binding InputData.ShortTermTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Crack width" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl ContentTemplate="{StaticResource CrackGrid}" Content="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBlock Grid.Row="1" Text="{Binding CrackResult.Description}"/>
|
||||
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource ResultValidness}" Content="{Binding ValidResultCounter}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для CurvatureCalculatorResultView.xaml
|
||||
/// </summary>
|
||||
public partial class CurvatureCalculatorResultView : Window
|
||||
{
|
||||
private readonly CurvatureCalculatorResultViewModel viewModel;
|
||||
public CurvatureCalculatorResultView(CurvatureCalculatorResultViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.viewModel = viewModel;
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
public CurvatureCalculatorResultView(ICurvatureCalculatorResult? curvatureResult) : this(new CurvatureCalculatorResultViewModel(curvatureResult))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorResultViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ICurvatureCalculatorResult resultModel;
|
||||
public CurvatureForceCalculatorResultViewModel SelectedResult { get; set; }
|
||||
public List<CurvatureForceCalculatorResultViewModel> ForcesResult { get; set; }
|
||||
public ICurvatureCalculatorResult Result => resultModel;
|
||||
public ValidResultCounterVM ValidResultCounter { get; }
|
||||
|
||||
public CurvatureCalculatorResultViewModel(ICurvatureCalculatorResult resultModel)
|
||||
{
|
||||
this.resultModel = resultModel;
|
||||
ValidResultCounter = new(this.resultModel.ForceCalculatorResults);
|
||||
ForcesResult = new();
|
||||
foreach (var item in resultModel.ForceCalculatorResults)
|
||||
{
|
||||
ForcesResult.Add(new CurvatureForceCalculatorResultViewModel(item));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:CurvatureCalculatorViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Curvature Calculator" Height="250" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||
Title="Curvature Calculator" Height="250" Width="400" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
@@ -23,18 +23,13 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding CalculatorViewModel.Name}"/>
|
||||
<TextBlock Grid.Row="1" Text="Show trace data"/>
|
||||
<CheckBox Grid.Column="1" Grid.Row="1" Margin="0,3" IsChecked="{Binding CalculatorViewModel.ShowTraceData}"/>
|
||||
<TextBlock Grid.Row="2" Text="Deflection factor"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor, Converter={StaticResource PlainDouble}}"/>
|
||||
<TextBlock Grid.Row="3" Text="Span length"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding InputDataViewModel.SpanLength, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Forces">
|
||||
@@ -43,6 +38,62 @@
|
||||
<TabItem Header="Primitives">
|
||||
<ContentControl ContentTemplate="{StaticResource SourceToTarget}" Content="{Binding InputDataViewModel.PrimitivesViewModel}"/>
|
||||
</TabItem>
|
||||
<TabItem Header="Deflections">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Span length"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.SpanLength, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
<Expander Header="Maximum deflections" IsExpanded="True">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Along Y"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.Mx, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="1" Text="Along X"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.My, Converter={StaticResource LengthConverter}}"/>
|
||||
<TextBlock Grid.Row="2" Text="Along Z"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor.MaxDeflections.Nz, Converter={StaticResource LengthConverter}}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<Expander Header="Deflection factors">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Along Y"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding InputDataViewModel.DeflectionFactor.DeflectionFactors.Mx, Converter={StaticResource PlainDouble}}"/>
|
||||
<TextBlock Grid.Row="1" Text="Along X"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding InputDataViewModel.DeflectionFactor.DeflectionFactors.My, Converter={StaticResource PlainDouble}}"/>
|
||||
<TextBlock Grid.Row="2" Text="Along Z"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding InputDataViewModel.DeflectionFactor.DeflectionFactors.Nz, Converter={StaticResource PlainDouble}}"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
|
||||
@@ -15,5 +15,10 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
this.viewModel = viewModel;
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
viewModel.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class CurvatureForceCalculatorResultViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ICurvatureForceCalculatorResult resultModel;
|
||||
|
||||
public CurvatureForceCalculatorResultViewModel(ICurvatureForceCalculatorResult resultModel)
|
||||
{
|
||||
this.resultModel = resultModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Windows.ViewModels.Forces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures
|
||||
{
|
||||
public class DeflectionFactorViewModel : ViewModelBase
|
||||
{
|
||||
IDeflectionFactor deflectionFactor;
|
||||
public ForceTupleVM DeflectionFactors { get; }
|
||||
public ForceTupleVM MaxDeflections { get; }
|
||||
|
||||
public double SpanLength
|
||||
{
|
||||
get => deflectionFactor.SpanLength;
|
||||
set
|
||||
{
|
||||
deflectionFactor.SpanLength = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(SpanLength));
|
||||
}
|
||||
}
|
||||
|
||||
public DeflectionFactorViewModel(IDeflectionFactor deflectionFactor)
|
||||
{
|
||||
this.deflectionFactor = deflectionFactor;
|
||||
DeflectionFactors = new(this.deflectionFactor.DeflectionFactors)
|
||||
{
|
||||
MinMx = 0.0,
|
||||
MinMy = 0.0,
|
||||
MinNz = 0.0
|
||||
};
|
||||
MaxDeflections = new(this.deflectionFactor.MaxDeflections)
|
||||
{
|
||||
MinMx = 0.0,
|
||||
MinMy = 0.0,
|
||||
MinNz = 0.0
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
}
|
||||
private void SetPrestrain()
|
||||
{
|
||||
var source = TupleConverter.ConvertToStrainTuple(SelectedResult.ForcesTupleResult.LoaderResults.StrainMatrix);
|
||||
var source = ForceTupleConverter.ConvertToStrainTuple(SelectedResult.ForcesTupleResult.LoaderResults.StrainMatrix);
|
||||
var vm = new SetPrestrainViewModel(source);
|
||||
var wnd = new SetPrestrainView(vm);
|
||||
wnd.ShowDialog();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using LoaderCalculator;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews;
|
||||
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures;
|
||||
@@ -298,6 +297,12 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
ValueDiagramLogic valueDiagramLogic = new(diagramCalcualtorResult);
|
||||
valueDiagramLogic.Show();
|
||||
}
|
||||
else if (SelectedItem is ICurvatureCalculator curvatureCalculator)
|
||||
{
|
||||
ICurvatureCalculatorResult curvatureResult = curvatureCalculator.Result as ICurvatureCalculatorResult;
|
||||
var wnd = new CurvatureCalculatorResultView(curvatureResult);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(SelectedItem));
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Forces
|
||||
{
|
||||
@@ -16,7 +12,8 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
get => forceTuple.Mx;
|
||||
set
|
||||
{
|
||||
forceTuple.Mx = value;
|
||||
forceTuple.Mx = Math.Max(value, MinMx);
|
||||
forceTuple.Mx = Math.Min(value, MaxMx);
|
||||
OnPropertyChanged(nameof(Mx));
|
||||
}
|
||||
}
|
||||
@@ -25,7 +22,8 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
get => forceTuple.My;
|
||||
set
|
||||
{
|
||||
forceTuple.My = value;
|
||||
forceTuple.My = Math.Max(value, MinMy);
|
||||
forceTuple.My = Math.Min(value, MaxMy);
|
||||
OnPropertyChanged(nameof(My));
|
||||
}
|
||||
}
|
||||
@@ -34,7 +32,8 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
get => forceTuple.Nz;
|
||||
set
|
||||
{
|
||||
forceTuple.Nz = value;
|
||||
forceTuple.Nz = Math.Max(value, MinNz);
|
||||
forceTuple.Nz = Math.Min(value, MaxNz);
|
||||
OnPropertyChanged(nameof(Nz));
|
||||
}
|
||||
}
|
||||
@@ -65,6 +64,20 @@ namespace StructureHelper.Windows.ViewModels.Forces
|
||||
OnPropertyChanged(nameof(Mz));
|
||||
}
|
||||
}
|
||||
|
||||
public double MaxMx { get; set; } = double.PositiveInfinity;
|
||||
public double MinMx { get; set; } = double.NegativeInfinity;
|
||||
public double MaxMy { get; set; } = double.PositiveInfinity;
|
||||
public double MinMy { get; set; } = double.NegativeInfinity;
|
||||
public double MaxNz { get; set; } = double.PositiveInfinity;
|
||||
public double MinNz { get; set; } = double.NegativeInfinity;
|
||||
public double MaxMz { get; set; } = double.PositiveInfinity;
|
||||
public double MinMz { get; set; } = double.NegativeInfinity;
|
||||
public double MaxQx { get; set; } = double.PositiveInfinity;
|
||||
public double MinQx { get; set; } = double.NegativeInfinity;
|
||||
public double MaxQy { get; set; } = double.PositiveInfinity;
|
||||
public double MinQy { get; set; } = double.NegativeInfinity;
|
||||
|
||||
public ForceTupleVM(IForceTuple forceTuple)
|
||||
{
|
||||
this.forceTuple = forceTuple;
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace StructureHelperCommon.Services.Forces
|
||||
{
|
||||
public static class TupleConverter
|
||||
public static class ForceTupleConverter
|
||||
{
|
||||
static readonly IStressLogic stressLogic = new StressLogic();
|
||||
public static StrainMatrix ConvertToLoaderStrainMatrix(StrainTuple strainTuple)
|
||||
@@ -29,6 +29,17 @@ namespace StructureHelperCommon.Services.Forces
|
||||
return strainTuple;
|
||||
}
|
||||
|
||||
public static ForceTuple ConvertToForceTuple(IStrainMatrix strainMatrix)
|
||||
{
|
||||
ForceTuple strainTuple = new()
|
||||
{
|
||||
Mx = strainMatrix.Kx,
|
||||
My = strainMatrix.Ky,
|
||||
Nz = strainMatrix.EpsZ
|
||||
};
|
||||
return strainTuple;
|
||||
}
|
||||
|
||||
public static ForceTuple ConvertToForceTuple(IEnumerable<INdm> ndms, StrainTuple strainTuple)
|
||||
{
|
||||
var strainMatrix = ConvertToLoaderStrainMatrix(strainTuple);
|
||||
@@ -69,7 +69,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
|
||||
private void CheckPrimitives()
|
||||
{
|
||||
checkPrimitiveCollectionLogic ??= new CheckPrimitiveCollectionLogic(
|
||||
checkPrimitiveCollectionLogic ??= new HasPrimitivesCheckLogic(
|
||||
TraceLogger,
|
||||
new CheckRebarPrimitiveLogic()
|
||||
{
|
||||
|
||||
@@ -12,12 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
/// <inheritdoc/>
|
||||
public IForceTuple ForceTuple { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IAccuracy Accuracy { get; set; }
|
||||
public bool CheckStrainLimit { get; set; }
|
||||
|
||||
public ForceTupleInputData()
|
||||
{
|
||||
Accuracy ??= new Accuracy() { IterationAccuracy = 0.01d, MaxIterationCount = 1000 };
|
||||
}
|
||||
public IAccuracy Accuracy { get; set; } = new Accuracy() { IterationAccuracy = 0.01d, MaxIterationCount = 1000 };
|
||||
public bool CheckStrainLimit { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
Mx = point3D.X,
|
||||
My = point3D.Y
|
||||
};
|
||||
logic.Tuple = tuple;
|
||||
logic.ForceTuple = tuple;
|
||||
logic.SectionNdmCollection = Ndms;
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
@@ -11,7 +12,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
public class CalculatorCloningStrategyContainer : ICalculatorCloningStrategyContainer
|
||||
{
|
||||
private ICloningStrategy cloningStrategy;
|
||||
|
||||
private IUpdateStrategy<IValueDiagramCalculator> valueDiagramCalculatorStrategy;
|
||||
private IUpdateStrategy<ICurvatureCalculator> curvatureCalculatorStrategy;
|
||||
|
||||
public IUpdateStrategy<IForceCalculator> ForceCalculatorStrategy => new ForceCalculatorUpdateCloningStrategy(cloningStrategy);
|
||||
|
||||
@@ -19,7 +21,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
|
||||
public IUpdateStrategy<ILimitCurvesCalculator> LimitCurvesCalculatorStrategy => new LimitCurvesCalculatorUpdateCloningStrategy(cloningStrategy);
|
||||
|
||||
public IUpdateStrategy<IValueDiagramCalculator> ValueDiagramCalculatorStrategy => new ValueDiagramCalculatorUpdateCloningStrategy(cloningStrategy);
|
||||
public IUpdateStrategy<IValueDiagramCalculator> ValueDiagramCalculatorStrategy => valueDiagramCalculatorStrategy ??= new ValueDiagramCalculatorUpdateCloningStrategy(cloningStrategy);
|
||||
public IUpdateStrategy<ICurvatureCalculator> CurvatureCalculatorStrategy => curvatureCalculatorStrategy ??= new CurvatureCalculatorUpdateCloningStrategy(cloningStrategy);
|
||||
public CalculatorCloningStrategyContainer(ICloningStrategy cloningStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
|
||||
@@ -6,6 +6,7 @@ using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
@@ -65,6 +66,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
{
|
||||
cloningStrategyContainer.ValueDiagramCalculatorStrategy.Update(newCalculator as IValueDiagramCalculator, valueDiagramCalculator);
|
||||
}
|
||||
else if (calculator is ICurvatureCalculator curvatureCalculator)
|
||||
{
|
||||
cloningStrategyContainer.CurvatureCalculatorStrategy.Update(newCalculator as ICurvatureCalculator, curvatureCalculator);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(calculator));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.Curvatures;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
|
||||
@@ -10,5 +11,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
|
||||
IUpdateStrategy<ICrackCalculator> CrackCalculatorStrategy { get; }
|
||||
IUpdateStrategy<ILimitCurvesCalculator> LimitCurvesCalculatorStrategy { get; }
|
||||
IUpdateStrategy<IValueDiagramCalculator> ValueDiagramCalculatorStrategy { get; }
|
||||
IUpdateStrategy<ICurvatureCalculator> CurvatureCalculatorStrategy { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.Logics
|
||||
TraceLogger?.AddMessage($"Logic of analisys based on calculating sum of secant stifness of elementary parts EA,i = A,i * Esec,i");
|
||||
TraceLogger?.AddMessage($"Calculating geometry properties for strains");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(StrainTuple));
|
||||
var loaderStainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(StrainTuple);
|
||||
var loaderStainMatrix = ForceTupleConverter.ConvertToLoaderStrainMatrix(StrainTuple);
|
||||
var (MxFactor, MyFactor, NzFactor) = GeometryOperations.GetSofteningsFactors(NdmCollection, loaderStainMatrix);
|
||||
TraceLogger?.AddMessage($"Reducing of stiffness in {ProgramSetting.GeometryNames.SndAxisName}-plane: EIx_cracked / EIx_uncracked = {MxFactor}");
|
||||
TraceLogger?.AddMessage($"Reducing of stiffness in {ProgramSetting.GeometryNames.FstAxisName}-plane: EIy_cracked / EIy_uncracked = {MyFactor}");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,7 +9,13 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureCalculator : ICurvatureCalculator
|
||||
{
|
||||
private ICurvatureCalculatorResult result;
|
||||
private CurvatureCalculatorResult result;
|
||||
private ICheckEntityLogic<ICurvatureCalculatorInputData> inputDataCheckLogic;
|
||||
private ICurvatureCalcualtorLogic calculatorLogic;
|
||||
private ICurvatureCalcualtorLogic CalculatorLogic => calculatorLogic ??= new CurvatureCalculatorLogic() { InputData = InputData, TraceLogger = TraceLogger};
|
||||
|
||||
private ICheckEntityLogic<ICurvatureCalculatorInputData> InputDataCheckLogic => inputDataCheckLogic ??= new CurvatureCalculatorInputDataCheckLogic(TraceLogger) { Entity = InputData};
|
||||
|
||||
public Guid Id { get; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public ICurvatureCalculatorInputData InputData { get; set; } = new CurvatureCalculatorInputData(Guid.NewGuid());
|
||||
@@ -34,7 +41,43 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
|
||||
public void Run()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
PrepareNewResult();
|
||||
if (CheckInputData() == false) {return;}
|
||||
GetResultByLogic();
|
||||
}
|
||||
|
||||
private void GetResultByLogic()
|
||||
{
|
||||
try
|
||||
{
|
||||
CalculatorLogic.Run();
|
||||
result = CalculatorLogic.Result as CurvatureCalculatorResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private void PrepareNewResult()
|
||||
{
|
||||
result = new()
|
||||
{
|
||||
IsValid = true,
|
||||
InputData = InputData,
|
||||
};
|
||||
}
|
||||
|
||||
private bool CheckInputData()
|
||||
{
|
||||
if (InputDataCheckLogic.Check() == false)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += inputDataCheckLogic.CheckResult;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
public List<IForceAction> ForceActions { get; } = [];
|
||||
|
||||
public List<INdmPrimitive> Primitives { get; } = [];
|
||||
public double DeflectionFactor { get; set; } = 0.1042;
|
||||
public double SpanLength { get; set; } = 6.0;
|
||||
public IDeflectionFactor DeflectionFactor { get; set; } = new DeflectionFactor(Guid.NewGuid());
|
||||
|
||||
public CurvatureCalculatorInputData(Guid id)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorResult : ICurvatureCalculatorResult
|
||||
{
|
||||
public ICurvatureCalculatorInputData InputData { get; set; }
|
||||
|
||||
public List<ICurvatureForceCalculatorResult> ForceCalculatorResults { get; } = [];
|
||||
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureForceCalculator : ICurvatureForceCalculator
|
||||
{
|
||||
private CurvatureForceCalculatorResult result;
|
||||
public ICurvatureForceCalculatorInputData InputData { get; set; }
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
PrepareResult();
|
||||
if (CheckForCracks(InputData.ShortTermTuple, CalcTerms.ShortTerm) || CheckForCracks(InputData.ShortTermTuple, CalcTerms.ShortTerm))
|
||||
{
|
||||
ProcessCrackedSection();
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessUncrackedSection();
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCrackedSection()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void ProcessUncrackedSection()
|
||||
{
|
||||
CurvatureTermCalculatorInputData inputData = new()
|
||||
{
|
||||
Primitives = InputData.Primitives,
|
||||
DeflectionFactor = InputData.DeflectionFactor
|
||||
};
|
||||
var calculator = new CurvatureTermUncrackedCalculator() { InputData = inputData };
|
||||
inputData.ForceTuple = InputData.LongTermTuple;
|
||||
inputData.CalculationTerm = CalcTerms.LongTerm;
|
||||
calculator.Run();
|
||||
var calcResult = calculator.Result as CurvatureTermCalculatorResult;
|
||||
if (calcResult.IsValid == false)
|
||||
{
|
||||
result.IsValid = false;
|
||||
}
|
||||
result.LongTermResult = calcResult;
|
||||
}
|
||||
|
||||
private bool CheckForCracks(IForceTuple forceTuple, CalcTerms calcTerm)
|
||||
{
|
||||
var triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
{
|
||||
Primitives = InputData.Primitives,
|
||||
LimitState = LimitStates.SLS,
|
||||
CalcTerm = calcTerm,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
var ndms = triangulateLogic.GetNdms();
|
||||
var logic = new IsSectionCrackedByForceLogic()
|
||||
{
|
||||
ForceTuple = forceTuple,
|
||||
CheckedNdmCollection = ndms,
|
||||
SectionNdmCollection = ndms
|
||||
};
|
||||
return logic.IsSectionCracked();
|
||||
}
|
||||
|
||||
private void PrepareResult()
|
||||
{
|
||||
result = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureForceCalculatorInputData : ICurvatureForceCalculatorInputData
|
||||
{
|
||||
public IForceTuple LongTermTuple { get; set; }
|
||||
public IForceTuple ShortTermTuple { get; set; }
|
||||
public List<INdmPrimitive> Primitives { get; set; } = [];
|
||||
public IDeflectionFactor DeflectionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureForceCalculatorResult : ICurvatureForceCalculatorResult
|
||||
{
|
||||
public ICurvatureForceCalculatorInputData InputData { get; set; }
|
||||
public ICurvatureTermCalculatorResult LongTermResult { get; set; }
|
||||
public ICurvatureTermCalculatorResult ShortTermResult { get; set; }
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureTermCalcualtor : ICurvatureTermCalcualtor
|
||||
public class CurvatureTermCalcualtor : ICurvatureTermCalculator
|
||||
{
|
||||
private ICurvatureTermCalcualtorResult result;
|
||||
public ICurvatureTermCalcualtorInputData InputData { get; set; }
|
||||
private ICurvatureTermCalculatorResult result;
|
||||
public ICurvatureTermCalculatorInputData InputData { get; set; }
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureTermCalculatorInputData : ICurvatureTermCalculatorInputData
|
||||
{
|
||||
public IForceTuple ForceTuple { get; set; }
|
||||
public CalcTerms LoadTerm { get; set; }
|
||||
public CalcTerms CalculationTerm { get; set; }
|
||||
|
||||
public List<INdmPrimitive> Primitives { get; set; } = [];
|
||||
public IDeflectionFactor DeflectionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureTermCalculatorResult : ICurvatureTermCalculatorResult
|
||||
{
|
||||
public ICurvatureTermCalculatorInputData InputData { get; set; }
|
||||
public IForceTuple CurvatureValues { get; set; }
|
||||
public IForceTuple Deflections { get; set; }
|
||||
public bool IsValid { get; set; } = true;
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureTermUncrackedCalculator : ICurvatureTermCalculator
|
||||
{
|
||||
private CurvatureTermCalculatorResult result;
|
||||
private List<INdm> ndms;
|
||||
|
||||
public ICurvatureTermCalculatorInputData InputData { get; set; }
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
PrepareNewResult();
|
||||
TriangulatePrimitives();
|
||||
Calculate();
|
||||
}
|
||||
|
||||
private void Calculate()
|
||||
{
|
||||
try
|
||||
{
|
||||
var inputData = new ForceTupleInputData()
|
||||
{
|
||||
NdmCollection = ndms,
|
||||
ForceTuple = InputData.ForceTuple
|
||||
};
|
||||
var calculator = new ForceTupleCalculator()
|
||||
{
|
||||
InputData = inputData,
|
||||
};
|
||||
calculator.Run();
|
||||
var calcResult = calculator.Result as IForceTupleCalculatorResult;
|
||||
if (calcResult.IsValid != true)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += calcResult.Description;
|
||||
return;
|
||||
}
|
||||
result.CurvatureValues = ForceTupleConverter.ConvertToForceTuple(calcResult.LoaderResults.StrainMatrix);
|
||||
ConvertCurvaturesToDeflections();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description = ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private void ConvertCurvaturesToDeflections()
|
||||
{
|
||||
ForceTuple deflections = new();
|
||||
double spanLength = InputData.DeflectionFactor.SpanLength;
|
||||
deflections.Mx = InputData.DeflectionFactor.DeflectionFactors.Mx * result.CurvatureValues.Mx * spanLength * spanLength;
|
||||
deflections.My = InputData.DeflectionFactor.DeflectionFactors.My * result.CurvatureValues.My * spanLength * spanLength;
|
||||
deflections.Nz = InputData.DeflectionFactor.DeflectionFactors.Nz * result.CurvatureValues.Nz * spanLength;
|
||||
result.Deflections = deflections;
|
||||
}
|
||||
|
||||
private void TriangulatePrimitives()
|
||||
{
|
||||
var triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
{
|
||||
Primitives = InputData.Primitives,
|
||||
LimitState = LimitStates.SLS,
|
||||
CalcTerm = InputData.CalculationTerm,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
ndms = triangulateLogic.GetNdms();
|
||||
}
|
||||
|
||||
private void PrepareNewResult()
|
||||
{
|
||||
result = new();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class DeflectionFactor : IDeflectionFactor
|
||||
{
|
||||
private const double bendCurveFactor = 0.1042;
|
||||
private const double longitudinalFactor = 1.0;
|
||||
private const double maxDeflection = 0.02;
|
||||
|
||||
public IForceTuple DeflectionFactors { get; set; }
|
||||
public double SpanLength { get; set; } = 6.0;
|
||||
public IForceTuple MaxDeflections { get; set; }
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
public DeflectionFactor(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
DeflectionFactors = new ForceTuple()
|
||||
{
|
||||
Mx = bendCurveFactor,
|
||||
My = bendCurveFactor,
|
||||
Mz = longitudinalFactor,
|
||||
Nz = longitudinalFactor,
|
||||
Qx = longitudinalFactor,
|
||||
Qy = longitudinalFactor
|
||||
};
|
||||
MaxDeflections = new ForceTuple()
|
||||
{
|
||||
Mx = maxDeflection,
|
||||
My = maxDeflection,
|
||||
Mz = maxDeflection,
|
||||
Nz = maxDeflection,
|
||||
Qx = maxDeflection,
|
||||
Qy = maxDeflection,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Input data for calculator of curvature of cross-section
|
||||
/// </summary>
|
||||
public interface ICurvatureCalculatorInputData : IInputData, ISaveable, IHasForceActions, IHasPrimitives
|
||||
{
|
||||
double DeflectionFactor { get; set; }
|
||||
double SpanLength { get; set; }
|
||||
IDeflectionFactor DeflectionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public interface ICurvatureForceCalcualtor : ILogicCalculator
|
||||
public interface ICurvatureForceCalculator : ILogicCalculator
|
||||
{
|
||||
ICurvatureForceCalculatorInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public interface ICurvatureForceCalculatorInputData : IInputData, IHasPrimitives
|
||||
{
|
||||
IDesignForceTuple DesignForceTuple { get; set; }
|
||||
IForceTuple LongTermTuple { get; set; }
|
||||
IForceTuple ShortTermTuple { get; set; }
|
||||
IDeflectionFactor DeflectionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
public interface ICurvatureForceCalculatorResult : IResult
|
||||
{
|
||||
ICurvatureForceCalculatorInputData InputData { get; set; }
|
||||
ICurvatureTermCalcualtorResult LongTermResult { get; set; }
|
||||
ICurvatureTermCalcualtorResult ShortTermResult { get; set; }
|
||||
ICurvatureTermCalculatorResult LongTermResult { get; set; }
|
||||
ICurvatureTermCalculatorResult ShortTermResult { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public interface ICurvatureTermCalcualtorResult : IResult
|
||||
{
|
||||
ICurvatureTermCalcualtorInputData InputData { get; set; }
|
||||
IForceTuple CurvatureValue { get; set; }
|
||||
IForceTuple Deflection { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public interface ICurvatureTermCalcualtor : ILogicCalculator
|
||||
public interface ICurvatureTermCalculator : ILogicCalculator
|
||||
{
|
||||
ICurvatureTermCalcualtorInputData InputData { get; set; }
|
||||
ICurvatureTermCalculatorInputData InputData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@ using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public interface ICurvatureTermCalcualtorInputData : IInputData, IHasPrimitives
|
||||
public interface ICurvatureTermCalculatorInputData : IInputData, IHasPrimitives
|
||||
{
|
||||
IForceTuple DesignForceTuple { get; set; }
|
||||
IForceTuple ForceTuple { get; set; }
|
||||
CalcTerms LoadTerm { get; set; }
|
||||
CalcTerms CalculationTerm { get; set; }
|
||||
IDeflectionFactor DeflectionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public interface ICurvatureTermCalculatorResult : IResult
|
||||
{
|
||||
ICurvatureTermCalculatorInputData InputData { get; set; }
|
||||
IForceTuple CurvatureValues { get; set; }
|
||||
IForceTuple Deflections { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements properties for calculation deflections
|
||||
/// </summary>
|
||||
public interface IDeflectionFactor : ISaveable
|
||||
{
|
||||
/// <summary>
|
||||
/// Factors for calculating deflections, dimensionless
|
||||
/// </summary>
|
||||
IForceTuple DeflectionFactors { get; set; }
|
||||
/// <summary>
|
||||
/// Maximum deflections, metres
|
||||
/// </summary>
|
||||
double SpanLength { get; set; }
|
||||
IForceTuple MaxDeflections { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorInputDataCheckLogic : CheckEntityLogic<ICurvatureCalculatorInputData>
|
||||
{
|
||||
private ICheckEntityLogic<IHasPrimitives> primitivesCheckLogic;
|
||||
private ICheckEntityLogic<IEnumerable<IForceAction>> actionsCheckLogic;
|
||||
private bool result;
|
||||
|
||||
private ICheckEntityLogic<IEnumerable<IForceAction>> ActionsCheckLogic => actionsCheckLogic ??= new CheckForceActionsLogic(TraceLogger);
|
||||
|
||||
private ICheckEntityLogic<IHasPrimitives> PrimitivesCheckLogic => primitivesCheckLogic ??= new HasPrimitivesCheckLogic();
|
||||
|
||||
public CurvatureCalculatorInputDataCheckLogic(IShiftTraceLogger traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger;
|
||||
CheckRebarPrimitiveLogic checkRebarPrimitiveLogic = new()
|
||||
{
|
||||
CheckRebarHostMaterial = false,
|
||||
CheckRebarPlacement = false
|
||||
};
|
||||
primitivesCheckLogic = new HasPrimitivesCheckLogic(TraceLogger, checkRebarPrimitiveLogic);
|
||||
}
|
||||
|
||||
public override bool Check()
|
||||
{
|
||||
result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": curvature calculator input data";
|
||||
TraceMessage(errorString);
|
||||
throw new StructureHelperException(errorString);
|
||||
}
|
||||
if (Entity.Primitives is null || !Entity.Primitives.Any())
|
||||
{
|
||||
TraceMessage("Calculator does not contain any primitives");
|
||||
result = false;
|
||||
}
|
||||
if (Entity.ForceActions is null || !Entity.ForceActions.Any())
|
||||
{
|
||||
TraceMessage("Calculator does not contain any forces");
|
||||
result = false;
|
||||
}
|
||||
CheckPrimitives();
|
||||
CheckActions();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void CheckPrimitives()
|
||||
{
|
||||
PrimitivesCheckLogic.Entity = Entity;
|
||||
if (PrimitivesCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
TraceMessage(PrimitivesCheckLogic.CheckResult);
|
||||
|
||||
}
|
||||
|
||||
private void CheckActions()
|
||||
{
|
||||
ActionsCheckLogic.Entity = Entity.ForceActions;
|
||||
if (ActionsCheckLogic.Check() == false)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
TraceMessage(ActionsCheckLogic.CheckResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorInputDataUpdateStrategy : IParentUpdateStrategy<ICurvatureCalculatorInputData>
|
||||
{
|
||||
private IUpdateStrategy<IDeflectionFactor> deflectionUpdateStrategy;
|
||||
private IUpdateStrategy<IDeflectionFactor> DeflectionUpdateStrategy => deflectionUpdateStrategy ??= new DeflectionFactorUpdateStrategy();
|
||||
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(ICurvatureCalculatorInputData targetObject, ICurvatureCalculatorInputData sourceObject)
|
||||
@@ -13,19 +16,23 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
CheckObject.ThrowIfNull(targetObject, nameof(targetObject));
|
||||
if (ReferenceEquals(targetObject, sourceObject))
|
||||
return;
|
||||
targetObject.DeflectionFactor = sourceObject.DeflectionFactor;
|
||||
targetObject.SpanLength = sourceObject.SpanLength;
|
||||
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
CheckObject.ThrowIfNull(sourceObject.Primitives);
|
||||
CheckObject.ThrowIfNull(targetObject.Primitives);
|
||||
CheckProperties(targetObject, sourceObject);
|
||||
targetObject.Primitives.Clear();
|
||||
targetObject.Primitives.AddRange(sourceObject.Primitives);
|
||||
CheckObject.ThrowIfNull(sourceObject.ForceActions);
|
||||
CheckObject.ThrowIfNull(targetObject.ForceActions);
|
||||
targetObject.ForceActions.Clear();
|
||||
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckProperties(ICurvatureCalculatorInputData targetObject, ICurvatureCalculatorInputData sourceObject)
|
||||
{
|
||||
CheckObject.ThrowIfNull(sourceObject.Primitives);
|
||||
CheckObject.ThrowIfNull(targetObject.Primitives);
|
||||
CheckObject.ThrowIfNull(sourceObject.ForceActions);
|
||||
CheckObject.ThrowIfNull(targetObject.ForceActions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Sections;
|
||||
using StructureHelperCommon.Models.Sections.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorLogic : ICurvatureCalcualtorLogic
|
||||
{
|
||||
private const LimitStates limitState = LimitStates.SLS;
|
||||
private CurvatureCalculatorResult result;
|
||||
private ICurvatureForceCalculator forceCalculator;
|
||||
private ICurvatureForceCalculator ForceCalculator => forceCalculator ??= new CurvatureForceCalculator();
|
||||
private IPoint2D gravityCenter;
|
||||
|
||||
public ICurvatureCalculatorInputData InputData { get; set; }
|
||||
|
||||
public IResult Result => result;
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public void Run()
|
||||
{
|
||||
PrepareNewResult();
|
||||
SetGravityCenter();
|
||||
try
|
||||
{
|
||||
Calculate();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsValid = false;
|
||||
result.Description += ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
private void Calculate()
|
||||
{
|
||||
foreach (var action in InputData.ForceActions)
|
||||
{
|
||||
var combinationList = action.GetCombinations();
|
||||
foreach (var combination in combinationList)
|
||||
{
|
||||
var longTuple = combination.DesignForces.Single(x => x.LimitState == limitState && x.CalcTerm == CalcTerms.LongTerm).ForceTuple;
|
||||
var shortTuple = combination.DesignForces.Single(x => x.LimitState == limitState && x.CalcTerm == CalcTerms.ShortTerm).ForceTuple;
|
||||
if (action.SetInGravityCenter == true)
|
||||
{
|
||||
IProcessorLogic<IForceTuple> forceLogic = new ForceTupleCopier(longTuple);
|
||||
forceLogic = new ForceTupleMoveToPointDecorator(forceLogic) { Point2D = gravityCenter };
|
||||
longTuple = forceLogic.GetValue();
|
||||
forceLogic = new ForceTupleCopier(shortTuple);
|
||||
forceLogic = new ForceTupleMoveToPointDecorator(forceLogic) { Point2D = gravityCenter };
|
||||
shortTuple = forceLogic.GetValue();
|
||||
}
|
||||
CurvatureForceCalculatorInputData forceInputData = new()
|
||||
{
|
||||
LongTermTuple = longTuple,
|
||||
ShortTermTuple = shortTuple,
|
||||
Primitives = InputData.Primitives,
|
||||
DeflectionFactor = InputData.DeflectionFactor
|
||||
};
|
||||
ForceCalculator.InputData = forceInputData;
|
||||
ForceCalculator.Run();
|
||||
result.ForceCalculatorResults.Add((ICurvatureForceCalculatorResult)ForceCalculator.Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetGravityCenter()
|
||||
{
|
||||
var triangulateLogic = new TriangulatePrimitiveLogic()
|
||||
{
|
||||
Primitives = InputData.Primitives,
|
||||
LimitState = LimitStates.ULS,
|
||||
CalcTerm = CalcTerms.ShortTerm,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
var ndms = triangulateLogic.GetNdms();
|
||||
var (Cx, Cy) = LoaderCalculator.Logics.Geometry.GeometryOperations.GetGravityCenter(ndms);
|
||||
gravityCenter = new Point2D() { X = Cx, Y = Cy };
|
||||
}
|
||||
|
||||
private void PrepareNewResult()
|
||||
{
|
||||
result = new CurvatureCalculatorResult()
|
||||
{
|
||||
IsValid = true,
|
||||
Description = string.Empty,
|
||||
InputData = InputData
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class CurvatureCalculatorUpdateCloningStrategy : IUpdateStrategy<ICurvatureCalculator>
|
||||
{
|
||||
private readonly ICloningStrategy cloningStrategy;
|
||||
private IUpdateStrategy<IHasForceActions> forcesUpdateStrategy;
|
||||
private IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy;
|
||||
private IUpdateStrategy<IHasForceActions> ForcesUpdateStrategy => forcesUpdateStrategy ??= new HasForceActionUpdateCloningStrategy(cloningStrategy);
|
||||
private IUpdateStrategy<IHasPrimitives> PrimitivesUpdateStrategy => primitivesUpdateStrategy ??= new HasPrimitivesUpdateCloningStrategy(cloningStrategy);
|
||||
|
||||
public CurvatureCalculatorUpdateCloningStrategy(ICloningStrategy cloningStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
}
|
||||
|
||||
public CurvatureCalculatorUpdateCloningStrategy(
|
||||
ICloningStrategy cloningStrategy,
|
||||
IUpdateStrategy<IHasForceActions> forcesUpdateStrategy,
|
||||
IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
this.forcesUpdateStrategy = forcesUpdateStrategy;
|
||||
this.primitivesUpdateStrategy = primitivesUpdateStrategy;
|
||||
}
|
||||
|
||||
public void Update(ICurvatureCalculator targetObject, ICurvatureCalculator sourceObject)
|
||||
{
|
||||
CheckObject.ThrowIfNull(cloningStrategy);
|
||||
CheckObject.ThrowIfNull(sourceObject);
|
||||
CheckObject.ThrowIfNull(targetObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
var sourceData = sourceObject.InputData;
|
||||
var targetData = targetObject.InputData;
|
||||
PrimitivesUpdateStrategy.Update(targetData, sourceData);
|
||||
ForcesUpdateStrategy.Update(targetData, sourceData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
public class DeflectionFactorUpdateStrategy : IParentUpdateStrategy<IDeflectionFactor>
|
||||
{
|
||||
public bool UpdateChildren { get; set; } = true;
|
||||
|
||||
public void Update(IDeflectionFactor targetObject, IDeflectionFactor sourceObject)
|
||||
{
|
||||
CheckObject.ThrowIfNull(sourceObject, nameof(sourceObject));
|
||||
CheckObject.ThrowIfNull(targetObject, nameof(targetObject));
|
||||
if (ReferenceEquals(targetObject, sourceObject))
|
||||
return;
|
||||
targetObject.SpanLength = sourceObject.SpanLength;
|
||||
if (UpdateChildren == true)
|
||||
{
|
||||
CheckObject.ThrowIfNull(sourceObject.DeflectionFactors);
|
||||
CheckObject.ThrowIfNull(targetObject.DeflectionFactors);
|
||||
CheckObject.ThrowIfNull(sourceObject.MaxDeflections);
|
||||
CheckObject.ThrowIfNull(targetObject.MaxDeflections);
|
||||
targetObject.DeflectionFactors = sourceObject.DeflectionFactors.Clone() as IForceTuple;
|
||||
targetObject.MaxDeflections = sourceObject.MaxDeflections.Clone() as IForceTuple;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses.Curvatures
|
||||
{
|
||||
internal interface ICurvatureCalcualtorLogic
|
||||
internal interface ICurvatureCalcualtorLogic : ILogic
|
||||
{
|
||||
ICurvatureCalculatorInputData InputData {get;set;}
|
||||
IResult Result { get; }
|
||||
@@ -61,7 +61,6 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
var newTuple = forcelogic.GetValue();
|
||||
GetForceTupleResult(forceAction, newTuple);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,12 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
public class ValueDiagramCalculatorUpdateCloningStrategy : IUpdateStrategy<IValueDiagramCalculator>
|
||||
{
|
||||
private readonly ICloningStrategy cloningStrategy;
|
||||
private readonly IUpdateStrategy<IHasForceActions> forcesUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy;
|
||||
private IUpdateStrategy<IHasForceActions> forcesUpdateStrategy;
|
||||
private IUpdateStrategy<IHasPrimitives> primitivesUpdateStrategy;
|
||||
private IUpdateStrategy<IHasForceActions> ForcesUpdateStrategy => forcesUpdateStrategy ??= new HasForceActionUpdateCloningStrategy(cloningStrategy);
|
||||
private IUpdateStrategy<IHasPrimitives> PrimitivesUpdateStrategy => primitivesUpdateStrategy ??= new HasPrimitivesUpdateCloningStrategy(cloningStrategy);
|
||||
|
||||
public ValueDiagramCalculatorUpdateCloningStrategy(ICloningStrategy cloningStrategy) : this(
|
||||
cloningStrategy,
|
||||
new HasForceActionUpdateCloningStrategy(cloningStrategy),
|
||||
new HasPrimitivesUpdateCloningStrategy(cloningStrategy))
|
||||
public ValueDiagramCalculatorUpdateCloningStrategy(ICloningStrategy cloningStrategy)
|
||||
{
|
||||
this.cloningStrategy = cloningStrategy;
|
||||
}
|
||||
@@ -37,8 +36,8 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
var sourceData = sourceObject.InputData;
|
||||
var targetData = targetObject.InputData;
|
||||
primitivesUpdateStrategy.Update(targetData, sourceData);
|
||||
forcesUpdateStrategy.Update(targetData, sourceData);
|
||||
PrimitivesUpdateStrategy.Update(targetData, sourceData);
|
||||
ForcesUpdateStrategy.Update(targetData, sourceData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams.Logics
|
||||
public class ValueDiagramCheckLogic : CheckEntityLogic<IValueDiagram>
|
||||
{
|
||||
private const double minDistance = 1e-3;
|
||||
private bool result;
|
||||
|
||||
public override bool Check()
|
||||
{
|
||||
result = true;
|
||||
bool result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
string errorString = ErrorStrings.ParameterIsNull + ": value diagram";
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ValueDiagrams
|
||||
CheckRebarHostMaterial = false,
|
||||
CheckRebarPlacement = false
|
||||
};
|
||||
primitivesCheckLogic = new CheckPrimitiveCollectionLogic(TraceLogger, checkRebarPrimitiveLogic);
|
||||
primitivesCheckLogic = new HasPrimitivesCheckLogic(TraceLogger, checkRebarPrimitiveLogic);
|
||||
actionsCheckLogic = new CheckForceActionsLogic(TraceLogger);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
this.checkPrimitiveCollectionLogic = checkPrimitiveCollectionLogic;
|
||||
}
|
||||
|
||||
public CheckCrackCalculatorInputDataLogic() : this (new CheckPrimitiveCollectionLogic())
|
||||
public CheckCrackCalculatorInputDataLogic() : this (new HasPrimitivesCheckLogic())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
forceTupleCalculator.Run();
|
||||
var result = forceTupleCalculator.Result as IForceTupleCalculatorResult;
|
||||
var loaderStrainMatrix = result.LoaderResults.ForceStrainPair.StrainMatrix;
|
||||
StrainTuple strainTuple = TupleConverter.ConvertToStrainTuple(loaderStrainMatrix);
|
||||
StrainTuple strainTuple = ForceTupleConverter.ConvertToStrainTuple(loaderStrainMatrix);
|
||||
return strainTuple;
|
||||
}
|
||||
private bool CheckInputData()
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// <inheritdoc/>
|
||||
public INdm ConcreteNdm { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IForceTuple Tuple { get; set; }
|
||||
public IForceTuple ForceTuple { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
public interface IIsSectionCracked : ILogic
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns result of checking of cracks appearence
|
||||
/// </summary>
|
||||
/// <returns>True if Checked collectition contains cracked elements</returns>
|
||||
bool IsSectionCracked();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,17 @@
|
||||
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>
|
||||
/// Logic for checking collection of ndms for appearance of crack
|
||||
/// </summary>
|
||||
public interface IIsSectionCrackedByForceLogic : ILogic
|
||||
public interface IIsSectionCrackedByForceLogic : IIsSectionCracked
|
||||
{
|
||||
/// <summary>
|
||||
/// Force tuple for checking of cracks appearence
|
||||
/// </summary>
|
||||
IForceTuple Tuple { get; set; }
|
||||
IForceTuple ForceTuple { get; set; }
|
||||
/// <summary>
|
||||
/// Collection of ndms which is checking for cracking
|
||||
/// </summary>
|
||||
@@ -26,10 +20,5 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
/// Full ndms collection of cross-section
|
||||
/// </summary>
|
||||
IEnumerable<INdm> SectionNdmCollection { get; set; }
|
||||
/// <summary>
|
||||
/// Returns result of checking of cracks appearence
|
||||
/// </summary>
|
||||
/// <returns>True if Checked collectition contains cracked elements</returns>
|
||||
bool IsSectionCracked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
IsSectionCrackedByForceLogic.TraceLogger ??= TraceLogger?.GetSimilarTraceLogger(50);
|
||||
var actualTuple = ForceTupleService.InterpolateTuples(StartTuple, EndTuple, factor);
|
||||
IsSectionCrackedByForceLogic.Tuple = actualTuple;
|
||||
IsSectionCrackedByForceLogic.ForceTuple = actualTuple;
|
||||
return IsSectionCrackedByForceLogic.IsSectionCracked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,33 +14,22 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
static readonly IStressLogic stressLogic = new StressLogic();
|
||||
/// <inheritdoc/>
|
||||
public IForceTuple Tuple { get; set; }
|
||||
public IForceTuple ForceTuple { get; set; }
|
||||
public IEnumerable<INdm> CheckedNdmCollection { get; set; }
|
||||
public IEnumerable<INdm> SectionNdmCollection { get; set; }
|
||||
public Accuracy Accuracy { get; set; }
|
||||
public Accuracy Accuracy { get; set; } = new Accuracy() { IterationAccuracy = 0.001d, MaxIterationCount = 10000};
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public IsSectionCrackedByForceLogic()
|
||||
{
|
||||
if (Accuracy is null)
|
||||
{
|
||||
Accuracy = new Accuracy()
|
||||
{
|
||||
IterationAccuracy = 0.001d,
|
||||
MaxIterationCount = 10000
|
||||
};
|
||||
}
|
||||
}
|
||||
public bool IsSectionCracked()
|
||||
{
|
||||
TraceLogger?.AddMessage($"Calculator type: {GetType()}", TraceLogStatuses.Service);
|
||||
TraceLogger?.AddMessage($"It is assumed, that cracks appearence if: cross-section has elementary parts of concrete and strain of concrete greater than limit value");
|
||||
TraceLogger?.AddMessage($"Force combination for cracking check");
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(Tuple));
|
||||
TraceLogger?.AddEntry(new TraceTablesFactory().GetByForceTuple(ForceTuple));
|
||||
var inputData = new ForceTupleInputData()
|
||||
{
|
||||
Accuracy = Accuracy,
|
||||
ForceTuple = Tuple,
|
||||
ForceTuple = ForceTuple,
|
||||
NdmCollection = SectionNdmCollection
|
||||
};
|
||||
var calculator = new ForceTupleCalculator() { InputData = inputData };
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
var strainTuple = GetStrainTuple();
|
||||
result.StrainTuple = strainTuple;
|
||||
var strainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||
var strainMatrix = ForceTupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||
result.RebarStrain = stressLogic.GetSectionStrain(strainMatrix, rebarNdm);
|
||||
result.RebarStress = stressLogic.GetStress(strainMatrix, rebarNdm);
|
||||
result.ConcreteStrain = -concreteNdm.PrestrainLogic.GetAll().Sum(x => x.PrestrainValue);
|
||||
@@ -94,7 +94,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
//TraceLogger?.AddMessage(LoggerStrings.CalculationError + $": {forceResult.Description}", TraceLogStatuses.Error);
|
||||
throw new StructureHelperException(ErrorStrings.CalculationError);
|
||||
}
|
||||
var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||
var strain = ForceTupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||
return strain;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
TraceLogger?.AddMessage("Bearing capacity of cross-section is not enough for action", TraceLogStatuses.Error);
|
||||
return null;
|
||||
}
|
||||
var strain = TupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||
var strain = ForceTupleConverter.ConvertToStrainTuple(forceResult.LoaderResults.StrainMatrix);
|
||||
return strain;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace StructureHelperLogics.NdmCalculations.Cracking
|
||||
{
|
||||
lengthLogic.NdmCollection = elasticNdms;
|
||||
lengthLogic.TraceLogger = TraceLogger;
|
||||
lengthLogic.StrainMatrix = TupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||
lengthLogic.StrainMatrix = ForceTupleConverter.ConvertToLoaderStrainMatrix(strainTuple);
|
||||
return lengthLogic.GetLength();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Calculators;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class CheckRebarPrimitiveLogic : ICheckEntityLogic<IRebarNdmPrimitive>
|
||||
{
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class CheckPrimitiveCollectionLogic : ICheckEntityLogic<IHasPrimitives>
|
||||
public class HasPrimitivesCheckLogic : ICheckEntityLogic<IHasPrimitives>
|
||||
{
|
||||
private const string collectionDoesntHaveAnyPrimitives = "Calculator does not contain any primitives\n";
|
||||
private const string checkRebarLogic = ": check rebar logic";
|
||||
@@ -19,7 +20,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
|
||||
public IShiftTraceLogger? TraceLogger { get; set; }
|
||||
|
||||
public CheckPrimitiveCollectionLogic(
|
||||
public HasPrimitivesCheckLogic(
|
||||
IShiftTraceLogger shiftTraceLogger,
|
||||
ICheckEntityLogic<IRebarNdmPrimitive> checkRebarPrimitiveLogic)
|
||||
{
|
||||
@@ -27,7 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
this.checkRebarPrimitiveLogic = checkRebarPrimitiveLogic;
|
||||
}
|
||||
|
||||
public CheckPrimitiveCollectionLogic() : this (new ShiftTraceLogger(), new CheckRebarPrimitiveLogic())
|
||||
public HasPrimitivesCheckLogic() : this (new ShiftTraceLogger(), new CheckRebarPrimitiveLogic())
|
||||
{
|
||||
|
||||
}
|
||||
@@ -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, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
NdmTransform.SetPrestrain(ndmCollection, ForceTupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
return ndmCollection;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
Material = options.HeadMaterial.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm)
|
||||
};
|
||||
;
|
||||
NdmTransform.SetPrestrain(rebarNdm, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
NdmTransform.SetPrestrain(rebarNdm, ForceTupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||
return rebarNdm;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
//StressScale = -1d
|
||||
StressScale = 1d//-1d
|
||||
};
|
||||
NdmTransform.SetPrestrain(concreteNdm, TupleConverter.ConvertToLoaderStrainMatrix(prestrain));
|
||||
NdmTransform.SetPrestrain(concreteNdm, ForceTupleConverter.ConvertToLoaderStrainMatrix(prestrain));
|
||||
return concreteNdm;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorT
|
||||
var ndmPrimitives = newSection.SectionRepository.Primitives;
|
||||
var result = calculator.Result as IForceCalculatorResult;
|
||||
var strainMatrix = result.ForcesResultList[0].ForcesTupleResult.LoaderResults.StrainMatrix;
|
||||
var source = TupleConverter.ConvertToStrainTuple(strainMatrix);
|
||||
var source = ForceTupleConverter.ConvertToStrainTuple(strainMatrix);
|
||||
//Act
|
||||
foreach (var item in ndmPrimitives)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
||||
private Mock<IShiftTraceLogger> _mockTraceLogger;
|
||||
private Mock<ICheckEntityLogic<IRebarNdmPrimitive>> _mockCheckRebarPrimitiveLogic;
|
||||
private Mock<IHasPrimitives> _mockHasPrimitives;
|
||||
private Mock<CheckPrimitiveCollectionLogic> _mockCheckPrimitiveCollectionLogic;
|
||||
private Mock<HasPrimitivesCheckLogic> _mockCheckPrimitiveCollectionLogic;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
@@ -26,7 +26,7 @@ namespace StructureHelperTests.UnitTests.Ndms
|
||||
_mockCheckRebarPrimitiveLogic = new Mock<ICheckEntityLogic<IRebarNdmPrimitive>>();
|
||||
_mockHasPrimitives = new Mock<IHasPrimitives>();
|
||||
|
||||
_mockCheckPrimitiveCollectionLogic = new Mock<CheckPrimitiveCollectionLogic>(_mockTraceLogger.Object, _mockCheckRebarPrimitiveLogic.Object)
|
||||
_mockCheckPrimitiveCollectionLogic = new Mock<HasPrimitivesCheckLogic>(_mockTraceLogger.Object, _mockCheckRebarPrimitiveLogic.Object)
|
||||
{
|
||||
CallBase = true
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user