Module: Models::HeatLossable
Constant Summary
HeatLossableConstants::BTU_PER_HOUR_PER_WATT, HeatLossableConstants::HIGH_U_VALUE_THRESHOLD, HeatLossableConstants::HLC_PRIMARY_OK_THRESHOLD, HeatLossableConstants::INFILTRATION_AREA_FACTORS, HeatLossableConstants::INFILTRATION_FIREPLACE_FACTORS, HeatLossableConstants::INFILTRATION_SEALING_FACTORS, HeatLossableConstants::PIE_CHART_FLAG_COLORS, HeatLossableConstants::PIE_CHART_OK_COLORS
Instance Method Summary
collapse
Instance Method Details
#children_heat_loss_recursive(inside_temperature, outside_temperature, res) ⇒ Object
28
29
30
31
32
33
|
# File 'app/concerns/models/heat_lossable.rb', line 28
def children_heat_loss_recursive(inside_temperature, outside_temperature, res)
heat_loss_children.each do |c|
res = c.self_and_children_heat_loss_recursive(inside_temperature, outside_temperature, res)
end
res
end
|
#get_children_heat_loss(inside_temperature, outside_temperature) ⇒ Object
35
36
37
|
# File 'app/concerns/models/heat_lossable.rb', line 35
def get_children_heat_loss(inside_temperature, outside_temperature)
heat_loss_children.to_a.sum { |c| c.get_self_and_children_heat_loss(inside_temperature, outside_temperature) }
end
|
#get_heat_loss(inside_temperature, outside_temperature) ⇒ Object
51
52
53
54
|
# File 'app/concerns/models/heat_lossable.rb', line 51
def get_heat_loss(inside_temperature, outside_temperature)
effective_area = area - heat_loss_children.to_a.sum(&:area)
effective_area * (inside_temperature - outside_temperature) * get_u_value
end
|
#get_self_and_children_heat_loss(inside_temperature, outside_temperature) ⇒ Object
16
17
18
|
# File 'app/concerns/models/heat_lossable.rb', line 16
def get_self_and_children_heat_loss(inside_temperature, outside_temperature)
get_heat_loss(inside_temperature, outside_temperature) + get_children_heat_loss(inside_temperature, outside_temperature)
end
|
#get_u_value ⇒ Object
56
57
58
|
# File 'app/concerns/models/heat_lossable.rb', line 56
def get_u_value
user_u_value || insulation_type&.u_value
end
|
#heat_loss_children ⇒ Object
39
40
41
|
# File 'app/concerns/models/heat_lossable.rb', line 39
def heat_loss_children
[]
end
|
#heat_loss_children_recursive(res) ⇒ Object
43
44
45
46
47
48
49
|
# File 'app/concerns/models/heat_lossable.rb', line 43
def heat_loss_children_recursive(res)
res += heat_loss_children
heat_loss_children.each do |c|
res = c.heat_loss_children_recursive(res)
end
res
end
|
#insulation_type ⇒ Object
60
61
62
|
# File 'app/concerns/models/heat_lossable.rb', line 60
def insulation_type
send("#{self.class.to_s.tableize.singularize}_insulation_type")
end
|
#reset_room_last_heat_loss ⇒ Object
64
65
66
67
68
69
|
# File 'app/concerns/models/heat_lossable.rb', line 64
def reset_room_last_heat_loss
logger.info "reset_room_last_heat_loss: self.class.to_s: #{self.class}"
logger.info "reset_room_last_heat_loss: self.class.to_s != 'RoomConfiguration': #{self.class.to_s != 'RoomConfiguration'}"
room_configuration.update_column(:last_heat_loss, nil)
true
end
|
#self_and_children_heat_loss_recursive(inside_temperature, outside_temperature, res) ⇒ Object
20
21
22
23
24
25
26
|
# File 'app/concerns/models/heat_lossable.rb', line 20
def self_and_children_heat_loss_recursive(inside_temperature, outside_temperature, res)
res << { object: self, heat_loss: get_heat_loss(inside_temperature, outside_temperature) }
heat_loss_children.each do |c|
res = c.self_and_children_heat_loss_recursive(inside_temperature, outside_temperature, res)
end
res
end
|