Add ForceCombinationPropertyUserControl

This commit is contained in:
Evgeny Redikultsev
2025-01-08 21:15:07 +05:00
parent 65253a907b
commit 932f87f566
51 changed files with 1674 additions and 360 deletions

View File

@@ -91,7 +91,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
return new FileVersion()
{
VersionNumber = 1,
SubVersionNumber = 0
SubVersionNumber = 1
};
}
}

View File

@@ -6,18 +6,18 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceColumnProperty : IForceColumnProperty
public class ColumnProperty : IColumnProperty
{
public Guid Id { get; private set; }
public string ColumnName { get; set; } = string.Empty;
public int ColumnIndex { get; set; } = 0;
public double ColumnFactor { get; set; } = 1d;
public ForceColumnProperty(Guid id, string columnName)
public ColumnProperty(Guid id, string columnName)
{
Id = id;
ColumnName = columnName;
}
public ForceColumnProperty(string columnName) : this(Guid.NewGuid(), columnName)
public ColumnProperty(string columnName) : this(Guid.NewGuid(), columnName)
{
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class FactoredCombinationProperty : IFactoredCombinationProperty
{
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
public LimitStates LimitState { get; set; } = LimitStates.SLS;
public double LongTermFactor { get; set; } = 1d;
public double ULSFactor { get; set; } = 1.2d;
}
}

View File

@@ -0,0 +1,18 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <inheritdoc/>
public class ForceActionProperty : IForceActionProperty
{
/// <inheritdoc/>
public bool SetInGravityCenter { get; set; }
/// <inheritdoc/>
public IPoint2D ForcePoint { get; set; }
}
}

View File

@@ -1,112 +0,0 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <inheritdoc/>
public class ForceCombinationByFactor : IForceCombinationByFactor
{
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
private ForceCombinationList result;
private List<LimitStates> limitStates;
private List<CalcTerms> calcTerms;
/// <inheritdoc/>
public Guid Id { get; }
/// <inheritdoc/>
public string Name { get; set; } = "New Factored Load";
/// <inheritdoc/>
public LimitStates LimitState { get; set; } = LimitStates.SLS; //By default create characteristic value of forces
/// <inheritdoc/>
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; //By defult use full value of load
public bool SetInGravityCenter { get; set; } = true;
/// <inheritdoc/>
public IPoint2D ForcePoint { get; set; } = new Point2D();
/// <inheritdoc/>
public IForceTuple FullSLSForces { get; set; } = new ForceTuple();
/// <inheritdoc/>
public double ULSFactor { get; set; } = 1.2d;
/// <inheritdoc/>
public double LongTermFactor { get; set; } = 1d;
public ForceCombinationByFactor(Guid id)
{
Id = id;
}
public ForceCombinationByFactor() : this (Guid.NewGuid()) { }
public IForceCombinationList GetCombination()
{
GetNewResult();
ProcessResult();
return result;
}
private void ProcessResult()
{
foreach (var limitState in limitStates)
{
ProcessLimitState(limitState);
}
}
private void ProcessLimitState(LimitStates limitState)
{
var stateFactor = limitState is LimitStates.SLS ? 1d : ULSFactor;
foreach (var calcTerm in calcTerms)
{
ProcessCalcTerm(limitState, stateFactor, calcTerm);
}
}
private void ProcessCalcTerm(LimitStates limitState, double stateFactor, CalcTerms calcTerm)
{
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
var designForceTuple = new DesignForceTuple()
{
LimitState = limitState,
CalcTerm = calcTerm
};
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor) as ForceTuple;
result.DesignForces.Add(designForceTuple);
}
private void GetNewResult()
{
result = new ForceCombinationList();
result.SetInGravityCenter = SetInGravityCenter;
result.ForcePoint = ForcePoint;
result.DesignForces.Clear();
limitStates = new List<LimitStates>()
{
LimitStates.ULS, LimitStates.SLS
};
calcTerms = new List<CalcTerms>()
{
CalcTerms.ShortTerm, CalcTerms.LongTerm
};
}
public object Clone()
{
var newItem = new ForceCombinationByFactor();
updateStrategy.Update(newItem, this);
return newItem;
}
public List<IForceCombinationList> GetCombinations()
{
var listResult = new List<IForceCombinationList>
{
GetCombination()
};
return listResult;
}
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,26 +10,24 @@ namespace StructureHelperCommon.Models.Forces
{
internal class ForceCombinationFromFile : IForceCombinationFromFile
{
private IForceFactoredCombination factoredCombination;
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public List<IForceFileProperty> ForceFiles { get; set; } = new();
public bool SetInGravityCenter { get; set; } = true;
public IPoint2D ForcePoint { get; set; } = new Point2D();
public IFactoredCombinationProperty CombinationProperty { get; } = new FactoredCombinationProperty();
public object Clone()
{
throw new NotImplementedException();
}
public IForceCombinationList GetCombination()
{
throw new NotImplementedException();
}
public List<IForceCombinationList> GetCombinations()
{
throw new NotImplementedException();
factoredCombination = new ForceFactoredList();
return factoredCombination.GetCombinations();
}
}
}

View File

@@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
namespace StructureHelperCommon.Models.Forces
{
@@ -18,9 +17,9 @@ namespace StructureHelperCommon.Models.Forces
/// <inheritdoc/>
public string Name { get; set; }
/// <inheritdoc/>
public bool SetInGravityCenter { get; set; }
public bool SetInGravityCenter { get; set; } = true;
/// <inheritdoc/>
public IPoint2D ForcePoint { get; set; }
public IPoint2D ForcePoint { get; set; } = new Point2D();
/// <inheritdoc/>
public List<IDesignForceTuple> DesignForces { get; set; }
@@ -28,8 +27,6 @@ namespace StructureHelperCommon.Models.Forces
public ForceCombinationList(Guid id)
{
Id = id;
SetInGravityCenter = true;
ForcePoint = new Point2D() { X = 0, Y = 0 };
DesignForces = new List<IDesignForceTuple>
{
new DesignForceTuple()

View File

@@ -0,0 +1,60 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces.Logics;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
namespace StructureHelperCommon.Models.Forces
{
/// <inheritdoc/>
public class ForceFactoredList : IForceFactoredList
{
readonly IUpdateStrategy<IForceFactoredList> updateStrategy = new ForceFactoredListUpdateStrategy();
private List<IForceCombinationList> result;
private IGetCombinationByFactoredTupleLogic getCombinationLogic = new GetCombinationByFactoredTupleLogic();
/// <inheritdoc/>
public Guid Id { get; }
/// <inheritdoc/>
public string Name { get; set; } = "New Factored Load";
public bool SetInGravityCenter { get; set; } = true;
/// <inheritdoc/>
public IPoint2D ForcePoint { get; set; } = new Point2D();
/// <inheritdoc/>
public List<IForceTuple> ForceTuples { get; } = new() { new ForceTuple()};
/// <inheritdoc/>
public IFactoredCombinationProperty CombinationProperty { get; } = new FactoredCombinationProperty();
public ForceFactoredList(Guid id)
{
Id = id;
}
public ForceFactoredList() : this (Guid.NewGuid()) { }
public object Clone()
{
var newItem = new ForceFactoredList();
updateStrategy.Update(newItem, this);
return newItem;
}
/// <inheritdoc/>
public List<IForceCombinationList> GetCombinations()
{
getCombinationLogic.CombinationProperty = CombinationProperty;
getCombinationLogic.ForceActionProperty = new ForceActionProperty()
{
SetInGravityCenter = SetInGravityCenter,
ForcePoint = ForcePoint
};
result = new();
ForceTuples.ForEach(x => GetCombinationByForceTuple(x));
return result;
}
private void GetCombinationByForceTuple(IForceTuple forceTuple)
{
getCombinationLogic.SourceForceTuple = forceTuple;
result.Add(getCombinationLogic.GetCombinationList());
}
}
}

View File

@@ -16,9 +16,9 @@ namespace StructureHelperCommon.Models.Forces
public int SkipRowBeforeHeaderCount { get; set; } = 2;
public int SkipRowHeaderCount { get; set; } = 1;
public double GlobalFactor { get; set; } = 1d;
public IForceColumnProperty Mx { get; set; } = new ForceColumnProperty("N");
public IForceColumnProperty My { get; set; } = new ForceColumnProperty("My");
public IForceColumnProperty Nz { get; set; } = new ForceColumnProperty("Mz");
public IColumnProperty Mx { get; set; } = new ColumnProperty("N");
public IColumnProperty My { get; set; } = new ColumnProperty("My");
public IColumnProperty Nz { get; set; } = new ColumnProperty("Mz");
public ForceFileProperty(Guid id)
{

View File

@@ -10,7 +10,7 @@ namespace StructureHelperCommon.Models.Forces
/// <summary>
/// Settingth for column reading from MSExcel file
/// </summary>
public interface IForceColumnProperty : ISaveable
public interface IColumnProperty : ISaveable
{
/// <summary>
/// Name of column for searching

View File

@@ -0,0 +1,32 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Properties of factored combination of forces
/// </summary>
public interface IFactoredCombinationProperty
{
/// <summary>
/// Term of calculation for assigned combination
/// </summary>
CalcTerms CalcTerm { get; set; }
/// <summary>
/// Limit state for assigned combination
/// </summary>
LimitStates LimitState { get; set; }
/// <summary>
/// Factor of converting of short term load to long term load
/// </summary>
double LongTermFactor { get; set; }
/// <summary>
/// Factor of converting serviceability state load to ultimate limit state load
/// </summary>
double ULSFactor { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Action as force load
/// Supports common properties of action
/// </summary>
public interface IForceAction : IAction
{
@@ -21,11 +21,9 @@ namespace StructureHelperCommon.Models.Forces
/// </summary>
IPoint2D ForcePoint { get; set; }
/// <summary>
/// Return combination of forces
/// Return combinations of forces
/// </summary>
/// <returns></returns>
IForceCombinationList GetCombination();
/// <returns>List of combination of forces</returns>
List<IForceCombinationList> GetCombinations();
}
}

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Properties of force action
/// </summary>
public interface IForceActionProperty
{
/// <summary>
/// True means force action is put in center of gravity
/// </summary>
bool SetInGravityCenter { get; set; }
/// <summary>
/// Point of applying of force load
/// </summary>
IPoint2D ForcePoint { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public interface IForceCombinationByFactor : IForceAction
{
LimitStates LimitState { get; set; }
CalcTerms CalcTerm { get; set; }
IForceTuple FullSLSForces { get; set; }
double ULSFactor { get; set; }
double LongTermFactor { get; set; }
}
}

View File

@@ -6,8 +6,14 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
internal interface IForceCombinationFromFile : IForceAction
/// <summary>
/// Supports list of files which provides import of combination of forces
/// </summary>
internal interface IForceCombinationFromFile : IForceFactoredCombination
{
/// <summary>
/// List of file properties for import combination
/// </summary>
List<IForceFileProperty> ForceFiles { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using StructureHelperCommon.Infrastructures.Enums;
namespace StructureHelperCommon.Models.Forces
{
/// <summary>
/// Supports common properties of factored combination of forces
/// </summary>
public interface IForceFactoredCombination : IForceAction
{
/// <summary>
/// Properties of factored combination of forces
/// </summary>
IFactoredCombinationProperty CombinationProperty { get; }
}
}

View File

@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace StructureHelperCommon.Models.Forces
{
public interface IForceFactoredList : IForceFactoredCombination
{
List<IForceTuple> ForceTuples { get;}
}
}

View File

@@ -19,9 +19,9 @@ namespace StructureHelperCommon.Models.Forces
int SkipRowBeforeHeaderCount { get; set; }
int SkipRowHeaderCount { get; set; }
double GlobalFactor { get; set; }
IForceColumnProperty Mx { get; set; }
IForceColumnProperty My { get; set; }
IForceColumnProperty Nz { get; set; }
IColumnProperty Mx { get; set; }
IColumnProperty My { get; set; }
IColumnProperty Nz { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces.Logics
{
public class FactoredCombinationPropertyUpdateStrategy : IUpdateStrategy<IFactoredCombinationProperty>
{
public void Update(IFactoredCombinationProperty targetObject, IFactoredCombinationProperty sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.ULSFactor = sourceObject.ULSFactor;
targetObject.LongTermFactor = sourceObject.LongTermFactor;
targetObject.CalcTerm = sourceObject.CalcTerm;
targetObject.LimitState = sourceObject.LimitState;
}
}
}

View File

@@ -16,13 +16,13 @@ namespace StructureHelperCommon.Models.Forces
{
private readonly IUpdateStrategy<IForceAction> forceActionUpdateStrategy;
private readonly IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy;
private readonly IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy;
private readonly IUpdateStrategy<IForceFactoredList> factorUpdateStrategy;
private readonly IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy;
public ForceActionUpdateStrategy(
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
IUpdateStrategy<IDesignForcePair> forcePairUpdateStrategy,
IUpdateStrategy<IForceCombinationByFactor> factorUpdateStrategy,
IUpdateStrategy<IForceFactoredList> factorUpdateStrategy,
IUpdateStrategy<IForceCombinationList> forceListUpdateStrategy)
{
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
@@ -34,7 +34,7 @@ namespace StructureHelperCommon.Models.Forces
public ForceActionUpdateStrategy() : this(
new ForceActionBaseUpdateStrategy(),
new ForcePairUpdateStrategy(),
new ForceCombinationByFactorUpdateStrategy(),
new ForceFactoredListUpdateStrategy(),
new ForceCombinationListUpdateStrategy()
)
{
@@ -56,9 +56,9 @@ namespace StructureHelperCommon.Models.Forces
{
forcePairUpdateStrategy.Update(pair, (IDesignForcePair)sourceObject);
}
else if (targetObject is IForceCombinationByFactor combination)
else if (targetObject is IForceFactoredList combination)
{
factorUpdateStrategy.Update(combination, (IForceCombinationByFactor)sourceObject);
factorUpdateStrategy.Update(combination, (IForceFactoredList)sourceObject);
}
else if (targetObject is IForceCombinationList forceCombinationList)
{

View File

@@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy<IForceColumnProperty>
public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy<IColumnProperty>
{
public void Update(IForceColumnProperty targetObject, IForceColumnProperty sourceObject)
public void Update(IColumnProperty targetObject, IColumnProperty sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);

View File

@@ -1,32 +0,0 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceCombinationByFactorUpdateStrategy : IUpdateStrategy<IForceCombinationByFactor>
{
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
public ForceCombinationByFactorUpdateStrategy(IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
{
this.tupleUpdateStrategy = tupleUpdateStrategy;
}
public ForceCombinationByFactorUpdateStrategy() : this(new ForceTupleUpdateStrategy())
{
}
public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces);
targetObject.ULSFactor = sourceObject.ULSFactor;
targetObject.LongTermFactor = sourceObject.LongTermFactor;
}
}
}

View File

@@ -0,0 +1,55 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces.Logics;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ForceFactoredListUpdateStrategy : IUpdateStrategy<IForceFactoredList>
{
private IUpdateStrategy<IForceAction> forceActionUpdateStrategy;
private IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
private IUpdateStrategy<IFactoredCombinationProperty> propertyUpdateStrategy;
public ForceFactoredListUpdateStrategy
(
IUpdateStrategy<IForceAction> forceActionUpdateStrategy,
IUpdateStrategy<IForceTuple> tupleUpdateStrategy,
IUpdateStrategy<IFactoredCombinationProperty> propertyUpdateStrategy)
{
this.forceActionUpdateStrategy = forceActionUpdateStrategy;
this.tupleUpdateStrategy = tupleUpdateStrategy;
this.propertyUpdateStrategy = propertyUpdateStrategy;
}
public ForceFactoredListUpdateStrategy() : this
(
new ForceActionBaseUpdateStrategy(),
new ForceTupleUpdateStrategy(),
new FactoredCombinationPropertyUpdateStrategy())
{
}
public void Update(IForceFactoredList targetObject, IForceFactoredList sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; }
forceActionUpdateStrategy.Update(targetObject, sourceObject);
CheckObject.IsNull(sourceObject.CombinationProperty);
CheckObject.IsNull(targetObject.CombinationProperty);
propertyUpdateStrategy.Update(targetObject.CombinationProperty, sourceObject.CombinationProperty);
CheckObject.IsNull(sourceObject.ForceTuples);
CheckObject.IsNull(targetObject.ForceTuples);
targetObject.ForceTuples.Clear();
foreach (var item in sourceObject.ForceTuples)
{
ForceTuple newTuple = new();
tupleUpdateStrategy.Update(newTuple, item);
targetObject.ForceTuples.Add(newTuple);
}
}
}
}

View File

@@ -10,9 +10,9 @@ namespace StructureHelperCommon.Models.Forces
{
public class ForceFilePropertyUpdateStrategy : IUpdateStrategy<IForceFileProperty>
{
private IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy;
private IUpdateStrategy<IColumnProperty> columnUpdateStrategy;
public ForceFilePropertyUpdateStrategy(IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy)
public ForceFilePropertyUpdateStrategy(IUpdateStrategy<IColumnProperty> columnUpdateStrategy)
{
this.columnUpdateStrategy = columnUpdateStrategy;
}

View File

@@ -0,0 +1,105 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Calculators;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces.Logics
{
public class GetCombinationByFactoredTupleLogic : IGetCombinationByFactoredTupleLogic
{
private ForceCombinationList? result;
private IForceTuple? fullSLSTuple;
private List<LimitStates> limitStates = new() { LimitStates.ULS, LimitStates.SLS };
private List<CalcTerms> calcTerms = new() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
public IForceTuple? SourceForceTuple { get; set; }
public IFactoredCombinationProperty? CombinationProperty { get; set; }
public IForceActionProperty? ForceActionProperty { get; set; }
public IForceCombinationList GetCombinationList()
{
Check();
GetFullSLSTuple();
GetNewResult();
ProcessResult();
return result;
}
private void GetFullSLSTuple()
{
double factor = 1d;
if (CombinationProperty.CalcTerm == CalcTerms.LongTerm)
{
factor /= CombinationProperty.LongTermFactor;
}
if (CombinationProperty.LimitState == LimitStates.ULS)
{
factor /= CombinationProperty.ULSFactor;
}
fullSLSTuple = ForceTupleService.MultiplyTupleByFactor(SourceForceTuple, factor);
}
private void Check()
{
if (SourceForceTuple is null)
{
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(SourceForceTuple)}");
}
if (CombinationProperty is null)
{
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(CombinationProperty)}");
}
if (ForceActionProperty is null)
{
throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(ForceActionProperty)}");
}
}
private void ProcessResult()
{
foreach (var limitState in limitStates)
{
ProcessLimitState(limitState);
}
}
private void ProcessLimitState(LimitStates limitState)
{
var factor = limitState is LimitStates.SLS ? 1d : CombinationProperty.ULSFactor;
foreach (var calcTerm in calcTerms)
{
ProcessCalcTerm(limitState, factor, calcTerm);
}
}
private void ProcessCalcTerm(LimitStates limitState, double stateFactor, CalcTerms calcTerm)
{
var factor = calcTerm is CalcTerms.ShortTerm ? 1d : CombinationProperty.LongTermFactor;
IForceTuple forceTuple = ForceTupleService.MultiplyTupleByFactor(fullSLSTuple, stateFactor * factor);
var designForceTuple = new DesignForceTuple
{
LimitState = limitState,
CalcTerm = calcTerm,
ForceTuple = forceTuple
};
result.DesignForces.Add(designForceTuple);
}
private void GetNewResult()
{
result = new()
{
SetInGravityCenter = ForceActionProperty.SetInGravityCenter,
ForcePoint = ForceActionProperty.ForcePoint
};
result.DesignForces.Clear();
}
}
}

View File

@@ -0,0 +1,22 @@
namespace StructureHelperCommon.Models.Forces.Logics
{
/// <summary>
/// Return combinations for source combination and properties
/// </summary>
public interface IGetCombinationByFactoredTupleLogic
{
/// <summary>
/// Source combination of forces
/// </summary>
IForceTuple? SourceForceTuple { get; set; }
/// <inheritdoc/>
IFactoredCombinationProperty? CombinationProperty { get; set; }
/// <inheritdoc/>
IForceActionProperty? ForceActionProperty { get; set; }
/// <summary>
/// Returns combination list
/// </summary>
/// <returns></returns>
IForceCombinationList GetCombinationList();
}
}

View File

@@ -40,7 +40,7 @@ namespace StructureHelperCommon.Services.Forces
}
return resultList;
}
public static List<IDesignForcePair> ConvertCombinationToPairs(IForceCombinationByFactor combinations)
public static List<IDesignForcePair> ConvertCombinationToPairs(IForceFactoredList combinations)
{
var resultList = new List<IDesignForcePair>();
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
@@ -50,9 +50,9 @@ namespace StructureHelperCommon.Services.Forces
var tuples = new IForceTuple[2];
for (int i = 0; i < calcTerms.Count; i++)
{
var stateFactor = limitState is LimitStates.SLS ? 1d : combinations.ULSFactor;
var termFactor = calcTerms[i] == CalcTerms.ShortTerm ? 1d : combinations.LongTermFactor;
var forceTupleList = ForceTupleService.MultiplyTuples(combinations.FullSLSForces, stateFactor * termFactor);
var stateFactor = limitState is LimitStates.SLS ? 1d : combinations.CombinationProperty.ULSFactor;
var termFactor = calcTerms[i] == CalcTerms.ShortTerm ? 1d : combinations.CombinationProperty.LongTermFactor;
var forceTupleList = ForceTupleService.MultiplyTupleByFactor(combinations.ForceTuples[0], stateFactor * termFactor);
tuples[i] = forceTupleList;
}
var pair = new DesignForcePair()
@@ -77,9 +77,9 @@ namespace StructureHelperCommon.Services.Forces
var item = forceAction as IForceCombinationList;
resultList.AddRange(ConvertCombinationToPairs(item));
}
else if (forceAction is IForceCombinationByFactor)
else if (forceAction is IForceFactoredList)
{
var item = forceAction as IForceCombinationByFactor;
var item = forceAction as IForceFactoredList;
resultList.AddRange(ConvertCombinationToPairs(item));
}
else

View File

@@ -38,10 +38,16 @@ namespace StructureHelperCommon.Services.Forces
};
return result;
}
public static IForceTuple MultiplyTuples(IForceTuple first, double factor)
/// <summary>
/// Multyplies force tuple by factor
/// </summary>
/// <param name="forceTuple">Source force tuple</param>
/// <param name="factor">Factor which tuple multyplies by</param>
/// <returns></returns>
public static IForceTuple MultiplyTupleByFactor(IForceTuple forceTuple, double factor)
{
var result = GetNewTupleSameType(first);
CopyProperties(first, result, factor);
var result = GetNewTupleSameType(forceTuple);
CopyProperties(forceTuple, result, factor);
return result;
}
public static IForceTuple InterpolateTuples(IForceTuple endTuple, IForceTuple startTuple = null, double coefficient = 0.5d)