From 68534a36f891f71937c0646df96f45cea2fd849b Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Mon, 27 Nov 2023 16:30:57 +0000 Subject: [PATCH 01/14] Added multiplication of gravity load by gravitational acceleration. Added warning when set to an unusual value by the user. --- Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs index cf0adc0a..6eea05af 100644 --- a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs +++ b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs @@ -24,11 +24,11 @@ using BH.oM.Structure.Loads; using BH.Engine.Adapter; using Lusas.LPI; +using BH.oM.Geometry; namespace BH.Adapter.Lusas { -#if Debug18 || Release18 - public partial class LusasV18Adapter +#if Debug18 || Release18 public partial class LusasV18Adapter #elif Debug19 || Release19 public partial class LusasV19Adapter #elif Debug191 || Release191 @@ -54,8 +54,13 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu } else { + double g = 9.8065; lusasGravityLoad = d_LusasData.createLoadingBody(gravityLoad.Name); - lusasGravityLoad.setBody(gravityLoad.GravityDirection.X, gravityLoad.GravityDirection.Y, gravityLoad.GravityDirection.Z); + lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * 9.806, gravityLoad.GravityDirection.Y * 9.806, gravityLoad.GravityDirection.Z * 9.806); + if (!(9.81 < lusasGravityLoad.getValue("accX") < 10.0 || 9.81 < lusasGravityLoad.getValue("accY") < 10.0 || 9.81 < lusasGravityLoad.getValue("accZ") < 10.0)) + { + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0"); + } } IFAssignment lusasAssignment = m_LusasApplication.assignment(); From c3f57592e0e7274f63376913220c59e67cb28856 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Mon, 27 Nov 2023 16:33:37 +0000 Subject: [PATCH 02/14] Fixed small writing mistake. --- Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs index 6eea05af..c2d6c7ed 100644 --- a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs +++ b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs @@ -28,7 +28,8 @@ namespace BH.Adapter.Lusas { -#if Debug18 || Release18 public partial class LusasV18Adapter +#if Debug18 || Release18 + public partial class LusasV18Adapter #elif Debug19 || Release19 public partial class LusasV19Adapter #elif Debug191 || Release191 @@ -54,12 +55,11 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu } else { - double g = 9.8065; lusasGravityLoad = d_LusasData.createLoadingBody(gravityLoad.Name); lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * 9.806, gravityLoad.GravityDirection.Y * 9.806, gravityLoad.GravityDirection.Z * 9.806); if (!(9.81 < lusasGravityLoad.getValue("accX") < 10.0 || 9.81 < lusasGravityLoad.getValue("accY") < 10.0 || 9.81 < lusasGravityLoad.getValue("accZ") < 10.0)) - { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0"); + { + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0."); } } From cab31ea1d4d64b487ea67037f6dd660465da6d92 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Mon, 27 Nov 2023 16:38:59 +0000 Subject: [PATCH 03/14] Added conversion back to BHoM by dividing by 9.806. --- Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs index 03d8f357..12f6e923 100644 --- a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs +++ b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs @@ -48,11 +48,16 @@ public static GravityLoad ToGravityLoad(IFLoading lusasGravityLoad, Loadcase loadcase = ToLoadcase(assignedLoadcase); Vector gravityVector = new Vector { - X = lusasGravityLoad.getValue("accX"), - Y = lusasGravityLoad.getValue("accY"), - Z = lusasGravityLoad.getValue("accZ") + X = lusasGravityLoad.getValue("accX") / 9.806, + Y = lusasGravityLoad.getValue("accY") / 9.806, + Z = lusasGravityLoad.getValue("accZ") / 9.806 }; + if (!(9.81 < lusasGravityLoad.getValue("accX") < 10.0 || 9.81 < lusasGravityLoad.getValue("accY") < 10.0 || 9.81 < lusasGravityLoad.getValue("accZ") < 10.0)) + { + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0."); + } + IEnumerable assignedObjects = GetGeometryAssignments( lusasAssignments, nodes, bars, panels); GravityLoad gravityLoad = Engine.Structure.Create.GravityLoad( From 02fbf9d5dbd143eac3f1b5e11ce5467d0dcd7aac Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Mon, 27 Nov 2023 17:14:12 +0000 Subject: [PATCH 04/14] Update to if statement. --- Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs | 7 +++++-- Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs index c2d6c7ed..a21f5cc2 100644 --- a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs +++ b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs @@ -57,9 +57,12 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu { lusasGravityLoad = d_LusasData.createLoadingBody(gravityLoad.Name); lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * 9.806, gravityLoad.GravityDirection.Y * 9.806, gravityLoad.GravityDirection.Z * 9.806); - if (!(9.81 < lusasGravityLoad.getValue("accX") < 10.0 || 9.81 < lusasGravityLoad.getValue("accY") < 10.0 || 9.81 < lusasGravityLoad.getValue("accZ") < 10.0)) + if (! + ((9.81 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) + || (9.81 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) + || (9.81 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0."); + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0 m/s^2."); } } diff --git a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs index 12f6e923..3ffcb591 100644 --- a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs +++ b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs @@ -53,9 +53,12 @@ public static GravityLoad ToGravityLoad(IFLoading lusasGravityLoad, Z = lusasGravityLoad.getValue("accZ") / 9.806 }; - if (!(9.81 < lusasGravityLoad.getValue("accX") < 10.0 || 9.81 < lusasGravityLoad.getValue("accY") < 10.0 || 9.81 < lusasGravityLoad.getValue("accZ") < 10.0)) + if (! + ((9.81 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) + || (9.81 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) + || (9.81 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0."); + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} outside of the range 9.81 to 10.0."); } IEnumerable assignedObjects = GetGeometryAssignments( From 927f215ddf57597f07b2db0cc2756da5e88f9f65 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Mon, 27 Nov 2023 17:29:51 +0000 Subject: [PATCH 05/14] Update to values for g. --- Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs | 10 +++++----- .../Convert/ToBHoM/Loads/ToGravityLoad.cs | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs index a21f5cc2..e5540852 100644 --- a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs +++ b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs @@ -56,13 +56,13 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu else { lusasGravityLoad = d_LusasData.createLoadingBody(gravityLoad.Name); - lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * 9.806, gravityLoad.GravityDirection.Y * 9.806, gravityLoad.GravityDirection.Z * 9.806); + lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * 9.80665, gravityLoad.GravityDirection.Y * 9.80665, gravityLoad.GravityDirection.Z * 9.80665); if (! - ((9.81 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) - || (9.81 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) - || (9.81 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) + ((9.8 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) + || (9.8 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) + || (9.8 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.81 to 10.0 m/s^2."); + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.8 to 10.0 m/s^2."); } } diff --git a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs index 3ffcb591..d0625e9c 100644 --- a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs +++ b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs @@ -48,17 +48,17 @@ public static GravityLoad ToGravityLoad(IFLoading lusasGravityLoad, Loadcase loadcase = ToLoadcase(assignedLoadcase); Vector gravityVector = new Vector { - X = lusasGravityLoad.getValue("accX") / 9.806, - Y = lusasGravityLoad.getValue("accY") / 9.806, - Z = lusasGravityLoad.getValue("accZ") / 9.806 + X = lusasGravityLoad.getValue("accX") / 9.80665, + Y = lusasGravityLoad.getValue("accY") / 9.80665, + Z = lusasGravityLoad.getValue("accZ") / 9.80665 }; if (! - ((9.81 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) - || (9.81 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) - || (9.81 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) + ((9.8 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) + || (9.8 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) + || (9.8 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} outside of the range 9.81 to 10.0."); + Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} outside of the range 9.8 to 10.0."); } IEnumerable assignedObjects = GetGeometryAssignments( From 7f0702cfb47f74a9cf3dd3796f11d9af65db2eec Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 11:44:46 +0000 Subject: [PATCH 06/14] Making g global variable set in the Adapter. Changes to methods to use g. --- Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs | 11 ++--------- Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs | 4 ++-- .../Convert/ToBHoM/Loads/ToGravityLoad.cs | 18 ++++++------------ Lusas_Adapter/LusasAdapter.cs | 3 +++ Lusas_Engine/Create/LusasSettings.cs | 5 ++++- Lusas_oM/Settings/LusasSettings.cs | 3 +++ 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs index e5540852..fa2f2fd4 100644 --- a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs +++ b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs @@ -48,7 +48,7 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu { IFLoadingBody lusasGravityLoad; IFLoadcase assignedLoadcase = (IFLoadcase)d_LusasData.getLoadset(gravityLoad.Loadcase.AdapterId(typeof(LusasId))); - + if (d_LusasData.existsAttribute("Loading", gravityLoad.Name)) { lusasGravityLoad = (IFLoadingBody)d_LusasData.getAttributes("Loading", gravityLoad.Name); @@ -56,14 +56,7 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu else { lusasGravityLoad = d_LusasData.createLoadingBody(gravityLoad.Name); - lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * 9.80665, gravityLoad.GravityDirection.Y * 9.80665, gravityLoad.GravityDirection.Z * 9.80665); - if (! - ((9.8 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) - || (9.8 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) - || (9.8 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) - { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} is outside of the range 9.8 to 10.0 m/s^2."); - } + lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * g, gravityLoad.GravityDirection.Y * g, gravityLoad.GravityDirection.Z * g); } IFAssignment lusasAssignment = m_LusasApplication.assignment(); diff --git a/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs b/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs index a795e756..70d491ec 100644 --- a/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs +++ b/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs @@ -72,9 +72,9 @@ private List ReadGravityLoads(List ids = null) foreach (IEnumerable groupedAssignment in groupedByLoadcases) { List analysisName = new List { lusasBodyForce.getAttributeType() }; - + GravityLoad gravityLoad = Adapters.Lusas.Convert.ToGravityLoad( - lusasBodyForce, groupedAssignment, nodes, bars, panels); + lusasBodyForce, groupedAssignment, nodes, bars, panels, g); gravityLoad.Tags = new HashSet(analysisName); gravityLoads.Add(gravityLoad); } diff --git a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs index d0625e9c..7c94c404 100644 --- a/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs +++ b/Lusas_Adapter/Convert/ToBHoM/Loads/ToGravityLoad.cs @@ -42,25 +42,19 @@ public static GravityLoad ToGravityLoad(IFLoading lusasGravityLoad, IEnumerable lusasAssignments, Dictionary nodes, Dictionary bars, - Dictionary panels) + Dictionary panels, + double g) + { IFLoadcase assignedLoadcase = (IFLoadcase)lusasAssignments.First().getAssignmentLoadset(); Loadcase loadcase = ToLoadcase(assignedLoadcase); Vector gravityVector = new Vector { - X = lusasGravityLoad.getValue("accX") / 9.80665, - Y = lusasGravityLoad.getValue("accY") / 9.80665, - Z = lusasGravityLoad.getValue("accZ") / 9.80665 + X = lusasGravityLoad.getValue("accX") / g, + Y = lusasGravityLoad.getValue("accY") / g, + Z = lusasGravityLoad.getValue("accZ") / g }; - if (! - ((9.8 < lusasGravityLoad.getValue("accX") && lusasGravityLoad.getValue("accX") < 10.0 || lusasGravityLoad.getValue("accX") == 0.0) - || (9.8 < lusasGravityLoad.getValue("accY") && lusasGravityLoad.getValue("accY") < 10.0 || lusasGravityLoad.getValue("accY") == 0.0) - || (9.8 < lusasGravityLoad.getValue("accZ") && lusasGravityLoad.getValue("accZ") < 10.0 || lusasGravityLoad.getValue("accZ") == 0.0))) - { - Engine.Base.Compute.RecordWarning($"The the gravitational acceleration of {lusasGravityLoad.getName()} outside of the range 9.8 to 10.0."); - } - IEnumerable assignedObjects = GetGeometryAssignments( lusasAssignments, nodes, bars, panels); GravityLoad gravityLoad = Engine.Structure.Create.GravityLoad( diff --git a/Lusas_Adapter/LusasAdapter.cs b/Lusas_Adapter/LusasAdapter.cs index 54379947..3aa63fd6 100644 --- a/Lusas_Adapter/LusasAdapter.cs +++ b/Lusas_Adapter/LusasAdapter.cs @@ -169,6 +169,8 @@ public LusasV17Adapter(string filePath, LusasSettings lusasSettings = null, bool m_mergeTolerance = lusasSettings.MergeTolerance; d_LusasData.getOptions().setDouble("TOLMRG", m_mergeTolerance); } + + if (lusasSettings != null) { g = lusasSettings.GravitationalForceEquivalent; } } } } @@ -190,6 +192,7 @@ public static bool IsApplicationRunning() private string m_directory; public double m_mergeTolerance = double.NaN; + public double g = 9.807; public LusasWinApp m_LusasApplication; public IFDatabase d_LusasData; private Dictionary>> m_tags = new Dictionary>>(); diff --git a/Lusas_Engine/Create/LusasSettings.cs b/Lusas_Engine/Create/LusasSettings.cs index 6725e3f4..001b3cf8 100644 --- a/Lusas_Engine/Create/LusasSettings.cs +++ b/Lusas_Engine/Create/LusasSettings.cs @@ -36,8 +36,9 @@ public static partial class Create [Description("Lusas adapter settings.")] [Input("mergeTolerance", "Sets the merging tolerance used in Lusas.")] [Input("librarySettings", "Sets the library settings.")] + [Input("m_g", "Sets the gravitational force equivalent. Used when converting gravitaional loads between BHoM and Lusas.")] [Output("Lusas specific adapter settings to be used by the adapter.")] - public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null) + public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double m_g = 9.807) { LusasSettings lusasSettings = new LusasSettings(); @@ -46,6 +47,8 @@ public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings if (librarySettings != null) lusasSettings.LibrarySettings = librarySettings; + lusasSettings.GravitationalForceEquivalent = m_g; + return lusasSettings; } /***************************************************/ diff --git a/Lusas_oM/Settings/LusasSettings.cs b/Lusas_oM/Settings/LusasSettings.cs index 25be71bb..097dfdbf 100644 --- a/Lusas_oM/Settings/LusasSettings.cs +++ b/Lusas_oM/Settings/LusasSettings.cs @@ -38,6 +38,9 @@ public class LusasSettings : AdapterSettings [Description("Sets the library settings.")] public virtual LibrarySettings LibrarySettings { get; set; } = new LibrarySettings(); + [Description("Sets the gravitational force equivalent. Used when converting gravity loads between BHoM and Lusas.")] + public virtual double GravitationalForceEquivalent { get; set; } = 9.807; + /***************************************************/ } } From f04d3b272f6dc57826f45fb7aa1a9a78497c53b5 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 12:26:31 +0000 Subject: [PATCH 07/14] Change to description. --- Lusas_Engine/Create/LusasSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lusas_Engine/Create/LusasSettings.cs b/Lusas_Engine/Create/LusasSettings.cs index 001b3cf8..3d61642a 100644 --- a/Lusas_Engine/Create/LusasSettings.cs +++ b/Lusas_Engine/Create/LusasSettings.cs @@ -36,7 +36,7 @@ public static partial class Create [Description("Lusas adapter settings.")] [Input("mergeTolerance", "Sets the merging tolerance used in Lusas.")] [Input("librarySettings", "Sets the library settings.")] - [Input("m_g", "Sets the gravitational force equivalent. Used when converting gravitaional loads between BHoM and Lusas.")] + [Input("m_g", "Sets the gravitational force equivalent. Used when converting gravity loads between BHoM and Lusas.")] [Output("Lusas specific adapter settings to be used by the adapter.")] public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double m_g = 9.807) { From fb392c7210e791bf1645685c554b98d4a0d7647e Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 14:15:44 +0000 Subject: [PATCH 08/14] Update Lusas_Engine/Create/LusasSettings.cs Description. Co-authored-by: Peter Nugent --- Lusas_Engine/Create/LusasSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lusas_Engine/Create/LusasSettings.cs b/Lusas_Engine/Create/LusasSettings.cs index 3d61642a..143b0ee0 100644 --- a/Lusas_Engine/Create/LusasSettings.cs +++ b/Lusas_Engine/Create/LusasSettings.cs @@ -36,7 +36,7 @@ public static partial class Create [Description("Lusas adapter settings.")] [Input("mergeTolerance", "Sets the merging tolerance used in Lusas.")] [Input("librarySettings", "Sets the library settings.")] - [Input("m_g", "Sets the gravitational force equivalent. Used when converting gravity loads between BHoM and Lusas.")] + [Input("g", "Sets the standard gravity i.e. the acceleration due to gravity. This is used when GravityLoads are pushed/pulled from Lusas as the BHoM uses a factor of g, whereas Lusas uses a specific acceleration.")] [Output("Lusas specific adapter settings to be used by the adapter.")] public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double m_g = 9.807) { From 15b358c6d0f42485d7b43ee04b4e75249f3371de Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 14:18:52 +0000 Subject: [PATCH 09/14] Update Variable `g` name and value in LusasAdapter.cs Co-authored-by: Peter Nugent --- Lusas_Adapter/LusasAdapter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lusas_Adapter/LusasAdapter.cs b/Lusas_Adapter/LusasAdapter.cs index 3aa63fd6..93c958b0 100644 --- a/Lusas_Adapter/LusasAdapter.cs +++ b/Lusas_Adapter/LusasAdapter.cs @@ -192,7 +192,7 @@ public static bool IsApplicationRunning() private string m_directory; public double m_mergeTolerance = double.NaN; - public double g = 9.807; + public double m_g = 9.807; public LusasWinApp m_LusasApplication; public IFDatabase d_LusasData; private Dictionary>> m_tags = new Dictionary>>(); From 6d08dae2cbd5defaa1b431476975bec699dc41eb Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 14:19:31 +0000 Subject: [PATCH 10/14] Update variable naming of g in LusasSettings.cs Co-authored-by: Peter Nugent --- Lusas_Engine/Create/LusasSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lusas_Engine/Create/LusasSettings.cs b/Lusas_Engine/Create/LusasSettings.cs index 143b0ee0..c9c95792 100644 --- a/Lusas_Engine/Create/LusasSettings.cs +++ b/Lusas_Engine/Create/LusasSettings.cs @@ -38,7 +38,7 @@ public static partial class Create [Input("librarySettings", "Sets the library settings.")] [Input("g", "Sets the standard gravity i.e. the acceleration due to gravity. This is used when GravityLoads are pushed/pulled from Lusas as the BHoM uses a factor of g, whereas Lusas uses a specific acceleration.")] [Output("Lusas specific adapter settings to be used by the adapter.")] - public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double m_g = 9.807) + public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double g = 9.807) { LusasSettings lusasSettings = new LusasSettings(); From d755680f755c7eb29798531db4670419c92c1020 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 14:19:49 +0000 Subject: [PATCH 11/14] Update variable naming of g in LusasSettings.cs Co-authored-by: Peter Nugent --- Lusas_Engine/Create/LusasSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lusas_Engine/Create/LusasSettings.cs b/Lusas_Engine/Create/LusasSettings.cs index c9c95792..0efdb391 100644 --- a/Lusas_Engine/Create/LusasSettings.cs +++ b/Lusas_Engine/Create/LusasSettings.cs @@ -47,7 +47,7 @@ public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings if (librarySettings != null) lusasSettings.LibrarySettings = librarySettings; - lusasSettings.GravitationalForceEquivalent = m_g; + lusasSettings.GravitationalForceEquivalent = g; return lusasSettings; } From ec534db856a7731480f82460517c0743ca833553 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 14:21:28 +0000 Subject: [PATCH 12/14] Update to description and value of StandardGravity in LusasSettings.cs Co-authored-by: Peter Nugent --- Lusas_oM/Settings/LusasSettings.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lusas_oM/Settings/LusasSettings.cs b/Lusas_oM/Settings/LusasSettings.cs index 097dfdbf..02b1d404 100644 --- a/Lusas_oM/Settings/LusasSettings.cs +++ b/Lusas_oM/Settings/LusasSettings.cs @@ -38,8 +38,9 @@ public class LusasSettings : AdapterSettings [Description("Sets the library settings.")] public virtual LibrarySettings LibrarySettings { get; set; } = new LibrarySettings(); - [Description("Sets the gravitational force equivalent. Used when converting gravity loads between BHoM and Lusas.")] - public virtual double GravitationalForceEquivalent { get; set; } = 9.807; + [Acceleration] + [Description("Sets the standard gravity i.e. the acceleration due to gravity. This is used when GravityLoads are pushed/pulled from Lusas as the BHoM uses a factor of g, whereas Lusas uses a specific acceleration.")] + public virtual double StandardGravity { get; set; } = 9.80665; /***************************************************/ } From f6e7a35a1e05edb9436d976cb5a0477b589aa0c4 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 14:50:44 +0000 Subject: [PATCH 13/14] Updates to variable naming and g value from 3 to 5 decimel places. --- Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs | 2 +- Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs | 2 +- Lusas_Adapter/LusasAdapter.cs | 4 ++-- Lusas_Engine/Create/LusasSettings.cs | 4 ++-- Lusas_oM/Settings/LusasSettings.cs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs index fa2f2fd4..79fcd780 100644 --- a/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs +++ b/Lusas_Adapter/CRUD/Create/Loads/GravityLoad.cs @@ -56,7 +56,7 @@ private IFLoadingBody CreateGravityLoad(GravityLoad gravityLoad, IFGeometry[] lu else { lusasGravityLoad = d_LusasData.createLoadingBody(gravityLoad.Name); - lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * g, gravityLoad.GravityDirection.Y * g, gravityLoad.GravityDirection.Z * g); + lusasGravityLoad.setBody(gravityLoad.GravityDirection.X * m_g, gravityLoad.GravityDirection.Y * m_g, gravityLoad.GravityDirection.Z * m_g); } IFAssignment lusasAssignment = m_LusasApplication.assignment(); diff --git a/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs b/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs index 70d491ec..0a31e98b 100644 --- a/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs +++ b/Lusas_Adapter/CRUD/Read/Loads/GravityLoads.cs @@ -74,7 +74,7 @@ private List ReadGravityLoads(List ids = null) List analysisName = new List { lusasBodyForce.getAttributeType() }; GravityLoad gravityLoad = Adapters.Lusas.Convert.ToGravityLoad( - lusasBodyForce, groupedAssignment, nodes, bars, panels, g); + lusasBodyForce, groupedAssignment, nodes, bars, panels, m_g); gravityLoad.Tags = new HashSet(analysisName); gravityLoads.Add(gravityLoad); } diff --git a/Lusas_Adapter/LusasAdapter.cs b/Lusas_Adapter/LusasAdapter.cs index 93c958b0..47409022 100644 --- a/Lusas_Adapter/LusasAdapter.cs +++ b/Lusas_Adapter/LusasAdapter.cs @@ -170,7 +170,7 @@ public LusasV17Adapter(string filePath, LusasSettings lusasSettings = null, bool d_LusasData.getOptions().setDouble("TOLMRG", m_mergeTolerance); } - if (lusasSettings != null) { g = lusasSettings.GravitationalForceEquivalent; } + if (lusasSettings != null) { m_g = lusasSettings.StandardGravity; } } } } @@ -192,7 +192,7 @@ public static bool IsApplicationRunning() private string m_directory; public double m_mergeTolerance = double.NaN; - public double m_g = 9.807; + public double m_g = 9.80665; public LusasWinApp m_LusasApplication; public IFDatabase d_LusasData; private Dictionary>> m_tags = new Dictionary>>(); diff --git a/Lusas_Engine/Create/LusasSettings.cs b/Lusas_Engine/Create/LusasSettings.cs index 0efdb391..53c72781 100644 --- a/Lusas_Engine/Create/LusasSettings.cs +++ b/Lusas_Engine/Create/LusasSettings.cs @@ -38,7 +38,7 @@ public static partial class Create [Input("librarySettings", "Sets the library settings.")] [Input("g", "Sets the standard gravity i.e. the acceleration due to gravity. This is used when GravityLoads are pushed/pulled from Lusas as the BHoM uses a factor of g, whereas Lusas uses a specific acceleration.")] [Output("Lusas specific adapter settings to be used by the adapter.")] - public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double g = 9.807) + public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings librarySettings = null, double g = 9.80665) { LusasSettings lusasSettings = new LusasSettings(); @@ -47,7 +47,7 @@ public static LusasSettings LusasSettings(double mergeTolerance, LibrarySettings if (librarySettings != null) lusasSettings.LibrarySettings = librarySettings; - lusasSettings.GravitationalForceEquivalent = g; + lusasSettings.StandardGravity = g; return lusasSettings; } diff --git a/Lusas_oM/Settings/LusasSettings.cs b/Lusas_oM/Settings/LusasSettings.cs index 02b1d404..a30c1852 100644 --- a/Lusas_oM/Settings/LusasSettings.cs +++ b/Lusas_oM/Settings/LusasSettings.cs @@ -38,7 +38,7 @@ public class LusasSettings : AdapterSettings [Description("Sets the library settings.")] public virtual LibrarySettings LibrarySettings { get; set; } = new LibrarySettings(); - [Acceleration] + //[Acceleration] [Description("Sets the standard gravity i.e. the acceleration due to gravity. This is used when GravityLoads are pushed/pulled from Lusas as the BHoM uses a factor of g, whereas Lusas uses a specific acceleration.")] public virtual double StandardGravity { get; set; } = 9.80665; From fbecebc34296ed6b96561a77bdba0510bde5ac97 Mon Sep 17 00:00:00 2001 From: Kalle Edstroem Date: Wed, 29 Nov 2023 15:18:30 +0000 Subject: [PATCH 14/14] Update to attribute of StandardGravity in LusasSettings.cs. Added reference to Quantities_oM. --- Lusas_oM/Lusas_oM.csproj | 5 +++++ Lusas_oM/Settings/LusasSettings.cs | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lusas_oM/Lusas_oM.csproj b/Lusas_oM/Lusas_oM.csproj index c2b14337..ee99487f 100644 --- a/Lusas_oM/Lusas_oM.csproj +++ b/Lusas_oM/Lusas_oM.csproj @@ -143,6 +143,11 @@ $(ProgramData)\BHoM\Assemblies\Geometry_oM.dll False False + + + $(ProgramData)\BHoM\Assemblies\Quantities_oM.dll + False + False diff --git a/Lusas_oM/Settings/LusasSettings.cs b/Lusas_oM/Settings/LusasSettings.cs index a30c1852..d39bdfd6 100644 --- a/Lusas_oM/Settings/LusasSettings.cs +++ b/Lusas_oM/Settings/LusasSettings.cs @@ -23,6 +23,7 @@ using BH.oM.Base; using System.ComponentModel; using BH.oM.Adapter; +using BH.oM.Quantities.Attributes; namespace BH.oM.Adapters.Lusas { @@ -31,14 +32,14 @@ public class LusasSettings : AdapterSettings /***************************************************/ /**** Public Properties ****/ /***************************************************/ - + [Description("Sets the merging tolerance used in Lusas.")] public virtual double MergeTolerance { get; set; } = double.NaN; [Description("Sets the library settings.")] public virtual LibrarySettings LibrarySettings { get; set; } = new LibrarySettings(); - //[Acceleration] + [Acceleration] [Description("Sets the standard gravity i.e. the acceleration due to gravity. This is used when GravityLoads are pushed/pulled from Lusas as the BHoM uses a factor of g, whereas Lusas uses a specific acceleration.")] public virtual double StandardGravity { get; set; } = 9.80665;