Thanks for the reply @jeremytammik . You are absolutely right that that is an error in that snippet (and a dumb one at that haha) however even after going through and double checking the conversions that aren't related to just the volume they're still out by a huge factor. There's obviously something going on that's more complicated than I'm understanding.
The volume appears to be correct now however the other calculations are all based upon the density and that is waaaay out. It should be 7850kg/m3 (490 PCF)
Modified Code:
private double GetDensity(Material material)
{
double density = 0.0;
var structuralAsset = a_doc.GetElement(material.StructuralAssetId);
if (structuralAsset != null)
{
var densityParam = structuralAsset.GetParameters("Density");
density = densityParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(densityParam[0].AsDouble(), DisplayUnitType.DUT_KILOGRAMS_PER_CUBIC_METER) : 0.0;
if (density == 0.0)
{
var unitWeightParam = structuralAsset.GetParameters("Unit weight");
density = unitWeightParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(unitWeightParam[0].AsDouble(), DisplayUnitType.DUT_KILOGRAMS_PER_CUBIC_METER) : 0.0;
}
}
return density;
}
Original:
{
double density = 0.0;
var structuralAsset = a_doc.GetElement(material.StructuralAssetId);
if (structuralAsset != null)
{
var densityParam = structuralAsset.GetParameters("Density");
density = densityParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(densityParam[0].AsDouble(), DisplayUnitType.DUT_POUNDS_MASS_PER_CUBIC_FOOT) : 0.0;
if (density == 0.0)
{
var unitWeightParam = structuralAsset.GetParameters("Unit weight");
density = unitWeightParam.Count() > 0 ? UnitUtils.ConvertFromInternalUnits(unitWeightParam[0].AsDouble(), DisplayUnitType.DUT_POUNDS_FORCE_PER_CUBIC_FOOT) : 0.0;
}
}
return density;
}
If I'm understanding correctly, it's pulling the material density from the imbedded material data, is it possible that it's taking the material and then multiplying it for the conversion or something like that?
Those two bits of program translate to 252657kg/m3 in the modified metric program and 490PCF (correct) in the imperial one.
Thanks for your time, as I said before I'm well out of my depth but we're pretty desperate for a program to calculate our embodied carbon (it's a big issue over here and something that has a lot of movement behind it) and unfortunately all the other plugins and programs I've looked at are far too complex for the simple calculations a structural engineering company wants and because of that complexity are priced far too high to be feasible.
Cheers,
Rob