automobile_trip 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Rakefile +8 -66
- data/automobile_trip.gemspec +13 -11
- data/features/automobile_trip_committees.feature +94 -48
- data/features/automobile_trip_emissions.feature +29 -24
- data/features/support/env.rb +1 -1
- data/lib/automobile_trip.rb +1 -1
- data/lib/automobile_trip/carbon_model.rb +99 -85
- data/lib/automobile_trip/characterization.rb +2 -1
- data/lib/automobile_trip/data.rb +1 -0
- data/lib/automobile_trip/fallback.rb +1 -6
- data/lib/automobile_trip/relationships.rb +1 -0
- data/lib/automobile_trip/version.rb +1 -1
- data/lib/test_support/db/fixtures/automobile_fuels.csv +4 -4
- data/lib/test_support/db/fixtures/automobile_make_model_year_variants.csv +1 -1
- data/lib/test_support/db/fixtures/automobile_type_fuel_year_ages.csv +3 -0
- data/lib/test_support/db/fixtures/countries.csv +2 -0
- data/lib/test_support/db/fixtures/fuels.csv +0 -1
- metadata +19 -39
- data/Gemfile.lock +0 -200
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,71 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require 'bundler'
|
4
|
+
Bundler.setup
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
yield
|
9
|
-
rescue LoadError
|
10
|
-
puts message
|
11
|
-
exit if failure_results_in_death
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
unless ENV['NOBUNDLE']
|
16
|
-
message = <<-MESSAGE
|
17
|
-
In order to run tests, you must:
|
18
|
-
* `gem install bundler`
|
19
|
-
* `bundle install`
|
20
|
-
MESSAGE
|
21
|
-
require_or_fail('bundler',message,true) do
|
22
|
-
Bundler.setup
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require_or_fail('jeweler', 'Jeweler (or a dependency) not available. Install it with: gem install jeweler') do
|
27
|
-
Jeweler::Tasks.new do |gem|
|
28
|
-
gem.name = "automobile_trip"
|
29
|
-
gem.summary = %Q{A carbon model}
|
30
|
-
gem.description = %Q{A software model in Ruby for the greenhouse gas emissions of an automobile trip}
|
31
|
-
gem.email = "andy@rossmeissl.net"
|
32
|
-
gem.homepage = "http://github.com/brighterplanet/automobile_trip"
|
33
|
-
gem.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling", 'Derek Kastner']
|
34
|
-
gem.files = ['LICENSE', 'README.rdoc'] +
|
35
|
-
Dir.glob(File.join('lib', '**','*.rb'))
|
36
|
-
gem.test_files = Dir.glob(File.join('features', '**', '*.rb')) +
|
37
|
-
Dir.glob(File.join('features', '**', '*.feature')) +
|
38
|
-
Dir.glob(File.join('lib', 'test_support', '**/*.rb')) +
|
39
|
-
Dir.glob(File.join('vendor', '**/*.rb'))
|
40
|
-
gem.add_development_dependency 'activerecord', '~>3'
|
41
|
-
gem.add_development_dependency 'bundler', '~>1.0.0'
|
42
|
-
gem.add_development_dependency 'rake'
|
43
|
-
gem.add_development_dependency 'cucumber'
|
44
|
-
gem.add_development_dependency 'jeweler', '~>1.4.0'
|
45
|
-
gem.add_development_dependency 'rdoc'
|
46
|
-
gem.add_development_dependency 'rspec', '~>2'
|
47
|
-
gem.add_development_dependency 'sniff', '~>0.6' unless ENV['LOCAL_SNIFF']
|
48
|
-
gem.add_development_dependency 'fastercsv'
|
49
|
-
gem.add_dependency 'emitter', '~>0.4.1' unless ENV['LOCAL_EMITTER']
|
50
|
-
gem.add_dependency 'earth' unless ENV['LOCAL_EARTH']
|
51
|
-
gem.add_dependency 'geokit'
|
52
|
-
end
|
53
|
-
Jeweler::GemcutterTasks.new
|
54
|
-
end
|
55
|
-
|
56
|
-
require_or_fail('sniff', 'Sniff gem not found, sniff tasks unavailable') do
|
57
|
-
require 'sniff/rake_tasks'
|
58
|
-
Sniff::RakeTasks.define_tasks do |t|
|
59
|
-
t.earth_domains = [:automobile, :fuel]
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
require 'rake/rdoctask'
|
64
|
-
Rake::RDocTask.new do |rdoc|
|
65
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
6
|
+
require 'bueller'
|
7
|
+
Bueller::Tasks.new
|
66
8
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
9
|
+
require 'sniff'
|
10
|
+
require 'sniff/rake_tasks'
|
11
|
+
Sniff::RakeTasks.define_tasks do |t|
|
12
|
+
t.earth_domains = [:automobile, :fuel]
|
71
13
|
end
|
data/automobile_trip.gemspec
CHANGED
@@ -6,22 +6,24 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = %q{automobile_trip}
|
7
7
|
s.version = BrighterPlanet::AutomobileTrip::VERSION
|
8
8
|
|
9
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
9
|
s.authors = ["Andy Rossmeissl", "Seamus Abshere", "Ian Hough", "Matt Kling", "Derek Kastner"]
|
11
|
-
s.date =
|
10
|
+
s.date = "2011-06-02"
|
12
11
|
s.summary = %q{A carbon model}
|
13
12
|
s.description = %q{A software model in Ruby for the greenhouse gas emissions of an automobile trip}
|
14
13
|
s.email = %q{andy@rossmeissl.net}
|
15
|
-
s.homepage = %q{
|
16
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
14
|
+
s.homepage = %q{https://github.com/brighterplanet/automobile_trip}
|
17
15
|
|
18
|
-
s.files
|
19
|
-
s.test_files
|
20
|
-
s.executables
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.extra_rdoc_files = [
|
20
|
+
"LICENSE",
|
21
|
+
"LICENSE-PREAMBLE",
|
22
|
+
"README.rdoc"
|
23
|
+
]
|
21
24
|
s.require_paths = ["lib"]
|
25
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
22
26
|
|
23
|
-
s.add_development_dependency 'sniff',
|
24
|
-
s.add_runtime_dependency 'emitter',
|
25
|
-
s.add_runtime_dependency 'geokit'
|
27
|
+
s.add_development_dependency 'sniff', '>=0.8.0'
|
28
|
+
s.add_runtime_dependency 'emitter', '>=0.5.0'
|
26
29
|
end
|
27
|
-
|
@@ -17,10 +17,24 @@ Feature: Automobile Trip Committee Calculations
|
|
17
17
|
Then the committee should have used quorum "from timeframe"
|
18
18
|
And the conclusion of the committee should be "2009-06-06"
|
19
19
|
|
20
|
-
Scenario:
|
20
|
+
Scenario: Country committee from default
|
21
21
|
Given an automobile_trip emitter
|
22
|
-
When the "
|
22
|
+
When the "country" committee is calculated
|
23
23
|
Then the committee should have used quorum "default"
|
24
|
+
And the conclusion of the committee should have "name" of "fallback"
|
25
|
+
|
26
|
+
Scenario: Urbanity committee from default country
|
27
|
+
Given an automobile_trip emitter
|
28
|
+
When the "country" committee is calculated
|
29
|
+
And the "urbanity" committee is calculated
|
30
|
+
Then the committee should have used quorum "from country"
|
31
|
+
And the conclusion of the committee should be "0.43"
|
32
|
+
|
33
|
+
Scenario: Urbanity committee from country
|
34
|
+
Given an automobile_trip emitter
|
35
|
+
And a characteristic "country.iso_3166_code" of "US"
|
36
|
+
When the "urbanity" committee is calculated
|
37
|
+
Then the committee should have used quorum "from country"
|
24
38
|
And the conclusion of the committee should be "0.43"
|
25
39
|
|
26
40
|
Scenario Outline: Urbanity committee from valid urbanity estimate
|
@@ -38,8 +52,9 @@ Feature: Automobile Trip Committee Calculations
|
|
38
52
|
Scenario Outline: Urbanity committee from invalid urbanity estimate
|
39
53
|
Given an automobile_trip emitter
|
40
54
|
And a characteristic "urbanity_estimate" of "<estimate>"
|
41
|
-
When the "
|
42
|
-
|
55
|
+
When the "country" committee is calculated
|
56
|
+
And the "urbanity" committee is calculated
|
57
|
+
Then the committee should have used quorum "from country"
|
43
58
|
And the conclusion of the committee should be "0.43"
|
44
59
|
Examples:
|
45
60
|
| estimate |
|
@@ -55,7 +70,8 @@ Feature: Automobile Trip Committee Calculations
|
|
55
70
|
Scenario Outline: Hybridity multiplier committee from hybridity and urbanity
|
56
71
|
Given an automobile_trip emitter
|
57
72
|
And a characteristic "hybridity" of "<hybridity>"
|
58
|
-
When the "
|
73
|
+
When the "country" committee is calculated
|
74
|
+
And the "urbanity" committee is calculated
|
59
75
|
And the "hybridity_multiplier" committee is calculated
|
60
76
|
Then the committee should have used quorum "from hybridity and urbanity"
|
61
77
|
And the conclusion of the committee should be "<multiplier>"
|
@@ -68,7 +84,8 @@ Feature: Automobile Trip Committee Calculations
|
|
68
84
|
Given an automobile_trip emitter
|
69
85
|
And a characteristic "hybridity" of "<hybridity>"
|
70
86
|
And a characteristic "size_class.name" of "<size_class>"
|
71
|
-
When the "
|
87
|
+
When the "country" committee is calculated
|
88
|
+
And the "urbanity" committee is calculated
|
72
89
|
And the "hybridity_multiplier" committee is calculated
|
73
90
|
Then the committee should have used quorum "from hybridity and urbanity"
|
74
91
|
And the conclusion of the committee should be "<multiplier>"
|
@@ -81,7 +98,8 @@ Feature: Automobile Trip Committee Calculations
|
|
81
98
|
Given an automobile_trip emitter
|
82
99
|
And a characteristic "hybridity" of "<hybridity>"
|
83
100
|
And a characteristic "size_class.name" of "<size_class>"
|
84
|
-
When the "
|
101
|
+
When the "country" committee is calculated
|
102
|
+
And the "urbanity" committee is calculated
|
85
103
|
And the "hybridity_multiplier" committee is calculated
|
86
104
|
Then the committee should have used quorum "from size class, hybridity, and urbanity"
|
87
105
|
And the conclusion of the committee should be "<multiplier>"
|
@@ -90,16 +108,29 @@ Feature: Automobile Trip Committee Calculations
|
|
90
108
|
| true | Midsize Car | 1.68067 |
|
91
109
|
| false | Midsize Car | 0.87464 |
|
92
110
|
|
93
|
-
Scenario Outline: Fuel efficiency committee from hybridity multiplier
|
111
|
+
Scenario Outline: Fuel efficiency committee from hybridity multiplier and default country
|
94
112
|
Given an automobile_trip emitter
|
95
113
|
And a characteristic "hybridity_multiplier" of "<multiplier>"
|
96
|
-
When the "
|
97
|
-
|
114
|
+
When the "country" committee is calculated
|
115
|
+
And the "fuel_efficiency" committee is calculated
|
116
|
+
Then the committee should have used quorum "from hybridity multiplier and country"
|
98
117
|
And the conclusion of the committee should be "<fe>"
|
99
118
|
Examples:
|
100
119
|
| multiplier | fe |
|
101
|
-
| 1.0 | 8.
|
102
|
-
| 10 |
|
120
|
+
| 1.0 | 8.22653 |
|
121
|
+
| 10 | 82.26531 |
|
122
|
+
|
123
|
+
Scenario Outline: Fuel efficiency committee from hybridity multiplier and country
|
124
|
+
Given an automobile_trip emitter
|
125
|
+
And a characteristic "hybridity_multiplier" of "<multiplier>"
|
126
|
+
And a characteristic "country.iso_3166_code" of "US"
|
127
|
+
When the "fuel_efficiency" committee is calculated
|
128
|
+
Then the committee should have used quorum "from hybridity multiplier and country"
|
129
|
+
And the conclusion of the committee should be "<fe>"
|
130
|
+
Examples:
|
131
|
+
| multiplier | fe |
|
132
|
+
| 1.0 | 9.0 |
|
133
|
+
| 10 | 90.0 |
|
103
134
|
|
104
135
|
Scenario: Fuel efficiency committee from make and hybridity multiplier
|
105
136
|
Given an automobile_trip emitter
|
@@ -150,12 +181,21 @@ Feature: Automobile Trip Committee Calculations
|
|
150
181
|
Then the committee should have used quorum "from make model year variant and urbanity"
|
151
182
|
And the conclusion of the committee should be "44.44444"
|
152
183
|
|
153
|
-
Scenario: Speed committee from urbanity
|
184
|
+
Scenario: Speed committee from urbanity and default country
|
185
|
+
Given an automobile_trip emitter
|
186
|
+
When the "country" committee is calculated
|
187
|
+
And the "urbanity" committee is calculated
|
188
|
+
And the "speed" committee is calculated
|
189
|
+
Then the committee should have used quorum "from urbanity and country"
|
190
|
+
And the conclusion of the committee should be "50.93426"
|
191
|
+
|
192
|
+
Scenario: Speed committee from urbanity and country
|
154
193
|
Given an automobile_trip emitter
|
194
|
+
And a characteristic "country.iso_3166_code" of "US"
|
155
195
|
When the "urbanity" committee is calculated
|
156
196
|
And the "speed" committee is calculated
|
157
|
-
Then the committee should have used quorum "from urbanity"
|
158
|
-
And the conclusion of the committee should be "50.
|
197
|
+
Then the committee should have used quorum "from urbanity and country"
|
198
|
+
And the conclusion of the committee should be "50.93426"
|
159
199
|
|
160
200
|
Scenario Outline: Origin location from geocodeable origin
|
161
201
|
Given a automobile_trip emitter
|
@@ -199,11 +239,19 @@ Feature: Automobile Trip Committee Calculations
|
|
199
239
|
When the "destination_location" committee is calculated
|
200
240
|
Then the conclusion of the committee should be nil
|
201
241
|
|
202
|
-
Scenario: Distance committee from default
|
242
|
+
Scenario: Distance committee from default country
|
203
243
|
Given an automobile_trip emitter
|
244
|
+
When the "country" committee is calculated
|
245
|
+
And the "distance" committee is calculated
|
246
|
+
Then the committee should have used quorum "from country"
|
247
|
+
And the conclusion of the committee should be "16.0"
|
248
|
+
|
249
|
+
Scenario: Distance committee from country
|
250
|
+
Given an automobile_trip emitter
|
251
|
+
And a characteristic "country.iso_3166_code" of "US"
|
204
252
|
When the "distance" committee is calculated
|
205
|
-
Then the committee should have used quorum "
|
206
|
-
And the conclusion of the committee should be "16.
|
253
|
+
Then the committee should have used quorum "from country"
|
254
|
+
And the conclusion of the committee should be "16.0"
|
207
255
|
|
208
256
|
Scenario: Distance committee from duration and speed
|
209
257
|
Given an automobile_trip emitter
|
@@ -232,11 +280,12 @@ Feature: Automobile Trip Committee Calculations
|
|
232
280
|
And a characteristic "origin" of "Lansing, MI"
|
233
281
|
And a characteristic "destination" of "Canterbury, Kent, UK"
|
234
282
|
And a characteristic "mapquest_api_key" of "ABC123"
|
235
|
-
When the "
|
283
|
+
When the "country" committee is calculated
|
284
|
+
And the "origin_location" committee is calculated
|
236
285
|
And the "destination_location" committee is calculated
|
237
286
|
And the "distance" committee is calculated
|
238
|
-
Then the committee should have used quorum "
|
239
|
-
And the conclusion of the committee should be "16.
|
287
|
+
Then the committee should have used quorum "from country"
|
288
|
+
And the conclusion of the committee should be "16.0"
|
240
289
|
|
241
290
|
Scenario: Fuel use committee from fuel efficiency and distance
|
242
291
|
Given an automobile_trip emitter
|
@@ -246,21 +295,18 @@ Feature: Automobile Trip Committee Calculations
|
|
246
295
|
Then the committee should have used quorum "from fuel efficiency and distance"
|
247
296
|
And the conclusion of the committee should be "10.0"
|
248
297
|
|
249
|
-
Scenario:
|
298
|
+
Scenario: Automobile fuel committee from default
|
250
299
|
Given an automobile_trip emitter
|
251
300
|
When the "automobile_fuel" committee is calculated
|
252
301
|
Then the committee should have used quorum "default"
|
253
|
-
And the conclusion of the committee should have "
|
254
|
-
And the conclusion of the committee should have "blend_fuel_name" of "Distillate Fuel Oil No. 2"
|
255
|
-
And the conclusion of the committee should have "distance_key" of "fallback"
|
256
|
-
And the conclusion of the committee should have "ef_key" of "fallback"
|
302
|
+
And the conclusion of the committee should have "name" of "fallback"
|
257
303
|
|
258
|
-
Scenario:
|
304
|
+
Scenario: Automobile fuel committee from make model year variant
|
259
305
|
Given an automobile_trip emitter
|
260
306
|
And a characteristic "make_model_year_variant.row_hash" of "xxx1"
|
261
307
|
When the "automobile_fuel" committee is calculated
|
262
308
|
Then the committee should have used quorum "from make model year variant"
|
263
|
-
And the conclusion of the committee should have "name" of "
|
309
|
+
And the conclusion of the committee should have "name" of "diesel"
|
264
310
|
|
265
311
|
Scenario: HFC emission factor committee from default automobile fuel
|
266
312
|
Given an automobile_trip emitter
|
@@ -276,10 +322,10 @@ Feature: Automobile Trip Committee Calculations
|
|
276
322
|
Then the committee should have used quorum "from automobile fuel"
|
277
323
|
And the conclusion of the committee should be "<ef>"
|
278
324
|
Examples:
|
279
|
-
| fuel | ef
|
280
|
-
| regular gasoline | 0.
|
281
|
-
| diesel | 0.
|
282
|
-
| B20 | 0.
|
325
|
+
| fuel | ef |
|
326
|
+
| regular gasoline | 0.1 |
|
327
|
+
| diesel | 0.12 |
|
328
|
+
| B20 | 0.12 |
|
283
329
|
|
284
330
|
Scenario: N2O emission factor committee from default automobile fuel
|
285
331
|
Given an automobile_trip emitter
|
@@ -295,10 +341,10 @@ Feature: Automobile Trip Committee Calculations
|
|
295
341
|
Then the committee should have used quorum "from automobile fuel"
|
296
342
|
And the conclusion of the committee should be "<ef>"
|
297
343
|
Examples:
|
298
|
-
| fuel | ef
|
299
|
-
| regular gasoline | 0.
|
300
|
-
| diesel | 0.
|
301
|
-
| B20 | 0.
|
344
|
+
| fuel | ef |
|
345
|
+
| regular gasoline | 0.008 |
|
346
|
+
| diesel | 0.002 |
|
347
|
+
| B20 | 0.002 |
|
302
348
|
|
303
349
|
Scenario: CH4 emission factor committee from default automobile fuel
|
304
350
|
Given an automobile_trip emitter
|
@@ -314,10 +360,10 @@ Feature: Automobile Trip Committee Calculations
|
|
314
360
|
Then the committee should have used quorum "from automobile fuel"
|
315
361
|
And the conclusion of the committee should be "<ef>"
|
316
362
|
Examples:
|
317
|
-
| fuel | ef
|
318
|
-
| regular gasoline | 0.
|
319
|
-
| diesel | 0.
|
320
|
-
| B20 | 0.
|
363
|
+
| fuel | ef |
|
364
|
+
| regular gasoline | 0.002 |
|
365
|
+
| diesel | 0.0001 |
|
366
|
+
| B20 | 0.0001 |
|
321
367
|
|
322
368
|
Scenario: CO2 biogenic emission factor committee from default automobile fuel
|
323
369
|
Given an automobile_trip emitter
|
@@ -333,10 +379,10 @@ Feature: Automobile Trip Committee Calculations
|
|
333
379
|
Then the committee should have used quorum "from automobile fuel"
|
334
380
|
And the conclusion of the committee should be "<ef>"
|
335
381
|
Examples:
|
336
|
-
| fuel | ef
|
337
|
-
| regular gasoline | 0.0
|
338
|
-
| diesel | 0.0
|
339
|
-
| B20 | 0.5
|
382
|
+
| fuel | ef |
|
383
|
+
| regular gasoline | 0.0 |
|
384
|
+
| diesel | 0.0 |
|
385
|
+
| B20 | 0.5 |
|
340
386
|
|
341
387
|
Scenario: CO2 emission factor committee from default automobile fuel
|
342
388
|
Given an automobile_trip emitter
|
@@ -352,10 +398,10 @@ Feature: Automobile Trip Committee Calculations
|
|
352
398
|
Then the committee should have used quorum "from automobile fuel"
|
353
399
|
And the conclusion of the committee should be "<ef>"
|
354
400
|
Examples:
|
355
|
-
| fuel | ef
|
356
|
-
| regular gasoline | 2.3
|
357
|
-
| diesel | 2.7
|
358
|
-
| B20 | 2.
|
401
|
+
| fuel | ef |
|
402
|
+
| regular gasoline | 2.3 |
|
403
|
+
| diesel | 2.7 |
|
404
|
+
| B20 | 2.2 |
|
359
405
|
|
360
406
|
Scenario Outline: HFC emission from fuel use, hfc emission factor, date, and timeframe
|
361
407
|
Given an automobile_trip emitter
|
@@ -4,7 +4,7 @@ Feature: Automobile Trip Emissions Calculations
|
|
4
4
|
Scenario: Calculations from nothing
|
5
5
|
Given an automobile_trip has nothing
|
6
6
|
When emissions are calculated
|
7
|
-
Then the emission value should be within "0.01" kgs of "4.
|
7
|
+
Then the emission value should be within "0.01" kgs of "4.72"
|
8
8
|
|
9
9
|
Scenario Outline: Calculations from date
|
10
10
|
Given an automobile_trip has "date" of "<date>"
|
@@ -14,7 +14,7 @@ Feature: Automobile Trip Emissions Calculations
|
|
14
14
|
Examples:
|
15
15
|
| date | emission |
|
16
16
|
| 2009-06-25 | 0.0 |
|
17
|
-
| 2010-06-25 | 4.
|
17
|
+
| 2010-06-25 | 4.72 |
|
18
18
|
| 2011-06-25 | 0.0 |
|
19
19
|
|
20
20
|
Scenario Outline: Calculations from date and timeframe
|
@@ -25,13 +25,18 @@ Feature: Automobile Trip Emissions Calculations
|
|
25
25
|
Examples:
|
26
26
|
| date | timeframe | emission |
|
27
27
|
| 2009-06-25 | 2009-01-01/2009-01-31 | 0.0 |
|
28
|
-
| 2009-06-25 | 2009-01-01/2009-12-31 | 4.
|
28
|
+
| 2009-06-25 | 2009-01-01/2009-12-31 | 4.72 |
|
29
29
|
| 2009-06-25 | 2009-12-01/2009-12-31 | 0.0 |
|
30
30
|
|
31
|
+
Scenario: Calculations from country
|
32
|
+
Given an automobile_trip has "country.iso_3166_code" of "US"
|
33
|
+
When emissions are calculated
|
34
|
+
Then the emission value should be within "0.01" kgs of "4.31"
|
35
|
+
|
31
36
|
Scenario: Calculations from urbanity estimate
|
32
37
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
33
38
|
When emissions are calculated
|
34
|
-
Then the emission value should be within "0.01" kgs of "4.
|
39
|
+
Then the emission value should be within "0.01" kgs of "4.72"
|
35
40
|
|
36
41
|
Scenario Outline: Calculations from hybridity and urbanity estimate
|
37
42
|
Given an automobile_trip has "hybridity" of "<hybridity>"
|
@@ -40,14 +45,14 @@ Feature: Automobile Trip Emissions Calculations
|
|
40
45
|
Then the emission value should be within "0.01" kgs of "<emission>"
|
41
46
|
Examples:
|
42
47
|
| hybridity | emission |
|
43
|
-
| true | 3.
|
44
|
-
| false | 4.
|
48
|
+
| true | 3.37 |
|
49
|
+
| false | 4.76 |
|
45
50
|
|
46
51
|
Scenario: Calculations from make and urbanity estimate
|
47
52
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
48
53
|
And it has "make.name" of "Toyota"
|
49
54
|
When emissions are calculated
|
50
|
-
Then the emission value should be within "0.01" kgs of "3.
|
55
|
+
Then the emission value should be within "0.01" kgs of "3.88"
|
51
56
|
|
52
57
|
Scenario Outline: Calculations from make, hybridity and urbanity estimate
|
53
58
|
Given an automobile_trip has "hybridity" of "<hybridity>"
|
@@ -57,14 +62,14 @@ Feature: Automobile Trip Emissions Calculations
|
|
57
62
|
Then the emission value should be within "0.01" kgs of "<emission>"
|
58
63
|
Examples:
|
59
64
|
| hybridity | emission |
|
60
|
-
| true | 2.
|
61
|
-
| false |
|
65
|
+
| true | 2.77 |
|
66
|
+
| false | 3.91 |
|
62
67
|
|
63
68
|
Scenario: Calculations from make year and urbanity estimate
|
64
69
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
65
70
|
And it has "make_year.name" of "Toyota 2003"
|
66
71
|
When emissions are calculated
|
67
|
-
Then the emission value should be within "0.01" kgs of "2.
|
72
|
+
Then the emission value should be within "0.01" kgs of "2.59"
|
68
73
|
|
69
74
|
Scenario Outline: Calculations from make year, hybridity and urbanity estimate
|
70
75
|
Given an automobile_trip has "hybridity" of "<hybridity>"
|
@@ -74,14 +79,14 @@ Feature: Automobile Trip Emissions Calculations
|
|
74
79
|
Then the emission value should be within "0.01" kgs of "<emission>"
|
75
80
|
Examples:
|
76
81
|
| hybridity | emission |
|
77
|
-
| true | 1.
|
78
|
-
| false | 2.
|
82
|
+
| true | 1.85 |
|
83
|
+
| false | 2.61 |
|
79
84
|
|
80
85
|
Scenario: Calculations from size class and urbanity estimate
|
81
86
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
82
87
|
And it has "size_class.name" of "Midsize Car"
|
83
88
|
When emissions are calculated
|
84
|
-
Then the emission value should be within "0.01" kgs of "2.
|
89
|
+
Then the emission value should be within "0.01" kgs of "2.91"
|
85
90
|
|
86
91
|
Scenario Outline: Calculations from size class, hybridity, and urbanity estimate
|
87
92
|
Given an automobile_trip has "hybridity" of "<hybridity>"
|
@@ -91,32 +96,32 @@ Feature: Automobile Trip Emissions Calculations
|
|
91
96
|
Then the emission value should be within "0.01" kgs of "<emission>"
|
92
97
|
Examples:
|
93
98
|
| hybridity | emission |
|
94
|
-
| true | 1.
|
95
|
-
| false | 3.
|
99
|
+
| true | 1.70 |
|
100
|
+
| false | 3.40 |
|
96
101
|
|
97
102
|
Scenario: Calculations from make model and urbanity estimate
|
98
103
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
99
104
|
And it has "make_model.name" of "Toyota Prius"
|
100
105
|
When emissions are calculated
|
101
|
-
Then the emission value should be within "0.01" kgs of "1.
|
106
|
+
Then the emission value should be within "0.01" kgs of "1.62"
|
102
107
|
|
103
108
|
Scenario: Calculations from make model year and urbanity estimate
|
104
109
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
105
110
|
And it has "make_model_year.name" of "Toyota Prius 2003"
|
106
111
|
When emissions are calculated
|
107
|
-
Then the emission value should be within "0.01" kgs of "1.
|
112
|
+
Then the emission value should be within "0.01" kgs of "1.13"
|
108
113
|
|
109
114
|
Scenario: Calculations from make model year variant and urbanity estimate
|
110
115
|
Given an automobile_trip has "urbanity_estimate" of "0.5"
|
111
116
|
And it has "make_model_year_variant.row_hash" of "xxx1"
|
112
117
|
When emissions are calculated
|
113
|
-
Then the emission value should be within "0.01" kgs of "
|
118
|
+
Then the emission value should be within "0.01" kgs of "1.02"
|
114
119
|
|
115
120
|
Scenario: Calculations from speed and duration
|
116
121
|
Given an automobile_trip has "speed" of "5.0"
|
117
122
|
And it has "duration" of "120.0"
|
118
123
|
When emissions are calculated
|
119
|
-
Then the emission value should be within "0.01" kgs of "2.
|
124
|
+
Then the emission value should be within "0.01" kgs of "2.95"
|
120
125
|
|
121
126
|
Scenario: Calculations from driveable locations
|
122
127
|
Given an automobile_trip has "origin" of "43,-73"
|
@@ -125,7 +130,7 @@ Feature: Automobile Trip Emissions Calculations
|
|
125
130
|
And the geocoder will encode the destination as "43.1,-73"
|
126
131
|
And mapquest will return a distance of "57.93638" kilometres
|
127
132
|
When emissions are calculated
|
128
|
-
Then the emission value should be within "0.01" kgs of "
|
133
|
+
Then the emission value should be within "0.01" kgs of "17.08"
|
129
134
|
|
130
135
|
Scenario: Calculations from non-driveable locations
|
131
136
|
Given an automobile_trip has "origin" of "Lansing, MI"
|
@@ -133,7 +138,7 @@ Feature: Automobile Trip Emissions Calculations
|
|
133
138
|
And it has "destination" of "Canterbury, Kent, UK"
|
134
139
|
And the geocoder will encode the destination as "51.2772689,1.0805173"
|
135
140
|
When emissions are calculated
|
136
|
-
Then the emission value should be within "0.01" kgs of "4.
|
141
|
+
Then the emission value should be within "0.01" kgs of "4.72"
|
137
142
|
|
138
143
|
Scenario: Calculations from fuel efficiency and distance
|
139
144
|
Given an automobile_trip has "fuel_efficiency" of "10.0"
|
@@ -148,6 +153,6 @@ Feature: Automobile Trip Emissions Calculations
|
|
148
153
|
Then the emission value should be within "0.01" kgs of "<emission>"
|
149
154
|
Examples:
|
150
155
|
| fuel | emission |
|
151
|
-
| regular gasoline | 48.
|
152
|
-
| diesel | 56.
|
153
|
-
| B20 |
|
156
|
+
| regular gasoline | 48.20 |
|
157
|
+
| diesel | 56.44 |
|
158
|
+
| B20 | 46.44 |
|