First time here? Check out the Help page!
1 | initial version |
Here is some code borrowed from the Office and K12 AEDG envelope measures.
# make new material
exposedMaterialNew = OpenStudio::Model::StandardOpaqueMaterial.new(construction.model)
exposedMaterialNew.setName(options['name'])
# set requested material properties
if !options['roughness'].nil? then exposedMaterialNew.setRoughness(options['roughness']) end
if !options['thickness'].nil? then exposedMaterialNew.setThickness(options['thickness']) end
if !options['conductivity'].nil? then exposedMaterialNew.setConductivity(options['conductivity']) end
if !options['density'].nil? then exposedMaterialNew.setDensity(options['density']) end
if !options['specificHeat'].nil? then exposedMaterialNew.setSpecificHeat(options['specificHeat']) end
if !options['thermalAbsorptance'].nil? then exposedMaterialNew.setThermalAbsorptance(options['thermalAbsorptance']) end
if !options['solarAbsorptance'].nil? then exposedMaterialNew.setSolarAbsorptance(options['solarAbsorptance']) end
if !options['visibleAbsorptance'].nil? then exposedMaterialNew.setVisibleAbsorptance(options['visibleAbsorptance']) end
# add material to construction
construction.insertLayer(options['layerIndex'], exposedMaterialNew)
In this example options
is a hash that contains data about the new material as well as the target layer index. It is in a resource file in a method named addNewLayerToConstruction
that takes a construction and the options hash.