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
+10 -4
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