automobile 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -192,20 +192,27 @@ Feature: Automobile Committee Calculations
|
|
192
192
|
Then the committee should have used quorum "from hybridity multiplier"
|
193
193
|
And the conclusion of the committee should be "8.58025"
|
194
194
|
|
195
|
-
Scenario: Annual distance committee from
|
195
|
+
Scenario: Annual distance committee from annual distance estimate
|
196
196
|
Given an automobile emitter
|
197
|
-
And a characteristic "
|
197
|
+
And a characteristic "annual_distance_estimate" of "100"
|
198
|
+
When the "annual_distance" committee is calculated
|
199
|
+
Then the committee should have used quorum "from annual distance estimate"
|
200
|
+
And the conclusion of the committee should be "100.0"
|
201
|
+
|
202
|
+
Scenario: Annual distance committee from weekly distance estimate and timeframe
|
203
|
+
Given an automobile emitter
|
204
|
+
And a characteristic "weekly_distance_estimate" of "7"
|
198
205
|
And a characteristic "timeframe" of "2010-05-23/2010-11-24"
|
199
206
|
When the "annual_distance" committee is calculated
|
200
|
-
Then the committee should have used quorum "from weekly distance and timeframe"
|
207
|
+
Then the committee should have used quorum "from weekly distance estimate and timeframe"
|
201
208
|
And the conclusion of the committee should be "365.0"
|
202
209
|
|
203
|
-
Scenario: Annual distance committee from daily distance and timeframe
|
210
|
+
Scenario: Annual distance committee from daily distance estimate and timeframe
|
204
211
|
Given an automobile emitter
|
205
|
-
And a characteristic "
|
212
|
+
And a characteristic "daily_distance_estimate" of "2"
|
206
213
|
And a characteristic "timeframe" of "2010-05-23/2010-11-24"
|
207
214
|
When the "annual_distance" committee is calculated
|
208
|
-
Then the committee should have used quorum "from daily distance and timeframe"
|
215
|
+
Then the committee should have used quorum "from daily distance estimate and timeframe"
|
209
216
|
And the conclusion of the committee should be "730.0"
|
210
217
|
|
211
218
|
Scenario: Annual distance committee from daily duration, speed and timeframe
|
@@ -35,12 +35,12 @@ Feature: Automobile Emissions Calculations
|
|
35
35
|
| false | 5564.02 |
|
36
36
|
|
37
37
|
Scenario: Calculation with multiple distance estimates
|
38
|
-
Given an automobile has "
|
39
|
-
And it has "
|
40
|
-
And it has "
|
41
|
-
And it has "
|
38
|
+
Given an automobile has "daily_duration" of "5"
|
39
|
+
And it has "daily_distance_estimate" of "10"
|
40
|
+
And it has "weekly_distance_estimate" of "100"
|
41
|
+
And it has "annual_distance_estimate" of "1000"
|
42
42
|
When emissions are calculated
|
43
|
-
Then the emission value should be within "0.1" kgs of "
|
43
|
+
Then the emission value should be within "0.1" kgs of "290.21"
|
44
44
|
|
45
45
|
Scenario: Automobile emission from urbanity
|
46
46
|
Given an automobile has "urbanity" of "0.5"
|
@@ -61,18 +61,18 @@ Feature: Automobile Emissions Calculations
|
|
61
61
|
When emissions are calculated
|
62
62
|
Then the emission value should be within "0.01" kgs of "2368.20"
|
63
63
|
|
64
|
-
Scenario: Automobile emission from annual distance
|
65
|
-
Given an automobile has "
|
64
|
+
Scenario: Automobile emission from annual distance estimate
|
65
|
+
Given an automobile has "annual_distance_estimate" of "1000"
|
66
66
|
When emissions are calculated
|
67
67
|
Then the emission value should be within "0.01" kgs of "290.21"
|
68
68
|
|
69
|
-
Scenario: Automobile emission from weekly distance
|
70
|
-
Given an automobile has "
|
69
|
+
Scenario: Automobile emission from weekly distance estimate
|
70
|
+
Given an automobile has "weekly_distance_estimate" of "100"
|
71
71
|
When emissions are calculated
|
72
72
|
Then the emission value should be within "0.01" kgs of "1513.26"
|
73
73
|
|
74
|
-
Scenario: Automobile emission from daily distance
|
75
|
-
Given an automobile has "
|
74
|
+
Scenario: Automobile emission from daily distance estimate
|
75
|
+
Given an automobile has "daily_distance_estimate" of "10"
|
76
76
|
When emissions are calculated
|
77
77
|
Then the emission value should be within "0.01" kgs of "1059.28"
|
78
78
|
|
@@ -100,25 +100,28 @@ module BrighterPlanet
|
|
100
100
|
# This is the distance the automobile would travel if it were in use for the entire calendar year in which the `timeframe` falls.
|
101
101
|
# Note that if either `acquisition` or `retirement` occurs during the calendar year in which the `timeframe` falls then `annual distance` will be MORE THAN the distance the automobile actually travelled during that calendar year.
|
102
102
|
committee :annual_distance do
|
103
|
-
#### Annual distance from
|
104
|
-
# **Complies:**
|
103
|
+
#### Annual distance from annual distance estimate
|
104
|
+
# **Complies:** GHG Protocol, ISO 14064-1
|
105
105
|
#
|
106
|
-
# Uses the
|
106
|
+
# Uses the `annual distance estimate` (*km*).
|
107
|
+
quorum 'from annual distance estimate', :needs => :annual_distance_estimate, :complies => [:ghg_protocol, :iso] do |characteristics|
|
108
|
+
characteristics[:annual_distance_estimate]
|
109
|
+
end
|
107
110
|
|
108
111
|
#### Annual distance from weekly distance
|
109
112
|
# **Complies:** GHG Protocol, ISO 14064-1
|
110
113
|
#
|
111
|
-
# Divides the `weekly distance` (*km*) by 7 and multiplies by the number of days in the calendar year in which the `timeframe` falls.
|
112
|
-
quorum 'from weekly distance and timeframe', :needs => :
|
113
|
-
(characteristics[:
|
114
|
+
# Divides the `weekly distance estimate` (*km*) by 7 and multiplies by the number of days in the calendar year in which the `timeframe` falls.
|
115
|
+
quorum 'from weekly distance estimate and timeframe', :needs => :weekly_distance_estimate, :complies => [:ghg_protocol, :iso] do |characteristics, timeframe|
|
116
|
+
(characteristics[:weekly_distance_estimate] / 7 ) * timeframe.year.days
|
114
117
|
end
|
115
118
|
|
116
119
|
#### Annual distance from daily distance
|
117
120
|
# **Complies:** GHG Protocol, ISO 14064-1
|
118
121
|
#
|
119
|
-
# Multiplies the `daily distance` (*km*) by the number of days in the calendar year in which the `timeframe` falls.
|
120
|
-
quorum 'from daily distance and timeframe', :needs => :
|
121
|
-
characteristics[:
|
122
|
+
# Multiplies the `daily distance estimate` (*km*) by the number of days in the calendar year in which the `timeframe` falls.
|
123
|
+
quorum 'from daily distance estimate and timeframe', :needs => :daily_distance_estimate, :complies => [:ghg_protocol, :iso] do |characteristics, timeframe|
|
124
|
+
characteristics[:daily_distance_estimate] * timeframe.year.days
|
122
125
|
end
|
123
126
|
|
124
127
|
#### Annual distance from daily duration and speed
|
@@ -155,12 +158,16 @@ module BrighterPlanet
|
|
155
158
|
end
|
156
159
|
end
|
157
160
|
|
158
|
-
###
|
159
|
-
# Returns the client-input `
|
161
|
+
### Annual distance estimate calculation
|
162
|
+
# Returns the client-input `annual distance estimate` (*km*).
|
163
|
+
# This is the average distance the automobile travels each week.
|
164
|
+
|
165
|
+
### Weekly distance estimate calculation
|
166
|
+
# Returns the client-input `weekly distance estimate` (*km*).
|
160
167
|
# This is the average distance the automobile travels each week.
|
161
168
|
|
162
|
-
### Daily distance calculation
|
163
|
-
# Returns the client-input `daily distance` (*km*).
|
169
|
+
### Daily distance estimate calculation
|
170
|
+
# Returns the client-input `daily distance estimate` (*km*).
|
164
171
|
# This is the average distance the automobile travels each day.
|
165
172
|
|
166
173
|
### Daily duration calculation
|
@@ -21,9 +21,9 @@ module BrighterPlanet
|
|
21
21
|
has :urbanity
|
22
22
|
has :hybridity
|
23
23
|
has :fuel_efficiency
|
24
|
-
has :
|
25
|
-
has :
|
26
|
-
has :
|
24
|
+
has :annual_distance_estimate
|
25
|
+
has :weekly_distance_estimate
|
26
|
+
has :daily_distance_estimate
|
27
27
|
has :daily_duration
|
28
28
|
has :acquisition
|
29
29
|
has :retirement
|
data/lib/automobile/data.rb
CHANGED
@@ -14,9 +14,9 @@ module BrighterPlanet
|
|
14
14
|
boolean 'hybridity'
|
15
15
|
float 'urbanity'
|
16
16
|
float 'fuel_efficiency'
|
17
|
-
float '
|
18
|
-
float '
|
19
|
-
float '
|
17
|
+
float 'annual_distance_estimate'
|
18
|
+
float 'weekly_distance_estimate'
|
19
|
+
float 'daily_distance_estimate'
|
20
20
|
float 'daily_duration'
|
21
21
|
date 'acquisition'
|
22
22
|
date 'retirement'
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automobile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Andy Rossmeissl
|
@@ -18,102 +19,110 @@ autorequire:
|
|
18
19
|
bindir: bin
|
19
20
|
cert_chain: []
|
20
21
|
|
21
|
-
date: 2010-11-
|
22
|
+
date: 2010-11-22 00:00:00 -05:00
|
22
23
|
default_executable:
|
23
24
|
dependencies:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: activerecord
|
27
|
+
prerelease: false
|
26
28
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
29
|
none: false
|
28
30
|
requirements:
|
29
31
|
- - ~>
|
30
32
|
- !ruby/object:Gem::Version
|
33
|
+
hash: 7
|
31
34
|
segments:
|
32
35
|
- 3
|
33
36
|
- 0
|
34
37
|
- 0
|
35
38
|
version: 3.0.0
|
36
39
|
type: :development
|
37
|
-
prerelease: false
|
38
40
|
version_requirements: *id001
|
39
41
|
- !ruby/object:Gem::Dependency
|
40
42
|
name: bundler
|
43
|
+
prerelease: false
|
41
44
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
45
|
none: false
|
43
46
|
requirements:
|
44
47
|
- - ~>
|
45
48
|
- !ruby/object:Gem::Version
|
49
|
+
hash: 23
|
46
50
|
segments:
|
47
51
|
- 1
|
48
52
|
- 0
|
49
53
|
- 0
|
50
54
|
version: 1.0.0
|
51
55
|
type: :development
|
52
|
-
prerelease: false
|
53
56
|
version_requirements: *id002
|
54
57
|
- !ruby/object:Gem::Dependency
|
55
58
|
name: cucumber
|
59
|
+
prerelease: false
|
56
60
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
61
|
none: false
|
58
62
|
requirements:
|
59
63
|
- - ~>
|
60
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 57
|
61
66
|
segments:
|
62
67
|
- 0
|
63
68
|
- 8
|
64
69
|
- 3
|
65
70
|
version: 0.8.3
|
66
71
|
type: :development
|
67
|
-
prerelease: false
|
68
72
|
version_requirements: *id003
|
69
73
|
- !ruby/object:Gem::Dependency
|
70
74
|
name: jeweler
|
75
|
+
prerelease: false
|
71
76
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
77
|
none: false
|
73
78
|
requirements:
|
74
79
|
- - ~>
|
75
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 7
|
76
82
|
segments:
|
77
83
|
- 1
|
78
84
|
- 4
|
79
85
|
- 0
|
80
86
|
version: 1.4.0
|
81
87
|
type: :development
|
82
|
-
prerelease: false
|
83
88
|
version_requirements: *id004
|
84
89
|
- !ruby/object:Gem::Dependency
|
85
90
|
name: rake
|
91
|
+
prerelease: false
|
86
92
|
requirement: &id005 !ruby/object:Gem::Requirement
|
87
93
|
none: false
|
88
94
|
requirements:
|
89
95
|
- - ">="
|
90
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
91
98
|
segments:
|
92
99
|
- 0
|
93
100
|
version: "0"
|
94
101
|
type: :development
|
95
|
-
prerelease: false
|
96
102
|
version_requirements: *id005
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: rdoc
|
105
|
+
prerelease: false
|
99
106
|
requirement: &id006 !ruby/object:Gem::Requirement
|
100
107
|
none: false
|
101
108
|
requirements:
|
102
109
|
- - ">="
|
103
110
|
- !ruby/object:Gem::Version
|
111
|
+
hash: 3
|
104
112
|
segments:
|
105
113
|
- 0
|
106
114
|
version: "0"
|
107
115
|
type: :development
|
108
|
-
prerelease: false
|
109
116
|
version_requirements: *id006
|
110
117
|
- !ruby/object:Gem::Dependency
|
111
118
|
name: rspec
|
119
|
+
prerelease: false
|
112
120
|
requirement: &id007 !ruby/object:Gem::Requirement
|
113
121
|
none: false
|
114
122
|
requirements:
|
115
123
|
- - ~>
|
116
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 62196417
|
117
126
|
segments:
|
118
127
|
- 2
|
119
128
|
- 0
|
@@ -122,52 +131,54 @@ dependencies:
|
|
122
131
|
- 17
|
123
132
|
version: 2.0.0.beta.17
|
124
133
|
type: :development
|
125
|
-
prerelease: false
|
126
134
|
version_requirements: *id007
|
127
135
|
- !ruby/object:Gem::Dependency
|
128
136
|
name: sniff
|
137
|
+
prerelease: false
|
129
138
|
requirement: &id008 !ruby/object:Gem::Requirement
|
130
139
|
none: false
|
131
140
|
requirements:
|
132
141
|
- - ~>
|
133
142
|
- !ruby/object:Gem::Version
|
143
|
+
hash: 19
|
134
144
|
segments:
|
135
145
|
- 0
|
136
146
|
- 3
|
137
147
|
- 0
|
138
148
|
version: 0.3.0
|
139
149
|
type: :development
|
140
|
-
prerelease: false
|
141
150
|
version_requirements: *id008
|
142
151
|
- !ruby/object:Gem::Dependency
|
143
152
|
name: emitter
|
153
|
+
prerelease: false
|
144
154
|
requirement: &id009 !ruby/object:Gem::Requirement
|
145
155
|
none: false
|
146
156
|
requirements:
|
147
157
|
- - ~>
|
148
158
|
- !ruby/object:Gem::Version
|
159
|
+
hash: 23
|
149
160
|
segments:
|
150
161
|
- 0
|
151
162
|
- 2
|
152
163
|
- 0
|
153
164
|
version: 0.2.0
|
154
165
|
type: :runtime
|
155
|
-
prerelease: false
|
156
166
|
version_requirements: *id009
|
157
167
|
- !ruby/object:Gem::Dependency
|
158
168
|
name: earth
|
169
|
+
prerelease: false
|
159
170
|
requirement: &id010 !ruby/object:Gem::Requirement
|
160
171
|
none: false
|
161
172
|
requirements:
|
162
173
|
- - ~>
|
163
174
|
- !ruby/object:Gem::Version
|
175
|
+
hash: 17
|
164
176
|
segments:
|
165
177
|
- 0
|
166
178
|
- 3
|
167
179
|
- 1
|
168
180
|
version: 0.3.1
|
169
181
|
type: :runtime
|
170
|
-
prerelease: false
|
171
182
|
version_requirements: *id010
|
172
183
|
description: A software model in Ruby for the greenhouse gas emissions of an automobile
|
173
184
|
email: andy@rossmeissl.net
|
@@ -188,8 +199,8 @@ files:
|
|
188
199
|
- lib/automobile/summarization.rb
|
189
200
|
- lib/test_support/automobile_record.rb
|
190
201
|
- features/support/env.rb
|
191
|
-
- features/automobile_emissions.feature
|
192
202
|
- features/automobile_committees.feature
|
203
|
+
- features/automobile_emissions.feature
|
193
204
|
has_rdoc: true
|
194
205
|
homepage: http://github.com/brighterplanet/automobile
|
195
206
|
licenses: []
|
@@ -204,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
215
|
requirements:
|
205
216
|
- - ">="
|
206
217
|
- !ruby/object:Gem::Version
|
207
|
-
hash:
|
218
|
+
hash: 3
|
208
219
|
segments:
|
209
220
|
- 0
|
210
221
|
version: "0"
|
@@ -213,6 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
224
|
requirements:
|
214
225
|
- - ">="
|
215
226
|
- !ruby/object:Gem::Version
|
227
|
+
hash: 3
|
216
228
|
segments:
|
217
229
|
- 0
|
218
230
|
version: "0"
|
@@ -225,6 +237,6 @@ specification_version: 3
|
|
225
237
|
summary: A carbon model
|
226
238
|
test_files:
|
227
239
|
- features/support/env.rb
|
228
|
-
- features/automobile_emissions.feature
|
229
240
|
- features/automobile_committees.feature
|
241
|
+
- features/automobile_emissions.feature
|
230
242
|
- lib/test_support/automobile_record.rb
|