computation 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/TODO ADDED
@@ -0,0 +1,14 @@
1
+ * In the future: add parameters for
2
+ * cpu wattage
3
+ * hard disk
4
+ * memory
5
+ * hosting company
6
+ * develop power usage estimates for different companies
7
+
8
+ * Develop plugin for New Relic
9
+ * API key parameter
10
+ * ENV Parameters for carbon model
11
+ * Website badge
12
+ * Link for site owners to buy offsets
13
+ * Future: display how much has been offset on badge
14
+
@@ -11,7 +11,7 @@ Feature: Computation Committee Calculations
11
11
  Given a computation emitter
12
12
  When the "duration" committee is calculated
13
13
  Then the committee should have used quorum "default"
14
- And the conclusion of the committee should be "1.0"
14
+ And the conclusion of the committee should be "3600.0"
15
15
 
16
16
  Scenario: eGRID subregion committee from default
17
17
  Given a computation emitter
@@ -53,10 +53,24 @@ Feature: Computation Committee Calculations
53
53
  Then the committee should have used quorum "default"
54
54
  And the conclusion of the committee should be "1.5"
55
55
 
56
+ Scenario Outline: Duration in hours from duration
57
+ Given a computation emitter
58
+ And a characteristic "duration" of "<seconds>"
59
+ When the "duration_in_hours" committee is calculated
60
+ Then the committee should have used quorum "from duration"
61
+ And the conclusion of the committee should be "<hours>"
62
+ Examples:
63
+ | seconds | hours |
64
+ | 0.0 | 0.0 |
65
+ | 1800.0 | 0.5 |
66
+ | 3600.0 | 1.0 |
67
+ | 7200.0 | 2.0 |
68
+
56
69
  Scenario: Electricity use commitee from default EC2 compute units, duration, electricity intensity, zip code, and PUE
57
70
  Given a computation emitter
58
71
  When the "ec2_compute_units" committee is calculated
59
72
  And the "duration" committee is calculated
73
+ And the "duration_in_hours" committee is calculated
60
74
  And the "egrid_subregion" committee is calculated
61
75
  And the "egrid_region" committee is calculated
62
76
  And the "electricity_intensity" committee is calculated
@@ -68,10 +82,11 @@ Feature: Computation Committee Calculations
68
82
  Scenario: Electricity use commitee from EC2 compute units, duration, electricity intensity, zip code, and PUE
69
83
  Given a computation emitter
70
84
  And a characteristic "ec2_compute_units" of "10"
71
- And a characteristic "duration" of "10"
85
+ And a characteristic "duration" of "36000"
72
86
  And a characteristic "zip_code.name" of "94122"
73
87
  And a characteristic "electricity_intensity" of "1.0"
74
88
  And a characteristic "power_usage_effectiveness" of "2.0"
89
+ When the "duration_in_hours" committee is calculated
75
90
  And the "egrid_subregion" committee is calculated
76
91
  And the "egrid_region" committee is calculated
77
92
  And the "electricity_use" committee is calculated
@@ -12,7 +12,7 @@ Feature: Computation Emissions Calculations
12
12
  Then the emission value should be within "0.01" kgs of "2.81"
13
13
 
14
14
  Scenario: Calculations starting from duration
15
- Given a computation has "duration" of "10"
15
+ Given a computation has "duration" of "36000"
16
16
  When emissions are calculated
17
17
  Then the emission value should be within "0.01" kgs of "2.81"
18
18
 
@@ -33,7 +33,7 @@ Feature: Computation Emissions Calculations
33
33
 
34
34
  Scenario: Calculations starting from EC2 compute units, duration, electricity intensity, zip code, and PUE
35
35
  Given a computation has "ec2_compute_units" of "10"
36
- And it has "duration" of "10"
36
+ And it has "duration" of "36000"
37
37
  And it has "zip_code.name" of "94122"
38
38
  And it has "electricity_intensity" of "1.0"
39
39
  And it has "power_usage_effectiveness" of "2.0"
@@ -20,8 +20,14 @@ module BrighterPlanet
20
20
  end
21
21
 
22
22
  committee :electricity_use do # returns kWh including distribution losses
23
- quorum 'from compute units, time, electricity intensity, PUE, and eGRID region', :needs => [:ec2_compute_units, :duration, :electricity_intensity, :power_usage_effectiveness, :egrid_region] do |characteristics|
24
- (characteristics[:ec2_compute_units] * characteristics[:duration] * characteristics[:electricity_intensity] * characteristics[:power_usage_effectiveness]) / (1 - characteristics[:egrid_region].loss_factor)
23
+ quorum 'from compute units, time, electricity intensity, PUE, and eGRID region', :needs => [:ec2_compute_units, :duration_in_hours, :electricity_intensity, :power_usage_effectiveness, :egrid_region] do |characteristics|
24
+ (characteristics[:ec2_compute_units] * characteristics[:duration_in_hours] * characteristics[:electricity_intensity] * characteristics[:power_usage_effectiveness]) / (1 - characteristics[:egrid_region].loss_factor)
25
+ end
26
+ end
27
+
28
+ committee :duration_in_hours do
29
+ quorum 'from duration', :needs => :duration do |characteristics|
30
+ characteristics[:duration] / (60 * 60)
25
31
  end
26
32
  end
27
33
 
@@ -53,7 +59,7 @@ module BrighterPlanet
53
59
  end
54
60
  end
55
61
 
56
- committee :duration do # returns hours
62
+ committee :duration do # returns seconds
57
63
  quorum 'default' do
58
64
  base.fallback.duration
59
65
  end
@@ -2,7 +2,7 @@ module BrighterPlanet
2
2
  module Computation
3
3
  module Fallback
4
4
  def self.included(base)
5
- base.falls_back_on :duration => 1.0, # assume 1 hour
5
+ base.falls_back_on :duration => 3600.0, # assume 1 hour
6
6
  :ec2_compute_units => 1, # assume 1 EC2 Unit
7
7
  :power_usage_effectiveness => 1.5, # based on Amazon's EC2 cost comparison calculator statement that most data centers have PUE of 1.3 - 3.0
8
8
  :electricity_intensity => 0.075 # kW based on Amazon's EC2 cost comparison calculator stating 150W for small compute instance equivalent server and 0.5 power conversion factor (to get average operating load from nameplate capacity) - EC2 probably has lower draw but higher power conversion factor
@@ -0,0 +1,3 @@
1
+ "name","loss_factor"
2
+ "W","0.1"
3
+ "US","0.2"
@@ -0,0 +1,3 @@
1
+ "abbreviation","electricity_emission_factor","electricity_emission_factor_units","egrid_region_name"
2
+ "CAMX","1.0","kilograms_per_kilowatt_hour","W"
3
+ "US","2.0","kilograms_per_kilowatt_hour","US"
@@ -0,0 +1,2 @@
1
+ "name","egrid_subregion_abbreviation"
2
+ "94122","CAMX"
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: computation
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 8
10
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
11
10
  platform: ruby
12
11
  authors:
13
12
  - Andy Rossmeissl
@@ -19,140 +18,51 @@ autorequire:
19
18
  bindir: bin
20
19
  cert_chain: []
21
20
 
22
- date: 2010-12-02 00:00:00 -05:00
21
+ date: 2011-01-21 00:00:00 -05:00
23
22
  default_executable:
24
23
  dependencies:
25
24
  - !ruby/object:Gem::Dependency
26
- name: activerecord
27
- prerelease: false
25
+ name: bueller
28
26
  requirement: &id001 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- hash: 5
34
- segments:
35
- - 3
36
- version: "3"
37
- type: :development
38
- version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: bundler
41
- prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- hash: 23
48
- segments:
49
- - 1
50
- - 0
51
- - 0
52
- version: 1.0.0
53
- type: :development
54
- version_requirements: *id002
55
- - !ruby/object:Gem::Dependency
56
- name: cucumber
57
- prerelease: false
58
- requirement: &id003 !ruby/object:Gem::Requirement
59
- none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- hash: 3
64
- segments:
65
- - 0
66
- version: "0"
67
- type: :development
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: jeweler
71
- prerelease: false
72
- 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
27
  none: false
90
28
  requirements:
91
29
  - - ">="
92
30
  - !ruby/object:Gem::Version
93
- hash: 3
94
31
  segments:
95
32
  - 0
96
33
  version: "0"
97
34
  type: :development
98
- version_requirements: *id005
99
- - !ruby/object:Gem::Dependency
100
- name: rdoc
101
- 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
35
  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
36
+ version_requirements: *id001
127
37
  - !ruby/object:Gem::Dependency
128
38
  name: sniff
129
- prerelease: false
130
- requirement: &id008 !ruby/object:Gem::Requirement
39
+ requirement: &id002 !ruby/object:Gem::Requirement
131
40
  none: false
132
41
  requirements:
133
- - - ">="
42
+ - - ~>
134
43
  - !ruby/object:Gem::Version
135
- hash: 3
136
44
  segments:
137
45
  - 0
138
- version: "0"
46
+ - 4
47
+ - 9
48
+ version: 0.4.9
139
49
  type: :development
140
- version_requirements: *id008
50
+ prerelease: false
51
+ version_requirements: *id002
141
52
  - !ruby/object:Gem::Dependency
142
53
  name: emitter
143
- prerelease: false
144
- requirement: &id009 !ruby/object:Gem::Requirement
54
+ requirement: &id003 !ruby/object:Gem::Requirement
145
55
  none: false
146
56
  requirements:
147
57
  - - ~>
148
58
  - !ruby/object:Gem::Version
149
- hash: 13
150
59
  segments:
151
60
  - 0
152
61
  - 3
153
62
  version: "0.3"
154
63
  type: :runtime
155
- version_requirements: *id009
64
+ prerelease: false
65
+ version_requirements: *id003
156
66
  description: A software model in Ruby for the greenhouse gas emissions of a computer's computations
157
67
  email: andy@rossmeissl.net
158
68
  executables: []
@@ -162,27 +72,32 @@ extensions: []
162
72
  extra_rdoc_files:
163
73
  - LICENSE
164
74
  - README.rdoc
75
+ - TODO
165
76
  files:
166
- - LICENSE
167
- - README.rdoc
168
77
  - lib/computation.rb
78
+ - lib/test_support/db/fixtures/egrid_subregions.csv
79
+ - lib/test_support/db/fixtures/egrid_regions.csv
80
+ - lib/test_support/db/fixtures/zip_codes.csv
81
+ - lib/test_support/computation_record.rb
82
+ - lib/computation/fallback.rb
169
83
  - lib/computation/carbon_model.rb
170
- - lib/computation/characterization.rb
171
84
  - lib/computation/data.rb
172
- - lib/computation/fallback.rb
173
85
  - lib/computation/relationships.rb
86
+ - lib/computation/characterization.rb
174
87
  - lib/computation/summarization.rb
175
- - lib/test_support/computation_record.rb
88
+ - LICENSE
89
+ - README.rdoc
90
+ - TODO
176
91
  - features/support/env.rb
177
- - features/computation_committees.feature
178
92
  - features/computation_emissions.feature
93
+ - features/computation_committees.feature
179
94
  has_rdoc: true
180
95
  homepage: http://github.com/brighterplanet/computation
181
96
  licenses: []
182
97
 
183
98
  post_install_message:
184
- rdoc_options:
185
- - --charset=UTF-8
99
+ rdoc_options: []
100
+
186
101
  require_paths:
187
102
  - lib
188
103
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -190,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
105
  requirements:
191
106
  - - ">="
192
107
  - !ruby/object:Gem::Version
193
- hash: 3
108
+ hash: 260890931
194
109
  segments:
195
110
  - 0
196
111
  version: "0"
@@ -199,7 +114,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
114
  requirements:
200
115
  - - ">="
201
116
  - !ruby/object:Gem::Version
202
- hash: 3
203
117
  segments:
204
118
  - 0
205
119
  version: "0"
@@ -212,6 +126,6 @@ specification_version: 3
212
126
  summary: A carbon model
213
127
  test_files:
214
128
  - features/support/env.rb
215
- - features/computation_committees.feature
216
129
  - features/computation_emissions.feature
130
+ - features/computation_committees.feature
217
131
  - lib/test_support/computation_record.rb