org.matsim.evacuation packageIn this tutorial we want to simulated the evacuation by car of an area in Berlin where the laboratories of the VSP working group are located. The area looks like a peninsular separated by the river Spree and Landwehrkanal. In this scenario it is assumed that the evacuees can leave the area via three different bridges (Dove bridge, March bridge and Gotzkowsky bridge). Area details are shown in the screenshots below.
Ok, here we go:
As for every other MATSim scenario we need a network.xml. This input file can be generated from openstreemap data.







map.osm. This file, however, can not be used with MATSim directly. We first have to converted into a MATSim compatible format.map.osm file into a network.xml file as described in Demand and Supply: Networkorg.matsim.evacuation.tutorial.NetworkFromOSM. You can run it by entering:
java -cp <MATSim release file> org.matsim.evacuation.tutorial.NetworkFromOSM \
<path to osm input file> <path to network.xml output file>
network.xml is still not very useful for an evacuation simulation. This is because the multi-destination evacuation problem has to be transformed in a single-destination problem. Meaning we have to connect all links that lead out of the evacuation area to a super sink where we can route to. Therefore we have to define the evacuation area in a separate xml file.map.osm into qgisevacuationArea.shpjava -cp <MATSim release file> org.matsim.evacuation.tutorial.EvacuationAreaGenerator \
<path to network.xml> <path to path to evacuationArea.shp> <path to output evacuationarea.xml>
Since we do not have real population data for the given area we invent a population. Let's say there are 5000 people with car that have to evacuate. Furthermore let's assume the car are some how equal distributed over the evacuation area.
java -cp <MATSim release file> org.matsim.evacuation.tutorial.PopulationGenerator \
<path to evacuationArea.shp> <path to network.xml> \
<path to output population.xml> <number of evacuees>
The <code>config.xml</code> wraps the paths of the input files and simulation specific parameters together. Below a minimal sample config is given. In order to functioning the paths to the input directory and output directory have to be adapted:
<?xml version="1.0" ?> <!DOCTYPE config SYSTEM "http://www.matsim.org/files/dtd/config_v1.dtd" [ <!ENTITY INPUTBASE "/home/laemmel/arbeit/evacuationTutorial/"> <!ENTITY OUTPUTBASE "/home/laemmel/arbeit/evacuationTutorial/output/"> ] > <config> <!-- ====================================================================== --> <module name="qsim"> <param name="endTime" value="09:00:00" /> </module> <!-- ====================================================================== --> <!-- Params for EvacuationQSimControler --> <module name="evacuation"> <param name="inputEvacuationAreaLinksFile" value = "&INPUTBASE;/evacuationarea.xml"/> </module> <!-- ====================================================================== --> <module name="controler"> <param name="outputDirectory" value="&OUTPUTBASE;" /> <param name="eventsFileFormat" value="xml" /> <param name="firstIteration" value="0" /> <param name="lastIteration" value="0" /> </module> <!-- ====================================================================== --> <module name="plans"> <param name="inputPlansFile" value="&INPUTBASE;/population.xml" /> </module> <!-- ====================================================================== --> <module name="network"> <param name="inputNetworkFile" value="&INPUTBASE;/network.xml" /> </module> <!-- ====================================================================== --> <module name="planCalcScore"> <param name="BrainExpBeta" value="10" /> <param name="traveling" value="-6" /> <!-- Activity indices (the numbers after the '_') go from 0 to n. The ordering doesn't matter. --> <param name="activityType_0" value="h" /> <!-- home --> <param name="activityPriority_0" value="1" /> <param name="activityTypicalDuration_0" value="12:00:00" /> <param name="activityMinimalDuration_0" value="08:00:00" /> </module> <!-- ====================================================================== --> <module name="strategy"> <param name="maxAgentPlanMemorySize" value="4" /> <!-- 0 means unlimited --> <param name="ModuleProbability_1" value="0.9" /> <param name="Module_1" value="ChangeExpBeta" /> <param name="ModuleProbability_2" value="0.1" /> <param name="Module_2" value="ReRoute_Dijkstra" /> </module> <!-- ====================================================================== --> </config>
java -cp <MATSim release file> org.matsim.evacuation.run.EvacuationQSimControler <path to config.xml>