public static EnergyMaterial ToLadybugTools(this OpaqueMaterial opaqueMaterial) { if (opaqueMaterial == null || string.IsNullOrEmpty(opaqueMaterial.Name)) { return(null); } return(new EnergyMaterial( identifier: opaqueMaterial.Name, thickness: opaqueMaterial.GetValue <double>(MaterialParameter.DefaultThickness), conductivity: opaqueMaterial.ThermalConductivity, density: opaqueMaterial.Density, specificHeat: opaqueMaterial.SpecificHeatCapacity, displayName: opaqueMaterial.DisplayName, userData: null, roughness: Roughness.MediumSmooth, thermalAbsorptance: opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.ExternalEmissivity), solarAbsorptance: 1 - opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.ExternalSolarReflectance), visibleAbsorptance: 1 - opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.ExternalLightReflectance))); }
public static bool UpdateMaterial(this TBD.material material, OpaqueMaterial opaqueMaterial) { if (!string.IsNullOrWhiteSpace(opaqueMaterial.Name) && !opaqueMaterial.Name.Equals(material.name)) { material.name = opaqueMaterial.Name; } material.type = (int)TBD.MaterialTypes.tcdOpaqueMaterial; material.description = opaqueMaterial.Description; material.width = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(MaterialParameter.DefaultThickness)); material.conductivity = System.Convert.ToSingle(opaqueMaterial.ThermalConductivity); material.specificHeat = System.Convert.ToSingle(opaqueMaterial.SpecificHeatCapacity); material.density = System.Convert.ToSingle(opaqueMaterial.Density); material.vapourDiffusionFactor = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(MaterialParameter.VapourDiffusionFactor)); material.externalSolarReflectance = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.ExternalSolarReflectance)); material.internalSolarReflectance = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.InternalSolarReflectance)); material.externalLightReflectance = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.ExternalLightReflectance)); material.internalLightReflectance = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.InternalLightReflectance)); material.externalEmissivity = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.ExternalEmissivity)); material.internalEmissivity = System.Convert.ToSingle(opaqueMaterial.GetValue <double>(OpaqueMaterialParameter.InternalEmissivity)); return(true); }