Skip to content

Commit

Permalink
Fixes #1284 by removing insulation for low U-value constructions
Browse files Browse the repository at this point in the history
  • Loading branch information
asparke2 committed Mar 17, 2022
1 parent 67b0223 commit f9ed0c8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/openstudio-standards/standards/Standards.Construction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,22 @@ def construction_set_u_value(construction, target_u_value_ip, insulation_layer_n
# and the R-value of the non-insulation layers and air films.
# This is the desired R-value of the insulation.
ins_r_value_si = target_r_value_si - other_layer_r_value_si
if ins_r_value_si <= 0.0
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Construction', "Requested U-value of #{target_u_value_ip} for #{construction.name} is too low given the other materials in the construction; insulation layer will not be modified.")
return false
end
ins_r_value_ip = OpenStudio.convert(ins_r_value_si, 'm^2*K/W', 'ft^2*h*R/Btu').get

# Set the R-value of the insulation layer
construction.layers.each do |layer|
construction.layers.each_with_index do |layer, l|
next unless layer.name.get == insulation_layer_name

# Remove insulation layer if requested R-value is lower than sum of non-insulation materials
if ins_r_value_si <= 0.0
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Construction', "Requested U-value of #{target_u_value_ip} for #{construction.name} is too low given the other materials in the construction; insulation layer will be removed.")
construction.eraseLayer(l)
# Set the target R-value to the sum of other layers to make name match properties
target_r_value_ip = OpenStudio.convert(other_layer_r_value_si, 'm^2*K/W', 'ft^2*hr*R/Btu').get
break # Don't modify the insulation layer since it has been removed
end

# Modify the insulation layer
ins_r_value_ip = OpenStudio.convert(ins_r_value_si, 'm^2*K/W', 'ft^2*h*R/Btu').get
if layer.to_StandardOpaqueMaterial.is_initialized
layer = layer.to_StandardOpaqueMaterial.get
layer.setThickness(ins_r_value_si * layer.conductivity)
Expand Down

0 comments on commit f9ed0c8

Please sign in to comment.