Skip to content

Commit

Permalink
update bike speed and network filter for new bike network
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Nov 12, 2024
1 parent 50063fb commit 83a69df
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
6 changes: 3 additions & 3 deletions input/v6.4/berlin-v6.4-vehicleTypes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<width meter="1.0"/>

<!-- The speed was set such that the obtained avg. speed per trip matches the one reported in the SrV survey -->
<!-- Note that this speed includes all the effects of delays that might occur, such as waiting traffic lights -->
<!-- 11.5 kmh -->
<maximumVelocity meterPerSecond="3.28"/>
<!-- Note that this speed includes all the effects of delays that might occur, such as waiting for traffic lights -->
<!-- The reported data is 10.29 km/h, it needs to set higher here (+0.5) because this includes access/egress as well -->
<maximumVelocity meterPerSecond="3"/>
<passengerCarEquivalents pce="0.2"/>
<networkMode networkMode="bike"/>
</vehicleType>
Expand Down
3 changes: 2 additions & 1 deletion input/v6.4/berlin-v6.4.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@
-->

<module name="simwrapper" >
<param name="sampleSize" value="0.1" />

<parameterset type="params" >
<param name="context" value="" />
<param name="mapCenter" value="13.39,52.51" />
<param name="mapZoomLevel" value="9.1" />
<param name="sampleSize" value="0.1" />
<param name="shp" value="./area/area.shp" />
</parameterset>
</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ private void matchWithNetwork(Path network) throws TransformException, IOExcepti
manager.addLinkFilter(l -> !l.getId().toString().startsWith("pt_"));
manager.addLinkFilter(l -> !NetworkUtils.getHighwayType(l).equals("service"));
manager.addLinkFilter(l -> !NetworkUtils.getHighwayType(l).equals("living_street"));
manager.addLinkFilter(l -> !NetworkUtils.getHighwayType(l).equals("path"));
manager.addLinkFilter(l -> !NetworkUtils.getHighwayType(l).equals("cycleway"));

net = manager.applyFilters();
}
Expand Down
31 changes: 31 additions & 0 deletions src/main/python/extract_bike_speeds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import os
from matsim.scenariogen.data import EconomicStatus, TripMode, preparation, run_create_ref_data


from extract_ref_data import trip_filter

def person_filter(df):
df = df[df.reporting_day <= 4]
df = df[df.location == "Berlin"]

return df

if __name__ == "__main__":
d = os.path.expanduser("~/Development/matsim-scenarios/shared-svn/projects/matsim-berlin/data/SrV/")

result = run_create_ref_data.create(
d + "Berlin+Umland",
person_filter, trip_filter,
run_create_ref_data.InvalidHandling.REMOVE_TRIPS,
)

t = result.trips

t["speed"] = (t.gis_length * 3600) / (t.duration * 60)
t = t[t.main_mode == TripMode.BIKE]

t.to_csv('bike_speeds.csv', columns=["t_weight", "age", "speed"], index=False)

0 comments on commit 83a69df

Please sign in to comment.