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

@@ -8,11 +8,11 @@ namespace DataAccess.DTOs.Converters
{
public class ForceActionToDTOConvertStrategy : ConvertStrategy<IForceAction, IForceAction>
{
private IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy;
private IConvertStrategy<ForceCombinationByFactorDTO, IForceFactoredList> forceCombinationByFactorConvertStrategy;
private IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy;
public ForceActionToDTOConvertStrategy(
IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy,
IConvertStrategy<ForceCombinationByFactorDTO, IForceFactoredList> forceCombinationByFactorConvertStrategy,
IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy)
{
this.forceCombinationByFactorConvertStrategy = forceCombinationByFactorConvertStrategy;
@@ -28,7 +28,7 @@ namespace DataAccess.DTOs.Converters
public override IForceAction GetNewItem(IForceAction source)
{
if (source is IForceCombinationByFactor forceCombinationByFactor)
if (source is IForceFactoredList forceCombinationByFactor)
{
return GetForceCombinationByFactor(forceCombinationByFactor);
}
@@ -54,11 +54,11 @@ namespace DataAccess.DTOs.Converters
return forceCombination;
}
private ForceCombinationByFactorDTO GetForceCombinationByFactor(IForceCombinationByFactor forceCombinationByFactor)
private ForceCombinationByFactorDTO GetForceCombinationByFactor(IForceFactoredList forceCombinationByFactor)
{
forceCombinationByFactorConvertStrategy.ReferenceDictionary = ReferenceDictionary;
forceCombinationByFactorConvertStrategy.TraceLogger = TraceLogger;
var convertLogic = new DictionaryConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor>(this, forceCombinationByFactorConvertStrategy);
var convertLogic = new DictionaryConvertStrategy<ForceCombinationByFactorDTO, IForceFactoredList>(this, forceCombinationByFactorConvertStrategy);
var forceCombination = convertLogic.Convert(forceCombinationByFactor);
return forceCombination;
}

View File

@@ -13,18 +13,22 @@ namespace DataAccess.DTOs
public class ForceActionsFromDTOConvertStrategy : ConvertStrategy<IForceAction, IForceAction>
{
private IConvertStrategy<ForceCombinationList, ForceCombinationListDTO> listConvertStrategy;
private IConvertStrategy<ForceCombinationByFactor, ForceCombinationByFactorDTO> factorConvertStrategy;
private IConvertStrategy<ForceFactoredList, ForceCombinationByFactorV1_0DTO> factorConvertStrategy_v1_0;
private IConvertStrategy<ForceFactoredList, ForceCombinationByFactorDTO> factorConvertStrategy;
public ForceActionsFromDTOConvertStrategy(
IConvertStrategy<ForceCombinationList, ForceCombinationListDTO> listConvertStrategy,
IConvertStrategy<ForceCombinationByFactor, ForceCombinationByFactorDTO> factorConvertStrategy)
IConvertStrategy<ForceFactoredList, ForceCombinationByFactorV1_0DTO> factorConvertStrategy_v1_0,
IConvertStrategy<ForceFactoredList, ForceCombinationByFactorDTO> factorConvertStrategy)
{
this.listConvertStrategy = listConvertStrategy;
this.factorConvertStrategy_v1_0 = factorConvertStrategy_v1_0;
this.factorConvertStrategy = factorConvertStrategy;
}
public ForceActionsFromDTOConvertStrategy() : this (
new ForceCombinationListFromDTOConvertStrategy(),
new ForceCombinationByFactorV1_0FromDTOConvertStrategy(),
new ForceCombinationByFactorFromDTOConvertStrategy())
{
@@ -32,6 +36,10 @@ namespace DataAccess.DTOs
public override IForceAction GetNewItem(IForceAction source)
{
if (source is ForceCombinationByFactorV1_0DTO combination_v1_0)
{
return Obsolete_GetForceCombination_V1_0(combination_v1_0);
}
if (source is ForceCombinationByFactorDTO combination)
{
return GetForceCombination(combination);
@@ -45,15 +53,25 @@ namespace DataAccess.DTOs
throw new StructureHelperException(errorString);
}
private ForceFactoredList Obsolete_GetForceCombination_V1_0(ForceCombinationByFactorV1_0DTO source)
{
TraceLogger?.AddMessage("Force action is combination by factors version 1.0 (obsolete)", TraceLogStatuses.Warning);
factorConvertStrategy_v1_0.ReferenceDictionary = ReferenceDictionary;
factorConvertStrategy_v1_0.TraceLogger = TraceLogger;
ForceFactoredList newItem = factorConvertStrategy_v1_0.Convert(source);
return newItem;
}
private IForceAction GetForceCombination(ForceCombinationByFactorDTO source)
{
TraceLogger?.AddMessage("Force action is combination by factors");
factorConvertStrategy.ReferenceDictionary = ReferenceDictionary;
factorConvertStrategy.TraceLogger = TraceLogger;
ForceCombinationByFactor newItem = factorConvertStrategy.Convert(source);
ForceFactoredList newItem = factorConvertStrategy.Convert(source);
return newItem;
}
private IForceAction GetForceList(ForceCombinationListDTO forceList)
{
TraceLogger?.AddMessage("Force action is combination by list");

View File

@@ -1,25 +1,22 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Forces.Logics;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureHelperCommon.Services;
namespace DataAccess.DTOs
{
public class ForceCombinationByFactorFromDTOConvertStrategy : ConvertStrategy<ForceCombinationByFactor, ForceCombinationByFactorDTO>
public class ForceCombinationByFactorFromDTOConvertStrategy : ConvertStrategy<ForceFactoredList, ForceCombinationByFactorDTO>
{
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
private IUpdateStrategy<IForceCombinationByFactor> updateStrategy;
private IUpdateStrategy<IForceFactoredList> updateStrategy;
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
private IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy;
public ForceCombinationByFactorFromDTOConvertStrategy(
IUpdateStrategy<IForceAction> baseUpdateStrategy,
IUpdateStrategy<IForceCombinationByFactor> updateStrategy,
IUpdateStrategy<IForceFactoredList> updateStrategy,
IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy,
IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy)
{
@@ -31,17 +28,17 @@ namespace DataAccess.DTOs
public ForceCombinationByFactorFromDTOConvertStrategy() : this(
new ForceActionBaseUpdateStrategy(),
new ForceCombinationByFactorUpdateStrategy(),
new ForceFactoredListUpdateStrategy(),
new Point2DFromDTOConvertStrategy(),
new ForceTupleFromDTOConvertStrategy())
{
}
public override ForceCombinationByFactor GetNewItem(ForceCombinationByFactorDTO source)
public override ForceFactoredList GetNewItem(ForceCombinationByFactorDTO source)
{
TraceLogger.AddMessage($"Force combination by factor name = {source.Name} is starting");
ForceCombinationByFactor newItem = new(source.Id);
ForceFactoredList newItem = new(source.Id);
baseUpdateStrategy.Update(newItem, source);
updateStrategy.Update(newItem, source);
pointConvertStrategy.ReferenceDictionary = ReferenceDictionary;
@@ -49,7 +46,13 @@ namespace DataAccess.DTOs
newItem.ForcePoint = pointConvertStrategy.Convert((Point2DDTO)source.ForcePoint);
forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
forceTupleConvertStrategy.TraceLogger = TraceLogger;
newItem.FullSLSForces = forceTupleConvertStrategy.Convert((ForceTupleDTO)source.FullSLSForces);
CheckObject.IsNull(newItem.ForceTuples, nameof(newItem.ForceTuples));
newItem.ForceTuples.Clear();
foreach (var item in source.ForceTuples)
{
var newTuple = forceTupleConvertStrategy.Convert((ForceTupleDTO)item);
newItem.ForceTuples.Add(newTuple);
}
TraceLogger.AddMessage($"Force combination by factor name = {newItem.Name} has been finished");
return newItem;
}

View File

@@ -12,15 +12,15 @@ using System.Threading.Tasks;
namespace DataAccess.DTOs.Converters
{
public class ForceCombinationByFactorToDTOConvertStrategy : IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor>
public class ForceCombinationByFactorToDTOConvertStrategy : IConvertStrategy<ForceCombinationByFactorDTO, IForceFactoredList>
{
private IUpdateStrategy<IForceCombinationByFactor> updateStrategy;
private IUpdateStrategy<IForceFactoredList> updateStrategy;
private IConvertStrategy<Point2DDTO, IPoint2D> pointUpdateStrategy;
private IConvertStrategy<ForceTupleDTO, IForceTuple> forceTupleConvertStrategy;
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
public ForceCombinationByFactorToDTOConvertStrategy(IUpdateStrategy<IForceCombinationByFactor> updateStrategy,
public ForceCombinationByFactorToDTOConvertStrategy(IUpdateStrategy<IForceFactoredList> updateStrategy,
IConvertStrategy<Point2DDTO, IPoint2D> pointUpdateStrategy,
IConvertStrategy<ForceTupleDTO, IForceTuple> convertStrategy,
IUpdateStrategy<IForceAction> baseUpdateStrategy)
@@ -32,7 +32,7 @@ namespace DataAccess.DTOs.Converters
}
public ForceCombinationByFactorToDTOConvertStrategy() : this (
new ForceCombinationByFactorUpdateStrategy(),
new ForceFactoredListUpdateStrategy(),
new Point2DToDTOConvertStrategy(),
new ForceTupleToDTOConvertStrategy(),
new ForceActionBaseUpdateStrategy())
@@ -43,7 +43,7 @@ namespace DataAccess.DTOs.Converters
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public IShiftTraceLogger TraceLogger { get; set; }
public ForceCombinationByFactorDTO Convert(IForceCombinationByFactor source)
public ForceCombinationByFactorDTO Convert(IForceFactoredList source)
{
Check();
try
@@ -61,7 +61,7 @@ namespace DataAccess.DTOs.Converters
}
private ForceCombinationByFactorDTO GetNewForceTuple(IForceCombinationByFactor source)
private ForceCombinationByFactorDTO GetNewForceTuple(IForceFactoredList source)
{
ForceCombinationByFactorDTO newItem = new() { Id = source.Id };
baseUpdateStrategy.Update(newItem, source);
@@ -71,18 +71,23 @@ namespace DataAccess.DTOs.Converters
return newItem;
}
private void GetNewFullSLSForces(IForceCombinationByFactor source, ForceCombinationByFactorDTO newItem)
private void GetNewFullSLSForces(IForceFactoredList source, ForceCombinationByFactorDTO newItem)
{
if (source.FullSLSForces is not null)
if (source.ForceTuples[0] is not null)
{
forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
forceTupleConvertStrategy.TraceLogger = TraceLogger;
var convertForceTupleLogic = new DictionaryConvertStrategy<ForceTupleDTO, IForceTuple>(this, forceTupleConvertStrategy);
newItem.FullSLSForces = convertForceTupleLogic.Convert(source.FullSLSForces);
newItem.ForceTuples.Clear();
foreach (var item in source.ForceTuples)
{
var forceTuple = convertForceTupleLogic.Convert(item);
newItem.ForceTuples.Add(forceTuple);
}
}
}
private void GetNewForcePoint(IForceCombinationByFactor source, ForceCombinationByFactorDTO newItem)
private void GetNewForcePoint(IForceFactoredList source, ForceCombinationByFactorDTO newItem)
{
if (source.ForcePoint is not null)
{
@@ -95,7 +100,7 @@ namespace DataAccess.DTOs.Converters
private void Check()
{
var checkLogic = new CheckConvertLogic<ForceCombinationByFactorDTO, IForceCombinationByFactor>(this);
var checkLogic = new CheckConvertLogic<ForceCombinationByFactorDTO, IForceFactoredList>(this);
checkLogic.Check();
}
}

View File

@@ -0,0 +1,60 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Forces.Logics;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class ForceCombinationByFactorV1_0FromDTOConvertStrategy : ConvertStrategy<ForceFactoredList, ForceCombinationByFactorV1_0DTO>
{
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
private IUpdateStrategy<IForceFactoredList> updateStrategy;
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
private IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy;
public ForceCombinationByFactorV1_0FromDTOConvertStrategy(
IUpdateStrategy<IForceAction> baseUpdateStrategy,
IUpdateStrategy<IForceFactoredList> updateStrategy,
IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy,
IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy)
{
this.baseUpdateStrategy = baseUpdateStrategy;
this.updateStrategy = updateStrategy;
this.pointConvertStrategy = pointConvertStrategy;
this.forceTupleConvertStrategy = forceTupleConvertStrategy;
}
public ForceCombinationByFactorV1_0FromDTOConvertStrategy() : this(
new ForceActionBaseUpdateStrategy(),
new ForceFactoredListUpdateStrategy(),
new Point2DFromDTOConvertStrategy(),
new ForceTupleFromDTOConvertStrategy())
{
}
public override ForceFactoredList GetNewItem(ForceCombinationByFactorV1_0DTO source)
{
TraceLogger.AddMessage($"Force combination by factor name = {source.Name} is starting");
ForceFactoredList newItem = new(source.Id);
baseUpdateStrategy.Update(newItem, source);
updateStrategy.Update(newItem, source);
pointConvertStrategy.ReferenceDictionary = ReferenceDictionary;
pointConvertStrategy.TraceLogger = TraceLogger;
newItem.ForcePoint = pointConvertStrategy.Convert((Point2DDTO)source.ForcePoint);
forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
forceTupleConvertStrategy.TraceLogger = TraceLogger;
var forceTuple = forceTupleConvertStrategy.Convert((ForceTupleDTO)source.ForceTuple);
newItem.ForceTuples[0] = forceTuple;
TraceLogger.AddMessage($"Force combination by factor name = {source.Name} was successfully converted from version 1.0", TraceLogStatuses.Warning);
TraceLogger.AddMessage($"Force combination by factor name = {newItem.Name} has been finished");
return newItem;
}
}
}

View File

@@ -10,26 +10,21 @@ using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class ForceCombinationByFactorDTO : IForceCombinationByFactor
public class ForceCombinationByFactorDTO : IForceFactoredList
{
[JsonProperty("Id")]
public Guid Id { get; set; }
[JsonProperty("Name")]
public string Name { get; set; }
[JsonProperty("LimitState")]
public LimitStates LimitState { get; set; } = LimitStates.SLS;
[JsonProperty("CalcTerm")]
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
[JsonProperty("FullSLSForces")]
public IForceTuple FullSLSForces { get; set; } = new ForceTupleDTO();
[JsonProperty("ULSFactor")]
public double ULSFactor { get; set; }
[JsonProperty("LongTermFactor")]
public double LongTermFactor { get; set; }
[JsonProperty("ForceTuples")]
public List<IForceTuple> ForceTuples { get; } = new();
[JsonProperty("SetInGravityCenter")]
public bool SetInGravityCenter { get; set; }
[JsonProperty("ForcePoint")]
public IPoint2D ForcePoint { get; set; } = new Point2DDTO();
[JsonProperty("CombinationProperty")]
public IFactoredCombinationProperty CombinationProperty { get; } = new ForceFactoredCombinationPropertyDTO();
public object Clone()
{

View File

@@ -0,0 +1,18 @@
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
namespace DataAccess.DTOs
{
public class ForceFactoredCombinationPropertyDTO : IFactoredCombinationProperty
{
[JsonProperty("CalctTerm")]
public CalcTerms CalcTerm { get; set; }
[JsonProperty("LimitState")]
public LimitStates LimitState { get; set; }
[JsonProperty("LongTermFactor")]
public double LongTermFactor { get; set; }
[JsonProperty("ULSFactor")]
public double ULSFactor { get; set; }
}
}

View File

@@ -0,0 +1,59 @@
using Newtonsoft.Json;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataAccess.DTOs
{
public class ForceCombinationByFactorV1_0DTO : IForceFactoredList
{
[JsonProperty("Id")]
public Guid Id { get; set; }
[JsonProperty("Name")]
public string Name { get; set; }
[JsonProperty("LimitState")]
public LimitStates LimitState { get; set; } = LimitStates.SLS;
[JsonProperty("CalcTerm")]
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
[JsonProperty("FullSLSForces")]
public IForceTuple ForceTuple { get; set; } = new ForceTupleDTO();
[JsonProperty("ULSFactor")]
public double ULSFactor { get; set; }
[JsonProperty("LongTermFactor")]
public double LongTermFactor { get; set; }
[JsonProperty("SetInGravityCenter")]
public bool SetInGravityCenter { get; set; }
[JsonProperty("ForcePoint")]
public IPoint2D ForcePoint { get; set; } = new Point2DDTO();
[JsonIgnore]
public IFactoredCombinationProperty CombinationProperty => new FactoredCombinationProperty()
{
CalcTerm = CalcTerm,
LimitState = LimitState,
LongTermFactor = LongTermFactor,
ULSFactor = ULSFactor,
};
[JsonIgnore]
public List<IForceTuple> ForceTuples => new() { ForceTuple};
public object Clone()
{
throw new NotImplementedException();
}
public IForceCombinationList GetCombination()
{
throw new NotImplementedException();
}
public List<IForceCombinationList> GetCombinations()
{
throw new NotImplementedException();
}
}
}

View File

@@ -54,8 +54,10 @@ namespace DataAccess.DTOs
{ (typeof(FileVersionDTO), "FileVersion") },
{ (typeof(ForceCalculatorDTO), "ForceCalculator") },
{ (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") },
{ (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor") },
{ (typeof(ForceCombinationByFactorV1_0DTO), "ForceCombinationByFactor") },
{ (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor_v1_1") },
{ (typeof(ForceCombinationListDTO), "ForceCombinationList") },
{ (typeof(ForceFactoredCombinationPropertyDTO), "ForceFactoredCombinationProperty") },
{ (typeof(ForceTupleDTO), "ForceTuple") },
{ (typeof(FRMaterialDTO), "FRMaterial") },
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
@@ -67,6 +69,7 @@ namespace DataAccess.DTOs
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
{ (typeof(List<IDesignForceTuple>), "ListOfIDesignForceTuple") },
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
{ (typeof(List<IForceTuple>), "ListOfIForceTuple") },
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
{ (typeof(List<LimitStates>), "ListOfLimitState") },
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },

View File

@@ -0,0 +1,776 @@
{
"$id": "1",
"$type": "RootObject",
"FileVersion": {
"Id": "5d599b0f-7368-44a1-9547-51979be1b14b",
"VersionNumber": 1,
"SubVersionNumber": 0
},
"Project": {
"Id": "55dedceb-cac1-43bc-9f8f-1294758c4e63",
"VisualAnalyses": {
"$id": "2",
"$type": "ListOfIVisualAnalysis",
"$values": [
{
"$id": "3",
"$type": "VisualAnalysis",
"Id": "67c5b5ef-0c5c-4f74-b41c-b06598be4302",
"Analysis": {
"$id": "4",
"$type": "CrossSectionNdmAnalysis",
"Id": "df11a5a3-30a7-4b72-a651-1774c96de3e8",
"Name": "New NDM Analysis",
"Tags": "#New group",
"VersionProcessor": {
"$id": "5",
"$type": "VersionProcessor",
"Id": "179efcec-101b-4601-b324-68eae7836b13",
"Versions": {
"$type": "ListOfIDateVersion",
"$values": [
{
"$id": "6",
"$type": "DateVersion",
"Id": "c43f9544-c11b-413e-abf0-14fa1785fddd",
"DateTime": "2025-01-08T14:30:06.8371783+05:00",
"Comment": "",
"AnalysisVersion": {
"$id": "7",
"$type": "CrossSection",
"Id": "c5ac3299-d964-4858-afef-795c4a58e93c",
"SectionRepository": {
"$id": "8",
"$type": "CrossSectionRepository",
"Id": "2fda8944-a3b1-43b9-9015-d64697c2fc15",
"HeadMaterials": {
"$type": "ListOfIHeadMaterial",
"$values": [
{
"$id": "9",
"$type": "HeadMaterial",
"Id": "f740fc6d-7322-4587-8663-f64716078eae",
"Name": "Concrete",
"Color": "#FFF0F8FF",
"HelperMaterial": {
"$id": "10",
"$type": "ConcreteLibMaterial",
"Id": "cb977fd6-9c21-4cbf-b1e8-a0fdcb8c4ad0",
"RelativeHumidity": 0.55,
"MinAge": 0.0,
"MaxAge": 2207520000.0,
"MaterialEntityId": "32614a91-fc85-4690-aa82-af45e00f7638",
"SafetyFactors": {
"$id": "11",
"$type": "ListOfMaterialSafetyFactor",
"$values": [
{
"$id": "12",
"$type": "MaterialSafetyFactor",
"Id": "2a053f6d-3478-47d7-9a7a-949e6d9bfe1a",
"Name": "Gamma_b1",
"Take": true,
"Description": "Coefficient for considering long term calculations",
"PartialFactors": {
"$type": "ListOfMaterialPartialFactor",
"$values": [
{
"$id": "13",
"$type": "MaterialPartialFactor",
"Id": "6505cfd7-ad2b-429d-a400-ad261261d83b",
"FactorValue": 0.9,
"StressState": 0,
"CalcTerm": 2,
"LimitState": 1
},
{
"$id": "14",
"$type": "MaterialPartialFactor",
"Id": "0304878c-5f67-44f1-86ff-ad214585f3b0",
"FactorValue": 0.9,
"StressState": 1,
"CalcTerm": 2,
"LimitState": 1
}
]
}
},
{
"$id": "15",
"$type": "MaterialSafetyFactor",
"Id": "a5e0ea95-8178-496f-8023-ed0b4346a8e8",
"Name": "Gamma_b2",
"Take": false,
"Description": "Coefficient for plain concrete structures",
"PartialFactors": {
"$type": "ListOfMaterialPartialFactor",
"$values": [
{
"$id": "16",
"$type": "MaterialPartialFactor",
"Id": "2c2f4f48-962e-4b29-9277-c59f6bc6c968",
"FactorValue": 0.9,
"StressState": 1,
"CalcTerm": 1,
"LimitState": 1
},
{
"$id": "17",
"$type": "MaterialPartialFactor",
"Id": "6997f48c-abda-46ca-8868-cbac83a6abbe",
"FactorValue": 0.9,
"StressState": 1,
"CalcTerm": 2,
"LimitState": 1
}
]
}
},
{
"$id": "18",
"$type": "MaterialSafetyFactor",
"Id": "59f8971a-6e49-491a-8a19-5c2bf780e8d3",
"Name": "Gamma_b3",
"Take": false,
"Description": "Coefficient for considering bleeding in vertical placement conditionals",
"PartialFactors": {
"$type": "ListOfMaterialPartialFactor",
"$values": [
{
"$id": "19",
"$type": "MaterialPartialFactor",
"Id": "2bfb1551-f804-4409-a69b-9e2124c9ca2b",
"FactorValue": 0.85,
"StressState": 1,
"CalcTerm": 1,
"LimitState": 1
},
{
"$id": "20",
"$type": "MaterialPartialFactor",
"Id": "24e1c5e3-31c1-46ad-af00-4abc8cc049ce",
"FactorValue": 0.85,
"StressState": 1,
"CalcTerm": 2,
"LimitState": 1
}
]
}
}
]
},
"TensionForULS": false,
"TensionForSLS": true,
"MaterialLogicId": "b97e8168-76a1-4e24-ae98-9aa38edd1e9a"
}
},
{
"$id": "21",
"$type": "HeadMaterial",
"Id": "72a82a62-990b-470f-8c55-e36b90c42b63",
"Name": "Reinforcement",
"Color": "#FFFF0000",
"HelperMaterial": {
"$id": "22",
"$type": "ReinforcementLibMaterial",
"Id": "2766510a-6d11-4e74-ac2e-5af3302b05c1",
"MaterialEntityId": "ea422282-3465-433c-9b93-c5bbfba5a904",
"SafetyFactors": {
"$id": "23",
"$type": "ListOfMaterialSafetyFactor",
"$values": []
},
"MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9"
}
}
]
},
"ForceActions": {
"$type": "ListOfIForceAction",
"$values": [
{
"$id": "24",
"$type": "ForceCombinationList",
"Id": "4d843776-aeaa-4362-85cb-9f47182c48c2",
"Name": "New Force Action",
"SetInGravityCenter": true,
"ForcePoint": {
"$id": "25",
"$type": "Point2D",
"Id": "ad1c1c5a-13cd-4c9e-8c33-02fc15728a1e",
"X": 0.0,
"Y": 0.0
},
"DesignForces": {
"$id": "26",
"$type": "ListOfIDesignForceTuple",
"$values": [
{
"$id": "27",
"$type": "DesignForceTuple",
"Id": "18d6576d-55a3-46c2-93a0-3b84de3d8b14",
"LimitState": 1,
"CalcTerm": 1,
"ForceTuple": {
"$id": "28",
"$type": "ForceTuple",
"Id": "f67ef70f-89a6-4c74-9dab-34c8427d687f",
"Mx": -50000.0,
"My": -50000.0,
"Nz": -100000.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
{
"$id": "29",
"$type": "DesignForceTuple",
"Id": "babf37e3-4744-400e-8eef-8282c721f77a",
"LimitState": 1,
"CalcTerm": 2,
"ForceTuple": {
"$id": "30",
"$type": "ForceTuple",
"Id": "a6d7ee69-04a0-43ba-a1bb-b4726c55b327",
"Mx": -50000.0,
"My": -50000.0,
"Nz": -100000.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
{
"$id": "31",
"$type": "DesignForceTuple",
"Id": "a7e30dab-fb80-47f2-8740-e1deaf935ea6",
"LimitState": 2,
"CalcTerm": 1,
"ForceTuple": {
"$id": "32",
"$type": "ForceTuple",
"Id": "ec91dfb2-4dd1-43a4-9c55-557b6b0d2036",
"Mx": -50000.0,
"My": -50000.0,
"Nz": -100000.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
{
"$id": "33",
"$type": "DesignForceTuple",
"Id": "1dc63aa5-9c2e-4fa6-9e8a-901cb89de1af",
"LimitState": 2,
"CalcTerm": 2,
"ForceTuple": {
"$id": "34",
"$type": "ForceTuple",
"Id": "35651c76-0a86-486f-a682-3218fb98110a",
"Mx": -50000.0,
"My": -50000.0,
"Nz": -100000.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
}
]
}
},
{
"$id": "35",
"$type": "ForceCombinationByFactor",
"Id": "52cc2928-64d8-4b7f-a046-a77f7e974486",
"Name": "New Factored Load",
"LimitState": 2,
"CalcTerm": 1,
"FullSLSForces": {
"$id": "36",
"$type": "ForceTuple",
"Id": "81e5560b-805b-4e76-96e6-2870d7564c05",
"Mx": -100000.0,
"My": -50000.0,
"Nz": -100000.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
},
"ULSFactor": 1.2,
"LongTermFactor": 1.0,
"SetInGravityCenter": true,
"ForcePoint": {
"$id": "37",
"$type": "Point2D",
"Id": "45052383-5ad3-45f6-9fa1-e86f3484d858",
"X": 0.0,
"Y": 0.0
}
}
]
},
"Primitives": {
"$type": "ListOfINdmPrimitive",
"$values": [
{
"$id": "38",
"$type": "RectangleNdmPrimitive",
"Id": "b245bcbe-5a40-4fcd-b908-9154324b320d",
"Name": "Concrete block",
"RectangleShape": {
"$id": "39",
"$type": "RectangleShape",
"Id": "9b918d84-5e11-43ef-ae86-82bd17def45f",
"Width": 0.4,
"Height": 0.6
},
"NdmElement": {
"$id": "40",
"$type": "NdmElement",
"Id": "4e625e44-3453-439e-b0bd-caaa29e297c0",
"HeadMaterial": {
"$ref": "9"
},
"Triangulate": true,
"UsersPrestrain": {
"$id": "41",
"$type": "ForceTuple",
"Id": "fa39b8c3-9abb-44c0-82cf-7429fe9dcb11",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
},
"AutoPrestrain": {
"$id": "42",
"$type": "ForceTuple",
"Id": "16e76225-dacd-41d6-ac21-ecdb7b3b129c",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
"VisualProperty": {
"$id": "43",
"$type": "VisualProperty",
"Id": "edd6ef74-e24f-4ef6-8db0-5a73a97e5e02",
"IsVisible": true,
"Color": "#FF03AEDC",
"SetMaterialColor": true,
"ZIndex": 0,
"Opacity": 0.8
},
"Center": {
"$id": "44",
"$type": "Point2D",
"Id": "8561a168-bec4-4d1d-8d9b-cfbb21d0f4e9",
"X": 0.0,
"Y": 0.0
},
"DivisionSize": {
"$id": "45",
"$type": "DivisionSize",
"Id": "9a630741-220d-4612-972d-9f9d8aec148c",
"NdmMaxSize": 0.01,
"NdmMinDivision": 10,
"ClearUnderlying": false
},
"RotationAngle": 0.0
},
{
"$id": "46",
"$type": "RebarNdmPrimitive",
"Id": "093cd50c-fb8b-46f8-80a0-f4a1ea361066",
"Name": "Left bottom rebar",
"NdmElement": {
"$id": "47",
"$type": "NdmElement",
"Id": "aadfefb3-a5db-441b-9e39-36b4c02c502e",
"HeadMaterial": {
"$ref": "21"
},
"Triangulate": true,
"UsersPrestrain": {
"$id": "48",
"$type": "ForceTuple",
"Id": "6149e2b1-dba1-428a-b380-cff0ed1f9396",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
},
"AutoPrestrain": {
"$id": "49",
"$type": "ForceTuple",
"Id": "a568e17b-05d4-48eb-b421-0dabf90e80e4",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
"VisualProperty": {
"$id": "50",
"$type": "VisualProperty",
"Id": "5ba35c9f-b54c-4f41-ba3a-4e3ce8997c8a",
"IsVisible": true,
"Color": "#FFA9D85C",
"SetMaterialColor": true,
"ZIndex": 0,
"Opacity": 1.0
},
"Center": {
"$id": "51",
"$type": "Point2D",
"Id": "be72d90f-ef23-420a-9bf5-c91d0adfe658",
"X": -0.15000000000000002,
"Y": -0.25
},
"RotationAngle": 0.0,
"Area": 0.0004908738521234052,
"HostPrimitive": {
"$ref": "38"
}
},
{
"$id": "52",
"$type": "RebarNdmPrimitive",
"Id": "ac123a80-3c5e-4d3b-bc14-26ac442f8c78",
"Name": "Right bottom rebar",
"NdmElement": {
"$id": "53",
"$type": "NdmElement",
"Id": "d2e116c1-7ba9-401c-9baf-e385da77da7e",
"HeadMaterial": {
"$ref": "21"
},
"Triangulate": true,
"UsersPrestrain": {
"$id": "54",
"$type": "ForceTuple",
"Id": "486f1a2d-035a-4f15-8b97-f18a0522a9da",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
},
"AutoPrestrain": {
"$id": "55",
"$type": "ForceTuple",
"Id": "0eb9a6bc-1449-40ca-aa54-93bd9c0577c1",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
"VisualProperty": {
"$id": "56",
"$type": "VisualProperty",
"Id": "b7d75d66-8917-43f7-8997-6c6c0819e2e3",
"IsVisible": true,
"Color": "#FFF52D76",
"SetMaterialColor": true,
"ZIndex": 0,
"Opacity": 1.0
},
"Center": {
"$id": "57",
"$type": "Point2D",
"Id": "4254382b-ae86-48cc-a7ad-4d313a25fbd3",
"X": 0.15000000000000002,
"Y": -0.25
},
"RotationAngle": 0.0,
"Area": 0.0004908738521234052,
"HostPrimitive": {
"$ref": "38"
}
},
{
"$id": "58",
"$type": "RebarNdmPrimitive",
"Id": "92e1e36e-5d5c-4916-b436-2ad71d5a40cb",
"Name": "Left top rebar",
"NdmElement": {
"$id": "59",
"$type": "NdmElement",
"Id": "994c5488-0b82-4098-af82-4ecf5a152227",
"HeadMaterial": {
"$ref": "21"
},
"Triangulate": true,
"UsersPrestrain": {
"$id": "60",
"$type": "ForceTuple",
"Id": "71e2573f-47ed-4e51-9b02-5e9d9416b767",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
},
"AutoPrestrain": {
"$id": "61",
"$type": "ForceTuple",
"Id": "8f83d338-5745-49e5-8dfe-80585c049a37",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
"VisualProperty": {
"$id": "62",
"$type": "VisualProperty",
"Id": "6bb9b771-1fe9-4623-a321-c403cad6c4c1",
"IsVisible": true,
"Color": "#FFEFCD71",
"SetMaterialColor": true,
"ZIndex": 0,
"Opacity": 1.0
},
"Center": {
"$id": "63",
"$type": "Point2D",
"Id": "f5e30e3e-fae0-4aa7-8d1a-040360e0f34f",
"X": -0.15000000000000002,
"Y": 0.25
},
"RotationAngle": 0.0,
"Area": 0.00020106192982974677,
"HostPrimitive": {
"$ref": "38"
}
},
{
"$id": "64",
"$type": "RebarNdmPrimitive",
"Id": "c87284be-d212-4963-b99a-43f0077c16dd",
"Name": "Right top rebar",
"NdmElement": {
"$id": "65",
"$type": "NdmElement",
"Id": "31dbdde1-579f-4463-9d7c-9cd3fa05d3cb",
"HeadMaterial": {
"$ref": "21"
},
"Triangulate": true,
"UsersPrestrain": {
"$id": "66",
"$type": "ForceTuple",
"Id": "75da3a58-8d79-4542-a807-390feb771ec8",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
},
"AutoPrestrain": {
"$id": "67",
"$type": "ForceTuple",
"Id": "2ca8c724-7a15-487a-a862-1bfd01fb422b",
"Mx": 0.0,
"My": 0.0,
"Nz": 0.0,
"Qx": 0.0,
"Qy": 0.0,
"Mz": 0.0
}
},
"VisualProperty": {
"$id": "68",
"$type": "VisualProperty",
"Id": "81826ca3-8d87-4533-afa2-417604544035",
"IsVisible": true,
"Color": "#FF279548",
"SetMaterialColor": true,
"ZIndex": 0,
"Opacity": 1.0
},
"Center": {
"$id": "69",
"$type": "Point2D",
"Id": "3a3c5793-7eb5-489c-9822-69c17f2ae4f1",
"X": 0.15000000000000002,
"Y": 0.25
},
"RotationAngle": 0.0,
"Area": 0.00020106192982974677,
"HostPrimitive": {
"$ref": "38"
}
}
]
},
"Calculators": {
"$type": "ListOfICalculator",
"$values": [
{
"$id": "70",
"$type": "ForceCalculator",
"Id": "92c66a20-4754-4f29-b619-3434e936f1eb",
"Name": "New Force Calculator",
"InputData": {
"$id": "71",
"$type": "ForceCalculatorInputData",
"Id": "afcb0d3f-31af-49fd-8f8c-88d734b8f4cc",
"ForceActions": {
"$id": "72",
"$type": "ListOfIForceAction",
"$values": [
{
"$ref": "24"
},
{
"$ref": "35"
}
]
},
"Primitives": {
"$id": "73",
"$type": "ListOfINdmPrimitive",
"$values": [
{
"$ref": "38"
},
{
"$ref": "46"
},
{
"$ref": "52"
},
{
"$ref": "58"
},
{
"$ref": "64"
}
]
},
"LimitStatesList": {
"$id": "74",
"$type": "ListOfLimitState",
"$values": [
1,
2
]
},
"CalcTermList": {
"$id": "75",
"$type": "ListOfCalcTerms",
"$values": [
1,
2
]
},
"Accuracy": {
"$id": "76",
"$type": "Accuracy",
"Id": "fefe3ba6-7423-4495-bba6-ee438df61d54",
"IterationAccuracy": 0.001,
"MaxIterationCount": 1000
},
"CompressedMember": {
"$id": "77",
"$type": "CompressedMember",
"Id": "3484631a-b429-4583-bf0c-c4f44ff2e8ee",
"Bucling": false,
"GeometryLength": 3.0,
"LengthFactorX": 1.0,
"DiagramFactorX": 1.0,
"LengthFactorY": 1.0,
"DiagramFactorY": 1.0
}
}
},
{
"$id": "78",
"$type": "CrackCalculator",
"Id": "de8c0c42-576d-4853-a964-6af84dcb0a79",
"Name": "New Crack Calculator",
"InputData": {
"$id": "79",
"$type": "CrackCalculatorInputData",
"Id": "7b76ed27-1db0-4dbc-89b8-08d6797174b3",
"ForceActions": {
"$id": "80",
"$type": "ListOfIForceAction",
"$values": [
{
"$ref": "24"
},
{
"$ref": "35"
}
]
},
"ForcePrimitives": {
"$id": "81",
"$type": "ListOfINdmPrimitive",
"$values": [
{
"$ref": "38"
},
{
"$ref": "46"
},
{
"$ref": "52"
},
{
"$ref": "58"
},
{
"$ref": "64"
}
]
},
"UserCrackInputData": {
"$id": "82",
"$type": "UserCrackInputData",
"Id": "d06c12e1-61d5-4e73-9fdb-02050f40ba81",
"LengthBetweenCracks": 0.4,
"SetLengthBetweenCracks": true,
"SetSofteningFactors": true,
"SofteningFactors": 1.0,
"UltimateLongCrackWidths": 0.0003,
"UltimateShortCrackWidths": 0.0004
}
}
}
]
}
}
}
}
]
}
},
"Comment": "",
"Color": "#FF800000"
}
}
]
}
}
}

View File

@@ -92,6 +92,7 @@
<ItemGroup>
<Folder Include="Documentation\Manuals\" />
<Folder Include="Documentation\Examples\" />
<Folder Include="Documentation\PreviousFileVersions\" />
<Folder Include="Documentation\Verification\" />
<Folder Include="Infrastructure\UI\DataContexts\Logics\" />
<Folder Include="Resources\" />

View File

@@ -84,6 +84,9 @@
<Compile Update="Windows\UserControls\ButtonToolTipEh.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\UserControls\Forces\FactoredCombination.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\UserControls\MultiplyDouble.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -188,6 +191,9 @@
<Page Update="Windows\UserControls\ButtonToolTipEh.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\UserControls\Forces\FactoredCombination.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\UserControls\MultiplyDouble.xaml">
<SubType>Designer</SubType>
</Page>

View File

@@ -0,0 +1,80 @@
using StructureHelper.Infrastructure;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace StructureHelper.Windows.Forces
{
public class FactoredCombinationPropertyVM : ViewModelBase, IFactoredCombinationProperty
{
private IFactoredCombinationProperty sourceProperty;
public List<LimitStates> LimitStateList { get; set; } = new() { LimitStates.ULS, LimitStates.SLS };
public List<CalcTerms> CalcTermList { get; set; } = new() { CalcTerms.LongTerm, CalcTerms.ShortTerm };
public FactoredCombinationPropertyVM(IFactoredCombinationProperty sourceProperty)
{
this.sourceProperty = sourceProperty;
}
public double ULSFactor
{
get => sourceProperty.ULSFactor;
set
{
sourceProperty.ULSFactor = value;
OnPropertyChanged(nameof(ULSFactor));
}
}
public double LongTermFactor
{
get => sourceProperty.LongTermFactor;
set
{
if (value < 0d) { value = 0d; }
if (value > 1d) { value = 1d; }
sourceProperty.LongTermFactor = value;
OnPropertyChanged(nameof(LongTermFactor));
}
}
public CalcTerms CalcTerm
{
get
{
return sourceProperty.CalcTerm;
}
set
{
sourceProperty.CalcTerm = value;
OnPropertyChanged(nameof(CalcTerm));
}
}
public LimitStates LimitState
{
get { return sourceProperty.LimitState; }
set
{
sourceProperty.LimitState = value;
OnPropertyChanged(nameof(LimitState));
}
}
internal void UpdateCombinationProperty(IFactoredCombinationProperty? newValue)
{
sourceProperty = newValue;
Refresh();
}
private void Refresh()
{
OnPropertyChanged(nameof(ULSFactor));
OnPropertyChanged(nameof(LongTermFactor));
OnPropertyChanged(nameof(CalcTerm));
OnPropertyChanged(nameof(LimitState));
}
}
}

View File

@@ -0,0 +1,59 @@
using StructureHelper.Windows.ViewModels.Forces;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Media3D;
namespace StructureHelper.Windows.Forces
{
public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo
{
IForceFactoredList forceAction;
ForceTupleVM forceTupleVM;
public ForceTupleVM ForceTupleVM => forceTupleVM;
public IFactoredCombinationProperty CombinationProperty
{
get
{
return forceAction.CombinationProperty;
}
}
public string Error => throw new NotImplementedException();
public string this[string columnName]
{
get
{
string error = null;
//if (columnName == nameof(ULSFactor))
//{
// if (ULSFactor <= 0)
// {
// error = "Safety factor for ULS must be greater than zero";
// }
//}
//if (columnName == nameof(LongTermFactor))
//{
// if (LongTermFactor < 0d || LongTermFactor > 1d)
// {
// error = "Long term factor must be between 0.0 and 1.0";
// }
//}
return error;
}
}
public ForceCombinationByFactorVM(IForceFactoredList forceAction) : base(forceAction)
{
this.forceAction = forceAction;
forceTupleVM = new ForceTupleVM(this.forceAction.ForceTuples[0]);
}
}
}

View File

@@ -4,10 +4,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
d:DataContext="{d:DesignInstance vm:ForceCombinationByFactorVM}"
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
d:DataContext="{d:DesignInstance local:ForceCombinationByFactorVM}"
mc:Ignorable="d"
Title="Force Combination By Factor" Height="290" Width="350" MinHeight="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
Title="Force Combination By Factor" Height="340" Width="350" MinHeight="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="95"/>
@@ -17,7 +17,8 @@
<!--ForceTemplates.xaml-->
<ContentControl ContentTemplate="{StaticResource ResourceKey=ForceActionTemplate}" Content="{Binding}"/>
<StackPanel Grid.Row="1">
<TextBlock Text="Full service load combination"/>
<uc:FactoredCombination x:Name="FactoredCombination" CombinationProperty="{Binding CombinationProperty}"/>
<TextBlock Text="Load combination"/>
<Grid DataContext="{Binding ForceTupleVM}">
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
@@ -35,20 +36,6 @@
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding My, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Nz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="Long Term factor"/>
<TextBox Grid.Column="1" Text="{Binding LongTermFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="1" Text="ULS Safety Factor"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding ULSFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
</Grid>
</StackPanel>
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
</Grid>

View File

@@ -1,5 +1,4 @@
using StructureHelper.Windows.ViewModels.Forces;
using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,12 +21,13 @@ namespace StructureHelper.Windows.Forces
public partial class ForceCombinationByFactorView : Window
{
ForceCombinationByFactorVM viewModel;
public ForceCombinationByFactorView(IForceCombinationByFactor forceCombination)
public ForceCombinationByFactorView(IForceFactoredList forceCombination)
{
InitializeComponent();
viewModel = new ForceCombinationByFactorVM(forceCombination);
DataContext = viewModel;
viewModel.ParentWindow = this;
InitializeComponent();
FactoredCombination.CombinationProperty = viewModel.CombinationProperty;
}
}
}

View File

@@ -41,7 +41,7 @@ namespace StructureHelper.Windows.Forces
private void StartValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(Properties.StartDesignForce.ForceTuple, obj.DoubleFactor);
var tmpTuple = ForceTupleService.MultiplyTupleByFactor(Properties.StartDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, Properties.StartDesignForce.ForceTuple, 1d);
Properties.RefreshStartTuple();
}
@@ -49,7 +49,7 @@ namespace StructureHelper.Windows.Forces
private void FinishValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTuples(Properties.FinishDesignForce.ForceTuple, obj.DoubleFactor);
var tmpTuple = ForceTupleService.MultiplyTupleByFactor(Properties.FinishDesignForce.ForceTuple, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, Properties.FinishDesignForce.ForceTuple, 1d);
Properties.RefreshFinishTuple();
}

View File

@@ -0,0 +1,31 @@
<UserControl x:Class="StructureHelper.Windows.UserControls.FactoredCombination"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StructureHelper.Windows.UserControls"
xmlns:forces="clr-namespace:StructureHelper.Windows.Forces"
d:DataContext="{d:DesignInstance forces:FactoredCombinationPropertyVM}"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="350">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Limit State"/>
<ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding LimitStateList}" SelectedItem="{Binding LimitState}"/>
<TextBlock Grid.Row="1" Text="Calculation term"/>
<ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding CalcTermList}" SelectedItem="{Binding CalcTerm}"/>
<TextBlock Grid.Row="2" Text="Long Term factor"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding LongTermFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
<TextBlock Grid.Row="3" Text="ULS Safety Factor"/>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding ULSFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
</Grid>
</UserControl>

View File

@@ -0,0 +1,62 @@
using StructureHelper.Windows.Forces;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Models.Forces;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
namespace StructureHelper.Windows.UserControls
{
/// <summary>
/// Interaction logic for FactoredCombination.xaml
/// </summary>
public partial class FactoredCombination : UserControl
{
FactoredCombinationPropertyVM viewModel;
// Registering the Dependency Property
public static readonly DependencyProperty CombinationPropertyProperty =
DependencyProperty.Register(
nameof(CombinationProperty), // Property name
typeof(IFactoredCombinationProperty), // Property type
typeof(FactoredCombination), // Owner class
new PropertyMetadata(
default(IFactoredCombinationProperty),
OnCombinationPropertyChanged // PropertyChangedCallback
)
);
// CLR Wrapper
public IFactoredCombinationProperty CombinationProperty
{
get => (IFactoredCombinationProperty)GetValue(CombinationPropertyProperty);
set => SetValue(CombinationPropertyProperty, value);
}
public FactoredCombination()
{
if (CombinationProperty is not null)
{
viewModel = new(CombinationProperty);
}
else
{
viewModel = new(new FactoredCombinationProperty());
}
DataContext = viewModel;
InitializeComponent();
}
private static void OnCombinationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as FactoredCombination;
var newValue = e.NewValue as IFactoredCombinationProperty;
if (control?.viewModel != null)
{
// Update the ViewModel with the new property value
control.viewModel.UpdateCombinationProperty(newValue);
}
}
}
}

View File

@@ -27,7 +27,7 @@ namespace StructureHelper.Windows.ViewModels.Forces
}
else if (paramType == ActionType.ForceCombinationByFactor)
{
NewItem = new ForceCombinationByFactor() { Name = "New Factored Combination" };
NewItem = new ForceFactoredList() { Name = "New Factored Combination" };
}
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}");
//GlobalRepository.Actions.Create(NewItem);
@@ -66,9 +66,9 @@ namespace StructureHelper.Windows.ViewModels.Forces
var item = (IForceCombinationList)SelectedItem;
wnd = new ForceCombinationView(item);
}
else if (SelectedItem is IForceCombinationByFactor)
else if (SelectedItem is IForceFactoredList)
{
var item = (IForceCombinationByFactor)SelectedItem;
var item = (IForceFactoredList)SelectedItem;
wnd = new ForceCombinationByFactorView(item);
}
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}");

View File

@@ -1,73 +0,0 @@
using StructureHelperCommon.Models.Forces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Media3D;
namespace StructureHelper.Windows.ViewModels.Forces
{
public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo
{
IForceCombinationByFactor forceAction;
ForceTupleVM forceTupleVM;
public double ULSFactor
{
get => forceAction.ULSFactor;
set
{
forceAction.ULSFactor = value;
OnPropertyChanged(nameof(ULSFactor));
}
}
public ForceTupleVM ForceTupleVM => forceTupleVM;
public double LongTermFactor
{
get => forceAction.LongTermFactor;
set
{
if (value <0d) { value = 0d; }
if (value > 1d) { value = 1d; }
forceAction.LongTermFactor = value;
OnPropertyChanged(nameof(LongTermFactor));
}
}
public string Error => throw new NotImplementedException();
public string this[string columnName]
{
get
{
string error = null;
if (columnName == nameof(ULSFactor))
{
if (ULSFactor <= 0)
{
error = "Safety factor for ULS must be greater than zero";
}
}
if (columnName == nameof(LongTermFactor))
{
if (LongTermFactor < 0d || LongTermFactor > 1d)
{
error = "Long term factor must be between 0.0 and 1.0";
}
}
return error;
}
}
public ForceCombinationByFactorVM(IForceCombinationByFactor forceAction) : base(forceAction)
{
this.forceAction = forceAction;
forceTupleVM = new ForceTupleVM(forceAction.FullSLSForces);
}
}
}

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)

View File

@@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections
combination.DesignForces.Clear();
combination.DesignForces.AddRange(ForceCombinationListFactory.GetDesignForces(DesignForceType.Suit_1));
combinations.Add(combination);
var factorCombination = new ForceCombinationByFactor();
var factorCombination = new ForceFactoredList();
combinations.Add(factorCombination);
return combinations;
}

View File

@@ -69,8 +69,8 @@ namespace StructureHelperTests.UnitTests.UpdateStrategiesTests
var targetObjectMock = new Mock<IHasForceActions>();
var sourceObjectMock = new Mock<IHasForceActions>();
var sourceForceActions = new List<IForceAction> { new ForceCombinationByFactor(), new ForceCombinationByFactor() };
var clonedForceActions = new List<IForceAction> { new ForceCombinationByFactor(), new ForceCombinationByFactor() };
var sourceForceActions = new List<IForceAction> { new ForceFactoredList(), new ForceFactoredList() };
var clonedForceActions = new List<IForceAction> { new ForceFactoredList(), new ForceFactoredList() };
sourceObjectMock.SetupGet(s => s.ForceActions).Returns(sourceForceActions);
targetObjectMock.SetupGet(t => t.ForceActions).Returns(targetForceActions);