meeting 0.0.5 → 0.0.6
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.
- data/features/meeting_committees.feature +33 -32
- data/features/meeting_emissions.feature +4 -4
- data/lib/meeting/carbon_model.rb +4 -33
- metadata +19 -3
@@ -27,6 +27,12 @@ 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 default
|
31
|
+
Given a meeting emitter
|
32
|
+
When the "egrid_subregion" committee is calculated
|
33
|
+
Then the committee should have used quorum "default"
|
34
|
+
And the conclusion of the committee should have "abbreviation" of "US"
|
35
|
+
|
30
36
|
Scenario: eGRID subregion committee from zip code
|
31
37
|
Given a meeting emitter
|
32
38
|
And a characteristic "zip_code.name" of "94122"
|
@@ -34,6 +40,13 @@ Feature: Meeting Committee Calculations
|
|
34
40
|
Then the committee should have used quorum "from zip code"
|
35
41
|
And the conclusion of the committee should have "abbreviation" of "CAMX"
|
36
42
|
|
43
|
+
Scenario: eGRID region committee from nothing
|
44
|
+
Given a meeting emitter
|
45
|
+
When the "egrid_subregion" committee is calculated
|
46
|
+
And the "egrid_region" committee is calculated
|
47
|
+
Then the committee should have used quorum "from eGRID subregion"
|
48
|
+
And the conclusion of the committee should have "name" of "US"
|
49
|
+
|
37
50
|
Scenario: eGRID region committee from eGRID subregion
|
38
51
|
Given a meeting emitter
|
39
52
|
And a characteristic "egrid_subregion.abbreviation" of "CAMX"
|
@@ -56,25 +69,21 @@ Feature: Meeting Committee Calculations
|
|
56
69
|
|
57
70
|
Scenario: Electricity intensity committee from default
|
58
71
|
Given a meeting emitter
|
59
|
-
When the "electricity_intensity" committee is calculated
|
60
|
-
Then the committee should have used quorum "default"
|
61
|
-
And the conclusion of the committee should be "0.072444"
|
62
|
-
|
63
|
-
Scenario: Electricity intensity committee from eGRID region
|
64
|
-
Given a meeting emitter
|
65
|
-
And a characteristic "zip_code.name" of "94122"
|
66
72
|
When the "egrid_subregion" committee is calculated
|
67
73
|
And the "egrid_region" committee is calculated
|
68
74
|
And the "electricity_intensity" committee is calculated
|
69
75
|
Then the committee should have used quorum "from eGRID region"
|
70
|
-
And the conclusion of the committee should be "0.
|
76
|
+
And the conclusion of the committee should be "0.07626"
|
71
77
|
|
72
|
-
Scenario: Electricity intensity committee from
|
78
|
+
Scenario: Electricity intensity committee from state
|
73
79
|
Given a meeting emitter
|
74
|
-
And a characteristic "
|
75
|
-
When the "
|
76
|
-
|
77
|
-
And the
|
80
|
+
And a characteristic "state.postal_abbreviation" of "CA"
|
81
|
+
When the "census_division" committee is calculated
|
82
|
+
And the "egrid_subregion" committee is calculated
|
83
|
+
And the "egrid_region" committee is calculated
|
84
|
+
And the "electricity_intensity" committee is calculated
|
85
|
+
Then the committee should have used quorum "from eGRID region and census division"
|
86
|
+
And the conclusion of the committee should be "3.15789"
|
78
87
|
|
79
88
|
Scenario: Electricity intensity committee from eGRID region and census division
|
80
89
|
Given a meeting emitter
|
@@ -115,29 +124,21 @@ Feature: Meeting Committee Calculations
|
|
115
124
|
|
116
125
|
Scenario: Emission factor committee from nothing
|
117
126
|
Given a meeting emitter
|
118
|
-
When the "
|
119
|
-
And the "
|
120
|
-
And the "
|
121
|
-
And the "district_heat_intensity" committee is calculated
|
122
|
-
And the "emission_factor" committee is calculated
|
123
|
-
Then the committee should have used quorum "from fuel intensities"
|
124
|
-
And the conclusion of the committee should be "0.15470"
|
125
|
-
|
126
|
-
Scenario: Emission factor committee from census division
|
127
|
-
Given a meeting emitter
|
128
|
-
And a characteristic "census_division.number" of "9"
|
129
|
-
When the "natural_gas_intensity" committee is calculated
|
127
|
+
When the "egrid_subregion" committee is calculated
|
128
|
+
And the "egrid_region" committee is calculated
|
129
|
+
And the "natural_gas_intensity" committee is calculated
|
130
130
|
And the "fuel_oil_intensity" committee is calculated
|
131
131
|
And the "electricity_intensity" committee is calculated
|
132
132
|
And the "district_heat_intensity" committee is calculated
|
133
133
|
And the "emission_factor" committee is calculated
|
134
|
-
Then the committee should have used quorum "from fuel intensities"
|
135
|
-
And the conclusion of the committee should be "
|
134
|
+
Then the committee should have used quorum "from eGRID subregion and fuel intensities"
|
135
|
+
And the conclusion of the committee should be "0.16232"
|
136
136
|
|
137
|
-
Scenario: Emission factor committee from
|
137
|
+
Scenario: Emission factor committee from state
|
138
138
|
Given a meeting emitter
|
139
|
-
And a characteristic "
|
140
|
-
When the "
|
139
|
+
And a characteristic "state.postal_abbreviation" of "CA"
|
140
|
+
When the "census_division" committee is calculated
|
141
|
+
And the "egrid_subregion" committee is calculated
|
141
142
|
And the "egrid_region" committee is calculated
|
142
143
|
And the "natural_gas_intensity" committee is calculated
|
143
144
|
And the "fuel_oil_intensity" committee is calculated
|
@@ -145,9 +146,9 @@ Feature: Meeting Committee Calculations
|
|
145
146
|
And the "district_heat_intensity" committee is calculated
|
146
147
|
And the "emission_factor" committee is calculated
|
147
148
|
Then the committee should have used quorum "from eGRID subregion and fuel intensities"
|
148
|
-
And the conclusion of the committee should be "
|
149
|
+
And the conclusion of the committee should be "8.81581"
|
149
150
|
|
150
|
-
Scenario: Emission factor committee from
|
151
|
+
Scenario: Emission factor committee from zip code
|
151
152
|
Given a meeting emitter
|
152
153
|
And a characteristic "zip_code.name" of "94122"
|
153
154
|
When the "state" committee is calculated
|
@@ -4,22 +4,22 @@ Feature: Meeting Emissions Calculations
|
|
4
4
|
Scenario: Calculations starting from nothing
|
5
5
|
Given a meeting has nothing
|
6
6
|
When emissions are calculated
|
7
|
-
Then the emission value should be within "0.1" kgs of "
|
7
|
+
Then the emission value should be within "0.1" kgs of "1538.2"
|
8
8
|
|
9
9
|
Scenario: Calculations starting from duration
|
10
10
|
Given a meeting has "duration" of "1"
|
11
11
|
When emissions are calculated
|
12
|
-
Then the emission value should be within "0.1" kgs of "
|
12
|
+
Then the emission value should be within "0.1" kgs of "192.3"
|
13
13
|
|
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 "0.1" kgs of "
|
17
|
+
Then the emission value should be within "0.1" kgs of "1298.6"
|
18
18
|
|
19
19
|
Scenario: Calculations starting from state
|
20
20
|
Given a meeting has "state.postal_abbreviation" of "CA"
|
21
21
|
When emissions are calculated
|
22
|
-
Then the emission value should be within "0.1" kgs of "
|
22
|
+
Then the emission value should be within "0.1" kgs of "83539.6"
|
23
23
|
|
24
24
|
Scenario: Calculations starting from zip code
|
25
25
|
Given a meeting has "zip_code.name" of "94122"
|
data/lib/meeting/carbon_model.rb
CHANGED
@@ -39,31 +39,6 @@ module BrighterPlanet
|
|
39
39
|
(characteristics[:electricity_intensity] * characteristics[:egrid_subregion].electricity_emission_factor) +
|
40
40
|
(characteristics[:district_heat_intensity] * district_heat_emission_factor)
|
41
41
|
end
|
42
|
-
|
43
|
-
quorum 'from fuel intensities', :needs => [:natural_gas_intensity, :fuel_oil_intensity, :electricity_intensity, :district_heat_intensity] do |characteristics|
|
44
|
-
natural_gas = FuelType.find_by_name "Commercial Natural Gas"
|
45
|
-
fuel_oil = FuelType.find_by_name "Distillate Fuel Oil 2"
|
46
|
-
electricity = ResidenceFuelType.find_by_name "electricity"
|
47
|
-
|
48
|
-
# FIXME TODO won't need this once we convert emission factors to co2 / unit energy
|
49
|
-
# kg / J kg / cubic m J / cubic m
|
50
|
-
natural_gas_energy_ef = natural_gas.emission_factor / 38_339_000
|
51
|
-
|
52
|
-
# FIXME TODO won't need this once we convert emission factors to co2 / unit energy
|
53
|
-
# kg / J kg / l J / l
|
54
|
-
fuel_oil_energy_ef = fuel_oil.emission_factor / 38_655_000
|
55
|
-
|
56
|
-
# based on CA-CP calculator
|
57
|
-
# assume district heat is 50% natural gas 50% distillate fuel
|
58
|
-
# assume natural gas boilers 81.7% efficient; fuel oil boilers 84.6% efficient
|
59
|
-
# assume 5% transmission loss
|
60
|
-
district_heat_emission_factor = (((natural_gas_energy_ef / 0.817) / 2) + ((fuel_oil_energy_ef / 0.846) / 2)) / 0.95
|
61
|
-
|
62
|
-
(characteristics[:natural_gas_intensity] * natural_gas.emission_factor) +
|
63
|
-
(characteristics[:fuel_oil_intensity] * fuel_oil.emission_factor) +
|
64
|
-
(characteristics[:electricity_intensity] * electricity.emission_factor) +
|
65
|
-
(characteristics[:district_heat_intensity] * district_heat_emission_factor)
|
66
|
-
end
|
67
42
|
end
|
68
43
|
|
69
44
|
committee :natural_gas_intensity do # returns cubic metres per square metre hour
|
@@ -91,17 +66,9 @@ module BrighterPlanet
|
|
91
66
|
characteristics[:census_division].meeting_building_electricity_intensity / (1 - characteristics[:egrid_region].loss_factor)
|
92
67
|
end
|
93
68
|
|
94
|
-
quorum 'from census division', :needs => :census_division do |characteristics|
|
95
|
-
characteristics[:census_division].meeting_building_electricity_intensity
|
96
|
-
end
|
97
|
-
|
98
69
|
quorum 'from eGRID region', :needs => :egrid_region do |characteristics|
|
99
70
|
CensusDivision.fallback.meeting_building_electricity_intensity / (1 - characteristics[:egrid_region].loss_factor)
|
100
71
|
end
|
101
|
-
|
102
|
-
quorum 'default' do
|
103
|
-
CensusDivision.fallback.meeting_building_electricity_intensity
|
104
|
-
end
|
105
72
|
end
|
106
73
|
|
107
74
|
committee :district_heat_intensity do # returns joules per square metre hour
|
@@ -124,6 +91,10 @@ module BrighterPlanet
|
|
124
91
|
quorum 'from zip code', :needs => :zip_code do |characteristics|
|
125
92
|
characteristics[:zip_code].egrid_subregion
|
126
93
|
end
|
94
|
+
|
95
|
+
quorum 'default' do
|
96
|
+
EgridSubregion.find_by_abbreviation 'US'
|
97
|
+
end
|
127
98
|
end
|
128
99
|
|
129
100
|
committee :census_division do # returns 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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
@@ -164,6 +164,22 @@ dependencies:
|
|
164
164
|
version: 0.1.4
|
165
165
|
type: :runtime
|
166
166
|
version_requirements: *id009
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: earth
|
169
|
+
prerelease: false
|
170
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ~>
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
hash: 21
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
- 2
|
179
|
+
- 1
|
180
|
+
version: 0.2.1
|
181
|
+
type: :runtime
|
182
|
+
version_requirements: *id010
|
167
183
|
description: A software model in Ruby for the greenhouse gas emissions of a meeting
|
168
184
|
email: andy@rossmeissl.net
|
169
185
|
executables: []
|