impact_model.rb |
|
|---|---|
|
Copyright © 2010 Brighter Planet. See LICENSE for details. Contact Brighter Planet for dual-license arrangements. |
|
Meeting carbon modelThis model is used by Brighter Planet’s carbon emission web service to estimate the greenhouse gas emissions of a meeting (e.g. a conference). Timeframe and dateThe model estimates the emissions that occur during a particular CalculationsThe final estimate is the result of the calculations detailed below. These calculations are performed in reverse order, starting with the last calculation listed and finishing with the MethodsTo accomodate varying client input, each calculation may have one or more methods. These are listed under each calculation in order from most to least preferred. Each method is named according to the values it requires. If any of these values is not available the method will be ignored. If all the methods for a calculation are ignored, the calculation will not return a value. “Default” methods do not require any values, and so a calculation with a default method will always return a value. Standard complianceEach method lists any established calculation standards with which it complies. When compliance with a standard is requested, all methods that do not comply with that standard are ignored. This means that any values a particular method requires will have been calculated using a compliant method, because those are the only methods available. If any value did not have a compliant method in its calculation then it would be undefined, and the current method would have been ignored. CollaborationContributions to this carbon model are actively encouraged and warmly welcomed. This library includes a comprehensive test suite to ensure that your changes do not cause regressions. All changes should include test coverage for new functionality. Please see sniff, our emitter testing framework, for more information. |
require 'conversions'
module BrighterPlanet
module Meeting
module ImpactModel
def self.included(base)
base.decide :impact, :with => :characteristics do |
Emission calculationReturns the |
committee :carbon do |
Emission from duration, area, and emission factor |
quorum 'from duration, area, and emission factor', :needs => [:duration, :area, :emission_factor], |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Multiplies |
characteristics[:duration] / 3600.0 * characteristics[:area] * characteristics[:emission_factor]
end
|
Default emission |
quorum 'default' do |
|
Displays an error if the previous method fails. |
raise "The emission committee's default quorum should never be called"
end
end
|
Emission factor calculationReturns the |
committee :emission_factor do |
Emission factor from fuel intensities and eGRID |
quorum 'from fuel intensities and eGRID', :needs => [:natural_gas_intensity, :fuel_oil_intensity, :electricity_intensity, :district_heat_intensity, :egrid_subregion, :egrid_region], |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Calculates an energy-based emission factor for natural gas by dividing its |
natural_gas = Fuel.find_by_name "Pipeline Natural Gas"
natural_gas_energy_ef = natural_gas.co2_emission_factor / natural_gas.energy_content
|
|
Calculates an energy-based emission factor for fuel oil by dividing its |
fuel_oil = Fuel.find_by_name "Distillate Fuel Oil No. 2"
fuel_oil_energy_ef = fuel_oil.co2_emission_factor / fuel_oil.energy_content
|
|
Calculates an energy-based emission factor for district heat by dividing the energy-based natural gas emission factor by 0.817 and the energy-based fuel oil emission factor by 0.846 (to account for boiler inefficiencies), averaging the two, and dividing by 0.95 (to account for transmission losses) to give kg CO2 / MJ |
district_heat_ef = (((natural_gas_energy_ef / 0.817) + (fuel_oil_energy_ef / 0.846)) / 2) / 0.95 # kg / MJ
|
|
Calculates an electricity emission factor by dividing the eGRID subregion electricity emission factor by 1 – the eGRID region loss factor (to account for transmission and distribution losses) to give kg CO2 / kWh |
electricity_ef = characteristics[:egrid_subregion].electricity_emission_factor / (1 - characteristics[:egrid_region].loss_factor)
|
|
Multiplies |
(characteristics[:natural_gas_intensity] * natural_gas.co2_emission_factor) +
(characteristics[:fuel_oil_intensity] * fuel_oil.co2_emission_factor) +
(characteristics[:district_heat_intensity] * district_heat_ef) +
(characteristics[:electricity_intensity] * electricity_ef)
end
end
|
Natural gas intensity calculationReturns the meeting venue’s |
committee :natural_gas_intensity do # returns cubic metres per square metre hour |
From census division |
quorum 'from census division', :needs => :census_division, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the census division meeting building |
characteristics[:census_division].meeting_building_natural_gas_intensity
end
|
Default natural gas intensity |
quorum 'default', |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |
|
Uses the U.S. average |
CensusDivision.fallback.meeting_building_natural_gas_intensity
end
end
|
Fuel oil intensity calculationReturns the meeting venue’s |
committee :fuel_oil_intensity do |
Fuel oil intensity from census division |
quorum 'from census division', :needs => :census_division, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the census division meeting building |
characteristics[:census_division].meeting_building_fuel_oil_intensity
end
|
Default fuel oil intensity |
quorum 'default', |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |
|
Uses the U.S. average |
CensusDivision.fallback.meeting_building_fuel_oil_intensity
end
end
|
Electricity intensity calculationReturns the meeting venue’s |
committee :electricity_intensity do |
Electricity intensity from census division and eGRID region |
quorum 'from eGRID region and census division', :needs => [:egrid_region, :census_division], |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
characteristics[:census_division].meeting_building_electricity_intensity / (1 - characteristics[:egrid_region].loss_factor)
end
|
Electricity intensity from eGRID region |
quorum 'from eGRID region', :needs => :egrid_region, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
CensusDivision.fallback.meeting_building_electricity_intensity / (1 - characteristics[:egrid_region].loss_factor)
end
end
|
District heat intensity calculationReturns the meeting venue’s |
committee :district_heat_intensity do |
District heat intensity from census division |
quorum 'from census division', :needs => :census_division, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the census division meeting building |
characteristics[:census_division].meeting_building_district_heat_intensity
end
|
Default district heat intensity |
quorum 'default', |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |
|
Uses the U.S. average. |
CensusDivision.fallback.meeting_building_district_heat_intensity
end
end
|
eGRID region calculationReturns the meeting venue’s eGRID region. |
committee :egrid_region do |
eGRID region from eGRID subregion |
quorum 'from eGRID subregion', :needs => :egrid_subregion, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the eGRID subregion |
characteristics[:egrid_subregion].egrid_region
end
end
|
eGRID subregion calculationReturns the meeting venue’s eGRID subregion. |
committee :egrid_subregion do |
eGRID subregion from zip code |
quorum 'from zip code', :needs => :zip_code, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the zip code |
characteristics[:zip_code].egrid_subregion
end
|
Default eGRID subregion |
quorum 'default', |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |
|
Uses an artificial eGRID subregion that represents the U.S. average. |
EgridSubregion.find_by_abbreviation 'US'
end
end
|
Census division calculationReturns the meeting venue’s census division. |
committee :census_division do |
Census division from state |
quorum 'from state', :needs => :state, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the state |
characteristics[:state].census_division
end
end
|
State calculationReturns the meeting venue’s state. |
committee :state do |
State from zip code |
quorum 'from zip code', :needs => :zip_code, |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |characteristics| |
|
Looks up the zip code |
characteristics[:zip_code].state
end
end
|
Zip code calculationReturns the meeting venue’s zip code. Zip code from client inputComplies: All Uses the client-input zip code. |
|
Area calculationReturns the meeting venue’s |
committee :area do |
Area from client inputComplies: All Uses the client-input |
|
Default area |
quorum 'default', |
|
Complies: GHG Protocol Scope 3, ISO 14064-1, Climate Registry Protocol |
:complies => [:ghg_protocol_scope_3, :iso, :tcr] do |
|
Uses a default |
10_448.square_feet.to(:square_metres)
end
end
|
Duration calculationReturns the meeting’s |
committee :duration do |
Duration from client inputComplies: All Uses the client-input |
|
Default duration |
quorum 'default' do |
|
Uses a default |
28800.0
end
end
end
end
end
end
end |