Class: CommercialBuildingEnergyConsumptionSurveyResponse
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CommercialBuildingEnergyConsumptionSurveyResponse
- Defined in:
- lib/lodging/cbecs.rb
Instance Method Summary collapse
-
#energy_use_membership(basis) ⇒ Object
empirically determined formula that minimizes variance between real and predicted energy use SQL! - :heating_degree_days_n_w will be replaced with, for example, ‘tmp_table_9301293.hdd_normalized_weight`.
Instance Method Details
#energy_use_membership(basis) ⇒ Object
empirically determined formula that minimizes variance between real and predicted energy use SQL! - :heating_degree_days_n_w will be replaced with, for example, ‘tmp_table_9301293.hdd_normalized_weight`
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lodging/cbecs.rb', line 12 def energy_use_membership(basis) keys = basis.keys unless keys.include?(:heating_degree_days) and keys.include?(:cooling_degree_days) raise ArgumentError, "[lodging] Must provide at least :heating_degree_days and :cooling_degree_days" end formula = ['(POW(:heating_degree_days_n_w, 0.8) + POW(:cooling_degree_days_n_w, 0.8))'] if keys.include?(:lodging_rooms) and keys.include?(:floors) formula << '(POW(:lodging_rooms_n_w, 0.8) + POW(:floors_n_w, 0.8))' elsif keys.include? :lodging_rooms formula << 'POW(:lodging_rooms_n_w, 0.8)' elsif keys.include? :floors formula << 'POW(:floors_n_w, 0.8)' end formula << 'POW(:percent_cooled_n_w, 0.8)' if keys.include?(:percent_cooled) formula << 'POW(:construction_year_n_w, 0.8)' if keys.include?(:construction_year) formula.join(' * ') end |