Class: TBD::KHI

Inherits:
Object
  • Object
show all
Extended by:
OSut
Defined in:
lib/tbd/psi.rb

Overview

Library of point thermal bridges (e.g. columns). Each key:value entry requires a unique identifier e.g. “poor (BETBG)” and a KHI-value in W/K.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKHI

Constructs a new KHI library (with defaults).



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/tbd/psi.rb', line 52

def initialize
  @point = {}

  # The following are built-in KHI-factors. Users may append new key:value
  # pairs, preferably through a TBD JSON input file. Units are in W/K.
  @point["poor (BETBG)"               ] = 0.900 # detail 5.7.2 BETBG
  @point["regular (BETBG)"            ] = 0.500 # detail 5.7.4 BETBG
  @point["efficient (BETBG)"          ] = 0.150 # detail 5.7.3 BETBG
  @point["code (Quebec)"              ] = 0.500 # art. 3.3.1.3. NECB-QC
  @point["uncompliant (Quebec)"       ] = 1.000 # NECB-QC Guide
  @point["90.1.22|steel.m|default"    ] = 0.480 # steel/metal, compliant
  @point["90.1.22|steel.m|unmitigated"] = 0.920 # steel/metal, non-compliant
  @point["90.1.22|mass.ex|default"    ] = 0.330 # ext/integral, compliant
  @point["90.1.22|mass.ex|unmitigated"] = 0.460 # ext/integral, non-compliant
  @point["90.1.22|mass.in|default"    ] = 0.330 # interior mass, compliant
  @point["90.1.22|mass.in|unmitigated"] = 0.460 # interior, non-compliant
  @point["90.1.22|wood.fr|default"    ] = 0.040 # compliant
  @point["90.1.22|wood.fr|unmitigated"] = 0.330 # non-compliant
  @point["(non thermal bridging)"     ] = 0.000 # defaults to 0
end

Instance Attribute Details

#pointHash (readonly)

Returns KHI library.

Returns:

  • (Hash)

    KHI library



48
49
50
# File 'lib/tbd/psi.rb', line 48

def point
  @point
end

Instance Method Details

#append(k = {}) ⇒ Bool, false

Appends a new KHI entry.

Parameters:

  • k (Hash) (defaults to: {})

    a new KHI entry

Options Hash (k):

  • :id (#to_s)

    name

  • :point (#to_f)

    conductance, in W/K

Returns:

  • (Bool)

    whether KHI entry is successfully appended

  • (false)

    if invalid input (see logs)



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/tbd/psi.rb', line 82

def append(k = {})
  mth = "TBD::#{__callee__}"
  a   = false
  ck1 = k.respond_to?(:key?)
  return mismatch("KHI"     , k, Hash  , mth, DBG, a) unless ck1
  return hashkey("KHI id"   , k, :id   , mth, DBG, a) unless k.key?(:id)
  return hashkey("KHI point", k, :point, mth, DBG, a) unless k.key?(:point)

  id = trim(k[:id])
  ck1 = id.empty?
  ck2 = k[:point].respond_to?(:to_f)
  return mismatch("KHI id"   , k[:id   ], String, mth, ERR, a)     if ck1
  return mismatch("KHI point", k[:point], Float , mth, ERR, a) unless ck2

  if @point.key?(id)
    log(ERR, "Skipping '#{id}': existing KHI entry (#{mth})")
    return false
  end

  @point[id] = k[:point].to_f

  true
end