matsim-org / matsim-libs

Multi-Agent Transport Simulation
www.matsim.org
482 stars 446 forks source link

Why are properties of reverse links in bicycle network hard coded? #1722

Closed marecabo closed 2 years ago

marecabo commented 3 years ago

The OsmBicycleReader reads an OSM file and creates a bicycle network. It creates a reverse link for every link. However, the properties (freespeed, capacity, numberOfLanes) of this reverse link are hard-coded (see below) and not taken from the the original forward link.

https://github.com/matsim-org/matsim-libs/blob/12c72bde619b57a4a38eb39620515d4df062cfde/contribs/osm/src/main/java/org/matsim/contrib/osm/networkReader/OsmBicycleReader.java#L111-L114

Example

Link F: 
org.matsim.core.network.LinkImpl@34fcaaad[id=9061489540000f] 
[from_id=331253128] 
[to_id=528518222] 
[length=2.2922350263730866] 
[freespeed=2.7777777777777777] 
[capacity=600.0] 
[permlanes=1.0] 
[modes=[car, bike]

Link R: 
org.matsim.core.network.LinkImpl@6bd94f9d[id=9061489540000f_bike-reverse]
[from_id=528518222]
[to_id=331253128]
[length=2.2922350263730866]
[freespeed=8.333333333333334]  // <-- way faster than forward link?
[capacity=375.0]  // <-- why less capacity?
[permlanes=1.0]
[modes=[bike]

Expected Behavior

I would expect, that all properties should have been used from the forward link, if a reverse link is added at all, as the length is already taken from the forward length.

Could you shed some light on the reasoning for using hard-coded properties for bike reverse links? On first glance I would expect at least freespeed to be the same, and capacity maybe less if the reverse link enables driving in the wrong/not permitted direction, but that might be hard to detect in the general case.

Thanks for your response and all your work on MATSim!

Janekdererste commented 3 years ago

Hi,

reverse links are only created if the original osm-way has a bike lane reverse tag (and some others). In OSM a street regardless whether it is one or two-way is represented by a single way. Streets in MATSim are represented as a directed graph, which means we have to have a link for each direction of a street. If we have a street which is a one way street for car traffic but has a tag, which indicates that bicycles can go the other way, we add a link like the one you have described.

As for the hard coded values: I think it doesn't necessarily makes sense to take the values from the car lane. Looking at the hard coded values I think having a single lane is fine, since I wouldn't know what other value to choose. Also, having a freespeed of 30km/h as a default makes sense to me, since this allows bike riders go as fast as the max. velocitly of their vehicle allows. The capacity value assumes that 1500 riders can pass through that reverse bike lane per hour. I think this value came from a literature review, but I don't know who brought it up anymore and what the sources were.

If you have a good idea for changed values, I would be happy to approve your PR with them.

marecabo commented 2 years ago

Hi, thanks for your explanation.

It took me a while, but I was looking at the code with a single-mode network in mind, in that case, I expected bikes to have the same freespeed in both directions.

With a multimodal network with car and bike, it makes sense to me, to leave the freespeed for the shared forward links as is, to not increase the frespeed for cars as well.

steffenaxer commented 2 years ago

May we close this issue?