Class: HeatingSystem

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

Overview

Catalogue of WarmlyYours heating-system product families, each
identified by a short code (TZ, EV2, SMC, …) and a customer-
facing name ('TempZone Flex Roll', 'Environ Easy Mat', …). Also
carries the marketing callouts used on the public landing pages and
is comparable so collections of systems sort consistently.

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' }.freeze
HEATING_SYSTEM_TYPES =

Recognised heating system types.

HEATING_SYSTEM_TYPES_BY_CODE.map { |_k, v|; v.to_s }
HEATING_SYSTEM_CODES =

Heating system codes.

HEATING_SYSTEM_TYPES_BY_CODE.map { |k, _v|; k.to_s }
CALLOUTS_BY_HEATING_SYSTEM =

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"]
}.freeze
IQ_IMAGE_NAMES_BY_HEATING_SYSTEM =

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"
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system_type) ⇒ HeatingSystem

Returns a new instance of HeatingSystem.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/heating_system.rb', line 68

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

    @heating_system_type = system_by_code
    @code = system_type

  end
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



10
11
12
# File 'lib/heating_system.rb', line 10

def code
  @code
end

#heating_system_typeObject

Returns the value of attribute heating_system_type.



10
11
12
# File 'lib/heating_system.rb', line 10

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



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
199
200
201
# File 'lib/heating_system.rb', line 171

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"
      res += if !room_type.nil? && 'Stairs'.eql?(room_type.name)
               ['Snow Melt Cable']
             else # Make the Snow Melt Cable first
               ['Snow Melt Cable', 'Snow Melt Mat']
             end
    end
  end
  res
end

.recommendation(floor_type_in, room_type = nil) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/heating_system.rb', line 158

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

  res = HeatingSystem.heating_system_types_for_floor_type(floor_type, room_type)
  res.map { |hs| HeatingSystem.new(hs) }
end

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



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

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]
  opts
end

Instance Method Details

#==(other) ⇒ Object



86
87
88
# File 'lib/heating_system.rb', line 86

def ==(other)
  other.to_s == to_s
end

#cable_system?Boolean

Returns:

  • (Boolean)


131
132
133
# File 'lib/heating_system.rb', line 131

def cable_system?
  require_cable_spacing?
end

#easy_mat?Boolean

Returns:

  • (Boolean)


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

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

#environ2?Boolean

Returns:

  • (Boolean)


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

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

#flex_roll?Boolean

Returns:

  • (Boolean)


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

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

#ideal_cable_spacing(_floor_type = nil) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/heating_system.rb', line 146

def ideal_cable_spacing(_floor_type = nil)
  return unless require_cable_spacing?

  cs = 3.0 # make this the default
  cs = 3.5 if @heating_system_type == "Slab Heat Cable"
  cs
end

#require_cable_spacing?Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/heating_system.rb', line 135

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

#slab_heat_cable?Boolean

Returns:

  • (Boolean)


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

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

#slab_heat_mat?Boolean

Returns:

  • (Boolean)


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

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

#snow_melt?Boolean

Returns:

  • (Boolean)


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

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

#snow_melt_or_slab_heat?Boolean

Returns:

  • (Boolean)


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

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)


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

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

#to_sObject



154
155
156
# File 'lib/heating_system.rb', line 154

def to_s
  @heating_system_type
end

#voltagesObject



90
91
92
93
94
95
96
97
# File 'lib/heating_system.rb', line 90

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