Question-and-Answer Resource for the Building Energy Modeling Community
Get s tarted with the Help page
Ask Your Question

Revision history [back]

Good question. There isn't a measure doing this yet, but there is some code in the Annual End Use meausre that may be helpful. The code below is used to make a table listing constructions used in the model along with area of each and effective R value.

# summary of exterior constructions used in the model for base surfaces
@surface_data = {}
@surface_data[:title] = 'Construction Summary for Base Surfaces'
@surface_data[:header] = ['Construction','Net Area',"Area Units",'Surface Count','R Value','R Value Units']
@surface_data[:data] = []
ext_const_base = {}
model.getSurfaces.each do |surface|
  next if surface.outsideBoundaryCondition != "Outdoors"
  if ext_const_base.include? surface.construction.get
    ext_const_base[surface.construction.get] += 1
  else
    ext_const_base[surface.construction.get] = 1
  end
end
ext_const_base.sort.each do |construction,count|
  net_area = construction.getNetArea
  net_area_ip = OpenStudio::convert(net_area,"m^2","ft^2").get
  net_area_ip_neat = OpenStudio::toNeatString(net_area_ip,0,true)
  area_units = "ft^2"
  surface_count = count
  thermal_conductance = construction.thermalConductance.get
  source_units = "m^2*K/W"
  target_units = "ft^2*h*R/Btu"
  r_value_ip = OpenStudio::convert(1/thermal_conductance,source_units,target_units).get
  r_value_ip_neat = OpenStudio::toNeatString(r_value_ip,2,true)
  @surface_data[:data] << [construction.name,net_area_ip_neat,area_units,surface_count,r_value_ip_neat,target_units]
  runner.registerValue(construction.name.to_s,net_area_ip,area_units)
end

Now while the construction base does have access to a method called .thermalConductance, there isn't one for .density. @macumber maybe that is something we can add, of course it would be an optional since not all materials have mass, such as No Mass Materials. In that case we would need to decide if that later contributes 0 and calculate the mass we do know about.

@Amir Roth, if you wanted to do this today, you would just loop through the materials used in the material. You can use the method in layered construction .layers to get the materials. You might be getting a standard "StandardOpaqueMaterial" for a layer or "No Mass Material" or "Air Gap Materials" etc. You need to get the object to the right material class. Then for StandardOpaqueMaterial there is a method .getDensity

If you look at a measure that changes the wall performance you can find example code to find and then step through materials.

Good question. There isn't a measure doing this yet, but there is some code in the Annual End Use meausre that may be helpful. The code below is used to make a table listing constructions used in the model along with area of each and effective R value.

# summary of exterior constructions used in the model for base surfaces
@surface_data = {}
@surface_data[:title] = 'Construction Summary for Base Surfaces'
@surface_data[:header] = ['Construction','Net Area',"Area Units",'Surface Count','R Value','R Value Units']
@surface_data[:data] = []
ext_const_base = {}
model.getSurfaces.each do |surface|
  next if surface.outsideBoundaryCondition != "Outdoors"
  if ext_const_base.include? surface.construction.get
    ext_const_base[surface.construction.get] += 1
  else
    ext_const_base[surface.construction.get] = 1
  end
end
ext_const_base.sort.each do |construction,count|
  net_area = construction.getNetArea
  net_area_ip = OpenStudio::convert(net_area,"m^2","ft^2").get
  net_area_ip_neat = OpenStudio::toNeatString(net_area_ip,0,true)
  area_units = "ft^2"
  surface_count = count
  thermal_conductance = construction.thermalConductance.get
  source_units = "m^2*K/W"
  target_units = "ft^2*h*R/Btu"
  r_value_ip = OpenStudio::convert(1/thermal_conductance,source_units,target_units).get
  r_value_ip_neat = OpenStudio::toNeatString(r_value_ip,2,true)
  @surface_data[:data] << [construction.name,net_area_ip_neat,area_units,surface_count,r_value_ip_neat,target_units]
  runner.registerValue(construction.name.to_s,net_area_ip,area_units)
end

Now while the construction base does have access to a method called .thermalConductance, there isn't one for .density. @macumber maybe that is something we can add, of course it would be an optional since not all materials have mass, such as No Mass Materials. In that case we would need to decide if that later layer contributes 0 mass and calculate the mass we do know about.about, or have the optional not initialize.

@Amir Roth, if you wanted to do this today, you would just loop through the materials used in the material. You can use the method in layered construction .layers to get the materials. You might be getting a standard "StandardOpaqueMaterial" for a layer or "No Mass Material" or "Air Gap Materials" etc. You need to get the object to the right material class. Then for StandardOpaqueMaterial there is a method .getDensity

If you look at a measure that changes the wall performance you can find example code to find and then step through materials.

Good question. There isn't a measure doing this yet, but there is some code in the Annual End Use meausre that may be helpful. The code below is used to make a table listing constructions used in the model along with area of each and effective R value.

# summary of exterior constructions used in the model for base surfaces
@surface_data = {}
@surface_data[:title] = 'Construction Summary for Base Surfaces'
@surface_data[:header] = ['Construction','Net Area',"Area Units",'Surface Count','R Value','R Value Units']
@surface_data[:data] = []
ext_const_base = {}
model.getSurfaces.each do |surface|
  next if surface.outsideBoundaryCondition != "Outdoors"
  if ext_const_base.include? surface.construction.get
    ext_const_base[surface.construction.get] += 1
  else
    ext_const_base[surface.construction.get] = 1
  end
end
ext_const_base.sort.each do |construction,count|
  net_area = construction.getNetArea
  net_area_ip = OpenStudio::convert(net_area,"m^2","ft^2").get
  net_area_ip_neat = OpenStudio::toNeatString(net_area_ip,0,true)
  area_units = "ft^2"
  surface_count = count
  thermal_conductance = construction.thermalConductance.get
  source_units = "m^2*K/W"
  target_units = "ft^2*h*R/Btu"
  r_value_ip = OpenStudio::convert(1/thermal_conductance,source_units,target_units).get
  r_value_ip_neat = OpenStudio::toNeatString(r_value_ip,2,true)
  @surface_data[:data] << [construction.name,net_area_ip_neat,area_units,surface_count,r_value_ip_neat,target_units]
  runner.registerValue(construction.name.to_s,net_area_ip,area_units)
end

Now while the construction base does have access to a method called .thermalConductance, there isn't one for .density. @macumber maybe that is something we can add, of course it would be an optional since not all materials have mass, such as No Mass Materials. In that case we would need to decide if that layer contributes 0 mass and calculate the mass we do know about, or have the optional not initialize.

@Amir Roth, if you wanted to do this today, you would just loop through the materials used in the material. You can use the method in layered construction .layers to get the materials. You might be getting a standard "StandardOpaqueMaterial" for a layer or "No Mass Material" or "Air Gap Materials" etc. You need to get the object to the right material class. Then for StandardOpaqueMaterial there is a method .getDensity.density

If you look at a measure that changes the wall performance you can find example code to find and then step through materials.materials. It would be something like this.

  construction_layers = construction.layers
  construction_layers.each do |construction_layer|
    if construction_layer.to_OpaqueMaterial.is_initialized
    construction_layer_r_value = construction_layer.to_OpaqueMaterial.get.density
    # you also need to get thickness to get this layers contribution to total construction mass
    else
      # add elsif to handle other material types  
    end
  end

Good question. There isn't a measure doing this yet, but there is some code in the Annual End Use meausre that may be helpful. The code below is used to make a table listing constructions used in the model along with area of each and effective R value.

# summary of exterior constructions used in the model for base surfaces
@surface_data = {}
@surface_data[:title] = 'Construction Summary for Base Surfaces'
@surface_data[:header] = ['Construction','Net Area',"Area Units",'Surface Count','R Value','R Value Units']
@surface_data[:data] = []
ext_const_base = {}
model.getSurfaces.each do |surface|
  next if surface.outsideBoundaryCondition != "Outdoors"
  if ext_const_base.include? surface.construction.get
    ext_const_base[surface.construction.get] += 1
  else
    ext_const_base[surface.construction.get] = 1
  end
end
ext_const_base.sort.each do |construction,count|
  net_area = construction.getNetArea
  net_area_ip = OpenStudio::convert(net_area,"m^2","ft^2").get
  net_area_ip_neat = OpenStudio::toNeatString(net_area_ip,0,true)
  area_units = "ft^2"
  surface_count = count
  thermal_conductance = construction.thermalConductance.get
  source_units = "m^2*K/W"
  target_units = "ft^2*h*R/Btu"
  r_value_ip = OpenStudio::convert(1/thermal_conductance,source_units,target_units).get
  r_value_ip_neat = OpenStudio::toNeatString(r_value_ip,2,true)
  @surface_data[:data] << [construction.name,net_area_ip_neat,area_units,surface_count,r_value_ip_neat,target_units]
  runner.registerValue(construction.name.to_s,net_area_ip,area_units)
end

Now while the construction base does have access to a method called .thermalConductance, there isn't one for .density. @macumber maybe that is something we can add, of course it would be an optional since not all materials have mass, such as No Mass Materials. In that case we would need to decide if that layer contributes 0 mass and calculate the mass we do know about, or have the optional not initialize.

@Amir Roth, if you wanted to do this today, you would just loop through the materials used in the material. You can use the method in layered construction .layers to get the materials. You might be getting a standard "StandardOpaqueMaterial" for a layer or "No Mass Material" or "Air Gap Materials" etc. You need to get the object to the right material class. Then for StandardOpaqueMaterial there is a method .density

If you look at a measure that changes the wall performance you can find example code to find and then step through materials. It would be something like this.

  construction_layers = construction.layers
  construction_layers.each do |construction_layer|
    if construction_layer.to_OpaqueMaterial.is_initialized
    construction_layer_r_value construction_layer_density = construction_layer.to_OpaqueMaterial.get.density
    # you also need to get thickness to get this layers contribution to total construction mass
    else
      # add elsif to handle other material types  
    end
  end