Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure_Engine: Add required methods for Cassette and BuiltUpRibbed properties #3311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Structure_Engine/Query/Description.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,32 @@ public static string Description(this Ribbed property)

/***************************************************/

[Description("Generates a default description for the SurfaceProperty.")]
[Input("property", "The SurfaceProperty to get a default description for.")]
[Output("desc", "The generated description for the property based on its dimensions, material and type.")]
public static string Description(this BuiltUpRibbed property)
{
if (property == null)
return "null property";

return $"Ribbed: {property.TopThickness:G3} THK slab {CheckGetMaterialName(property.Material)} on {property.RibHeight:G3}x{property.RibThickness:G3} ribs {CheckGetMaterialName(property.RibMaterial ?? property.Material)} spaced {property.RibSpacing:G3}";
}

/***************************************************/

[Description("Generates a default description for the SurfaceProperty.")]
[Input("property", "The SurfaceProperty to get a default description for.")]
[Output("desc", "The generated description for the property based on its dimensions, material and type.")]
public static string Description(this Cassette property)
{
if (property == null)
return "null property";

return $"Cassette Top: {property.TopThickness:G3} THK {CheckGetMaterialName(property.Material)} Bot: {property.BottomThickness:G3} THK {CheckGetMaterialName(property.BottomMaterial ?? property.Material)} Ribs: {property.RibHeight:G3}x{property.RibThickness:G3} {CheckGetMaterialName(property.RibMaterial ?? property.Material)} spaced {property.RibSpacing:G3}";
}

/***************************************************/

[Description("Generates a default description for the SurfaceProperty as 'Ribbed DepthX DepthY SpacingX SpacingY StemWidthX StemWidthY - MaterialName'.")]
[Input("property", "The SurfaceProperty to get a default description for.")]
[Output("desc", "The generated description for the property based on its dimensions, material and type.")]
Expand Down
47 changes: 46 additions & 1 deletion Structure_Engine/Query/MassPerArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,57 @@ public static double MassPerArea(this CorrugatedDeck property)
[PreviousInputNames("property","loadingPanelProperty")]
[Description("Gets the mass per area for a LoadingPanelProperty. This will always return 0.")]
[Input("property", "The LoadingPanelProperty property to calculate the mass per area for.")]
[Output("massPerArea", "The mass per area for the property. THis will always return 0 for a LoadingPanelProperty.", typeof(MassPerUnitArea))]
[Output("massPerArea", "The mass per area for the property. This will always return 0 for a LoadingPanelProperty.", typeof(MassPerUnitArea))]
public static double MassPerArea(this LoadingPanelProperty property)
{
return 0;
}


/***************************************************/

[Description("Gets the mass per area for a Cassette.")]
[Input("property", "The Cassette property to calculate the mass per area for.")]
[Output("massPerArea", "The mass per area for the property.", typeof(MassPerUnitArea))]
public static double MassPerArea(this Cassette property)
{
if (property.IsNull() || property.Material.IsNull())
return double.NaN;

if (property.RibThickness <= 0 || property.RibSpacing < property.RibThickness)
{
Base.Compute.RecordError($"The {nameof(Cassette.RibThickness)} is 0 or {nameof(Cassette.RibSpacing)} smaller than {nameof(Cassette.RibThickness)}. The {nameof(Cassette)} is invalid and mass per area cannot be computed.");
return double.NaN;
}

double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);
return property.TopThickness * property.Material.Density +
property.BottomThickness * (property.BottomMaterial ?? property.Material).Density +
volPerAreaRibZone * (property.RibMaterial ?? property.Material).Density;
}

/***************************************************/

[Description("Gets the mass per area for a BuiltUpRibbed.")]
[Input("property", "The BuiltUpRibbed property to calculate the mass per area for.")]
[Output("massPerArea", "The mass per area for the property.", typeof(MassPerUnitArea))]
public static double MassPerArea(this BuiltUpRibbed property)
{
if (property.IsNull() || property.Material.IsNull())
return double.NaN;

if (property.RibThickness <= 0 || property.RibSpacing < property.RibThickness)
{
Base.Compute.RecordError($"The {nameof(BuiltUpRibbed.RibThickness)} is 0 or {nameof(BuiltUpRibbed.RibSpacing)} smaller than {nameof(BuiltUpRibbed.RibThickness)}. The {nameof(BuiltUpRibbed)} is invalid and mass per area cannot be computed.");
return double.NaN;
}

double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);
return property.TopThickness * property.Material.Density +
volPerAreaRibZone * (property.RibMaterial ?? property.Material).Density;
}


/***************************************************/
/**** Public Methods - Interfaces ****/
/***************************************************/
Expand Down
59 changes: 58 additions & 1 deletion Structure_Engine/Query/MaterialComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,62 @@
);
}

/***************************************************/

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this Cassette property, ReinforcementDensity reinforcementDensity = null)
{
if (property.IsNull() || property.Material.IsNull())
return null;

//If only main material provided, use it for all parts
if (property.RibMaterial == null && property.BottomMaterial == null)
return property.Material.MaterialComposition(reinforcementDensity);

IMaterialFragment topMat = property.Material;
IMaterialFragment bottomMat = property.BottomMaterial ?? property.Material;
IMaterialFragment ribMat = property.RibMaterial ?? property.Material;
double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);

return Matter.Compute.AggregateMaterialComposition(new List<MaterialComposition>
{
topMat.MaterialComposition(reinforcementDensity),
bottomMat.MaterialComposition(reinforcementDensity),
ribMat.MaterialComposition(reinforcementDensity)
},
new List<double> { property.TopThickness, property.BottomThickness, volPerAreaRibZone });
}

/***************************************************/

[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Input("reinforcementDensity", "ReinforcementDensity assigned to the panel.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition MaterialComposition(this BuiltUpRibbed property, ReinforcementDensity reinforcementDensity = null)
{
if (property.IsNull() || property.Material.IsNull())
return null;

//If only main material provided, use it for all parts
if (property.RibMaterial == null)
return property.Material.MaterialComposition(reinforcementDensity);

IMaterialFragment topMat = property.Material;
IMaterialFragment ribMat = property.RibMaterial ?? property.Material;
double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);
return Matter.Compute.AggregateMaterialComposition(new List<MaterialComposition>
{
topMat.MaterialComposition(reinforcementDensity),
ribMat.MaterialComposition(reinforcementDensity)
},
new List<double> { property.TopThickness, volPerAreaRibZone });
}


/***************************************************/

[Description("Returns a Pile's homogeneous MaterialComposition.")]
Expand Down Expand Up @@ -308,7 +364,7 @@
[Description("Returns a SurfaceProperty's MaterialComposition.")]
[Input("property", "The SurfaceProperty to query.")]
[Output("materialComposition", "The MaterialComposition of the SurfaceProperty.")]
public static MaterialComposition IMaterialComposition(this ISurfaceProperty property, ReinforcementDensity reinforcementDensity = null)

Check warning on line 367 in Structure_Engine/Query/MaterialComposition.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Structure_Engine/Query/MaterialComposition.cs#L367

Input parameter requires a matching Input attribute - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/IsInputAttributePresent
{
if (property.IsNull()) //Specific MaterialComposition(SurfaceProp) methods must check for material null- some properties ignore the base material.
return null;
Expand Down Expand Up @@ -352,7 +408,7 @@

private static MaterialComposition MaterialComposition(this IMaterialFragment baseMaterial, ReinforcementDensity reinforcementDensity)
{
if (reinforcementDensity.Material == null || reinforcementDensity.Material.Density == 0 || reinforcementDensity.Density == 0)
if (reinforcementDensity?.Material == null || reinforcementDensity.Material.Density == 0 || reinforcementDensity.Density == 0)
return (MaterialComposition)Physical.Create.Material(baseMaterial);

if (reinforcementDensity.Material.Density < 0)
Expand Down Expand Up @@ -380,6 +436,7 @@

/***************************************************/


}
}

Expand Down
27 changes: 27 additions & 0 deletions Structure_Engine/Query/TotalThickness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,33 @@ public static double TotalThickness(this ToppedSlab property)
return property.BaseProperty.ITotalThickness() + property.ToppingThickness;
}

/***************************************************/

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this Cassette property)
{
if (property.IsNull())
return 0;

return property.TopThickness + property.BottomThickness + property.RibHeight;
}

/***************************************************/

[Description("Gets the total thickness of the surface property.")]
[Input("property", "The property to evaluate.")]
[Output("TotalThickness", "The total thickness, including any ribs or waffling.", typeof(Length))]
public static double TotalThickness(this BuiltUpRibbed property)
{
if (property.IsNull())
return 0;

return property.TopThickness + property.RibHeight;
}


/***************************************************/
/**** Public Methods - Interfaces ****/
/***************************************************/
Expand Down
40 changes: 40 additions & 0 deletions Structure_Engine/Query/VolumePerArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,46 @@ public static double VolumePerArea(this ToppedSlab property)
return property.BaseProperty.IVolumePerArea() + property.ToppingThickness;
}

/***************************************************/

[Description("Gets the volume per area of the property for the purpose of calculating solid volume.")]
[Input("property", "The property to evaluate the volume per area of.")]
[Output("volumePerArea", "The volume per area of the property for the purpose of calculating solid volume.", typeof(Length))]
public static double VolumePerArea(this Cassette property)
{
if (property.IsNull())
return double.NaN;

if (property.RibThickness <= 0 || property.RibSpacing < property.RibThickness)
{
Base.Compute.RecordError($"The {nameof(Cassette.RibThickness)} is 0 or {nameof(Cassette.RibSpacing)} smaller than {nameof(Cassette.RibThickness)}. The {nameof(Cassette)} is invalid and volume cannot be computed.");
return double.NaN;
}

double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);
return property.TopThickness + property.BottomThickness + volPerAreaRibZone;
}


/***************************************************/

[Description("Gets the volume per area of the property for the purpose of calculating solid volume.")]
[Input("property", "The property to evaluate the volume per area of.")]
[Output("volumePerArea", "The volume per area of the property for the purpose of calculating solid volume.", typeof(Length))]
public static double VolumePerArea(this BuiltUpRibbed property)
{
if (property.IsNull())
return double.NaN;

if (property.RibThickness <= 0 || property.RibSpacing < property.RibThickness)
{
Base.Compute.RecordError($"The {nameof(BuiltUpRibbed.RibThickness)} is 0 or {nameof(BuiltUpRibbed.RibSpacing)} smaller than {nameof(BuiltUpRibbed.RibThickness)}. The {nameof(BuiltUpRibbed)} is invalid and volume cannot be computed.");
return double.NaN;
}

double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);
return property.TopThickness + volPerAreaRibZone;
}
/***************************************************/
/**** Public Methods - Interfaces ****/
/***************************************************/
Expand Down