Skip to content

Commit

Permalink
Structure_Engine: Add required methods for Cassette and BuiltUpRibbed…
Browse files Browse the repository at this point in the history
… properties (#3311)
  • Loading branch information
Fraser Greenroyd authored Mar 5, 2024
2 parents 55ad027 + e4b8fb5 commit 5bcc6bb
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 2 deletions.
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 @@ public static MaterialComposition MaterialComposition(this SlabOnDeck property,
);
}

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

[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 @@ -352,7 +408,7 @@ private static MaterialComposition MaterialComposition(this ISurfaceProperty pro

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 @@ private static MaterialComposition MaterialComposition(this IMaterialFragment ba

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


}
}

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

0 comments on commit 5bcc6bb

Please sign in to comment.