Skip to content

Structure_Engine: Add method required for new BuiltUpDoubleRibbed surface property #3351

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

Merged
Merged
13 changes: 13 additions & 0 deletions Structure_Engine/Query/Description.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ public static string Description(this BuiltUpRibbed 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 BuiltUpDoubleRibbed property)
{
if (property == null)
return "null property";

return $"Ribbed: {property.TopThickness:G3} THK slab {CheckGetMaterialName(property.Material)} on double {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.")]
Expand Down
20 changes: 20 additions & 0 deletions Structure_Engine/Query/MassPerArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,26 @@ public static double MassPerArea(this BuiltUpRibbed property)
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 BuiltUpDoubleRibbed property)
{
if (property.IsNull() || property.Material.IsNull())
return double.NaN;

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

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

/***************************************************/
/**** Public Methods - Interfaces ****/
Expand Down
57 changes: 57 additions & 0 deletions Structure_Engine/Query/MaterialComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,63 @@
new List<double> { property.TopThickness, 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 BuiltUpDoubleRibbed property, ReinforcementDensity reinforcementDensity = null)
{
if (property.IsNull() || property.Material.IsNull())
return null;

IMaterialFragment topMat = property.Material;
IMaterialFragment ribMat = property.RibMaterial ?? property.Material;

bool reinfToSlab = false;
bool reinfToRib = false;
if (reinforcementDensity != null)
{
bool ribIsConcrete = ribMat is Concrete;
bool topIsConcrete = topMat is Concrete;

if (ribIsConcrete && topIsConcrete) //Both concrete
{
reinfToSlab = true;
reinfToRib = true;
}
else if (ribIsConcrete) //Only rib concrete
{
reinfToRib = true;
Base.Compute.RecordNote($"Only the Ribbs in the in the {nameof(BuiltUpDoubleRibbed)} is made up of a concrete material. Provided {nameof(ReinforcementDensity)} is only applied to the Ribbs.");
}
else if (topIsConcrete) //Only slab concrete
{
reinfToRib = true;
Base.Compute.RecordNote($"Only the Slab in the in the {nameof(BuiltUpDoubleRibbed)} is made up of a concrete material. Provided {nameof(ReinforcementDensity)} is only applied to the Slab.");
}
else //Neither is concrete. Add to both and record a note
{
reinfToSlab = true;
reinfToRib = true;
Base.Compute.RecordNote($"Neither Ribbs or Slab in the {nameof(BuiltUpDoubleRibbed)} is made up of a concrete material. Provided {nameof(ReinforcementDensity)} is applied to both.");

}
}

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

double volPerAreaRibZone = property.RibHeight * (property.RibThickness * 2 / property.RibSpacing);
return Matter.Compute.AggregateMaterialComposition(new List<MaterialComposition>
{
topMat.MaterialComposition(reinfToSlab ? reinforcementDensity : null),
ribMat.MaterialComposition(reinfToRib ? reinforcementDensity : null)
},
new List<double> { property.TopThickness, volPerAreaRibZone });
}

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

Expand Down Expand Up @@ -364,7 +421,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 424 in Structure_Engine/Query/MaterialComposition.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Structure_Engine/Query/MaterialComposition.cs#L424

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
12 changes: 12 additions & 0 deletions Structure_Engine/Query/TotalThickness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ public static double TotalThickness(this BuiltUpRibbed property)
return property.TopThickness + property.RibHeight;
}

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

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

return property.TopThickness + property.RibHeight;
}

/***************************************************/
/**** Public Methods - Interfaces ****/
Expand Down
21 changes: 21 additions & 0 deletions Structure_Engine/Query/VolumePerArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,27 @@ public static double VolumePerArea(this BuiltUpRibbed property)
double volPerAreaRibZone = property.RibHeight * (property.RibThickness / property.RibSpacing);
return property.TopThickness + 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 BuiltUpDoubleRibbed property)
{
if (property.IsNull())
return double.NaN;

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

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

/***************************************************/
/**** Public Methods - Interfaces ****/
/***************************************************/
Expand Down