From 2621932109241700e19b4f9f5b662eda8d1f37c6 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 24 Sep 2024 11:34:02 +0200 Subject: [PATCH 01/53] Load interfaces --- Loads/ILoads/IAreaForce.cs | 13 +++++ Loads/ILoads/IAreaMoment.cs | 12 +++++ Loads/ILoads/IColumnLoad.cs | 10 ++++ Loads/ILoads/ILineForce.cs | 8 +++ Loads/ILoads/ILineForce2d.cs | 11 ++++ Loads/ILoads/ILoad.cs | 4 ++ Loads/ILoads/IPoint2dDisplacement.cs | 10 ++++ Loads/ILoads/IPoint2dForce.cs | 9 ++++ Loads/ILoads/IPoint2dMoment.cs | 10 ++++ Loads/ILoads/IPointDisplacement.cs | 9 ++++ Loads/ILoads/IPointForce.cs | 8 +++ Loads/ILoads/IPointMoment.cs | 9 ++++ Loads/ILoads/LoadApplication.cs | 9 ++++ .../ILoads/MagmaWorks.Taxonomy.ILoads.csproj | 51 +++++++++++++++++++ Taxonomy.sln | 11 +++- 15 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 Loads/ILoads/IAreaForce.cs create mode 100644 Loads/ILoads/IAreaMoment.cs create mode 100644 Loads/ILoads/IColumnLoad.cs create mode 100644 Loads/ILoads/ILineForce.cs create mode 100644 Loads/ILoads/ILineForce2d.cs create mode 100644 Loads/ILoads/ILoad.cs create mode 100644 Loads/ILoads/IPoint2dDisplacement.cs create mode 100644 Loads/ILoads/IPoint2dForce.cs create mode 100644 Loads/ILoads/IPoint2dMoment.cs create mode 100644 Loads/ILoads/IPointDisplacement.cs create mode 100644 Loads/ILoads/IPointForce.cs create mode 100644 Loads/ILoads/IPointMoment.cs create mode 100644 Loads/ILoads/LoadApplication.cs create mode 100644 Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj diff --git a/Loads/ILoads/IAreaForce.cs b/Loads/ILoads/IAreaForce.cs new file mode 100644 index 0000000..6d3cb7f --- /dev/null +++ b/Loads/ILoads/IAreaForce.cs @@ -0,0 +1,13 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IAreaForce : ILoad + { + Pressure X { get; } + Pressure Y { get; } + Pressure Z { get; } + bool IsProjected { get; } + bool IsLocal { get; } + } +} diff --git a/Loads/ILoads/IAreaMoment.cs b/Loads/ILoads/IAreaMoment.cs new file mode 100644 index 0000000..6d68813 --- /dev/null +++ b/Loads/ILoads/IAreaMoment.cs @@ -0,0 +1,12 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IAreaMoment : ILoad + { + Pressure Xx { get; } + Pressure Yy { get; } + Pressure Zz { get; } + LoadApplication Application { get; } + } +} diff --git a/Loads/ILoads/IColumnLoad.cs b/Loads/ILoads/IColumnLoad.cs new file mode 100644 index 0000000..aab0159 --- /dev/null +++ b/Loads/ILoads/IColumnLoad.cs @@ -0,0 +1,10 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IColumnLoad { + Force Force { get; } + IPoint2dMoment TopMoment { get; } + IPoint2dMoment BottomMoment { get; } + } +} diff --git a/Loads/ILoads/ILineForce.cs b/Loads/ILoads/ILineForce.cs new file mode 100644 index 0000000..31b1bb4 --- /dev/null +++ b/Loads/ILoads/ILineForce.cs @@ -0,0 +1,8 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ILineForce : ILine2dForce { + ForcePerLength Y { get; } + } +} diff --git a/Loads/ILoads/ILineForce2d.cs b/Loads/ILoads/ILineForce2d.cs new file mode 100644 index 0000000..1fc0073 --- /dev/null +++ b/Loads/ILoads/ILineForce2d.cs @@ -0,0 +1,11 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ILine2dForce : ILoad + { + ForcePerLength X { get; } + ForcePerLength Z { get; } + LoadApplication Application { get; } + } +} diff --git a/Loads/ILoads/ILoad.cs b/Loads/ILoads/ILoad.cs new file mode 100644 index 0000000..5927903 --- /dev/null +++ b/Loads/ILoads/ILoad.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ILoad { } +} diff --git a/Loads/ILoads/IPoint2dDisplacement.cs b/Loads/ILoads/IPoint2dDisplacement.cs new file mode 100644 index 0000000..e7c073c --- /dev/null +++ b/Loads/ILoads/IPoint2dDisplacement.cs @@ -0,0 +1,10 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPoint2dDisplacement : ILoad + { + Length X { get; } + Length Z { get; } + } +} diff --git a/Loads/ILoads/IPoint2dForce.cs b/Loads/ILoads/IPoint2dForce.cs new file mode 100644 index 0000000..b73be1c --- /dev/null +++ b/Loads/ILoads/IPoint2dForce.cs @@ -0,0 +1,9 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPoint2dForce : ILoad { + Force X { get; } + Force Z { get; } + } +} diff --git a/Loads/ILoads/IPoint2dMoment.cs b/Loads/ILoads/IPoint2dMoment.cs new file mode 100644 index 0000000..581e2b9 --- /dev/null +++ b/Loads/ILoads/IPoint2dMoment.cs @@ -0,0 +1,10 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPoint2dMoment : ILoad + { + Moment Yy { get; } + Moment Zz { get; } + } +} diff --git a/Loads/ILoads/IPointDisplacement.cs b/Loads/ILoads/IPointDisplacement.cs new file mode 100644 index 0000000..113fdd9 --- /dev/null +++ b/Loads/ILoads/IPointDisplacement.cs @@ -0,0 +1,9 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPointDisplacement : IPoint2dDisplacement + { + Length Y { get; } + } +} diff --git a/Loads/ILoads/IPointForce.cs b/Loads/ILoads/IPointForce.cs new file mode 100644 index 0000000..1b485fb --- /dev/null +++ b/Loads/ILoads/IPointForce.cs @@ -0,0 +1,8 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPointForce : IPoint2dForce { + Force Y { get; } + } +} diff --git a/Loads/ILoads/IPointMoment.cs b/Loads/ILoads/IPointMoment.cs new file mode 100644 index 0000000..db1a2a7 --- /dev/null +++ b/Loads/ILoads/IPointMoment.cs @@ -0,0 +1,9 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPointMoment : IPoint2dMoment + { + Moment Xx { get; } + } +} diff --git a/Loads/ILoads/LoadApplication.cs b/Loads/ILoads/LoadApplication.cs new file mode 100644 index 0000000..88e95ee --- /dev/null +++ b/Loads/ILoads/LoadApplication.cs @@ -0,0 +1,9 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public enum LoadApplication + { + Local, + Global, + Projected + } +} diff --git a/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj b/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj new file mode 100644 index 0000000..908ddd1 --- /dev/null +++ b/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj @@ -0,0 +1,51 @@ + + + + 0.0 + preview + + + + net48;netstandard2.0;net6.0;net7.0;net8.0 + 9.0 + AnyCPU + MagmaWorks.Taxonomy.Loads + + + + MagmaWorks Taxonomy Load Interfaces + Whitby Wood + README.md + MIT + https://github.com/MagmaWorks/Taxonomy/ + MagmaWorks.png + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + True + \ + + + True + \ + + + True + \Licenses\ + + + True + \ + + + + diff --git a/Taxonomy.sln b/Taxonomy.sln index 43798a2..fb09b59 100644 --- a/Taxonomy.sln +++ b/Taxonomy.sln @@ -61,7 +61,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.ISectio EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Sections", "Sections\Sections\MagmaWorks.Taxonomy.Sections.csproj", "{31167C8D-47E7-4C6B-848A-C6369BF89E76}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SectionTests", "Sections\SectionTests\SectionTests.csproj", "{1091E92F-A6F3-4B4F-939D-F2377B5D243D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SectionTests", "Sections\SectionTests\SectionTests.csproj", "{1091E92F-A6F3-4B4F-939D-F2377B5D243D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Loads", "Loads", "{41A2BC38-4EBB-4B17-A305-46BEEB81FE1C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.ILoads", "Loads\ILoads\MagmaWorks.Taxonomy.ILoads.csproj", "{7E1966E6-7497-40C0-8938-00196F4B75C7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -165,6 +169,10 @@ Global {1091E92F-A6F3-4B4F-939D-F2377B5D243D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1091E92F-A6F3-4B4F-939D-F2377B5D243D}.Release|Any CPU.ActiveCfg = Release|Any CPU {1091E92F-A6F3-4B4F-939D-F2377B5D243D}.Release|Any CPU.Build.0 = Release|Any CPU + {7E1966E6-7497-40C0-8938-00196F4B75C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E1966E6-7497-40C0-8938-00196F4B75C7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E1966E6-7497-40C0-8938-00196F4B75C7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E1966E6-7497-40C0-8938-00196F4B75C7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -194,6 +202,7 @@ Global {71CF9742-4D08-450F-B88D-EDF992D05381} = {69DBCCB8-FF7F-42B8-952C-8D4F09B0C4C4} {31167C8D-47E7-4C6B-848A-C6369BF89E76} = {69DBCCB8-FF7F-42B8-952C-8D4F09B0C4C4} {1091E92F-A6F3-4B4F-939D-F2377B5D243D} = {69DBCCB8-FF7F-42B8-952C-8D4F09B0C4C4} + {7E1966E6-7497-40C0-8938-00196F4B75C7} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {037E8DD3-6CB9-4A55-BB67-CD24D471F05A} From 2a911113392fe49e5edf2dd2ff4b2a324d67e9c3 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 24 Sep 2024 14:34:22 +0200 Subject: [PATCH 02/53] Interfaces cleanup --- Loads/ILoads/IAreaForce.cs | 3 +-- Loads/ILoads/IAreaMoment.cs | 12 ------------ Loads/ILoads/IColumnLoad.cs | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) delete mode 100644 Loads/ILoads/IAreaMoment.cs diff --git a/Loads/ILoads/IAreaForce.cs b/Loads/ILoads/IAreaForce.cs index 6d3cb7f..ede816b 100644 --- a/Loads/ILoads/IAreaForce.cs +++ b/Loads/ILoads/IAreaForce.cs @@ -7,7 +7,6 @@ public interface IAreaForce : ILoad Pressure X { get; } Pressure Y { get; } Pressure Z { get; } - bool IsProjected { get; } - bool IsLocal { get; } + LoadApplication Application { get; } } } diff --git a/Loads/ILoads/IAreaMoment.cs b/Loads/ILoads/IAreaMoment.cs deleted file mode 100644 index 6d68813..0000000 --- a/Loads/ILoads/IAreaMoment.cs +++ /dev/null @@ -1,12 +0,0 @@ -using OasysUnits; - -namespace MagmaWorks.Taxonomy.Loads -{ - public interface IAreaMoment : ILoad - { - Pressure Xx { get; } - Pressure Yy { get; } - Pressure Zz { get; } - LoadApplication Application { get; } - } -} diff --git a/Loads/ILoads/IColumnLoad.cs b/Loads/ILoads/IColumnLoad.cs index aab0159..fa8aef5 100644 --- a/Loads/ILoads/IColumnLoad.cs +++ b/Loads/ILoads/IColumnLoad.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IColumnLoad { + public interface IColumnLoad : ILoad { Force Force { get; } IPoint2dMoment TopMoment { get; } IPoint2dMoment BottomMoment { get; } From fa6886e032e58e4c47660e37edc2780950cd624a Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 24 Sep 2024 14:34:35 +0200 Subject: [PATCH 03/53] Concrete implementation of loads --- Loads/Loads/AreaForce.cs | 29 +++++++++++ Loads/Loads/ColumnLoad.cs | 28 ++++++++++ Loads/Loads/LineForce.cs | 26 +++++++++ Loads/Loads/LineForce2d.cs | 29 +++++++++++ Loads/Loads/MagmaWorks.Taxonomy.Loads.csproj | 55 ++++++++++++++++++++ Loads/Loads/Point2dDisplacement.cs | 18 +++++++ Loads/Loads/Point2dForce.cs | 27 ++++++++++ Loads/Loads/Point2dMoment.cs | 18 +++++++ Loads/Loads/PointDisplacement.cs | 16 ++++++ Loads/Loads/PointForce.cs | 20 +++++++ Loads/Loads/PointMoment.cs | 16 ++++++ 11 files changed, 282 insertions(+) create mode 100644 Loads/Loads/AreaForce.cs create mode 100644 Loads/Loads/ColumnLoad.cs create mode 100644 Loads/Loads/LineForce.cs create mode 100644 Loads/Loads/LineForce2d.cs create mode 100644 Loads/Loads/MagmaWorks.Taxonomy.Loads.csproj create mode 100644 Loads/Loads/Point2dDisplacement.cs create mode 100644 Loads/Loads/Point2dForce.cs create mode 100644 Loads/Loads/Point2dMoment.cs create mode 100644 Loads/Loads/PointDisplacement.cs create mode 100644 Loads/Loads/PointForce.cs create mode 100644 Loads/Loads/PointMoment.cs diff --git a/Loads/Loads/AreaForce.cs b/Loads/Loads/AreaForce.cs new file mode 100644 index 0000000..7f116cd --- /dev/null +++ b/Loads/Loads/AreaForce.cs @@ -0,0 +1,29 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class AreaForce : IAreaForce + { + public Pressure X { get; set; } = Pressure.Zero; + public Pressure Y { get; set; } = Pressure.Zero; + public Pressure Z { get; set; } = Pressure.Zero; + public LoadApplication Application { get; set; } = LoadApplication.Local; + + private AreaForce() { } + + public AreaForce(Pressure z) { + Z = z; + } + public AreaForce(Pressure x, Pressure y, Pressure z, LoadApplication application) { + X = x; + Y = y; + Z = z; + Application = application; + } + + public static implicit operator AreaForce(Pressure f) + { + return new AreaForce(f); + } + } +} diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs new file mode 100644 index 0000000..0b55972 --- /dev/null +++ b/Loads/Loads/ColumnLoad.cs @@ -0,0 +1,28 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class ColumnLoad : IColumnLoad { + public Force Force { get; set; } = Force.Zero; + public IPoint2dMoment TopMoment { get; set; } = new Point2dMoment(); + public IPoint2dMoment BottomMoment { get; set; } = new Point2dMoment(); + + private ColumnLoad() { } + + public ColumnLoad(Force force) { + Force = force; + } + + public ColumnLoad(Force force, IPoint2dMoment topMoment, IPoint2dMoment bottomMoment) + { + Force = force; + TopMoment = topMoment; + BottomMoment = bottomMoment; + } + + public static implicit operator ColumnLoad(Force f) + { + return new ColumnLoad(f); + } + } +} diff --git a/Loads/Loads/LineForce.cs b/Loads/Loads/LineForce.cs new file mode 100644 index 0000000..23574d7 --- /dev/null +++ b/Loads/Loads/LineForce.cs @@ -0,0 +1,26 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class LineForce : Line2dForce, ILineForce { + + public ForcePerLength Y { get; } = ForcePerLength.Zero; + + private LineForce() { } + + public LineForce(ForcePerLength z) : base(z) { } + + public LineForce(ForcePerLength x, ForcePerLength y, ForcePerLength z, LoadApplication application) + { + X = x; + Y = y; + Z = z; + Application = application; + } + + public static implicit operator LineForce(ForcePerLength f) + { + return new LineForce(f); + } + } +} diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs new file mode 100644 index 0000000..4a4aaf6 --- /dev/null +++ b/Loads/Loads/LineForce2d.cs @@ -0,0 +1,29 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class Line2dForce : ILine2dForce + { + public ForcePerLength X { get; set; } = ForcePerLength.Zero; + public ForcePerLength Z { get; set; } = ForcePerLength.Zero; + public LoadApplication Application { get; set;} = LoadApplication.Global; + + internal Line2dForce() { } + + public Line2dForce(ForcePerLength z) + { + Z = z; + } + + public Line2dForce(ForcePerLength x, ForcePerLength z, LoadApplication application) { + X = x; + Z = z; + Application = application; + } + + public static implicit operator Line2dForce(ForcePerLength f) + { + return new Line2dForce(f); + } + } +} diff --git a/Loads/Loads/MagmaWorks.Taxonomy.Loads.csproj b/Loads/Loads/MagmaWorks.Taxonomy.Loads.csproj new file mode 100644 index 0000000..5335efd --- /dev/null +++ b/Loads/Loads/MagmaWorks.Taxonomy.Loads.csproj @@ -0,0 +1,55 @@ + + + + 0.0 + preview + + + + net48;netstandard2.0;net6.0;net7.0;net8.0 + 9.0 + AnyCPU + MagmaWorks.Taxonomy.Loads + + + + MagmaWorks Taxonomy Loads + Whitby Wood + README.md + MIT + https://github.com/MagmaWorks/Taxonomy/ + MagmaWorks.png + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + True + \ + + + True + \ + + + True + \Licenses\ + + + True + \ + + + + + + + + diff --git a/Loads/Loads/Point2dDisplacement.cs b/Loads/Loads/Point2dDisplacement.cs new file mode 100644 index 0000000..26d380c --- /dev/null +++ b/Loads/Loads/Point2dDisplacement.cs @@ -0,0 +1,18 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class Point2dDisplacement : IPoint2dDisplacement + { + public Length X { get; set; } = Length.Zero; + public Length Z { get; set; } = Length.Zero; + + internal Point2dDisplacement() { } + + public Point2dDisplacement(Length x, Length z) + { + X = x; + Z = z; + } + } +} diff --git a/Loads/Loads/Point2dForce.cs b/Loads/Loads/Point2dForce.cs new file mode 100644 index 0000000..943fca8 --- /dev/null +++ b/Loads/Loads/Point2dForce.cs @@ -0,0 +1,27 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class Point2dForce : IPoint2dForce + { + public Force X { get; set; } = Force.Zero; + public Force Z { get; set; } = Force.Zero; + + internal Point2dForce() { } + + public Point2dForce(Force z) { + Z = z; + } + + public Point2dForce(Force x, Force z) + { + X = x; + Z = z; + } + + public static implicit operator Point2dForce(Force f) + { + return new Point2dForce(f); + } + } +} diff --git a/Loads/Loads/Point2dMoment.cs b/Loads/Loads/Point2dMoment.cs new file mode 100644 index 0000000..6dbd0f9 --- /dev/null +++ b/Loads/Loads/Point2dMoment.cs @@ -0,0 +1,18 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class Point2dMoment : IPoint2dMoment + { + public Moment Yy { get; set; } = Moment.Zero; + public Moment Zz { get; set; } = Moment.Zero; + + internal Point2dMoment() { } + + public Point2dMoment(Moment yy, Moment zz) + { + Yy = yy; + Zz = zz; + } + } +} diff --git a/Loads/Loads/PointDisplacement.cs b/Loads/Loads/PointDisplacement.cs new file mode 100644 index 0000000..9ded8ae --- /dev/null +++ b/Loads/Loads/PointDisplacement.cs @@ -0,0 +1,16 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class PointDisplacement : Point2dDisplacement, IPointDisplacement + { + public Length Y { get; set; } = Length.Zero; + + public PointDisplacement(Length x, Length y, Length z) + { + X = x; + Y = y; + Z = z; + } + } +} diff --git a/Loads/Loads/PointForce.cs b/Loads/Loads/PointForce.cs new file mode 100644 index 0000000..a9c3170 --- /dev/null +++ b/Loads/Loads/PointForce.cs @@ -0,0 +1,20 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class PointForce : Point2dForce, IPointForce + { + public Force Y { get; set; } = Force.Zero; + + public PointForce(Force x, Force y, Force z) { + X = x; + Y = y; + Z = z; + } + + public static implicit operator PointForce(Force f) + { + return new PointForce(Force.Zero, Force.Zero, f); + } + } +} diff --git a/Loads/Loads/PointMoment.cs b/Loads/Loads/PointMoment.cs new file mode 100644 index 0000000..5ed7850 --- /dev/null +++ b/Loads/Loads/PointMoment.cs @@ -0,0 +1,16 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class PointMoment : Point2dMoment, IPointMoment + { + public Moment Xx { get; set; } = Moment.Zero; + + public PointMoment(Moment xx, Moment yy, Moment zz) + { + Xx = xx; + Yy = yy; + Zz = zz; + } + } +} From 92d23c7a9ee97cc8a655a0aa7d22a5c314c56e01 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 24 Sep 2024 14:34:42 +0200 Subject: [PATCH 04/53] Serialization and tests --- Loads/LoadTests/AutomatedTests.cs | 247 ++++++++++++++++++ Loads/LoadTests/GlobalUsings.cs | 1 + Loads/LoadTests/LoadTests.csproj | 28 ++ Loads/LoadTests/UseCultureAttribute.cs | 83 ++++++ Loads/LoadTests/xunit.runner.json | 4 + Loads/Serialization/JsonSerializerSettings.cs | 23 ++ ...aWorks.Taxonomy.Loads.Serialization.csproj | 60 +++++ .../ProfileJsonSerializationExtensions.cs | 18 ++ Taxonomy.sln | 23 +- 9 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 Loads/LoadTests/AutomatedTests.cs create mode 100644 Loads/LoadTests/GlobalUsings.cs create mode 100644 Loads/LoadTests/LoadTests.csproj create mode 100644 Loads/LoadTests/UseCultureAttribute.cs create mode 100644 Loads/LoadTests/xunit.runner.json create mode 100644 Loads/Serialization/JsonSerializerSettings.cs create mode 100644 Loads/Serialization/MagmaWorks.Taxonomy.Loads.Serialization.csproj create mode 100644 Loads/Serialization/ProfileJsonSerializationExtensions.cs diff --git a/Loads/LoadTests/AutomatedTests.cs b/Loads/LoadTests/AutomatedTests.cs new file mode 100644 index 0000000..a8bcf7e --- /dev/null +++ b/Loads/LoadTests/AutomatedTests.cs @@ -0,0 +1,247 @@ +using System.Collections; +using System.Reflection; +using System.Runtime.CompilerServices; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Serialization; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class AutomatedTests + { + // Add classes here that has complex constructors (e.i throws exceptions) + // Add manual tests of these class' constructors instead + private static readonly List _excludedTypes = + [ + + ]; + + // static inputs used to populate constructor variables + private static string _string { get { return "lava"; } } + private static int _int { get { return 42; } } + private static double _double { get { return 9.8; } } + private static bool _bool { get { return true; } } + private static byte _byte { get { return 3; } } + private static Length _length { get { return new Length(2.5, LengthUnit.Centimeter); } } + private static Angle _angle { get { return new Angle(33, AngleUnit.Degree); } } + private static Force _force { get { return new Force(11.5, ForceUnit.Kilonewton); } } + private static Moment _moment { get { return new Moment(140, MomentUnit.KilonewtonMeter); } } + private static ForcePerLength _forcePerLength { get { return new ForcePerLength(-15.2, ForcePerLengthUnit.KilonewtonPerMeter); } } + private static Pressure _forcePerArea { get { return new Pressure(-105.4, PressureUnit.KilonewtonPerSquareMeter); } } + + [Theory] + [ClassData(typeof(TestDataGenerator))] + public void ConstructorTest(Type type) + { + ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public); + foreach (ConstructorInfo constructor in constructors) + { + object[] args = CreateConstructorArguments(constructor); + object instance = constructor.Invoke(args); + Assert.NotNull(instance); + TestObjectsPropertiesAreNotNull(instance); + } + } + + [Theory] + [ClassData(typeof(TestDataGenerator))] + public void DeserializeTest(Type type) + { + ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public); + foreach (ConstructorInfo constructor in constructors) + { + object[] args = CreateConstructorArguments(constructor); + ILoad instance = (ILoad)constructor.Invoke(args); + Assert.NotNull(instance); + TestObjectsSurvivesJsonRoundtrip(instance); + } + } + + public class TestDataGenerator : IEnumerable + { + private readonly List _data = GetAllComponents(); + + public IEnumerator GetEnumerator() + { + return _data.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + private static List GetAllComponents() + { + var data = new List(); + Type[] typelist = Assembly.GetAssembly(typeof(Point2dForce)).GetTypes(); + foreach (Type type in typelist) + { + if (type.Namespace == null) + { + continue; + } + + if (type.Namespace.StartsWith("MagmaWorks.Taxonomy") + && type.BaseType.Name != "Enum" + && !_excludedTypes.Contains(type) + && type.Attributes.HasFlag(TypeAttributes.Public) + && !type.Attributes.HasFlag(TypeAttributes.Abstract) + && !type.Attributes.HasFlag(TypeAttributes.Interface) + && type.GetCustomAttribute(typeof(CompilerGeneratedAttribute), true) == null) + { + data.Add([type]); + } + } + + return data; + } + } + + private void TestObjectsPropertiesAreNotNull(object obj) + { + PropertyInfo[] propertyInfo = obj.GetType().GetProperties( + BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); + foreach (PropertyInfo property in propertyInfo) + { + Assert.NotNull(property.GetValue(obj)); + } + } + + private void TestObjectsSurvivesJsonRoundtrip(T obj) where T : ILoad + { + string json = obj.ToJson(); + Assert.NotNull(json); + Assert.True(json.Length > 0); + T deserialized = json.FromJson(); + Assert.NotNull(deserialized); + TestPropertiesInObjectsAreEqual(obj, deserialized); + } + + private void TestPropertiesInObjectsAreEqual(T expected, T actual) where T : ILoad + { + PropertyInfo[] expectedProperties = expected.GetType().GetProperties( + BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); + PropertyInfo[] actualProperties = actual.GetType().GetProperties( + BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); + Assert.Equal(expectedProperties.Length, actualProperties.Length); + for (int i = 0; i < expectedProperties.Length; i++) + { + Assert.Equal(expectedProperties[i], actualProperties[i]); + } + } + + private object[] CreateConstructorArguments(ConstructorInfo constructor) + { + ParameterInfo[] parameters = constructor.GetParameters(); + var args = new List(); + foreach (ParameterInfo parameter in parameters) + { + Type type = parameter.ParameterType; + // check if parameter is primitive type + switch (Type.GetTypeCode(type)) + { + case TypeCode.Int32: + args.Add(_int); + continue; + + case TypeCode.String: + args.Add(_string); + continue; + + case TypeCode.Double: + args.Add(_double); + continue; + + case TypeCode.Boolean: + args.Add(_bool); + continue; + + case TypeCode.Byte: + args.Add(_byte); + continue; + } + + // check if type is IQuanty type + if (typeof(IQuantity).IsAssignableFrom(type)) + { + switch (type.Name) + { + case "Length": + args.Add(_length); + continue; + + case "Angle": + args.Add(_angle); + continue; + + case "Force": + args.Add(_force); + continue; + + case "ForcePerLength": + args.Add(_forcePerLength); + continue; + + case "Moment": + args.Add(_moment); + continue; + + case "Pressure": + args.Add(_forcePerArea); + continue; + } + } + + // check if type is IList type + Type[] genericArguments = type.GetGenericArguments(); + if (genericArguments.Length == 1) + { + Type listType = typeof(IList<>).MakeGenericType(genericArguments); + if (listType.IsAssignableFrom(type)) + { + dynamic list = CreateGenericList(typeof(List<>), genericArguments[0]); + dynamic objectInstance = CreateObjectInstance(genericArguments[0]); + list.Add(objectInstance); + args.Add(list); + continue; + } + } + + // use the types constructor + args.Add(CreateObjectInstance(type)); + } + + return args.ToArray(); + } + + private dynamic CreateObjectInstance(Type type) + { + if (type.IsInterface == false) + { + ConstructorInfo ctor = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public)[0]; + object[] args = CreateConstructorArguments(ctor); + return ctor.Invoke(args); + } + + // reflect on assembly to find concrete implementation of interface + Type[] typelist = Assembly.GetAssembly(typeof(Point2dForce)).GetTypes(); + foreach (Type concreteType in typelist) + { + if (type.IsAssignableFrom(concreteType)) + { + return CreateObjectInstance(concreteType); + } + } + + throw new NotImplementedException($"Could not find concrete implementation of type {type}"); + } + + public static dynamic CreateGenericList(Type generic, Type innerType, params object[] args) + { + Type specificType = generic.MakeGenericType(new Type[] { innerType }); + return Activator.CreateInstance(specificType, args); + } + } +} diff --git a/Loads/LoadTests/GlobalUsings.cs b/Loads/LoadTests/GlobalUsings.cs new file mode 100644 index 0000000..c802f44 --- /dev/null +++ b/Loads/LoadTests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; diff --git a/Loads/LoadTests/LoadTests.csproj b/Loads/LoadTests/LoadTests.csproj new file mode 100644 index 0000000..13d3072 --- /dev/null +++ b/Loads/LoadTests/LoadTests.csproj @@ -0,0 +1,28 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + + + + + + + + + + + + + diff --git a/Loads/LoadTests/UseCultureAttribute.cs b/Loads/LoadTests/UseCultureAttribute.cs new file mode 100644 index 0000000..97aec30 --- /dev/null +++ b/Loads/LoadTests/UseCultureAttribute.cs @@ -0,0 +1,83 @@ +using System.Globalization; +using System.Reflection; +using Xunit.Sdk; + +/// +/// Apply this attribute to your test method to replace the +/// and +/// with another culture. +/// +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, + Inherited = true)] +public class UseCultureAttribute : BeforeAfterTestAttribute +{ + /// + /// Gets the culture. + /// + public CultureInfo Culture => _culture.Value; + /// + /// Gets the UI culture. + /// + public CultureInfo UiCulture => _uiCulture.Value; + private readonly Lazy _culture; + private readonly Lazy _uiCulture; + private CultureInfo _originalCulture; + private CultureInfo _originalUiCulture; + + /// + /// Replaces the culture and UI culture of the current thread with + /// + /// + /// The name of the culture. + /// + /// + /// This constructor overload uses for both + /// and . + /// + /// + public UseCultureAttribute(string culture) : this(culture, culture) { } + + /// + /// Replaces the culture and UI culture of the current thread with + /// and + /// + /// The name of the culture. + /// The name of the UI culture. + public UseCultureAttribute(string culture, string uiCulture) + { + _culture = new Lazy(() => new CultureInfo(culture, false)); + _uiCulture = new Lazy(() => new CultureInfo(uiCulture, false)); + } + + /// + /// Restores the original and + /// to + /// + /// The method under test + public override void After(MethodInfo methodUnderTest) + { + Thread.CurrentThread.CurrentCulture = _originalCulture; + Thread.CurrentThread.CurrentUICulture = _originalUiCulture; + + CultureInfo.CurrentCulture.ClearCachedData(); + CultureInfo.CurrentUICulture.ClearCachedData(); + } + + /// + /// Stores the current + /// and + /// and replaces them with the new cultures defined in the constructor. + /// + /// The method under test + public override void Before(MethodInfo methodUnderTest) + { + _originalCulture = Thread.CurrentThread.CurrentCulture; + _originalUiCulture = Thread.CurrentThread.CurrentUICulture; + + Thread.CurrentThread.CurrentCulture = Culture; + Thread.CurrentThread.CurrentUICulture = UiCulture; + + CultureInfo.CurrentCulture.ClearCachedData(); + CultureInfo.CurrentUICulture.ClearCachedData(); + } +} diff --git a/Loads/LoadTests/xunit.runner.json b/Loads/LoadTests/xunit.runner.json new file mode 100644 index 0000000..2b65d19 --- /dev/null +++ b/Loads/LoadTests/xunit.runner.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "appDomain": "denied" +} diff --git a/Loads/Serialization/JsonSerializerSettings.cs b/Loads/Serialization/JsonSerializerSettings.cs new file mode 100644 index 0000000..cea0ed2 --- /dev/null +++ b/Loads/Serialization/JsonSerializerSettings.cs @@ -0,0 +1,23 @@ +using Newtonsoft.Json; + +namespace MagmaWorks.Taxonomy.Serialization +{ + internal static class TaxonomyJsonSerializer + { + internal static JsonSerializerSettings Settings + { + get + { + var settings = new JsonSerializerSettings + { + Converters = { + new OasysUnits.Serialization.JsonNet.OasysUnitsIQuantityJsonConverter(), + }, + TypeNameHandling = TypeNameHandling.Objects, + TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple + }; + return settings; + } + } + } +} diff --git a/Loads/Serialization/MagmaWorks.Taxonomy.Loads.Serialization.csproj b/Loads/Serialization/MagmaWorks.Taxonomy.Loads.Serialization.csproj new file mode 100644 index 0000000..dcb1cc1 --- /dev/null +++ b/Loads/Serialization/MagmaWorks.Taxonomy.Loads.Serialization.csproj @@ -0,0 +1,60 @@ + + + + 0.0 + preview + + + + net48;netstandard2.0;net6.0;net7.0;net8.0 + 9.0 + AnyCPU + MagmaWorks.Taxonomy.Loads.Serialization + + + + MagmaWorks Taxonomy Serialization Loads + Whitby Wood + README.md + MIT + https://github.com/MagmaWorks/Taxonomy/ + MagmaWorks.png + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + True + \ + + + True + \ + + + True + \Licenses\ + + + True + \Licenses\ + + + True + \ + + + + diff --git a/Loads/Serialization/ProfileJsonSerializationExtensions.cs b/Loads/Serialization/ProfileJsonSerializationExtensions.cs new file mode 100644 index 0000000..475530a --- /dev/null +++ b/Loads/Serialization/ProfileJsonSerializationExtensions.cs @@ -0,0 +1,18 @@ +using MagmaWorks.Taxonomy.Serialization; +using Newtonsoft.Json; + +namespace MagmaWorks.Taxonomy.Loads.Serialization +{ + public static class LoadJsonSerializationExtensions + { + public static string ToJson(this T load) where T : ILoad + { + return JsonConvert.SerializeObject(load, Formatting.Indented, TaxonomyJsonSerializer.Settings); + } + + public static T FromJson(this string json) where T : ILoad + { + return JsonConvert.DeserializeObject(json, TaxonomyJsonSerializer.Settings); + } + } +} diff --git a/Taxonomy.sln b/Taxonomy.sln index fb09b59..91c5ca6 100644 --- a/Taxonomy.sln +++ b/Taxonomy.sln @@ -65,7 +65,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SectionTests", "Sections\Se EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Loads", "Loads", "{41A2BC38-4EBB-4B17-A305-46BEEB81FE1C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.ILoads", "Loads\ILoads\MagmaWorks.Taxonomy.ILoads.csproj", "{7E1966E6-7497-40C0-8938-00196F4B75C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.ILoads", "Loads\ILoads\MagmaWorks.Taxonomy.ILoads.csproj", "{7E1966E6-7497-40C0-8938-00196F4B75C7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Loads", "Loads\Loads\MagmaWorks.Taxonomy.Loads.csproj", "{2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Loads.Serialization", "Loads\Serialization\MagmaWorks.Taxonomy.Loads.Serialization.csproj", "{0DB384BD-6270-4A1D-95D4-ED3972AE63B0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTests", "Loads\LoadTests\LoadTests.csproj", "{D9EF311B-6C73-4EA3-9F87-63D660C24CEE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -173,6 +179,18 @@ Global {7E1966E6-7497-40C0-8938-00196F4B75C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E1966E6-7497-40C0-8938-00196F4B75C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {7E1966E6-7497-40C0-8938-00196F4B75C7}.Release|Any CPU.Build.0 = Release|Any CPU + {2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B}.Release|Any CPU.Build.0 = Release|Any CPU + {0DB384BD-6270-4A1D-95D4-ED3972AE63B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DB384BD-6270-4A1D-95D4-ED3972AE63B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DB384BD-6270-4A1D-95D4-ED3972AE63B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DB384BD-6270-4A1D-95D4-ED3972AE63B0}.Release|Any CPU.Build.0 = Release|Any CPU + {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -203,6 +221,9 @@ Global {31167C8D-47E7-4C6B-848A-C6369BF89E76} = {69DBCCB8-FF7F-42B8-952C-8D4F09B0C4C4} {1091E92F-A6F3-4B4F-939D-F2377B5D243D} = {69DBCCB8-FF7F-42B8-952C-8D4F09B0C4C4} {7E1966E6-7497-40C0-8938-00196F4B75C7} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} + {2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} + {0DB384BD-6270-4A1D-95D4-ED3972AE63B0} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} + {D9EF311B-6C73-4EA3-9F87-63D660C24CEE} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {037E8DD3-6CB9-4A55-BB67-CD24D471F05A} From 58e20f8b8a6f116af1023c6e8721ef073efd3223 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 24 Sep 2024 12:37:54 +0000 Subject: [PATCH 05/53] Fix code style issues with dotnet_format --- Loads/ILoads/IColumnLoad.cs | 3 ++- Loads/ILoads/ILineForce.cs | 3 ++- Loads/ILoads/IPoint2dForce.cs | 3 ++- Loads/ILoads/IPointForce.cs | 3 ++- Loads/Loads/AreaForce.cs | 6 ++++-- Loads/Loads/ColumnLoad.cs | 6 ++++-- Loads/Loads/LineForce.cs | 3 ++- Loads/Loads/LineForce2d.cs | 5 +++-- Loads/Loads/Point2dForce.cs | 3 ++- Loads/Loads/PointForce.cs | 3 ++- 10 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Loads/ILoads/IColumnLoad.cs b/Loads/ILoads/IColumnLoad.cs index fa8aef5..705e92d 100644 --- a/Loads/ILoads/IColumnLoad.cs +++ b/Loads/ILoads/IColumnLoad.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IColumnLoad : ILoad { + public interface IColumnLoad : ILoad + { Force Force { get; } IPoint2dMoment TopMoment { get; } IPoint2dMoment BottomMoment { get; } diff --git a/Loads/ILoads/ILineForce.cs b/Loads/ILoads/ILineForce.cs index 31b1bb4..ee25521 100644 --- a/Loads/ILoads/ILineForce.cs +++ b/Loads/ILoads/ILineForce.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ILineForce : ILine2dForce { + public interface ILineForce : ILine2dForce + { ForcePerLength Y { get; } } } diff --git a/Loads/ILoads/IPoint2dForce.cs b/Loads/ILoads/IPoint2dForce.cs index b73be1c..dd40be8 100644 --- a/Loads/ILoads/IPoint2dForce.cs +++ b/Loads/ILoads/IPoint2dForce.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPoint2dForce : ILoad { + public interface IPoint2dForce : ILoad + { Force X { get; } Force Z { get; } } diff --git a/Loads/ILoads/IPointForce.cs b/Loads/ILoads/IPointForce.cs index 1b485fb..34e5324 100644 --- a/Loads/ILoads/IPointForce.cs +++ b/Loads/ILoads/IPointForce.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPointForce : IPoint2dForce { + public interface IPointForce : IPoint2dForce + { Force Y { get; } } } diff --git a/Loads/Loads/AreaForce.cs b/Loads/Loads/AreaForce.cs index 7f116cd..ac321ac 100644 --- a/Loads/Loads/AreaForce.cs +++ b/Loads/Loads/AreaForce.cs @@ -11,10 +11,12 @@ public class AreaForce : IAreaForce private AreaForce() { } - public AreaForce(Pressure z) { + public AreaForce(Pressure z) + { Z = z; } - public AreaForce(Pressure x, Pressure y, Pressure z, LoadApplication application) { + public AreaForce(Pressure x, Pressure y, Pressure z, LoadApplication application) + { X = x; Y = y; Z = z; diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs index 0b55972..7270f19 100644 --- a/Loads/Loads/ColumnLoad.cs +++ b/Loads/Loads/ColumnLoad.cs @@ -2,14 +2,16 @@ namespace MagmaWorks.Taxonomy.Loads { - public class ColumnLoad : IColumnLoad { + public class ColumnLoad : IColumnLoad + { public Force Force { get; set; } = Force.Zero; public IPoint2dMoment TopMoment { get; set; } = new Point2dMoment(); public IPoint2dMoment BottomMoment { get; set; } = new Point2dMoment(); private ColumnLoad() { } - public ColumnLoad(Force force) { + public ColumnLoad(Force force) + { Force = force; } diff --git a/Loads/Loads/LineForce.cs b/Loads/Loads/LineForce.cs index 23574d7..277d030 100644 --- a/Loads/Loads/LineForce.cs +++ b/Loads/Loads/LineForce.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public class LineForce : Line2dForce, ILineForce { + public class LineForce : Line2dForce, ILineForce + { public ForcePerLength Y { get; } = ForcePerLength.Zero; diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs index 4a4aaf6..5e06c45 100644 --- a/Loads/Loads/LineForce2d.cs +++ b/Loads/Loads/LineForce2d.cs @@ -6,7 +6,7 @@ public class Line2dForce : ILine2dForce { public ForcePerLength X { get; set; } = ForcePerLength.Zero; public ForcePerLength Z { get; set; } = ForcePerLength.Zero; - public LoadApplication Application { get; set;} = LoadApplication.Global; + public LoadApplication Application { get; set; } = LoadApplication.Global; internal Line2dForce() { } @@ -15,7 +15,8 @@ public Line2dForce(ForcePerLength z) Z = z; } - public Line2dForce(ForcePerLength x, ForcePerLength z, LoadApplication application) { + public Line2dForce(ForcePerLength x, ForcePerLength z, LoadApplication application) + { X = x; Z = z; Application = application; diff --git a/Loads/Loads/Point2dForce.cs b/Loads/Loads/Point2dForce.cs index 943fca8..a6cf0b0 100644 --- a/Loads/Loads/Point2dForce.cs +++ b/Loads/Loads/Point2dForce.cs @@ -9,7 +9,8 @@ public class Point2dForce : IPoint2dForce internal Point2dForce() { } - public Point2dForce(Force z) { + public Point2dForce(Force z) + { Z = z; } diff --git a/Loads/Loads/PointForce.cs b/Loads/Loads/PointForce.cs index a9c3170..548d6c3 100644 --- a/Loads/Loads/PointForce.cs +++ b/Loads/Loads/PointForce.cs @@ -6,7 +6,8 @@ public class PointForce : Point2dForce, IPointForce { public Force Y { get; set; } = Force.Zero; - public PointForce(Force x, Force y, Force z) { + public PointForce(Force x, Force y, Force z) + { X = x; Y = y; Z = z; From 31baa4cf10eb7b7b9bcc7e3d0d39a2bb6e7c8ff3 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 24 Sep 2024 19:36:33 +0200 Subject: [PATCH 06/53] implicit operator (cast) tests --- Loads/LoadTests/AreaForceTests.cs | 22 ++++++++++++++++++++++ Loads/LoadTests/ColumnLoadTests.cs | 22 ++++++++++++++++++++++ Loads/LoadTests/Line2dForceTests.cs | 22 ++++++++++++++++++++++ Loads/LoadTests/LineForceTests.cs | 22 ++++++++++++++++++++++ Loads/LoadTests/Point2dForceTests.cs | 22 ++++++++++++++++++++++ Loads/LoadTests/PointForceTests.cs | 22 ++++++++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 Loads/LoadTests/AreaForceTests.cs create mode 100644 Loads/LoadTests/ColumnLoadTests.cs create mode 100644 Loads/LoadTests/Line2dForceTests.cs create mode 100644 Loads/LoadTests/LineForceTests.cs create mode 100644 Loads/LoadTests/Point2dForceTests.cs create mode 100644 Loads/LoadTests/PointForceTests.cs diff --git a/Loads/LoadTests/AreaForceTests.cs b/Loads/LoadTests/AreaForceTests.cs new file mode 100644 index 0000000..f1630d3 --- /dev/null +++ b/Loads/LoadTests/AreaForceTests.cs @@ -0,0 +1,22 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class AreaForceTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new Pressure(15.4, PressureUnit.KilonewtonPerSquareMeter); + + // Act + AreaForce load = (AreaForce)f; + + // Assert + Assert.Equal(f, load.Z); + } + } +} diff --git a/Loads/LoadTests/ColumnLoadTests.cs b/Loads/LoadTests/ColumnLoadTests.cs new file mode 100644 index 0000000..5af5a18 --- /dev/null +++ b/Loads/LoadTests/ColumnLoadTests.cs @@ -0,0 +1,22 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class ColumnLoadTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + + // Act + ColumnLoad load = (ColumnLoad)f; + + // Assert + Assert.Equal(f, load.Force); + } + } +} diff --git a/Loads/LoadTests/Line2dForceTests.cs b/Loads/LoadTests/Line2dForceTests.cs new file mode 100644 index 0000000..bb1a946 --- /dev/null +++ b/Loads/LoadTests/Line2dForceTests.cs @@ -0,0 +1,22 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class Line2dForceTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new ForcePerLength(15.4, ForcePerLengthUnit.KilonewtonPerMeter); + + // Act + Line2dForce load = (Line2dForce)f; + + // Assert + Assert.Equal(f, load.Z); + } + } +} diff --git a/Loads/LoadTests/LineForceTests.cs b/Loads/LoadTests/LineForceTests.cs new file mode 100644 index 0000000..b11d0e0 --- /dev/null +++ b/Loads/LoadTests/LineForceTests.cs @@ -0,0 +1,22 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class LineForceTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new ForcePerLength(15.4, ForcePerLengthUnit.KilonewtonPerMeter); + + // Act + LineForce load = (LineForce)f; + + // Assert + Assert.Equal(f, load.Z); + } + } +} diff --git a/Loads/LoadTests/Point2dForceTests.cs b/Loads/LoadTests/Point2dForceTests.cs new file mode 100644 index 0000000..4fa061a --- /dev/null +++ b/Loads/LoadTests/Point2dForceTests.cs @@ -0,0 +1,22 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class Point2dForceTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + + // Act + Point2dForce load = (Point2dForce)f; + + // Assert + Assert.Equal(f, load.Z); + } + } +} diff --git a/Loads/LoadTests/PointForceTests.cs b/Loads/LoadTests/PointForceTests.cs new file mode 100644 index 0000000..b3c0f4f --- /dev/null +++ b/Loads/LoadTests/PointForceTests.cs @@ -0,0 +1,22 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class PointForceTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + + // Act + PointForce load = (PointForce)f; + + // Assert + Assert.Equal(f, load.Z); + } + } +} From 519ad60fcd10875499104a154e2a8231aa957073 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 09:50:16 +0200 Subject: [PATCH 07/53] Load cases and combinations WIP --- Loads/ICases/ICase.cs | 4 ++ Loads/ICases/LimitState.cs | 10 ++++ Loads/ICases/LoadCase/ILoadCase.cs | 9 +++ Loads/ICases/LoadCase/IPermanentCase.cs | 10 ++++ Loads/ICases/LoadCase/IVariableCase.cs | 11 ++++ .../ICases/MagmaWorks.Taxonomy.ICases.csproj | 55 +++++++++++++++++++ Taxonomy.sln | 7 +++ 7 files changed, 106 insertions(+) create mode 100644 Loads/ICases/ICase.cs create mode 100644 Loads/ICases/LimitState.cs create mode 100644 Loads/ICases/LoadCase/ILoadCase.cs create mode 100644 Loads/ICases/LoadCase/IPermanentCase.cs create mode 100644 Loads/ICases/LoadCase/IVariableCase.cs create mode 100644 Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj diff --git a/Loads/ICases/ICase.cs b/Loads/ICases/ICase.cs new file mode 100644 index 0000000..f47014e --- /dev/null +++ b/Loads/ICases/ICase.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ICase { } +} diff --git a/Loads/ICases/LimitState.cs b/Loads/ICases/LimitState.cs new file mode 100644 index 0000000..8d49026 --- /dev/null +++ b/Loads/ICases/LimitState.cs @@ -0,0 +1,10 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public enum LimitState + { + Ultimate, + Serviceability, + Accidental, + Seismic + } +} diff --git a/Loads/ICases/LoadCase/ILoadCase.cs b/Loads/ICases/LoadCase/ILoadCase.cs new file mode 100644 index 0000000..ab21ee6 --- /dev/null +++ b/Loads/ICases/LoadCase/ILoadCase.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ILoadCase : ICase + { + IList Loads { get; } + } +} diff --git a/Loads/ICases/LoadCase/IPermanentCase.cs b/Loads/ICases/LoadCase/IPermanentCase.cs new file mode 100644 index 0000000..696e49b --- /dev/null +++ b/Loads/ICases/LoadCase/IPermanentCase.cs @@ -0,0 +1,10 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IPermanentCase : ILoadCase + { + Ratio Unfavourable { get; } + Ratio Favourable { get; } + } +} diff --git a/Loads/ICases/LoadCase/IVariableCase.cs b/Loads/ICases/LoadCase/IVariableCase.cs new file mode 100644 index 0000000..ee9285d --- /dev/null +++ b/Loads/ICases/LoadCase/IVariableCase.cs @@ -0,0 +1,11 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IVariableCase : ILoadCase + { + Ratio Characteristic { get; } // ψ_0 + Ratio Frequent { get; } // ψ_1 + Ratio QuasiPermanent { get; } // ψ_2 + } +} diff --git a/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj b/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj new file mode 100644 index 0000000..04b34d0 --- /dev/null +++ b/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj @@ -0,0 +1,55 @@ + + + + 0.0 + preview + + + + net48;netstandard2.0;net6.0;net7.0;net8.0 + 9.0 + AnyCPU + MagmaWorks.Taxonomy.Loads + + + + MagmaWorks Taxonomy Load Case Interfaces + Whitby Wood + README.md + MIT + https://github.com/MagmaWorks/Taxonomy/ + MagmaWorks.png + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + True + \ + + + True + \ + + + True + \Licenses\ + + + True + \ + + + + + + + + diff --git a/Taxonomy.sln b/Taxonomy.sln index 91c5ca6..0c8b147 100644 --- a/Taxonomy.sln +++ b/Taxonomy.sln @@ -73,6 +73,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Loads.S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTests", "Loads\LoadTests\LoadTests.csproj", "{D9EF311B-6C73-4EA3-9F87-63D660C24CEE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.ICases", "Loads\ICases\MagmaWorks.Taxonomy.ICases.csproj", "{6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -191,6 +193,10 @@ Global {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {D9EF311B-6C73-4EA3-9F87-63D660C24CEE}.Release|Any CPU.Build.0 = Release|Any CPU + {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -224,6 +230,7 @@ Global {2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} {0DB384BD-6270-4A1D-95D4-ED3972AE63B0} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} {D9EF311B-6C73-4EA3-9F87-63D660C24CEE} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} + {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {037E8DD3-6CB9-4A55-BB67-CD24D471F05A} From 31477d982652a44e8c37e8b67b1a2aeb8b1e57a5 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 11:32:28 +0200 Subject: [PATCH 08/53] https://github.com/MagmaWorks/Taxonomy/pull/32#discussion_r1774537905 --- Loads/ILoads/IColumnLoad.cs | 4 ++-- Loads/ILoads/IPointDisplacement.cs | 2 +- ...oint2dDisplacement.cs => IPointDisplacement2d.cs} | 2 +- Loads/ILoads/IPointForce.cs | 2 +- Loads/ILoads/{IPoint2dForce.cs => IPointForce2d.cs} | 2 +- Loads/ILoads/IPointMoment.cs | 2 +- .../ILoads/{IPoint2dMoment.cs => IPointMoment2d.cs} | 2 +- Loads/LoadTests/AutomatedTests.cs | 4 ++-- Loads/LoadTests/Point2dForceTests.cs | 2 +- Loads/Loads/ColumnLoad.cs | 6 +++--- Loads/Loads/PointDisplacement.cs | 2 +- ...Point2dDisplacement.cs => PointDisplacement2d.cs} | 6 +++--- Loads/Loads/PointForce.cs | 2 +- Loads/Loads/{Point2dForce.cs => PointForce2d.cs} | 12 ++++++------ Loads/Loads/PointMoment.cs | 2 +- Loads/Loads/{Point2dMoment.cs => PointMoment2d.cs} | 6 +++--- 16 files changed, 29 insertions(+), 29 deletions(-) rename Loads/ILoads/{IPoint2dDisplacement.cs => IPointDisplacement2d.cs} (71%) rename Loads/ILoads/{IPoint2dForce.cs => IPointForce2d.cs} (73%) rename Loads/ILoads/{IPoint2dMoment.cs => IPointMoment2d.cs} (73%) rename Loads/Loads/{Point2dDisplacement.cs => PointDisplacement2d.cs} (60%) rename Loads/Loads/{Point2dForce.cs => PointForce2d.cs} (52%) rename Loads/Loads/{Point2dMoment.cs => PointMoment2d.cs} (64%) diff --git a/Loads/ILoads/IColumnLoad.cs b/Loads/ILoads/IColumnLoad.cs index 705e92d..0d56834 100644 --- a/Loads/ILoads/IColumnLoad.cs +++ b/Loads/ILoads/IColumnLoad.cs @@ -5,7 +5,7 @@ namespace MagmaWorks.Taxonomy.Loads public interface IColumnLoad : ILoad { Force Force { get; } - IPoint2dMoment TopMoment { get; } - IPoint2dMoment BottomMoment { get; } + IPointMoment2d TopMoment { get; } + IPointMoment2d BottomMoment { get; } } } diff --git a/Loads/ILoads/IPointDisplacement.cs b/Loads/ILoads/IPointDisplacement.cs index 113fdd9..1771291 100644 --- a/Loads/ILoads/IPointDisplacement.cs +++ b/Loads/ILoads/IPointDisplacement.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPointDisplacement : IPoint2dDisplacement + public interface IPointDisplacement : IPointDisplacement2d { Length Y { get; } } diff --git a/Loads/ILoads/IPoint2dDisplacement.cs b/Loads/ILoads/IPointDisplacement2d.cs similarity index 71% rename from Loads/ILoads/IPoint2dDisplacement.cs rename to Loads/ILoads/IPointDisplacement2d.cs index e7c073c..59046e3 100644 --- a/Loads/ILoads/IPoint2dDisplacement.cs +++ b/Loads/ILoads/IPointDisplacement2d.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPoint2dDisplacement : ILoad + public interface IPointDisplacement2d : ILoad { Length X { get; } Length Z { get; } diff --git a/Loads/ILoads/IPointForce.cs b/Loads/ILoads/IPointForce.cs index 34e5324..438aa22 100644 --- a/Loads/ILoads/IPointForce.cs +++ b/Loads/ILoads/IPointForce.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPointForce : IPoint2dForce + public interface IPointForce : IPointForce2d { Force Y { get; } } diff --git a/Loads/ILoads/IPoint2dForce.cs b/Loads/ILoads/IPointForce2d.cs similarity index 73% rename from Loads/ILoads/IPoint2dForce.cs rename to Loads/ILoads/IPointForce2d.cs index dd40be8..21d0bc0 100644 --- a/Loads/ILoads/IPoint2dForce.cs +++ b/Loads/ILoads/IPointForce2d.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPoint2dForce : ILoad + public interface IPointForce2d : ILoad { Force X { get; } Force Z { get; } diff --git a/Loads/ILoads/IPointMoment.cs b/Loads/ILoads/IPointMoment.cs index db1a2a7..ee303f8 100644 --- a/Loads/ILoads/IPointMoment.cs +++ b/Loads/ILoads/IPointMoment.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPointMoment : IPoint2dMoment + public interface IPointMoment : IPointMoment2d { Moment Xx { get; } } diff --git a/Loads/ILoads/IPoint2dMoment.cs b/Loads/ILoads/IPointMoment2d.cs similarity index 73% rename from Loads/ILoads/IPoint2dMoment.cs rename to Loads/ILoads/IPointMoment2d.cs index 581e2b9..e20bd03 100644 --- a/Loads/ILoads/IPoint2dMoment.cs +++ b/Loads/ILoads/IPointMoment2d.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IPoint2dMoment : ILoad + public interface IPointMoment2d : ILoad { Moment Yy { get; } Moment Zz { get; } diff --git a/Loads/LoadTests/AutomatedTests.cs b/Loads/LoadTests/AutomatedTests.cs index a8bcf7e..639f596 100644 --- a/Loads/LoadTests/AutomatedTests.cs +++ b/Loads/LoadTests/AutomatedTests.cs @@ -75,7 +75,7 @@ IEnumerator IEnumerable.GetEnumerator() private static List GetAllComponents() { var data = new List(); - Type[] typelist = Assembly.GetAssembly(typeof(Point2dForce)).GetTypes(); + Type[] typelist = Assembly.GetAssembly(typeof(PointForce2d)).GetTypes(); foreach (Type type in typelist) { if (type.Namespace == null) @@ -226,7 +226,7 @@ private dynamic CreateObjectInstance(Type type) } // reflect on assembly to find concrete implementation of interface - Type[] typelist = Assembly.GetAssembly(typeof(Point2dForce)).GetTypes(); + Type[] typelist = Assembly.GetAssembly(typeof(PointForce2d)).GetTypes(); foreach (Type concreteType in typelist) { if (type.IsAssignableFrom(concreteType)) diff --git a/Loads/LoadTests/Point2dForceTests.cs b/Loads/LoadTests/Point2dForceTests.cs index 4fa061a..8ba662d 100644 --- a/Loads/LoadTests/Point2dForceTests.cs +++ b/Loads/LoadTests/Point2dForceTests.cs @@ -13,7 +13,7 @@ public void ImplicitOperatorTest() var f = new Force(15.4, ForceUnit.Kilonewton); // Act - Point2dForce load = (Point2dForce)f; + PointForce2d load = (PointForce2d)f; // Assert Assert.Equal(f, load.Z); diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs index 7270f19..b0c6b22 100644 --- a/Loads/Loads/ColumnLoad.cs +++ b/Loads/Loads/ColumnLoad.cs @@ -5,8 +5,8 @@ namespace MagmaWorks.Taxonomy.Loads public class ColumnLoad : IColumnLoad { public Force Force { get; set; } = Force.Zero; - public IPoint2dMoment TopMoment { get; set; } = new Point2dMoment(); - public IPoint2dMoment BottomMoment { get; set; } = new Point2dMoment(); + public IPointMoment2d TopMoment { get; set; } = new PointMoment2d(); + public IPointMoment2d BottomMoment { get; set; } = new PointMoment2d(); private ColumnLoad() { } @@ -15,7 +15,7 @@ public ColumnLoad(Force force) Force = force; } - public ColumnLoad(Force force, IPoint2dMoment topMoment, IPoint2dMoment bottomMoment) + public ColumnLoad(Force force, IPointMoment2d topMoment, IPointMoment2d bottomMoment) { Force = force; TopMoment = topMoment; diff --git a/Loads/Loads/PointDisplacement.cs b/Loads/Loads/PointDisplacement.cs index 9ded8ae..fd225df 100644 --- a/Loads/Loads/PointDisplacement.cs +++ b/Loads/Loads/PointDisplacement.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public class PointDisplacement : Point2dDisplacement, IPointDisplacement + public class PointDisplacement : PointDisplacement2d, IPointDisplacement { public Length Y { get; set; } = Length.Zero; diff --git a/Loads/Loads/Point2dDisplacement.cs b/Loads/Loads/PointDisplacement2d.cs similarity index 60% rename from Loads/Loads/Point2dDisplacement.cs rename to Loads/Loads/PointDisplacement2d.cs index 26d380c..5302592 100644 --- a/Loads/Loads/Point2dDisplacement.cs +++ b/Loads/Loads/PointDisplacement2d.cs @@ -2,14 +2,14 @@ namespace MagmaWorks.Taxonomy.Loads { - public class Point2dDisplacement : IPoint2dDisplacement + public class PointDisplacement2d : IPointDisplacement2d { public Length X { get; set; } = Length.Zero; public Length Z { get; set; } = Length.Zero; - internal Point2dDisplacement() { } + internal PointDisplacement2d() { } - public Point2dDisplacement(Length x, Length z) + public PointDisplacement2d(Length x, Length z) { X = x; Z = z; diff --git a/Loads/Loads/PointForce.cs b/Loads/Loads/PointForce.cs index 548d6c3..0e80457 100644 --- a/Loads/Loads/PointForce.cs +++ b/Loads/Loads/PointForce.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public class PointForce : Point2dForce, IPointForce + public class PointForce : PointForce2d, IPointForce { public Force Y { get; set; } = Force.Zero; diff --git a/Loads/Loads/Point2dForce.cs b/Loads/Loads/PointForce2d.cs similarity index 52% rename from Loads/Loads/Point2dForce.cs rename to Loads/Loads/PointForce2d.cs index a6cf0b0..cc4a778 100644 --- a/Loads/Loads/Point2dForce.cs +++ b/Loads/Loads/PointForce2d.cs @@ -2,27 +2,27 @@ namespace MagmaWorks.Taxonomy.Loads { - public class Point2dForce : IPoint2dForce + public class PointForce2d : IPointForce2d { public Force X { get; set; } = Force.Zero; public Force Z { get; set; } = Force.Zero; - internal Point2dForce() { } + internal PointForce2d() { } - public Point2dForce(Force z) + public PointForce2d(Force z) { Z = z; } - public Point2dForce(Force x, Force z) + public PointForce2d(Force x, Force z) { X = x; Z = z; } - public static implicit operator Point2dForce(Force f) + public static implicit operator PointForce2d(Force f) { - return new Point2dForce(f); + return new PointForce2d(f); } } } diff --git a/Loads/Loads/PointMoment.cs b/Loads/Loads/PointMoment.cs index 5ed7850..910a188 100644 --- a/Loads/Loads/PointMoment.cs +++ b/Loads/Loads/PointMoment.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public class PointMoment : Point2dMoment, IPointMoment + public class PointMoment : PointMoment2d, IPointMoment { public Moment Xx { get; set; } = Moment.Zero; diff --git a/Loads/Loads/Point2dMoment.cs b/Loads/Loads/PointMoment2d.cs similarity index 64% rename from Loads/Loads/Point2dMoment.cs rename to Loads/Loads/PointMoment2d.cs index 6dbd0f9..70398dd 100644 --- a/Loads/Loads/Point2dMoment.cs +++ b/Loads/Loads/PointMoment2d.cs @@ -2,14 +2,14 @@ namespace MagmaWorks.Taxonomy.Loads { - public class Point2dMoment : IPoint2dMoment + public class PointMoment2d : IPointMoment2d { public Moment Yy { get; set; } = Moment.Zero; public Moment Zz { get; set; } = Moment.Zero; - internal Point2dMoment() { } + internal PointMoment2d() { } - public Point2dMoment(Moment yy, Moment zz) + public PointMoment2d(Moment yy, Moment zz) { Yy = yy; Zz = zz; From ff969d64d712da15dd0ff2e93d7445249f7cc833 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 12:12:17 +0200 Subject: [PATCH 09/53] summary and renaming --- Loads/ICases/LoadCase/IPermanentCase.cs | 7 +++++++ Loads/ICases/LoadCase/IVariableCase.cs | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Loads/ICases/LoadCase/IPermanentCase.cs b/Loads/ICases/LoadCase/IPermanentCase.cs index 696e49b..5b0366d 100644 --- a/Loads/ICases/LoadCase/IPermanentCase.cs +++ b/Loads/ICases/LoadCase/IPermanentCase.cs @@ -4,7 +4,14 @@ namespace MagmaWorks.Taxonomy.Loads { public interface IPermanentCase : ILoadCase { + /// + /// γ_G,j,sup - Unfavourable (superior) partial factor + /// Ratio Unfavourable { get; } + + /// + /// γ_G,j,inf - Favourable (inferior) partial factor + /// Ratio Favourable { get; } } } diff --git a/Loads/ICases/LoadCase/IVariableCase.cs b/Loads/ICases/LoadCase/IVariableCase.cs index ee9285d..9b8967e 100644 --- a/Loads/ICases/LoadCase/IVariableCase.cs +++ b/Loads/ICases/LoadCase/IVariableCase.cs @@ -4,8 +4,19 @@ namespace MagmaWorks.Taxonomy.Loads { public interface IVariableCase : ILoadCase { - Ratio Characteristic { get; } // ψ_0 - Ratio Frequent { get; } // ψ_1 - Ratio QuasiPermanent { get; } // ψ_2 + /// + /// ψ_0 Characteristic partial factor + /// + Ratio Characteristic { get; } + + /// + /// ψ_1 Frequent partial factor + /// + Ratio Frequent { get; } + + /// + /// ψ_2 Quasi-permanent partial factor + /// + Ratio QuasiPermanent { get; } } } From 524731952caae645817addae9e826bf9fd7ffd70 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:09:17 +0200 Subject: [PATCH 10/53] Load symbol --- Loads/ILoads/ILoad.cs | 4 +++- Loads/Loads/AreaForce.cs | 1 + Loads/Loads/ColumnLoad.cs | 1 + Loads/Loads/Gravity.cs | 14 ++++++++++++++ Loads/Loads/Gravity2d.cs | 19 +++++++++++++++++++ Loads/Loads/LineForce2d.cs | 1 + Loads/Loads/PointDisplacement2d.cs | 1 + Loads/Loads/PointForce2d.cs | 1 + Loads/Loads/PointMoment2d.cs | 1 + 9 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Loads/Loads/Gravity.cs create mode 100644 Loads/Loads/Gravity2d.cs diff --git a/Loads/ILoads/ILoad.cs b/Loads/ILoads/ILoad.cs index 5927903..f8e43f1 100644 --- a/Loads/ILoads/ILoad.cs +++ b/Loads/ILoads/ILoad.cs @@ -1,4 +1,6 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ILoad { } + public interface ILoad { + char Symbol { get; } + } } diff --git a/Loads/Loads/AreaForce.cs b/Loads/Loads/AreaForce.cs index ac321ac..8a9bfdf 100644 --- a/Loads/Loads/AreaForce.cs +++ b/Loads/Loads/AreaForce.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class AreaForce : IAreaForce { + public char Symbol { get; set; } public Pressure X { get; set; } = Pressure.Zero; public Pressure Y { get; set; } = Pressure.Zero; public Pressure Z { get; set; } = Pressure.Zero; diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs index b0c6b22..4c5699d 100644 --- a/Loads/Loads/ColumnLoad.cs +++ b/Loads/Loads/ColumnLoad.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class ColumnLoad : IColumnLoad { + public char Symbol { get; set; } public Force Force { get; set; } = Force.Zero; public IPointMoment2d TopMoment { get; set; } = new PointMoment2d(); public IPointMoment2d BottomMoment { get; set; } = new PointMoment2d(); diff --git a/Loads/Loads/Gravity.cs b/Loads/Loads/Gravity.cs new file mode 100644 index 0000000..a257fe7 --- /dev/null +++ b/Loads/Loads/Gravity.cs @@ -0,0 +1,14 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class Gravity : Gravity2d, IGravity + { + public Ratio Y { get; } = Ratio.Zero; + + public Gravity() { } + + public Gravity(Ratio z) : base(z) { } + + } +} diff --git a/Loads/Loads/Gravity2d.cs b/Loads/Loads/Gravity2d.cs new file mode 100644 index 0000000..6736dab --- /dev/null +++ b/Loads/Loads/Gravity2d.cs @@ -0,0 +1,19 @@ +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class Gravity2d : IGravity2d + { + public char Symbol { get; set; } = 'G'; + public Ratio X { get; set; } = Ratio.Zero; + public Ratio Z { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); + + public Gravity2d() { } + + public Gravity2d(Ratio z) + { + Z = z; + } + } +} diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs index 5e06c45..4d2fe48 100644 --- a/Loads/Loads/LineForce2d.cs +++ b/Loads/Loads/LineForce2d.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class Line2dForce : ILine2dForce { + public char Symbol { get; set; } public ForcePerLength X { get; set; } = ForcePerLength.Zero; public ForcePerLength Z { get; set; } = ForcePerLength.Zero; public LoadApplication Application { get; set; } = LoadApplication.Global; diff --git a/Loads/Loads/PointDisplacement2d.cs b/Loads/Loads/PointDisplacement2d.cs index 5302592..6a2dc35 100644 --- a/Loads/Loads/PointDisplacement2d.cs +++ b/Loads/Loads/PointDisplacement2d.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointDisplacement2d : IPointDisplacement2d { + public char Symbol { get; set; } public Length X { get; set; } = Length.Zero; public Length Z { get; set; } = Length.Zero; diff --git a/Loads/Loads/PointForce2d.cs b/Loads/Loads/PointForce2d.cs index cc4a778..38ce6c2 100644 --- a/Loads/Loads/PointForce2d.cs +++ b/Loads/Loads/PointForce2d.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointForce2d : IPointForce2d { + public char Symbol { get; set; } public Force X { get; set; } = Force.Zero; public Force Z { get; set; } = Force.Zero; diff --git a/Loads/Loads/PointMoment2d.cs b/Loads/Loads/PointMoment2d.cs index 70398dd..7b037ad 100644 --- a/Loads/Loads/PointMoment2d.cs +++ b/Loads/Loads/PointMoment2d.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointMoment2d : IPointMoment2d { + public char Symbol { get; set; } public Moment Yy { get; set; } = Moment.Zero; public Moment Zz { get; set; } = Moment.Zero; From 2d0ac6dd5460842067f07c157da47cb7a71fb7ea Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:09:25 +0200 Subject: [PATCH 11/53] Gravity load --- Loads/ILoads/IGravity.cs | 9 +++++++++ Loads/ILoads/IGravity2d.cs | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Loads/ILoads/IGravity.cs create mode 100644 Loads/ILoads/IGravity2d.cs diff --git a/Loads/ILoads/IGravity.cs b/Loads/ILoads/IGravity.cs new file mode 100644 index 0000000..4e56d23 --- /dev/null +++ b/Loads/ILoads/IGravity.cs @@ -0,0 +1,9 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IGravity : IGravity2d + { + Ratio Y { get; } + } +} diff --git a/Loads/ILoads/IGravity2d.cs b/Loads/ILoads/IGravity2d.cs new file mode 100644 index 0000000..8d9b8e4 --- /dev/null +++ b/Loads/ILoads/IGravity2d.cs @@ -0,0 +1,10 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IGravity2d : ILoad + { + Ratio X { get; } + Ratio Z { get; } + } +} From 0080ab02e2c3f31a884f5722b0677f3c46906fff Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:10:02 +0200 Subject: [PATCH 12/53] Add case name --- Loads/ICases/ICase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Loads/ICases/ICase.cs b/Loads/ICases/ICase.cs index f47014e..63e1c2c 100644 --- a/Loads/ICases/ICase.cs +++ b/Loads/ICases/ICase.cs @@ -1,4 +1,6 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ICase { } + public interface ICase { + string Name { get; } + } } From d25d31db7d47c823c8851e7d11780aeba9c9fd0f Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:10:11 +0200 Subject: [PATCH 13/53] Load combinations --- Loads/ICases/LimitState.cs | 10 ---------- .../ICases/LoadCombination/IAccidentialCombination.cs | 4 ++++ .../LoadCombination/ICharacteristicCombination.cs | 4 ++++ .../ICases/LoadCombination/IEquilibriumCombination.cs | 4 ++++ Loads/ICases/LoadCombination/IFrequentCombination.cs | 4 ++++ Loads/ICases/LoadCombination/ILoadCombination.cs | 10 ++++++++++ .../ICases/LoadCombination/IMemberDesignCombination.cs | 4 ++++ .../LoadCombination/IQuasiPermanentCombination.cs | 4 ++++ Loads/ICases/LoadCombination/ISeismicCombination.cs | 4 ++++ .../LoadCombination/IServiceabilityLimitState.cs | 4 ++++ Loads/ICases/LoadCombination/IUltimateLimitState.cs | 4 ++++ 11 files changed, 46 insertions(+), 10 deletions(-) delete mode 100644 Loads/ICases/LimitState.cs create mode 100644 Loads/ICases/LoadCombination/IAccidentialCombination.cs create mode 100644 Loads/ICases/LoadCombination/ICharacteristicCombination.cs create mode 100644 Loads/ICases/LoadCombination/IEquilibriumCombination.cs create mode 100644 Loads/ICases/LoadCombination/IFrequentCombination.cs create mode 100644 Loads/ICases/LoadCombination/ILoadCombination.cs create mode 100644 Loads/ICases/LoadCombination/IMemberDesignCombination.cs create mode 100644 Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs create mode 100644 Loads/ICases/LoadCombination/ISeismicCombination.cs create mode 100644 Loads/ICases/LoadCombination/IServiceabilityLimitState.cs create mode 100644 Loads/ICases/LoadCombination/IUltimateLimitState.cs diff --git a/Loads/ICases/LimitState.cs b/Loads/ICases/LimitState.cs deleted file mode 100644 index 8d49026..0000000 --- a/Loads/ICases/LimitState.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace MagmaWorks.Taxonomy.Loads -{ - public enum LimitState - { - Ultimate, - Serviceability, - Accidental, - Seismic - } -} diff --git a/Loads/ICases/LoadCombination/IAccidentialCombination.cs b/Loads/ICases/LoadCombination/IAccidentialCombination.cs new file mode 100644 index 0000000..74180bd --- /dev/null +++ b/Loads/ICases/LoadCombination/IAccidentialCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IAccidentialCombination : IUltimateLimitState { } +} diff --git a/Loads/ICases/LoadCombination/ICharacteristicCombination.cs b/Loads/ICases/LoadCombination/ICharacteristicCombination.cs new file mode 100644 index 0000000..a65641e --- /dev/null +++ b/Loads/ICases/LoadCombination/ICharacteristicCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ICharacteristicCombination : IServiceabilityLimitState { } +} diff --git a/Loads/ICases/LoadCombination/IEquilibriumCombination.cs b/Loads/ICases/LoadCombination/IEquilibriumCombination.cs new file mode 100644 index 0000000..2057e7e --- /dev/null +++ b/Loads/ICases/LoadCombination/IEquilibriumCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IEquilibriumCombination : IUltimateLimitState { } +} diff --git a/Loads/ICases/LoadCombination/IFrequentCombination.cs b/Loads/ICases/LoadCombination/IFrequentCombination.cs new file mode 100644 index 0000000..c2556d3 --- /dev/null +++ b/Loads/ICases/LoadCombination/IFrequentCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IFrequentCombination : IServiceabilityLimitState { } +} diff --git a/Loads/ICases/LoadCombination/ILoadCombination.cs b/Loads/ICases/LoadCombination/ILoadCombination.cs new file mode 100644 index 0000000..5806095 --- /dev/null +++ b/Loads/ICases/LoadCombination/ILoadCombination.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ILoadCombination : ICase + { + IList LoadCases { get; } + IList GetFactoredLoads(); + } +} diff --git a/Loads/ICases/LoadCombination/IMemberDesignCombination.cs b/Loads/ICases/LoadCombination/IMemberDesignCombination.cs new file mode 100644 index 0000000..e0e9b34 --- /dev/null +++ b/Loads/ICases/LoadCombination/IMemberDesignCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IMemberDesignCombination : IUltimateLimitState { } +} diff --git a/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs b/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs new file mode 100644 index 0000000..c2556d3 --- /dev/null +++ b/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IFrequentCombination : IServiceabilityLimitState { } +} diff --git a/Loads/ICases/LoadCombination/ISeismicCombination.cs b/Loads/ICases/LoadCombination/ISeismicCombination.cs new file mode 100644 index 0000000..9051d41 --- /dev/null +++ b/Loads/ICases/LoadCombination/ISeismicCombination.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface ISeismicCombination : IUltimateLimitState { } +} diff --git a/Loads/ICases/LoadCombination/IServiceabilityLimitState.cs b/Loads/ICases/LoadCombination/IServiceabilityLimitState.cs new file mode 100644 index 0000000..32735ab --- /dev/null +++ b/Loads/ICases/LoadCombination/IServiceabilityLimitState.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IServiceabilityLimitState : ILoadCombination { } +} diff --git a/Loads/ICases/LoadCombination/IUltimateLimitState.cs b/Loads/ICases/LoadCombination/IUltimateLimitState.cs new file mode 100644 index 0000000..f7be13c --- /dev/null +++ b/Loads/ICases/LoadCombination/IUltimateLimitState.cs @@ -0,0 +1,4 @@ +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IUltimateLimitState : ILoadCombination { } +} From 69766c0fd74e85360e8601761396a1439c9c8600 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Wed, 25 Sep 2024 11:11:50 +0000 Subject: [PATCH 14/53] Fix code style issues with dotnet_format --- Loads/ICases/ICase.cs | 3 ++- Loads/ILoads/ILoad.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Loads/ICases/ICase.cs b/Loads/ICases/ICase.cs index 63e1c2c..9fdc9ca 100644 --- a/Loads/ICases/ICase.cs +++ b/Loads/ICases/ICase.cs @@ -1,6 +1,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ICase { + public interface ICase + { string Name { get; } } } diff --git a/Loads/ILoads/ILoad.cs b/Loads/ILoads/ILoad.cs index f8e43f1..f014b65 100644 --- a/Loads/ILoads/ILoad.cs +++ b/Loads/ILoads/ILoad.cs @@ -1,6 +1,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ILoad { + public interface ILoad + { char Symbol { get; } } } From 90171074c4315bbf5cc9b08a801ddffa2fe14e1c Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:22:51 +0200 Subject: [PATCH 15/53] fix quasipermanent --- Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs b/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs index c2556d3..2d707ee 100644 --- a/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs +++ b/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs @@ -1,4 +1,4 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IFrequentCombination : IServiceabilityLimitState { } + public interface IQuasiPermanentCombination : IServiceabilityLimitState { } } From 5c75a75ca293808b00bf4c91c4ec9c081870b376 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:27:30 +0200 Subject: [PATCH 16/53] folder rename --- .../{LoadCombination => Combinations}/IAccidentialCombination.cs | 0 .../ICharacteristicCombination.cs | 0 .../{LoadCombination => Combinations}/IEquilibriumCombination.cs | 0 .../{LoadCombination => Combinations}/IFrequentCombination.cs | 0 .../ICases/{LoadCombination => Combinations}/ILoadCombination.cs | 0 .../{LoadCombination => Combinations}/IMemberDesignCombination.cs | 0 .../IQuasiPermanentCombination.cs | 0 .../{LoadCombination => Combinations}/ISeismicCombination.cs | 0 .../IServiceabilityLimitState.cs | 0 .../{LoadCombination => Combinations}/IUltimateLimitState.cs | 0 Loads/ICases/{LoadCase => LoadCases}/ILoadCase.cs | 0 Loads/ICases/{LoadCase => LoadCases}/IPermanentCase.cs | 0 Loads/ICases/{LoadCase => LoadCases}/IVariableCase.cs | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename Loads/ICases/{LoadCombination => Combinations}/IAccidentialCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/ICharacteristicCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/IEquilibriumCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/IFrequentCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/ILoadCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/IMemberDesignCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/IQuasiPermanentCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/ISeismicCombination.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/IServiceabilityLimitState.cs (100%) rename Loads/ICases/{LoadCombination => Combinations}/IUltimateLimitState.cs (100%) rename Loads/ICases/{LoadCase => LoadCases}/ILoadCase.cs (100%) rename Loads/ICases/{LoadCase => LoadCases}/IPermanentCase.cs (100%) rename Loads/ICases/{LoadCase => LoadCases}/IVariableCase.cs (100%) diff --git a/Loads/ICases/LoadCombination/IAccidentialCombination.cs b/Loads/ICases/Combinations/IAccidentialCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/IAccidentialCombination.cs rename to Loads/ICases/Combinations/IAccidentialCombination.cs diff --git a/Loads/ICases/LoadCombination/ICharacteristicCombination.cs b/Loads/ICases/Combinations/ICharacteristicCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/ICharacteristicCombination.cs rename to Loads/ICases/Combinations/ICharacteristicCombination.cs diff --git a/Loads/ICases/LoadCombination/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/IEquilibriumCombination.cs rename to Loads/ICases/Combinations/IEquilibriumCombination.cs diff --git a/Loads/ICases/LoadCombination/IFrequentCombination.cs b/Loads/ICases/Combinations/IFrequentCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/IFrequentCombination.cs rename to Loads/ICases/Combinations/IFrequentCombination.cs diff --git a/Loads/ICases/LoadCombination/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/ILoadCombination.cs rename to Loads/ICases/Combinations/ILoadCombination.cs diff --git a/Loads/ICases/LoadCombination/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/IMemberDesignCombination.cs rename to Loads/ICases/Combinations/IMemberDesignCombination.cs diff --git a/Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs b/Loads/ICases/Combinations/IQuasiPermanentCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/IQuasiPermanentCombination.cs rename to Loads/ICases/Combinations/IQuasiPermanentCombination.cs diff --git a/Loads/ICases/LoadCombination/ISeismicCombination.cs b/Loads/ICases/Combinations/ISeismicCombination.cs similarity index 100% rename from Loads/ICases/LoadCombination/ISeismicCombination.cs rename to Loads/ICases/Combinations/ISeismicCombination.cs diff --git a/Loads/ICases/LoadCombination/IServiceabilityLimitState.cs b/Loads/ICases/Combinations/IServiceabilityLimitState.cs similarity index 100% rename from Loads/ICases/LoadCombination/IServiceabilityLimitState.cs rename to Loads/ICases/Combinations/IServiceabilityLimitState.cs diff --git a/Loads/ICases/LoadCombination/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs similarity index 100% rename from Loads/ICases/LoadCombination/IUltimateLimitState.cs rename to Loads/ICases/Combinations/IUltimateLimitState.cs diff --git a/Loads/ICases/LoadCase/ILoadCase.cs b/Loads/ICases/LoadCases/ILoadCase.cs similarity index 100% rename from Loads/ICases/LoadCase/ILoadCase.cs rename to Loads/ICases/LoadCases/ILoadCase.cs diff --git a/Loads/ICases/LoadCase/IPermanentCase.cs b/Loads/ICases/LoadCases/IPermanentCase.cs similarity index 100% rename from Loads/ICases/LoadCase/IPermanentCase.cs rename to Loads/ICases/LoadCases/IPermanentCase.cs diff --git a/Loads/ICases/LoadCase/IVariableCase.cs b/Loads/ICases/LoadCases/IVariableCase.cs similarity index 100% rename from Loads/ICases/LoadCase/IVariableCase.cs rename to Loads/ICases/LoadCases/IVariableCase.cs From 9e7a933769158a5863dce234c24258dd9b80f2b2 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 25 Sep 2024 13:48:58 +0200 Subject: [PATCH 17/53] move gamma factors into combinations --- Loads/ICases/Combinations/ILoadCombination.cs | 10 ++++++++++ Loads/ICases/Combinations/IUltimateLimitState.cs | 16 ++++++++++++++-- Loads/ICases/LoadCases/IPermanentCase.cs | 10 +--------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Loads/ICases/Combinations/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs index 5806095..c5cb543 100644 --- a/Loads/ICases/Combinations/ILoadCombination.cs +++ b/Loads/ICases/Combinations/ILoadCombination.cs @@ -1,9 +1,19 @@ using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { public interface ILoadCombination : ICase { + /// + /// γ_G,j,inf - Favourable (inferior) partial factor + /// + Ratio Favourable { get; } + + /// + /// γ_G,j,sup - Unfavourable (superior) partial factor + /// + Ratio Unfavourable { get; } IList LoadCases { get; } IList GetFactoredLoads(); } diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index f7be13c..70d9636 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -1,4 +1,16 @@ -namespace MagmaWorks.Taxonomy.Loads +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads { - public interface IUltimateLimitState : ILoadCombination { } + public interface IUltimateLimitState : ILoadCombination { + /// + /// γ_Q,1 - Leading variable action partial factor + /// + Ratio LeadingVariable { get; } + + /// + /// γ_Q,i - Accompanying variable action partial factor + /// + Ratio OtherVariable { get; } + } } diff --git a/Loads/ICases/LoadCases/IPermanentCase.cs b/Loads/ICases/LoadCases/IPermanentCase.cs index 5b0366d..0eb3d5a 100644 --- a/Loads/ICases/LoadCases/IPermanentCase.cs +++ b/Loads/ICases/LoadCases/IPermanentCase.cs @@ -4,14 +4,6 @@ namespace MagmaWorks.Taxonomy.Loads { public interface IPermanentCase : ILoadCase { - /// - /// γ_G,j,sup - Unfavourable (superior) partial factor - /// - Ratio Unfavourable { get; } - - /// - /// γ_G,j,inf - Favourable (inferior) partial factor - /// - Ratio Favourable { get; } + } } From f74b1a30e67fc46d5eef105dc0337cf710c78a9c Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 26 Sep 2024 15:45:29 +0200 Subject: [PATCH 18/53] change `char Symbol` to `string Label` --- Loads/ILoads/ILoad.cs | 2 +- Loads/Loads/AreaForce.cs | 2 +- Loads/Loads/ColumnLoad.cs | 2 +- Loads/Loads/Gravity2d.cs | 2 +- Loads/Loads/LineForce2d.cs | 2 +- Loads/Loads/PointDisplacement2d.cs | 2 +- Loads/Loads/PointForce2d.cs | 2 +- Loads/Loads/PointMoment2d.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Loads/ILoads/ILoad.cs b/Loads/ILoads/ILoad.cs index f014b65..697e002 100644 --- a/Loads/ILoads/ILoad.cs +++ b/Loads/ILoads/ILoad.cs @@ -2,6 +2,6 @@ { public interface ILoad { - char Symbol { get; } + string Label { get; } } } diff --git a/Loads/Loads/AreaForce.cs b/Loads/Loads/AreaForce.cs index 8a9bfdf..f9904e0 100644 --- a/Loads/Loads/AreaForce.cs +++ b/Loads/Loads/AreaForce.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class AreaForce : IAreaForce { - public char Symbol { get; set; } + public string Label { get; set; } public Pressure X { get; set; } = Pressure.Zero; public Pressure Y { get; set; } = Pressure.Zero; public Pressure Z { get; set; } = Pressure.Zero; diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs index 4c5699d..b17574c 100644 --- a/Loads/Loads/ColumnLoad.cs +++ b/Loads/Loads/ColumnLoad.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class ColumnLoad : IColumnLoad { - public char Symbol { get; set; } + public string Label { get; set; } public Force Force { get; set; } = Force.Zero; public IPointMoment2d TopMoment { get; set; } = new PointMoment2d(); public IPointMoment2d BottomMoment { get; set; } = new PointMoment2d(); diff --git a/Loads/Loads/Gravity2d.cs b/Loads/Loads/Gravity2d.cs index 6736dab..dba6a8b 100644 --- a/Loads/Loads/Gravity2d.cs +++ b/Loads/Loads/Gravity2d.cs @@ -5,7 +5,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class Gravity2d : IGravity2d { - public char Symbol { get; set; } = 'G'; + public string Label { get; set; } public Ratio X { get; set; } = Ratio.Zero; public Ratio Z { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs index 4d2fe48..5d4c042 100644 --- a/Loads/Loads/LineForce2d.cs +++ b/Loads/Loads/LineForce2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class Line2dForce : ILine2dForce { - public char Symbol { get; set; } + public string Label { get; set; } public ForcePerLength X { get; set; } = ForcePerLength.Zero; public ForcePerLength Z { get; set; } = ForcePerLength.Zero; public LoadApplication Application { get; set; } = LoadApplication.Global; diff --git a/Loads/Loads/PointDisplacement2d.cs b/Loads/Loads/PointDisplacement2d.cs index 6a2dc35..3f724ac 100644 --- a/Loads/Loads/PointDisplacement2d.cs +++ b/Loads/Loads/PointDisplacement2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointDisplacement2d : IPointDisplacement2d { - public char Symbol { get; set; } + public string Label { get; set; } public Length X { get; set; } = Length.Zero; public Length Z { get; set; } = Length.Zero; diff --git a/Loads/Loads/PointForce2d.cs b/Loads/Loads/PointForce2d.cs index 38ce6c2..e41b52c 100644 --- a/Loads/Loads/PointForce2d.cs +++ b/Loads/Loads/PointForce2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointForce2d : IPointForce2d { - public char Symbol { get; set; } + public string Label { get; set; } public Force X { get; set; } = Force.Zero; public Force Z { get; set; } = Force.Zero; diff --git a/Loads/Loads/PointMoment2d.cs b/Loads/Loads/PointMoment2d.cs index 7b037ad..b1e23a0 100644 --- a/Loads/Loads/PointMoment2d.cs +++ b/Loads/Loads/PointMoment2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointMoment2d : IPointMoment2d { - public char Symbol { get; set; } + public string Label { get; set; } public Moment Yy { get; set; } = Moment.Zero; public Moment Zz { get; set; } = Moment.Zero; From 96883c7d7dca023fb9815532f7c5bc0e61b5c017 Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 26 Sep 2024 17:51:47 +0200 Subject: [PATCH 19/53] Factor load methods --- Loads/ILoads/ILoad.cs | 5 ++++- Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj | 2 +- Loads/Loads/AreaForce.cs | 14 +++++++++++++- Loads/Loads/ColumnLoad.cs | 11 +++++++++++ Loads/Loads/Gravity.cs | 9 ++++++++- Loads/Loads/Gravity2d.cs | 7 +++++++ Loads/Loads/LineForce.cs | 11 ++++++++++- Loads/Loads/LineForce2d.cs | 10 +++++++++- Loads/Loads/PointDisplacement.cs | 8 ++++++++ Loads/Loads/PointDisplacement2d.cs | 7 +++++++ Loads/Loads/PointForce.cs | 8 ++++++++ Loads/Loads/PointForce2d.cs | 7 +++++++ Loads/Loads/PointMoment.cs | 8 ++++++++ Loads/Loads/PointMoment2d.cs | 7 +++++++ 14 files changed, 108 insertions(+), 6 deletions(-) diff --git a/Loads/ILoads/ILoad.cs b/Loads/ILoads/ILoad.cs index 697e002..a125eee 100644 --- a/Loads/ILoads/ILoad.cs +++ b/Loads/ILoads/ILoad.cs @@ -1,7 +1,10 @@ -namespace MagmaWorks.Taxonomy.Loads +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads { public interface ILoad { string Label { get; } + ILoad Factor(Ratio factor); } } diff --git a/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj b/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj index 908ddd1..b68cfa9 100644 --- a/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj +++ b/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj @@ -7,7 +7,7 @@ net48;netstandard2.0;net6.0;net7.0;net8.0 - 9.0 + 11.0 AnyCPU MagmaWorks.Taxonomy.Loads diff --git a/Loads/Loads/AreaForce.cs b/Loads/Loads/AreaForce.cs index f9904e0..57763ac 100644 --- a/Loads/Loads/AreaForce.cs +++ b/Loads/Loads/AreaForce.cs @@ -5,10 +5,10 @@ namespace MagmaWorks.Taxonomy.Loads public class AreaForce : IAreaForce { public string Label { get; set; } + public LoadApplication Application { get; set; } = LoadApplication.Local; public Pressure X { get; set; } = Pressure.Zero; public Pressure Y { get; set; } = Pressure.Zero; public Pressure Z { get; set; } = Pressure.Zero; - public LoadApplication Application { get; set; } = LoadApplication.Local; private AreaForce() { } @@ -28,5 +28,17 @@ public static implicit operator AreaForce(Pressure f) { return new AreaForce(f); } + + public ILoad Factor(Ratio factor) + { + return new AreaForce() + { + Label = this.Label, + Application = this.Application, + X = this.X * factor.DecimalFractions, + Y = this.Y * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions, + }; + } } } diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs index b17574c..d873b11 100644 --- a/Loads/Loads/ColumnLoad.cs +++ b/Loads/Loads/ColumnLoad.cs @@ -27,5 +27,16 @@ public static implicit operator ColumnLoad(Force f) { return new ColumnLoad(f); } + + public ILoad Factor(Ratio factor) + { + return new ColumnLoad() + { + Force = this.Force * factor.DecimalFractions, + TopMoment = (IPointMoment2d)this.TopMoment.Factor(factor), + BottomMoment = (IPointMoment2d)this.BottomMoment.Factor(factor), + Label = this.Label + }; + } } } diff --git a/Loads/Loads/Gravity.cs b/Loads/Loads/Gravity.cs index a257fe7..10e4938 100644 --- a/Loads/Loads/Gravity.cs +++ b/Loads/Loads/Gravity.cs @@ -4,11 +4,18 @@ namespace MagmaWorks.Taxonomy.Loads { public class Gravity : Gravity2d, IGravity { - public Ratio Y { get; } = Ratio.Zero; + public Ratio Y { get; set; } = Ratio.Zero; public Gravity() { } public Gravity(Ratio z) : base(z) { } + public override ILoad Factor(Ratio factor) => new Gravity() + { + Label = this.Label, + X = this.X * factor.DecimalFractions, + Y = this.Y * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions, + }; } } diff --git a/Loads/Loads/Gravity2d.cs b/Loads/Loads/Gravity2d.cs index dba6a8b..c82de18 100644 --- a/Loads/Loads/Gravity2d.cs +++ b/Loads/Loads/Gravity2d.cs @@ -15,5 +15,12 @@ public Gravity2d(Ratio z) { Z = z; } + + public virtual ILoad Factor(Ratio factor) => new Gravity2d() + { + Label = this.Label, + X = this.X * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions, + }; } } diff --git a/Loads/Loads/LineForce.cs b/Loads/Loads/LineForce.cs index 277d030..b6f510a 100644 --- a/Loads/Loads/LineForce.cs +++ b/Loads/Loads/LineForce.cs @@ -5,7 +5,7 @@ namespace MagmaWorks.Taxonomy.Loads public class LineForce : Line2dForce, ILineForce { - public ForcePerLength Y { get; } = ForcePerLength.Zero; + public ForcePerLength Y { get; set; } = ForcePerLength.Zero; private LineForce() { } @@ -23,5 +23,14 @@ public static implicit operator LineForce(ForcePerLength f) { return new LineForce(f); } + + public override ILoad Factor(Ratio factor) => new LineForce() + { + Label = this.Label, + Application = this.Application, + X = this.X * factor.DecimalFractions, + Y = this.Y * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions, + }; } } diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs index 5d4c042..7d3d733 100644 --- a/Loads/Loads/LineForce2d.cs +++ b/Loads/Loads/LineForce2d.cs @@ -5,9 +5,9 @@ namespace MagmaWorks.Taxonomy.Loads public class Line2dForce : ILine2dForce { public string Label { get; set; } + public LoadApplication Application { get; set; } = LoadApplication.Global; public ForcePerLength X { get; set; } = ForcePerLength.Zero; public ForcePerLength Z { get; set; } = ForcePerLength.Zero; - public LoadApplication Application { get; set; } = LoadApplication.Global; internal Line2dForce() { } @@ -27,5 +27,13 @@ public static implicit operator Line2dForce(ForcePerLength f) { return new Line2dForce(f); } + + public virtual ILoad Factor(Ratio factor) => new Line2dForce() + { + Label = this.Label, + Application = this.Application, + X = this.X * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions, + }; } } diff --git a/Loads/Loads/PointDisplacement.cs b/Loads/Loads/PointDisplacement.cs index fd225df..6278318 100644 --- a/Loads/Loads/PointDisplacement.cs +++ b/Loads/Loads/PointDisplacement.cs @@ -12,5 +12,13 @@ public PointDisplacement(Length x, Length y, Length z) Y = y; Z = z; } + + public override ILoad Factor(Ratio factor) => new PointDisplacement( + this.X * factor.DecimalFractions, + this.Y * factor.DecimalFractions, + this.Z * factor.DecimalFractions) + { + Label = this.Label, + }; } } diff --git a/Loads/Loads/PointDisplacement2d.cs b/Loads/Loads/PointDisplacement2d.cs index 3f724ac..d242a9c 100644 --- a/Loads/Loads/PointDisplacement2d.cs +++ b/Loads/Loads/PointDisplacement2d.cs @@ -15,5 +15,12 @@ public PointDisplacement2d(Length x, Length z) X = x; Z = z; } + + public virtual ILoad Factor(Ratio factor) => new PointDisplacement2d() + { + Label = this.Label, + X = this.X * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions + }; } } diff --git a/Loads/Loads/PointForce.cs b/Loads/Loads/PointForce.cs index 0e80457..c6be8de 100644 --- a/Loads/Loads/PointForce.cs +++ b/Loads/Loads/PointForce.cs @@ -17,5 +17,13 @@ public static implicit operator PointForce(Force f) { return new PointForce(Force.Zero, Force.Zero, f); } + + public override ILoad Factor(Ratio factor) => new PointForce( + this.X * factor.DecimalFractions, + this.Y * factor.DecimalFractions, + this.Z * factor.DecimalFractions) + { + Label = this.Label, + }; } } diff --git a/Loads/Loads/PointForce2d.cs b/Loads/Loads/PointForce2d.cs index e41b52c..c8a150f 100644 --- a/Loads/Loads/PointForce2d.cs +++ b/Loads/Loads/PointForce2d.cs @@ -25,5 +25,12 @@ public static implicit operator PointForce2d(Force f) { return new PointForce2d(f); } + + public virtual ILoad Factor(Ratio factor) => new PointForce2d() + { + Label = this.Label, + X = this.X * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions + }; } } diff --git a/Loads/Loads/PointMoment.cs b/Loads/Loads/PointMoment.cs index 910a188..2b28db6 100644 --- a/Loads/Loads/PointMoment.cs +++ b/Loads/Loads/PointMoment.cs @@ -12,5 +12,13 @@ public PointMoment(Moment xx, Moment yy, Moment zz) Yy = yy; Zz = zz; } + + public override ILoad Factor(Ratio factor) => new PointMoment( + this.Xx * factor.DecimalFractions, + this.Yy * factor.DecimalFractions, + this.Zz * factor.DecimalFractions) + { + Label = this.Label, + }; } } diff --git a/Loads/Loads/PointMoment2d.cs b/Loads/Loads/PointMoment2d.cs index b1e23a0..1623b2e 100644 --- a/Loads/Loads/PointMoment2d.cs +++ b/Loads/Loads/PointMoment2d.cs @@ -15,5 +15,12 @@ public PointMoment2d(Moment yy, Moment zz) Yy = yy; Zz = zz; } + + public virtual ILoad Factor(Ratio factor) => new PointMoment2d() + { + Label = this.Label, + Yy = this.Yy * factor.DecimalFractions, + Zz = this.Zz * factor.DecimalFractions + }; } } From dc81b66294341a84fb87e664119ea16181dd1b6e Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 26 Sep 2024 19:24:04 +0200 Subject: [PATCH 20/53] rename 2d and tests for Factor methods --- Loads/ILoads/ILineForce.cs | 2 +- Loads/ILoads/ILineForce2d.cs | 2 +- .../ILoads/MagmaWorks.Taxonomy.ILoads.csproj | 2 +- Loads/LoadTests/AreaForceTests.cs | 25 +++++++++++ Loads/LoadTests/ColumnLoadTests.cs | 29 ++++++++++++ Loads/LoadTests/Line2dForceTests.cs | 22 --------- Loads/LoadTests/LineForce2dTests.cs | 45 +++++++++++++++++++ Loads/LoadTests/LineForceTests.cs | 25 +++++++++++ Loads/LoadTests/Point2dForceTests.cs | 22 --------- Loads/LoadTests/PointForce2dTests.cs | 43 ++++++++++++++++++ Loads/LoadTests/PointForceTests.cs | 21 +++++++++ Loads/Loads/Gravity.cs | 15 ++++--- Loads/Loads/LineForce.cs | 2 +- Loads/Loads/LineForce2d.cs | 14 +++--- 14 files changed, 208 insertions(+), 61 deletions(-) delete mode 100644 Loads/LoadTests/Line2dForceTests.cs create mode 100644 Loads/LoadTests/LineForce2dTests.cs delete mode 100644 Loads/LoadTests/Point2dForceTests.cs create mode 100644 Loads/LoadTests/PointForce2dTests.cs diff --git a/Loads/ILoads/ILineForce.cs b/Loads/ILoads/ILineForce.cs index ee25521..f84a37c 100644 --- a/Loads/ILoads/ILineForce.cs +++ b/Loads/ILoads/ILineForce.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ILineForce : ILine2dForce + public interface ILineForce : ILineForce2d { ForcePerLength Y { get; } } diff --git a/Loads/ILoads/ILineForce2d.cs b/Loads/ILoads/ILineForce2d.cs index 1fc0073..595f29b 100644 --- a/Loads/ILoads/ILineForce2d.cs +++ b/Loads/ILoads/ILineForce2d.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface ILine2dForce : ILoad + public interface ILineForce2d : ILoad { ForcePerLength X { get; } ForcePerLength Z { get; } diff --git a/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj b/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj index b68cfa9..908ddd1 100644 --- a/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj +++ b/Loads/ILoads/MagmaWorks.Taxonomy.ILoads.csproj @@ -7,7 +7,7 @@ net48;netstandard2.0;net6.0;net7.0;net8.0 - 11.0 + 9.0 AnyCPU MagmaWorks.Taxonomy.Loads diff --git a/Loads/LoadTests/AreaForceTests.cs b/Loads/LoadTests/AreaForceTests.cs index f1630d3..5671f55 100644 --- a/Loads/LoadTests/AreaForceTests.cs +++ b/Loads/LoadTests/AreaForceTests.cs @@ -18,5 +18,30 @@ public void ImplicitOperatorTest() // Assert Assert.Equal(f, load.Z); } + + [Fact] + public void FactorTest() + { + // Assemble + var f = new Pressure(15.4, PressureUnit.KilonewtonPerSquareMeter); + AreaForce load = new AreaForce(f) + { + Application = LoadApplication.Global, + Label = "myLoad", + X = new Pressure(13.2, PressureUnit.KilonewtonPerSquareMeter), + Y = new Pressure(22.1, PressureUnit.KilonewtonPerSquareMeter) + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IAreaForce factored = (IAreaForce)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Z); + Assert.Equal(13.2 * 2, factored.Y.KilonewtonsPerSquareMeter); + Assert.Equal(22.1 * 2, factored.Z.KilonewtonsPerSquareMeter); + Assert.Equal(LoadApplication.Global, factored.Application); + Assert.Equal("myLoad", factored.Label); + } } } diff --git a/Loads/LoadTests/ColumnLoadTests.cs b/Loads/LoadTests/ColumnLoadTests.cs index 5af5a18..897ed7c 100644 --- a/Loads/LoadTests/ColumnLoadTests.cs +++ b/Loads/LoadTests/ColumnLoadTests.cs @@ -18,5 +18,34 @@ public void ImplicitOperatorTest() // Assert Assert.Equal(f, load.Force); } + + [Fact] + public void FactorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + ColumnLoad load = new ColumnLoad(f) + { + Label = "myLoad", + TopMoment = new PointMoment2d( + new Moment(13.2, MomentUnit.KilonewtonMeter), + new Moment(-0.2, MomentUnit.KilonewtonMeter)), + BottomMoment = new PointMoment2d( + new Moment(53.2, MomentUnit.KilonewtonMeter), + new Moment(33.2, MomentUnit.KilonewtonMeter)), + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IColumnLoad factored = (IColumnLoad)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Force); + Assert.Equal(13.2 * 2, factored.TopMoment.Yy.KilonewtonMeters); + Assert.Equal(-0.2 * 2, factored.TopMoment.Zz.KilonewtonMeters); + Assert.Equal(53.2 * 2, factored.BottomMoment.Yy.KilonewtonMeters); + Assert.Equal(33.2 * 2, factored.BottomMoment.Zz.KilonewtonMeters); + Assert.Equal("myLoad", factored.Label); + } } } diff --git a/Loads/LoadTests/Line2dForceTests.cs b/Loads/LoadTests/Line2dForceTests.cs deleted file mode 100644 index bb1a946..0000000 --- a/Loads/LoadTests/Line2dForceTests.cs +++ /dev/null @@ -1,22 +0,0 @@ -using MagmaWorks.Taxonomy.Loads; -using OasysUnits; -using OasysUnits.Units; - -namespace LoadTests -{ - public class Line2dForceTests - { - [Fact] - public void ImplicitOperatorTest() - { - // Assemble - var f = new ForcePerLength(15.4, ForcePerLengthUnit.KilonewtonPerMeter); - - // Act - Line2dForce load = (Line2dForce)f; - - // Assert - Assert.Equal(f, load.Z); - } - } -} diff --git a/Loads/LoadTests/LineForce2dTests.cs b/Loads/LoadTests/LineForce2dTests.cs new file mode 100644 index 0000000..7a6898f --- /dev/null +++ b/Loads/LoadTests/LineForce2dTests.cs @@ -0,0 +1,45 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class LineForce2dTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new ForcePerLength(15.4, ForcePerLengthUnit.KilonewtonPerMeter); + + // Act + LineForce2d load = (LineForce2d)f; + + // Assert + Assert.Equal(f, load.Z); + } + + [Fact] + public void FactorTest() + { + // Assemble + var f = new ForcePerLength(15.4, ForcePerLengthUnit.KilonewtonPerMeter); + LineForce2d load = new LineForce2d(f) + { + Label = "myLoad", + Application = LoadApplication.Projected, + X = new ForcePerLength(-25.4, ForcePerLengthUnit.KilonewtonPerMeter) + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + ILineForce2d factored = (ILineForce2d)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Z); + Assert.Equal(-25.4 * 2, factored.X.KilonewtonsPerMeter); + Assert.Equal(LoadApplication.Projected, factored.Application); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/LineForceTests.cs b/Loads/LoadTests/LineForceTests.cs index b11d0e0..b77ccc8 100644 --- a/Loads/LoadTests/LineForceTests.cs +++ b/Loads/LoadTests/LineForceTests.cs @@ -18,5 +18,30 @@ public void ImplicitOperatorTest() // Assert Assert.Equal(f, load.Z); } + + [Fact] + public void FactorTest() + { + // Assemble + var f = new ForcePerLength(15.4, ForcePerLengthUnit.KilonewtonPerMeter); + LineForce load = new LineForce(f) + { + Label = "myLoad", + Application = LoadApplication.Local, + X = new ForcePerLength(-25.4, ForcePerLengthUnit.KilonewtonPerMeter), + Y = new ForcePerLength(-25.3, ForcePerLengthUnit.KilonewtonPerMeter), + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + ILineForce factored = (ILineForce)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Z); + Assert.Equal(-25.4 * 2, factored.X.KilonewtonsPerMeter); + Assert.Equal(-25.3 * 2, factored.Y.KilonewtonsPerMeter); + Assert.Equal(LoadApplication.Local, factored.Application); + Assert.Equal("myLoad", factored.Label); + } } } diff --git a/Loads/LoadTests/Point2dForceTests.cs b/Loads/LoadTests/Point2dForceTests.cs deleted file mode 100644 index 8ba662d..0000000 --- a/Loads/LoadTests/Point2dForceTests.cs +++ /dev/null @@ -1,22 +0,0 @@ -using MagmaWorks.Taxonomy.Loads; -using OasysUnits; -using OasysUnits.Units; - -namespace LoadTests -{ - public class Point2dForceTests - { - [Fact] - public void ImplicitOperatorTest() - { - // Assemble - var f = new Force(15.4, ForceUnit.Kilonewton); - - // Act - PointForce2d load = (PointForce2d)f; - - // Assert - Assert.Equal(f, load.Z); - } - } -} diff --git a/Loads/LoadTests/PointForce2dTests.cs b/Loads/LoadTests/PointForce2dTests.cs new file mode 100644 index 0000000..abb9d07 --- /dev/null +++ b/Loads/LoadTests/PointForce2dTests.cs @@ -0,0 +1,43 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class PointForce2dTests + { + [Fact] + public void ImplicitOperatorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + + // Act + PointForce2d load = (PointForce2d)f; + + // Assert + Assert.Equal(f, load.Z); + } + + [Fact] + public void FactorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + PointForce2d load = new PointForce2d(f) + { + Label = "myLoad", + X = new Force(-25.4, ForceUnit.Kilonewton) + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IPointForce2d factored = (IPointForce2d)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Z); + Assert.Equal(-25.4 * 2, factored.X.Kilonewtons); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/PointForceTests.cs b/Loads/LoadTests/PointForceTests.cs index b3c0f4f..a657f99 100644 --- a/Loads/LoadTests/PointForceTests.cs +++ b/Loads/LoadTests/PointForceTests.cs @@ -18,5 +18,26 @@ public void ImplicitOperatorTest() // Assert Assert.Equal(f, load.Z); } + + [Fact] + public void FactorTest() + { + // Assemble + var f = new Force(15.4, ForceUnit.Kilonewton); + PointForce load = new PointForce(f, new Force(-25.4, ForceUnit.Kilonewton), new Force(0.01, ForceUnit.Kilonewton)) + { + Label = "myLoad", + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IPointForce factored = (IPointForce)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.X); + Assert.Equal(-25.4 * 2, factored.Y.Kilonewtons); + Assert.Equal(0.01 * 2, factored.Z.Kilonewtons); + Assert.Equal("myLoad", factored.Label); + } } } diff --git a/Loads/Loads/Gravity.cs b/Loads/Loads/Gravity.cs index 10e4938..98ad964 100644 --- a/Loads/Loads/Gravity.cs +++ b/Loads/Loads/Gravity.cs @@ -10,12 +10,15 @@ public Gravity() { } public Gravity(Ratio z) : base(z) { } - public override ILoad Factor(Ratio factor) => new Gravity() + public override ILoad Factor(Ratio factor) { - Label = this.Label, - X = this.X * factor.DecimalFractions, - Y = this.Y * factor.DecimalFractions, - Z = this.Z * factor.DecimalFractions, - }; + return new Gravity() + { + Label = this.Label, + X = this.X * factor.DecimalFractions, + Y = this.Y * factor.DecimalFractions, + Z = this.Z * factor.DecimalFractions, + }; + } } } diff --git a/Loads/Loads/LineForce.cs b/Loads/Loads/LineForce.cs index b6f510a..a014763 100644 --- a/Loads/Loads/LineForce.cs +++ b/Loads/Loads/LineForce.cs @@ -2,7 +2,7 @@ namespace MagmaWorks.Taxonomy.Loads { - public class LineForce : Line2dForce, ILineForce + public class LineForce : LineForce2d, ILineForce { public ForcePerLength Y { get; set; } = ForcePerLength.Zero; diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs index 7d3d733..92c8a96 100644 --- a/Loads/Loads/LineForce2d.cs +++ b/Loads/Loads/LineForce2d.cs @@ -2,33 +2,33 @@ namespace MagmaWorks.Taxonomy.Loads { - public class Line2dForce : ILine2dForce + public class LineForce2d : ILineForce2d { public string Label { get; set; } public LoadApplication Application { get; set; } = LoadApplication.Global; public ForcePerLength X { get; set; } = ForcePerLength.Zero; public ForcePerLength Z { get; set; } = ForcePerLength.Zero; - internal Line2dForce() { } + internal LineForce2d() { } - public Line2dForce(ForcePerLength z) + public LineForce2d(ForcePerLength z) { Z = z; } - public Line2dForce(ForcePerLength x, ForcePerLength z, LoadApplication application) + public LineForce2d(ForcePerLength x, ForcePerLength z, LoadApplication application) { X = x; Z = z; Application = application; } - public static implicit operator Line2dForce(ForcePerLength f) + public static implicit operator LineForce2d(ForcePerLength f) { - return new Line2dForce(f); + return new LineForce2d(f); } - public virtual ILoad Factor(Ratio factor) => new Line2dForce() + public virtual ILoad Factor(Ratio factor) => new LineForce2d() { Label = this.Label, Application = this.Application, From 78d8299bb6558e45c0c2bd1edc1bcccffd5ecf26 Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 26 Sep 2024 19:24:18 +0200 Subject: [PATCH 21/53] cases WIP --- .../Combinations/MemberDesignCombination.cs | 47 ++++++++++++++++ Loads/Cases/LoadCases/PermanentCase.cs | 13 +++++ Loads/Cases/LoadCases/VariableCase.cs | 16 ++++++ Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj | 55 +++++++++++++++++++ .../Combinations/IEquilibriumCombination.cs | 10 +++- Loads/ICases/Combinations/ILoadCombination.cs | 12 +--- .../Combinations/IMemberDesignCombination.cs | 10 +++- .../Combinations/IUltimateLimitState.cs | 10 +--- Loads/ICases/LoadCases/IPermanentCase.cs | 9 +-- Taxonomy.sln | 7 +++ 10 files changed, 160 insertions(+), 29 deletions(-) create mode 100644 Loads/Cases/Combinations/MemberDesignCombination.cs create mode 100644 Loads/Cases/LoadCases/PermanentCase.cs create mode 100644 Loads/Cases/LoadCases/VariableCase.cs create mode 100644 Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj diff --git a/Loads/Cases/Combinations/MemberDesignCombination.cs b/Loads/Cases/Combinations/MemberDesignCombination.cs new file mode 100644 index 0000000..6442210 --- /dev/null +++ b/Loads/Cases/Combinations/MemberDesignCombination.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class MemberDesignCombination : IMemberDesignCombination + { + public string Name { get; set; } + public Ratio PermanentPartialFactor { get; set; } + public Ratio LeadingVariablePartialFactor { get; set; } + public Ratio OtherVariablePartialFactor { get; set; } + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList AccompanyingVariableCases { get; set; } + + public MemberDesignCombination() { } + public IList GetFactoredLoads() + { + var factoredLoads = new List(); + foreach (ILoadCase loadCase in PermanentCases) + { + foreach (ILoad load in loadCase.Loads) + { + factoredLoads.Add(load.Factor(PermanentPartialFactor)); + } + } + + foreach (ILoadCase loadCase in LeadingVariableCases) + { + foreach (ILoad load in loadCase.Loads) + { + factoredLoads.Add(load.Factor(LeadingVariablePartialFactor)); + } + } + + foreach (ILoadCase loadCase in AccompanyingVariableCases) + { + foreach (ILoad load in loadCase.Loads) + { + factoredLoads.Add(load.Factor(OtherVariablePartialFactor)); + } + } + + return factoredLoads; + } + } +} diff --git a/Loads/Cases/LoadCases/PermanentCase.cs b/Loads/Cases/LoadCases/PermanentCase.cs new file mode 100644 index 0000000..9827d46 --- /dev/null +++ b/Loads/Cases/LoadCases/PermanentCase.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class PermanentCase : IPermanentCase + { + public string Name { get; set; } + public IList Loads { get; set; } + + public PermanentCase() { } + } +} diff --git a/Loads/Cases/LoadCases/VariableCase.cs b/Loads/Cases/LoadCases/VariableCase.cs new file mode 100644 index 0000000..7ce565d --- /dev/null +++ b/Loads/Cases/LoadCases/VariableCase.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class VariableCase : IVariableCase + { + public string Name { get; set; } + public Ratio Characteristic { get; set; } + public Ratio Frequent { get; set; } + public Ratio QuasiPermanent { get; set; } + public IList Loads { get; set; } + + public VariableCase() { } + } +} diff --git a/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj b/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj new file mode 100644 index 0000000..ff8b2f5 --- /dev/null +++ b/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj @@ -0,0 +1,55 @@ + + + + 0.0 + preview + + + + net48;netstandard2.0;net6.0;net7.0;net8.0 + 9.0 + AnyCPU + MagmaWorks.Taxonomy.Loads + + + + MagmaWorks Taxonomy Load Cases and Combinations + Whitby Wood + README.md + MIT + https://github.com/MagmaWorks/Taxonomy/ + MagmaWorks.png + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + True + \ + + + True + \ + + + True + \Licenses\ + + + True + \ + + + + + + + + diff --git a/Loads/ICases/Combinations/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs index 2057e7e..e5b3b5a 100644 --- a/Loads/ICases/Combinations/IEquilibriumCombination.cs +++ b/Loads/ICases/Combinations/IEquilibriumCombination.cs @@ -1,4 +1,10 @@ -namespace MagmaWorks.Taxonomy.Loads +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads { - public interface IEquilibriumCombination : IUltimateLimitState { } + public interface IEquilibriumCombination : IUltimateLimitState { + Ratio PermanentPartialFactor { get; } + Ratio LeadingVariablePartialFactor { get; } + Ratio OtherVariablePartialFactor { get; } + } } diff --git a/Loads/ICases/Combinations/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs index c5cb543..4363c67 100644 --- a/Loads/ICases/Combinations/ILoadCombination.cs +++ b/Loads/ICases/Combinations/ILoadCombination.cs @@ -5,16 +5,10 @@ namespace MagmaWorks.Taxonomy.Loads { public interface ILoadCombination : ICase { - /// - /// γ_G,j,inf - Favourable (inferior) partial factor - /// - Ratio Favourable { get; } + IList PermanentCases { get; } + IList LeadingVariableCases { get; } + IList AccompanyingVariableCases { get; } - /// - /// γ_G,j,sup - Unfavourable (superior) partial factor - /// - Ratio Unfavourable { get; } - IList LoadCases { get; } IList GetFactoredLoads(); } } diff --git a/Loads/ICases/Combinations/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs index e0e9b34..ad9c29e 100644 --- a/Loads/ICases/Combinations/IMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IMemberDesignCombination.cs @@ -1,4 +1,10 @@ -namespace MagmaWorks.Taxonomy.Loads +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads { - public interface IMemberDesignCombination : IUltimateLimitState { } + public interface IMemberDesignCombination : IUltimateLimitState { + Ratio PermanentPartialFactor { get; } + Ratio LeadingVariablePartialFactor { get; } + Ratio OtherVariablePartialFactor { get; } + } } diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index 70d9636..ca0423b 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -3,14 +3,6 @@ namespace MagmaWorks.Taxonomy.Loads { public interface IUltimateLimitState : ILoadCombination { - /// - /// γ_Q,1 - Leading variable action partial factor - /// - Ratio LeadingVariable { get; } - - /// - /// γ_Q,i - Accompanying variable action partial factor - /// - Ratio OtherVariable { get; } + } } diff --git a/Loads/ICases/LoadCases/IPermanentCase.cs b/Loads/ICases/LoadCases/IPermanentCase.cs index 0eb3d5a..7faf8b9 100644 --- a/Loads/ICases/LoadCases/IPermanentCase.cs +++ b/Loads/ICases/LoadCases/IPermanentCase.cs @@ -1,9 +1,4 @@ -using OasysUnits; - -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads { - public interface IPermanentCase : ILoadCase - { - - } + public interface IPermanentCase : ILoadCase { } } diff --git a/Taxonomy.sln b/Taxonomy.sln index 0c8b147..ffb4f6e 100644 --- a/Taxonomy.sln +++ b/Taxonomy.sln @@ -75,6 +75,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTests", "Loads\LoadTest EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.ICases", "Loads\ICases\MagmaWorks.Taxonomy.ICases.csproj", "{6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Cases", "Loads\Cases\MagmaWorks.Taxonomy.Cases.csproj", "{8ED7E8B2-BD1C-419F-9FEB-23F51788085E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -197,6 +199,10 @@ Global {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Debug|Any CPU.Build.0 = Debug|Any CPU {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Release|Any CPU.ActiveCfg = Release|Any CPU {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}.Release|Any CPU.Build.0 = Release|Any CPU + {8ED7E8B2-BD1C-419F-9FEB-23F51788085E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8ED7E8B2-BD1C-419F-9FEB-23F51788085E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8ED7E8B2-BD1C-419F-9FEB-23F51788085E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8ED7E8B2-BD1C-419F-9FEB-23F51788085E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -231,6 +237,7 @@ Global {0DB384BD-6270-4A1D-95D4-ED3972AE63B0} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} {D9EF311B-6C73-4EA3-9F87-63D660C24CEE} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} {6B92B8E9-FD08-449B-8EBB-F63E2ADE7043} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} + {8ED7E8B2-BD1C-419F-9FEB-23F51788085E} = {41A2BC38-4EBB-4B17-A305-46BEEB81FE1C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {037E8DD3-6CB9-4A55-BB67-CD24D471F05A} From 46f1e6f62df45765c56bc37c97a64dd3459cc6db Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 26 Sep 2024 17:26:01 +0000 Subject: [PATCH 22/53] Fix code style issues with dotnet_format --- Loads/ICases/Combinations/IEquilibriumCombination.cs | 3 ++- Loads/ICases/Combinations/IMemberDesignCombination.cs | 3 ++- Loads/ICases/Combinations/IUltimateLimitState.cs | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Loads/ICases/Combinations/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs index e5b3b5a..22e384e 100644 --- a/Loads/ICases/Combinations/IEquilibriumCombination.cs +++ b/Loads/ICases/Combinations/IEquilibriumCombination.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IEquilibriumCombination : IUltimateLimitState { + public interface IEquilibriumCombination : IUltimateLimitState + { Ratio PermanentPartialFactor { get; } Ratio LeadingVariablePartialFactor { get; } Ratio OtherVariablePartialFactor { get; } diff --git a/Loads/ICases/Combinations/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs index ad9c29e..8aee2c0 100644 --- a/Loads/ICases/Combinations/IMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IMemberDesignCombination.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IMemberDesignCombination : IUltimateLimitState { + public interface IMemberDesignCombination : IUltimateLimitState + { Ratio PermanentPartialFactor { get; } Ratio LeadingVariablePartialFactor { get; } Ratio OtherVariablePartialFactor { get; } diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index ca0423b..5d625af 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IUltimateLimitState : ILoadCombination { - + public interface IUltimateLimitState : ILoadCombination + { + } } From 41cde162fe35abbe3bce59c6844779e5d42f73e4 Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 30 Sep 2024 10:52:12 +0200 Subject: [PATCH 23/53] fix test --- Loads/LoadTests/AreaForceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Loads/LoadTests/AreaForceTests.cs b/Loads/LoadTests/AreaForceTests.cs index 5671f55..77d1fb3 100644 --- a/Loads/LoadTests/AreaForceTests.cs +++ b/Loads/LoadTests/AreaForceTests.cs @@ -38,8 +38,8 @@ public void FactorTest() // Assert Assert.Equal(f * 2, factored.Z); - Assert.Equal(13.2 * 2, factored.Y.KilonewtonsPerSquareMeter); - Assert.Equal(22.1 * 2, factored.Z.KilonewtonsPerSquareMeter); + Assert.Equal(13.2 * 2, factored.X.KilonewtonsPerSquareMeter); + Assert.Equal(22.1 * 2, factored.Y.KilonewtonsPerSquareMeter); Assert.Equal(LoadApplication.Global, factored.Application); Assert.Equal("myLoad", factored.Label); } From 8be15136cc14eec8e94e3e914d5876ec78d7a793 Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 30 Sep 2024 10:52:34 +0200 Subject: [PATCH 24/53] initialise Label to empty string --- Loads/Loads/AreaForce.cs | 2 +- Loads/Loads/ColumnLoad.cs | 2 +- Loads/Loads/Gravity2d.cs | 2 +- Loads/Loads/LineForce2d.cs | 2 +- Loads/Loads/PointDisplacement2d.cs | 2 +- Loads/Loads/PointForce2d.cs | 2 +- Loads/Loads/PointMoment2d.cs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Loads/Loads/AreaForce.cs b/Loads/Loads/AreaForce.cs index 57763ac..d9c068e 100644 --- a/Loads/Loads/AreaForce.cs +++ b/Loads/Loads/AreaForce.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class AreaForce : IAreaForce { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public LoadApplication Application { get; set; } = LoadApplication.Local; public Pressure X { get; set; } = Pressure.Zero; public Pressure Y { get; set; } = Pressure.Zero; diff --git a/Loads/Loads/ColumnLoad.cs b/Loads/Loads/ColumnLoad.cs index d873b11..c6b84ea 100644 --- a/Loads/Loads/ColumnLoad.cs +++ b/Loads/Loads/ColumnLoad.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class ColumnLoad : IColumnLoad { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public Force Force { get; set; } = Force.Zero; public IPointMoment2d TopMoment { get; set; } = new PointMoment2d(); public IPointMoment2d BottomMoment { get; set; } = new PointMoment2d(); diff --git a/Loads/Loads/Gravity2d.cs b/Loads/Loads/Gravity2d.cs index c82de18..614bccf 100644 --- a/Loads/Loads/Gravity2d.cs +++ b/Loads/Loads/Gravity2d.cs @@ -5,7 +5,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class Gravity2d : IGravity2d { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public Ratio X { get; set; } = Ratio.Zero; public Ratio Z { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); diff --git a/Loads/Loads/LineForce2d.cs b/Loads/Loads/LineForce2d.cs index 92c8a96..e44ebeb 100644 --- a/Loads/Loads/LineForce2d.cs +++ b/Loads/Loads/LineForce2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class LineForce2d : ILineForce2d { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public LoadApplication Application { get; set; } = LoadApplication.Global; public ForcePerLength X { get; set; } = ForcePerLength.Zero; public ForcePerLength Z { get; set; } = ForcePerLength.Zero; diff --git a/Loads/Loads/PointDisplacement2d.cs b/Loads/Loads/PointDisplacement2d.cs index d242a9c..37c2b8b 100644 --- a/Loads/Loads/PointDisplacement2d.cs +++ b/Loads/Loads/PointDisplacement2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointDisplacement2d : IPointDisplacement2d { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public Length X { get; set; } = Length.Zero; public Length Z { get; set; } = Length.Zero; diff --git a/Loads/Loads/PointForce2d.cs b/Loads/Loads/PointForce2d.cs index c8a150f..71a7350 100644 --- a/Loads/Loads/PointForce2d.cs +++ b/Loads/Loads/PointForce2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointForce2d : IPointForce2d { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public Force X { get; set; } = Force.Zero; public Force Z { get; set; } = Force.Zero; diff --git a/Loads/Loads/PointMoment2d.cs b/Loads/Loads/PointMoment2d.cs index 1623b2e..486e9ca 100644 --- a/Loads/Loads/PointMoment2d.cs +++ b/Loads/Loads/PointMoment2d.cs @@ -4,7 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public class PointMoment2d : IPointMoment2d { - public string Label { get; set; } + public string Label { get; set; } = string.Empty; public Moment Yy { get; set; } = Moment.Zero; public Moment Zz { get; set; } = Moment.Zero; From 75df63bc1fe1349bd98aca9d5d6e7d1c8424e3ad Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 30 Sep 2024 11:12:54 +0200 Subject: [PATCH 25/53] additional load tests --- Loads/LoadTests/Gravity2dTests.cs | 30 +++++++++++++++++++ Loads/LoadTests/GravityTests.cs | 32 +++++++++++++++++++++ Loads/LoadTests/PointDisplacement2dTests.cs | 30 +++++++++++++++++++ Loads/LoadTests/PointDisplacementTests.cs | 32 +++++++++++++++++++++ Loads/LoadTests/PointMoment2dTests.cs | 30 +++++++++++++++++++ Loads/LoadTests/PointMomentTests.cs | 32 +++++++++++++++++++++ 6 files changed, 186 insertions(+) create mode 100644 Loads/LoadTests/Gravity2dTests.cs create mode 100644 Loads/LoadTests/GravityTests.cs create mode 100644 Loads/LoadTests/PointDisplacement2dTests.cs create mode 100644 Loads/LoadTests/PointDisplacementTests.cs create mode 100644 Loads/LoadTests/PointMoment2dTests.cs create mode 100644 Loads/LoadTests/PointMomentTests.cs diff --git a/Loads/LoadTests/Gravity2dTests.cs b/Loads/LoadTests/Gravity2dTests.cs new file mode 100644 index 0000000..4435c24 --- /dev/null +++ b/Loads/LoadTests/Gravity2dTests.cs @@ -0,0 +1,30 @@ +using OasysUnits.Units; +using OasysUnits; +using MagmaWorks.Taxonomy.Loads; + +namespace LoadTests +{ + public class Gravity2dTests + { + [Fact] + public void FactorTest() + { + // Assemble + var f = new Ratio(0.9, RatioUnit.DecimalFraction); + Gravity2d load = new Gravity2d(f) + { + Label = "myLoad", + X = new Ratio(0.01, RatioUnit.DecimalFraction), + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IGravity2d factored = (IGravity2d)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Z); + Assert.Equal(0.01 * 2, factored.X.DecimalFractions); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/GravityTests.cs b/Loads/LoadTests/GravityTests.cs new file mode 100644 index 0000000..4c958a4 --- /dev/null +++ b/Loads/LoadTests/GravityTests.cs @@ -0,0 +1,32 @@ +using OasysUnits.Units; +using OasysUnits; +using MagmaWorks.Taxonomy.Loads; + +namespace LoadTests +{ + public class GravityTests + { + [Fact] + public void FactorTest() + { + // Assemble + var f = new Ratio(0.9, RatioUnit.DecimalFraction); + Gravity load = new Gravity(f) + { + Label = "myLoad", + X = new Ratio(0.01, RatioUnit.DecimalFraction), + Y = new Ratio(0.02, RatioUnit.DecimalFraction) + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IGravity factored = (IGravity)load.Factor(factor); + + // Assert + Assert.Equal(f * 2, factored.Z); + Assert.Equal(0.01 * 2, factored.X.DecimalFractions); + Assert.Equal(0.02 * 2, factored.Y.DecimalFractions); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/PointDisplacement2dTests.cs b/Loads/LoadTests/PointDisplacement2dTests.cs new file mode 100644 index 0000000..c34a13b --- /dev/null +++ b/Loads/LoadTests/PointDisplacement2dTests.cs @@ -0,0 +1,30 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class PointDisplacement2dTests + { + [Fact] + public void FactorTest() + { + // Assemble + var x = new Length(1, LengthUnit.Meter); + var z = new Length(3, LengthUnit.Meter); + PointDisplacement2d load = new PointDisplacement2d(x, z) + { + Label = "myLoad", + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IPointDisplacement2d factored = (IPointDisplacement2d)load.Factor(factor); + + // Assert + Assert.Equal(x * 2, factored.X); + Assert.Equal(z * 2, factored.Z); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/PointDisplacementTests.cs b/Loads/LoadTests/PointDisplacementTests.cs new file mode 100644 index 0000000..719099b --- /dev/null +++ b/Loads/LoadTests/PointDisplacementTests.cs @@ -0,0 +1,32 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class PointDisplacementTests + { + [Fact] + public void FactorTest() + { + // Assemble + var x = new Length(1, LengthUnit.Meter); + var y = new Length(2, LengthUnit.Meter); + var z = new Length(3, LengthUnit.Meter); + PointDisplacement load = new PointDisplacement(x, y, z) + { + Label = "myLoad", + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IPointDisplacement factored = (IPointDisplacement)load.Factor(factor); + + // Assert + Assert.Equal(x * 2, factored.X); + Assert.Equal(y * 2, factored.Y); + Assert.Equal(z * 2, factored.Z); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/PointMoment2dTests.cs b/Loads/LoadTests/PointMoment2dTests.cs new file mode 100644 index 0000000..6fe2ee9 --- /dev/null +++ b/Loads/LoadTests/PointMoment2dTests.cs @@ -0,0 +1,30 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class PointMoment2dTests + { + [Fact] + public void FactorTest() + { + // Assemble + var yy = new Moment(2, MomentUnit.KilonewtonMeter); + var zz = new Moment(3, MomentUnit.KilonewtonMeter); + PointMoment2d load = new PointMoment2d(yy, zz) + { + Label = "myLoad", + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IPointMoment2d factored = (IPointMoment2d)load.Factor(factor); + + // Assert + Assert.Equal(yy * 2, factored.Yy); + Assert.Equal(zz * 2, factored.Zz); + Assert.Equal("myLoad", factored.Label); + } + } +} diff --git a/Loads/LoadTests/PointMomentTests.cs b/Loads/LoadTests/PointMomentTests.cs new file mode 100644 index 0000000..0725a1e --- /dev/null +++ b/Loads/LoadTests/PointMomentTests.cs @@ -0,0 +1,32 @@ +using MagmaWorks.Taxonomy.Loads; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadTests +{ + public class PointMomentTests + { + [Fact] + public void FactorTest() + { + // Assemble + var xx = new Moment(1, MomentUnit.KilonewtonMeter); + var yy = new Moment(2, MomentUnit.KilonewtonMeter); + var zz = new Moment(3, MomentUnit.KilonewtonMeter); + PointMoment load = new PointMoment(xx, yy, zz) + { + Label = "myLoad", + }; + var factor = new Ratio(2, RatioUnit.DecimalFraction); + + // Act + IPointMoment factored = (IPointMoment)load.Factor(factor); + + // Assert + Assert.Equal(xx * 2, factored.Xx); + Assert.Equal(yy * 2, factored.Yy); + Assert.Equal(zz * 2, factored.Zz); + Assert.Equal("myLoad", factored.Label); + } + } +} From 8e61eac31335404dd17a5d1d759594dbaf45a48f Mon Sep 17 00:00:00 2001 From: Lint Action Date: Mon, 30 Sep 2024 09:14:42 +0000 Subject: [PATCH 26/53] Fix code style issues with dotnet_format --- Loads/LoadTests/Gravity2dTests.cs | 4 ++-- Loads/LoadTests/GravityTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Loads/LoadTests/Gravity2dTests.cs b/Loads/LoadTests/Gravity2dTests.cs index 4435c24..f5b3ab5 100644 --- a/Loads/LoadTests/Gravity2dTests.cs +++ b/Loads/LoadTests/Gravity2dTests.cs @@ -1,6 +1,6 @@ -using OasysUnits.Units; +using MagmaWorks.Taxonomy.Loads; using OasysUnits; -using MagmaWorks.Taxonomy.Loads; +using OasysUnits.Units; namespace LoadTests { diff --git a/Loads/LoadTests/GravityTests.cs b/Loads/LoadTests/GravityTests.cs index 4c958a4..6e90d3a 100644 --- a/Loads/LoadTests/GravityTests.cs +++ b/Loads/LoadTests/GravityTests.cs @@ -1,6 +1,6 @@ -using OasysUnits.Units; +using MagmaWorks.Taxonomy.Loads; using OasysUnits; -using MagmaWorks.Taxonomy.Loads; +using OasysUnits.Units; namespace LoadTests { From afe41280a5c7d98fe045face23dedd2bc50cebeb Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 30 Sep 2024 19:59:33 +0200 Subject: [PATCH 27/53] combinations WIP --- .../Combinations/EquilibriumCombination.cs | 52 ++++ .../GeotechnicalMemberDesignCombination.cs | 52 ++++ .../Combinations/MemberDesignCombination.cs | 43 +-- .../Utility/ENCombinationFactory.cs | 289 ++++++++++++++++++ Loads/Cases/Combinations/Utility/Utility.cs | 40 +++ Loads/Cases/LoadCases/PermanentCase.cs | 7 +- Loads/Cases/LoadCases/VariableCase.cs | 6 +- Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj | 1 + .../Combinations/IEquilibriumCombination.cs | 13 +- .../IGeotechnicalMemberDesignCombination.cs | 22 ++ Loads/ICases/Combinations/ILoadCombination.cs | 3 - .../Combinations/IMemberDesignCombination.cs | 18 +- .../Combinations/IServiceabilityLimitState.cs | 8 +- .../Combinations/IUltimateLimitState.cs | 5 +- Loads/ICases/LoadCases/ILoadCase.cs | 2 + 15 files changed, 529 insertions(+), 32 deletions(-) create mode 100644 Loads/Cases/Combinations/EquilibriumCombination.cs create mode 100644 Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs create mode 100644 Loads/Cases/Combinations/Utility/ENCombinationFactory.cs create mode 100644 Loads/Cases/Combinations/Utility/Utility.cs create mode 100644 Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs diff --git a/Loads/Cases/Combinations/EquilibriumCombination.cs b/Loads/Cases/Combinations/EquilibriumCombination.cs new file mode 100644 index 0000000..f0e34b8 --- /dev/null +++ b/Loads/Cases/Combinations/EquilibriumCombination.cs @@ -0,0 +1,52 @@ +using OasysUnits; +using System.Collections.Generic; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class EquilibriumCombination : IEquilibriumCombination + { + public string Name { get; set; } + public Ratio PermanentPartialFactor { get; set; } + public Ratio LeadingVariablePartialFactor { get; set; } + public Ratio AccompanyingPartialFactor { get; set; } + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList MainAccompanyingVariableCases { get; set; } + public IList OtherAccompanyingVariableCases { get; set; } + + + public EquilibriumCombination() { } + + public virtual IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange( + Utility.FactorLoads(PermanentPartialFactor, PermanentCases)); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); + } + + if (MainAccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + } + + if (OtherAccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + } + + return factoredLoads; + } + } +} diff --git a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs new file mode 100644 index 0000000..c4bc6fd --- /dev/null +++ b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs @@ -0,0 +1,52 @@ +using OasysUnits; +using System.Collections.Generic; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class GeotechnicalMemberDesignCombination : IGeotechnicalMemberDesignCombination + { + public string Name { get; set; } + public Ratio PermanentPartialFactor { get; set; } + public Ratio LeadingVariablePartialFactor { get; set; } + public Ratio AccompanyingPartialFactor { get; set; } + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList MainAccompanyingVariableCases { get; set; } + public IList OtherAccompanyingVariableCases { get; set; } + + + public GeotechnicalMemberDesignCombination() { } + + public virtual IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange( + Utility.FactorLoads(PermanentPartialFactor, PermanentCases)); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); + } + + if (MainAccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + } + + if (OtherAccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + } + + return factoredLoads; + } + } +} diff --git a/Loads/Cases/Combinations/MemberDesignCombination.cs b/Loads/Cases/Combinations/MemberDesignCombination.cs index 6442210..fd53460 100644 --- a/Loads/Cases/Combinations/MemberDesignCombination.cs +++ b/Loads/Cases/Combinations/MemberDesignCombination.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using OasysUnits; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads { @@ -7,41 +8,47 @@ public class MemberDesignCombination : IMemberDesignCombination { public string Name { get; set; } public Ratio PermanentPartialFactor { get; set; } + public Ratio PermanentReductionFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); public Ratio LeadingVariablePartialFactor { get; set; } - public Ratio OtherVariablePartialFactor { get; set; } + public Ratio AccompanyingPartialFactor { get; set; } public IList PermanentCases { get; set; } public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public IList MainAccompanyingVariableCases { get; set; } + public IList OtherAccompanyingVariableCases { get; set; } + + public MemberDesignCombination() : base() { } - public MemberDesignCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - foreach (ILoadCase loadCase in PermanentCases) + if (PermanentCases != null) { - foreach (ILoad load in loadCase.Loads) - { - factoredLoads.Add(load.Factor(PermanentPartialFactor)); - } + factoredLoads.AddRange( + Utility.FactorLoads(PermanentPartialFactor * PermanentReductionFactor.DecimalFractions, PermanentCases)); } - foreach (ILoadCase loadCase in LeadingVariableCases) + if (LeadingVariableCases != null) { - foreach (ILoad load in loadCase.Loads) - { - factoredLoads.Add(load.Factor(LeadingVariablePartialFactor)); - } + factoredLoads.AddRange( + Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); } - foreach (ILoadCase loadCase in AccompanyingVariableCases) + if (MainAccompanyingVariableCases != null) { - foreach (ILoad load in loadCase.Loads) - { - factoredLoads.Add(load.Factor(OtherVariablePartialFactor)); - } + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + } + + if (OtherAccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); } return factoredLoads; } + } } diff --git a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs new file mode 100644 index 0000000..ab01069 --- /dev/null +++ b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs @@ -0,0 +1,289 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits.Units; +using OasysUnits; +using System.Linq; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static class ENCombinationFactory + { + public static IList CreateEquSetA(IList cases) + { + return CreateEquSetA(cases, NationalAnnex.RecommendedValues); + } + + public static IList CreateEquSetA(IList cases, NationalAnnex nationalAnnex) + { + (IList permanents, IList variables) = SortLoadCases(cases); + int caseId = 1; + TableA1Properties factors = EN1990_TableA1_1[nationalAnnex]; + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new EquilibriumCombination() + { + Name = $"LC{caseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new EquilibriumCombination() + { + Name = $"LC{caseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + public static IList CreateStrGeoSetB(IList cases) + { + return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true); + } + + public static IList CreateStrGeoSetB(IList cases, NationalAnnex nationalAnnex, bool use6_10aAnd6_10b) + { + if (use6_10aAnd6_10b) + { + return CreateSTR6_10aAnd6_10b(cases, nationalAnnex); + } + else + { + return CreateSTR6_10(cases, nationalAnnex); + } + } + + public static IList CreateStrGeoSetC(IList cases) + { + return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues); + } + + public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex) + { + (IList permanents, IList variables) = SortLoadCases(cases); + int caseId = 1; + TableA1Properties factors = EN1990_TableA1_1[nationalAnnex]; + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new GeotechnicalMemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new GeotechnicalMemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex) + { + (IList permanents, IList variables) = SortLoadCases(cases); + int caseId = 1; + TableA1Properties factors = EN1990_TableA1_2[nationalAnnex]; + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static IList CreateSTR6_10aAnd6_10b(IList cases, NationalAnnex nationalAnnex) + { + (IList permanents, IList variables) = SortLoadCases(cases); + int caseId = 1; + TableA1Properties factors = EN1990_TableA1_2[nationalAnnex]; + var combinations = new List(); + + bool onlyOne6_10a = Equals(factors.Gamma_Q1, factors.Gamma_Qi); + if (onlyOne6_10a) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with accompanying variable actions", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + OtherAccompanyingVariableCases = variables, + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + + for (int i = 0; i < variables.Count; i++) + { + if (!onlyOne6_10a) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with {variables[i].Name} as main accompanying variable action", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + MainAccompanyingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10b - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + PermanentReductionFactor = factors.Xi, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10b - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + PermanentReductionFactor = factors.Xi, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static (IList Permanents, IList Variables) SortLoadCases(IList cases) + { + var permanent = new List(); + var variable = new List(); + foreach (var item in cases) + { + switch (item) + { + case IPermanentCase permanentCase: + permanent.Add(permanentCase); + continue; + + case IVariableCase variableCase: + variable.Add(variableCase); + continue; + + default: + throw new System.Exception($"Unrecognised type of load case: {item.GetType()}"); + } + } + + return (permanent, variable); + } + + private static readonly Dictionary EN1990_TableA1_1 = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, + + }; + + private static readonly Dictionary EN1990_TableA1_2 = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, + + }; + + private static readonly Dictionary EN1990_TableA1_3 = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + }; + + private struct TableA1Properties + { + internal Ratio Gamma_Gsup; + internal Ratio Gamma_Ginf; + internal Ratio Gamma_Q1; + internal Ratio Gamma_Qi; + internal Ratio Xi; + + internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi, double xi) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Gamma_Gsup = new Ratio(gamma_Gsup, unit); + Gamma_Ginf = new Ratio(gamma_Ginf, unit); + Gamma_Q1 = new Ratio(gamma_Q1, unit); + Gamma_Qi = new Ratio(gamma_Qi, unit); + Xi = new Ratio(xi, unit); + } + + internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Gamma_Gsup = new Ratio(gamma_Gsup, unit); + Gamma_Ginf = new Ratio(gamma_Ginf, unit); + Gamma_Q1 = new Ratio(gamma_Q1, unit); + Gamma_Qi = new Ratio(gamma_Qi, unit); + Xi = Ratio.Zero; + } + } + } +} diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs new file mode 100644 index 0000000..39f64a2 --- /dev/null +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + internal static class Utility + { + public static IList FactorLoads(Ratio partialFactor, IList loadCases) + where T : ILoadCase + { + var factoredLoads = new List(); + foreach (T loadCase in loadCases) + { + foreach (ILoad load in loadCase.Loads) + { + factoredLoads.Add(load.Factor(partialFactor)); + } + } + + return factoredLoads; + } + + public static IList FactorAccompanyingVariableLoads(Ratio partialFactor, IList loadCases, Func selector) + where T : IVariableCase + { + var factoredLoads = new List(); + foreach (T loadCase in loadCases) + { + foreach (ILoad load in loadCase.Loads) + { + Ratio factor = partialFactor * selector(loadCase).DecimalFractions; + factoredLoads.Add(load.Factor(factor)); + } + } + + return factoredLoads; + } + } +} diff --git a/Loads/Cases/LoadCases/PermanentCase.cs b/Loads/Cases/LoadCases/PermanentCase.cs index 9827d46..e2e2f4b 100644 --- a/Loads/Cases/LoadCases/PermanentCase.cs +++ b/Loads/Cases/LoadCases/PermanentCase.cs @@ -1,12 +1,13 @@ using System.Collections.Generic; -using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { public class PermanentCase : IPermanentCase { - public string Name { get; set; } - public IList Loads { get; set; } + public bool IsFavourable { get; set; } = false; + public bool IsHorizontal { get; set; } = false; + public string Name { get; set; } = "Permanent Loads"; + public IList Loads { get; set; } = new List(); public PermanentCase() { } } diff --git a/Loads/Cases/LoadCases/VariableCase.cs b/Loads/Cases/LoadCases/VariableCase.cs index 7ce565d..832e733 100644 --- a/Loads/Cases/LoadCases/VariableCase.cs +++ b/Loads/Cases/LoadCases/VariableCase.cs @@ -5,11 +5,13 @@ namespace MagmaWorks.Taxonomy.Loads { public class VariableCase : IVariableCase { - public string Name { get; set; } + public bool IsFavourable { get; set; } = false; + public bool IsHorizontal { get; set; } = false; + public string Name { get; set; } = "Variable Loads"; public Ratio Characteristic { get; set; } public Ratio Frequent { get; set; } public Ratio QuasiPermanent { get; set; } - public IList Loads { get; set; } + public IList Loads { get; set; } = new List(); public VariableCase() { } } diff --git a/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj b/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj index ff8b2f5..86d84f3 100644 --- a/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj +++ b/Loads/Cases/MagmaWorks.Taxonomy.Cases.csproj @@ -49,6 +49,7 @@ + diff --git a/Loads/ICases/Combinations/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs index 22e384e..a18c834 100644 --- a/Loads/ICases/Combinations/IEquilibriumCombination.cs +++ b/Loads/ICases/Combinations/IEquilibriumCombination.cs @@ -4,8 +4,19 @@ namespace MagmaWorks.Taxonomy.Loads { public interface IEquilibriumCombination : IUltimateLimitState { + /// + /// γ_G,j (sup or inf) permanent partial factor + /// Ratio PermanentPartialFactor { get; } + + /// + /// γ_Q,1 variable partial factor + /// Ratio LeadingVariablePartialFactor { get; } - Ratio OtherVariablePartialFactor { get; } + + /// + /// γ_Q,i other variable partial factor + /// + Ratio AccompanyingPartialFactor { get; } } } diff --git a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs new file mode 100644 index 0000000..2b68e21 --- /dev/null +++ b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs @@ -0,0 +1,22 @@ +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads +{ + public interface IGeotechnicalMemberDesignCombination : IUltimateLimitState + { + /// + /// γ_G,j (sup or inf) permanent partial factor + /// + Ratio PermanentPartialFactor { get; } + + /// + /// γ_Q,1 variable partial factor + /// + Ratio LeadingVariablePartialFactor { get; } + + /// + /// γ_Q,i other variable partial factor + /// + Ratio AccompanyingPartialFactor { get; } + } +} diff --git a/Loads/ICases/Combinations/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs index 4363c67..f61f264 100644 --- a/Loads/ICases/Combinations/ILoadCombination.cs +++ b/Loads/ICases/Combinations/ILoadCombination.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { @@ -7,8 +6,6 @@ public interface ILoadCombination : ICase { IList PermanentCases { get; } IList LeadingVariableCases { get; } - IList AccompanyingVariableCases { get; } - IList GetFactoredLoads(); } } diff --git a/Loads/ICases/Combinations/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs index 8aee2c0..b2ab963 100644 --- a/Loads/ICases/Combinations/IMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IMemberDesignCombination.cs @@ -4,8 +4,24 @@ namespace MagmaWorks.Taxonomy.Loads { public interface IMemberDesignCombination : IUltimateLimitState { + /// + /// γ_G,j (sup or inf) permanent partial factor + /// Ratio PermanentPartialFactor { get; } + + /// + /// γ_Q,1 variable partial factor + /// Ratio LeadingVariablePartialFactor { get; } - Ratio OtherVariablePartialFactor { get; } + + /// + /// γ_Q,i other variable partial factor + /// + Ratio AccompanyingPartialFactor { get; } + + /// + /// ξ permanent load reduction factor + /// + Ratio PermanentReductionFactor { get; } } } diff --git a/Loads/ICases/Combinations/IServiceabilityLimitState.cs b/Loads/ICases/Combinations/IServiceabilityLimitState.cs index 32735ab..0b3ca2c 100644 --- a/Loads/ICases/Combinations/IServiceabilityLimitState.cs +++ b/Loads/ICases/Combinations/IServiceabilityLimitState.cs @@ -1,4 +1,8 @@ -namespace MagmaWorks.Taxonomy.Loads +using System.Collections.Generic; + +namespace MagmaWorks.Taxonomy.Loads { - public interface IServiceabilityLimitState : ILoadCombination { } + public interface IServiceabilityLimitState : ILoadCombination { + IList AccompanyingVariableCases { get; } + } } diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index 5d625af..5b45f2f 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -1,9 +1,10 @@ -using OasysUnits; +using System.Collections.Generic; namespace MagmaWorks.Taxonomy.Loads { public interface IUltimateLimitState : ILoadCombination { - + IList MainAccompanyingVariableCases { get; } + IList OtherAccompanyingVariableCases { get; } } } diff --git a/Loads/ICases/LoadCases/ILoadCase.cs b/Loads/ICases/LoadCases/ILoadCase.cs index ab21ee6..bd9e8c8 100644 --- a/Loads/ICases/LoadCases/ILoadCase.cs +++ b/Loads/ICases/LoadCases/ILoadCase.cs @@ -5,5 +5,7 @@ namespace MagmaWorks.Taxonomy.Loads public interface ILoadCase : ICase { IList Loads { get; } + bool IsFavourable { get; } + bool IsHorizontal { get; } } } From b3bab67c366b4b5ae74f7ed1ae715126b36b70ca Mon Sep 17 00:00:00 2001 From: Lint Action Date: Mon, 30 Sep 2024 18:01:23 +0000 Subject: [PATCH 28/53] Fix code style issues with dotnet_format --- Loads/Cases/Combinations/EquilibriumCombination.cs | 4 ++-- .../Cases/Combinations/GeotechnicalMemberDesignCombination.cs | 4 ++-- Loads/Cases/Combinations/Utility/ENCombinationFactory.cs | 4 ++-- Loads/ICases/Combinations/IServiceabilityLimitState.cs | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Loads/Cases/Combinations/EquilibriumCombination.cs b/Loads/Cases/Combinations/EquilibriumCombination.cs index f0e34b8..d6af108 100644 --- a/Loads/Cases/Combinations/EquilibriumCombination.cs +++ b/Loads/Cases/Combinations/EquilibriumCombination.cs @@ -1,5 +1,5 @@ -using OasysUnits; -using System.Collections.Generic; +using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { diff --git a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs index c4bc6fd..8cd3fc6 100644 --- a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs +++ b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs @@ -1,5 +1,5 @@ -using OasysUnits; -using System.Collections.Generic; +using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { diff --git a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs index ab01069..6bba143 100644 --- a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs +++ b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; +using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; -using OasysUnits.Units; using OasysUnits; -using System.Linq; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads { diff --git a/Loads/ICases/Combinations/IServiceabilityLimitState.cs b/Loads/ICases/Combinations/IServiceabilityLimitState.cs index 0b3ca2c..16e1382 100644 --- a/Loads/ICases/Combinations/IServiceabilityLimitState.cs +++ b/Loads/ICases/Combinations/IServiceabilityLimitState.cs @@ -2,7 +2,8 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IServiceabilityLimitState : ILoadCombination { + public interface IServiceabilityLimitState : ILoadCombination + { IList AccompanyingVariableCases { get; } } } From 15d6460f8fb9e9bbdb224bce2b4465f70a7f95b8 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 1 Oct 2024 23:24:53 +0200 Subject: [PATCH 29/53] Combinations WIP --- .../Combinations/AccidentialCombination.cs | 78 ++++++++++++ .../Combinations/EquilibriumCombination.cs | 31 ++--- .../GeotechnicalMemberDesignCombination.cs | 27 ++-- .../Combinations/MemberDesignCombination.cs | 14 ++- .../Cases/Combinations/SeismicCombination.cs | 51 ++++++++ .../Utility/ENCombinationFactory.cs | 61 ++++++++- Loads/Cases/Combinations/Utility/Utility.cs | 118 ++++++++++++++++++ Loads/Cases/LoadCases/PermanentCase.cs | 3 +- Loads/Cases/LoadCases/VariableCase.cs | 3 +- .../Combinations/IAccidentialCombination.cs | 13 +- .../Combinations/IEquilibriumCombination.cs | 5 +- .../IGeotechnicalMemberDesignCombination.cs | 5 +- Loads/ICases/Combinations/ILoadCombination.cs | 1 + .../Combinations/IMemberDesignCombination.cs | 6 +- .../Combinations/ISeismicCombination.cs | 10 +- .../Combinations/IUltimateLimitState.cs | 6 +- Loads/ICases/LoadCases/ILoadCase.cs | 1 + 17 files changed, 384 insertions(+), 49 deletions(-) create mode 100644 Loads/Cases/Combinations/AccidentialCombination.cs create mode 100644 Loads/Cases/Combinations/SeismicCombination.cs diff --git a/Loads/Cases/Combinations/AccidentialCombination.cs b/Loads/Cases/Combinations/AccidentialCombination.cs new file mode 100644 index 0000000..e784f4a --- /dev/null +++ b/Loads/Cases/Combinations/AccidentialCombination.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class AccidentialCombination : IAccidentialCombination + { + public string Name { get; set; } + public string Definition => GetDefinition(); + public bool UseFrequentCombinationFactorForMainAccompanying { get; set; } = true; + public Ratio LeadingAccidentialPartialFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList MainAccompanyingVariableCases { get; set; } + public IList OtherAccompanyingVariableCases { get; set; } + + public AccidentialCombination() { } + + public IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange((IList)PermanentCases); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorLoads(LeadingAccidentialPartialFactor, LeadingVariableCases)); + } + + if (MainAccompanyingVariableCases != null) + { + if (UseFrequentCombinationFactorForMainAccompanying) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + MainAccompanyingVariableCases, ld => ld.Frequent)); + } + else + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + MainAccompanyingVariableCases, ld => ld.QuasiPermanent)); + } + } + + if (OtherAccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + OtherAccompanyingVariableCases, ld => ld.QuasiPermanent)); + } + + return factoredLoads; + } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); + string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingAccidentialPartialFactor); + Func selector = ld => ld.QuasiPermanent; + if (UseFrequentCombinationFactorForMainAccompanying) + { + selector = ld => ld.Frequent; + } + + string main = Utility.DescriptionHelper( + MainAccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), selector); + string other = Utility.DescriptionHelper( + OtherAccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + return Utility.JoinDescriptions(new string[] { perm, lead, main, other }); + } + } +} diff --git a/Loads/Cases/Combinations/EquilibriumCombination.cs b/Loads/Cases/Combinations/EquilibriumCombination.cs index f0e34b8..504f774 100644 --- a/Loads/Cases/Combinations/EquilibriumCombination.cs +++ b/Loads/Cases/Combinations/EquilibriumCombination.cs @@ -1,23 +1,22 @@ -using OasysUnits; -using System.Collections.Generic; +using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { public class EquilibriumCombination : IEquilibriumCombination { public string Name { get; set; } + public string Definition => GetDefinition(); public Ratio PermanentPartialFactor { get; set; } public Ratio LeadingVariablePartialFactor { get; set; } public Ratio AccompanyingPartialFactor { get; set; } public IList PermanentCases { get; set; } public IList LeadingVariableCases { get; set; } - public IList MainAccompanyingVariableCases { get; set; } - public IList OtherAccompanyingVariableCases { get; set; } - + public IList AccompanyingVariableCases { get; set; } public EquilibriumCombination() { } - public virtual IList GetFactoredLoads() + public IList GetFactoredLoads() { var factoredLoads = new List(); if (PermanentCases != null) @@ -32,21 +31,23 @@ public virtual IList GetFactoredLoads() Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); } - if (MainAccompanyingVariableCases != null) + if (AccompanyingVariableCases != null) { factoredLoads.AddRange( Utility.FactorAccompanyingVariableLoads( - LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); - } - - if (OtherAccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorAccompanyingVariableLoads( - AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + AccompanyingPartialFactor, AccompanyingVariableCases, ld => ld.Characteristic)); } return factoredLoads; } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, PermanentPartialFactor); + string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingVariablePartialFactor); + string other = Utility.DescriptionHelper( + AccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); + return Utility.JoinDescriptions(new string[] { perm, lead, other }); + } } } diff --git a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs index c4bc6fd..663738f 100644 --- a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs +++ b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs @@ -6,18 +6,17 @@ namespace MagmaWorks.Taxonomy.Loads public class GeotechnicalMemberDesignCombination : IGeotechnicalMemberDesignCombination { public string Name { get; set; } + public string Definition => GetDefinition(); public Ratio PermanentPartialFactor { get; set; } public Ratio LeadingVariablePartialFactor { get; set; } public Ratio AccompanyingPartialFactor { get; set; } public IList PermanentCases { get; set; } public IList LeadingVariableCases { get; set; } - public IList MainAccompanyingVariableCases { get; set; } - public IList OtherAccompanyingVariableCases { get; set; } - + public IList AccompanyingVariableCases { get; set; } public GeotechnicalMemberDesignCombination() { } - public virtual IList GetFactoredLoads() + public IList GetFactoredLoads() { var factoredLoads = new List(); if (PermanentCases != null) @@ -32,21 +31,23 @@ public virtual IList GetFactoredLoads() Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); } - if (MainAccompanyingVariableCases != null) + if (AccompanyingVariableCases != null) { factoredLoads.AddRange( Utility.FactorAccompanyingVariableLoads( - LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); - } - - if (OtherAccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorAccompanyingVariableLoads( - AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + AccompanyingPartialFactor, AccompanyingVariableCases, ld => ld.Characteristic)); } return factoredLoads; } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, PermanentPartialFactor); + string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingVariablePartialFactor); + string other = Utility.DescriptionHelper( + AccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); + return Utility.JoinDescriptions(new string[] { perm, lead, other }); + } } } diff --git a/Loads/Cases/Combinations/MemberDesignCombination.cs b/Loads/Cases/Combinations/MemberDesignCombination.cs index fd53460..97e439b 100644 --- a/Loads/Cases/Combinations/MemberDesignCombination.cs +++ b/Loads/Cases/Combinations/MemberDesignCombination.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using OasysUnits; using OasysUnits.Units; @@ -7,6 +8,7 @@ namespace MagmaWorks.Taxonomy.Loads public class MemberDesignCombination : IMemberDesignCombination { public string Name { get; set; } + public string Definition => GetDefinition(); public Ratio PermanentPartialFactor { get; set; } public Ratio PermanentReductionFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); public Ratio LeadingVariablePartialFactor { get; set; } @@ -50,5 +52,15 @@ public IList GetFactoredLoads() return factoredLoads; } + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, PermanentPartialFactor, PermanentReductionFactor); + string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingVariablePartialFactor); + string main = Utility.DescriptionHelper( + MainAccompanyingVariableCases, LeadingVariablePartialFactor, ld => ld.Characteristic); + string other = Utility.DescriptionHelper( + OtherAccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); + return Utility.JoinDescriptions(new string[] { perm, lead, main, other }); + } } } diff --git a/Loads/Cases/Combinations/SeismicCombination.cs b/Loads/Cases/Combinations/SeismicCombination.cs new file mode 100644 index 0000000..cbf0efa --- /dev/null +++ b/Loads/Cases/Combinations/SeismicCombination.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class SeismicCombination : ISeismicCombination + { + public string Name { get; set; } + public string Definition => GetDefinition(); + public Ratio LeadingSeismicPartialFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList AccompanyingVariableCases { get; set; } + + public SeismicCombination() { } + + public virtual IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange((IList)PermanentCases); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange( + Utility.FactorLoads(LeadingSeismicPartialFactor, LeadingVariableCases)); + } + + if (AccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + AccompanyingVariableCases, ld => ld.QuasiPermanent)); + } + + return factoredLoads; + } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); + string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingSeismicPartialFactor); + string other = Utility.DescriptionHelper( + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + return Utility.JoinDescriptions(new string[] { perm, lead, other }); + } + } +} diff --git a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs index ab01069..1157dd2 100644 --- a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs +++ b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs @@ -1,12 +1,13 @@ using System.Collections.Generic; +using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; using OasysUnits.Units; using OasysUnits; -using System.Linq; +using System.Xml.Linq; namespace MagmaWorks.Taxonomy.Loads { - public static class ENCombinationFactory + public static partial class ENCombinationFactory { public static IList CreateEquSetA(IList cases) { @@ -28,7 +29,7 @@ public static IList CreateEquSetA(IList case PermanentPartialFactor = factors.Gamma_Gsup, LeadingVariableCases = new List() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), AccompanyingPartialFactor = factors.Gamma_Qi, }); @@ -41,7 +42,7 @@ public static IList CreateEquSetA(IList case PermanentPartialFactor = factors.Gamma_Ginf, LeadingVariableCases = new List() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), AccompanyingPartialFactor = factors.Gamma_Qi, }); } @@ -87,7 +88,7 @@ public static IList CreateStrGeoSetC(IList PermanentPartialFactor = factors.Gamma_Gsup, LeadingVariableCases = new List() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), AccompanyingPartialFactor = factors.Gamma_Qi, }); @@ -100,7 +101,7 @@ public static IList CreateStrGeoSetC(IList PermanentPartialFactor = factors.Gamma_Ginf, LeadingVariableCases = new List() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), AccompanyingPartialFactor = factors.Gamma_Qi, }); } @@ -109,6 +110,54 @@ public static IList CreateStrGeoSetC(IList return combinations; } + public static IList CreateAccidential(IVariableCase accidentalCase, Ratio partialFactor, + IList otherCases, NationalAnnex nationalAnnex, bool useFrequentCombinationFactorForMainAccompanying) + { + (IList permanents, IList variables) = SortLoadCases(otherCases); + int caseId = 1; + TableA1Properties factors = EN1990_TableA1_1[nationalAnnex]; + var combinations = new List(); + if (!useFrequentCombinationFactorForMainAccompanying) + { + combinations.Add(new AccidentialCombination() + { + Name = $"Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", + PermanentCases = permanents, + OtherAccompanyingVariableCases = variables, + UseFrequentCombinationFactorForMainAccompanying = false + }); + return combinations; + } + + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new AccidentialCombination() + { + Name = $"LC{caseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name} combined with {variables[i].Name} as main accompanying variable action", + PermanentCases = permanents, + LeadingAccidentialPartialFactor = partialFactor, + LeadingVariableCases = new List() { variables[i] }, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + UseFrequentCombinationFactorForMainAccompanying = true + }); + } + + return combinations; + } + + public static ISeismicCombination CreateSeismic(IVariableCase seismicCase, Ratio partialFactor, IList otherCases, NationalAnnex nationalAnnex) + { + (IList permanents, IList variables) = SortLoadCases(otherCases); + return new SeismicCombination() + { + Name = $"Seismic, Eq. 6.12a/b - Leading {seismicCase.Name}", + PermanentCases = permanents, + LeadingVariableCases = new List() { seismicCase }, + LeadingSeismicPartialFactor = partialFactor, + AccompanyingVariableCases = variables, + }; + } + private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex) { (IList permanents, IList variables) = SortLoadCases(cases); diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 39f64a2..e625370 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -1,5 +1,8 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads @@ -36,5 +39,120 @@ public static IList FactorAccompanyingVariableLoads(Ratio partialFacto return factoredLoads; } + + public static IList SelectAccompanyingVariableLoads(IList loadCases, Func selector) + where T : IVariableCase + { + var factoredLoads = new List(); + foreach (T loadCase in loadCases) + { + foreach (ILoad load in loadCase.Loads) + { + factoredLoads.Add(load.Factor(selector(loadCase))); + } + } + + return factoredLoads; + } + + internal static string DescriptionHelper(IList cases, Ratio factor) where T : ILoadCase + { + if (cases == null || cases.Count == 0 || factor.Value == 0) + { + return string.Empty; + } + + if (cases.Count == 1) + { + if (factor.DecimalFractions == 1) + { + return cases.First().Nickname; + } + else + { + return $"{factor}·{cases.First().Nickname}"; + } + } + + StringBuilder desc = new StringBuilder(); + if (factor.Value != 1) + { + desc.AppendLine($"{factor}·"); + } + + desc.AppendLine("("); + foreach (ILoadCase lc in cases) + { + desc.Append($"{lc.Nickname} + "); + } + + desc.AppendLine(")"); + return desc.ToString(); + } + + internal static string DescriptionHelper(IList cases, Ratio factor1, Ratio factor2) where T : ILoadCase + { + if (cases == null || cases.Count == 0 || factor1.Value == 0) + { + return string.Empty; + } + string f2 = factor2.DecimalFractions == 1 ? string.Empty : $"{factor2}·"; + + if (cases.Count == 1) + { + return $"{factor1}·{f2}{cases.First().Nickname}"; + } + + StringBuilder desc = new StringBuilder(); + desc.AppendLine($"{factor1}·{f2}("); + foreach (ILoadCase lc in cases) + { + desc.Append($"{lc.Nickname} + "); + } + + desc.AppendLine(")"); + return desc.ToString(); + } + + internal static string DescriptionHelper(IList cases, Ratio factor, Func selector) + where T : IVariableCase + { + if (cases == null || cases.Count == 0 || factor.Value == 0) + { + return string.Empty; + } + + if (cases.Count == 1) + { + if (factor.DecimalFractions == 1) + { + return cases.First().Nickname; + } + else + { + return $"{factor}·{selector(cases.First())}·{cases.First().Nickname}"; + } + } + + StringBuilder desc = new StringBuilder(); + if (factor.Value != 1) + { + desc.AppendLine($"{factor}·"); + } + + desc.AppendLine("("); + foreach (ILoadCase lc in cases) + { + desc.Append($"{selector(cases.First())}·{lc.Nickname} + "); + } + + desc.AppendLine(")"); + return desc.ToString(); + } + + internal static string JoinDescriptions(string[] strings) + { + return string.Join(" + ", strings).Replace(" + + ", string.Empty).Trim(new char[] {' ', '+'}); + } } } diff --git a/Loads/Cases/LoadCases/PermanentCase.cs b/Loads/Cases/LoadCases/PermanentCase.cs index e2e2f4b..d1dbb62 100644 --- a/Loads/Cases/LoadCases/PermanentCase.cs +++ b/Loads/Cases/LoadCases/PermanentCase.cs @@ -4,9 +4,10 @@ namespace MagmaWorks.Taxonomy.Loads { public class PermanentCase : IPermanentCase { + public string Nickname { get; set; } = "G"; public bool IsFavourable { get; set; } = false; public bool IsHorizontal { get; set; } = false; - public string Name { get; set; } = "Permanent Loads"; + public string Name { get; set; } = "Dead Load"; public IList Loads { get; set; } = new List(); public PermanentCase() { } diff --git a/Loads/Cases/LoadCases/VariableCase.cs b/Loads/Cases/LoadCases/VariableCase.cs index 832e733..03d1cd9 100644 --- a/Loads/Cases/LoadCases/VariableCase.cs +++ b/Loads/Cases/LoadCases/VariableCase.cs @@ -5,9 +5,10 @@ namespace MagmaWorks.Taxonomy.Loads { public class VariableCase : IVariableCase { + public string Nickname { get; set; } = "Q"; public bool IsFavourable { get; set; } = false; public bool IsHorizontal { get; set; } = false; - public string Name { get; set; } = "Variable Loads"; + public string Name { get; set; } = "Live Load"; public Ratio Characteristic { get; set; } public Ratio Frequent { get; set; } public Ratio QuasiPermanent { get; set; } diff --git a/Loads/ICases/Combinations/IAccidentialCombination.cs b/Loads/ICases/Combinations/IAccidentialCombination.cs index 74180bd..eead159 100644 --- a/Loads/ICases/Combinations/IAccidentialCombination.cs +++ b/Loads/ICases/Combinations/IAccidentialCombination.cs @@ -1,4 +1,13 @@ -namespace MagmaWorks.Taxonomy.Loads +using System.Collections.Generic; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads { - public interface IAccidentialCombination : IUltimateLimitState { } + public interface IAccidentialCombination : IUltimateLimitState + { + bool UseFrequentCombinationFactorForMainAccompanying { get; } + Ratio LeadingAccidentialPartialFactor { get; } + IList MainAccompanyingVariableCases { get; } + IList OtherAccompanyingVariableCases { get; } + } } diff --git a/Loads/ICases/Combinations/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs index a18c834..4ce23a7 100644 --- a/Loads/ICases/Combinations/IEquilibriumCombination.cs +++ b/Loads/ICases/Combinations/IEquilibriumCombination.cs @@ -1,4 +1,5 @@ -using OasysUnits; +using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { @@ -18,5 +19,7 @@ public interface IEquilibriumCombination : IUltimateLimitState /// γ_Q,i other variable partial factor /// Ratio AccompanyingPartialFactor { get; } + + IList AccompanyingVariableCases { get; } } } diff --git a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs index 2b68e21..c5715e7 100644 --- a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs @@ -1,4 +1,5 @@ -using OasysUnits; +using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { @@ -18,5 +19,7 @@ public interface IGeotechnicalMemberDesignCombination : IUltimateLimitState /// γ_Q,i other variable partial factor /// Ratio AccompanyingPartialFactor { get; } + + IList AccompanyingVariableCases { get; } } } diff --git a/Loads/ICases/Combinations/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs index f61f264..a51c55d 100644 --- a/Loads/ICases/Combinations/ILoadCombination.cs +++ b/Loads/ICases/Combinations/ILoadCombination.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public interface ILoadCombination : ICase { + string Definition { get; } IList PermanentCases { get; } IList LeadingVariableCases { get; } IList GetFactoredLoads(); diff --git a/Loads/ICases/Combinations/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs index b2ab963..68e67de 100644 --- a/Loads/ICases/Combinations/IMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IMemberDesignCombination.cs @@ -1,4 +1,5 @@ -using OasysUnits; +using System.Collections.Generic; +using OasysUnits; namespace MagmaWorks.Taxonomy.Loads { @@ -23,5 +24,8 @@ public interface IMemberDesignCombination : IUltimateLimitState /// ξ permanent load reduction factor /// Ratio PermanentReductionFactor { get; } + + IList MainAccompanyingVariableCases { get; } + IList OtherAccompanyingVariableCases { get; } } } diff --git a/Loads/ICases/Combinations/ISeismicCombination.cs b/Loads/ICases/Combinations/ISeismicCombination.cs index 9051d41..e99ed42 100644 --- a/Loads/ICases/Combinations/ISeismicCombination.cs +++ b/Loads/ICases/Combinations/ISeismicCombination.cs @@ -1,4 +1,10 @@ -namespace MagmaWorks.Taxonomy.Loads +using System.Collections.Generic; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads { - public interface ISeismicCombination : IUltimateLimitState { } + public interface ISeismicCombination : IUltimateLimitState { + Ratio LeadingSeismicPartialFactor { get; } + IList AccompanyingVariableCases { get; } + } } diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index 5b45f2f..d8387f1 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -2,9 +2,5 @@ namespace MagmaWorks.Taxonomy.Loads { - public interface IUltimateLimitState : ILoadCombination - { - IList MainAccompanyingVariableCases { get; } - IList OtherAccompanyingVariableCases { get; } - } + public interface IUltimateLimitState : ILoadCombination { } } diff --git a/Loads/ICases/LoadCases/ILoadCase.cs b/Loads/ICases/LoadCases/ILoadCase.cs index bd9e8c8..96af79b 100644 --- a/Loads/ICases/LoadCases/ILoadCase.cs +++ b/Loads/ICases/LoadCases/ILoadCase.cs @@ -4,6 +4,7 @@ namespace MagmaWorks.Taxonomy.Loads { public interface ILoadCase : ICase { + string Nickname { get; } IList Loads { get; } bool IsFavourable { get; } bool IsHorizontal { get; } From 87616b775ee61103695314b9c559045dd3b66a7d Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 1 Oct 2024 21:26:59 +0000 Subject: [PATCH 30/53] Fix code style issues with dotnet_format --- Loads/Cases/Combinations/Utility/Utility.cs | 2 +- Loads/ICases/Combinations/ISeismicCombination.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index e625370..27163cb 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -152,7 +152,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor, Func AccompanyingVariableCases { get; } } From 862f6b6f62e6b5834fd88243759cf6afe52871c1 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 2 Oct 2024 21:32:56 +0200 Subject: [PATCH 31/53] Combinations WIP --- .../Combinations/CharacteristicCombination.cs | 49 +++ .../Factory/ENCombinationFactoryUtility.cs | 64 ++++ .../Factory/ENCombinationSetAFactory.cs | 61 ++++ .../Factory/ENCombinationSetBFactory.cs | 142 ++++++++ .../Factory/ENCombinationSetCFactory.cs | 59 +++ .../Factory/ENSLSCombinationFactory.cs | 95 +++++ .../ENULSCombinationAccidentialFactory.cs | 64 ++++ .../Cases/Combinations/FrequentCombination.cs | 52 +++ .../Combinations/QuasiPermanentCombination.cs | 52 +++ .../Utility/ENCombinationFactory.cs | 337 ------------------ .../Cases/LoadCases/Factory/ENLoadFactory.cs | 17 + .../Combinations/IUltimateLimitState.cs | 4 +- 12 files changed, 656 insertions(+), 340 deletions(-) create mode 100644 Loads/Cases/Combinations/CharacteristicCombination.cs create mode 100644 Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs create mode 100644 Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs create mode 100644 Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs create mode 100644 Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs create mode 100644 Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs create mode 100644 Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs create mode 100644 Loads/Cases/Combinations/FrequentCombination.cs create mode 100644 Loads/Cases/Combinations/QuasiPermanentCombination.cs delete mode 100644 Loads/Cases/Combinations/Utility/ENCombinationFactory.cs create mode 100644 Loads/Cases/LoadCases/Factory/ENLoadFactory.cs diff --git a/Loads/Cases/Combinations/CharacteristicCombination.cs b/Loads/Cases/Combinations/CharacteristicCombination.cs new file mode 100644 index 0000000..e12dcc7 --- /dev/null +++ b/Loads/Cases/Combinations/CharacteristicCombination.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class CharacteristicCombination : ICharacteristicCombination + { + public string Name { get; set; } + public string Definition => GetDefinition(); + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList AccompanyingVariableCases { get; set; } + + public CharacteristicCombination() { } + + public IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange((IList)PermanentCases); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange((IEnumerable)LeadingVariableCases); + } + + if (AccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + AccompanyingVariableCases, ld => ld.Characteristic)); + } + + return factoredLoads; + } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); + string lead = Utility.DescriptionHelper(LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction)); + string other = Utility.DescriptionHelper( + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Characteristic); + return Utility.JoinDescriptions(new string[] { perm, lead, other }); + } + } +} diff --git a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs new file mode 100644 index 0000000..b380692 --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENCombinationFactory + { + private struct TableA1Properties + { + internal Ratio Gamma_Gsup; + internal Ratio Gamma_Ginf; + internal Ratio Gamma_Q1; + internal Ratio Gamma_Qi; + internal Ratio Xi; + + internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi, double xi) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Gamma_Gsup = new Ratio(gamma_Gsup, unit); + Gamma_Ginf = new Ratio(gamma_Ginf, unit); + Gamma_Q1 = new Ratio(gamma_Q1, unit); + Gamma_Qi = new Ratio(gamma_Qi, unit); + Xi = new Ratio(xi, unit); + } + + internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Gamma_Gsup = new Ratio(gamma_Gsup, unit); + Gamma_Ginf = new Ratio(gamma_Ginf, unit); + Gamma_Q1 = new Ratio(gamma_Q1, unit); + Gamma_Qi = new Ratio(gamma_Qi, unit); + Xi = Ratio.Zero; + } + } + + private static (IList Permanents, IList Variables) SortLoadCases(IList cases) + { + var permanent = new List(); + var variable = new List(); + foreach (var item in cases) + { + switch (item) + { + case IPermanentCase permanentCase: + permanent.Add(permanentCase); + continue; + + case IVariableCase variableCase: + variable.Add(variableCase); + continue; + + default: + throw new System.Exception($"Unrecognised type of load case: {item.GetType()}"); + } + } + + return (permanent, variable); + } + + + } +} diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs new file mode 100644 index 0000000..633cc25 --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using System.Linq; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENCombinationFactory + { + public static IList CreateEquSetA(IList cases) + { + return CreateEquSetA(cases, NationalAnnex.RecommendedValues); + } + + public static IList CreateEquSetA(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + if (!EN1990_TableA1_2A.TryGetValue(nationalAnnex, out TableA1Properties factors)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(A) values"); + }; + + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new EquilibriumCombination() + { + Name = $"LC{firstCaseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new EquilibriumCombination() + { + Name = $"LC{firstCaseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static readonly Dictionary EN1990_TableA1_2A = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, + + }; + } +} diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs new file mode 100644 index 0000000..b119a1c --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs @@ -0,0 +1,142 @@ +using System.Collections.Generic; +using System.Linq; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENCombinationFactory + { + public static IList CreateStrGeoSetB(IList cases, int firstCaseId = 1) + { + return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true, firstCaseId); + } + + public static IList CreateStrGeoSetB(IList cases, NationalAnnex nationalAnnex, bool use6_10aAnd6_10b, int firstCaseId = 1) + { + if (use6_10aAnd6_10b) + { + return CreateSTR6_10aAnd6_10b(cases, nationalAnnex, firstCaseId); + } + else + { + return CreateSTR6_10(cases, nationalAnnex, firstCaseId); + } + } + + private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1Properties factors)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(B) values"); + }; + + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static IList CreateSTR6_10aAnd6_10b(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1Properties factors)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(B) values"); + }; + + var combinations = new List(); + bool onlyOne6_10a = Equals(factors.Gamma_Q1, factors.Gamma_Qi); + if (onlyOne6_10a) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with accompanying variable actions", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + OtherAccompanyingVariableCases = variables, + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + + for (int i = 0; i < variables.Count; i++) + { + if (!onlyOne6_10a) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with {variables[i].Name} as main accompanying variable action", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + MainAccompanyingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10b - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + PermanentReductionFactor = factors.Xi, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new MemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10b - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + PermanentReductionFactor = factors.Xi, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static readonly Dictionary EN1990_TableA1_2B = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, + + }; + } +} diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs new file mode 100644 index 0000000..40e14dc --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Linq; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENCombinationFactory + { + public static IList CreateStrGeoSetC(IList cases, int firstCaseId = 1) + { + return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues, firstCaseId); + } + + public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1Properties factors)){ + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(C) values"); + }; + + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new GeotechnicalMemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name}", + PermanentCases = permanents, + PermanentPartialFactor = factors.Gamma_Gsup, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new GeotechnicalMemberDesignCombination() + { + Name = $"LC{firstCaseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + PermanentPartialFactor = factors.Gamma_Ginf, + LeadingVariableCases = new List() { variables[i] }, + LeadingVariablePartialFactor = factors.Gamma_Q1, + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + AccompanyingPartialFactor = factors.Gamma_Qi, + }); + } + } + + return combinations; + } + + private static readonly Dictionary EN1990_TableA1_2C = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + }; + } +} diff --git a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs new file mode 100644 index 0000000..c71db58 --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; +using System.Linq; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENCombinationFactory + { + public static IList CreateCharacteristic(IList cases, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new CharacteristicCombination() + { + Name = $"LC{firstCaseId++}: SLS Characteristic - Leading {variables[i].Name}", + PermanentCases = permanents, + LeadingVariableCases = new List() { variables[i] }, + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new CharacteristicCombination() + { + Name = $"LC{firstCaseId++}: SLS Characteristic - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + LeadingVariableCases = new List() { variables[i] }, + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + }); + } + } + + return combinations; + } + + public static IList CreateFrequent(IList cases, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new FrequentCombination() + { + Name = $"LC{firstCaseId++}: SLS Frequent - Leading {variables[i].Name}", + PermanentCases = permanents, + LeadingVariableCases = new List() { variables[i] }, + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new FrequentCombination() + { + Name = $"LC{firstCaseId++}: SLS Frequent - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + LeadingVariableCases = new List() { variables[i] }, + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + }); + } + } + + return combinations; + } + + public static IList CreateQuasiPermanent(IList cases, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(cases); + var combinations = new List(); + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new QuasiPermanentCombination() + { + Name = $"LC{firstCaseId++}: SLS Quasi-permanent - Leading {variables[i].Name}", + PermanentCases = permanents, + LeadingVariableCases = new List() { variables[i] }, + AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + }); + + if (variables[i].IsHorizontal) + { + combinations.Add(new QuasiPermanentCombination() + { + Name = $"LC{firstCaseId++}: SLS Quasi-permanent - Leading {variables[i].Name} with unfavourable permanent", + PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), + LeadingVariableCases = new List() { variables[i] }, + AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), + }); + } + } + + return combinations; + } + } +} diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs new file mode 100644 index 0000000..180773b --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using System.Linq; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENCombinationFactory + { + public static IList CreateAccidential(IVariableCase accidentalCase, Ratio partialFactor, + IList otherCases, NationalAnnex nationalAnnex, bool useFrequentCombinationFactorForMainAccompanying, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(otherCases); + var combinations = new List(); + if (!useFrequentCombinationFactorForMainAccompanying) + { + combinations.Add(new AccidentialCombination() + { + Name = $"Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", + PermanentCases = permanents, + OtherAccompanyingVariableCases = variables, + UseFrequentCombinationFactorForMainAccompanying = false + }); + return combinations; + } + + for (int i = 0; i < variables.Count; i++) + { + combinations.Add(new AccidentialCombination() + { + Name = $"LC{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name} combined with {variables[i].Name} as main accompanying variable action", + PermanentCases = permanents, + LeadingAccidentialPartialFactor = partialFactor, + LeadingVariableCases = new List() { variables[i] }, + OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), + UseFrequentCombinationFactorForMainAccompanying = true + }); + } + + return combinations; + } + + public static IList CreateSeismic(IList seismicCases, Ratio partialFactor, + IList otherCases, NationalAnnex nationalAnnex, int firstCaseId = 1) + { + (IList permanents, IList variables) = SortLoadCases(otherCases); + var combinations = new List(); + for (int i = 0; i < seismicCases.Count; i++) + { + combinations.Add(new SeismicCombination() + { + Name = $"LC{firstCaseId++}: Seismic, Eq. 6.12a/b - Leading {seismicCases[i].Name}", + PermanentCases = permanents, + LeadingVariableCases = new List() { seismicCases[i] }, + LeadingSeismicPartialFactor = partialFactor, + AccompanyingVariableCases = variables, + } ); + } + + return combinations; + } + } +} diff --git a/Loads/Cases/Combinations/FrequentCombination.cs b/Loads/Cases/Combinations/FrequentCombination.cs new file mode 100644 index 0000000..eac0b97 --- /dev/null +++ b/Loads/Cases/Combinations/FrequentCombination.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class FrequentCombination : IFrequentCombination + { + public string Name { get; set; } + public string Definition => GetDefinition(); + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList AccompanyingVariableCases { get; set; } + + public FrequentCombination() { } + + public IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange((IList)PermanentCases); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + LeadingVariableCases, ld => ld.Frequent)); + } + + if (AccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + AccompanyingVariableCases, ld => ld.QuasiPermanent)); + } + + return factoredLoads; + } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); + string lead = Utility.DescriptionHelper( + LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Frequent); + string other = Utility.DescriptionHelper( + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + return Utility.JoinDescriptions(new string[] { perm, lead, other }); + } + } +} diff --git a/Loads/Cases/Combinations/QuasiPermanentCombination.cs b/Loads/Cases/Combinations/QuasiPermanentCombination.cs new file mode 100644 index 0000000..3c2e6aa --- /dev/null +++ b/Loads/Cases/Combinations/QuasiPermanentCombination.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public class QuasiPermanentCombination : IQuasiPermanentCombination + { + public string Name { get; set; } + public string Definition => GetDefinition(); + public IList PermanentCases { get; set; } + public IList LeadingVariableCases { get; set; } + public IList AccompanyingVariableCases { get; set; } + + public QuasiPermanentCombination() { } + + public IList GetFactoredLoads() + { + var factoredLoads = new List(); + if (PermanentCases != null) + { + factoredLoads.AddRange((IList)PermanentCases); + } + + if (LeadingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + LeadingVariableCases, ld => ld.QuasiPermanent)); + } + + if (AccompanyingVariableCases != null) + { + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads( + AccompanyingVariableCases, ld => ld.QuasiPermanent)); + } + + return factoredLoads; + } + + private string GetDefinition() + { + string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); + string lead = Utility.DescriptionHelper( + LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Frequent); + string other = Utility.DescriptionHelper( + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + return Utility.JoinDescriptions(new string[] { perm, lead, other }); + } + } +} diff --git a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs b/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs deleted file mode 100644 index 915ffe4..0000000 --- a/Loads/Cases/Combinations/Utility/ENCombinationFactory.cs +++ /dev/null @@ -1,337 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using MagmaWorks.Taxonomy.Standards.Eurocode; -using OasysUnits; -using OasysUnits.Units; - -namespace MagmaWorks.Taxonomy.Loads -{ - public static partial class ENCombinationFactory - { - public static IList CreateEquSetA(IList cases) - { - return CreateEquSetA(cases, NationalAnnex.RecommendedValues); - } - - public static IList CreateEquSetA(IList cases, NationalAnnex nationalAnnex) - { - (IList permanents, IList variables) = SortLoadCases(cases); - int caseId = 1; - TableA1Properties factors = EN1990_TableA1_1[nationalAnnex]; - var combinations = new List(); - for (int i = 0; i < variables.Count; i++) - { - combinations.Add(new EquilibriumCombination() - { - Name = $"LC{caseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name}", - PermanentCases = permanents, - PermanentPartialFactor = factors.Gamma_Gsup, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - - if (variables[i].IsHorizontal) - { - combinations.Add(new EquilibriumCombination() - { - Name = $"LC{caseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", - PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), - PermanentPartialFactor = factors.Gamma_Ginf, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - } - } - - return combinations; - } - - public static IList CreateStrGeoSetB(IList cases) - { - return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true); - } - - public static IList CreateStrGeoSetB(IList cases, NationalAnnex nationalAnnex, bool use6_10aAnd6_10b) - { - if (use6_10aAnd6_10b) - { - return CreateSTR6_10aAnd6_10b(cases, nationalAnnex); - } - else - { - return CreateSTR6_10(cases, nationalAnnex); - } - } - - public static IList CreateStrGeoSetC(IList cases) - { - return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues); - } - - public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex) - { - (IList permanents, IList variables) = SortLoadCases(cases); - int caseId = 1; - TableA1Properties factors = EN1990_TableA1_1[nationalAnnex]; - var combinations = new List(); - for (int i = 0; i < variables.Count; i++) - { - combinations.Add(new GeotechnicalMemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name}", - PermanentCases = permanents, - PermanentPartialFactor = factors.Gamma_Gsup, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - - if (variables[i].IsHorizontal) - { - combinations.Add(new GeotechnicalMemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", - PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), - PermanentPartialFactor = factors.Gamma_Ginf, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - } - } - - return combinations; - } - - public static IList CreateAccidential(IVariableCase accidentalCase, Ratio partialFactor, - IList otherCases, NationalAnnex nationalAnnex, bool useFrequentCombinationFactorForMainAccompanying) - { - (IList permanents, IList variables) = SortLoadCases(otherCases); - int caseId = 1; - TableA1Properties factors = EN1990_TableA1_1[nationalAnnex]; - var combinations = new List(); - if (!useFrequentCombinationFactorForMainAccompanying) - { - combinations.Add(new AccidentialCombination() - { - Name = $"Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", - PermanentCases = permanents, - OtherAccompanyingVariableCases = variables, - UseFrequentCombinationFactorForMainAccompanying = false - }); - return combinations; - } - - for (int i = 0; i < variables.Count; i++) - { - combinations.Add(new AccidentialCombination() - { - Name = $"LC{caseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name} combined with {variables[i].Name} as main accompanying variable action", - PermanentCases = permanents, - LeadingAccidentialPartialFactor = partialFactor, - LeadingVariableCases = new List() { variables[i] }, - OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - UseFrequentCombinationFactorForMainAccompanying = true - }); - } - - return combinations; - } - - public static ISeismicCombination CreateSeismic(IVariableCase seismicCase, Ratio partialFactor, IList otherCases, NationalAnnex nationalAnnex) - { - (IList permanents, IList variables) = SortLoadCases(otherCases); - return new SeismicCombination() - { - Name = $"Seismic, Eq. 6.12a/b - Leading {seismicCase.Name}", - PermanentCases = permanents, - LeadingVariableCases = new List() { seismicCase }, - LeadingSeismicPartialFactor = partialFactor, - AccompanyingVariableCases = variables, - }; - } - - private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex) - { - (IList permanents, IList variables) = SortLoadCases(cases); - int caseId = 1; - TableA1Properties factors = EN1990_TableA1_2[nationalAnnex]; - var combinations = new List(); - for (int i = 0; i < variables.Count; i++) - { - combinations.Add(new MemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name}", - PermanentCases = permanents, - PermanentPartialFactor = factors.Gamma_Gsup, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - - if (variables[i].IsHorizontal) - { - combinations.Add(new MemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", - PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), - PermanentPartialFactor = factors.Gamma_Ginf, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - } - } - - return combinations; - } - - private static IList CreateSTR6_10aAnd6_10b(IList cases, NationalAnnex nationalAnnex) - { - (IList permanents, IList variables) = SortLoadCases(cases); - int caseId = 1; - TableA1Properties factors = EN1990_TableA1_2[nationalAnnex]; - var combinations = new List(); - - bool onlyOne6_10a = Equals(factors.Gamma_Q1, factors.Gamma_Qi); - if (onlyOne6_10a) - { - combinations.Add(new MemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with accompanying variable actions", - PermanentCases = permanents, - PermanentPartialFactor = factors.Gamma_Gsup, - OtherAccompanyingVariableCases = variables, - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - } - - for (int i = 0; i < variables.Count; i++) - { - if (!onlyOne6_10a) - { - combinations.Add(new MemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with {variables[i].Name} as main accompanying variable action", - PermanentCases = permanents, - PermanentPartialFactor = factors.Gamma_Gsup, - MainAccompanyingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - } - - combinations.Add(new MemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10b - Leading {variables[i].Name}", - PermanentCases = permanents, - PermanentPartialFactor = factors.Gamma_Gsup, - PermanentReductionFactor = factors.Xi, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - - if (variables[i].IsHorizontal) - { - combinations.Add(new MemberDesignCombination() - { - Name = $"LC{caseId++}: STR/GEO Set B, Eq. 6.10b - Leading {variables[i].Name} with unfavourable permanent", - PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), - PermanentPartialFactor = factors.Gamma_Ginf, - PermanentReductionFactor = factors.Xi, - LeadingVariableCases = new List() { variables[i] }, - LeadingVariablePartialFactor = factors.Gamma_Q1, - OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), - AccompanyingPartialFactor = factors.Gamma_Qi, - }); - } - } - - return combinations; - } - - private static (IList Permanents, IList Variables) SortLoadCases(IList cases) - { - var permanent = new List(); - var variable = new List(); - foreach (var item in cases) - { - switch (item) - { - case IPermanentCase permanentCase: - permanent.Add(permanentCase); - continue; - - case IVariableCase variableCase: - variable.Add(variableCase); - continue; - - default: - throw new System.Exception($"Unrecognised type of load case: {item.GetType()}"); - } - } - - return (permanent, variable); - } - - private static readonly Dictionary EN1990_TableA1_1 = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - - }; - - private static readonly Dictionary EN1990_TableA1_2 = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, - - }; - - private static readonly Dictionary EN1990_TableA1_3 = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, - }; - - private struct TableA1Properties - { - internal Ratio Gamma_Gsup; - internal Ratio Gamma_Ginf; - internal Ratio Gamma_Q1; - internal Ratio Gamma_Qi; - internal Ratio Xi; - - internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi, double xi) - { - RatioUnit unit = RatioUnit.DecimalFraction; - Gamma_Gsup = new Ratio(gamma_Gsup, unit); - Gamma_Ginf = new Ratio(gamma_Ginf, unit); - Gamma_Q1 = new Ratio(gamma_Q1, unit); - Gamma_Qi = new Ratio(gamma_Qi, unit); - Xi = new Ratio(xi, unit); - } - - internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi) - { - RatioUnit unit = RatioUnit.DecimalFraction; - Gamma_Gsup = new Ratio(gamma_Gsup, unit); - Gamma_Ginf = new Ratio(gamma_Ginf, unit); - Gamma_Q1 = new Ratio(gamma_Q1, unit); - Gamma_Qi = new Ratio(gamma_Qi, unit); - Xi = Ratio.Zero; - } - } - } -} diff --git a/Loads/Cases/LoadCases/Factory/ENLoadFactory.cs b/Loads/Cases/LoadCases/Factory/ENLoadFactory.cs new file mode 100644 index 0000000..8153423 --- /dev/null +++ b/Loads/Cases/LoadCases/Factory/ENLoadFactory.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace MagmaWorks.Taxonomy.Loads +{ + public static partial class ENLoadFactory + { + public static IList CreateEquSetA(IList cases) + { + //return CreateEquSetA(cases, NationalAnnex.RecommendedValues); + } + + } +} diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index d8387f1..f7be13c 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads { public interface IUltimateLimitState : ILoadCombination { } } From 499ee8afad2f6d52656f3919c1209875abd6de17 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Wed, 2 Oct 2024 19:34:43 +0000 Subject: [PATCH 32/53] Fix code style issues with dotnet_format --- .../Cases/Combinations/Factory/ENCombinationFactoryUtility.cs | 2 +- Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs | 3 ++- .../Combinations/Factory/ENULSCombinationAccidentialFactory.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs index b380692..257badf 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs @@ -59,6 +59,6 @@ private static (IList Permanents, IList Variables return (permanent, variable); } - + } } diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs index 40e14dc..44fe4d8 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs @@ -14,7 +14,8 @@ public static IList CreateStrGeoSetC(IList public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); - if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1Properties factors)){ + if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1Properties factors)) + { throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(C) values"); }; diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs index 180773b..efeb1d6 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs @@ -55,7 +55,7 @@ public static IList CreateSeismic(IList seis LeadingVariableCases = new List() { seismicCases[i] }, LeadingSeismicPartialFactor = partialFactor, AccompanyingVariableCases = variables, - } ); + }); } return combinations; From c43d68ec9e79c2073628c0a1e4b7d904b0bc4ec3 Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 3 Oct 2024 11:03:09 +0200 Subject: [PATCH 33/53] namespace --- .../Cases/{LoadCases => Cases}/PermanentCase.cs | 2 +- .../Cases/{LoadCases => Cases}/VariableCase.cs | 6 +++--- .../Combinations/AccidentialCombination.cs | 2 +- .../Combinations/CharacteristicCombination.cs | 2 +- .../Combinations/EquilibriumCombination.cs | 2 +- .../Factory/ENCombinationFactoryUtility.cs | 2 +- .../Factory/ENCombinationSetAFactory.cs | 2 +- .../Factory/ENCombinationSetBFactory.cs | 2 +- .../Factory/ENCombinationSetCFactory.cs | 2 +- .../Factory/ENSLSCombinationFactory.cs | 2 +- .../ENULSCombinationAccidentialFactory.cs | 3 +-- Loads/Cases/Combinations/FrequentCombination.cs | 2 +- .../GeotechnicalMemberDesignCombination.cs | 2 +- .../Combinations/MemberDesignCombination.cs | 5 ++--- .../Combinations/QuasiPermanentCombination.cs | 2 +- Loads/Cases/Combinations/SeismicCombination.cs | 2 +- Loads/Cases/Combinations/Utility/Utility.cs | 3 +-- Loads/Cases/LoadCases/Factory/ENLoadFactory.cs | 17 ----------------- .../Combinations/IAccidentialCombination.cs | 2 +- .../Combinations/ICharacteristicCombination.cs | 2 +- .../Combinations/IEquilibriumCombination.cs | 2 +- .../ICases/Combinations/IFrequentCombination.cs | 2 +- .../IGeotechnicalMemberDesignCombination.cs | 2 +- Loads/ICases/Combinations/ILoadCombination.cs | 2 +- .../Combinations/IMemberDesignCombination.cs | 2 +- .../Combinations/IQuasiPermanentCombination.cs | 2 +- .../ICases/Combinations/ISeismicCombination.cs | 2 +- .../Combinations/IServiceabilityLimitState.cs | 2 +- .../ICases/Combinations/IUltimateLimitState.cs | 2 +- Loads/ICases/LoadCases/ILoadCase.cs | 2 +- Loads/ICases/LoadCases/IPermanentCase.cs | 2 +- Loads/ICases/LoadCases/IVariableCase.cs | 2 +- 32 files changed, 34 insertions(+), 54 deletions(-) rename Loads/Cases/{LoadCases => Cases}/PermanentCase.cs (91%) rename Loads/Cases/{LoadCases => Cases}/VariableCase.cs (76%) delete mode 100644 Loads/Cases/LoadCases/Factory/ENLoadFactory.cs diff --git a/Loads/Cases/LoadCases/PermanentCase.cs b/Loads/Cases/Cases/PermanentCase.cs similarity index 91% rename from Loads/Cases/LoadCases/PermanentCase.cs rename to Loads/Cases/Cases/PermanentCase.cs index d1dbb62..77fbf21 100644 --- a/Loads/Cases/LoadCases/PermanentCase.cs +++ b/Loads/Cases/Cases/PermanentCase.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Cases { public class PermanentCase : IPermanentCase { diff --git a/Loads/Cases/LoadCases/VariableCase.cs b/Loads/Cases/Cases/VariableCase.cs similarity index 76% rename from Loads/Cases/LoadCases/VariableCase.cs rename to Loads/Cases/Cases/VariableCase.cs index 03d1cd9..485254d 100644 --- a/Loads/Cases/LoadCases/VariableCase.cs +++ b/Loads/Cases/Cases/VariableCase.cs @@ -1,14 +1,14 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Cases { public class VariableCase : IVariableCase { - public string Nickname { get; set; } = "Q"; + public string Nickname { get; set; } public bool IsFavourable { get; set; } = false; public bool IsHorizontal { get; set; } = false; - public string Name { get; set; } = "Live Load"; + public string Name { get; set; } public Ratio Characteristic { get; set; } public Ratio Frequent { get; set; } public Ratio QuasiPermanent { get; set; } diff --git a/Loads/Cases/Combinations/AccidentialCombination.cs b/Loads/Cases/Combinations/AccidentialCombination.cs index e784f4a..e3ec9a1 100644 --- a/Loads/Cases/Combinations/AccidentialCombination.cs +++ b/Loads/Cases/Combinations/AccidentialCombination.cs @@ -3,7 +3,7 @@ using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class AccidentialCombination : IAccidentialCombination { diff --git a/Loads/Cases/Combinations/CharacteristicCombination.cs b/Loads/Cases/Combinations/CharacteristicCombination.cs index e12dcc7..4d010b8 100644 --- a/Loads/Cases/Combinations/CharacteristicCombination.cs +++ b/Loads/Cases/Combinations/CharacteristicCombination.cs @@ -2,7 +2,7 @@ using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class CharacteristicCombination : ICharacteristicCombination { diff --git a/Loads/Cases/Combinations/EquilibriumCombination.cs b/Loads/Cases/Combinations/EquilibriumCombination.cs index 504f774..b8ef3b2 100644 --- a/Loads/Cases/Combinations/EquilibriumCombination.cs +++ b/Loads/Cases/Combinations/EquilibriumCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class EquilibriumCombination : IEquilibriumCombination { diff --git a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs index 257badf..19c0203 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs @@ -2,7 +2,7 @@ using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs index 633cc25..9b261c1 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs @@ -2,7 +2,7 @@ using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs index b119a1c..7f42af5 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs @@ -2,7 +2,7 @@ using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs index 44fe4d8..ec677c7 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs @@ -2,7 +2,7 @@ using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { diff --git a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs index c71db58..fc8b5a3 100644 --- a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs index efeb1d6..9303a88 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs @@ -2,9 +2,8 @@ using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; using OasysUnits; -using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { diff --git a/Loads/Cases/Combinations/FrequentCombination.cs b/Loads/Cases/Combinations/FrequentCombination.cs index eac0b97..62e8173 100644 --- a/Loads/Cases/Combinations/FrequentCombination.cs +++ b/Loads/Cases/Combinations/FrequentCombination.cs @@ -2,7 +2,7 @@ using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class FrequentCombination : IFrequentCombination { diff --git a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs index c3b396e..e442e97 100644 --- a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs +++ b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class GeotechnicalMemberDesignCombination : IGeotechnicalMemberDesignCombination { diff --git a/Loads/Cases/Combinations/MemberDesignCombination.cs b/Loads/Cases/Combinations/MemberDesignCombination.cs index 97e439b..a84166d 100644 --- a/Loads/Cases/Combinations/MemberDesignCombination.cs +++ b/Loads/Cases/Combinations/MemberDesignCombination.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class MemberDesignCombination : IMemberDesignCombination { diff --git a/Loads/Cases/Combinations/QuasiPermanentCombination.cs b/Loads/Cases/Combinations/QuasiPermanentCombination.cs index 3c2e6aa..0477aa7 100644 --- a/Loads/Cases/Combinations/QuasiPermanentCombination.cs +++ b/Loads/Cases/Combinations/QuasiPermanentCombination.cs @@ -2,7 +2,7 @@ using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class QuasiPermanentCombination : IQuasiPermanentCombination { diff --git a/Loads/Cases/Combinations/SeismicCombination.cs b/Loads/Cases/Combinations/SeismicCombination.cs index cbf0efa..7764c4a 100644 --- a/Loads/Cases/Combinations/SeismicCombination.cs +++ b/Loads/Cases/Combinations/SeismicCombination.cs @@ -2,7 +2,7 @@ using OasysUnits; using OasysUnits.Units; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public class SeismicCombination : ISeismicCombination { diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 27163cb..ae2104f 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -1,11 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Numerics; using System.Text; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { internal static class Utility { diff --git a/Loads/Cases/LoadCases/Factory/ENLoadFactory.cs b/Loads/Cases/LoadCases/Factory/ENLoadFactory.cs deleted file mode 100644 index 8153423..0000000 --- a/Loads/Cases/LoadCases/Factory/ENLoadFactory.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using MagmaWorks.Taxonomy.Standards.Eurocode; -using OasysUnits; -using OasysUnits.Units; - -namespace MagmaWorks.Taxonomy.Loads -{ - public static partial class ENLoadFactory - { - public static IList CreateEquSetA(IList cases) - { - //return CreateEquSetA(cases, NationalAnnex.RecommendedValues); - } - - } -} diff --git a/Loads/ICases/Combinations/IAccidentialCombination.cs b/Loads/ICases/Combinations/IAccidentialCombination.cs index eead159..44f4145 100644 --- a/Loads/ICases/Combinations/IAccidentialCombination.cs +++ b/Loads/ICases/Combinations/IAccidentialCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IAccidentialCombination : IUltimateLimitState { diff --git a/Loads/ICases/Combinations/ICharacteristicCombination.cs b/Loads/ICases/Combinations/ICharacteristicCombination.cs index a65641e..6f824d3 100644 --- a/Loads/ICases/Combinations/ICharacteristicCombination.cs +++ b/Loads/ICases/Combinations/ICharacteristicCombination.cs @@ -1,4 +1,4 @@ -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface ICharacteristicCombination : IServiceabilityLimitState { } } diff --git a/Loads/ICases/Combinations/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs index 4ce23a7..f4ab781 100644 --- a/Loads/ICases/Combinations/IEquilibriumCombination.cs +++ b/Loads/ICases/Combinations/IEquilibriumCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IEquilibriumCombination : IUltimateLimitState { diff --git a/Loads/ICases/Combinations/IFrequentCombination.cs b/Loads/ICases/Combinations/IFrequentCombination.cs index c2556d3..c983830 100644 --- a/Loads/ICases/Combinations/IFrequentCombination.cs +++ b/Loads/ICases/Combinations/IFrequentCombination.cs @@ -1,4 +1,4 @@ -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IFrequentCombination : IServiceabilityLimitState { } } diff --git a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs index c5715e7..d9909b0 100644 --- a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IGeotechnicalMemberDesignCombination : IUltimateLimitState { diff --git a/Loads/ICases/Combinations/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs index a51c55d..57b662d 100644 --- a/Loads/ICases/Combinations/ILoadCombination.cs +++ b/Loads/ICases/Combinations/ILoadCombination.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface ILoadCombination : ICase { diff --git a/Loads/ICases/Combinations/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs index 68e67de..be359e5 100644 --- a/Loads/ICases/Combinations/IMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IMemberDesignCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IMemberDesignCombination : IUltimateLimitState { diff --git a/Loads/ICases/Combinations/IQuasiPermanentCombination.cs b/Loads/ICases/Combinations/IQuasiPermanentCombination.cs index 2d707ee..79900c8 100644 --- a/Loads/ICases/Combinations/IQuasiPermanentCombination.cs +++ b/Loads/ICases/Combinations/IQuasiPermanentCombination.cs @@ -1,4 +1,4 @@ -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IQuasiPermanentCombination : IServiceabilityLimitState { } } diff --git a/Loads/ICases/Combinations/ISeismicCombination.cs b/Loads/ICases/Combinations/ISeismicCombination.cs index 6584e76..e428ca4 100644 --- a/Loads/ICases/Combinations/ISeismicCombination.cs +++ b/Loads/ICases/Combinations/ISeismicCombination.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface ISeismicCombination : IUltimateLimitState { diff --git a/Loads/ICases/Combinations/IServiceabilityLimitState.cs b/Loads/ICases/Combinations/IServiceabilityLimitState.cs index 16e1382..0e1f4fe 100644 --- a/Loads/ICases/Combinations/IServiceabilityLimitState.cs +++ b/Loads/ICases/Combinations/IServiceabilityLimitState.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IServiceabilityLimitState : ILoadCombination { diff --git a/Loads/ICases/Combinations/IUltimateLimitState.cs b/Loads/ICases/Combinations/IUltimateLimitState.cs index f7be13c..8a9974a 100644 --- a/Loads/ICases/Combinations/IUltimateLimitState.cs +++ b/Loads/ICases/Combinations/IUltimateLimitState.cs @@ -1,4 +1,4 @@ -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Combinations { public interface IUltimateLimitState : ILoadCombination { } } diff --git a/Loads/ICases/LoadCases/ILoadCase.cs b/Loads/ICases/LoadCases/ILoadCase.cs index 96af79b..440d892 100644 --- a/Loads/ICases/LoadCases/ILoadCase.cs +++ b/Loads/ICases/LoadCases/ILoadCase.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Cases { public interface ILoadCase : ICase { diff --git a/Loads/ICases/LoadCases/IPermanentCase.cs b/Loads/ICases/LoadCases/IPermanentCase.cs index 7faf8b9..68e34b6 100644 --- a/Loads/ICases/LoadCases/IPermanentCase.cs +++ b/Loads/ICases/LoadCases/IPermanentCase.cs @@ -1,4 +1,4 @@ -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Cases { public interface IPermanentCase : ILoadCase { } } diff --git a/Loads/ICases/LoadCases/IVariableCase.cs b/Loads/ICases/LoadCases/IVariableCase.cs index 9b8967e..3fa1fc0 100644 --- a/Loads/ICases/LoadCases/IVariableCase.cs +++ b/Loads/ICases/LoadCases/IVariableCase.cs @@ -1,6 +1,6 @@ using OasysUnits; -namespace MagmaWorks.Taxonomy.Loads +namespace MagmaWorks.Taxonomy.Loads.Cases { public interface IVariableCase : ILoadCase { From 1551cbeaecf4e9711f9a4919a233b03093ae530a Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 3 Oct 2024 12:45:53 +0200 Subject: [PATCH 34/53] namespace --- .../Cases/Combinations/AccidentialCombination.cs | 1 + .../Combinations/CharacteristicCombination.cs | 1 + .../Cases/Combinations/EquilibriumCombination.cs | 1 + .../Factory/ENCombinationFactoryUtility.cs | 3 +-- .../Factory/ENCombinationSetAFactory.cs | 15 ++++++++------- .../Factory/ENCombinationSetBFactory.cs | 15 ++++++++------- .../Factory/ENCombinationSetCFactory.cs | 14 ++++++++------ .../Factory/ENSLSCombinationFactory.cs | 1 + .../Factory/ENULSCombinationAccidentialFactory.cs | 1 + Loads/Cases/Combinations/FrequentCombination.cs | 1 + .../GeotechnicalMemberDesignCombination.cs | 1 + .../Cases/Combinations/MemberDesignCombination.cs | 1 + .../Combinations/QuasiPermanentCombination.cs | 1 + Loads/Cases/Combinations/SeismicCombination.cs | 1 + Loads/Cases/Combinations/Utility/Utility.cs | 1 + .../Combinations/IAccidentialCombination.cs | 1 + .../Combinations/IEquilibriumCombination.cs | 1 + .../IGeotechnicalMemberDesignCombination.cs | 1 + .../Combinations/IMemberDesignCombination.cs | 1 + Loads/ICases/Combinations/ISeismicCombination.cs | 1 + .../Combinations/IServiceabilityLimitState.cs | 1 + 21 files changed, 42 insertions(+), 22 deletions(-) diff --git a/Loads/Cases/Combinations/AccidentialCombination.cs b/Loads/Cases/Combinations/AccidentialCombination.cs index e3ec9a1..f729c96 100644 --- a/Loads/Cases/Combinations/AccidentialCombination.cs +++ b/Loads/Cases/Combinations/AccidentialCombination.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Cases/Combinations/CharacteristicCombination.cs b/Loads/Cases/Combinations/CharacteristicCombination.cs index 4d010b8..b326474 100644 --- a/Loads/Cases/Combinations/CharacteristicCombination.cs +++ b/Loads/Cases/Combinations/CharacteristicCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Cases/Combinations/EquilibriumCombination.cs b/Loads/Cases/Combinations/EquilibriumCombination.cs index b8ef3b2..8416f4f 100644 --- a/Loads/Cases/Combinations/EquilibriumCombination.cs +++ b/Loads/Cases/Combinations/EquilibriumCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs index 19c0203..3b9b61e 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; @@ -58,7 +59,5 @@ private static (IList Permanents, IList Variables return (permanent, variable); } - - } } diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs index 9b261c1..37946a2 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs @@ -1,11 +1,19 @@ using System.Collections.Generic; using System.Linq; +using MagmaWorks.Taxonomy.Loads.Cases; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { + private static readonly Dictionary EN1990_TableA1_2A = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, + + }; + public static IList CreateEquSetA(IList cases) { return CreateEquSetA(cases, NationalAnnex.RecommendedValues); @@ -50,12 +58,5 @@ public static IList CreateEquSetA(IList case return combinations; } - - private static readonly Dictionary EN1990_TableA1_2A = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - - }; } } diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs index 7f42af5..004564a 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs @@ -1,11 +1,19 @@ using System.Collections.Generic; using System.Linq; +using MagmaWorks.Taxonomy.Loads.Cases; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { + private static readonly Dictionary EN1990_TableA1_2B = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, + + }; + public static IList CreateStrGeoSetB(IList cases, int firstCaseId = 1) { return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true, firstCaseId); @@ -131,12 +139,5 @@ private static IList CreateSTR6_10aAnd6_10b(IList EN1990_TableA1_2B = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, - - }; } } diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs index ec677c7..3c0c50b 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs @@ -1,11 +1,19 @@ using System.Collections.Generic; using System.Linq; +using MagmaWorks.Taxonomy.Loads.Cases; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { + + private static readonly Dictionary EN1990_TableA1_2C = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + }; + public static IList CreateStrGeoSetC(IList cases, int firstCaseId = 1) { return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues, firstCaseId); @@ -50,11 +58,5 @@ public static IList CreateStrGeoSetC(IList return combinations; } - - private static readonly Dictionary EN1990_TableA1_2C = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, - }; } } diff --git a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs index fc8b5a3..9e7225f 100644 --- a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using MagmaWorks.Taxonomy.Loads.Cases; namespace MagmaWorks.Taxonomy.Loads.Combinations { diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs index 9303a88..f9e8409 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using MagmaWorks.Taxonomy.Loads.Cases; using MagmaWorks.Taxonomy.Standards.Eurocode; using OasysUnits; diff --git a/Loads/Cases/Combinations/FrequentCombination.cs b/Loads/Cases/Combinations/FrequentCombination.cs index 62e8173..d7dc405 100644 --- a/Loads/Cases/Combinations/FrequentCombination.cs +++ b/Loads/Cases/Combinations/FrequentCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs index e442e97..c63deb5 100644 --- a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs +++ b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/Cases/Combinations/MemberDesignCombination.cs b/Loads/Cases/Combinations/MemberDesignCombination.cs index a84166d..3d5c89d 100644 --- a/Loads/Cases/Combinations/MemberDesignCombination.cs +++ b/Loads/Cases/Combinations/MemberDesignCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Cases/Combinations/QuasiPermanentCombination.cs b/Loads/Cases/Combinations/QuasiPermanentCombination.cs index 0477aa7..ed0e2c0 100644 --- a/Loads/Cases/Combinations/QuasiPermanentCombination.cs +++ b/Loads/Cases/Combinations/QuasiPermanentCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Cases/Combinations/SeismicCombination.cs b/Loads/Cases/Combinations/SeismicCombination.cs index 7764c4a..cb7e39a 100644 --- a/Loads/Cases/Combinations/SeismicCombination.cs +++ b/Loads/Cases/Combinations/SeismicCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index ae2104f..8ba025a 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/ICases/Combinations/IAccidentialCombination.cs b/Loads/ICases/Combinations/IAccidentialCombination.cs index 44f4145..48c8d2d 100644 --- a/Loads/ICases/Combinations/IAccidentialCombination.cs +++ b/Loads/ICases/Combinations/IAccidentialCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/ICases/Combinations/IEquilibriumCombination.cs b/Loads/ICases/Combinations/IEquilibriumCombination.cs index f4ab781..eea561e 100644 --- a/Loads/ICases/Combinations/IEquilibriumCombination.cs +++ b/Loads/ICases/Combinations/IEquilibriumCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs index d9909b0..1be4c64 100644 --- a/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IGeotechnicalMemberDesignCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/ICases/Combinations/IMemberDesignCombination.cs b/Loads/ICases/Combinations/IMemberDesignCombination.cs index be359e5..1d168b7 100644 --- a/Loads/ICases/Combinations/IMemberDesignCombination.cs +++ b/Loads/ICases/Combinations/IMemberDesignCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/ICases/Combinations/ISeismicCombination.cs b/Loads/ICases/Combinations/ISeismicCombination.cs index e428ca4..4c19b33 100644 --- a/Loads/ICases/Combinations/ISeismicCombination.cs +++ b/Loads/ICases/Combinations/ISeismicCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; namespace MagmaWorks.Taxonomy.Loads.Combinations diff --git a/Loads/ICases/Combinations/IServiceabilityLimitState.cs b/Loads/ICases/Combinations/IServiceabilityLimitState.cs index 0e1f4fe..db8092f 100644 --- a/Loads/ICases/Combinations/IServiceabilityLimitState.cs +++ b/Loads/ICases/Combinations/IServiceabilityLimitState.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; namespace MagmaWorks.Taxonomy.Loads.Combinations { From 1850f14c6e0bd4954759999b3d22412592bc516d Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 3 Oct 2024 12:46:02 +0200 Subject: [PATCH 35/53] Load case factory --- .../Cases/Factory/ENImposedCaseFactory.cs | 88 +++++++++++++++++++ .../Cases/Cases/Factory/ENSnowCaseFactory.cs | 40 +++++++++ .../Cases/Factory/ENThermalCaseFactory.cs | 39 ++++++++ .../Cases/Cases/Factory/ENWindCaseFactory.cs | 39 ++++++++ Loads/Cases/Cases/ImposedLoadCategory.cs | 14 +++ 5 files changed, 220 insertions(+) create mode 100644 Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs create mode 100644 Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs create mode 100644 Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs create mode 100644 Loads/Cases/Cases/Factory/ENWindCaseFactory.cs create mode 100644 Loads/Cases/Cases/ImposedLoadCategory.cs diff --git a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs new file mode 100644 index 0000000..c64df4a --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits.Units; +using OasysUnits; +using System.Linq; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + public static partial class ENLoadCaseFactory + { + private struct TableA1Properties + { + internal Ratio Phi_0; + internal Ratio Phi_1; + internal Ratio Phi_2; + + internal TableA1Properties(double phi_0, double phi_1, double phi_2) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Phi_0 = new Ratio(phi_0, unit); + Phi_1 = new Ratio(phi_1, unit); + Phi_2 = new Ratio(phi_2, unit); + } + } + + private static readonly Dictionary> EN1990_TableA1_1_Imposed = new() + { + { NationalAnnex.RecommendedValues, new () { + { ImposedLoadCategory.CategoryA, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryB, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryC, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryD, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryE, new TableA1Properties(1.0, 0.9, 0.8) }, + { ImposedLoadCategory.CategoryF, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryG, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryH, new TableA1Properties(0.0, 0.0, 0.0) }, + } + }, + { NationalAnnex.UnitedKingdom, new () { + { ImposedLoadCategory.CategoryA, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryB, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryC, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryD, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryE, new TableA1Properties(1.0, 0.9, 0.8) }, + { ImposedLoadCategory.CategoryF, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryG, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryH, new TableA1Properties(0.7, 0.0, 0.0) }, + } + }, + { NationalAnnex.Germany, new () { + { ImposedLoadCategory.CategoryA, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryB, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryC, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryD, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryE, new TableA1Properties(1.0, 0.9, 0.8) }, + { ImposedLoadCategory.CategoryF, new TableA1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryG, new TableA1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryH, new TableA1Properties(0.0, 0.0, 0.0) }, + } + }, + }; + + public static VariableCase CreateImposed(ImposedLoadCategory category, NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Imposed.TryGetValue(nationalAnnex, out Dictionary kvp)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Imposed Load φ-factors"); + }; + + TableA1Properties factors = kvp[category]; + return new VariableCase() + { + Characteristic = factors.Phi_0, + Frequent = factors.Phi_1, + QuasiPermanent = factors.Phi_2, + Name = $"Live loads Category {category.ToString().Last()}", + Nickname = $"Q_{category.ToString().Last()}", + }; + } + + public static VariableCase CreateImposed(IList loads, ImposedLoadCategory category, NationalAnnex nationalAnnex) + { + VariableCase loadCase = CreateImposed(category, nationalAnnex); + loadCase.Loads = loads; + return loadCase; + } + } +} diff --git a/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs b/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs new file mode 100644 index 0000000..dec03ce --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + public static partial class ENLoadCaseFactory + { + private static readonly Dictionary EN1990_TableA1_1_Snow = new() + { + { NationalAnnex.RecommendedValues, (new TableA1Properties(0.7, 0.5, 0.2), new TableA1Properties(0.5, 0.2, 0.0)) }, + { NationalAnnex.UnitedKingdom, (new TableA1Properties(0.7, 0.5, 0.2), new TableA1Properties(0.5, 0.2, 0.0)) }, + { NationalAnnex.Germany, (new TableA1Properties(0.7, 0.5, 0.2), new TableA1Properties(0.5, 0.2, 0.0)) }, + }; + + public static VariableCase CreateSnow(NationalAnnex nationalAnnex, bool altitudeAbove1000m) + { + if (!EN1990_TableA1_1_Snow.TryGetValue(nationalAnnex, out (TableA1Properties Above1000m, TableA1Properties Below1000m) kvp)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Snow φ-factors"); + }; + + TableA1Properties factors = altitudeAbove1000m ? kvp.Above1000m : kvp.Below1000m; + return new VariableCase() + { + Characteristic = factors.Phi_0, + Frequent = factors.Phi_1, + QuasiPermanent = factors.Phi_2, + Name = $"Snow loads", + Nickname = "S", + }; + } + + public static VariableCase CreateSnow(IList loads, NationalAnnex nationalAnnex, bool altitudeAbove1000m) + { + VariableCase loadCase = CreateSnow(nationalAnnex, altitudeAbove1000m); + loadCase.Loads = loads; + return loadCase; + } + } +} diff --git a/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs b/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs new file mode 100644 index 0000000..2f7ae52 --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + public static partial class ENLoadCaseFactory + { + private static readonly Dictionary EN1990_TableA1_1_Thermal = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(0.6, 0.5, 0.0) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(0.6, 0.5, 0.0) }, + { NationalAnnex.Germany, new TableA1Properties(0.6, 0.5, 0.0) }, + }; + + public static VariableCase CreateThermal(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Thermal.TryGetValue(nationalAnnex, out TableA1Properties factors)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Thermal φ-factors"); + }; + + return new VariableCase() + { + Characteristic = factors.Phi_0, + Frequent = factors.Phi_1, + QuasiPermanent = factors.Phi_2, + Name = $"Thermal loads", + Nickname = "T", + }; + } + + public static VariableCase CreateThermal(IList loads, NationalAnnex nationalAnnex) + { + VariableCase loadCase = CreateThermal(nationalAnnex); + loadCase.Loads = loads; + return loadCase; + } + } +} diff --git a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs new file mode 100644 index 0000000..e2de1bc --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + public static partial class ENLoadCaseFactory + { + private static readonly Dictionary EN1990_TableA1_1_Wind = new() + { + { NationalAnnex.RecommendedValues, new TableA1Properties(0.6, 0.2, 0.0) }, + { NationalAnnex.UnitedKingdom, new TableA1Properties(0.6, 0.2, 0.0) }, + { NationalAnnex.Germany, new TableA1Properties(0.6, 0.2, 0.0) }, + }; + + public static VariableCase CreateWind(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Wind.TryGetValue(nationalAnnex, out TableA1Properties factors)) + { + throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Wind φ-factors"); + }; + + return new VariableCase() + { + Characteristic = factors.Phi_0, + Frequent = factors.Phi_1, + QuasiPermanent = factors.Phi_2, + Name = $"Snow loads", + Nickname = "S", + }; + } + + public static VariableCase CreateWind(IList loads, NationalAnnex nationalAnnex) + { + VariableCase loadCase = CreateWind(nationalAnnex); + loadCase.Loads = loads; + return loadCase; + } + } +} diff --git a/Loads/Cases/Cases/ImposedLoadCategory.cs b/Loads/Cases/Cases/ImposedLoadCategory.cs new file mode 100644 index 0000000..be3595d --- /dev/null +++ b/Loads/Cases/Cases/ImposedLoadCategory.cs @@ -0,0 +1,14 @@ +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + public enum ImposedLoadCategory + { + CategoryA, + CategoryB, + CategoryC, + CategoryD, + CategoryE, + CategoryF, + CategoryG, + CategoryH, + } +} From d068efe7eac23931a8e1c3a103e07cadd91c0616 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 3 Oct 2024 10:47:53 +0000 Subject: [PATCH 36/53] Fix code style issues with dotnet_format --- Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs index c64df4a..6ac061c 100644 --- a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; +using System.Linq; using MagmaWorks.Taxonomy.Standards.Eurocode; -using OasysUnits.Units; using OasysUnits; -using System.Linq; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Cases { From a7bc962e0882a6ba8ce92569267acc4850271bd8 Mon Sep 17 00:00:00 2001 From: kpne Date: Thu, 3 Oct 2024 12:57:44 +0200 Subject: [PATCH 37/53] add missing reference to Cases --- Loads/ICases/Combinations/ILoadCombination.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Loads/ICases/Combinations/ILoadCombination.cs b/Loads/ICases/Combinations/ILoadCombination.cs index 57b662d..0679e3e 100644 --- a/Loads/ICases/Combinations/ILoadCombination.cs +++ b/Loads/ICases/Combinations/ILoadCombination.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases; namespace MagmaWorks.Taxonomy.Loads.Combinations { From 9804a32e60554ba23ca67c7b1d91f00031d08909 Mon Sep 17 00:00:00 2001 From: kpne Date: Fri, 4 Oct 2024 20:12:19 +0200 Subject: [PATCH 38/53] organise tests in folders --- Loads/LoadTests/LoadTests.csproj | 6 ++++++ Loads/LoadTests/{ => Loads}/AreaForceTests.cs | 0 Loads/LoadTests/{ => Loads}/AutomatedTests.cs | 0 Loads/LoadTests/{ => Loads}/ColumnLoadTests.cs | 0 Loads/LoadTests/{ => Loads}/Gravity2dTests.cs | 0 Loads/LoadTests/{ => Loads}/GravityTests.cs | 0 Loads/LoadTests/{ => Loads}/LineForce2dTests.cs | 0 Loads/LoadTests/{ => Loads}/LineForceTests.cs | 0 Loads/LoadTests/{ => Loads}/PointDisplacement2dTests.cs | 0 Loads/LoadTests/{ => Loads}/PointDisplacementTests.cs | 0 Loads/LoadTests/{ => Loads}/PointForce2dTests.cs | 0 Loads/LoadTests/{ => Loads}/PointForceTests.cs | 0 Loads/LoadTests/{ => Loads}/PointMoment2dTests.cs | 0 Loads/LoadTests/{ => Loads}/PointMomentTests.cs | 0 14 files changed, 6 insertions(+) rename Loads/LoadTests/{ => Loads}/AreaForceTests.cs (100%) rename Loads/LoadTests/{ => Loads}/AutomatedTests.cs (100%) rename Loads/LoadTests/{ => Loads}/ColumnLoadTests.cs (100%) rename Loads/LoadTests/{ => Loads}/Gravity2dTests.cs (100%) rename Loads/LoadTests/{ => Loads}/GravityTests.cs (100%) rename Loads/LoadTests/{ => Loads}/LineForce2dTests.cs (100%) rename Loads/LoadTests/{ => Loads}/LineForceTests.cs (100%) rename Loads/LoadTests/{ => Loads}/PointDisplacement2dTests.cs (100%) rename Loads/LoadTests/{ => Loads}/PointDisplacementTests.cs (100%) rename Loads/LoadTests/{ => Loads}/PointForce2dTests.cs (100%) rename Loads/LoadTests/{ => Loads}/PointForceTests.cs (100%) rename Loads/LoadTests/{ => Loads}/PointMoment2dTests.cs (100%) rename Loads/LoadTests/{ => Loads}/PointMomentTests.cs (100%) diff --git a/Loads/LoadTests/LoadTests.csproj b/Loads/LoadTests/LoadTests.csproj index 13d3072..22471ca 100644 --- a/Loads/LoadTests/LoadTests.csproj +++ b/Loads/LoadTests/LoadTests.csproj @@ -17,6 +17,8 @@ + + @@ -25,4 +27,8 @@ + + + + diff --git a/Loads/LoadTests/AreaForceTests.cs b/Loads/LoadTests/Loads/AreaForceTests.cs similarity index 100% rename from Loads/LoadTests/AreaForceTests.cs rename to Loads/LoadTests/Loads/AreaForceTests.cs diff --git a/Loads/LoadTests/AutomatedTests.cs b/Loads/LoadTests/Loads/AutomatedTests.cs similarity index 100% rename from Loads/LoadTests/AutomatedTests.cs rename to Loads/LoadTests/Loads/AutomatedTests.cs diff --git a/Loads/LoadTests/ColumnLoadTests.cs b/Loads/LoadTests/Loads/ColumnLoadTests.cs similarity index 100% rename from Loads/LoadTests/ColumnLoadTests.cs rename to Loads/LoadTests/Loads/ColumnLoadTests.cs diff --git a/Loads/LoadTests/Gravity2dTests.cs b/Loads/LoadTests/Loads/Gravity2dTests.cs similarity index 100% rename from Loads/LoadTests/Gravity2dTests.cs rename to Loads/LoadTests/Loads/Gravity2dTests.cs diff --git a/Loads/LoadTests/GravityTests.cs b/Loads/LoadTests/Loads/GravityTests.cs similarity index 100% rename from Loads/LoadTests/GravityTests.cs rename to Loads/LoadTests/Loads/GravityTests.cs diff --git a/Loads/LoadTests/LineForce2dTests.cs b/Loads/LoadTests/Loads/LineForce2dTests.cs similarity index 100% rename from Loads/LoadTests/LineForce2dTests.cs rename to Loads/LoadTests/Loads/LineForce2dTests.cs diff --git a/Loads/LoadTests/LineForceTests.cs b/Loads/LoadTests/Loads/LineForceTests.cs similarity index 100% rename from Loads/LoadTests/LineForceTests.cs rename to Loads/LoadTests/Loads/LineForceTests.cs diff --git a/Loads/LoadTests/PointDisplacement2dTests.cs b/Loads/LoadTests/Loads/PointDisplacement2dTests.cs similarity index 100% rename from Loads/LoadTests/PointDisplacement2dTests.cs rename to Loads/LoadTests/Loads/PointDisplacement2dTests.cs diff --git a/Loads/LoadTests/PointDisplacementTests.cs b/Loads/LoadTests/Loads/PointDisplacementTests.cs similarity index 100% rename from Loads/LoadTests/PointDisplacementTests.cs rename to Loads/LoadTests/Loads/PointDisplacementTests.cs diff --git a/Loads/LoadTests/PointForce2dTests.cs b/Loads/LoadTests/Loads/PointForce2dTests.cs similarity index 100% rename from Loads/LoadTests/PointForce2dTests.cs rename to Loads/LoadTests/Loads/PointForce2dTests.cs diff --git a/Loads/LoadTests/PointForceTests.cs b/Loads/LoadTests/Loads/PointForceTests.cs similarity index 100% rename from Loads/LoadTests/PointForceTests.cs rename to Loads/LoadTests/Loads/PointForceTests.cs diff --git a/Loads/LoadTests/PointMoment2dTests.cs b/Loads/LoadTests/Loads/PointMoment2dTests.cs similarity index 100% rename from Loads/LoadTests/PointMoment2dTests.cs rename to Loads/LoadTests/Loads/PointMoment2dTests.cs diff --git a/Loads/LoadTests/PointMomentTests.cs b/Loads/LoadTests/Loads/PointMomentTests.cs similarity index 100% rename from Loads/LoadTests/PointMomentTests.cs rename to Loads/LoadTests/Loads/PointMomentTests.cs From 87d6865fa7e57817dd6a8a4de49b926da151c469 Mon Sep 17 00:00:00 2001 From: kpne Date: Fri, 4 Oct 2024 20:12:29 +0200 Subject: [PATCH 39/53] fix name and nickname --- Loads/Cases/Cases/Factory/ENWindCaseFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs index e2de1bc..7ec998a 100644 --- a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs @@ -24,8 +24,8 @@ public static VariableCase CreateWind(NationalAnnex nationalAnnex) Characteristic = factors.Phi_0, Frequent = factors.Phi_1, QuasiPermanent = factors.Phi_2, - Name = $"Snow loads", - Nickname = "S", + Name = $"Wind loads", + Nickname = "W", }; } From 1016d0f40dbcfd53eab1a9ba9f8745e9877244a7 Mon Sep 17 00:00:00 2001 From: kpne Date: Fri, 4 Oct 2024 20:12:36 +0200 Subject: [PATCH 40/53] case tests --- .../Cases/LoadCases/ImposedCaseTests.cs | 100 ++++++++++++++++++ .../Cases/LoadCases/PermanentCaseTests.cs | 66 ++++++++++++ .../Cases/LoadCases/SnowCaseTests.cs | 64 +++++++++++ .../Cases/LoadCases/ThermalCaseTests.cs | 59 +++++++++++ .../Cases/LoadCases/WindCaseTests.cs | 58 ++++++++++ 5 files changed, 347 insertions(+) create mode 100644 Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs create mode 100644 Loads/LoadTests/Cases/LoadCases/PermanentCaseTests.cs create mode 100644 Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs create mode 100644 Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs create mode 100644 Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs diff --git a/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs new file mode 100644 index 0000000..61bcaa9 --- /dev/null +++ b/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs @@ -0,0 +1,100 @@ +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadCaseTests +{ + public class ImposedCaseTests + { + [Theory] + [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryC, NationalAnnex.RecommendedValues, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryD, NationalAnnex.RecommendedValues, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryE, NationalAnnex.RecommendedValues, 1.0, 0.9, 0.8)] + [InlineData(ImposedLoadCategory.CategoryF, NationalAnnex.RecommendedValues, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryG, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryH, NationalAnnex.RecommendedValues, 0.0, 0.0, 0.0)] + [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.UnitedKingdom, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.UnitedKingdom, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryC, NationalAnnex.UnitedKingdom, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryD, NationalAnnex.UnitedKingdom, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryE, NationalAnnex.UnitedKingdom, 1.0, 0.9, 0.8)] + [InlineData(ImposedLoadCategory.CategoryF, NationalAnnex.UnitedKingdom, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryG, NationalAnnex.UnitedKingdom, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryH, NationalAnnex.UnitedKingdom, 0.7, 0.0, 0.0)] + [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.Germany, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.Germany, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryC, NationalAnnex.Germany, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryD, NationalAnnex.Germany, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryE, NationalAnnex.Germany, 1.0, 0.9, 0.8)] + [InlineData(ImposedLoadCategory.CategoryF, NationalAnnex.Germany, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryG, NationalAnnex.Germany, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryH, NationalAnnex.Germany, 0.0, 0.0, 0.0)] + public void CreateImposedCaseTest(ImposedLoadCategory category, NationalAnnex nationalAnnex, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Live loads Category {category.ToString().Last()}"; + string expectedNickname = $"Q_{category.ToString().Last()}"; + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateImposed(category, nationalAnnex); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + } + + [Theory] + [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryC, NationalAnnex.RecommendedValues, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryD, NationalAnnex.RecommendedValues, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryE, NationalAnnex.RecommendedValues, 1.0, 0.9, 0.8)] + [InlineData(ImposedLoadCategory.CategoryF, NationalAnnex.RecommendedValues, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryG, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryH, NationalAnnex.RecommendedValues, 0.0, 0.0, 0.0)] + [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.UnitedKingdom, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.UnitedKingdom, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryC, NationalAnnex.UnitedKingdom, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryD, NationalAnnex.UnitedKingdom, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryE, NationalAnnex.UnitedKingdom, 1.0, 0.9, 0.8)] + [InlineData(ImposedLoadCategory.CategoryF, NationalAnnex.UnitedKingdom, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryG, NationalAnnex.UnitedKingdom, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryH, NationalAnnex.UnitedKingdom, 0.7, 0.0, 0.0)] + [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.Germany, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.Germany, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryC, NationalAnnex.Germany, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryD, NationalAnnex.Germany, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryE, NationalAnnex.Germany, 1.0, 0.9, 0.8)] + [InlineData(ImposedLoadCategory.CategoryF, NationalAnnex.Germany, 0.7, 0.7, 0.6)] + [InlineData(ImposedLoadCategory.CategoryG, NationalAnnex.Germany, 0.7, 0.5, 0.3)] + [InlineData(ImposedLoadCategory.CategoryH, NationalAnnex.Germany, 0.0, 0.0, 0.0)] + public void CreateImposedCaseWithLoadTest(ImposedLoadCategory category, NationalAnnex nationalAnnex, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Live loads Category {category.ToString().Last()}"; + string expectedNickname = $"Q_{category.ToString().Last()}"; + var load = new LineForce2d(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateImposed( + new List() { load }, category, nationalAnnex); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + Assert.Equal(-15, ((ILineForce2d)variableCase.Loads.FirstOrDefault()).Z.KilonewtonsPerMeter); + } + } +} diff --git a/Loads/LoadTests/Cases/LoadCases/PermanentCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/PermanentCaseTests.cs new file mode 100644 index 0000000..480e5dd --- /dev/null +++ b/Loads/LoadTests/Cases/LoadCases/PermanentCaseTests.cs @@ -0,0 +1,66 @@ +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadCaseTests +{ + public class PermanentCaseTests + { + public static IPermanentCase CreateDLCase() + { + var loadCase = new PermanentCase() + { + Nickname = "DL" + }; + + loadCase.Loads.Add(new Gravity()); + return loadCase; + } + + public static IPermanentCase CreateSDLCase() + { + var loadCase = new PermanentCase() + { + Nickname = "SDL", + Name = "Superimposed Dead Load" + }; + + loadCase.Loads.Add(new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter))); + return loadCase; + } + + [Fact] + public void CreatePermanentCaseTest() + { + // Assemble + // Act + IPermanentCase permanentCase = CreateDLCase(); + + // Assert + Assert.Equal("DL", permanentCase.Nickname); + Assert.Equal("Dead Load", permanentCase.Name); + Assert.False(permanentCase.IsFavourable); + Assert.False(permanentCase.IsHorizontal); + Assert.Single(permanentCase.Loads); + Assert.Equivalent(new Gravity(), permanentCase.Loads.FirstOrDefault()); + } + + [Fact] + public void CreateSDLCaseTest() + { + // Assemble + // Act + IPermanentCase permanentCase = CreateSDLCase(); + + // Assert + Assert.Equal("SDL", permanentCase.Nickname); + Assert.Equal("Superimposed Dead Load", permanentCase.Name); + Assert.False(permanentCase.IsFavourable); + Assert.False(permanentCase.IsHorizontal); + Assert.Single(permanentCase.Loads); + Assert.Equivalent(new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)), + permanentCase.Loads.FirstOrDefault()); + } + } +} diff --git a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs new file mode 100644 index 0000000..9170eb2 --- /dev/null +++ b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs @@ -0,0 +1,64 @@ +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadCaseTests +{ + public class SnowCaseTests + { + [Theory] + [InlineData(NationalAnnex.RecommendedValues, true, 0.7, 0.5, 0.2)] + [InlineData(NationalAnnex.RecommendedValues, false, 0.5, 0.2, 0.0)] + [InlineData(NationalAnnex.UnitedKingdom, true, 0.7, 0.5, 0.2)] + [InlineData(NationalAnnex.UnitedKingdom, false, 0.5, 0.2, 0.0)] + [InlineData(NationalAnnex.Germany, true, 0.7, 0.5, 0.2)] + [InlineData(NationalAnnex.Germany, false, 0.5, 0.2, 0.0)] + public void CreateSnowCaseTest(NationalAnnex nationalAnnex, bool above1000m, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Snow loads"; + string expectedNickname = $"S"; + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateSnow(nationalAnnex, above1000m); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + } + + [Theory] + [InlineData(NationalAnnex.RecommendedValues, true, 0.7, 0.5, 0.2)] + [InlineData(NationalAnnex.RecommendedValues, false, 0.5, 0.2, 0.0)] + [InlineData(NationalAnnex.UnitedKingdom, true, 0.7, 0.5, 0.2)] + [InlineData(NationalAnnex.UnitedKingdom, false, 0.5, 0.2, 0.0)] + [InlineData(NationalAnnex.Germany, true, 0.7, 0.5, 0.2)] + [InlineData(NationalAnnex.Germany, false, 0.5, 0.2, 0.0)] + public void CreateSnowCaseWithLoadTest(NationalAnnex nationalAnnex, bool above1000m, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Snow loads"; + string expectedNickname = $"S"; + var load = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateSnow( + new List() { load }, nationalAnnex, above1000m); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + Assert.Equal(-15, ((ILineForce)variableCase.Loads.FirstOrDefault()).Z.KilonewtonsPerMeter); + } + } +} diff --git a/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs new file mode 100644 index 0000000..c14efe8 --- /dev/null +++ b/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs @@ -0,0 +1,59 @@ +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadCaseTests +{ + public class ThermalCaseTests + { + [Theory] + [InlineData(NationalAnnex.RecommendedValues, 0.6, 0.5, 0.0)] + [InlineData(NationalAnnex.UnitedKingdom, 0.6, 0.5, 0.0)] + [InlineData(NationalAnnex.Germany, 0.6, 0.5, 0.0)] + public void CreateThermaCaseTest(NationalAnnex nationalAnnex, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Thermal loads"; + string expectedNickname = $"T"; + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateThermal(nationalAnnex); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + } + + [Theory] + [InlineData(NationalAnnex.RecommendedValues, 0.6, 0.5, 0.0)] + [InlineData(NationalAnnex.UnitedKingdom, 0.6, 0.5, 0.0)] + [InlineData(NationalAnnex.Germany, 0.6, 0.5, 0.0)] + public void CreateThermalCaseWithLoadTest(NationalAnnex nationalAnnex, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Thermal loads"; + string expectedNickname = $"T"; + var load = new PointDisplacement(Length.Zero, Length.Zero, + new Length(0.01, LengthUnit.Centimeter)); + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateThermal( + new List() { load }, nationalAnnex); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + Assert.Equal(0.01, ((IPointDisplacement)variableCase.Loads.FirstOrDefault()).Z.Centimeters); + } + } +} diff --git a/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs new file mode 100644 index 0000000..41711a8 --- /dev/null +++ b/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs @@ -0,0 +1,58 @@ +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace LoadCaseTests +{ + public class WindCaseTests + { + [Theory] + [InlineData(NationalAnnex.RecommendedValues, 0.6, 0.2, 0.0)] + [InlineData(NationalAnnex.UnitedKingdom, 0.6, 0.2, 0.0)] + [InlineData(NationalAnnex.Germany, 0.6, 0.2, 0.0)] + public void CreateWindCaseTest(NationalAnnex nationalAnnex, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Wind loads"; + string expectedNickname = $"W"; + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateWind(nationalAnnex); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + } + + [Theory] + [InlineData(NationalAnnex.RecommendedValues, 0.6, 0.2, 0.0)] + [InlineData(NationalAnnex.UnitedKingdom, 0.6, 0.2, 0.0)] + [InlineData(NationalAnnex.Germany, 0.6, 0.2, 0.0)] + public void CreateWindCaseWithLoadTest(NationalAnnex nationalAnnex, + double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) + { + // Assemble + string expectedName = $"Wind loads"; + string expectedNickname = $"W"; + var load = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + + // Act + IVariableCase variableCase = ENLoadCaseFactory.CreateWind( + new List() { load }, nationalAnnex); + + // Assert + Assert.Equal(expectedName, variableCase.Name); + Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); + Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); + Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + Assert.Equal(90, ((IPointForce2d)variableCase.Loads.FirstOrDefault()).Z.Kilonewtons); + } + } +} From a48dc5d5851aa95aee47d836e2c088416b62e931 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 4 Oct 2024 18:14:18 +0000 Subject: [PATCH 41/53] Fix code style issues with dotnet_format --- Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs index 9170eb2..2dffc54 100644 --- a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs @@ -15,7 +15,7 @@ public class SnowCaseTests [InlineData(NationalAnnex.UnitedKingdom, false, 0.5, 0.2, 0.0)] [InlineData(NationalAnnex.Germany, true, 0.7, 0.5, 0.2)] [InlineData(NationalAnnex.Germany, false, 0.5, 0.2, 0.0)] - public void CreateSnowCaseTest(NationalAnnex nationalAnnex, bool above1000m, + public void CreateSnowCaseTest(NationalAnnex nationalAnnex, bool above1000m, double expectedPhi_0, double expectedPhi_1, double expectedPhi_2) { // Assemble From ded6fb21d699e2ad8b5994ebdb8bb9f712ae1ac8 Mon Sep 17 00:00:00 2001 From: kpne Date: Fri, 4 Oct 2024 20:22:53 +0200 Subject: [PATCH 42/53] case test helpers for combo --- .../Cases/LoadCases/ImposedCaseTests.cs | 20 ++++++++++++++++++ .../Cases/LoadCases/SnowCaseTests.cs | 20 ++++++++++++++++++ .../Cases/LoadCases/ThermalCaseTests.cs | 20 ++++++++++++++++++ .../Cases/LoadCases/WindCaseTests.cs | 21 +++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs index 61bcaa9..e5e8c71 100644 --- a/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs @@ -8,6 +8,26 @@ namespace LoadCaseTests { public class ImposedCaseTests { + public static IVariableCase Create() + { + return ENLoadCaseFactory.CreateImposed( + ImposedLoadCategory.CategoryB, NationalAnnex.UnitedKingdom); + } + + [Fact] + public void CreateImposedTest() + { + // Assemble + IVariableCase variableCase = Create(); + + // Assert + Assert.Equal("Live loads Category B", variableCase.Name); + Assert.Equal("Q_B", variableCase.Nickname); + Assert.Equal(0.7, variableCase.Characteristic.DecimalFractions); + Assert.Equal(0.5, variableCase.Frequent.DecimalFractions); + Assert.Equal(0.3, variableCase.QuasiPermanent.DecimalFractions); + } + [Theory] [InlineData(ImposedLoadCategory.CategoryA, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] [InlineData(ImposedLoadCategory.CategoryB, NationalAnnex.RecommendedValues, 0.7, 0.5, 0.3)] diff --git a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs index 9170eb2..0114dcd 100644 --- a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs @@ -8,6 +8,26 @@ namespace LoadCaseTests { public class SnowCaseTests { + public static IVariableCase Create() + { + return ENLoadCaseFactory.CreateSnow(NationalAnnex.UnitedKingdom, false); + } + + [Fact] + public void CreateImposedTest() + { + // Assemble + // Act + IVariableCase variableCase = Create(); + + // Assert + Assert.Equal("Snow loads", variableCase.Name); + Assert.Equal("S", variableCase.Nickname); + Assert.Equal(0.5, variableCase.Characteristic.DecimalFractions); + Assert.Equal(0.2, variableCase.Frequent.DecimalFractions); + Assert.Equal(0.0, variableCase.QuasiPermanent.DecimalFractions); + } + [Theory] [InlineData(NationalAnnex.RecommendedValues, true, 0.7, 0.5, 0.2)] [InlineData(NationalAnnex.RecommendedValues, false, 0.5, 0.2, 0.0)] diff --git a/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs index c14efe8..bbc5981 100644 --- a/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs @@ -8,6 +8,26 @@ namespace LoadCaseTests { public class ThermalCaseTests { + public static IVariableCase Create() + { + return ENLoadCaseFactory.CreateThermal(NationalAnnex.UnitedKingdom); + } + + [Fact] + public void CreateImposedTest() + { + // Assemble + // Act + IVariableCase variableCase = Create(); + + // Assert + Assert.Equal("Thermal loads", variableCase.Name); + Assert.Equal("T", variableCase.Nickname); + Assert.Equal(0.6, variableCase.Characteristic.DecimalFractions); + Assert.Equal(0.5, variableCase.Frequent.DecimalFractions); + Assert.Equal(0.0, variableCase.QuasiPermanent.DecimalFractions); + } + [Theory] [InlineData(NationalAnnex.RecommendedValues, 0.6, 0.5, 0.0)] [InlineData(NationalAnnex.UnitedKingdom, 0.6, 0.5, 0.0)] diff --git a/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs index 41711a8..a5a7450 100644 --- a/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs @@ -8,6 +8,27 @@ namespace LoadCaseTests { public class WindCaseTests { + public static IVariableCase Create() + { + return ENLoadCaseFactory.CreateWind(NationalAnnex.UnitedKingdom); + } + + [Fact] + public void CreateImposedTest() + { + // Assemble + // Act + IVariableCase variableCase = Create(); + + // Assert + Assert.Equal("Wind loads", variableCase.Name); + Assert.Equal("W", variableCase.Nickname); + Assert.Equal(0.6, variableCase.Characteristic.DecimalFractions); + Assert.Equal(0.2, variableCase.Frequent.DecimalFractions); + Assert.Equal(0.0, variableCase.QuasiPermanent.DecimalFractions); + } + + [Theory] [InlineData(NationalAnnex.RecommendedValues, 0.6, 0.2, 0.0)] [InlineData(NationalAnnex.UnitedKingdom, 0.6, 0.2, 0.0)] From 7b64659e66485d8f2a2c519ece67b808139e36d7 Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 7 Oct 2024 14:45:58 +0200 Subject: [PATCH 43/53] accidential combination tests --- .../Cases/Factory/ENImposedCaseFactory.cs | 2 +- .../Cases/Cases/Factory/ENWindCaseFactory.cs | 1 + .../Combinations/AccidentialCombination.cs | 3 +- .../ENULSCombinationAccidentialFactory.cs | 7 +- Loads/Cases/Combinations/Utility/Utility.cs | 44 ++- .../AccidentialCombinationTests.cs | 254 ++++++++++++++++++ .../Cases/LoadCases/ImposedCaseTests.cs | 9 +- .../Cases/LoadCases/SnowCaseTests.cs | 6 +- .../Cases/LoadCases/ThermalCaseTests.cs | 3 +- .../Cases/LoadCases/WindCaseTests.cs | 7 +- Loads/LoadTests/LoadTests.csproj | 4 - 11 files changed, 314 insertions(+), 26 deletions(-) create mode 100644 Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs diff --git a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs index 6ac061c..6a2ef40 100644 --- a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs @@ -74,7 +74,7 @@ public static VariableCase CreateImposed(ImposedLoadCategory category, NationalA Frequent = factors.Phi_1, QuasiPermanent = factors.Phi_2, Name = $"Live loads Category {category.ToString().Last()}", - Nickname = $"Q_{category.ToString().Last()}", + Nickname = $"Q", }; } diff --git a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs index 7ec998a..f54118e 100644 --- a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs @@ -26,6 +26,7 @@ public static VariableCase CreateWind(NationalAnnex nationalAnnex) QuasiPermanent = factors.Phi_2, Name = $"Wind loads", Nickname = "W", + IsHorizontal = true, }; } diff --git a/Loads/Cases/Combinations/AccidentialCombination.cs b/Loads/Cases/Combinations/AccidentialCombination.cs index f729c96..c720799 100644 --- a/Loads/Cases/Combinations/AccidentialCombination.cs +++ b/Loads/Cases/Combinations/AccidentialCombination.cs @@ -24,7 +24,8 @@ public IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange((IList)PermanentCases); + factoredLoads.AddRange( + Utility.FactorLoads(new Ratio(1.0, RatioUnit.DecimalFraction), PermanentCases)); } if (LeadingVariableCases != null) diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs index f9e8409..4af7246 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs @@ -17,8 +17,10 @@ public static IList CreateAccidential(IVariableCase acc { combinations.Add(new AccidentialCombination() { - Name = $"Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", + Name = $"LC{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", PermanentCases = permanents, + LeadingAccidentialPartialFactor = partialFactor, + LeadingVariableCases = new List() { accidentalCase }, OtherAccompanyingVariableCases = variables, UseFrequentCombinationFactorForMainAccompanying = false }); @@ -32,7 +34,8 @@ public static IList CreateAccidential(IVariableCase acc Name = $"LC{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name} combined with {variables[i].Name} as main accompanying variable action", PermanentCases = permanents, LeadingAccidentialPartialFactor = partialFactor, - LeadingVariableCases = new List() { variables[i] }, + LeadingVariableCases = new List() { accidentalCase }, + MainAccompanyingVariableCases = new List() { variables[i] }, OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), UseFrequentCombinationFactorForMainAccompanying = true }); diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 8ba025a..bc188d6 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -77,16 +77,20 @@ internal static string DescriptionHelper(IList cases, Ratio factor) where StringBuilder desc = new StringBuilder(); if (factor.Value != 1) { - desc.AppendLine($"{factor}·"); + desc.AppendLine($"{factor}·("); } - desc.AppendLine("("); foreach (ILoadCase lc in cases) { desc.Append($"{lc.Nickname} + "); } - desc.AppendLine(")"); + desc.Remove(desc.Length - 3, 3); + if (factor.Value != 1) + { + desc.AppendLine(")"); + } + return desc.ToString(); } @@ -110,6 +114,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor1, Ratio desc.Append($"{lc.Nickname} + "); } + desc.Remove(desc.Length - 3, 3); desc.AppendLine(")"); return desc.ToString(); } @@ -124,35 +129,54 @@ internal static string DescriptionHelper(IList cases, Ratio factor, Func 3) + { + desc.Remove(desc.Length - 3, 3); + } + + if (factor.Value != 1) + { + desc.AppendLine(")"); } - desc.AppendLine(")"); return desc.ToString(); } internal static string JoinDescriptions(string[] strings) { - return string.Join(" + ", strings).Replace(" + + ", string.Empty).Trim(new char[] { ' ', '+' }); + string joined = string.Join(" + ", strings).Replace(" + + ", " + "); + if (!joined.EndsWith(" + ")) + { + return joined; + } + + return joined.Remove(joined.LastIndexOf(" + ")); } } } diff --git a/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs new file mode 100644 index 0000000..a48b6fd --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs @@ -0,0 +1,254 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class AccidentialCombinationTests + { + public static IList Create(bool useFrequent) + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + IVariableCase impact = new VariableCase() + { + Name = "Truck impact", + Nickname = "A", + Loads = new List() + { + new ColumnLoad(new Force(50, ForceUnit.Kilonewton)) + } + }; + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateAccidential( + impact, new Ratio(1.5, RatioUnit.DecimalFraction), otherCases, + NationalAnnex.RecommendedValues, useFrequent); + } + + [Fact] + public void NameAndDefinitionWithFrequentTest() + { + // Assemble + // Act + IList combinations = Create(true); + + // Assert + Assert.Equal("LC1: Accidential, Eq. 6.11a/b - Leading Truck impact combined with Live loads Category B as main accompanying variable action", + combinations[0].Name); + Assert.Equal("DL + SDL + 1.5·A + 0.5·Q + 0.2·S", combinations[0].Definition); + + Assert.Equal("LC2: Accidential, Eq. 6.11a/b - Leading Truck impact combined with Wind loads as main accompanying variable action", + combinations[1].Name); + Assert.Equal("DL + SDL + 1.5·A + 0.2·W + 0.3·Q + 0.2·S", combinations[1].Definition); + + Assert.Equal("LC3: Accidential, Eq. 6.11a/b - Leading Truck impact combined with Snow loads as main accompanying variable action", + combinations[2].Name); + Assert.Equal("DL + SDL + 1.5·A + 0.5·S + 0.3·Q", combinations[2].Definition); + + Assert.Equal("LC4: Accidential, Eq. 6.11a/b - Leading Truck impact combined with Thermal loads as main accompanying variable action", + combinations[3].Name); + Assert.Equal("DL + SDL + 1.5·A + 0.5·T + 0.3·Q + 0.2·S", combinations[3].Definition); + } + + [Fact] + public void NameAndDefinitionWithQuasiTest() + { + // Assemble + // Act + IList combinations = Create(false); + + // Assert + Assert.Equal("LC1: Accidential, Eq. 6.11a/b - Leading Truck impact", combinations[0].Name); + Assert.Equal("DL + SDL + 1.5·A + 0.3·Q + 0.2·S", combinations[0].Definition); + } + + [Fact] + public void CasesWithFrequentTest() + { + // Assemble + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + IVariableCase impact = new VariableCase() + { + Name = "Truck impact", + Nickname = "A", + Loads = new List() + { + new ColumnLoad(new Force(50, ForceUnit.Kilonewton)) + } + }; + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + // Act + IList combinations = Create(true); + + // Assert + Assert.Equal(4, combinations.Count); + for (int i = 0; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + Assert.Equivalent(impact, combinations[i].LeadingVariableCases.FirstOrDefault()); + Assert.Single(combinations[i].MainAccompanyingVariableCases); + Assert.DoesNotContain(otherCases[i + 2], combinations[i].OtherAccompanyingVariableCases); + Assert.Equal(3, combinations[i].OtherAccompanyingVariableCases.Count); + Assert.Equal(1.5, combinations[i].LeadingAccidentialPartialFactor.DecimalFractions); + } + } + + [Fact] + public void CasesWithQuasiTest() + { + // Assemble + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + IVariableCase impact = new VariableCase() + { + Name = "Truck impact", + Nickname = "A", + Loads = new List() + { + new ColumnLoad(new Force(50, ForceUnit.Kilonewton)) + } + }; + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + // Act + IList combinations = Create(false); + + // Assert + Assert.Single(combinations); + Assert.Equal(2, combinations[0].PermanentCases.Count); + Assert.Single(combinations[0].LeadingVariableCases); + Assert.Equivalent(impact, combinations[0].LeadingVariableCases.FirstOrDefault()); + Assert.Null(combinations[0].MainAccompanyingVariableCases); + Assert.Equal(4, combinations[0].OtherAccompanyingVariableCases.Count); + Assert.Equal(1.5, combinations[0].LeadingAccidentialPartialFactor.DecimalFractions); + } + + [Fact] + public void FactoredLoadsWithFrequentTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + ILoad impact = new ColumnLoad(new Force(50, ForceUnit.Kilonewton)); + + IList combinations = Create(true); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + 1.5·A + 0.5·Q + 0.2·S + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.0, dl); + TestFactoredLoad(lc1Loads[i++], 1.0, sdl); + TestFactoredLoad(lc1Loads[i++], 1.5, impact); + TestFactoredLoad(lc1Loads[i++], 0.5, ll); + TestFactoredLoad(lc1Loads[i++], 0.0, w); + TestFactoredLoad(lc1Loads[i++], 0.2, s); + TestFactoredLoad(lc1Loads[i++], 0.0, t); + + // LC2: DL + SDL + 1.5·A + 0.2·W + 0.3·Q + 0.2·S + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.0, dl); + TestFactoredLoad(lc2Loads[i++], 1.0, sdl); + TestFactoredLoad(lc2Loads[i++], 1.5, impact); + TestFactoredLoad(lc2Loads[i++], 0.2, w); + TestFactoredLoad(lc2Loads[i++], 0.3, ll); + TestFactoredLoad(lc2Loads[i++], 0.2, s); + TestFactoredLoad(lc2Loads[i++], 0.0, t); + + // LC3: DL + SDL + 1.5·A + 0.5·S + 0.3·Q + i = 0; + TestFactoredLoad(lc3Loads[i++], 1.0, dl); + TestFactoredLoad(lc3Loads[i++], 1.0, sdl); + TestFactoredLoad(lc3Loads[i++], 1.5, impact); + TestFactoredLoad(lc3Loads[i++], 0.5, s); + TestFactoredLoad(lc3Loads[i++], 0.3, ll); + TestFactoredLoad(lc3Loads[i++], 0.0, w); + TestFactoredLoad(lc3Loads[i++], 0.0, t); + + // LC4: DL + SDL + 1.5·A + 0.5·T + 0.3·Q + 0.2·S + i = 0; + TestFactoredLoad(lc4Loads[i++], 1.0, dl); + TestFactoredLoad(lc4Loads[i++], 1.0, sdl); + TestFactoredLoad(lc4Loads[i++], 1.5, impact); + TestFactoredLoad(lc4Loads[i++], 0.5, t); + TestFactoredLoad(lc4Loads[i++], 0.3, ll); + TestFactoredLoad(lc4Loads[i++], 0.0, w); + TestFactoredLoad(lc4Loads[i++], 0.2, s); + } + + [Fact] + public void FactoredLoadsWithQuasiTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + ILoad impact = new ColumnLoad(new Force(50, ForceUnit.Kilonewton)); + + IList combinations = Create(false); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + 1.5·A + 0.3·Q + 0.2·S + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.0, dl); + TestFactoredLoad(lc1Loads[i++], 1.0, sdl); + TestFactoredLoad(lc1Loads[i++], 1.5, impact); + TestFactoredLoad(lc1Loads[i++], 0.3, ll); + TestFactoredLoad(lc1Loads[i++], 0.0, w); + TestFactoredLoad(lc1Loads[i++], 0.2, s); + TestFactoredLoad(lc1Loads[i++], 0.0, t); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + diff --git a/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs index e5e8c71..1026bcf 100644 --- a/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/ImposedCaseTests.cs @@ -10,7 +10,8 @@ public class ImposedCaseTests { public static IVariableCase Create() { - return ENLoadCaseFactory.CreateImposed( + var load = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + return ENLoadCaseFactory.CreateImposed(new List { load }, ImposedLoadCategory.CategoryB, NationalAnnex.UnitedKingdom); } @@ -22,7 +23,7 @@ public void CreateImposedTest() // Assert Assert.Equal("Live loads Category B", variableCase.Name); - Assert.Equal("Q_B", variableCase.Nickname); + Assert.Equal("Q", variableCase.Nickname); Assert.Equal(0.7, variableCase.Characteristic.DecimalFractions); Assert.Equal(0.5, variableCase.Frequent.DecimalFractions); Assert.Equal(0.3, variableCase.QuasiPermanent.DecimalFractions); @@ -58,7 +59,7 @@ public void CreateImposedCaseTest(ImposedLoadCategory category, NationalAnnex na { // Assemble string expectedName = $"Live loads Category {category.ToString().Last()}"; - string expectedNickname = $"Q_{category.ToString().Last()}"; + string expectedNickname = $"Q"; // Act IVariableCase variableCase = ENLoadCaseFactory.CreateImposed(category, nationalAnnex); @@ -101,7 +102,7 @@ public void CreateImposedCaseWithLoadTest(ImposedLoadCategory category, National { // Assemble string expectedName = $"Live loads Category {category.ToString().Last()}"; - string expectedNickname = $"Q_{category.ToString().Last()}"; + string expectedNickname = $"Q"; var load = new LineForce2d(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); // Act diff --git a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs index 0114dcd..164c7a0 100644 --- a/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/SnowCaseTests.cs @@ -8,9 +8,11 @@ namespace LoadCaseTests { public class SnowCaseTests { - public static IVariableCase Create() + public static IVariableCase Create(bool above1000m = false) { - return ENLoadCaseFactory.CreateSnow(NationalAnnex.UnitedKingdom, false); + var load = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + return ENLoadCaseFactory.CreateSnow(new List { load }, + NationalAnnex.UnitedKingdom, above1000m); } [Fact] diff --git a/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs index bbc5981..239a687 100644 --- a/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/ThermalCaseTests.cs @@ -10,7 +10,8 @@ public class ThermalCaseTests { public static IVariableCase Create() { - return ENLoadCaseFactory.CreateThermal(NationalAnnex.UnitedKingdom); + var load = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + return ENLoadCaseFactory.CreateThermal(new List { load }, NationalAnnex.UnitedKingdom); } [Fact] diff --git a/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs b/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs index a5a7450..d7b0daa 100644 --- a/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs +++ b/Loads/LoadTests/Cases/LoadCases/WindCaseTests.cs @@ -10,7 +10,9 @@ public class WindCaseTests { public static IVariableCase Create() { - return ENLoadCaseFactory.CreateWind(NationalAnnex.UnitedKingdom); + var load = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + return ENLoadCaseFactory.CreateWind( + new List() { load }, NationalAnnex.UnitedKingdom); } [Fact] @@ -26,6 +28,7 @@ public void CreateImposedTest() Assert.Equal(0.6, variableCase.Characteristic.DecimalFractions); Assert.Equal(0.2, variableCase.Frequent.DecimalFractions); Assert.Equal(0.0, variableCase.QuasiPermanent.DecimalFractions); + Assert.True(variableCase.IsHorizontal); } @@ -49,6 +52,7 @@ public void CreateWindCaseTest(NationalAnnex nationalAnnex, Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); + Assert.True(variableCase.IsHorizontal); } [Theory] @@ -70,6 +74,7 @@ public void CreateWindCaseWithLoadTest(NationalAnnex nationalAnnex, // Assert Assert.Equal(expectedName, variableCase.Name); Assert.Equal(expectedNickname, variableCase.Nickname); + Assert.True(variableCase.IsHorizontal); Assert.Equal(expectedPhi_0, variableCase.Characteristic.DecimalFractions); Assert.Equal(expectedPhi_1, variableCase.Frequent.DecimalFractions); Assert.Equal(expectedPhi_2, variableCase.QuasiPermanent.DecimalFractions); diff --git a/Loads/LoadTests/LoadTests.csproj b/Loads/LoadTests/LoadTests.csproj index 22471ca..913ffc9 100644 --- a/Loads/LoadTests/LoadTests.csproj +++ b/Loads/LoadTests/LoadTests.csproj @@ -27,8 +27,4 @@ - - - - From 71a22d65af0195d51e4c56254dbc150c30a1b7ca Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 7 Oct 2024 14:59:00 +0200 Subject: [PATCH 44/53] change serialization project name and namespace --- Loads/LoadTests/LoadTests.csproj | 2 +- Loads/LoadTests/Loads/AutomatedTests.cs | 2 +- ...agmaWorks.Taxonomy.Serialization.Loads.csproj} | 0 .../ProfileJsonSerializationExtensions.cs | 4 ++-- Taxonomy.sln | 15 ++++++++------- 5 files changed, 12 insertions(+), 11 deletions(-) rename Loads/Serialization/{MagmaWorks.Taxonomy.Loads.Serialization.csproj => MagmaWorks.Taxonomy.Serialization.Loads.csproj} (100%) diff --git a/Loads/LoadTests/LoadTests.csproj b/Loads/LoadTests/LoadTests.csproj index 913ffc9..59ddfbf 100644 --- a/Loads/LoadTests/LoadTests.csproj +++ b/Loads/LoadTests/LoadTests.csproj @@ -20,7 +20,7 @@ - + diff --git a/Loads/LoadTests/Loads/AutomatedTests.cs b/Loads/LoadTests/Loads/AutomatedTests.cs index 639f596..7558c26 100644 --- a/Loads/LoadTests/Loads/AutomatedTests.cs +++ b/Loads/LoadTests/Loads/AutomatedTests.cs @@ -2,7 +2,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using MagmaWorks.Taxonomy.Loads; -using MagmaWorks.Taxonomy.Loads.Serialization; +using MagmaWorks.Taxonomy.Serialization.Loads; using OasysUnits; using OasysUnits.Units; diff --git a/Loads/Serialization/MagmaWorks.Taxonomy.Loads.Serialization.csproj b/Loads/Serialization/MagmaWorks.Taxonomy.Serialization.Loads.csproj similarity index 100% rename from Loads/Serialization/MagmaWorks.Taxonomy.Loads.Serialization.csproj rename to Loads/Serialization/MagmaWorks.Taxonomy.Serialization.Loads.csproj diff --git a/Loads/Serialization/ProfileJsonSerializationExtensions.cs b/Loads/Serialization/ProfileJsonSerializationExtensions.cs index 475530a..a883ea5 100644 --- a/Loads/Serialization/ProfileJsonSerializationExtensions.cs +++ b/Loads/Serialization/ProfileJsonSerializationExtensions.cs @@ -1,7 +1,7 @@ -using MagmaWorks.Taxonomy.Serialization; +using MagmaWorks.Taxonomy.Loads; using Newtonsoft.Json; -namespace MagmaWorks.Taxonomy.Loads.Serialization +namespace MagmaWorks.Taxonomy.Serialization.Loads { public static class LoadJsonSerializationExtensions { diff --git a/Taxonomy.sln b/Taxonomy.sln index 233ab59..8e91fd4 100644 --- a/Taxonomy.sln +++ b/Taxonomy.sln @@ -69,18 +69,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.ILoads" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Loads", "Loads\Loads\MagmaWorks.Taxonomy.Loads.csproj", "{2BE8AF39-9677-44E1-AE6C-CE9A14DF5B5B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Loads.Serialization", "Loads\Serialization\MagmaWorks.Taxonomy.Loads.Serialization.csproj", "{0DB384BD-6270-4A1D-95D4-ED3972AE63B0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Serialization.Loads", "Loads\Serialization\MagmaWorks.Taxonomy.Serialization.Loads.csproj", "{0DB384BD-6270-4A1D-95D4-ED3972AE63B0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadTests", "Loads\LoadTests\LoadTests.csproj", "{D9EF311B-6C73-4EA3-9F87-63D660C24CEE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoadTests", "Loads\LoadTests\LoadTests.csproj", "{D9EF311B-6C73-4EA3-9F87-63D660C24CEE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.ICases", "Loads\ICases\MagmaWorks.Taxonomy.ICases.csproj", "{6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.ICases", "Loads\ICases\MagmaWorks.Taxonomy.ICases.csproj", "{6B92B8E9-FD08-449B-8EBB-F63E2ADE7043}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Cases", "Loads\Cases\MagmaWorks.Taxonomy.Cases.csproj", "{8ED7E8B2-BD1C-419F-9FEB-23F51788085E}" -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Serialization.Standards", "Standards\Serialization\MagmaWorks.Taxonomy.Serialization.Standards.csproj", "{A76C4493-75AB-4F55-8DC4-4D806F7B86FD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Cases", "Loads\Cases\MagmaWorks.Taxonomy.Cases.csproj", "{8ED7E8B2-BD1C-419F-9FEB-23F51788085E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Serialization.Materials", "Materials\Serialization\MagmaWorks.Taxonomy.Serialization.Materials.csproj", "{FC999BF3-6232-4564-8035-9F8753AAF387}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Serialization.Standards", "Standards\Serialization\MagmaWorks.Taxonomy.Serialization.Standards.csproj", "{A76C4493-75AB-4F55-8DC4-4D806F7B86FD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagmaWorks.Taxonomy.Serialization.Sections", "Sections\Serialization\MagmaWorks.Taxonomy.Serialization.Sections.csproj", "{0374F525-1D2C-49F5-818F-187A04D8A779}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Serialization.Materials", "Materials\Serialization\MagmaWorks.Taxonomy.Serialization.Materials.csproj", "{FC999BF3-6232-4564-8035-9F8753AAF387}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MagmaWorks.Taxonomy.Serialization.Sections", "Sections\Serialization\MagmaWorks.Taxonomy.Serialization.Sections.csproj", "{0374F525-1D2C-49F5-818F-187A04D8A779}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 59b745dee6226c3c2b2a2a8ff3326857f63488db Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 7 Oct 2024 20:43:47 +0200 Subject: [PATCH 45/53] consistent file naming and prefix load combination name --- .../Factory/ENSLSCombinationFactory.cs | 18 +-- .../ENULSCombinationAccidentialFactory.cs | 11 +- ...tory.cs => ENULSCombinationSetAFactory.cs} | 7 +- ...tory.cs => ENULSCombinationSetBFactory.cs} | 26 ++-- ...tory.cs => ENULSCombinationSetCFactory.cs} | 10 +- .../Cases/Combinations/SeismicCombination.cs | 3 +- Loads/Cases/Combinations/Utility/Utility.cs | 26 ++-- .../Combinations/SeismicCombinationTests.cs | 127 ++++++++++++++++++ 8 files changed, 183 insertions(+), 45 deletions(-) rename Loads/Cases/Combinations/Factory/{ENCombinationSetAFactory.cs => ENULSCombinationSetAFactory.cs} (88%) rename Loads/Cases/Combinations/Factory/{ENCombinationSetBFactory.cs => ENULSCombinationSetBFactory.cs} (83%) rename Loads/Cases/Combinations/Factory/{ENCombinationSetCFactory.cs => ENULSCombinationSetCFactory.cs} (86%) create mode 100644 Loads/LoadTests/Cases/Combinations/SeismicCombinationTests.cs diff --git a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs index 9e7225f..89a32a0 100644 --- a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs @@ -6,7 +6,7 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { - public static IList CreateCharacteristic(IList cases, int firstCaseId = 1) + public static IList CreateCharacteristic(IList cases, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); var combinations = new List(); @@ -14,7 +14,7 @@ public static IList CreateCharacteristic(IList() { variables[i] }, AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), @@ -24,7 +24,7 @@ public static IList CreateCharacteristic(IList !item.IsFavourable).ToList(), LeadingVariableCases = new List() { variables[i] }, AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), @@ -35,7 +35,7 @@ public static IList CreateCharacteristic(IList CreateFrequent(IList cases, int firstCaseId = 1) + public static IList CreateFrequent(IList cases, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); var combinations = new List(); @@ -43,7 +43,7 @@ public static IList CreateFrequent(IList cases, { combinations.Add(new FrequentCombination() { - Name = $"LC{firstCaseId++}: SLS Frequent - Leading {variables[i].Name}", + Name = $"{prefix}{firstCaseId++}: SLS Frequent - Leading {variables[i].Name}", PermanentCases = permanents, LeadingVariableCases = new List() { variables[i] }, AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), @@ -53,7 +53,7 @@ public static IList CreateFrequent(IList cases, { combinations.Add(new FrequentCombination() { - Name = $"LC{firstCaseId++}: SLS Frequent - Leading {variables[i].Name} with unfavourable permanent", + Name = $"{prefix}{firstCaseId++}: SLS Frequent - Leading {variables[i].Name} with unfavourable permanent", PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), LeadingVariableCases = new List() { variables[i] }, AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), @@ -64,7 +64,7 @@ public static IList CreateFrequent(IList cases, return combinations; } - public static IList CreateQuasiPermanent(IList cases, int firstCaseId = 1) + public static IList CreateQuasiPermanent(IList cases, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); var combinations = new List(); @@ -72,7 +72,7 @@ public static IList CreateQuasiPermanent(IList() { variables[i] }, AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), @@ -82,7 +82,7 @@ public static IList CreateQuasiPermanent(IList !item.IsFavourable).ToList(), LeadingVariableCases = new List() { variables[i] }, AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs index 4af7246..c3b0941 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationAccidentialFactory.cs @@ -9,7 +9,8 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations public static partial class ENCombinationFactory { public static IList CreateAccidential(IVariableCase accidentalCase, Ratio partialFactor, - IList otherCases, NationalAnnex nationalAnnex, bool useFrequentCombinationFactorForMainAccompanying, int firstCaseId = 1) + IList otherCases, NationalAnnex nationalAnnex, bool useFrequentCombinationFactorForMainAccompanying, + string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(otherCases); var combinations = new List(); @@ -17,7 +18,7 @@ public static IList CreateAccidential(IVariableCase acc { combinations.Add(new AccidentialCombination() { - Name = $"LC{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", + Name = $"{prefix}{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name}", PermanentCases = permanents, LeadingAccidentialPartialFactor = partialFactor, LeadingVariableCases = new List() { accidentalCase }, @@ -31,7 +32,7 @@ public static IList CreateAccidential(IVariableCase acc { combinations.Add(new AccidentialCombination() { - Name = $"LC{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name} combined with {variables[i].Name} as main accompanying variable action", + Name = $"{prefix}{firstCaseId++}: Accidential, Eq. 6.11a/b - Leading {accidentalCase.Name} combined with {variables[i].Name} as main accompanying variable action", PermanentCases = permanents, LeadingAccidentialPartialFactor = partialFactor, LeadingVariableCases = new List() { accidentalCase }, @@ -45,7 +46,7 @@ public static IList CreateAccidential(IVariableCase acc } public static IList CreateSeismic(IList seismicCases, Ratio partialFactor, - IList otherCases, NationalAnnex nationalAnnex, int firstCaseId = 1) + IList otherCases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(otherCases); var combinations = new List(); @@ -53,7 +54,7 @@ public static IList CreateSeismic(IList seis { combinations.Add(new SeismicCombination() { - Name = $"LC{firstCaseId++}: Seismic, Eq. 6.12a/b - Leading {seismicCases[i].Name}", + Name = $"{prefix}{firstCaseId++}: Seismic, Eq. 6.12a/b - Leading {seismicCases[i].Name}", PermanentCases = permanents, LeadingVariableCases = new List() { seismicCases[i] }, LeadingSeismicPartialFactor = partialFactor, diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs similarity index 88% rename from Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs rename to Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs index 37946a2..eb68305 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetAFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs @@ -11,7 +11,6 @@ public static partial class ENCombinationFactory { { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - }; public static IList CreateEquSetA(IList cases) @@ -19,7 +18,7 @@ public static IList CreateEquSetA(IList case return CreateEquSetA(cases, NationalAnnex.RecommendedValues); } - public static IList CreateEquSetA(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + public static IList CreateEquSetA(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); if (!EN1990_TableA1_2A.TryGetValue(nationalAnnex, out TableA1Properties factors)) @@ -32,7 +31,7 @@ public static IList CreateEquSetA(IList case { combinations.Add(new EquilibriumCombination() { - Name = $"LC{firstCaseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name}", + Name = $"{prefix}{firstCaseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name}", PermanentCases = permanents, PermanentPartialFactor = factors.Gamma_Gsup, LeadingVariableCases = new List() { variables[i] }, @@ -45,7 +44,7 @@ public static IList CreateEquSetA(IList case { combinations.Add(new EquilibriumCombination() { - Name = $"LC{firstCaseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + Name = $"{prefix}{firstCaseId++}: EQU Set A, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), PermanentPartialFactor = factors.Gamma_Ginf, LeadingVariableCases = new List() { variables[i] }, diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs similarity index 83% rename from Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs rename to Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs index 004564a..bcc1589 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetBFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs @@ -14,24 +14,24 @@ public static partial class ENCombinationFactory }; - public static IList CreateStrGeoSetB(IList cases, int firstCaseId = 1) + public static IList CreateStrGeoSetB(IList cases, string prefix = "LC", int firstCaseId = 1) { - return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true, firstCaseId); + return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true, prefix, firstCaseId); } - public static IList CreateStrGeoSetB(IList cases, NationalAnnex nationalAnnex, bool use6_10aAnd6_10b, int firstCaseId = 1) + public static IList CreateStrGeoSetB(IList cases, NationalAnnex nationalAnnex, bool use6_10aAnd6_10b, string prefix = "LC", int firstCaseId = 1) { if (use6_10aAnd6_10b) { - return CreateSTR6_10aAnd6_10b(cases, nationalAnnex, firstCaseId); + return CreateSTR6_10aAnd6_10b(cases, nationalAnnex, prefix, firstCaseId); } else { - return CreateSTR6_10(cases, nationalAnnex, firstCaseId); + return CreateSTR6_10(cases, nationalAnnex, prefix, firstCaseId); } } - private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1Properties factors)) @@ -44,7 +44,7 @@ private static IList CreateSTR6_10(IList ca { combinations.Add(new MemberDesignCombination() { - Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name}", + Name = $"{prefix}{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name}", PermanentCases = permanents, PermanentPartialFactor = factors.Gamma_Gsup, LeadingVariableCases = new List() { variables[i] }, @@ -57,7 +57,7 @@ private static IList CreateSTR6_10(IList ca { combinations.Add(new MemberDesignCombination() { - Name = $"LC{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + Name = $"{prefix}{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), PermanentPartialFactor = factors.Gamma_Ginf, LeadingVariableCases = new List() { variables[i] }, @@ -71,7 +71,7 @@ private static IList CreateSTR6_10(IList ca return combinations; } - private static IList CreateSTR6_10aAnd6_10b(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + private static IList CreateSTR6_10aAnd6_10b(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1Properties factors)) @@ -85,7 +85,7 @@ private static IList CreateSTR6_10aAnd6_10b(IList CreateSTR6_10aAnd6_10b(IList() { variables[i] }, @@ -111,7 +111,7 @@ private static IList CreateSTR6_10aAnd6_10b(IList CreateSTR6_10aAnd6_10b(IList !item.IsFavourable).ToList(), PermanentPartialFactor = factors.Gamma_Ginf, PermanentReductionFactor = factors.Xi, diff --git a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs similarity index 86% rename from Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs rename to Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs index 3c0c50b..44a37cf 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationSetCFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs @@ -14,12 +14,12 @@ public static partial class ENCombinationFactory { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, }; - public static IList CreateStrGeoSetC(IList cases, int firstCaseId = 1) + public static IList CreateStrGeoSetC(IList cases, string prefix = "LC", int firstCaseId = 1) { - return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues, firstCaseId); + return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues, prefix, firstCaseId); } - public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, int firstCaseId = 1) + public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1Properties factors)) @@ -32,7 +32,7 @@ public static IList CreateStrGeoSetC(IList { combinations.Add(new GeotechnicalMemberDesignCombination() { - Name = $"LC{firstCaseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name}", + Name = $"{prefix}{firstCaseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name}", PermanentCases = permanents, PermanentPartialFactor = factors.Gamma_Gsup, LeadingVariableCases = new List() { variables[i] }, @@ -45,7 +45,7 @@ public static IList CreateStrGeoSetC(IList { combinations.Add(new GeotechnicalMemberDesignCombination() { - Name = $"LC{firstCaseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", + Name = $"{prefix}{firstCaseId++}: STR/GEO Set C, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), PermanentPartialFactor = factors.Gamma_Ginf, LeadingVariableCases = new List() { variables[i] }, diff --git a/Loads/Cases/Combinations/SeismicCombination.cs b/Loads/Cases/Combinations/SeismicCombination.cs index cb7e39a..714cdb9 100644 --- a/Loads/Cases/Combinations/SeismicCombination.cs +++ b/Loads/Cases/Combinations/SeismicCombination.cs @@ -21,7 +21,8 @@ public virtual IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange((IList)PermanentCases); + factoredLoads.AddRange( + Utility.FactorLoads(new Ratio(1, RatioUnit.DecimalFraction), PermanentCases)); } if (LeadingVariableCases != null) diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index bc188d6..145161b 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -66,11 +66,11 @@ internal static string DescriptionHelper(IList cases, Ratio factor) where { if (factor.DecimalFractions == 1) { - return cases.First().Nickname; + return GetNickname(cases.First()); } else { - return $"{factor}·{cases.First().Nickname}"; + return $"{factor}·{GetNickname(cases.First())}"; } } @@ -82,7 +82,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor) where foreach (ILoadCase lc in cases) { - desc.Append($"{lc.Nickname} + "); + desc.Append($"{GetNickname(lc)} + "); } desc.Remove(desc.Length - 3, 3); @@ -104,14 +104,14 @@ internal static string DescriptionHelper(IList cases, Ratio factor1, Ratio if (cases.Count == 1) { - return $"{factor1}·{f2}{cases.First().Nickname}"; + return $"{factor1}·{f2}{GetNickname(cases.First())}"; } StringBuilder desc = new StringBuilder(); desc.AppendLine($"{factor1}·{f2}("); foreach (ILoadCase lc in cases) { - desc.Append($"{lc.Nickname} + "); + desc.Append($"{GetNickname(lc)} + "); } desc.Remove(desc.Length - 3, 3); @@ -132,11 +132,11 @@ internal static string DescriptionHelper(IList cases, Ratio factor, Func(IList cases, Ratio factor, Func Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + IVariableCase seismic = new VariableCase() + { + Name = "Seismic Equivalent Horizontal Load in X-direction", + Nickname = "EHL X", + Loads = new List() + { + new ColumnLoad(new Force(50, ForceUnit.Kilonewton)) + } + }; + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateSeismic(new List() { seismic }, + new Ratio(1.5, RatioUnit.DecimalFraction), otherCases, NationalAnnex.RecommendedValues, + "ULS", 54); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("ULS54: Seismic, Eq. 6.12a/b - Leading Seismic Equivalent Horizontal Load in X-direction", + combinations[0].Name); + Assert.Equal("DL + SDL + 1.5·'EHL X' + 0.3·Q + 0.2·S", combinations[0].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + IVariableCase seismic = new VariableCase() + { + Name = "Seismic Equivalent Horizontal Load in X-direction", + Nickname = "EHL X", + Loads = new List() + { + new ColumnLoad(new Force(50, ForceUnit.Kilonewton)) + } + }; + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + // Act + IList combinations = Create(); + + // Assert + Assert.Single(combinations); + Assert.Equal(2, combinations[0].PermanentCases.Count); + Assert.Single(combinations[0].LeadingVariableCases); + Assert.Equivalent(seismic, combinations[0].LeadingVariableCases.FirstOrDefault()); + Assert.Equal(4, combinations[0].AccompanyingVariableCases.Count); + Assert.Equal(1.5, combinations[0].LeadingSeismicPartialFactor.DecimalFractions); + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + ILoad impact = new ColumnLoad(new Force(50, ForceUnit.Kilonewton)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + 1.5·A + 0.3·Q + 0.2·S + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.0, dl); + TestFactoredLoad(lc1Loads[i++], 1.0, sdl); + TestFactoredLoad(lc1Loads[i++], 1.5, impact); + TestFactoredLoad(lc1Loads[i++], 0.3, ll); + TestFactoredLoad(lc1Loads[i++], 0.0, w); + TestFactoredLoad(lc1Loads[i++], 0.2, s); + TestFactoredLoad(lc1Loads[i++], 0.0, t); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + From 05347a8c9e0a88e3d406821c1ad69421430253d4 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Mon, 7 Oct 2024 18:45:27 +0000 Subject: [PATCH 46/53] Fix code style issues with dotnet_format --- Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs index 44a37cf..8dff5ba 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs @@ -19,7 +19,7 @@ public static IList CreateStrGeoSetC(IList return CreateStrGeoSetC(cases, NationalAnnex.RecommendedValues, prefix, firstCaseId); } - public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) + public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1Properties factors)) From 53ef6d26209eb7553f5fdb7e491207ede7e01d73 Mon Sep 17 00:00:00 2001 From: kpne Date: Mon, 7 Oct 2024 22:50:51 +0200 Subject: [PATCH 47/53] Equilibrium combination tests --- Loads/Cases/Combinations/Utility/Utility.cs | 12 +- .../EquilibriumCombinationTests.cs | 163 ++++++++++++++++++ 2 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 Loads/LoadTests/Cases/Combinations/EquilibriumCombinationTests.cs diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 145161b..50c76b0 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -77,7 +77,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor) where StringBuilder desc = new StringBuilder(); if (factor.Value != 1) { - desc.AppendLine($"{factor}·("); + desc.Append($"{factor}·("); } foreach (ILoadCase lc in cases) @@ -88,7 +88,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor) where desc.Remove(desc.Length - 3, 3); if (factor.Value != 1) { - desc.AppendLine(")"); + desc.Append(")"); } return desc.ToString(); @@ -108,14 +108,14 @@ internal static string DescriptionHelper(IList cases, Ratio factor1, Ratio } StringBuilder desc = new StringBuilder(); - desc.AppendLine($"{factor1}·{f2}("); + desc.Append($"{factor1}·{f2}("); foreach (ILoadCase lc in cases) { desc.Append($"{GetNickname(lc)} + "); } desc.Remove(desc.Length - 3, 3); - desc.AppendLine(")"); + desc.Append(")"); return desc.ToString(); } @@ -143,7 +143,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor, Func(IList cases, Ratio factor, Func Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(false); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateEquSetA(loadCases); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: EQU Set A, Eq. 6.10 - Leading Live loads Category B", + combinations[0].Name); + Assert.Equal("1.1·(DL + SDL) + 1.5·Q + 1.5·(0.6·W + 0.5·S + 0.6·T)", combinations[0].Definition); + + Assert.Equal("LC2: EQU Set A, Eq. 6.10 - Leading Wind loads", + combinations[1].Name); + Assert.Equal("1.1·(DL + SDL) + 1.5·W + 1.5·(0.7·Q + 0.5·S + 0.6·T)", combinations[1].Definition); + + Assert.Equal("LC3: EQU Set A, Eq. 6.10 - Leading Wind loads with unfavourable permanent", + combinations[2].Name); + Assert.Equal("0.9·(DL + SDL) + 1.5·W", combinations[2].Definition); + + Assert.Equal("LC4: EQU Set A, Eq. 6.10 - Leading Snow loads", + combinations[3].Name); + Assert.Equal("1.1·(DL + SDL) + 1.5·S + 1.5·(0.7·Q + 0.6·W + 0.6·T)", combinations[3].Definition); + + Assert.Equal("LC5: EQU Set A, Eq. 6.10 - Leading Thermal loads", + combinations[4].Name); + Assert.Equal("1.1·(DL + SDL) + 1.5·T + 1.5·(0.7·Q + 0.6·W + 0.5·S)", combinations[4].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + // Act + IList combinations = Create(); + + // Assert + Assert.Equal(5, combinations.Count); + for (int i = 0; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + Assert.Single(combinations[i].LeadingVariableCases); + if (!combinations[i].LeadingVariableCases.First().IsHorizontal) + { + Assert.Equal(3, combinations[i].AccompanyingVariableCases.Count); + } + } + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + IList lc5Loads = combinations[4].GetFactoredLoads(); + + // Assert + // LC1:1.1·(DL + SDL) + 1.5·Q + 1.5·(0.6·W + 0.5·S + 0.6·T) + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.1, dl); + TestFactoredLoad(lc1Loads[i++], 1.1, sdl); + TestFactoredLoad(lc1Loads[i++], 1.5, ll); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.6, t); + + // LC2: 1.1·(DL + SDL) + 1.5·W + 1.5·(0.7·Q + 0.5·S + 0.6·T) + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.1, dl); + TestFactoredLoad(lc2Loads[i++], 1.1, sdl); + TestFactoredLoad(lc2Loads[i++], 1.5, w); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.6, t); + + // LC3: 0.9·(DL + SDL) + 1.5·W + i = 0; + TestFactoredLoad(lc3Loads[i++], 0.9, dl); + TestFactoredLoad(lc3Loads[i++], 0.9, sdl); + TestFactoredLoad(lc3Loads[i++], 1.5, w); + + // LC4: 1.1·(DL + SDL) + 1.5·S + 1.5·(0.7·Q + 0.6·W + 0.6·T) + i = 0; + TestFactoredLoad(lc4Loads[i++], 1.1, dl); + TestFactoredLoad(lc4Loads[i++], 1.1, sdl); + TestFactoredLoad(lc4Loads[i++], 1.5, s); + TestFactoredLoad(lc4Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc4Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc4Loads[i++], 1.5 * 0.6, t); + + // LC5: 1.1·(DL + SDL) + 1.5·T + 1.5·(0.7·Q + 0.6·W + 0.5·S) + i = 0; + TestFactoredLoad(lc5Loads[i++], 1.1, dl); + TestFactoredLoad(lc5Loads[i++], 1.1, sdl); + TestFactoredLoad(lc5Loads[i++], 1.5, t); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.5, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + From 3cebf1e57b02f23ac04c75c85c6ae63bc12958b3 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 8 Oct 2024 12:29:00 +0200 Subject: [PATCH 48/53] member design tests --- Loads/Cases/Combinations/Utility/Utility.cs | 42 ++-- .../MemberDesign6_10CombinationTests.cs | 164 ++++++++++++++++ .../MemberDesign6_10abCombinationTests.cs | 183 ++++++++++++++++++ 3 files changed, 369 insertions(+), 20 deletions(-) create mode 100644 Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs create mode 100644 Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 50c76b0..69d4394 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -100,22 +100,29 @@ internal static string DescriptionHelper(IList cases, Ratio factor1, Ratio { return string.Empty; } - string f2 = factor2.DecimalFractions == 1 ? string.Empty : $"{factor2}·"; if (cases.Count == 1) { - return $"{factor1}·{f2}{GetNickname(cases.First())}"; + return $"{MultiFactor(factor1, factor2)}·{GetNickname(cases.First())}"; } StringBuilder desc = new StringBuilder(); - desc.Append($"{factor1}·{f2}("); + if (factor1.DecimalFractions != 1 || factor2.DecimalFractions != 1) + { + desc.Append($"{MultiFactor(factor1, factor2)}·("); + } + foreach (ILoadCase lc in cases) { desc.Append($"{GetNickname(lc)} + "); } desc.Remove(desc.Length - 3, 3); - desc.Append(")"); + if (factor1.DecimalFractions != 1 || factor2.DecimalFractions != 1) + { + desc.Append(")"); + } + return desc.ToString(); } @@ -130,14 +137,7 @@ internal static string DescriptionHelper(IList cases, Ratio factor, Func(IList cases, Ratio factor, Func !string.IsNullOrEmpty(x)).ToArray(); + return string.Join(separator, strings); } private static string GetNickname(ILoadCase loadCase) @@ -188,5 +183,12 @@ private static string GetNickname(ILoadCase loadCase) return loadCase.Nickname; } + + private static string MultiFactor(Ratio factor1, Ratio factor2) + { + string f1 = factor1.DecimalFractions == 1 ? string.Empty : $"{factor1}"; + string f2 = factor2.DecimalFractions == 1 ? string.Empty : $"{factor2}"; + return JoinDescriptions(new string[] { f1, f2 }, "·"); + } } } diff --git a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs new file mode 100644 index 0000000..d27115d --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs @@ -0,0 +1,164 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class MemberDesign6_10CombinationTests + { + public static IList Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(false); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateStrGeoSetB(loadCases, NationalAnnex.UnitedKingdom, false); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: STR/GEO Set B, Eq. 6.10 - Leading Live loads Category B", + combinations[0].Name); + Assert.Equal("1.35·(DL + SDL) + 1.5·Q + 1.5·(0.6·W + 0.5·S + 0.6·T)", combinations[0].Definition); + + Assert.Equal("LC2: STR/GEO Set B, Eq. 6.10 - Leading Wind loads", + combinations[1].Name); + Assert.Equal("1.35·(DL + SDL) + 1.5·W + 1.5·(0.7·Q + 0.5·S + 0.6·T)", combinations[1].Definition); + + Assert.Equal("LC3: STR/GEO Set B, Eq. 6.10 - Leading Wind loads with unfavourable permanent", + combinations[2].Name); + Assert.Equal("DL + SDL + 1.5·W", combinations[2].Definition); + + Assert.Equal("LC4: STR/GEO Set B, Eq. 6.10 - Leading Snow loads", + combinations[3].Name); + Assert.Equal("1.35·(DL + SDL) + 1.5·S + 1.5·(0.7·Q + 0.6·W + 0.6·T)", combinations[3].Definition); + + Assert.Equal("LC5: STR/GEO Set B, Eq. 6.10 - Leading Thermal loads", + combinations[4].Name); + Assert.Equal("1.35·(DL + SDL) + 1.5·T + 1.5·(0.7·Q + 0.6·W + 0.5·S)", combinations[4].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + // Act + IList combinations = Create(); + + // Assert + Assert.Equal(5, combinations.Count); + for (int i = 0; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + Assert.Null(combinations[i].MainAccompanyingVariableCases); + if (!combinations[i].LeadingVariableCases.First().IsHorizontal) + { + Assert.Equal(3, combinations[i].OtherAccompanyingVariableCases.Count); + } + } + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + IList lc5Loads = combinations[4].GetFactoredLoads(); + + // Assert + // LC1: 1.35·(DL + SDL) + 1.5·Q + 1.5·(0.6·W + 0.5·S + 0.6·T) + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.35, dl); + TestFactoredLoad(lc1Loads[i++], 1.35, sdl); + TestFactoredLoad(lc1Loads[i++], 1.5, ll); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.6, t); + + // LC2: 1.35·(DL + SDL) + 1.5·W + 1.5·(0.7·Q + 0.5·S + 0.6·T) + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.35, dl); + TestFactoredLoad(lc2Loads[i++], 1.35, sdl); + TestFactoredLoad(lc2Loads[i++], 1.5, w); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.6, t); + + // LC3: DL + SDL + 1.5·W + i = 0; + TestFactoredLoad(lc3Loads[i++], 1.0, dl); + TestFactoredLoad(lc3Loads[i++], 1.0, sdl); + TestFactoredLoad(lc3Loads[i++], 1.5, w); + + // LC4: 1.35·(DL + SDL) + 1.5·S + 1.5·(0.7·Q + 0.6·W + 0.6·T) + i = 0; + TestFactoredLoad(lc4Loads[i++], 1.35, dl); + TestFactoredLoad(lc4Loads[i++], 1.35, sdl); + TestFactoredLoad(lc4Loads[i++], 1.5, s); + TestFactoredLoad(lc4Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc4Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc4Loads[i++], 1.5 * 0.6, t); + + // LC5: 1.35·(DL + SDL) + 1.5·T + 1.5·(0.7·Q + 0.6·W + 0.5·S) + i = 0; + TestFactoredLoad(lc5Loads[i++], 1.35, dl); + TestFactoredLoad(lc5Loads[i++], 1.35, sdl); + TestFactoredLoad(lc5Loads[i++], 1.5, t); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.5, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + diff --git a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs new file mode 100644 index 0000000..9c25e88 --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs @@ -0,0 +1,183 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class MemberDesign6_10abCombinationTests + { + public static IList Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(false); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateStrGeoSetB(loadCases); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: STR/GEO Set B, Eq. 6.10a - Leading Permanent combined with accompanying variable actions", + combinations[0].Name); + Assert.Equal("1.35·(DL + SDL) + 1.5·(0.7·Q + 0.6·W + 0.5·S + 0.6·T)", combinations[0].Definition); + + Assert.Equal("LC2: STR/GEO Set B, Eq. 6.10b - Leading Live loads Category B", + combinations[1].Name); + Assert.Equal("1.35·0.85·(DL + SDL) + 1.5·Q + 1.5·(0.6·W + 0.5·S + 0.6·T)", combinations[1].Definition); + + Assert.Equal("LC3: STR/GEO Set B, Eq. 6.10b - Leading Wind loads", + combinations[2].Name); + Assert.Equal("1.35·0.85·(DL + SDL) + 1.5·W + 1.5·(0.7·Q + 0.5·S + 0.6·T)", combinations[2].Definition); + + Assert.Equal("LC4: STR/GEO Set B, Eq. 6.10b - Leading Wind loads with unfavourable permanent", + combinations[3].Name); + Assert.Equal("0.85·(DL + SDL) + 1.5·W", combinations[3].Definition); + + Assert.Equal("LC5: STR/GEO Set B, Eq. 6.10b - Leading Snow loads", + combinations[4].Name); + Assert.Equal("1.35·0.85·(DL + SDL) + 1.5·S + 1.5·(0.7·Q + 0.6·W + 0.6·T)", combinations[4].Definition); + + Assert.Equal("LC6: STR/GEO Set B, Eq. 6.10b - Leading Thermal loads", + combinations[5].Name); + Assert.Equal("1.35·0.85·(DL + SDL) + 1.5·T + 1.5·(0.7·Q + 0.6·W + 0.5·S)", combinations[5].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + var otherCases = new List() + { + dl, sdl, ll, w, s, t + }; + + // Act + IList combinations = Create(); + + // Assert + Assert.Equal(6, combinations.Count); + Assert.Equal(2, combinations[0].PermanentCases.Count); + Assert.Null(combinations[0].LeadingVariableCases); + Assert.Null(combinations[0].MainAccompanyingVariableCases); + Assert.Equal(4, combinations[0].OtherAccompanyingVariableCases.Count); + + for (int i = 1; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + Assert.Null(combinations[i].MainAccompanyingVariableCases); + if (!combinations[i].LeadingVariableCases.First().IsHorizontal) + { + Assert.Equal(3, combinations[i].OtherAccompanyingVariableCases.Count); + } + } + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + IList lc5Loads = combinations[4].GetFactoredLoads(); + IList lc6Loads = combinations[5].GetFactoredLoads(); + + // Assert + // LC1: 1.35·(DL + SDL) + 1.5·(0.7·Q + 0.6·W + 0.5·S + 0.6·T) + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.35, dl); + TestFactoredLoad(lc1Loads[i++], 1.35, sdl); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc1Loads[i++], 1.5 * 0.6, t); + + // LC2: 1.35·0.85·(DL + SDL) + 1.5·Q + 1.5·(0.6·W + 0.5·S + 0.6·T) + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.35 * 0.85, dl); + TestFactoredLoad(lc2Loads[i++], 1.35 * 0.85, sdl); + TestFactoredLoad(lc2Loads[i++], 1.5, ll); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc2Loads[i++], 1.5 * 0.6, t); + + // LC3: 1.35·0.85·(DL + SDL) + 1.5·W + 1.5·(0.7·Q + 0.5·S + 0.6·T) + i = 0; + TestFactoredLoad(lc3Loads[i++], 1.35 * 0.85, dl); + TestFactoredLoad(lc3Loads[i++], 1.35 * 0.85, sdl); + TestFactoredLoad(lc3Loads[i++], 1.5, w); + TestFactoredLoad(lc3Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc3Loads[i++], 1.5 * 0.5, s); + TestFactoredLoad(lc3Loads[i++], 1.5 * 0.6, t); + + // LC4: 0.85·(DL + SDL) + 1.5·W + i = 0; + TestFactoredLoad(lc4Loads[i++], 0.85, dl); + TestFactoredLoad(lc4Loads[i++], 0.85, sdl); + TestFactoredLoad(lc4Loads[i++], 1.5, w); + + // LC5: 1.35·0.85·(DL + SDL) + 1.5·S + 1.5·(0.7·Q + 0.6·W + 0.6·T) + i = 0; + TestFactoredLoad(lc5Loads[i++], 1.35 * 0.85, dl); + TestFactoredLoad(lc5Loads[i++], 1.35 * 0.85, sdl); + TestFactoredLoad(lc5Loads[i++], 1.5, s); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc5Loads[i++], 1.5 * 0.6, t); + + // LC6: 1.35·0.85·(DL + SDL) + 1.5·T + 1.5·(0.7·Q + 0.6·W + 0.5·S) + i = 0; + TestFactoredLoad(lc6Loads[i++], 1.35 * 0.85, dl); + TestFactoredLoad(lc6Loads[i++], 1.35 * 0.85, sdl); + TestFactoredLoad(lc6Loads[i++], 1.5, t); + TestFactoredLoad(lc6Loads[i++], 1.5 * 0.7, ll); + TestFactoredLoad(lc6Loads[i++], 1.5 * 0.6, w); + TestFactoredLoad(lc6Loads[i++], 1.5 * 0.5, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + From 1bccd6739509be7a4ecd97b49c88b1ecf222aab3 Mon Sep 17 00:00:00 2001 From: kpne Date: Tue, 8 Oct 2024 15:33:01 +0200 Subject: [PATCH 49/53] SLS tests --- .../Combinations/AccidentialCombination.cs | 3 +- .../Combinations/CharacteristicCombination.cs | 4 +- .../Factory/ENSLSCombinationFactory.cs | 23 +-- .../Cases/Combinations/FrequentCombination.cs | 2 +- .../Combinations/QuasiPermanentCombination.cs | 2 +- .../Cases/Combinations/SeismicCombination.cs | 3 +- Loads/Cases/Combinations/Utility/Utility.cs | 26 ++- .../AccidentialCombinationTests.cs | 8 - .../CharacteristicCombinationTests.cs | 151 ++++++++++++++++++ .../EquilibriumCombinationTests.cs | 11 -- .../Combinations/FrequentCombinationTests.cs | 145 +++++++++++++++++ ...eotechnicalMemberDesignCombinationTests.cs | 151 ++++++++++++++++++ .../MemberDesign6_10CombinationTests.cs | 11 -- .../MemberDesign6_10abCombinationTests.cs | 11 -- .../QuasiPermanentCombinationTests.cs | 90 +++++++++++ .../Combinations/SeismicCombinationTests.cs | 12 -- 16 files changed, 572 insertions(+), 81 deletions(-) create mode 100644 Loads/LoadTests/Cases/Combinations/CharacteristicCombinationTests.cs create mode 100644 Loads/LoadTests/Cases/Combinations/FrequentCombinationTests.cs create mode 100644 Loads/LoadTests/Cases/Combinations/GeotechnicalMemberDesignCombinationTests.cs create mode 100644 Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs diff --git a/Loads/Cases/Combinations/AccidentialCombination.cs b/Loads/Cases/Combinations/AccidentialCombination.cs index c720799..b59791d 100644 --- a/Loads/Cases/Combinations/AccidentialCombination.cs +++ b/Loads/Cases/Combinations/AccidentialCombination.cs @@ -24,8 +24,7 @@ public IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange( - Utility.FactorLoads(new Ratio(1.0, RatioUnit.DecimalFraction), PermanentCases)); + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); } if (LeadingVariableCases != null) diff --git a/Loads/Cases/Combinations/CharacteristicCombination.cs b/Loads/Cases/Combinations/CharacteristicCombination.cs index b326474..4befdd7 100644 --- a/Loads/Cases/Combinations/CharacteristicCombination.cs +++ b/Loads/Cases/Combinations/CharacteristicCombination.cs @@ -20,12 +20,12 @@ public IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange((IList)PermanentCases); + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); } if (LeadingVariableCases != null) { - factoredLoads.AddRange((IEnumerable)LeadingVariableCases); + factoredLoads.AddRange(Utility.GetLoads(LeadingVariableCases)); } if (AccompanyingVariableCases != null) diff --git a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs index 89a32a0..8cae868 100644 --- a/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENSLSCombinationFactory.cs @@ -67,28 +67,15 @@ public static IList CreateFrequent(IList cases, public static IList CreateQuasiPermanent(IList cases, string prefix = "LC", int firstCaseId = 1) { (IList permanents, IList variables) = SortLoadCases(cases); - var combinations = new List(); - for (int i = 0; i < variables.Count; i++) + var combinations = new List { - combinations.Add(new QuasiPermanentCombination() + new QuasiPermanentCombination() { - Name = $"{prefix}{firstCaseId++}: SLS Quasi-permanent - Leading {variables[i].Name}", + Name = $"{prefix}{firstCaseId++}: SLS Quasi-permanent", PermanentCases = permanents, - LeadingVariableCases = new List() { variables[i] }, - AccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), - }); - - if (variables[i].IsHorizontal) - { - combinations.Add(new QuasiPermanentCombination() - { - Name = $"{prefix}{firstCaseId++}: SLS Quasi-permanent - Leading {variables[i].Name} with unfavourable permanent", - PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), - LeadingVariableCases = new List() { variables[i] }, - AccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), - }); + AccompanyingVariableCases = variables.Where(lc => lc.QuasiPermanent.Value != 0).ToList(), } - } + }; return combinations; } diff --git a/Loads/Cases/Combinations/FrequentCombination.cs b/Loads/Cases/Combinations/FrequentCombination.cs index d7dc405..8559834 100644 --- a/Loads/Cases/Combinations/FrequentCombination.cs +++ b/Loads/Cases/Combinations/FrequentCombination.cs @@ -20,7 +20,7 @@ public IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange((IList)PermanentCases); + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); } if (LeadingVariableCases != null) diff --git a/Loads/Cases/Combinations/QuasiPermanentCombination.cs b/Loads/Cases/Combinations/QuasiPermanentCombination.cs index ed0e2c0..30d7ae0 100644 --- a/Loads/Cases/Combinations/QuasiPermanentCombination.cs +++ b/Loads/Cases/Combinations/QuasiPermanentCombination.cs @@ -20,7 +20,7 @@ public IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange((IList)PermanentCases); + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); } if (LeadingVariableCases != null) diff --git a/Loads/Cases/Combinations/SeismicCombination.cs b/Loads/Cases/Combinations/SeismicCombination.cs index 714cdb9..73bf5f5 100644 --- a/Loads/Cases/Combinations/SeismicCombination.cs +++ b/Loads/Cases/Combinations/SeismicCombination.cs @@ -21,8 +21,7 @@ public virtual IList GetFactoredLoads() var factoredLoads = new List(); if (PermanentCases != null) { - factoredLoads.AddRange( - Utility.FactorLoads(new Ratio(1, RatioUnit.DecimalFraction), PermanentCases)); + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); } if (LeadingVariableCases != null) diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 69d4394..0027307 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -24,6 +24,21 @@ public static IList FactorLoads(Ratio partialFactor, IList loadCase return factoredLoads; } + public static IList GetLoads(IList loadCases) + where T : ILoadCase + { + var factoredLoads = new List(); + foreach (T loadCase in loadCases) + { + foreach (ILoad load in loadCase.Loads) + { + factoredLoads.Add(load); + } + } + + return factoredLoads; + } + public static IList FactorAccompanyingVariableLoads(Ratio partialFactor, IList loadCases, Func selector) where T : IVariableCase { @@ -33,7 +48,10 @@ public static IList FactorAccompanyingVariableLoads(Ratio partialFacto foreach (ILoad load in loadCase.Loads) { Ratio factor = partialFactor * selector(loadCase).DecimalFractions; - factoredLoads.Add(load.Factor(factor)); + if (factor.Value != 0) + { + factoredLoads.Add(load.Factor(factor)); + } } } @@ -48,7 +66,11 @@ public static IList SelectAccompanyingVariableLoads(IList loadCases { foreach (ILoad load in loadCase.Loads) { - factoredLoads.Add(load.Factor(selector(loadCase))); + Ratio phi = selector(loadCase); + if (phi.Value != 0) + { + factoredLoads.Add(load.Factor(phi)); + } } } diff --git a/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs index a48b6fd..7649128 100644 --- a/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs @@ -179,9 +179,7 @@ public void FactoredLoadsWithFrequentTest() TestFactoredLoad(lc1Loads[i++], 1.0, sdl); TestFactoredLoad(lc1Loads[i++], 1.5, impact); TestFactoredLoad(lc1Loads[i++], 0.5, ll); - TestFactoredLoad(lc1Loads[i++], 0.0, w); TestFactoredLoad(lc1Loads[i++], 0.2, s); - TestFactoredLoad(lc1Loads[i++], 0.0, t); // LC2: DL + SDL + 1.5·A + 0.2·W + 0.3·Q + 0.2·S i = 0; @@ -191,7 +189,6 @@ public void FactoredLoadsWithFrequentTest() TestFactoredLoad(lc2Loads[i++], 0.2, w); TestFactoredLoad(lc2Loads[i++], 0.3, ll); TestFactoredLoad(lc2Loads[i++], 0.2, s); - TestFactoredLoad(lc2Loads[i++], 0.0, t); // LC3: DL + SDL + 1.5·A + 0.5·S + 0.3·Q i = 0; @@ -200,8 +197,6 @@ public void FactoredLoadsWithFrequentTest() TestFactoredLoad(lc3Loads[i++], 1.5, impact); TestFactoredLoad(lc3Loads[i++], 0.5, s); TestFactoredLoad(lc3Loads[i++], 0.3, ll); - TestFactoredLoad(lc3Loads[i++], 0.0, w); - TestFactoredLoad(lc3Loads[i++], 0.0, t); // LC4: DL + SDL + 1.5·A + 0.5·T + 0.3·Q + 0.2·S i = 0; @@ -210,7 +205,6 @@ public void FactoredLoadsWithFrequentTest() TestFactoredLoad(lc4Loads[i++], 1.5, impact); TestFactoredLoad(lc4Loads[i++], 0.5, t); TestFactoredLoad(lc4Loads[i++], 0.3, ll); - TestFactoredLoad(lc4Loads[i++], 0.0, w); TestFactoredLoad(lc4Loads[i++], 0.2, s); } @@ -238,9 +232,7 @@ public void FactoredLoadsWithQuasiTest() TestFactoredLoad(lc1Loads[i++], 1.0, sdl); TestFactoredLoad(lc1Loads[i++], 1.5, impact); TestFactoredLoad(lc1Loads[i++], 0.3, ll); - TestFactoredLoad(lc1Loads[i++], 0.0, w); TestFactoredLoad(lc1Loads[i++], 0.2, s); - TestFactoredLoad(lc1Loads[i++], 0.0, t); } private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) diff --git a/Loads/LoadTests/Cases/Combinations/CharacteristicCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/CharacteristicCombinationTests.cs new file mode 100644 index 0000000..8e93c09 --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/CharacteristicCombinationTests.cs @@ -0,0 +1,151 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class CharacteristicCombinationTests + { + public static IList Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(false); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateCharacteristic(loadCases); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: SLS Characteristic - Leading Live loads Category B", + combinations[0].Name); + Assert.Equal("DL + SDL + Q + 0.6·W + 0.5·S + 0.6·T", combinations[0].Definition); + + Assert.Equal("LC2: SLS Characteristic - Leading Wind loads", + combinations[1].Name); + Assert.Equal("DL + SDL + W + 0.7·Q + 0.5·S + 0.6·T", combinations[1].Definition); + + Assert.Equal("LC3: SLS Characteristic - Leading Wind loads with unfavourable permanent", + combinations[2].Name); + Assert.Equal("DL + SDL + W", combinations[2].Definition); + + Assert.Equal("LC4: SLS Characteristic - Leading Snow loads", + combinations[3].Name); + Assert.Equal("DL + SDL + S + 0.7·Q + 0.6·W + 0.6·T", combinations[3].Definition); + + Assert.Equal("LC5: SLS Characteristic - Leading Thermal loads", + combinations[4].Name); + Assert.Equal("DL + SDL + T + 0.7·Q + 0.6·W + 0.5·S", combinations[4].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal(5, combinations.Count); + for (int i = 0; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + if (!combinations[i].LeadingVariableCases.First().IsHorizontal) + { + Assert.Equal(3, combinations[i].AccompanyingVariableCases.Count); + } + } + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + IList lc5Loads = combinations[4].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + Q + 0.6·W + 0.5·S + 0.6·T + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.0, dl); + TestFactoredLoad(lc1Loads[i++], 1.0, sdl); + TestFactoredLoad(lc1Loads[i++], 1.0, ll); + TestFactoredLoad(lc1Loads[i++], 0.6, w); + TestFactoredLoad(lc1Loads[i++], 0.5, s); + TestFactoredLoad(lc1Loads[i++], 0.6, t); + + // LC2: DL + SDL + W + 0.7·Q + 0.5·S + 0.6·T + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.0, dl); + TestFactoredLoad(lc2Loads[i++], 1.0, sdl); + TestFactoredLoad(lc2Loads[i++], 1.0, w); + TestFactoredLoad(lc2Loads[i++], 0.7, ll); + TestFactoredLoad(lc2Loads[i++], 0.5, s); + TestFactoredLoad(lc2Loads[i++], 0.6, t); + + // LC3: DL + SDL + W + i = 0; + TestFactoredLoad(lc3Loads[i++], 1.0, dl); + TestFactoredLoad(lc3Loads[i++], 1.0, sdl); + TestFactoredLoad(lc3Loads[i++], 1.0, w); + + // LC4: DL + SDL + S + 0.7·Q + 0.6·W + 0.6·T + i = 0; + TestFactoredLoad(lc4Loads[i++], 1.0, dl); + TestFactoredLoad(lc4Loads[i++], 1.0, sdl); + TestFactoredLoad(lc4Loads[i++], 1.0, s); + TestFactoredLoad(lc4Loads[i++], 0.7, ll); + TestFactoredLoad(lc4Loads[i++], 0.6, w); + TestFactoredLoad(lc4Loads[i++], 0.6, t); + + // LC5: DL + SDL + T + 0.7·Q + 0.6·W + 0.5·S + i = 0; + TestFactoredLoad(lc5Loads[i++], 1.0, dl); + TestFactoredLoad(lc5Loads[i++], 1.0, sdl); + TestFactoredLoad(lc5Loads[i++], 1.0, t); + TestFactoredLoad(lc5Loads[i++], 0.7, ll); + TestFactoredLoad(lc5Loads[i++], 0.6, w); + TestFactoredLoad(lc5Loads[i++], 0.5, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + diff --git a/Loads/LoadTests/Cases/Combinations/EquilibriumCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/EquilibriumCombinationTests.cs index 5376321..40fcfa9 100644 --- a/Loads/LoadTests/Cases/Combinations/EquilibriumCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/EquilibriumCombinationTests.cs @@ -60,17 +60,6 @@ public void NameAndDefinitionTest() public void CasesTest() { // Assemble - IPermanentCase dl = PermanentCaseTests.CreateDLCase(); - IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); - IVariableCase ll = ImposedCaseTests.Create(); - IVariableCase w = WindCaseTests.Create(); - IVariableCase s = SnowCaseTests.Create(true); - IVariableCase t = ThermalCaseTests.Create(); - var otherCases = new List() - { - dl, sdl, ll, w, s, t - }; - // Act IList combinations = Create(); diff --git a/Loads/LoadTests/Cases/Combinations/FrequentCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/FrequentCombinationTests.cs new file mode 100644 index 0000000..af90ac3 --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/FrequentCombinationTests.cs @@ -0,0 +1,145 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class FrequentCombinationTests + { + public static IList Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateFrequent(loadCases); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: SLS Frequent - Leading Live loads Category B", + combinations[0].Name); + Assert.Equal("DL + SDL + 0.5·Q + 0.2·S", combinations[0].Definition); + + Assert.Equal("LC2: SLS Frequent - Leading Wind loads", + combinations[1].Name); + Assert.Equal("DL + SDL + 0.2·W + 0.3·Q + 0.2·S", combinations[1].Definition); + + Assert.Equal("LC3: SLS Frequent - Leading Wind loads with unfavourable permanent", + combinations[2].Name); + Assert.Equal("DL + SDL + 0.2·W", combinations[2].Definition); + + Assert.Equal("LC4: SLS Frequent - Leading Snow loads", + combinations[3].Name); + Assert.Equal("DL + SDL + 0.5·S + 0.3·Q", combinations[3].Definition); + + Assert.Equal("LC5: SLS Frequent - Leading Thermal loads", + combinations[4].Name); + Assert.Equal("DL + SDL + 0.5·T + 0.3·Q + 0.2·S", combinations[4].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal(5, combinations.Count); + for (int i = 0; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + if (!combinations[i].LeadingVariableCases.First().IsHorizontal) + { + Assert.Equal(3, combinations[i].AccompanyingVariableCases.Count); + } + } + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + IList lc5Loads = combinations[4].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + 0.5·Q + 0.2·S + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.0, dl); + TestFactoredLoad(lc1Loads[i++], 1.0, sdl); + TestFactoredLoad(lc1Loads[i++], 0.5, ll); + TestFactoredLoad(lc1Loads[i++], 0.2, s); + + // LC2: DL + SDL + 0.2·W + 0.3·Q + 0.2·S + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.0, dl); + TestFactoredLoad(lc2Loads[i++], 1.0, sdl); + TestFactoredLoad(lc2Loads[i++], 0.2, w); + TestFactoredLoad(lc2Loads[i++], 0.3, ll); + TestFactoredLoad(lc2Loads[i++], 0.2, s); + + // LC3: DL + SDL + 0.2·W + i = 0; + TestFactoredLoad(lc3Loads[i++], 1.0, dl); + TestFactoredLoad(lc3Loads[i++], 1.0, sdl); + TestFactoredLoad(lc3Loads[i++], 0.2, w); + + // LC4: DL + SDL + 0.5·S + 0.3·Q + i = 0; + TestFactoredLoad(lc4Loads[i++], 1.0, dl); + TestFactoredLoad(lc4Loads[i++], 1.0, sdl); + TestFactoredLoad(lc4Loads[i++], 0.5, s); + TestFactoredLoad(lc4Loads[i++], 0.3, ll); + + // LC5: DL + SDL + 0.5·T + 0.3·Q + 0.2·S + i = 0; + TestFactoredLoad(lc5Loads[i++], 1.0, dl); + TestFactoredLoad(lc5Loads[i++], 1.0, sdl); + TestFactoredLoad(lc5Loads[i++], 0.5, t); + TestFactoredLoad(lc5Loads[i++], 0.3, ll); + TestFactoredLoad(lc5Loads[i++], 0.2, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + diff --git a/Loads/LoadTests/Cases/Combinations/GeotechnicalMemberDesignCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/GeotechnicalMemberDesignCombinationTests.cs new file mode 100644 index 0000000..09af307 --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/GeotechnicalMemberDesignCombinationTests.cs @@ -0,0 +1,151 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class GeotechnicalMemberDesignCombinationTests + { + public static IList Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(false); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateStrGeoSetC(loadCases); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: STR/GEO Set C, Eq. 6.10 - Leading Live loads Category B", + combinations[0].Name); + Assert.Equal("DL + SDL + 1.3·Q + 1.3·(0.6·W + 0.5·S + 0.6·T)", combinations[0].Definition); + + Assert.Equal("LC2: STR/GEO Set C, Eq. 6.10 - Leading Wind loads", + combinations[1].Name); + Assert.Equal("DL + SDL + 1.3·W + 1.3·(0.7·Q + 0.5·S + 0.6·T)", combinations[1].Definition); + + Assert.Equal("LC3: STR/GEO Set C, Eq. 6.10 - Leading Wind loads with unfavourable permanent", + combinations[2].Name); + Assert.Equal("DL + SDL + 1.3·W", combinations[2].Definition); + + Assert.Equal("LC4: STR/GEO Set C, Eq. 6.10 - Leading Snow loads", + combinations[3].Name); + Assert.Equal("DL + SDL + 1.3·S + 1.3·(0.7·Q + 0.6·W + 0.6·T)", combinations[3].Definition); + + Assert.Equal("LC5: STR/GEO Set C, Eq. 6.10 - Leading Thermal loads", + combinations[4].Name); + Assert.Equal("DL + SDL + 1.3·T + 1.3·(0.7·Q + 0.6·W + 0.5·S)", combinations[4].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal(5, combinations.Count); + for (int i = 0; i < combinations.Count; i++) + { + Assert.Equal(2, combinations[i].PermanentCases.Count); + Assert.Single(combinations[i].LeadingVariableCases); + if (!combinations[i].LeadingVariableCases.First().IsHorizontal) + { + Assert.Equal(3, combinations[i].AccompanyingVariableCases.Count); + } + } + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList lc1Loads = combinations[0].GetFactoredLoads(); + IList lc2Loads = combinations[1].GetFactoredLoads(); + IList lc3Loads = combinations[2].GetFactoredLoads(); + IList lc4Loads = combinations[3].GetFactoredLoads(); + IList lc5Loads = combinations[4].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + 1.3·Q + 1.3·(0.6·W + 0.5·S + 0.6·T) + int i = 0; + TestFactoredLoad(lc1Loads[i++], 1.0, dl); + TestFactoredLoad(lc1Loads[i++], 1.0, sdl); + TestFactoredLoad(lc1Loads[i++], 1.3, ll); + TestFactoredLoad(lc1Loads[i++], 1.3 * 0.6, w); + TestFactoredLoad(lc1Loads[i++], 1.3 * 0.5, s); + TestFactoredLoad(lc1Loads[i++], 1.3 * 0.6, t); + + // LC2: DL + SDL + 1.3·W + 1.3·(0.7·Q + 0.5·S + 0.6·T) + i = 0; + TestFactoredLoad(lc2Loads[i++], 1.0, dl); + TestFactoredLoad(lc2Loads[i++], 1.0, sdl); + TestFactoredLoad(lc2Loads[i++], 1.3, w); + TestFactoredLoad(lc2Loads[i++], 1.3 * 0.7, ll); + TestFactoredLoad(lc2Loads[i++], 1.3 * 0.5, s); + TestFactoredLoad(lc2Loads[i++], 1.3 * 0.6, t); + + // LC3: DL + SDL + 1.3·W + i = 0; + TestFactoredLoad(lc3Loads[i++], 1.0, dl); + TestFactoredLoad(lc3Loads[i++], 1.0, sdl); + TestFactoredLoad(lc3Loads[i++], 1.3, w); + + // LC4: DL + SDL + 1.3·S + 1.3·(0.7·Q + 0.6·W + 0.6·T) + i = 0; + TestFactoredLoad(lc4Loads[i++], 1.0, dl); + TestFactoredLoad(lc4Loads[i++], 1.0, sdl); + TestFactoredLoad(lc4Loads[i++], 1.3, s); + TestFactoredLoad(lc4Loads[i++], 1.3 * 0.7, ll); + TestFactoredLoad(lc4Loads[i++], 1.3 * 0.6, w); + TestFactoredLoad(lc4Loads[i++], 1.3 * 0.6, t); + + // LC5: DL + SDL + 1.3·T + 1.3·(0.7·Q + 0.6·W + 0.5·S) + i = 0; + TestFactoredLoad(lc5Loads[i++], 1.0, dl); + TestFactoredLoad(lc5Loads[i++], 1.0, sdl); + TestFactoredLoad(lc5Loads[i++], 1.3, t); + TestFactoredLoad(lc5Loads[i++], 1.3 * 0.7, ll); + TestFactoredLoad(lc5Loads[i++], 1.3 * 0.6, w); + TestFactoredLoad(lc5Loads[i++], 1.3 * 0.5, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + diff --git a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs index d27115d..157a241 100644 --- a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs @@ -61,17 +61,6 @@ public void NameAndDefinitionTest() public void CasesTest() { // Assemble - IPermanentCase dl = PermanentCaseTests.CreateDLCase(); - IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); - IVariableCase ll = ImposedCaseTests.Create(); - IVariableCase w = WindCaseTests.Create(); - IVariableCase s = SnowCaseTests.Create(true); - IVariableCase t = ThermalCaseTests.Create(); - var otherCases = new List() - { - dl, sdl, ll, w, s, t - }; - // Act IList combinations = Create(); diff --git a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs index 9c25e88..9edf449 100644 --- a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs @@ -65,17 +65,6 @@ public void NameAndDefinitionTest() public void CasesTest() { // Assemble - IPermanentCase dl = PermanentCaseTests.CreateDLCase(); - IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); - IVariableCase ll = ImposedCaseTests.Create(); - IVariableCase w = WindCaseTests.Create(); - IVariableCase s = SnowCaseTests.Create(true); - IVariableCase t = ThermalCaseTests.Create(); - var otherCases = new List() - { - dl, sdl, ll, w, s, t - }; - // Act IList combinations = Create(); diff --git a/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs new file mode 100644 index 0000000..41cef99 --- /dev/null +++ b/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs @@ -0,0 +1,90 @@ +using LoadCaseTests; +using MagmaWorks.Taxonomy.Loads; +using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations; +using OasysUnits; +using OasysUnits.Units; + +namespace CombinationTests +{ + public class QuasiPermanentCombinationTests + { + public static IList Create() + { + IPermanentCase dl = PermanentCaseTests.CreateDLCase(); + IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); + IVariableCase ll = ImposedCaseTests.Create(); + IVariableCase w = WindCaseTests.Create(); + IVariableCase s = SnowCaseTests.Create(true); + IVariableCase t = ThermalCaseTests.Create(); + + var loadCases = new List() + { + dl, sdl, ll, w, s, t + }; + + return ENCombinationFactory.CreateQuasiPermanent(loadCases); + } + + [Fact] + public void NameAndDefinitionTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Equal("LC1: SLS Quasi-permanent", + combinations[0].Name); + Assert.Equal("DL + SDL + 0.3·Q + 0.2·S", combinations[0].Definition); + } + + + [Fact] + public void CasesTest() + { + // Assemble + // Act + IList combinations = Create(); + + // Assert + Assert.Single(combinations); + Assert.Equal(2, combinations[0].PermanentCases.Count); + Assert.Null(combinations[0].LeadingVariableCases); + Assert.Equal(2, combinations[0].AccompanyingVariableCases.Count); + } + + [Fact] + public void FactoredLoadsTest() + { + // Assemble + ILoad dl = new Gravity(); + ILoad sdl = new AreaForce(new Pressure(2.5, PressureUnit.KilonewtonPerSquareMeter)); + ILoad ll = new AreaForce(new Pressure(5.0, PressureUnit.KilonewtonPerSquareMeter)); + ILoad w = new PointForce2d(new Force(90, ForceUnit.Kilonewton)); + ILoad s = new LineForce(new ForcePerLength(-15, ForcePerLengthUnit.KilonewtonPerMeter)); + ILoad t = new PointDisplacement(Length.Zero, Length.Zero, new Length(0.01, LengthUnit.Centimeter)); + + IList combinations = Create(); + + // Act + IList loads = combinations[0].GetFactoredLoads(); + + // Assert + // LC1: DL + SDL + 0.3·Q + 0.2·S + int i = 0; + TestFactoredLoad(loads[i++], 1.0, dl); + TestFactoredLoad(loads[i++], 1.0, sdl); + TestFactoredLoad(loads[i++], 0.3, ll); + TestFactoredLoad(loads[i++], 0.2, s); + } + + private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) + { + Assert.Equivalent( + expectedUnfactored.Factor(new Ratio(factor, RatioUnit.DecimalFraction)), + actual); + } + } +} + diff --git a/Loads/LoadTests/Cases/Combinations/SeismicCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/SeismicCombinationTests.cs index 382be2a..6cff635 100644 --- a/Loads/LoadTests/Cases/Combinations/SeismicCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/SeismicCombinationTests.cs @@ -55,12 +55,6 @@ public void NameAndDefinitionTest() public void CasesTest() { // Assemble - IPermanentCase dl = PermanentCaseTests.CreateDLCase(); - IPermanentCase sdl = PermanentCaseTests.CreateSDLCase(); - IVariableCase ll = ImposedCaseTests.Create(); - IVariableCase w = WindCaseTests.Create(); - IVariableCase s = SnowCaseTests.Create(true); - IVariableCase t = ThermalCaseTests.Create(); IVariableCase seismic = new VariableCase() { Name = "Seismic Equivalent Horizontal Load in X-direction", @@ -70,10 +64,6 @@ public void CasesTest() new ColumnLoad(new Force(50, ForceUnit.Kilonewton)) } }; - var otherCases = new List() - { - dl, sdl, ll, w, s, t - }; // Act IList combinations = Create(); @@ -111,9 +101,7 @@ public void FactoredLoadsTest() TestFactoredLoad(lc1Loads[i++], 1.0, sdl); TestFactoredLoad(lc1Loads[i++], 1.5, impact); TestFactoredLoad(lc1Loads[i++], 0.3, ll); - TestFactoredLoad(lc1Loads[i++], 0.0, w); TestFactoredLoad(lc1Loads[i++], 0.2, s); - TestFactoredLoad(lc1Loads[i++], 0.0, t); } private void TestFactoredLoad(ILoad actual, double factor, ILoad expectedUnfactored) From 8ed60080747abb65ad57afb5b0ddce2c42cfcc99 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 9 Oct 2024 18:47:15 +0200 Subject: [PATCH 50/53] https://github.com/MagmaWorks/Taxonomy/pull/32#discussion_r1793235185 --- .../Combinations/AccidentialCombination.cs | 54 ++++++----------- .../Combinations/CharacteristicCombination.cs | 31 +++------- .../Combinations/EquilibriumCombination.cs | 41 +++++-------- .../Factory/ENULSCombinationSetBFactory.cs | 7 ++- .../Cases/Combinations/FrequentCombination.cs | 36 ++++-------- .../GeotechnicalMemberDesignCombination.cs | 41 +++++-------- .../Combinations/MemberDesignCombination.cs | 58 +++++++------------ .../Combinations/QuasiPermanentCombination.cs | 36 ++++-------- .../Cases/Combinations/SeismicCombination.cs | 31 +++------- Loads/Cases/Combinations/Utility/Utility.cs | 20 +++++++ .../AccidentialCombinationTests.cs | 2 +- .../MemberDesign6_10CombinationTests.cs | 2 +- .../MemberDesign6_10abCombinationTests.cs | 6 +- .../QuasiPermanentCombinationTests.cs | 2 +- 14 files changed, 139 insertions(+), 228 deletions(-) diff --git a/Loads/Cases/Combinations/AccidentialCombination.cs b/Loads/Cases/Combinations/AccidentialCombination.cs index b59791d..434d3c0 100644 --- a/Loads/Cases/Combinations/AccidentialCombination.cs +++ b/Loads/Cases/Combinations/AccidentialCombination.cs @@ -8,54 +8,36 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public class AccidentialCombination : IAccidentialCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); public bool UseFrequentCombinationFactorForMainAccompanying { get; set; } = true; public Ratio LeadingAccidentialPartialFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList MainAccompanyingVariableCases { get; set; } - public IList OtherAccompanyingVariableCases { get; set; } + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList MainAccompanyingVariableCases { get; set; } = new List(); + public IList OtherAccompanyingVariableCases { get; set; } = new List(); public AccidentialCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(LeadingAccidentialPartialFactor, LeadingVariableCases)); - } - - if (MainAccompanyingVariableCases != null) + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); + factoredLoads.AddRange( + Utility.FactorLoads(LeadingAccidentialPartialFactor, LeadingVariableCases)); + if (UseFrequentCombinationFactorForMainAccompanying) { - if (UseFrequentCombinationFactorForMainAccompanying) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - MainAccompanyingVariableCases, ld => ld.Frequent)); - } - else - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - MainAccompanyingVariableCases, ld => ld.QuasiPermanent)); - } + factoredLoads.AddRange(Utility.SelectAccompanyingVariableLoads( + MainAccompanyingVariableCases, ld => ld.Frequent)); } - - if (OtherAccompanyingVariableCases != null) + else { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - OtherAccompanyingVariableCases, ld => ld.QuasiPermanent)); + factoredLoads.AddRange(Utility.SelectAccompanyingVariableLoads( + MainAccompanyingVariableCases, ld => ld.QuasiPermanent)); } + factoredLoads.AddRange(Utility.SelectAccompanyingVariableLoads( + OtherAccompanyingVariableCases, ld => ld.QuasiPermanent)); return factoredLoads; } @@ -70,9 +52,9 @@ private string GetDefinition() } string main = Utility.DescriptionHelper( - MainAccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), selector); + MainAccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), selector); string other = Utility.DescriptionHelper( - OtherAccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + OtherAccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); return Utility.JoinDescriptions(new string[] { perm, lead, main, other }); } } diff --git a/Loads/Cases/Combinations/CharacteristicCombination.cs b/Loads/Cases/Combinations/CharacteristicCombination.cs index 4befdd7..e8bc1cf 100644 --- a/Loads/Cases/Combinations/CharacteristicCombination.cs +++ b/Loads/Cases/Combinations/CharacteristicCombination.cs @@ -7,34 +7,21 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public class CharacteristicCombination : ICharacteristicCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList AccompanyingVariableCases { get; set; } = new List(); public CharacteristicCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange(Utility.GetLoads(LeadingVariableCases)); - } - - if (AccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - AccompanyingVariableCases, ld => ld.Characteristic)); - } - + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); + factoredLoads.AddRange(Utility.GetLoads(LeadingVariableCases)); + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads(AccompanyingVariableCases, ld => ld.Characteristic)); return factoredLoads; } @@ -43,7 +30,7 @@ private string GetDefinition() string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); string lead = Utility.DescriptionHelper(LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction)); string other = Utility.DescriptionHelper( - AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Characteristic); + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Characteristic); return Utility.JoinDescriptions(new string[] { perm, lead, other }); } } diff --git a/Loads/Cases/Combinations/EquilibriumCombination.cs b/Loads/Cases/Combinations/EquilibriumCombination.cs index 8416f4f..1811af3 100644 --- a/Loads/Cases/Combinations/EquilibriumCombination.cs +++ b/Loads/Cases/Combinations/EquilibriumCombination.cs @@ -1,44 +1,31 @@ using System.Collections.Generic; using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Combinations { public class EquilibriumCombination : IEquilibriumCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); - public Ratio PermanentPartialFactor { get; set; } - public Ratio LeadingVariablePartialFactor { get; set; } - public Ratio AccompanyingPartialFactor { get; set; } - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public Ratio PermanentPartialFactor { get; set; } = new Ratio(1.1, RatioUnit.DecimalFraction); + public Ratio LeadingVariablePartialFactor { get; set; } = new Ratio(1.5, RatioUnit.DecimalFraction); + public Ratio AccompanyingPartialFactor { get; set; } = new Ratio(1.5, RatioUnit.DecimalFraction); + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList AccompanyingVariableCases { get; set; } = new List(); public EquilibriumCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(PermanentPartialFactor, PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); - } - - if (AccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorAccompanyingVariableLoads( - AccompanyingPartialFactor, AccompanyingVariableCases, ld => ld.Characteristic)); - } - + factoredLoads.AddRange(Utility.FactorLoads(PermanentPartialFactor, PermanentCases)); + factoredLoads.AddRange( + Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); + factoredLoads.AddRange(Utility.FactorAccompanyingVariableLoads( + AccompanyingPartialFactor, AccompanyingVariableCases, ld => ld.Characteristic)); return factoredLoads; } @@ -47,7 +34,7 @@ private string GetDefinition() string perm = Utility.DescriptionHelper(PermanentCases, PermanentPartialFactor); string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingVariablePartialFactor); string other = Utility.DescriptionHelper( - AccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); + AccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); return Utility.JoinDescriptions(new string[] { perm, lead, other }); } } diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs index bcc1589..e989ff1 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs @@ -2,6 +2,8 @@ using System.Linq; using MagmaWorks.Taxonomy.Loads.Cases; using MagmaWorks.Taxonomy.Standards.Eurocode; +using OasysUnits; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Combinations { @@ -11,7 +13,6 @@ public static partial class ENCombinationFactory { { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, - }; public static IList CreateStrGeoSetB(IList cases, string prefix = "LC", int firstCaseId = 1) @@ -47,6 +48,7 @@ private static IList CreateSTR6_10(IList ca Name = $"{prefix}{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name}", PermanentCases = permanents, PermanentPartialFactor = factors.Gamma_Gsup, + PermanentReductionFactor = new Ratio(1.0, RatioUnit.DecimalFraction), LeadingVariableCases = new List() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), @@ -60,6 +62,7 @@ private static IList CreateSTR6_10(IList ca Name = $"{prefix}{firstCaseId++}: STR/GEO Set B, Eq. 6.10 - Leading {variables[i].Name} with unfavourable permanent", PermanentCases = permanents.Where((item, index) => !item.IsFavourable).ToList(), PermanentPartialFactor = factors.Gamma_Ginf, + PermanentReductionFactor = new Ratio(1.0, RatioUnit.DecimalFraction), LeadingVariableCases = new List() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, OtherAccompanyingVariableCases = variables.Where((item, index) => item.IsHorizontal && index != i).ToList(), @@ -88,6 +91,7 @@ private static IList CreateSTR6_10aAnd6_10b(IList CreateSTR6_10aAnd6_10b(IList() { variables[i] }, LeadingVariablePartialFactor = factors.Gamma_Q1, OtherAccompanyingVariableCases = variables.Where((item, index) => index != i).ToList(), diff --git a/Loads/Cases/Combinations/FrequentCombination.cs b/Loads/Cases/Combinations/FrequentCombination.cs index 8559834..459e643 100644 --- a/Loads/Cases/Combinations/FrequentCombination.cs +++ b/Loads/Cases/Combinations/FrequentCombination.cs @@ -7,36 +7,22 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public class FrequentCombination : IFrequentCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList AccompanyingVariableCases { get; set; } = new List(); public FrequentCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - LeadingVariableCases, ld => ld.Frequent)); - } - - if (AccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - AccompanyingVariableCases, ld => ld.QuasiPermanent)); - } - + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads(LeadingVariableCases, ld => ld.Frequent)); + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads(AccompanyingVariableCases, ld => ld.QuasiPermanent)); return factoredLoads; } @@ -44,9 +30,9 @@ private string GetDefinition() { string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); string lead = Utility.DescriptionHelper( - LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Frequent); + LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Frequent); string other = Utility.DescriptionHelper( - AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); return Utility.JoinDescriptions(new string[] { perm, lead, other }); } } diff --git a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs index c63deb5..70c8a2d 100644 --- a/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs +++ b/Loads/Cases/Combinations/GeotechnicalMemberDesignCombination.cs @@ -1,44 +1,31 @@ using System.Collections.Generic; using MagmaWorks.Taxonomy.Loads.Cases; using OasysUnits; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Combinations { public class GeotechnicalMemberDesignCombination : IGeotechnicalMemberDesignCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); - public Ratio PermanentPartialFactor { get; set; } - public Ratio LeadingVariablePartialFactor { get; set; } - public Ratio AccompanyingPartialFactor { get; set; } - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public Ratio PermanentPartialFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); + public Ratio LeadingVariablePartialFactor { get; set; } = new Ratio(1.3, RatioUnit.DecimalFraction); + public Ratio AccompanyingPartialFactor { get; set; } = new Ratio(1.3, RatioUnit.DecimalFraction); + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList AccompanyingVariableCases { get; set; } = new List(); public GeotechnicalMemberDesignCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(PermanentPartialFactor, PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); - } - - if (AccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorAccompanyingVariableLoads( - AccompanyingPartialFactor, AccompanyingVariableCases, ld => ld.Characteristic)); - } - + factoredLoads.AddRange(Utility.FactorLoads(PermanentPartialFactor, PermanentCases)); + factoredLoads.AddRange( + Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); + factoredLoads.AddRange(Utility.FactorAccompanyingVariableLoads( + AccompanyingPartialFactor, AccompanyingVariableCases, ld => ld.Characteristic)); return factoredLoads; } @@ -47,7 +34,7 @@ private string GetDefinition() string perm = Utility.DescriptionHelper(PermanentCases, PermanentPartialFactor); string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingVariablePartialFactor); string other = Utility.DescriptionHelper( - AccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); + AccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); return Utility.JoinDescriptions(new string[] { perm, lead, other }); } } diff --git a/Loads/Cases/Combinations/MemberDesignCombination.cs b/Loads/Cases/Combinations/MemberDesignCombination.cs index 3d5c89d..c879f20 100644 --- a/Loads/Cases/Combinations/MemberDesignCombination.cs +++ b/Loads/Cases/Combinations/MemberDesignCombination.cs @@ -7,48 +7,32 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public class MemberDesignCombination : IMemberDesignCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); - public Ratio PermanentPartialFactor { get; set; } - public Ratio PermanentReductionFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); - public Ratio LeadingVariablePartialFactor { get; set; } - public Ratio AccompanyingPartialFactor { get; set; } - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList MainAccompanyingVariableCases { get; set; } - public IList OtherAccompanyingVariableCases { get; set; } + public Ratio PermanentPartialFactor { get; set; } = new Ratio(1.35, RatioUnit.DecimalFraction); + public Ratio PermanentReductionFactor { get; set; } = new Ratio(0.85, RatioUnit.DecimalFraction); + public Ratio LeadingVariablePartialFactor { get; set; } = new Ratio(1.5, RatioUnit.DecimalFraction); + public Ratio AccompanyingPartialFactor { get; set; } = new Ratio(1.5, RatioUnit.DecimalFraction); + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList MainAccompanyingVariableCases { get; set; } = new List(); + public IList OtherAccompanyingVariableCases { get; set; } = new List(); public MemberDesignCombination() : base() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(PermanentPartialFactor * PermanentReductionFactor.DecimalFractions, PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); - } - - if (MainAccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorAccompanyingVariableLoads( - LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); - } - - if (OtherAccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorAccompanyingVariableLoads( - AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); - } - + factoredLoads.AddRange(Utility.FactorLoads( + PermanentPartialFactor * PermanentReductionFactor.DecimalFractions, PermanentCases)); + factoredLoads.AddRange( + Utility.FactorLoads(LeadingVariablePartialFactor, LeadingVariableCases)); + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + LeadingVariablePartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); + factoredLoads.AddRange( + Utility.FactorAccompanyingVariableLoads( + AccompanyingPartialFactor, OtherAccompanyingVariableCases, ld => ld.Characteristic)); return factoredLoads; } @@ -57,9 +41,9 @@ private string GetDefinition() string perm = Utility.DescriptionHelper(PermanentCases, PermanentPartialFactor, PermanentReductionFactor); string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingVariablePartialFactor); string main = Utility.DescriptionHelper( - MainAccompanyingVariableCases, LeadingVariablePartialFactor, ld => ld.Characteristic); + MainAccompanyingVariableCases, LeadingVariablePartialFactor, ld => ld.Characteristic); string other = Utility.DescriptionHelper( - OtherAccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); + OtherAccompanyingVariableCases, AccompanyingPartialFactor, ld => ld.Characteristic); return Utility.JoinDescriptions(new string[] { perm, lead, main, other }); } } diff --git a/Loads/Cases/Combinations/QuasiPermanentCombination.cs b/Loads/Cases/Combinations/QuasiPermanentCombination.cs index 30d7ae0..442de8d 100644 --- a/Loads/Cases/Combinations/QuasiPermanentCombination.cs +++ b/Loads/Cases/Combinations/QuasiPermanentCombination.cs @@ -7,36 +7,22 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public class QuasiPermanentCombination : IQuasiPermanentCombination { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public string Definition => GetDefinition(); - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList AccompanyingVariableCases { get; set; } = new List(); public QuasiPermanentCombination() { } public IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - LeadingVariableCases, ld => ld.QuasiPermanent)); - } - - if (AccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - AccompanyingVariableCases, ld => ld.QuasiPermanent)); - } - + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads(LeadingVariableCases, ld => ld.QuasiPermanent)); + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads(AccompanyingVariableCases, ld => ld.QuasiPermanent)); return factoredLoads; } @@ -44,9 +30,9 @@ private string GetDefinition() { string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); string lead = Utility.DescriptionHelper( - LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Frequent); + LeadingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.Frequent); string other = Utility.DescriptionHelper( - AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); return Utility.JoinDescriptions(new string[] { perm, lead, other }); } } diff --git a/Loads/Cases/Combinations/SeismicCombination.cs b/Loads/Cases/Combinations/SeismicCombination.cs index 73bf5f5..be2cc6b 100644 --- a/Loads/Cases/Combinations/SeismicCombination.cs +++ b/Loads/Cases/Combinations/SeismicCombination.cs @@ -10,33 +10,20 @@ public class SeismicCombination : ISeismicCombination public string Name { get; set; } public string Definition => GetDefinition(); public Ratio LeadingSeismicPartialFactor { get; set; } = new Ratio(1, RatioUnit.DecimalFraction); - public IList PermanentCases { get; set; } - public IList LeadingVariableCases { get; set; } - public IList AccompanyingVariableCases { get; set; } + public IList PermanentCases { get; set; } = new List(); + public IList LeadingVariableCases { get; set; } = new List(); + public IList AccompanyingVariableCases { get; set; } = new List(); public SeismicCombination() { } public virtual IList GetFactoredLoads() { var factoredLoads = new List(); - if (PermanentCases != null) - { - factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); - } - - if (LeadingVariableCases != null) - { - factoredLoads.AddRange( - Utility.FactorLoads(LeadingSeismicPartialFactor, LeadingVariableCases)); - } - - if (AccompanyingVariableCases != null) - { - factoredLoads.AddRange( - Utility.SelectAccompanyingVariableLoads( - AccompanyingVariableCases, ld => ld.QuasiPermanent)); - } - + factoredLoads.AddRange(Utility.GetLoads(PermanentCases)); + factoredLoads.AddRange( + Utility.FactorLoads(LeadingSeismicPartialFactor, LeadingVariableCases)); + factoredLoads.AddRange( + Utility.SelectAccompanyingVariableLoads(AccompanyingVariableCases, ld => ld.QuasiPermanent)); return factoredLoads; } @@ -45,7 +32,7 @@ private string GetDefinition() string perm = Utility.DescriptionHelper(PermanentCases, new Ratio(1, RatioUnit.DecimalFraction)); string lead = Utility.DescriptionHelper(LeadingVariableCases, LeadingSeismicPartialFactor); string other = Utility.DescriptionHelper( - AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); + AccompanyingVariableCases, new Ratio(1, RatioUnit.DecimalFraction), ld => ld.QuasiPermanent); return Utility.JoinDescriptions(new string[] { perm, lead, other }); } } diff --git a/Loads/Cases/Combinations/Utility/Utility.cs b/Loads/Cases/Combinations/Utility/Utility.cs index 0027307..80b44df 100644 --- a/Loads/Cases/Combinations/Utility/Utility.cs +++ b/Loads/Cases/Combinations/Utility/Utility.cs @@ -13,6 +13,11 @@ public static IList FactorLoads(Ratio partialFactor, IList loadCase where T : ILoadCase { var factoredLoads = new List(); + if (loadCases == null || loadCases.Count == 0) + { + return factoredLoads; + } + foreach (T loadCase in loadCases) { foreach (ILoad load in loadCase.Loads) @@ -28,6 +33,11 @@ public static IList GetLoads(IList loadCases) where T : ILoadCase { var factoredLoads = new List(); + if (loadCases == null || loadCases.Count == 0) + { + return factoredLoads; + } + foreach (T loadCase in loadCases) { foreach (ILoad load in loadCase.Loads) @@ -43,6 +53,11 @@ public static IList FactorAccompanyingVariableLoads(Ratio partialFacto where T : IVariableCase { var factoredLoads = new List(); + if (loadCases == null || loadCases.Count == 0) + { + return factoredLoads; + } + foreach (T loadCase in loadCases) { foreach (ILoad load in loadCase.Loads) @@ -62,6 +77,11 @@ public static IList SelectAccompanyingVariableLoads(IList loadCases where T : IVariableCase { var factoredLoads = new List(); + if (loadCases == null || loadCases.Count == 0) + { + return factoredLoads; + } + foreach (T loadCase in loadCases) { foreach (ILoad load in loadCase.Loads) diff --git a/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs index 7649128..796954c 100644 --- a/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/AccidentialCombinationTests.cs @@ -147,7 +147,7 @@ public void CasesWithQuasiTest() Assert.Equal(2, combinations[0].PermanentCases.Count); Assert.Single(combinations[0].LeadingVariableCases); Assert.Equivalent(impact, combinations[0].LeadingVariableCases.FirstOrDefault()); - Assert.Null(combinations[0].MainAccompanyingVariableCases); + Assert.Empty(combinations[0].MainAccompanyingVariableCases); Assert.Equal(4, combinations[0].OtherAccompanyingVariableCases.Count); Assert.Equal(1.5, combinations[0].LeadingAccidentialPartialFactor.DecimalFractions); } diff --git a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs index 157a241..6a928e6 100644 --- a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10CombinationTests.cs @@ -70,7 +70,7 @@ public void CasesTest() { Assert.Equal(2, combinations[i].PermanentCases.Count); Assert.Single(combinations[i].LeadingVariableCases); - Assert.Null(combinations[i].MainAccompanyingVariableCases); + Assert.Empty(combinations[i].MainAccompanyingVariableCases); if (!combinations[i].LeadingVariableCases.First().IsHorizontal) { Assert.Equal(3, combinations[i].OtherAccompanyingVariableCases.Count); diff --git a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs index 9edf449..d4cfddc 100644 --- a/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/MemberDesign6_10abCombinationTests.cs @@ -71,15 +71,15 @@ public void CasesTest() // Assert Assert.Equal(6, combinations.Count); Assert.Equal(2, combinations[0].PermanentCases.Count); - Assert.Null(combinations[0].LeadingVariableCases); - Assert.Null(combinations[0].MainAccompanyingVariableCases); + Assert.Empty(combinations[0].LeadingVariableCases); + Assert.Empty(combinations[0].MainAccompanyingVariableCases); Assert.Equal(4, combinations[0].OtherAccompanyingVariableCases.Count); for (int i = 1; i < combinations.Count; i++) { Assert.Equal(2, combinations[i].PermanentCases.Count); Assert.Single(combinations[i].LeadingVariableCases); - Assert.Null(combinations[i].MainAccompanyingVariableCases); + Assert.Empty(combinations[i].MainAccompanyingVariableCases); if (!combinations[i].LeadingVariableCases.First().IsHorizontal) { Assert.Equal(3, combinations[i].OtherAccompanyingVariableCases.Count); diff --git a/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs b/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs index 41cef99..00dc7cc 100644 --- a/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs +++ b/Loads/LoadTests/Cases/Combinations/QuasiPermanentCombinationTests.cs @@ -50,7 +50,7 @@ public void CasesTest() // Assert Assert.Single(combinations); Assert.Equal(2, combinations[0].PermanentCases.Count); - Assert.Null(combinations[0].LeadingVariableCases); + Assert.Empty(combinations[0].LeadingVariableCases); Assert.Equal(2, combinations[0].AccompanyingVariableCases.Count); } From 6dcbe61e4a9a83eec9f57f330eb199b8e0ac3808 Mon Sep 17 00:00:00 2001 From: kpne Date: Wed, 9 Oct 2024 20:40:46 +0200 Subject: [PATCH 51/53] https://github.com/MagmaWorks/Taxonomy/pull/32#discussion_r1793218856 --- .../Cases/Factory/ENImposedCaseFactory.cs | 62 +------------------ .../Cases/Cases/Factory/ENSnowCaseFactory.cs | 15 +---- .../Cases/Cases/Factory/ENTableA1_1Imposed.cs | 59 ++++++++++++++++++ Loads/Cases/Cases/Factory/ENTableA1_1Snow.cs | 32 ++++++++++ .../Cases/Cases/Factory/ENTableA1_1Thermal.cs | 27 ++++++++ Loads/Cases/Cases/Factory/ENTableA1_1Wind.cs | 27 ++++++++ .../Cases/Factory/ENThermalCaseFactory.cs | 14 +---- .../Cases/Cases/Factory/ENWindCaseFactory.cs | 14 +---- .../Factory/ENCombinationFactoryUtility.cs | 31 ---------- .../Combinations/Factory/ENTableA1_2A.cs | 26 ++++++++ .../Combinations/Factory/ENTableA1_2B.cs | 26 ++++++++ .../Combinations/Factory/ENTableA1_2C.cs | 26 ++++++++ .../Factory/ENULSCombinationSetAFactory.cs | 13 +--- .../Factory/ENULSCombinationSetBFactory.cs | 19 +----- .../Factory/ENULSCombinationSetCFactory.cs | 13 ++-- Loads/ICases/Combinations/EN/ITableA1_2.cs | 9 +++ .../Combinations/EN/TableA1_2Properties.cs | 34 ++++++++++ Loads/ICases/LoadCases/EN/ITableA1_1.cs | 9 +++ .../ICases/LoadCases/EN/ITableA1_1Imposed.cs | 9 +++ Loads/ICases/LoadCases/EN/ITableA1_1Snow.cs | 9 +++ .../LoadCases/EN}/ImposedLoadCategory.cs | 0 .../LoadCases/EN/TableA1_1Properties.cs | 20 ++++++ .../ICases/MagmaWorks.Taxonomy.ICases.csproj | 1 + 23 files changed, 333 insertions(+), 162 deletions(-) create mode 100644 Loads/Cases/Cases/Factory/ENTableA1_1Imposed.cs create mode 100644 Loads/Cases/Cases/Factory/ENTableA1_1Snow.cs create mode 100644 Loads/Cases/Cases/Factory/ENTableA1_1Thermal.cs create mode 100644 Loads/Cases/Cases/Factory/ENTableA1_1Wind.cs create mode 100644 Loads/Cases/Combinations/Factory/ENTableA1_2A.cs create mode 100644 Loads/Cases/Combinations/Factory/ENTableA1_2B.cs create mode 100644 Loads/Cases/Combinations/Factory/ENTableA1_2C.cs create mode 100644 Loads/ICases/Combinations/EN/ITableA1_2.cs create mode 100644 Loads/ICases/Combinations/EN/TableA1_2Properties.cs create mode 100644 Loads/ICases/LoadCases/EN/ITableA1_1.cs create mode 100644 Loads/ICases/LoadCases/EN/ITableA1_1Imposed.cs create mode 100644 Loads/ICases/LoadCases/EN/ITableA1_1Snow.cs rename Loads/{Cases/Cases => ICases/LoadCases/EN}/ImposedLoadCategory.cs (100%) create mode 100644 Loads/ICases/LoadCases/EN/TableA1_1Properties.cs diff --git a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs index 6a2ef40..37d23f2 100644 --- a/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENImposedCaseFactory.cs @@ -1,73 +1,15 @@ using System.Collections.Generic; using System.Linq; +using MagmaWorks.Taxonomy.Loads.Cases.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; -using OasysUnits; -using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Cases { public static partial class ENLoadCaseFactory { - private struct TableA1Properties - { - internal Ratio Phi_0; - internal Ratio Phi_1; - internal Ratio Phi_2; - - internal TableA1Properties(double phi_0, double phi_1, double phi_2) - { - RatioUnit unit = RatioUnit.DecimalFraction; - Phi_0 = new Ratio(phi_0, unit); - Phi_1 = new Ratio(phi_1, unit); - Phi_2 = new Ratio(phi_2, unit); - } - } - - private static readonly Dictionary> EN1990_TableA1_1_Imposed = new() - { - { NationalAnnex.RecommendedValues, new () { - { ImposedLoadCategory.CategoryA, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryB, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryC, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryD, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryE, new TableA1Properties(1.0, 0.9, 0.8) }, - { ImposedLoadCategory.CategoryF, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryG, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryH, new TableA1Properties(0.0, 0.0, 0.0) }, - } - }, - { NationalAnnex.UnitedKingdom, new () { - { ImposedLoadCategory.CategoryA, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryB, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryC, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryD, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryE, new TableA1Properties(1.0, 0.9, 0.8) }, - { ImposedLoadCategory.CategoryF, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryG, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryH, new TableA1Properties(0.7, 0.0, 0.0) }, - } - }, - { NationalAnnex.Germany, new () { - { ImposedLoadCategory.CategoryA, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryB, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryC, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryD, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryE, new TableA1Properties(1.0, 0.9, 0.8) }, - { ImposedLoadCategory.CategoryF, new TableA1Properties(0.7, 0.7, 0.6) }, - { ImposedLoadCategory.CategoryG, new TableA1Properties(0.7, 0.5, 0.3) }, - { ImposedLoadCategory.CategoryH, new TableA1Properties(0.0, 0.0, 0.0) }, - } - }, - }; - public static VariableCase CreateImposed(ImposedLoadCategory category, NationalAnnex nationalAnnex) { - if (!EN1990_TableA1_1_Imposed.TryGetValue(nationalAnnex, out Dictionary kvp)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Imposed Load φ-factors"); - }; - - TableA1Properties factors = kvp[category]; + TableA1_1Properties factors = new ENTableA1_1Imposed().GetProperties(category, nationalAnnex); return new VariableCase() { Characteristic = factors.Phi_0, diff --git a/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs b/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs index dec03ce..aa6964f 100644 --- a/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENSnowCaseFactory.cs @@ -1,25 +1,14 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Cases { public static partial class ENLoadCaseFactory { - private static readonly Dictionary EN1990_TableA1_1_Snow = new() - { - { NationalAnnex.RecommendedValues, (new TableA1Properties(0.7, 0.5, 0.2), new TableA1Properties(0.5, 0.2, 0.0)) }, - { NationalAnnex.UnitedKingdom, (new TableA1Properties(0.7, 0.5, 0.2), new TableA1Properties(0.5, 0.2, 0.0)) }, - { NationalAnnex.Germany, (new TableA1Properties(0.7, 0.5, 0.2), new TableA1Properties(0.5, 0.2, 0.0)) }, - }; - public static VariableCase CreateSnow(NationalAnnex nationalAnnex, bool altitudeAbove1000m) { - if (!EN1990_TableA1_1_Snow.TryGetValue(nationalAnnex, out (TableA1Properties Above1000m, TableA1Properties Below1000m) kvp)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Snow φ-factors"); - }; - - TableA1Properties factors = altitudeAbove1000m ? kvp.Above1000m : kvp.Below1000m; + TableA1_1Properties factors = new ENTableA1_1Snow().GetProperties(altitudeAbove1000m, nationalAnnex); return new VariableCase() { Characteristic = factors.Phi_0, diff --git a/Loads/Cases/Cases/Factory/ENTableA1_1Imposed.cs b/Loads/Cases/Cases/Factory/ENTableA1_1Imposed.cs new file mode 100644 index 0000000..8d3558d --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENTableA1_1Imposed.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + internal class ENTableA1_1Imposed : ITableA1_1Imposed + { + public TableA1_1Properties GetProperties(ImposedLoadCategory category, NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Imposed.TryGetValue( + nationalAnnex, out Dictionary kvp)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Imposed Load φ-factors"); + }; + + return kvp[category]; + } + + private static readonly Dictionary> EN1990_TableA1_1_Imposed = new() + { + { NationalAnnex.RecommendedValues, new () { + { ImposedLoadCategory.CategoryA, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryB, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryC, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryD, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryE, new TableA1_1Properties(1.0, 0.9, 0.8) }, + { ImposedLoadCategory.CategoryF, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryG, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryH, new TableA1_1Properties(0.0, 0.0, 0.0) }, + } + }, + { NationalAnnex.UnitedKingdom, new () { + { ImposedLoadCategory.CategoryA, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryB, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryC, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryD, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryE, new TableA1_1Properties(1.0, 0.9, 0.8) }, + { ImposedLoadCategory.CategoryF, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryG, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryH, new TableA1_1Properties(0.7, 0.0, 0.0) }, + } + }, + { NationalAnnex.Germany, new () { + { ImposedLoadCategory.CategoryA, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryB, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryC, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryD, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryE, new TableA1_1Properties(1.0, 0.9, 0.8) }, + { ImposedLoadCategory.CategoryF, new TableA1_1Properties(0.7, 0.7, 0.6) }, + { ImposedLoadCategory.CategoryG, new TableA1_1Properties(0.7, 0.5, 0.3) }, + { ImposedLoadCategory.CategoryH, new TableA1_1Properties(0.0, 0.0, 0.0) }, + } + }, + }; + } +} diff --git a/Loads/Cases/Cases/Factory/ENTableA1_1Snow.cs b/Loads/Cases/Cases/Factory/ENTableA1_1Snow.cs new file mode 100644 index 0000000..077397b --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENTableA1_1Snow.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + internal class ENTableA1_1Snow : ITableA1_1Snow + { + public TableA1_1Properties GetProperties(bool above1000m, NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Snow.TryGetValue( + nationalAnnex, out (TableA1_1Properties Above1000m, TableA1_1Properties Below1000m) kvp)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Snow φ-factors"); + }; + + return above1000m ? kvp.Above1000m : kvp.Below1000m; + } + + private static readonly Dictionary EN1990_TableA1_1_Snow = new() + { + { NationalAnnex.RecommendedValues, + (new TableA1_1Properties(0.7, 0.5, 0.2), new TableA1_1Properties(0.5, 0.2, 0.0)) }, + { NationalAnnex.UnitedKingdom, + (new TableA1_1Properties(0.7, 0.5, 0.2), new TableA1_1Properties(0.5, 0.2, 0.0)) }, + { NationalAnnex.Germany, + (new TableA1_1Properties(0.7, 0.5, 0.2), new TableA1_1Properties(0.5, 0.2, 0.0)) }, + }; + } +} diff --git a/Loads/Cases/Cases/Factory/ENTableA1_1Thermal.cs b/Loads/Cases/Cases/Factory/ENTableA1_1Thermal.cs new file mode 100644 index 0000000..6e1a1ed --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENTableA1_1Thermal.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + internal class ENTableA1_1Thermal : ITableA1_1 + { + public TableA1_1Properties GetProperties(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Thermal.TryGetValue(nationalAnnex, out TableA1_1Properties factors)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Thermal φ-factors"); + }; + + return factors; + } + + private static readonly Dictionary EN1990_TableA1_1_Thermal = new() + { + { NationalAnnex.RecommendedValues, new TableA1_1Properties(0.6, 0.5, 0.0) }, + { NationalAnnex.UnitedKingdom, new TableA1_1Properties(0.6, 0.5, 0.0) }, + { NationalAnnex.Germany, new TableA1_1Properties(0.6, 0.5, 0.0) }, + }; + } +} diff --git a/Loads/Cases/Cases/Factory/ENTableA1_1Wind.cs b/Loads/Cases/Cases/Factory/ENTableA1_1Wind.cs new file mode 100644 index 0000000..f85300d --- /dev/null +++ b/Loads/Cases/Cases/Factory/ENTableA1_1Wind.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases +{ + internal class ENTableA1_1Wind : ITableA1_1 + { + public TableA1_1Properties GetProperties(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_1_Wind.TryGetValue(nationalAnnex, out TableA1_1Properties factors)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Wind φ-factors"); + }; + + return factors; + } + + private static readonly Dictionary EN1990_TableA1_1_Wind = new() + { + { NationalAnnex.RecommendedValues, new TableA1_1Properties(0.6, 0.2, 0.0) }, + { NationalAnnex.UnitedKingdom, new TableA1_1Properties(0.6, 0.2, 0.0) }, + { NationalAnnex.Germany, new TableA1_1Properties(0.6, 0.2, 0.0) }, + }; + } +} diff --git a/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs b/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs index 2f7ae52..8bbf532 100644 --- a/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENThermalCaseFactory.cs @@ -1,24 +1,14 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Cases { public static partial class ENLoadCaseFactory { - private static readonly Dictionary EN1990_TableA1_1_Thermal = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(0.6, 0.5, 0.0) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(0.6, 0.5, 0.0) }, - { NationalAnnex.Germany, new TableA1Properties(0.6, 0.5, 0.0) }, - }; - public static VariableCase CreateThermal(NationalAnnex nationalAnnex) { - if (!EN1990_TableA1_1_Thermal.TryGetValue(nationalAnnex, out TableA1Properties factors)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Thermal φ-factors"); - }; - + TableA1_1Properties factors = new ENTableA1_1Thermal().GetProperties(nationalAnnex); return new VariableCase() { Characteristic = factors.Phi_0, diff --git a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs index f54118e..9f84291 100644 --- a/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs +++ b/Loads/Cases/Cases/Factory/ENWindCaseFactory.cs @@ -1,24 +1,14 @@ using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Cases.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Cases { public static partial class ENLoadCaseFactory { - private static readonly Dictionary EN1990_TableA1_1_Wind = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(0.6, 0.2, 0.0) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(0.6, 0.2, 0.0) }, - { NationalAnnex.Germany, new TableA1Properties(0.6, 0.2, 0.0) }, - }; - public static VariableCase CreateWind(NationalAnnex nationalAnnex) { - if (!EN1990_TableA1_1_Wind.TryGetValue(nationalAnnex, out TableA1Properties factors)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.1 Wind φ-factors"); - }; - + TableA1_1Properties factors = new ENTableA1_1Wind().GetProperties(nationalAnnex); return new VariableCase() { Characteristic = factors.Phi_0, diff --git a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs index 3b9b61e..c2d3e5e 100644 --- a/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs +++ b/Loads/Cases/Combinations/Factory/ENCombinationFactoryUtility.cs @@ -1,41 +1,10 @@ using System.Collections.Generic; using MagmaWorks.Taxonomy.Loads.Cases; -using OasysUnits; -using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { - private struct TableA1Properties - { - internal Ratio Gamma_Gsup; - internal Ratio Gamma_Ginf; - internal Ratio Gamma_Q1; - internal Ratio Gamma_Qi; - internal Ratio Xi; - - internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi, double xi) - { - RatioUnit unit = RatioUnit.DecimalFraction; - Gamma_Gsup = new Ratio(gamma_Gsup, unit); - Gamma_Ginf = new Ratio(gamma_Ginf, unit); - Gamma_Q1 = new Ratio(gamma_Q1, unit); - Gamma_Qi = new Ratio(gamma_Qi, unit); - Xi = new Ratio(xi, unit); - } - - internal TableA1Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi) - { - RatioUnit unit = RatioUnit.DecimalFraction; - Gamma_Gsup = new Ratio(gamma_Gsup, unit); - Gamma_Ginf = new Ratio(gamma_Ginf, unit); - Gamma_Q1 = new Ratio(gamma_Q1, unit); - Gamma_Qi = new Ratio(gamma_Qi, unit); - Xi = Ratio.Zero; - } - } - private static (IList Permanents, IList Variables) SortLoadCases(IList cases) { var permanent = new List(); diff --git a/Loads/Cases/Combinations/Factory/ENTableA1_2A.cs b/Loads/Cases/Combinations/Factory/ENTableA1_2A.cs new file mode 100644 index 0000000..a6a814b --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENTableA1_2A.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Combinations.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Combinations +{ + internal class ENTableA1_2A : ITableA1_2 + { + public TableA1_2Properties GetProperties(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_2A.TryGetValue(nationalAnnex, out TableA1_2Properties factors)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.2(A) values"); + }; + + return factors; + } + + private static readonly Dictionary EN1990_TableA1_2A = new() + { + { NationalAnnex.RecommendedValues, new TableA1_2Properties(1.1, 0.9, 1.5, 1.5) }, + { NationalAnnex.UnitedKingdom, new TableA1_2Properties(1.1, 0.9, 1.5, 1.5) }, + }; + } +} diff --git a/Loads/Cases/Combinations/Factory/ENTableA1_2B.cs b/Loads/Cases/Combinations/Factory/ENTableA1_2B.cs new file mode 100644 index 0000000..30a94e2 --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENTableA1_2B.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Combinations.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Combinations +{ + internal class ENTableA1_2B : ITableA1_2 + { + public TableA1_2Properties GetProperties(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1_2Properties factors)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.2(B) values"); + }; + + return factors; + } + + private static readonly Dictionary EN1990_TableA1_2B = new() + { + { NationalAnnex.RecommendedValues, new TableA1_2Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, + { NationalAnnex.UnitedKingdom, new TableA1_2Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, + }; + } +} diff --git a/Loads/Cases/Combinations/Factory/ENTableA1_2C.cs b/Loads/Cases/Combinations/Factory/ENTableA1_2C.cs new file mode 100644 index 0000000..1a2eaa2 --- /dev/null +++ b/Loads/Cases/Combinations/Factory/ENTableA1_2C.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using MagmaWorks.Taxonomy.Loads.Combinations.EN; +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Combinations +{ + internal class ENTableA1_2C : ITableA1_2 + { + public TableA1_2Properties GetProperties(NationalAnnex nationalAnnex) + { + if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1_2Properties factors)) + { + throw new System.NotImplementedException( + $"NA {nationalAnnex} not implemented for EN1990 Table A1.2(C) values"); + }; + + return factors; + } + + private static readonly Dictionary EN1990_TableA1_2C = new() + { + { NationalAnnex.RecommendedValues, new TableA1_2Properties(1.0, 1.0, 1.3, 1.3) }, + { NationalAnnex.UnitedKingdom, new TableA1_2Properties(1.0, 1.0, 1.3, 1.3) }, + }; + } +} diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs index eb68305..a436020 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs @@ -1,17 +1,14 @@ using System.Collections.Generic; using System.Linq; using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { - private static readonly Dictionary EN1990_TableA1_2A = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.1, 0.9, 1.5, 1.5) }, - }; + public static IList CreateEquSetA(IList cases) { @@ -20,12 +17,8 @@ public static IList CreateEquSetA(IList case public static IList CreateEquSetA(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { + TableA1_2Properties factors = new ENTableA1_2A().GetProperties(nationalAnnex); (IList permanents, IList variables) = SortLoadCases(cases); - if (!EN1990_TableA1_2A.TryGetValue(nationalAnnex, out TableA1Properties factors)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(A) values"); - }; - var combinations = new List(); for (int i = 0; i < variables.Count; i++) { diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs index e989ff1..78e154f 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetBFactory.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; using OasysUnits; using OasysUnits.Units; @@ -9,12 +10,6 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { - private static readonly Dictionary EN1990_TableA1_2B = new() - { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.85) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.35, 1.0, 1.5, 1.5, 0.925) }, - }; - public static IList CreateStrGeoSetB(IList cases, string prefix = "LC", int firstCaseId = 1) { return CreateStrGeoSetB(cases, NationalAnnex.RecommendedValues, true, prefix, firstCaseId); @@ -34,12 +29,8 @@ public static IList CreateStrGeoSetB(IList private static IList CreateSTR6_10(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { + TableA1_2Properties factors = new ENTableA1_2B().GetProperties(nationalAnnex); (IList permanents, IList variables) = SortLoadCases(cases); - if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1Properties factors)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(B) values"); - }; - var combinations = new List(); for (int i = 0; i < variables.Count; i++) { @@ -76,12 +67,8 @@ private static IList CreateSTR6_10(IList ca private static IList CreateSTR6_10aAnd6_10b(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { + TableA1_2Properties factors = new ENTableA1_2B().GetProperties(nationalAnnex); (IList permanents, IList variables) = SortLoadCases(cases); - if (!EN1990_TableA1_2B.TryGetValue(nationalAnnex, out TableA1Properties factors)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(B) values"); - }; - var combinations = new List(); bool onlyOne6_10a = Equals(factors.Gamma_Q1, factors.Gamma_Qi); if (onlyOne6_10a) diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs index 8dff5ba..adc91bf 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetCFactory.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using MagmaWorks.Taxonomy.Loads.Cases; +using MagmaWorks.Taxonomy.Loads.Combinations.EN; using MagmaWorks.Taxonomy.Standards.Eurocode; namespace MagmaWorks.Taxonomy.Loads.Combinations @@ -8,10 +9,10 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations public static partial class ENCombinationFactory { - private static readonly Dictionary EN1990_TableA1_2C = new() + private static readonly Dictionary EN1990_TableA1_2C = new() { - { NationalAnnex.RecommendedValues, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, - { NationalAnnex.UnitedKingdom, new TableA1Properties(1.0, 1.0, 1.3, 1.3) }, + { NationalAnnex.RecommendedValues, new TableA1_2Properties(1.0, 1.0, 1.3, 1.3) }, + { NationalAnnex.UnitedKingdom, new TableA1_2Properties(1.0, 1.0, 1.3, 1.3) }, }; public static IList CreateStrGeoSetC(IList cases, string prefix = "LC", int firstCaseId = 1) @@ -21,12 +22,8 @@ public static IList CreateStrGeoSetC(IList public static IList CreateStrGeoSetC(IList cases, NationalAnnex nationalAnnex, string prefix = "LC", int firstCaseId = 1) { + TableA1_2Properties factors = new ENTableA1_2C().GetProperties(nationalAnnex); (IList permanents, IList variables) = SortLoadCases(cases); - if (!EN1990_TableA1_2C.TryGetValue(nationalAnnex, out TableA1Properties factors)) - { - throw new System.NotImplementedException($"NA {nationalAnnex} not implemented for EN1990 Table A1.2(C) values"); - }; - var combinations = new List(); for (int i = 0; i < variables.Count; i++) { diff --git a/Loads/ICases/Combinations/EN/ITableA1_2.cs b/Loads/ICases/Combinations/EN/ITableA1_2.cs new file mode 100644 index 0000000..7d0d905 --- /dev/null +++ b/Loads/ICases/Combinations/EN/ITableA1_2.cs @@ -0,0 +1,9 @@ +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Combinations.EN +{ + public interface ITableA1_2 + { + TableA1_2Properties GetProperties(NationalAnnex nationalAnnex); + } +} diff --git a/Loads/ICases/Combinations/EN/TableA1_2Properties.cs b/Loads/ICases/Combinations/EN/TableA1_2Properties.cs new file mode 100644 index 0000000..c1d060f --- /dev/null +++ b/Loads/ICases/Combinations/EN/TableA1_2Properties.cs @@ -0,0 +1,34 @@ +using OasysUnits.Units; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads.Combinations.EN +{ + public struct TableA1_2Properties + { + public Ratio Gamma_Gsup; + public Ratio Gamma_Ginf; + public Ratio Gamma_Q1; + public Ratio Gamma_Qi; + public Ratio Xi; + + public TableA1_2Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi, double xi) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Gamma_Gsup = new Ratio(gamma_Gsup, unit); + Gamma_Ginf = new Ratio(gamma_Ginf, unit); + Gamma_Q1 = new Ratio(gamma_Q1, unit); + Gamma_Qi = new Ratio(gamma_Qi, unit); + Xi = new Ratio(xi, unit); + } + + public TableA1_2Properties(double gamma_Gsup, double gamma_Ginf, double gamma_Q1, double gamma_Qi) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Gamma_Gsup = new Ratio(gamma_Gsup, unit); + Gamma_Ginf = new Ratio(gamma_Ginf, unit); + Gamma_Q1 = new Ratio(gamma_Q1, unit); + Gamma_Qi = new Ratio(gamma_Qi, unit); + Xi = Ratio.Zero; + } + } +} diff --git a/Loads/ICases/LoadCases/EN/ITableA1_1.cs b/Loads/ICases/LoadCases/EN/ITableA1_1.cs new file mode 100644 index 0000000..ccc16fc --- /dev/null +++ b/Loads/ICases/LoadCases/EN/ITableA1_1.cs @@ -0,0 +1,9 @@ +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases.EN +{ + public interface ITableA1_1 + { + TableA1_1Properties GetProperties(NationalAnnex nationalAnnex); + } +} diff --git a/Loads/ICases/LoadCases/EN/ITableA1_1Imposed.cs b/Loads/ICases/LoadCases/EN/ITableA1_1Imposed.cs new file mode 100644 index 0000000..06cfdc7 --- /dev/null +++ b/Loads/ICases/LoadCases/EN/ITableA1_1Imposed.cs @@ -0,0 +1,9 @@ +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases.EN +{ + public interface ITableA1_1Imposed + { + TableA1_1Properties GetProperties(ImposedLoadCategory category, NationalAnnex nationalAnnex); + } +} diff --git a/Loads/ICases/LoadCases/EN/ITableA1_1Snow.cs b/Loads/ICases/LoadCases/EN/ITableA1_1Snow.cs new file mode 100644 index 0000000..8f2a858 --- /dev/null +++ b/Loads/ICases/LoadCases/EN/ITableA1_1Snow.cs @@ -0,0 +1,9 @@ +using MagmaWorks.Taxonomy.Standards.Eurocode; + +namespace MagmaWorks.Taxonomy.Loads.Cases.EN +{ + public interface ITableA1_1Snow + { + TableA1_1Properties GetProperties(bool above1000m, NationalAnnex nationalAnnex); + } +} diff --git a/Loads/Cases/Cases/ImposedLoadCategory.cs b/Loads/ICases/LoadCases/EN/ImposedLoadCategory.cs similarity index 100% rename from Loads/Cases/Cases/ImposedLoadCategory.cs rename to Loads/ICases/LoadCases/EN/ImposedLoadCategory.cs diff --git a/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs b/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs new file mode 100644 index 0000000..6b3e789 --- /dev/null +++ b/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs @@ -0,0 +1,20 @@ +using OasysUnits.Units; +using OasysUnits; + +namespace MagmaWorks.Taxonomy.Loads.Cases.EN +{ + public struct TableA1_1Properties + { + public Ratio Phi_0; + public Ratio Phi_1; + public Ratio Phi_2; + + public TableA1_1Properties(double phi_0, double phi_1, double phi_2) + { + RatioUnit unit = RatioUnit.DecimalFraction; + Phi_0 = new Ratio(phi_0, unit); + Phi_1 = new Ratio(phi_1, unit); + Phi_2 = new Ratio(phi_2, unit); + } + } +} diff --git a/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj b/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj index 04b34d0..88be491 100644 --- a/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj +++ b/Loads/ICases/MagmaWorks.Taxonomy.ICases.csproj @@ -49,6 +49,7 @@ + From 23a616d30304ba9cf68fc82ce913e6b155d33508 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Wed, 9 Oct 2024 18:42:37 +0000 Subject: [PATCH 52/53] Fix code style issues with dotnet_format --- .../Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs | 2 +- Loads/ICases/Combinations/EN/TableA1_2Properties.cs | 4 ++-- Loads/ICases/LoadCases/EN/TableA1_1Properties.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs b/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs index a436020..3b5fec3 100644 --- a/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs +++ b/Loads/Cases/Combinations/Factory/ENULSCombinationSetAFactory.cs @@ -8,7 +8,7 @@ namespace MagmaWorks.Taxonomy.Loads.Combinations { public static partial class ENCombinationFactory { - + public static IList CreateEquSetA(IList cases) { diff --git a/Loads/ICases/Combinations/EN/TableA1_2Properties.cs b/Loads/ICases/Combinations/EN/TableA1_2Properties.cs index c1d060f..9f944e4 100644 --- a/Loads/ICases/Combinations/EN/TableA1_2Properties.cs +++ b/Loads/ICases/Combinations/EN/TableA1_2Properties.cs @@ -1,5 +1,5 @@ -using OasysUnits.Units; -using OasysUnits; +using OasysUnits; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Combinations.EN { diff --git a/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs b/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs index 6b3e789..10bac97 100644 --- a/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs +++ b/Loads/ICases/LoadCases/EN/TableA1_1Properties.cs @@ -1,5 +1,5 @@ -using OasysUnits.Units; -using OasysUnits; +using OasysUnits; +using OasysUnits.Units; namespace MagmaWorks.Taxonomy.Loads.Cases.EN { From 7d5d2ce966d08b8855ccd2f6ebe774a2167bcbc6 Mon Sep 17 00:00:00 2001 From: Kristjan Nielsen Date: Thu, 10 Oct 2024 12:00:41 +0200 Subject: [PATCH 53/53] Update on-pull-request.yml