adjust speeds to universally use 4/5th of the free-flow speed as expected avg speed

- this is a workaround until we get more thourough work done on the cost model
- this is related to #955 and #989
This commit is contained in:
Dennis Luxen 2014-05-09 11:11:14 +02:00
parent 881a57bf8d
commit 3c5b2286a3
3 changed files with 36 additions and 30 deletions

View File

@ -1,6 +1,6 @@
@routing @maxspeed @car
Feature: Car - Max speed restrictions
When a max speed is set, osrm will use 2/3 of that as the actual speed.
OSRM will use 4/5 of the projected free-flow speed.
Background: Use specific speeds
Given the profile "car"
@ -17,8 +17,8 @@ When a max speed is set, osrm will use 2/3 of that as the actual speed.
When I route I should get
| from | to | route | speed |
| a | b | ab | 85 km/h |
| b | c | bc | 40 km/h +- 1 |
| a | b | ab | 67 km/h |
| b | c | bc | 48 km/h +- 1 |
Scenario: Car - Do not ignore maxspeed when higher than way speed
Given the node map
@ -31,21 +31,21 @@ When a max speed is set, osrm will use 2/3 of that as the actual speed.
When I route I should get
| from | to | route | speed |
| a | b | ab | 25 km/h |
| b | c | bc | 60 km/h +- 1 |
| a | b | ab | 20 km/h |
| b | c | bc | 72 km/h +- 1 |
Scenario: Car - Forward/backward maxspeed
Given a grid size of 100 meters
Then routability should be
| highway | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
| primary | | | | 65 km/h | 65 km/h |
| primary | 60 | | | 40 km/h | 40 km/h |
| primary | | 60 | | 40 km/h | 65 km/h |
| primary | | | 60 | 65 km/h | 40 km/h |
| primary | 15 | 60 | | 40 km/h | 10 km/h +- 1 |
| primary | 15 | | 60 | 10 km/h +- 1| 40 km/h |
| primary | 15 | 30 | 60 | 20 km/h | 40 km/h |
| primary | | | | 51 km/h | 51 km/h |
| primary | 60 | | | 48 km/h | 48 km/h |
| primary | | 60 | | 48 km/h | 65 km/h |
| primary | | | 60 | 51 km/h | 48 km/h |
| primary | 15 | 60 | | 48 km/h | 15 km/h +- 1 |
| primary | 15 | | 60 | 12 km/h +- 1| 48 km/h |
| primary | 15 | 30 | 60 | 24 km/h | 48 km/h |
Scenario: Car - Maxspeed should not allow routing on unroutable ways
Then routability should be

View File

@ -8,17 +8,17 @@ Feature: Car - speeds
Scenario: Car - speed of various way types
Then routability should be
| highway | oneway | bothw |
| motorway | no | 90 km/h |
| motorway_link | no | 75 km/h |
| trunk | no | 85 km/h +- 1 |
| trunk_link | no | 70 km/h +- 1 |
| primary | no | 65 km/h +- 1 |
| primary_link | no | 60 km/h |
| secondary | no | 55 km/h +- 1 |
| secondary_link | no | 50 km/h |
| tertiary | no | 40 km/h |
| tertiary_link | no | 30 km/h |
| unclassified | no | 25 km/h |
| residential | no | 25 km/h |
| living_street | no | 10 km/h |
| service | no | 15 km/h |
| motorway | no | 72 km/h |
| motorway_link | no | 60 km/h |
| trunk | no | 67 km/h +- 1 |
| trunk_link | no | 55 km/h +- 1 |
| primary | no | 52 km/h +- 1 |
| primary_link | no | 48 km/h |
| secondary | no | 43 km/h +- 1 |
| secondary_link | no | 40 km/h |
| tertiary | no | 32 km/h |
| tertiary_link | no | 24 km/h |
| unclassified | no | 20 km/h |
| residential | no | 20 km/h |
| living_street | no | 8 km/h |
| service | no | 12 km/h |

View File

@ -46,7 +46,7 @@ local abs = math.abs
local min = math.min
local max = math.max
local maxspeed_reduction = 0.66
local speed_reduction = 0.8
local function find_access_tag(source,access_tags_hierachy)
for i,v in ipairs(access_tags_hierachy) do
@ -172,7 +172,7 @@ function way_function (way)
if way.speed == -1 then
local highway_speed = speed_profile[highway]
local max_speed = parse_maxspeed( way.tags:Find("maxspeed") )*maxspeed_reduction
local max_speed = parse_maxspeed( way.tags:Find("maxspeed") )
-- Set the avg speed on the way if it is accessible by road class
if highway_speed then
if max_speed > highway_speed then
@ -244,8 +244,8 @@ function way_function (way)
end
-- Override speed settings if explicit forward/backward maxspeeds are given
local maxspeed_forward = parse_maxspeed(way.tags:Find( "maxspeed:forward"))*maxspeed_reduction
local maxspeed_backward = parse_maxspeed(way.tags:Find( "maxspeed:backward"))*maxspeed_reduction
local maxspeed_forward = parse_maxspeed(way.tags:Find( "maxspeed:forward"))
local maxspeed_backward = parse_maxspeed(way.tags:Find( "maxspeed:backward"))
if maxspeed_forward > 0 then
if Way.bidirectional == way.direction then
way.backward_speed = way.speed
@ -261,6 +261,12 @@ function way_function (way)
way.ignore_in_grid = true
end
way.type = 1
-- scale speeds to get better avg driving times
way.speed = way.speed * speed_reduction
if maxspeed_backward > 0 then
way.backward_speed = way.backward_speed*speed_reduction
end
return
end