lib/measures/tbd/resources/psi.rb
##
# Identifies a layered construction's insulating (or deratable) layer.
#
# @param [OpenStudio::Model::Construction] construction An OS construction
#
# @return [Integer] Returns index of insulating material within construction
# @return [Symbol] Returns type of insulating material (:standard or :massless)
# @return [Float] Returns insulating layer thermal resistance [m2.K/W]
Identifies a layered construction's insulating (or deratable) layer.
Identifies a layered construction ' s insulating ( or deratable ) layer .
def deratableLayer(construction)
  r                = 0.0                        
  index            = nil                        
  type             = nil                        
  i                = 0                          
  unless construction && construction.is_a?(OpenStudio::Model::Construction)
    TBD.log(TBD::DEBUG,
      "Invalid construction, can't derate insulation layer - skipping")
    return index, type, r
  end
  construction.layers.each do |m|
    unless m.to_MasslessOpaqueMaterial.empty?
      m            = m.to_MasslessOpaqueMaterial.get
      if m.thermalResistance < 0.001 || m.thermalResistance < r
        i += 1
        next
      else
        r          = m.thermalResistance
        index      = i
        type       = :massless
      end
    end
    unless m.to_StandardOpaqueMaterial.empty?
      m            = m.to_StandardOpaqueMaterial.get
      k            = m.thermalConductivity
      d            = m.thickness
      if d < 0.003 || k > 3.0 || d / k < r
        i += 1
        next
      else
        r          = d / k
        index      = i
        type       = :standard
      end
    end
    i += 1
  end
  return index, type, r
end
def deratableLayer ( construction ) r = 0.0 index = nil type = nil i = 0 unless construction && construction . is_a? ( OpenStudio :: Model :: Construction ) TBD . log ( TBD :: DEBUG , "Invalid construction, can't derate insulation layer - skipping" ) return index , type , r end construction . layers . each do | m | unless m . to_MasslessOpaqueMaterial . empty? m = m . to_MasslessOpaqueMaterial . get if m . thermalResistance < 0.001 || m . thermalResistance < r i += 1 next else r = m . thermalResistance index = i type = :massless end end unless m . to_StandardOpaqueMaterial . empty? m = m . to_StandardOpaqueMaterial . get k = m . thermalConductivity d = m . thickness if d < 0.003 || k > 3.0 || d / k < r i += 1 next else r = d / k index = i type = :standard end end i += 1 end return index , type , r end
Identifies a layered construction's insulating (or deratable) layer.
Identifies a layered construction ' s insulating ( or deratable ) layer .
# R-value of insulating material # index of insulating material # nil, :massless; :standard # iterator
Returns index of insulating material within construction
Returns index of insulating material within construction
Integer
Returns type of insulating material (:standard or :massless)
Returns type of insulating material ( : standard or : massless )
Symbol
Returns insulating layer thermal resistance [m2.K/W]
Returns insulating layer thermal resistance [ m2 . K / W ]
Float
construction
construction An OS construction
construction An OS construction