Class: HeatingSystem

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/heating_system.rb

Constant Summary collapse

HEATING_SYSTEM_TYPES_BY_CODE =

old legacy
HEATING_SYSTEM_TYPES_BY_CODE = {:TZ => 'TempZone', :EV2 => 'Environ II', :SMC => 'Snow Melt Cable', :SMM => 'Snow Melt Mat', :SHC => 'Slab Heat Cable', :SHM => 'Slab Heat Mat', :UDH => 'Under Desk Heater', :ARW => 'Area Rug Warmer', :HTM => 'Heat Trak Mat', :OTH => 'Other', :IP => 'Infrared Panel' }
Interim HEATING_SYSTEM_TYPES_BY_CODE = {:TZ => 'TempZone', :TZM => 'TempZone Easy Mat', :TZSM => 'TempZone Shower Mat', :TZBM => 'TempZone Bench Mat', :EV2 => 'Environ II', :EVCF => 'Environ Flex Roll', :SMC => 'Snow Melt Cable', :SMM => 'Snow Melt Mat', :SHC => 'Slab Heat Cable', :SHM => 'Slab Heat Mat', :UDH => 'Under Desk Heater', :ARW => 'Area Rug Warmer', :HTM => 'Heat Trak Mat', :OTH => 'Other', :IP => 'Infrared Panel' }

{:TZ => 'TempZone Flex Roll', :TZEM => 'TempZone Easy Mat', :EV2 => 'Environ Easy Mat', :EVFR => 'Environ Flex Roll', :SMC => 'Snow Melt Cable', :SMM => 'Snow Melt Mat', :SHC => 'Slab Heat Cable', :SHM => 'Slab Heat Mat', :UDH => 'Under Desk Heater', :ARW => 'Area Rug Warmer', :HTM => 'Heat Trak Mat', :OTH => 'Other', :IP => 'Infrared Panel' }
HEATING_SYSTEM_TYPES =
HEATING_SYSTEM_TYPES_BY_CODE.map{|k,v|;v.to_s}
HEATING_SYSTEM_CODES =
HEATING_SYSTEM_TYPES_BY_CODE.map{|k,v|;k.to_s}
CALLOUTS_BY_HEATING_SYSTEM =
{
  'TempZone Flex Roll' => ["Full coverage for any size space, such as kitchens, living rooms, or basements",
                 "Ideal for in-field flexibility",
                 "Single & twin conductor available",
                 "15 watts per sq. ft., 1/8\" thick"],
  'TempZone Easy Mat' => ["Floor heating for specific larger areas 'blanket' coverage, such as a family room or bedroom",
                 "No-cut one piece, rectangular mat",
                 "120 Volt / 240 Volt",
                 "15 watts per sq. ft., 1/8\" thick"],
  'Environ Flex Roll' => ["Ideal for in-field flexibility",
                 "Full coverage for any size space, commonly installed beneath carpet & laminate",
                 "12 watts per sq. ft."],
  'Environ Easy Mat' => ["Floor heating for specific larger areas 'blanket' coverage, such as a family room",
                 "No-cut one piece",
                 "12 watts per sq. ft."],
  'Snow Melt Cable' => ["Installs in asphalt, concrete, or under pavers in mortar",
                        "Perfect for driveways, patios, walkways and stairs",
                        "Available in 120V or 240V systems",
                        "Ultimate in flexible installation with free-form cable"],
  'Snow Melt Mat' => ["Installs in asphalt, concrete, or under pavers in mortar",
                        "Perfect for driveways, patios, walkways and stairs",
                        "Available in 120V or 240V systems",
                        "Flexible installation with Flex Roll technology"],
  'Slab Heat Cable' => ["Installs directly in concrete",
                        "Available in 120v or 240v systems",
                        "6 Watts per lineal ft / 20 Watts per sq ft.",
                        "Ultimate in flexible installation with free-form cable"],
  'Slab Heat Mat' => ["Installs directly in concrete",
                      "Available in 120v or 240v systems",
                      "6 Watts per lineal ft / 20 Watts per sq ft.",
                      "Flexible installation with Flex Roll technology"]
}
IQ_IMAGE_NAMES_BY_HEATING_SYSTEM =
{
  'TempZone Flex Roll' => "tempzone.png",
  'TempZone Easy Mat' => "tempzone.png",
  'Environ Flex Roll' => "environ.png",
  'Environ Easy Mat' => "environ.png",
  'Snow Melt Cable' => "snow-melt-cable.png",
  'Snow Melt Mat' => "snow-melt-mat.png",
  'Slab Heat Cable' => "slab-cable.png",
  'Slab Heat Mat' => "slab-mat.png"
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system_type) ⇒ HeatingSystem

Returns a new instance of HeatingSystem.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/heating_system.rb', line 57

def initialize(system_type)
  if system_type.blank?
    code = "OTH"
    system_type = HEATING_SYSTEM_TYPES_BY_CODE[code.to_sym]
  end
  unless HEATING_SYSTEM_TYPES.include?system_type
    system_by_code = HEATING_SYSTEM_TYPES_BY_CODE[system_type.to_sym]
    if system_by_code.nil?
      raise "Invalid system types, must be one of #{HEATING_SYSTEM_TYPES.join(',')}"
    else
      @heating_system_type = system_by_code
      @code = system_type
    end
  else
    @heating_system_type = system_type
    @code = HEATING_SYSTEM_CODES[HEATING_SYSTEM_TYPES.index(system_type)]
  end


end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/heating_system.rb', line 4

def code
  @code
end

#heating_system_typeObject

Returns the value of attribute heating_system_type.



3
4
5
# File 'lib/heating_system.rb', line 3

def heating_system_type
  @heating_system_type
end

Class Method Details

.heating_system_types_for_floor_type(floor_type, room_type = nil, for_iq = false) ⇒ Object



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/heating_system.rb', line 168

def self.heating_system_types_for_floor_type(floor_type,room_type=nil, for_iq=false)
  res = []
  #we will evaluate our options, simplest first
  unless floor_type.nil?
    #if Indoor and one of these three types we are an ev2
    if ['Bamboo (Floating)','Carpet','Cork','Engineered (Floating)','Laminate (Click Together Floating)','Laminate (Glued Together Floating)'].include?floor_type.name
      # we want the reps to have options but put EV2 first res << self.find_by(code: "EV2")
      res += ['Environ Flex Roll','Environ Easy Mat']
      res += ['TempZone Flex Roll','TempZone Easy Mat'] unless for_iq
    elsif floor_type.name.index('Concrete Slab (outdoor)')
      res += ['Snow Melt Mat','Snow Melt Cable']
      res.reverse! if 'Stairs'.eql?room_type.name # want to start with SMC if stairs
    elsif floor_type.environment.eql?"Indoor" #Anything else indoor includes TempZone
      if floor_type.id == 5 # Concrete Slab (indoor) Finished/Decorative
        res += ['Slab Heat Mat','Slab Heat Cable']
        res += ['TempZone Flex Roll'] unless for_iq
      else
        # we want the reps to have options but put TZ first
        res += ['TempZone Flex Roll','TempZone Easy Mat']
        res += ['Environ Flex Roll','Environ Easy Mat'] unless for_iq
      end
    elsif floor_type.environment.eql?"Outdoor"
      if !room_type.nil? and 'Stairs'.eql?room_type.name
        res += ['Snow Melt Cable']
      else #Make the Snow Melt Cable first
        res += ['Snow Melt Cable','Snow Melt Mat']
      end
    end
  end
  return res
end

.recommendation(floor_type_in, room_type = nil) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/heating_system.rb', line 154

def self.recommendation(floor_type_in,room_type=nil)
  floor_type = nil
  if floor_type_in.instance_of? String
    floor_type = FloorType.find_by(name: floor_type_in)
  else
    floor_type = floor_type_in
  end
  if floor_type.nil?
    raise "Could not find floor type #{floor_type_in} or floor type not specified"
  end
  res = HeatingSystem.heating_system_types_for_floor_type(floor_type,room_type)
  return res.map{|hs| HeatingSystem.new(hs)}
end

.shc_cable_spacing_for_select(floor_type = nil, unit = "in") ⇒ Object



131
132
133
134
135
136
137
# File 'lib/heating_system.rb', line 131

def self.shc_cable_spacing_for_select(floor_type=nil, unit="in")
  
  opts = [["15 watts/sqft - #{RubyUnits::Unit.new('5.0 in').to_s(unit)}", 5.0]]
  opts <<["20 watts/sqft - #{RubyUnits::Unit.new('3.5 in').to_s(unit)}", 3.5]
  opts <<["25 watts/sqft - #{RubyUnits::Unit.new('3.0 in').to_s(unit)}", 3.0]
  return opts
end

Instance Method Details

#==(hs2) ⇒ Object



78
79
80
# File 'lib/heating_system.rb', line 78

def ==(hs2)
  hs2.to_s == self.to_s
end

#cable_system?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/heating_system.rb', line 123

def cable_system?
  require_cable_spacing?
end

#easy_mat?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/heating_system.rb', line 95

def easy_mat?
  ['Environ Easy Mat','TempZone Easy Mat'].include?@heating_system_type
end

#environ2?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/heating_system.rb', line 103

def environ2?
  ['Environ Easy Mat'].include?@heating_system_type
end

#flex_roll?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/heating_system.rb', line 91

def flex_roll?
  ['TempZone Flex Roll','Environ Flex Roll'].include?@heating_system_type
end

#ideal_cable_spacing(floor_type = nil) ⇒ Object



139
140
141
142
143
144
145
146
147
148
# File 'lib/heating_system.rb', line 139

def ideal_cable_spacing(floor_type=nil )
  if require_cable_spacing?
    cs = 3.0 # make this the default
    if @heating_system_type == "Slab Heat Cable"
      cs = 3.5
    end
    return cs
  end

end

#require_cable_spacing?Boolean

Returns:

  • (Boolean)


127
128
129
# File 'lib/heating_system.rb', line 127

def require_cable_spacing?
  ['Snow Melt Cable','Slab Heat Cable'].include?@heating_system_type
end

#slab_heat_cable?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/heating_system.rb', line 115

def slab_heat_cable?
  ['Slab Heat Cable'].include?@heating_system_type
end

#slab_heat_mat?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/heating_system.rb', line 119

def slab_heat_mat?
  ['Slab Heat Mat'].include?@heating_system_type
end

#snow_melt?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/heating_system.rb', line 107

def snow_melt?
  ['Snow Melt Cable','Snow Melt Mat'].include?@heating_system_type
end

#snow_melt_or_slab_heat?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/heating_system.rb', line 111

def snow_melt_or_slab_heat?
  ['Snow Melt Cable','Snow Melt Mat','Slab Heat Cable','Slab Heat Mat'].include?@heating_system_type
end

#tempzone?Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/heating_system.rb', line 99

def tempzone?
  ['TempZone Flex Roll'].include?@heating_system_type
end

#to_sObject



150
151
152
# File 'lib/heating_system.rb', line 150

def to_s
  @heating_system_type
end

#voltagesObject



82
83
84
85
86
87
88
89
# File 'lib/heating_system.rb', line 82

def voltages
  case @heating_system_type
    when "TempZone Flex Roll"
      [120,240,24]
    else
      [120,240]
    end
end