GIS based evacuation simulation tutorial

GIS based evacuation simulation tutorial

What does this tutorial provide:

  • Introduction in org.matsim.evacuation package
  • Setup of a basic evacuation scenario from scratch
  • Some insights of what makes an evacuation simulation different to other transport simulations

What does this tutorial NOT provide:

  • An introduction into MATSim, the participant is expected to have successfully processed the Learning MATSim in 3 Days tutorial
  • A disscussion of more complex evacuation related issues like time dependent networks or system optimum

Requirements:

  • November 2010 MATSim release
  • Java installation
  • Recent version of QuantumGis (>= 1.5) can be obtained from qgis.org for free
  • Working internet connection
  • Webbrowser

In 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:

1. Network

As for every other MATSim scenario we need a network.xml. This input file can be generated from openstreemap data.

Evacuation area.

Evacuation area.

Evacuation area.

Evacuation area.

Evacuation area.

Evacuation area.

Evacuation area.

  1. Go to openstreemap.org
  2. Zoom to the above described area of Berlin (see also screen shot below)
  3. Select the area that has to be evacuated as shown in the screen shot
  4. Export the selected area as OpenStreetMap XML Data
  5. If successful we now have a file called map.osm. This file, however, can not be used with MATSim directly. We first have to converted into a MATSim compatible format.
  6. Convert the map.osm file into a network.xml file as described in Demand and Supply: Network
    The relevant JAVA class can be found in org.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>
  7. The just generated 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.
  8. Import map.osm into qgis
  9. The result looks a little bit distorted. To change this press ctrl-shift-p. Anable "on the fly" transformation and select the Universal Transverse Mercator UTM 33 North coordinate system.
  10. After this right click on map polygons in the layer list and choose "zoom to layer extend".
  11. Create a new polygon layer
  12. Choose Plygon as Type Universal Transverse Mercator UTM 33 North as CRS and insert name as attribute.
  13. Click toggle editing
  14. Click capture polygon and draw the evacuation area (right click when finished)
  15. Click toggle editing again and safe the file as evacuationArea.shp
  16. evacuationarea.xml file by entering:
    java -cp <MATSim release file> org.matsim.evacuation.tutorial.EvacuationAreaGenerator \
         <path to network.xml> <path to path to evacuationArea.shp> <path to output evacuationarea.xml>

2. Population

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.

  1. The PopulationGenerator does all the work. To run it enter:
    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>

3. Config.xml

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> 

4. Run it

  1. Make your evacuation simulation run by entering:
    java -cp <MATSim release file> org.matsim.evacuation.run.EvacuationQSimControler <path to config.xml>