-
Notifications
You must be signed in to change notification settings - Fork 3.8k
car: better speeds on links #989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
in the first test, a motorway has maxspeed=60 => ave=48. the link has ave=35. so the motorway is still picked. in the second test, the motorway has maxspeed=40 => ave=32. since this is lower that the ave of 35 for the link, the link is followed. |
|
btw, the increase in max to ave factor can be omitted from this PR if desired. just seemed like a good time to consider that too. |
|
cool. thanks. will get to this once remove_geometry branch is successfully merged. |
|
Thanks for providing this. I gave the approach another thought. Here is what I was thinking: From a modeling point of view, we should first calculate the free flow speed for each way and only afterwards scale it down to what we think is the average or expected speed. The rationale is that we will apply scaling as the last step as we are getting access to sources of real-time traffic information. |
|
Do you mean we should specify max speeds in the profile, rather than average speeds? I think average speeds are generally easier to work with. Wouldn't traffic data usually also consist of average travel speeds? |
|
A refinement would be to specify both max and average speed for each way type. Implicit this also defines the scaling factor. Example |
|
Let me get into more detail here. So, yes, you are right. Let's think of getting maxspeeds right at first. And then we apply scaling or real-time information for that matter. It is important to do the maxspeeds at first, because we view the application of the scaling similar to the application of an operator the underlying data structure. |
|
Yeah, cool idea with the type-dependent scaling. This could be a thing to learn from traffic feeds for example. We should make this the very last step of the way_function call. |
|
I'm not sure I really understand the need to determine maxspeed (free flow) first. Ultimately, we need the average speed to assign an impedance. Average speed is also what traffic data will usually provide. If we only have a max speed for a way, but no average, then we need to scale down the max to get to a realistic average. But if we already have an average, there's no need for scaling or max speed? What is the benefit of modelling it as free flow, lowered by some factor, rather than simply an average? |
|
Doing maxspeed first and then having a deliberate step to get that into a realistic number has the benefit of separating between the extraction process and the modeling. Think of a scaling process that needs the maxspeed as an input. Also, I'd like this to be separate for the purpose of maintaining. |
|
Most of the time no maxspeed tag exists, and we will have no other option than to assign an estimate. So that initial 'clean' max speed value, together with a scaling factor, will just be another way of guestimating the average? That's why I'm wondering if it's not easier to just use averages like we're currently doing. |
|
The separation is the key. It makes the entire process of finding reasonable speeds more clearly layed out. First, we try to come up with reasonable maxspeeds. Later, we find estimates for the average. You can work on both parts separately and independently which important for maintainability. |
|
rebased on develop |
|
what's happening with this one? |
|
do you plan to merge this? |
|
Yeah, this is still on the plate. But as mentioned above the separation of deriving a general free-flow speed first and adjusting it in a subsequent step is important. |
|
@emiltin would you mind rebasing this one onto develop? I'd like to move on this. |
|
sure. should i fix the problem in current dev, that causes all speeds to be reduced by 4/5, even when there's no maxspeed? motorways currently end up with 72km/h when no maxspeed is specified. then maybe as a next step we can work on specifying all speeds in profiles as maxspeeds instead of averages. |
|
ie remove this code from the end of car.lua, which is always called: -- scale speeds to get better avg driving times
way.speed = way.speed * max_to_average_speed_factor
if maxspeed_backward > 0 then
way.backward_speed = way.backward_speed*max_to_average_speed_factor
end |
|
thus rebased, average speed on motorways are now 90, motorway_links 40, etc |
That isn't a bug. That is by design. |
|
ok i understand that we want to always start with a maxspeed (either specified in the profile, or read from the maxspeed tag), and then scale it down. but isn't an average of 72km/h on motorways too low? |
|
It is low, yes. The next step will be deriving highway-type specific scaling factors. |
|
so what do we do with this PR - leave speeds low? |
|
alright, reverted to alway scaling down speeds. then we can work on improving that as a next step. |
|
hi dennis, now that remove_geometry has been merged, what should we do with this pr? |
|
@emiltin as argued above: move the scaling at the bottom. Doing it explicitly at the end of everything is superior to implicitly scaling in default speeds. |
|
Hi, I think it would be great if adjustments to the speed profile could be merged, since it would help removing a lot of defects on routes where it goes over links instead of keeping on the main road. Renaming the scaling factor makes it's purpose more clear. The rest of the changes I'm not so sure about. Isn't maxspeed from tags scaled twice? In that case why? Also a variable named max_speed is set to a scaled average speed value. Don't know if setting the way.speed to max_speed at first and scale later is good either, if a clear separation is wanted. Is way.speed a speed limit or an average speed? OT: Is maxspeed from tags used only when higher than the speed profile value? Is that correct even if the maxspeed is set to a correct lower value? |
|
Ignore my previous comment. I noticed speed profiles has been fixed by commit 5653516 I guess this request can be closed then |
|
Thanks for the note @agunnarsson |
|
@emiltin this PR has become obsolete, right? Or is there anything in it that should move into develop branch? |
|
yeah. you chose to implement the same thing again :-) |
|
Totally overlooked this issue when re-implementing :-) |
lower speed of links to more realistic levels. keep in mind that the speeds in the profile are average speeds, not max speeds. a motorway_link now has average of 45, instead of 75, similar pattern for other ways types.
also add tests to verify that links are not used unless the main road has a very low maxspeed (about half the default average).
also increased the max to ave factor from 0.66 to 0.8.