meeting 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,6 +27,20 @@ Feature: Meeting Committee Calculations
27
27
  Then the committee should have used quorum "from state"
28
28
  And the conclusion of the committee should have "number" of "9"
29
29
 
30
+ Scenario: eGRID subregion committee from zip code
31
+ Given a meeting emitter
32
+ And a characteristic "zip_code.name" of "94122"
33
+ When the "egrid_subregion" committee is calculated
34
+ Then the committee should have used quorum "from zip code"
35
+ And the conclusion of the committee should have "abbreviation" of "CAMX"
36
+
37
+ Scenario: eGRID region committee from eGRID subregion
38
+ Given a meeting emitter
39
+ And a characteristic "egrid_subregion.abbreviation" of "CAMX"
40
+ When the "egrid_region" committee is calculated
41
+ Then the committee should have used quorum "from eGRID subregion"
42
+ And the conclusion of the committee should have "name" of "W"
43
+
30
44
  Scenario: District heat intensity committee from default
31
45
  Given a meeting emitter
32
46
  When the "district_heat_intensity" committee is calculated
@@ -46,6 +60,15 @@ Feature: Meeting Committee Calculations
46
60
  Then the committee should have used quorum "default"
47
61
  And the conclusion of the committee should be "0.072444"
48
62
 
63
+ Scenario: Electricity intensity committee from eGRID region
64
+ Given a meeting emitter
65
+ And a characteristic "zip_code.name" of "94122"
66
+ When the "egrid_subregion" committee is calculated
67
+ And the "egrid_region" committee is calculated
68
+ And the "electricity_intensity" committee is calculated
69
+ Then the committee should have used quorum "from eGRID region"
70
+ And the conclusion of the committee should be "0.080493"
71
+
49
72
  Scenario: Electricity intensity committee from census division
50
73
  Given a meeting emitter
51
74
  And a characteristic "census_division.number" of "9"
@@ -53,6 +76,17 @@ Feature: Meeting Committee Calculations
53
76
  Then the committee should have used quorum "from census division"
54
77
  And the conclusion of the committee should be "3"
55
78
 
79
+ Scenario: Electricity intensity committee from eGRID region and census division
80
+ Given a meeting emitter
81
+ And a characteristic "zip_code.name" of "94122"
82
+ When the "state" committee is calculated
83
+ And the "census_division" committee is calculated
84
+ And the "egrid_subregion" committee is calculated
85
+ And the "egrid_region" committee is calculated
86
+ And the "electricity_intensity" committee is calculated
87
+ Then the committee should have used quorum "from eGRID region and census division"
88
+ And the conclusion of the committee should be "3.33333"
89
+
56
90
  Scenario: Fuel oil intensity committee from default
57
91
  Given a meeting emitter
58
92
  When the "fuel_oil_intensity" committee is calculated
@@ -99,3 +133,31 @@ Feature: Meeting Committee Calculations
99
133
  And the "emission_factor" committee is calculated
100
134
  Then the committee should have used quorum "from fuel intensities"
101
135
  And the conclusion of the committee should be "8.50002"
136
+
137
+ Scenario: Emission factor committee from eGRID subregion
138
+ Given a meeting emitter
139
+ And a characteristic "zip_code.name" of "94122"
140
+ When the "egrid_subregion" committee is calculated
141
+ And the "egrid_region" committee is calculated
142
+ And the "natural_gas_intensity" committee is calculated
143
+ And the "fuel_oil_intensity" committee is calculated
144
+ And the "electricity_intensity" committee is calculated
145
+ And the "district_heat_intensity" committee is calculated
146
+ And the "emission_factor" committee is calculated
147
+ Then the committee should have used quorum "from eGRID subregion and fuel intensities"
148
+ And the conclusion of the committee should be "0.09030"
149
+
150
+ Scenario: Emission factor committee from eGRID subregion and census division
151
+ Given a meeting emitter
152
+ And a characteristic "zip_code.name" of "94122"
153
+ When the "state" committee is calculated
154
+ And the "census_division" committee is calculated
155
+ And the "egrid_subregion" committee is calculated
156
+ And the "egrid_region" committee is calculated
157
+ And the "natural_gas_intensity" committee is calculated
158
+ And the "fuel_oil_intensity" committee is calculated
159
+ And the "electricity_intensity" committee is calculated
160
+ And the "district_heat_intensity" committee is calculated
161
+ And the "emission_factor" committee is calculated
162
+ Then the committee should have used quorum "from eGRID subregion and fuel intensities"
163
+ And the conclusion of the committee should be "5.83336"
@@ -14,16 +14,21 @@ Feature: Meeting Emissions Calculations
14
14
  Scenario: Calculations starting from area
15
15
  Given a meeting has "area" of "1000"
16
16
  When emissions are calculated
17
- Then the emission value should be within "1" kgs of "1237.6"
17
+ Then the emission value should be within "0.1" kgs of "1237.6"
18
+
19
+ Scenario: Calculations starting from state
20
+ Given a meeting has "state.postal_abbreviation" of "CA"
21
+ When emissions are calculated
22
+ Then the emission value should be within "0.1" kgs of "80547.2"
18
23
 
19
24
  Scenario: Calculations starting from zip code
20
25
  Given a meeting has "zip_code.name" of "94122"
21
26
  When emissions are calculated
22
- Then the emission value should be within "1" kgs of "80547"
27
+ Then the emission value should be within "0.1" kgs of "55277.5"
23
28
 
24
29
  Scenario: Calculations starting from duration, area, and zip code
25
30
  Given a meeting has "duration" of "1"
26
31
  And it has "area" of "1000"
27
32
  And it has "zip_code.name" of "94122"
28
33
  When emissions are calculated
29
- Then the emission value should be within "0.1" kgs of "8500.0"
34
+ Then the emission value should be within "0.1" kgs of "5833.4"
@@ -16,6 +16,30 @@ module BrighterPlanet
16
16
  end
17
17
 
18
18
  committee :emission_factor do # returns kg CO2e / square metre hour
19
+ quorum 'from eGRID subregion and fuel intensities', :needs => [:egrid_subregion, :natural_gas_intensity, :fuel_oil_intensity, :electricity_intensity, :district_heat_intensity] do |characteristics|
20
+ natural_gas = FuelType.find_by_name "Commercial Natural Gas"
21
+ fuel_oil = FuelType.find_by_name "Distillate Fuel Oil 2"
22
+
23
+ # FIXME TODO won't need this once we convert emission factors to co2 / unit energy
24
+ # kg / J kg / cubic m J / cubic m
25
+ natural_gas_energy_ef = natural_gas.emission_factor / 38_339_000
26
+
27
+ # FIXME TODO won't need this once we convert emission factors to co2 / unit energy
28
+ # kg / J kg / l J / l
29
+ fuel_oil_energy_ef = fuel_oil.emission_factor / 38_655_000
30
+
31
+ # based on CA-CP calculator
32
+ # assume district heat is 50% natural gas 50% distillate fuel
33
+ # assume natural gas boilers 81.7% efficient; fuel oil boilers 84.6% efficient
34
+ # assume 5% transmission loss
35
+ district_heat_emission_factor = (((natural_gas_energy_ef / 0.817) / 2) + ((fuel_oil_energy_ef / 0.846) / 2)) / 0.95
36
+
37
+ (characteristics[:natural_gas_intensity] * natural_gas.emission_factor) +
38
+ (characteristics[:fuel_oil_intensity] * fuel_oil.emission_factor) +
39
+ (characteristics[:electricity_intensity] * characteristics[:egrid_subregion].electricity_emission_factor) +
40
+ (characteristics[:district_heat_intensity] * district_heat_emission_factor)
41
+ end
42
+
19
43
  quorum 'from fuel intensities', :needs => [:natural_gas_intensity, :fuel_oil_intensity, :electricity_intensity, :district_heat_intensity] do |characteristics|
20
44
  natural_gas = FuelType.find_by_name "Commercial Natural Gas"
21
45
  fuel_oil = FuelType.find_by_name "Distillate Fuel Oil 2"
@@ -51,7 +75,7 @@ module BrighterPlanet
51
75
  CensusDivision.fallback.meeting_building_natural_gas_intensity
52
76
  end
53
77
  end
54
-
78
+
55
79
  committee :fuel_oil_intensity do # returns litres per square metre hour
56
80
  quorum 'from census division', :needs => :census_division do |characteristics|
57
81
  characteristics[:census_division].meeting_building_fuel_oil_intensity
@@ -61,17 +85,25 @@ module BrighterPlanet
61
85
  CensusDivision.fallback.meeting_building_fuel_oil_intensity
62
86
  end
63
87
  end
64
-
88
+
65
89
  committee :electricity_intensity do # returns kilowatt hours per square metre hour
90
+ quorum 'from eGRID region and census division', :needs => [:egrid_region, :census_division] do |characteristics|
91
+ characteristics[:census_division].meeting_building_electricity_intensity / (1 - characteristics[:egrid_region].loss_factor)
92
+ end
93
+
66
94
  quorum 'from census division', :needs => :census_division do |characteristics|
67
95
  characteristics[:census_division].meeting_building_electricity_intensity
68
96
  end
69
97
 
98
+ quorum 'from eGRID region', :needs => :egrid_region do |characteristics|
99
+ CensusDivision.fallback.meeting_building_electricity_intensity / (1 - characteristics[:egrid_region].loss_factor)
100
+ end
101
+
70
102
  quorum 'default' do
71
103
  CensusDivision.fallback.meeting_building_electricity_intensity
72
104
  end
73
105
  end
74
-
106
+
75
107
  committee :district_heat_intensity do # returns joules per square metre hour
76
108
  quorum 'from census division', :needs => :census_division do |characteristics|
77
109
  characteristics[:census_division].meeting_building_district_heat_intensity
@@ -82,6 +114,18 @@ module BrighterPlanet
82
114
  end
83
115
  end
84
116
 
117
+ committee :egrid_region do # returns eGRID region
118
+ quorum 'from eGRID subregion', :needs => :egrid_subregion do |characteristics|
119
+ characteristics[:egrid_subregion].egrid_region
120
+ end
121
+ end
122
+
123
+ committee :egrid_subregion do # returns eGRID subregion
124
+ quorum 'from zip code', :needs => :zip_code do |characteristics|
125
+ characteristics[:zip_code].egrid_subregion
126
+ end
127
+ end
128
+
85
129
  committee :census_division do # returns census division
86
130
  quorum 'from state', :needs => :state do |characteristics|
87
131
  characteristics[:state].census_division
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meeting
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Rossmeissl
@@ -19,14 +19,13 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-09-22 00:00:00 -04:00
22
+ date: 2010-09-22 00:00:00 -07:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
- type: :development
27
- prerelease: false
28
26
  name: activerecord
29
- version_requirements: &id001 !ruby/object:Gem::Requirement
27
+ prerelease: false
28
+ requirement: &id001 !ruby/object:Gem::Requirement
30
29
  none: false
31
30
  requirements:
32
31
  - - ~>
@@ -37,12 +36,12 @@ dependencies:
37
36
  - 0
38
37
  - 0
39
38
  version: 3.0.0
40
- requirement: *id001
41
- - !ruby/object:Gem::Dependency
42
39
  type: :development
43
- prerelease: false
40
+ version_requirements: *id001
41
+ - !ruby/object:Gem::Dependency
44
42
  name: bundler
45
- version_requirements: &id002 !ruby/object:Gem::Requirement
43
+ prerelease: false
44
+ requirement: &id002 !ruby/object:Gem::Requirement
46
45
  none: false
47
46
  requirements:
48
47
  - - ~>
@@ -53,12 +52,12 @@ dependencies:
53
52
  - 0
54
53
  - 0
55
54
  version: 1.0.0
56
- requirement: *id002
57
- - !ruby/object:Gem::Dependency
58
55
  type: :development
59
- prerelease: false
56
+ version_requirements: *id002
57
+ - !ruby/object:Gem::Dependency
60
58
  name: cucumber
61
- version_requirements: &id003 !ruby/object:Gem::Requirement
59
+ prerelease: false
60
+ requirement: &id003 !ruby/object:Gem::Requirement
62
61
  none: false
63
62
  requirements:
64
63
  - - ~>
@@ -69,12 +68,12 @@ dependencies:
69
68
  - 8
70
69
  - 3
71
70
  version: 0.8.3
72
- requirement: *id003
73
- - !ruby/object:Gem::Dependency
74
71
  type: :development
75
- prerelease: false
72
+ version_requirements: *id003
73
+ - !ruby/object:Gem::Dependency
76
74
  name: jeweler
77
- version_requirements: &id004 !ruby/object:Gem::Requirement
75
+ prerelease: false
76
+ requirement: &id004 !ruby/object:Gem::Requirement
78
77
  none: false
79
78
  requirements:
80
79
  - - ~>
@@ -85,12 +84,12 @@ dependencies:
85
84
  - 4
86
85
  - 0
87
86
  version: 1.4.0
88
- requirement: *id004
89
- - !ruby/object:Gem::Dependency
90
87
  type: :development
91
- prerelease: false
88
+ version_requirements: *id004
89
+ - !ruby/object:Gem::Dependency
92
90
  name: rake
93
- version_requirements: &id005 !ruby/object:Gem::Requirement
91
+ prerelease: false
92
+ requirement: &id005 !ruby/object:Gem::Requirement
94
93
  none: false
95
94
  requirements:
96
95
  - - ">="
@@ -99,12 +98,12 @@ dependencies:
99
98
  segments:
100
99
  - 0
101
100
  version: "0"
102
- requirement: *id005
103
- - !ruby/object:Gem::Dependency
104
101
  type: :development
105
- prerelease: false
102
+ version_requirements: *id005
103
+ - !ruby/object:Gem::Dependency
106
104
  name: rdoc
107
- version_requirements: &id006 !ruby/object:Gem::Requirement
105
+ prerelease: false
106
+ requirement: &id006 !ruby/object:Gem::Requirement
108
107
  none: false
109
108
  requirements:
110
109
  - - ">="
@@ -113,12 +112,12 @@ dependencies:
113
112
  segments:
114
113
  - 0
115
114
  version: "0"
116
- requirement: *id006
117
- - !ruby/object:Gem::Dependency
118
115
  type: :development
119
- prerelease: false
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
120
118
  name: rspec
121
- version_requirements: &id007 !ruby/object:Gem::Requirement
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
122
121
  none: false
123
122
  requirements:
124
123
  - - ~>
@@ -131,12 +130,12 @@ dependencies:
131
130
  - beta
132
131
  - 17
133
132
  version: 2.0.0.beta.17
134
- requirement: *id007
135
- - !ruby/object:Gem::Dependency
136
133
  type: :development
137
- prerelease: false
134
+ version_requirements: *id007
135
+ - !ruby/object:Gem::Dependency
138
136
  name: sniff
139
- version_requirements: &id008 !ruby/object:Gem::Requirement
137
+ prerelease: false
138
+ requirement: &id008 !ruby/object:Gem::Requirement
140
139
  none: false
141
140
  requirements:
142
141
  - - ~>
@@ -147,12 +146,12 @@ dependencies:
147
146
  - 1
148
147
  - 12
149
148
  version: 0.1.12
150
- requirement: *id008
149
+ type: :development
150
+ version_requirements: *id008
151
151
  - !ruby/object:Gem::Dependency
152
- type: :runtime
153
- prerelease: false
154
152
  name: emitter
155
- version_requirements: &id009 !ruby/object:Gem::Requirement
153
+ prerelease: false
154
+ requirement: &id009 !ruby/object:Gem::Requirement
156
155
  none: false
157
156
  requirements:
158
157
  - - ~>
@@ -163,7 +162,8 @@ dependencies:
163
162
  - 1
164
163
  - 4
165
164
  version: 0.1.4
166
- requirement: *id009
165
+ type: :runtime
166
+ version_requirements: *id009
167
167
  description: A software model in Ruby for the greenhouse gas emissions of a meeting
168
168
  email: andy@rossmeissl.net
169
169
  executables: []