lib/residence.rb in residence-0.0.2 vs lib/residence.rb in residence-0.0.3
- old
+ new
@@ -25,56 +25,56 @@
committee :fuel_oil_consumed do # returns litres
quorum 'from reports', :needs => :reported_annual_fuel_oil_consumption do |characteristics, timeframe|
characteristics[:reported_annual_fuel_oil_consumption] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_fuel_oil_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_fuel_oil_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:fuel_oil]).joules.to(:litres_of_fuel_oil) ) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_fuel_oil_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:fuel_oil]).joules.to(:litres_of_fuel_oil) ) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :natural_gas_consumed do # returns joules
quorum 'from reports', :needs => :reported_annual_natural_gas_consumption do |characteristics, timeframe|
characteristics[:reported_annual_natural_gas_consumption] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_natural_gas_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_natural_gas_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:natural_gas])) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_natural_gas_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:natural_gas])) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :propane_consumed do # returns litres
quorum 'from reports', :needs => :reported_annual_propane_consumption do |characteristics, timeframe|
characteristics[:reported_annual_propane_consumption] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_propane_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_propane_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:propane]).joules.to(:litres_of_propane)) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_propane_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:propane]).joules.to(:litres_of_propane)) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :biomass_consumed do # returns joules
quorum 'from reports', :needs => :reported_annual_biomass_consumption do |characteristics, timeframe|
characteristics[:reported_annual_biomass_consumption] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_biomass_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_biomass_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:biomass])) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_biomass_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:biomass])) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :kerosene_consumed do # returns litres
quorum 'from reports', :needs => :reported_annual_kerosene_consumption do |characteristics, timeframe|
characteristics[:reported_annual_kerosene_consumption] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_kerosene_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_kerosene_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:kerosene]).joules.to(:litres_of_kerosene)) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_kerosene_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:kerosene]).joules.to(:litres_of_kerosene)) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :coal_consumed do # returns kg
quorum 'from reports', :needs => :reported_annual_coal_consumption do |characteristics, timeframe|
characteristics[:reported_annual_coal_consumption] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_coal_consumption, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_coal_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:coal]).joules.to(:kilograms_of_coal)) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_coal_consumption] + (characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:coal]).joules.to(:kilograms_of_coal)) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :dirty_electricity_generated do
quorum 'from electricity generated and green electricity', :needs => [:electricity_generated, :green_electricity] do |characteristics|
@@ -82,11 +82,11 @@
end
end
committee :green_electricity do
quorum 'default' do
- ::Pet.fallback.green_electricity
+ ::Residence.fallback.green_electricity
end
end
committee :electricity_generated do # returns kWh
quorum 'from electricity used and loss rate', :needs => [:electricity_used, :electricity_loss_rate] do |characteristics|
@@ -98,11 +98,11 @@
quorum 'from reports', :needs => :reported_annual_electricity_use do |characteristics, timeframe|
characteristics[:reported_annual_electricity_use] * (timeframe / timeframe.year)
end
quorum 'from research', :needs => [:predicted_annual_electricity_use, :predicted_fuel_shares, :missing_annual_energy, :occupation] do |characteristics, timeframe|
- (characteristics[:predicted_annual_electricity_use] + ((characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:electricity]).joules.to(:kilowatt_hours))) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Pet.fallback.occupation
+ (characteristics[:predicted_annual_electricity_use] + ((characteristics[:missing_annual_energy] * characteristics[:predicted_fuel_shares][:electricity]).joules.to(:kilowatt_hours))) * (timeframe / timeframe.year) * characteristics[:occupation] / ::Residence.fallback.occupation
end
end
committee :missing_annual_energy do # returns joules
quorum 'from fuel reports', :needs => [:predicted_annual_fuel_oil_consumption, :predicted_annual_natural_gas_consumption, :predicted_annual_propane_consumption, :predicted_annual_kerosene_consumption, :predicted_annual_biomass_consumption, :predicted_annual_coal_consumption, :predicted_annual_electricity_use], :appreciates => [:reported_annual_fuel_oil_consumption, :reported_annual_natural_gas_consumption, :reported_annual_propane_consumption, :reported_annual_kerosene_consumption, :reported_annual_biomass_consumption, :reported_annual_coal_consumption, :reported_annual_electricity_use] do |characteristics|
@@ -164,21 +164,21 @@
end
end
committee :occupation do
quorum 'default' do
- ::Pet.fallback.occupation
+ ::Residence.fallback.occupation
end
end
committee :residents do
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average :residents
end
quorum 'default' do
- ::Pet.fallback.residents_before_type_cast
+ ::Residence.fallback.residents_before_type_cast
end
end
committee :air_conditioner_use do
quorum 'default' do
@@ -236,11 +236,11 @@
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average(%w(heating_space heating_water appliances).map { |purpose| "annual_energy_from_fuel_oil_for_#{purpose}".to_sym }).to_f.joules.to(:litres_of_fuel_oil)
end
quorum 'default' do
- ::Pet.fallback.annual_fuel_oil_volume_estimate
+ ::Residence.fallback.annual_fuel_oil_volume_estimate
end
end
committee :reported_annual_natural_gas_consumption do # returns joules
quorum 'from volume estimate', :needs => :monthly_natural_gas_volume_estimate do |characteristics|
@@ -265,11 +265,11 @@
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average(%w(heating_space heating_water appliances).map { |purpose| "annual_energy_from_natural_gas_for_#{purpose}".to_sym }).to_f
end
quorum 'default' do
- ::Pet.fallback.monthly_natural_gas_volume_estimate * 12
+ ::Residence.fallback.monthly_natural_gas_volume_estimate * 12
end
end
committee :reported_annual_propane_consumption do # returns litres
quorum 'from volume estimate', :needs => :annual_propane_volume_estimate do |characteristics|
@@ -294,11 +294,11 @@
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average(%w(heating_space heating_water appliances).map { |purpose| "annual_energy_from_propane_for_#{purpose}".to_sym }).to_f.joules.to(:litres_of_propane)
end
quorum 'default' do
- ::Pet.fallback.annual_propane_volume_estimate
+ ::Residence.fallback.annual_propane_volume_estimate
end
end
committee :reported_annual_kerosene_consumption do # returns litres
quorum 'from volume estimate', :needs => :annual_kerosene_volume_estimate do |characteristics|
@@ -310,11 +310,11 @@
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average(:annual_energy_from_kerosene).to_f.joules.to(:litres_of_kerosene)
end
quorum 'default' do
- ::Pet.fallback.annual_kerosene_volume_estimate
+ ::Residence.fallback.annual_kerosene_volume_estimate
end
end
committee :reported_annual_biomass_consumption do # returns joules
quorum 'from volume estimate', :needs => :annual_wood_volume_estimate do |characteristics|
@@ -326,11 +326,11 @@
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average(:annual_energy_from_wood)
end
quorum 'default' do
- ::Pet.fallback.annual_wood_volume_estimate
+ ::Residence.fallback.annual_wood_volume_estimate
end
end
committee :reported_annual_coal_consumption do # returns kg
quorum 'from volume estimate', :needs => :annual_coal_volume_estimate do |characteristics|
@@ -338,11 +338,11 @@
end
end
committee :predicted_annual_coal_consumption do # returns kg
quorum 'default' do
- ::Pet.fallback.annual_coal_volume_estimate
+ ::Residence.fallback.annual_coal_volume_estimate
end
end
committee :reported_annual_electricity_use do # returns kWh
quorum 'from use estimate', :needs => :monthly_electricity_use_estimate do |characteristics|
@@ -436,11 +436,11 @@
energy.joules.to(:kilowatt_hours)
end
quorum 'default' do
- ::Pet.fallback.monthly_electricity_use_estimate * 12
+ ::Residence.fallback.monthly_electricity_use_estimate * 12
end
end
committee :active_subtimeframe do
quorum 'from acquisition and retirement', :needs => [:acquisition, :retirement] do |characteristics, timeframe|
@@ -464,17 +464,17 @@
end
end
# This is kindof "hacky"
# As implemented, this needs to be above floorspace committee or else cohort will always
- # use the ::Pet.fallback
+ # use the ::Residence.fallback
committee :floorspace_estimate do
quorum 'from cohort', :needs => :cohort do |characteristics|
characteristics[:cohort].weighted_average :floorspace
end
quorum 'default' do
- ::Pet.fallback.floorspace_estimate
+ ::Residence.fallback.floorspace_estimate
end
end
committee :cohort do
quorum 'from residential energy consumption survey', :appreciates => ResidentialEnergyConsumptionSurveyResponse::INPUT_CHARACTERISTICS do |characteristics|
\ No newline at end of file