impact_model.rb |
|
|---|---|
|
Copyright © 2010 Brighter Planet. See LICENSE for details. Contact Brighter Planet for dual-license arrangements. |
|
Automobile impact modelThis model is used by the Brighter Planet CM1 web service to calculate the impacts of an automobile, such as energy use and greenhouse gas emissions. |
|
TimeframeThe model calculates impacts that occured during a particular time period ( The default |
|
CalculationsThe final impacts are the result of the calculations below. These are performed in reverse order, starting with the last calculation listed and finishing with the greenhouse gas emissions calculation. Each calculation listing shows:
Some methods use |
|
Standard complianceWhen compliance with a particular standard is requested, all methods that do not comply with that standard are ignored.
Thus any Client input complies with all standards. |
|
CollaborationContributions to this impact 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. |
module BrighterPlanet
module Automobile
module ImpactModel
def self.included(base)
base.decide :impact, :with => :characteristics do |
|
|
|
Carbon (kg CO2e)The automobile’s total anthropogenic greenhouse gas emissions during |
committee :carbon do |
|
Sum |
quorum 'from co2 emission, ch4 emission, n2o emission, and hfc emission', :needs => [:co2_emission, :ch4_emission, :n2o_emission, :hfc_emission],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:co2_emission] + characteristics[:ch4_emission] + characteristics[:n2o_emission] + characteristics[:hfc_emission]
end
end
|
CO2 emission (kg)The automobile’s CO2 emissions from anthropogenic sources during |
committee :co2_emission do |
|
Multiply |
quorum 'from fuel use and co2 emission factor', :needs => [:fuel_use, :co2_emission_factor],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:fuel_use] * characteristics[:co2_emission_factor]
end
end
|
CO2 biogenic emission (kg)The automobile’s CO2 emissions from biogenic sources during |
committee :co2_biogenic_emission do |
|
Multiply |
quorum 'from fuel use and co2 biogenic emission factor', :needs => [:fuel_use, :co2_biogenic_emission_factor],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:fuel_use] * characteristics[:co2_biogenic_emission_factor]
end
end
|
CH4 emission (kg CO2e)The automobile’s CH4 emissions during |
committee :ch4_emission do |
|
Multiply |
quorum 'from distance and ch4 emission factor', :needs => [:distance, :ch4_emission_factor],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:distance] * characteristics[:ch4_emission_factor]
end
end
|
N2O emission (kg CO2e)The automobile’s N2O emissions during |
committee :n2o_emission do |
|
Multiply |
quorum 'from distance and n2o emission factor', :needs => [:distance, :n2o_emission_factor],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:distance] * characteristics[:n2o_emission_factor]
end
end
|
HFC emission (kg CO2e)The automobile’s HFC emissions during |
committee :hfc_emission do |
|
Multiply |
quorum 'from distance and hfc emission factor', :needs => [:distance, :hfc_emission_factor],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:distance] * characteristics[:hfc_emission_factor]
end
end
|
CO2 emission factor (kg / various)The CO2 emission factor. |
committee :co2_emission_factor do |
|
Use the |
quorum 'from automobile fuel', :needs => :automobile_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:automobile_fuel].co2_emission_factor
end
|
|
Otherwise use the |
quorum 'from country', :needs => :country,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:country].electricity_emission_factor
end
|
|
Otherwise use the global average electricity emission factor (kg CO2e / kWh) (electricity is the only automobile fuel without a co2 biogenic emission factor). |
quorum 'default',
:complies => [:ghg_protocol_scope_3, :iso] do
Country.fallback.electricity_emission_factor
end
end
|
CO2 biogenic emission factor (kg / various)The CO2 emission factor. |
committee :co2_biogenic_emission_factor do |
|
Use the |
quorum 'from automobile fuel', :needs => :automobile_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:automobile_fuel].co2_biogenic_emission_factor
end
|
|
Otherwise use a default of 0 kg / kWh (electricity is the only automobile fuel without a co2 biogenic emission factor). |
quorum 'default',
:complies => [:ghg_protocol_scope_3, :iso] do
0.0
end
end
|
CH4 emission factor (kg CO2e / km)The CH4 emission factor. |
committee :ch4_emission_factor do |
|
Use the |
quorum 'from type fuel year', :needs => :type_fuel_year,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:type_fuel_year].ch4_emission_factor
end
|
|
Otherwise use the |
quorum 'from type fuel', :needs => :type_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:type_fuel].ch4_emission_factor
end
|
|
Otherwise use the |
quorum 'from automobile fuel', :needs => :automobile_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:automobile_fuel].ch4_emission_factor
end
end
|
N2O emission factor (kg CO2e / km)The N2O emission factor. |
committee :n2o_emission_factor do |
|
Use the |
quorum 'from type fuel year', :needs => :type_fuel_year,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:type_fuel_year].n2o_emission_factor
end
|
|
Otherwise use the |
quorum 'from type fuel', :needs => :type_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:type_fuel].n2o_emission_factor
end
|
|
Otherwise use the |
quorum 'from automobile fuel', :needs => :automobile_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:automobile_fuel].n2o_emission_factor
end
end
|
HFC emission (kg CO2e / km)The automobile’s HFC emission factor. |
committee :hfc_emission_factor do |
|
Use the |
quorum 'from activity year type', :needs => :activity_year_type,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:activity_year_type].hfc_emission_factor
end
|
|
Otherwise use the |
quorum 'from activity year', :needs => :activity_year,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:activity_year].hfc_emission_factor
end
end
|
Activity year typeThe automobile’s activity year and type. |
committee :activity_year_type do |
|
Find the best match for |
quorum 'from active subtimeframe and automobile type', :needs => [:active_subtimeframe, :automobile_type],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileActivityYearType.find_by_type_name_and_closest_year characteristics[:automobile_type].value, characteristics[:active_subtimeframe].start_date.year
end
end
|
Activity yearThe year in which the trip occurred. |
committee :activity_year do |
|
Find the best match for |
quorum 'from active subtimeframe', :needs => :active_subtimeframe,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileActivityYear.find_by_closest_year characteristics[:active_subtimeframe].start_date.year
end
end
|
Energy (MJ)The automobile’s energy use during |
committee :energy do |
|
Multiply |
quorum 'from fuel use and automobile fuel', :needs => [:fuel_use, :automobile_fuel] do |characteristics|
characteristics[:fuel_use] * characteristics[:automobile_fuel].energy_content
end
end
|
Fuel use (various)The automobile’s fuel use during |
committee :fuel_use do |
|
Multiply |
quorum 'from annual fuel use, active subtimeframe, and timeframe', :needs => [:annual_fuel_use, :active_subtimeframe],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
characteristics[:annual_fuel_use] * (characteristics[:active_subtimeframe] / timeframe.year)
end
end
|
Annual fuel use (various)The fuel the automobile would use if it were used for the entire calendar year in which |
committee :annual_fuel_use do |
|
Use client input, if available. |
|
|
Otherwise divide |
quorum 'from fuel efficiency, annual distance, and automobile fuel', :needs => [:fuel_efficiency, :annual_distance, :automobile_fuel],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:automobile_fuel].non_liquid?
characteristics[:annual_distance] / characteristics[:fuel_efficiency] * AutomobileFuel.find('gasoline').energy_content / characteristics[:automobile_fuel].energy_content
else
characteristics[:annual_distance] / characteristics[:fuel_efficiency]
end
end
end
|
Distance (km)The distance the automobile travelled during |
committee :distance do |
|
Multiply |
quorum 'from annual distance, active subtimeframe, and timeframe', :needs => [:annual_distance, :active_subtimeframe],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
characteristics[:annual_distance] * (characteristics[:active_subtimeframe] / timeframe.year)
end
end
|
Annual distance (km)The distance the automobile would travel if it were used for the entire calendar year in which |
committee :annual_distance do |
|
Use client input, if available. |
|
|
Otherwise multiply client-input |
quorum 'from annual fuel use and fuel efficiency', :needs => [:annual_fuel_use, :fuel_efficiency],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
characteristics[:annual_fuel_use] * characteristics[:fuel_efficiency]
end
|
|
Otherwise divide |
quorum 'from weekly distance and timeframe', :needs => :weekly_distance,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
(characteristics[:weekly_distance] / 7 ) * timeframe.year.days
end
|
|
Otherwise multiply |
quorum 'from daily distance and timeframe', :needs => :daily_distance,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
characteristics[:daily_distance] * timeframe.year.days
end
|
|
Otherwise divide |
quorum 'from daily duration, speed, and timeframe', :needs => [:daily_duration, :speed],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
characteristics[:daily_duration] / 3600.0 * characteristics[:speed] * timeframe.year.days
end
|
|
Otherwise use the |
quorum 'from type fuel year', :needs => :type_fuel_year,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:type_fuel_year].annual_distance
end
|
|
Otherwise use the |
quorum 'from type fuel', :needs => :type_fuel,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:type_fuel].annual_distance
end
|
|
Otherwise use the |
quorum 'from automobile fuel', :needs => :automobile_fuel,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:automobile_fuel].annual_distance
end
end
|
Weekly distance (km)The average distance the automobile is driven each week. Use client input if available. |
|
Daily distance (km)The average distance the automobile is driven each day. Use client input if available. |
|
Type fuel year |
committee :type_fuel_year do |
|
Match |
quorum 'from automobile type, automobile fuel, and year', :needs => [:automobile_type, :automobile_fuel, :year],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileTypeFuelYear.find_by_type_name_and_fuel_family_and_closest_year characteristics[:automobile_type].value, characteristics[:automobile_fuel].family, characteristics[:year].year
end
end
|
Type fuel |
committee :type_fuel do |
|
Match |
quorum 'from automobile type and automobile fuel', :needs => [:automobile_type, :automobile_fuel],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileTypeFuel.find_by_type_name_and_fuel_family characteristics[:automobile_type].value, characteristics[:automobile_fuel].family
end
end
|
Automobile typeThe automobile’s type. |
committee :automobile_type do |
|
Use the |
quorum 'from make model year', :needs => :make_model_year,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:make_model_year].type_name
end
|
|
Otherwise use the |
quorum 'from make model', :needs => :make_model,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:make_model].type_name
end
|
|
Otherwise use the |
quorum 'from size class', :needs => :size_class,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:size_class].type_name
end
end
|
Daily duration (seconds)The average time the automobile is driven each day. Use client input, if available. |
|
Speed (km / hour)The automobile’s average speed. |
committee :speed do |
|
Use client input, if available. |
|
|
Otherwise calculate the harmonic mean of the |
quorum 'from urbanity and country', :needs => [:urbanity, :country],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:country].automobile_city_speed and characteristics[:country].automobile_highway_speed
1 / (characteristics[:urbanity] / characteristics[:country].automobile_city_speed + (1 - characteristics[:urbanity]) / characteristics[:country].automobile_highway_speed)
end
end
|
|
Otherwise calculate the harmonic mean of the global average automobile city and highway speeds (km / hour), weighted by |
quorum 'from urbanity', :needs => :urbanity,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
1 / (characteristics[:urbanity] / Country.fallback.automobile_city_speed + (1 - characteristics[:urbanity]) / Country.fallback.automobile_highway_speed)
end
end
|
Fuel efficiency (km / l)The automobile’s fuel efficiency. |
committee :fuel_efficiency do |
|
Use client input, if available. |
|
|
Otherwise calculate the harmonic mean of |
quorum 'from fuel efficiency city, fuel efficiency highway, and urbanity', :needs => [:fuel_efficiency_city, :fuel_efficiency_highway, :urbanity],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
1.0 / (
(characteristics[:urbanity] / characteristics[:fuel_efficiency_city]) +
((1.0 - characteristics[:urbanity]) / characteristics[:fuel_efficiency_highway])
)
end
|
|
Otherwise look up the |
quorum 'from size class, hybridity multiplier, and urbanity', :needs => [:size_class, :hybridity_multiplier, :urbanity],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
(1.0 / (
(characteristics[:urbanity] / characteristics[:size_class].fuel_efficiency_city) +
((1.0 - characteristics[:urbanity]) / characteristics[:size_class].fuel_efficiency_highway)
)) * characteristics[:hybridity_multiplier]
end
|
|
Otherwise multiply the |
quorum 'from make year and hybridity multiplier', :needs => [:make_year, :hybridity_multiplier],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:make_year].fuel_efficiency * characteristics[:hybridity_multiplier]
end
|
|
Otherwise multiply the |
quorum 'from make and hybridity multiplier', :needs => [:make, :hybridity_multiplier],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:make].fuel_efficiency * characteristics[:hybridity_multiplier]
end
|
|
Otherwise multiply the |
quorum 'from country and hybridity multiplier', :needs => [:country, :hybridity_multiplier],
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:country].automobile_fuel_efficiency
characteristics[:country].automobile_fuel_efficiency * characteristics[:hybridity_multiplier]
end
end
|
|
Otherwise multiply the global average automobile fuel efficiency (km / l) by |
quorum 'from hybridity multiplier', :needs => :hybridity_multiplier,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
Country.fallback.automobile_fuel_efficiency * characteristics[:hybridity_multiplier]
end
end
|
Fuel efficiency city (km / l)The automobile’s city fuel efficiency. |
committee :fuel_efficiency_city do |
|
Use client input, if available. |
|
|
Otherwise check whether |
quorum 'from make model year and automobile fuel', :needs => [:make_model_year, :automobile_fuel],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:automobile_fuel].same_as? characteristics[:make_model_year].automobile_fuel
characteristics[:make_model_year].fuel_efficiency_city
elsif characteristics[:automobile_fuel].same_as? characteristics[:make_model_year].alt_automobile_fuel
characteristics[:make_model_year].alt_fuel_efficiency_city
end
end
|
|
Otherwise check whether |
quorum 'from make model and automobile fuel', :needs => [:make_model, :automobile_fuel],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:automobile_fuel].same_as? characteristics[:make_model].automobile_fuel
characteristics[:make_model].fuel_efficiency_city
elsif characteristics[:automobile_fuel].same_as? characteristics[:make_model].alt_automobile_fuel
characteristics[:make_model].alt_fuel_efficiency_city
end
end
end
|
Fuel efficiency highway (km / l)The automobile’s highway fuel efficiency. |
committee :fuel_efficiency_highway do |
|
Use client input, if available. |
|
|
Otherwise check whether |
quorum 'from make model year and automobile fuel', :needs => [:make_model_year, :automobile_fuel],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:automobile_fuel].same_as? characteristics[:make_model_year].automobile_fuel
characteristics[:make_model_year].fuel_efficiency_highway
elsif characteristics[:automobile_fuel].same_as? characteristics[:make_model_year].alt_automobile_fuel
characteristics[:make_model_year].alt_fuel_efficiency_highway
end
end
|
|
Otherwise check whether |
quorum 'from make model and automobile fuel', :needs => [:make_model, :automobile_fuel],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
if characteristics[:automobile_fuel].same_as? characteristics[:make_model].automobile_fuel
characteristics[:make_model].fuel_efficiency_highway
elsif characteristics[:automobile_fuel].same_as? characteristics[:make_model].alt_automobile_fuel
characteristics[:make_model].alt_fuel_efficiency_highway
end
end
end
|
Automobile fuelThe automobile’s fuel type. |
committee :automobile_fuel do |
|
Use client input, if available. |
|
|
Otherwise use the |
quorum 'from make model year', :needs => :make_model_year,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:make_model_year].automobile_fuel
end
|
|
Otherwise use the |
quorum 'from make model', :needs => :make_model,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:make_model].automobile_fuel
end
|
|
Otherwise use the average automobile fuel. |
quorum 'default',
:complies => [:ghg_protocol_scope_3, :iso] do
AutomobileFuel.fallback
end
end
|
Hybridity multiplier (dimensionless)A multiplier to adjust fuel efficiency based on whether the automobile is a hybrid or conventional vehicle. |
committee :hybridity_multiplier do |
|
Check whether the |
quorum 'from size class, hybridity, and urbanity', :needs => [:size_class, :hybridity, :urbanity],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
drivetrain = (characteristics[:hybridity] == true) ? :hybrid : :conventional
city_multiplier = characteristics[:size_class].send(:"#{drivetrain}_fuel_efficiency_city_multiplier")
highway_multiplier = characteristics[:size_class].send(:"#{drivetrain}_fuel_efficiency_highway_multiplier")
if city_multiplier and highway_multiplier
1.0 / ((characteristics[:urbanity] / city_multiplier) + ((1.0 - characteristics[:urbanity]) / highway_multiplier))
end
end
|
|
Otherwise look up the average size class |
quorum 'from hybridity and urbanity', :needs => [:hybridity, :urbanity],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
drivetrain = (characteristics[:hybridity] == true) ? :hybrid : :conventional
city_multiplier = AutomobileSizeClass.fallback.send(:"#{drivetrain}_fuel_efficiency_city_multiplier")
highway_multiplier = AutomobileSizeClass.fallback.send(:"#{drivetrain}_fuel_efficiency_highway_multiplier")
1.0 / ((characteristics[:urbanity] / city_multiplier) + ((1.0 - characteristics[:urbanity]) / highway_multiplier))
end
|
|
Otherwise use a multiplier of 1.0. |
quorum 'default',
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do
1.0
end
end
|
Hybridity (boolean)True if the automobile is a hybrid vehicle. False if the automobile is a conventional vehicle. Use client input, if available. |
|
Size classThe automobile’s size class. Use client input, if available. |
|
Urbanity (%)The fraction of the total distance driven that is in towns and cities rather than highways. Highways are defined as roads with a speed limit of 45 miles per hour or more. |
committee :urbanity do |
|
Use client input, if available. |
|
|
Otherwise use the |
quorum 'from country', :needs => :country,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
characteristics[:country].automobile_urbanity
end
|
|
Otherwise use the global average automobile urbanity (%). |
quorum 'default',
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do
Country.fallback.automobile_urbanity
end
end
|
CountryThe country in which the trip occurred. Use client input, if available. |
|
Active subtimeframe (date range)The portion of |
committee :active_subtimeframe do |
|
Calculate the portion of |
quorum 'from acquisition and retirement', :needs => [:acquisition, :retirement],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
if characteristics[:acquisition].value <= characteristics[:retirement].value
Timeframe.constrained_new characteristics[:acquisition].to_date, characteristics[:retirement].to_date, timeframe
else
Timeframe.constrained_new characteristics[:retirement].to_date, characteristics[:retirement].to_date, timeframe
end
end
end
|
Acquisition (date)The date the automobile was put into use. |
committee :acquisition do |
|
Use client input, if available. |
|
|
Otherwise use the first day of |
quorum 'from year', :needs => :year,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics|
Date.new characteristics[:year].year, 1, 1
end
|
|
Otherwise use whichever is earlier: the first day of |
quorum 'from timeframe and retirement', :needs => :retirement,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
[ timeframe.from, characteristics[:retirement] ].compact.min
end
end
|
Retirement (date)The date the automobile was taken out of use. |
committee :retirement do |
|
Use client input, if available. |
|
|
Otherwise use whichever is later: the last day of |
quorum 'from timeframe', :appreciates => :acquisition,
:complies => [:ghg_protocol_scope_3, :iso] do |characteristics, timeframe|
[ timeframe.to, characteristics[:acquisition] ].compact.max
end
end
|
Make model yearThe automobile’s make, model, and year. |
committee :make_model_year do |
|
Match |
quorum 'from make model and year', :needs => [:make_model, :year],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileMakeModelYear.find_by_make_name_and_model_name_and_year characteristics[:make_model].make_name, characteristics[:make_model].model_name, characteristics[:year].year
end
end
|
Make yearThe automobile’s make and year. |
committee :make_year do |
|
Match |
quorum 'from make and year', :needs => [:make, :year],
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileMakeYear.find_by_make_name_and_year characteristics[:make].name, characteristics[:year].year
end
end
|
Make modelThe automobile’s make and model. |
committee :make_model do |
|
Match |
quorum 'from make and model', :needs => [:make, :model], :appreciates => :automobile_fuel,
:complies => [:ghg_protocol_scope_1, :ghg_protocol_scope_3, :iso] do |characteristics|
AutomobileMakeModel.custom_find characteristics
end
end
|
YearThe automobile’s year of manufacture. Use client input, if available. |
|
ModelThe automobile’s model. Use client input, if available. |
|
MakeThe automobile’s make. Use client input, if available. |
end
end
end
end
end |