lodging 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.document +5 -0
  2. data/.gitignore +26 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE-PREAMBLE +52 -0
  5. data/Rakefile +8 -0
  6. data/VERSION +1 -0
  7. data/certification_changelog.markdown +11 -0
  8. data/dot.rvmrc +9 -0
  9. data/features/lodging_committees.feature +356 -171
  10. data/features/lodging_impacts.feature +74 -0
  11. data/features/support/db/fixtures/census_divisions.csv +2 -0
  12. data/features/support/db/fixtures/climate_divisions.csv +2 -0
  13. data/features/support/db/fixtures/commercial_building_energy_consumption_survey_responses.csv +11 -0
  14. data/features/support/db/fixtures/countries.csv +4 -0
  15. data/features/support/db/fixtures/egrid_countries.csv +2 -0
  16. data/features/support/db/fixtures/egrid_regions.csv +2 -0
  17. data/features/support/db/fixtures/egrid_subregions.csv +3 -0
  18. data/features/support/db/fixtures/fuel_years.csv +2 -0
  19. data/features/support/db/fixtures/fuels.csv +4 -0
  20. data/features/support/db/fixtures/lodging_classes.csv +4 -0
  21. data/features/support/db/fixtures/lodging_properties.csv +5 -0
  22. data/features/support/db/fixtures/states.csv +2 -0
  23. data/features/support/db/fixtures/zip_codes.csv +4 -0
  24. data/features/support/env.rb +18 -1
  25. data/features/support/lodging_property.rb +26 -0
  26. data/{lib/test_support → features/support}/lodging_record.rb +1 -4
  27. data/lib/lodging.rb +1 -0
  28. data/lib/lodging/cbecs.rb +31 -0
  29. data/lib/lodging/characterization.rb +19 -3
  30. data/lib/lodging/data.rb +22 -8
  31. data/lib/lodging/impact_model.rb +544 -0
  32. data/lib/lodging/relationships.rb +3 -1
  33. data/lib/lodging/version.rb +5 -0
  34. data/lodging.gemspec +31 -0
  35. data/todo.txt +5 -0
  36. metadata +76 -119
  37. data/features/lodging_emissions.feature +0 -53
  38. data/lib/lodging/carbon_model.rb +0 -265
  39. data/lib/lodging/fallback.rb +0 -10
@@ -2,9 +2,11 @@ module BrighterPlanet
2
2
  module Lodging
3
3
  module Relationships
4
4
  def self.included(target)
5
- target.belongs_to :lodging_class, :foreign_key => 'lodging_class_name'
6
5
  target.belongs_to :zip_code, :foreign_key => 'zip_code_name'
7
6
  target.belongs_to :state, :foreign_key => 'state_postal_abbreviation'
7
+ target.belongs_to :country, :foreign_key => 'country_iso_3166_code'
8
+ target.belongs_to :lodging_class, :foreign_key => 'lodging_class_name'
9
+ target.belongs_to :property, :foreign_key => 'property_northstar_id', :class_name => 'LodgingProperty'
8
10
  end
9
11
  end
10
12
  end
@@ -0,0 +1,5 @@
1
+ module BrighterPlanet
2
+ module Lodging
3
+ VERSION = "0.0.13"
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "lodging/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{lodging}
7
+ s.version = BrighterPlanet::Lodging::VERSION
8
+
9
+ s.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling", "Derek Kastner"]
10
+ s.date = "2012-05-16"
11
+ s.summary = %q{A carbon model}
12
+ s.description = %q{A software model in Ruby for the greenhouse gas emissions of a lodging}
13
+ s.email = %q{andy@rossmeissl.net}
14
+ s.homepage = %q{https://github.com/brighterplanet/lodging}
15
+
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "LICENSE-PREAMBLE",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
+ s.require_paths = ["lib"]
25
+
26
+ s.add_runtime_dependency 'earth', '~>0.11.13'
27
+ s.add_runtime_dependency 'emitter', '~>0.11.0'
28
+ s.add_runtime_dependency 'fuzzy_infer', '>=0.0.2'
29
+ s.add_development_dependency 'mysql2'
30
+ s.add_development_dependency 'sniff', '~>0.11.11'
31
+ end
@@ -0,0 +1,5 @@
1
+ room_nights committee shouldn't need to coerce user-input date
2
+
3
+ consider not assuming all pool energy use is natural gas
4
+
5
+ add area
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lodging
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 12
10
- version: 0.0.12
4
+ prerelease:
5
+ version: 0.0.13
11
6
  platform: ruby
12
7
  authors:
13
8
  - Andy Rossmeissl
@@ -19,140 +14,63 @@ autorequire:
19
14
  bindir: bin
20
15
  cert_chain: []
21
16
 
22
- date: 2010-12-07 00:00:00 -06:00
23
- default_executable:
17
+ date: 2012-05-16 00:00:00 Z
24
18
  dependencies:
25
19
  - !ruby/object:Gem::Dependency
26
- name: activerecord
27
- prerelease: false
20
+ name: earth
28
21
  requirement: &id001 !ruby/object:Gem::Requirement
29
22
  none: false
30
23
  requirements:
31
24
  - - ~>
32
25
  - !ruby/object:Gem::Version
33
- hash: 5
34
- segments:
35
- - 3
36
- version: "3"
37
- type: :development
26
+ version: 0.11.13
27
+ type: :runtime
28
+ prerelease: false
38
29
  version_requirements: *id001
39
30
  - !ruby/object:Gem::Dependency
40
- name: bundler
41
- prerelease: false
31
+ name: emitter
42
32
  requirement: &id002 !ruby/object:Gem::Requirement
43
33
  none: false
44
34
  requirements:
45
35
  - - ~>
46
36
  - !ruby/object:Gem::Version
47
- hash: 23
48
- segments:
49
- - 1
50
- - 0
51
- - 0
52
- version: 1.0.0
53
- type: :development
37
+ version: 0.11.0
38
+ type: :runtime
39
+ prerelease: false
54
40
  version_requirements: *id002
55
41
  - !ruby/object:Gem::Dependency
56
- name: cucumber
57
- prerelease: false
42
+ name: fuzzy_infer
58
43
  requirement: &id003 !ruby/object:Gem::Requirement
59
44
  none: false
60
45
  requirements:
61
46
  - - ">="
62
47
  - !ruby/object:Gem::Version
63
- hash: 3
64
- segments:
65
- - 0
66
- version: "0"
67
- type: :development
48
+ version: 0.0.2
49
+ type: :runtime
50
+ prerelease: false
68
51
  version_requirements: *id003
69
52
  - !ruby/object:Gem::Dependency
70
- name: jeweler
71
- prerelease: false
53
+ name: mysql2
72
54
  requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 7
78
- segments:
79
- - 1
80
- - 4
81
- - 0
82
- version: 1.4.0
83
- type: :development
84
- version_requirements: *id004
85
- - !ruby/object:Gem::Dependency
86
- name: rake
87
- prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
89
55
  none: false
90
56
  requirements:
91
57
  - - ">="
92
58
  - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
59
  version: "0"
97
60
  type: :development
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
- name: rdoc
101
61
  prerelease: false
102
- requirement: &id006 !ruby/object:Gem::Requirement
103
- none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- type: :development
112
- version_requirements: *id006
113
- - !ruby/object:Gem::Dependency
114
- name: rspec
115
- prerelease: false
116
- requirement: &id007 !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ~>
120
- - !ruby/object:Gem::Version
121
- hash: 7
122
- segments:
123
- - 2
124
- version: "2"
125
- type: :development
126
- version_requirements: *id007
62
+ version_requirements: *id004
127
63
  - !ruby/object:Gem::Dependency
128
64
  name: sniff
129
- prerelease: false
130
- requirement: &id008 !ruby/object:Gem::Requirement
65
+ requirement: &id005 !ruby/object:Gem::Requirement
131
66
  none: false
132
67
  requirements:
133
- - - ">="
68
+ - - ~>
134
69
  - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
137
- - 0
138
- version: "0"
70
+ version: 0.11.11
139
71
  type: :development
140
- version_requirements: *id008
141
- - !ruby/object:Gem::Dependency
142
- name: emitter
143
72
  prerelease: false
144
- requirement: &id009 !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ~>
148
- - !ruby/object:Gem::Version
149
- hash: 13
150
- segments:
151
- - 0
152
- - 3
153
- version: "0.3"
154
- type: :runtime
155
- version_requirements: *id009
73
+ version_requirements: *id005
156
74
  description: A software model in Ruby for the greenhouse gas emissions of a lodging
157
75
  email: andy@rossmeissl.net
158
76
  executables: []
@@ -161,28 +79,53 @@ extensions: []
161
79
 
162
80
  extra_rdoc_files:
163
81
  - LICENSE
82
+ - LICENSE-PREAMBLE
164
83
  - README.rdoc
165
84
  files:
85
+ - .document
86
+ - .gitignore
87
+ - Gemfile
166
88
  - LICENSE
89
+ - LICENSE-PREAMBLE
167
90
  - README.rdoc
91
+ - Rakefile
92
+ - VERSION
93
+ - certification_changelog.markdown
94
+ - dot.rvmrc
95
+ - features/lodging_committees.feature
96
+ - features/lodging_impacts.feature
97
+ - features/support/db/fixtures/census_divisions.csv
98
+ - features/support/db/fixtures/climate_divisions.csv
99
+ - features/support/db/fixtures/commercial_building_energy_consumption_survey_responses.csv
100
+ - features/support/db/fixtures/countries.csv
101
+ - features/support/db/fixtures/egrid_countries.csv
102
+ - features/support/db/fixtures/egrid_regions.csv
103
+ - features/support/db/fixtures/egrid_subregions.csv
104
+ - features/support/db/fixtures/fuel_years.csv
105
+ - features/support/db/fixtures/fuels.csv
106
+ - features/support/db/fixtures/lodging_classes.csv
107
+ - features/support/db/fixtures/lodging_properties.csv
108
+ - features/support/db/fixtures/states.csv
109
+ - features/support/db/fixtures/zip_codes.csv
110
+ - features/support/env.rb
111
+ - features/support/lodging_property.rb
112
+ - features/support/lodging_record.rb
168
113
  - lib/lodging.rb
169
- - lib/lodging/carbon_model.rb
114
+ - lib/lodging/cbecs.rb
170
115
  - lib/lodging/characterization.rb
171
116
  - lib/lodging/data.rb
172
- - lib/lodging/fallback.rb
117
+ - lib/lodging/impact_model.rb
173
118
  - lib/lodging/relationships.rb
174
119
  - lib/lodging/summarization.rb
175
- - lib/test_support/lodging_record.rb
176
- - features/support/env.rb
177
- - features/lodging_committees.feature
178
- - features/lodging_emissions.feature
179
- has_rdoc: true
180
- homepage: http://github.com/brighterplanet/lodging
120
+ - lib/lodging/version.rb
121
+ - lodging.gemspec
122
+ - todo.txt
123
+ homepage: https://github.com/brighterplanet/lodging
181
124
  licenses: []
182
125
 
183
126
  post_install_message:
184
- rdoc_options:
185
- - --charset=UTF-8
127
+ rdoc_options: []
128
+
186
129
  require_paths:
187
130
  - lib
188
131
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -190,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
133
  requirements:
191
134
  - - ">="
192
135
  - !ruby/object:Gem::Version
193
- hash: 3
136
+ hash: 3694912134130995247
194
137
  segments:
195
138
  - 0
196
139
  version: "0"
@@ -199,19 +142,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
142
  requirements:
200
143
  - - ">="
201
144
  - !ruby/object:Gem::Version
202
- hash: 3
145
+ hash: 3694912134130995247
203
146
  segments:
204
147
  - 0
205
148
  version: "0"
206
149
  requirements: []
207
150
 
208
151
  rubyforge_project:
209
- rubygems_version: 1.3.7
152
+ rubygems_version: 1.8.15
210
153
  signing_key:
211
154
  specification_version: 3
212
155
  summary: A carbon model
213
156
  test_files:
214
- - features/support/env.rb
215
157
  - features/lodging_committees.feature
216
- - features/lodging_emissions.feature
217
- - lib/test_support/lodging_record.rb
158
+ - features/lodging_impacts.feature
159
+ - features/support/db/fixtures/census_divisions.csv
160
+ - features/support/db/fixtures/climate_divisions.csv
161
+ - features/support/db/fixtures/commercial_building_energy_consumption_survey_responses.csv
162
+ - features/support/db/fixtures/countries.csv
163
+ - features/support/db/fixtures/egrid_countries.csv
164
+ - features/support/db/fixtures/egrid_regions.csv
165
+ - features/support/db/fixtures/egrid_subregions.csv
166
+ - features/support/db/fixtures/fuel_years.csv
167
+ - features/support/db/fixtures/fuels.csv
168
+ - features/support/db/fixtures/lodging_classes.csv
169
+ - features/support/db/fixtures/lodging_properties.csv
170
+ - features/support/db/fixtures/states.csv
171
+ - features/support/db/fixtures/zip_codes.csv
172
+ - features/support/env.rb
173
+ - features/support/lodging_property.rb
174
+ - features/support/lodging_record.rb
@@ -1,53 +0,0 @@
1
- Feature: Lodging Emissions Calculations
2
- The lodging model should generate correct emission calculations
3
-
4
- Scenario: Calculations starting from nothing
5
- Given a lodging has nothing
6
- When emissions are calculated
7
- Then the emission value should be within "0.1" kgs of "13.7"
8
-
9
- Scenario: Calculations starting from rooms
10
- Given a lodging has "rooms" of "5"
11
- When emissions are calculated
12
- Then the emission value should be within "0.1" kgs of "68.7"
13
-
14
- Scenario: Calculations starting from duration
15
- Given a lodging has "duration" of "5"
16
- When emissions are calculated
17
- Then the emission value should be within "0.1" kgs of "68.7"
18
-
19
- Scenario: Calculations starting from lodging class
20
- Given a lodging has "lodging_class.name" of "Luxury Hotel"
21
- When emissions are calculated
22
- Then the emission value should be within "0.1" kgs of "27.5"
23
-
24
- Scenario: Calculations starting from state
25
- Given a lodging has "state.postal_abbreviation" of "CA"
26
- When emissions are calculated
27
- Then the emission value should be within "0.1" kgs of "10.0"
28
-
29
- Scenario: Calculations starting from zip code
30
- Given a lodging has "zip_code.name" of "94122"
31
- When emissions are calculated
32
- Then the emission value should be within "0.1" kgs of "5.8"
33
-
34
- Scenario: Calculations starting from rooms, duration, and lodging class
35
- Given a lodging has "rooms" of "2"
36
- And it has "duration" of "2"
37
- And it has "lodging_class.name" of "Luxury Hotel"
38
- When emissions are calculated
39
- Then the emission value should be within "0.1" kgs of "110.0"
40
-
41
- Scenario: Calculations starting from rooms, duration, and state
42
- Given a lodging has "rooms" of "2"
43
- And it has "duration" of "2"
44
- And it has "state.postal_abbreviation" of "CA"
45
- When emissions are calculated
46
- Then the emission value should be within "0.1" kgs of "40.0"
47
-
48
- Scenario: Calculations starting from rooms, duration, and zip code
49
- Given a lodging has "rooms" of "2"
50
- And it has "duration" of "2"
51
- And it has "zip_code.name" of "94122"
52
- When emissions are calculated
53
- Then the emission value should be within "0.1" kgs of "23.3"
@@ -1,265 +0,0 @@
1
- # Copyright © 2010 Brighter Planet.
2
- # See LICENSE for details.
3
- # Contact Brighter Planet for dual-license arrangements.
4
-
5
- ## Lodging carbon model
6
- # This model is used by [Brighter Planet](http://brighterplanet.com)'s carbon emission [web service](http://carbon.brighterplanet.com) to estimate the **greenhouse gas emissions of a lodging** (e.g. a hotel stay).
7
- #
8
- ##### Calculations
9
- # The 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 `emission` calculation. Each calculation is named according to the value it returns.
10
- #
11
- ##### Methods
12
- # To 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.
13
- #
14
- ##### Standard compliance
15
- # Each 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.
16
- #
17
- ##### Collaboration
18
- # Contributions 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](http://github.com/brighterplanet/sniff#readme), our emitter testing framework, for more information.
19
- module BrighterPlanet
20
- module Lodging
21
- module CarbonModel
22
- def self.included(base)
23
- base.decide :emission, :with => :characteristics do
24
- ### Emission calculation
25
- # Returns the `emission` estimate (*kg CO<sub>2</sub>e*).
26
- committee :emission do
27
- #### Emission from rooms, duration, and emission factor
28
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
29
- #
30
- # Multiplies `rooms` by `duration` and the `emission factor` (*kg CO<sub>2</sub>e / room-night*) to give (*kg CO<sub>2</sub>e).
31
- quorum 'from rooms, duration, and emission factor', :needs => [:rooms, :duration, :emission_factor] do |characteristics|
32
- characteristics[:rooms] * characteristics[:duration] * characteristics[:emission_factor]
33
- end
34
-
35
- #### Default emission
36
- # **Complies:**
37
- #
38
- # Displays an error message if the previous method fails.
39
- quorum 'default' do
40
- raise "The emission committee's default quorum should never be called."
41
- end
42
- end
43
-
44
- ### Emission factor calculation
45
- # Returns the `emission factor` (*kg CO<sub>2</sub>e / room-night*)
46
- committee :emission_factor do
47
- #### Emission factor from fuel intensities and eGRID
48
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
49
- #
50
- # - Looks up the [natural gas](http://data.brighterplanet.com/fuels) emission factor (*kg CO<sub>2</sub>e / cubic m*)
51
- # - Looks up the [fuel oil](http://data.brighterplanet.com/fuels) emission factor (*kg CO<sub>2</sub>e / l*)
52
- # - Looks up the [eGRID subregion](http://data.brighterplanet.com/egrid_subregions) electricity emission factor
53
- # - Looks up the [eGRID region](http://data.brighterplanet.com/egrid_regions) electricity loss factor
54
- # - Adjusts the electricity emission factor upwards by dividing by 1 - the electricity loss factor
55
- # - Divides the natural gas emission factor (*kg CO<sub>2</sub>e / cubic m*) by the natural gas energy content (38,339,000 *J / cubic m*) to give an energy-based natural gas emission factor (*kg CO<sub>2</sub>e / J*)
56
- # - Divides the fuel oil emission factor (*kg CO<sub>2</sub>e / l*) by the fuel oil energy content (38,655,000 *J / l*) to give an energy-based fuel oil emission factor (*kg CO<sub>2</sub>e / J*)
57
- # - Divides the energy-based natural gas emission factor by 0.817 and the energy-based fuel oil emission factor by 0.846, adds these together and divides by 2, and divides by 0.95. This gives a district heat emission factor (*kg CO<sub>2</sub>e / J*) based on the assumption that district heat is produced by 50% natural gas and 50% fuel oil, natural gas boilers are 81.7% efficient, fuel oil boilers are 84.6% efficient, and transmission losses are 5%.
58
- # - Multiplies `natural gas intensity` by the natural gas emission factor, `fuel oil intensity` by the fuel oil emission factor, `electricity intensity` by the electricity emission factor, and `district heat intensity` by the district heat emission factor
59
- # - Adds these together
60
- quorum 'from fuel intensities and eGRID', :needs => [:natural_gas_intensity, :fuel_oil_intensity, :electricity_intensity, :district_heat_intensity, :egrid_subregion, :egrid_region] do |characteristics|
61
- natural_gas = FuelType.find_by_name "Commercial Natural Gas"
62
- fuel_oil = FuelType.find_by_name "Distillate Fuel Oil 2"
63
- natural_gas_energy_ef = natural_gas.emission_factor / 38_339_000
64
- fuel_oil_energy_ef = fuel_oil.emission_factor / 38_655_000
65
- district_heat_emission_factor = (((natural_gas_energy_ef / 0.817) / 2) + ((fuel_oil_energy_ef / 0.846) / 2)) / 0.95
66
-
67
- (characteristics[:natural_gas_intensity] * natural_gas.emission_factor) +
68
- (characteristics[:fuel_oil_intensity] * fuel_oil.emission_factor) +
69
- (characteristics[:electricity_intensity] / (1 - characteristics[:egrid_region].loss_factor) * characteristics[:egrid_subregion].electricity_emission_factor) +
70
- (characteristics[:district_heat_intensity] * district_heat_emission_factor)
71
- end
72
- end
73
-
74
- ### Natural gas intensity calculation
75
- # Returns the `natural gas intensity` (*cubic m / room-night*).
76
- committee :natural_gas_intensity do
77
- #### Natural gas intensity from census division
78
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
79
- #
80
- # Looks up the [census division](http://data.brighterplanet.com/census_divisions) `natural gas intensity` (*cubic m / room-night*).
81
- quorum 'from census division', :needs => :census_division do |characteristics|
82
- characteristics[:census_division].lodging_building_natural_gas_intensity
83
- end
84
-
85
- #### Natural gas intensity from lodging class
86
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
87
- #
88
- # Looks up the [lodging class](http://data.brighterplanet.com/lodging_class) `natural gas intensity` (*cubic m / room-night*).
89
- quorum 'from lodging class', :needs => :lodging_class do |characteristics|
90
- characteristics[:lodging_class].natural_gas_intensity
91
- end
92
- end
93
-
94
- ### Fuel oil intensity calculation
95
- # Returns the `fuel oil intensity` (*l / room-night*).
96
- committee :fuel_oil_intensity do
97
- #### Fuel oil intensity from census division
98
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
99
- #
100
- # Looks up the [census division](http://data.brighterplanet.com/census_divisions) `fuel oil intensity` (*l / room-night*).
101
- quorum 'from census division', :needs => :census_division do |characteristics|
102
- characteristics[:census_division].lodging_building_fuel_oil_intensity
103
- end
104
-
105
- #### Fuel oil intensity from lodging class
106
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
107
- #
108
- # Looks up the [lodging class](http://data.brighterplanet.com/lodging_class) `fuel oil intensity` (*l / room-night*).
109
- quorum 'from lodging class', :needs => :lodging_class do |characteristics|
110
- characteristics[:lodging_class].fuel_oil_intensity
111
- end
112
- end
113
-
114
- ### Electricity intensity calculation
115
- # Returns the `electricity intensity` (*kWh / room-night*).
116
- committee :electricity_intensity do
117
- #### Electricity intensity from census division
118
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
119
- #
120
- # Looks up the [census division](http://data.brighterplanet.com/census_divisions) `electricity intensity` (*kWh / room-night*).
121
- quorum 'from census division', :needs => :census_division do |characteristics|
122
- characteristics[:census_division].lodging_building_electricity_intensity
123
- end
124
-
125
- #### Electricity intensity from lodging class
126
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
127
- #
128
- # Looks up the [lodging class](http://data.brighterplanet.com/lodging classes) `electricity intensity` (*kWh / room-night*).
129
- quorum 'from lodging class', :needs => :lodging_class do |characteristics|
130
- characteristics[:lodging_class].electricity_intensity
131
- end
132
- end
133
-
134
- ### District heat intensity calculation
135
- # Returns the `district heat intensity` (*J / room-night*).
136
- committee :district_heat_intensity do
137
- #### District heat intensity from census division
138
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
139
- #
140
- # Looks up the [census division](http://data.brighterplanet.com/census_divisions) `district heat intensity` (*J / room-night*).
141
- quorum 'from census division', :needs => :census_division do |characteristics|
142
- characteristics[:census_division].lodging_building_district_heat_intensity
143
- end
144
-
145
- #### District heat intensity from lodging class
146
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
147
- #
148
- # Looks up the [lodging class](http://data.brighterplanet.com/lodging_classes) `district heat intensity` (*J / room-night*).
149
- quorum 'from lodging class', :needs => :lodging_class do |characteristics|
150
- characteristics[:lodging_class].district_heat_intensity
151
- end
152
- end
153
-
154
- ### Lodging class calculation
155
- # Returns the [lodging class](http://data.brighterplanet.com/lodging_classes).
156
- committee :lodging_class do
157
- #### Lodging class from client input
158
- # **Complies:** All
159
- #
160
- # Uses the client-input [loding class](http://data.brighterplanet.com/lodging_classes).
161
-
162
- #### Default lodging class
163
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
164
- #
165
- # Uses an artificial [lodging class](http://data.brighterplanet.com/lodging_classes) that represents the U.S. average.
166
- quorum 'default' do
167
- LodgingClass.find_by_name 'Average'
168
- end
169
- end
170
-
171
- ### eGRID region calculation
172
- # Returns the lodging's [eGRID region](http://data.brighterplanet.com/egrid_regions).
173
- committee :egrid_region do
174
- #### eGRID region from eGRID subregion
175
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
176
- #
177
- # Looks up the [eGRID subregion](http://data.brighterplanet.com/egrid_subregions) `eGRID region`.
178
- quorum 'from eGRID subregion', :needs => :egrid_subregion do |characteristics|
179
- characteristics[:egrid_subregion].egrid_region
180
- end
181
- end
182
-
183
- ### eGRID subregion calculation
184
- # Returns the lodging's [eGRID subregion](http://data.brighterplanet.com/egrid_subregions).
185
- committee :egrid_subregion do
186
- #### eGRID subregion from zip code
187
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
188
- #
189
- # Looks up the [zip code](http://data.brighterplanet.com/zip_codes) `eGRID subregion`.
190
- quorum 'from zip code', :needs => :zip_code do |characteristics|
191
- characteristics[:zip_code].egrid_subregion
192
- end
193
-
194
- #### Default eGRID subregion
195
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
196
- #
197
- # Uses an artificial [eGRID subregion](http://data.brighterplanet.com/egrid_subregions) that represents the U.S. average.
198
- quorum 'default' do
199
- EgridSubregion.find_by_abbreviation 'US'
200
- end
201
- end
202
-
203
- ### Census division calculation
204
- # Returns the lodging's [census division](http://data.brighterplanet.com/census_divisions).
205
- committee :census_division do
206
- #### Census division from state
207
- # Looks up the [state](http://data.brighterplanet.com/states) `census division`.
208
- quorum 'from state', :needs => :state do |characteristics|
209
- characteristics[:state].census_division
210
- end
211
- end
212
-
213
- ### State calculation
214
- # Returns the lodging's [state](http://data.brighterplanet.com/states).
215
- committee :state do
216
- #### State from zip code
217
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
218
- #
219
- # Looks up the [zip code](http://data.brighterplanet.com/zip_codes) `state`.
220
- quorum 'from zip code', :needs => :zip_code do |characteristics|
221
- characteristics[:zip_code].state
222
- end
223
- end
224
-
225
- ### Zip code calculation
226
- # Returns the client-input [zip code](http://data.brighterplanet.com/zip_codes).
227
-
228
- ### Duration calculation
229
- # Returns the stay's `duration` (*nights*).
230
- committee :duration do
231
- #### Duration from client input
232
- # **Complies:** All
233
- #
234
- # Uses the client-input `duration` (*nights*).
235
-
236
- #### Default duration
237
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
238
- #
239
- # Uses 1 *night*.
240
- quorum 'default' do
241
- 1
242
- end
243
- end
244
-
245
- ### Rooms calculation
246
- # Returns the number of `rooms` used.
247
- committee :rooms do
248
- #### Rooms from client input
249
- # **Complies:** All
250
- #
251
- # Uses the client-input number of `rooms`.
252
-
253
- #### Default rooms
254
- # **Complies:** GHG Protocol, ISO 14064-1, Climate Registry Protocol
255
- #
256
- # Uses 1 room.
257
- quorum 'default' do
258
- 1
259
- end
260
- end
261
- end
262
- end
263
- end
264
- end
265
- end