Page |1
Realistic Urban Traffic Simulation Tool CISC 499 Project Report
Muhammad R Muhaimin Student # 06127876
Page |2
Table of Contents
1. Introduction 3
2. Tools used 4 2.1 Open Street Map 4 2.1.1 Map Production Technique used in Open Street Map 4 2.2 Sumo 4 2.2.1 Features of SUMO 5 2.2.2 Included Applications in SUMO 5 3. How the program works 7 3.1 Map Conversion 7 3.2 Trips Generation 9 3.2.1 Program Configurations 9 3.2.2.1 Coordinate Based 9 3.2.2.2 District Based 11 3.3 Generating Trip File from routing table 12 3.4 Generating Flow File from routing table 13 4. Vehicle Movement Generation and data extraction 13 5. Conclusion 17
Page |3
1. Introduction:
Vehicle mobility is now becoming a key element for many areas of scientific data analysis. The data generated from vehicle mobility traces can be used in urban planning, telecommunications, and other disciplines that encompass human movement. There are some existing tools to perform such simulations. However, these tools are challenging to use for general users. Some of them require coding skills and familiarity with command line interfaces. Creating a simple simulation with different scenario can become very challenging and time consuming. To support this need, we develop a simple tool which researchers can use to easily generate vehicle mobility over a real map. To build this tool we are going to use
SUMO “Simulation of UrbanMObility” traffic simulation engine,
Open Street Map and
Java.
We are going to import designated map from Open Street Map and modify it using Java and make it compatible to use with SUMO Simulator. User will be asked to give input of origin and destination of vehicle as simple latitude and longitude co ordinate of the vehicle or they can divide the map into districts and create trips between districts. The file format would be simple text file or .CSV file. We will parse the file using Java and send the coordinate to SUMO for creating the simulation and then save the result for user to further use. Our main goal here is to automate the whole process. Generated output for each stage will be used as input for next stage by program.
Figure 1: Vehicle Mobility Simulation Process
2. Tools used
2.1 Open Street Map:
OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world. Two major driving forces behind the establishment and growth of OSM have been restrictions on use or availability of map information across much of the world and the advent of inexpensive portable satellite navigation devices. Rather than the map itself, the data generated by the OpenStreetMap project is considered its primary output. This data is then available for use in both traditional applications, like its usage by Craigslist and Foursquare to replace Google Maps, and more unusual roles, like replacing default data included with GPS receivers.
2.1.1 Map Production Technique used in Open Street Map:
The initial map data were collected from scratch by volunteers performing systematic ground surveys using a handheld GPS unit and a notebook, digital camera, or a voice recorder. These data were then entered into the OpenStreetMap database. More recently, the availability of aerial photography and other data sources from commercial and government sources has greatly increased the speed of this work and has allowed land-use data to be collected more accurately by the process of digitization. When especially large datasets become available, a technical team manages the conversion and import of the data. Open street map for any part of the world can be downloaded from open street map server and later that can be used for map related to applications. In my project designated area based on user input is selected for parsing from a large area open street map.
2.2 Sumo
“Simulation of Urban MObility” (SUMO) is an open source, highly portable, microscopic road traffic simulation package designed to handle large road networks. It is mainly developed by employees of the Institute of Transportation Systems at the German Aerospace Center. SUMO is licensed under the Plai
Page |4
The simulation allows addressing a large set of traffic management topics. It is purely
t allows to simulate how a given
traffic demand which consists of single vehicles moves through a given road network.
microscopic: each vehicle is modelled explicitly, has an own route, and moves
individually through the network.
2.2.1 Features of SUMO
Page |5
Includes all applications needed to prepare and perform a traffic simulation (network and routes import, DUA, simulation)
Simulation
Space-continuous and time-discrete vehicle movement
Different vehicle types
Multi-lane streets with lane changing
Different right-of-way rules, traffic lights
A fast openGL graphical user interface
Manages networks with several 10.000 edges (streets)
Fast execution speed (up to 100.000 vehicle updates/s on a 1GHz machine)
Interoperability with other application at run-time
Network-wide, edge-based, vehicle-based, and detector-based outputs
Supports person-based inter-modal trips
Network Import
Imports VISUM, Vissim, Shapefiles, OSM, RoboCup, MATsim, openDRIVE, and XML-
Descriptions
Missing values are determined via heuristics
Routing
Microscopic routes – each vehicle has an own one
Different Dynamic User Assignment algorithms
High portability
Only standard c++ and portable libraries are used
Packages for Windows main Linux distributions exist
High interoperability through usage of XML-data only
Open source (GPL)
2.2.2 Included Applications in SUMO
SUMO package comes with following applications:
Application Name
Short Description
SUMO
The microscopic simulation with no visualization; command line application
SUMO-GUI
The microscopic simulation with a graphical user interface
Additionally, the following unsupported contributions are included:
Page |6
NETCONVERT
Network importer and generator; reads road networks from different formats and converts them into the SUMO-format
NETGENERATE
Generates abstract networks for the SUMO-simulation
DUAROUTER
Computes fastest routes through the network, importing different types of demand description. Performs the DUA
JTRROUTER
Computes routes using junction turning percentages
DFROUTER
Computes routes from induction loop measurements
OD2TRIPS
Decomposes O/D-matrices into single vehicle trips
POLYCONVERT
Imports points of interest and polygons from different formats and translates them into a description that may be visualized by SUMO- GUI
ACTIVITYGEN
Generates a demand based on mobility wishes of a modeled population
Additional Tools
There are some tasks for which writing a large application is not necessary. Several solutions for different problems may be covered by these tools.
Application Name
Short Description
TraCI4J
A Java interface for connecting and extending information via TraCI by Enrico Gueli
Contributed/SUMO Traffic Modeler
A Java application for generating a demand based on mobility wishes by Leontios Papaleontiou
Several people have extended the SUMO package during their work and submitted their code. If not being a part of the release, these contributions are usually not tested frequently and may be outdated.
Further – closed source – applications and extensions exist and may be used within joined projects. They are:
Application Name
Short Description
NETEDIT
A graphical network editor.
MESO
A simulation which uses a mesoscopic queue-model, performing simulations up to 100 times faster than the pure microscopic simulation.
In my project the tools we are going to use are SUMO, SUMO-GUI, NETCONVERT, and DUAROUTER.
3. How the program works 3.1 Map Conversion:
Sumo Simulator do not support traditional map format. It only support NETMAP format map. It is represented as an xml file. For using a map with Sumo Simulator firstly we need to convert it to NETMAP format using sumo NETCONVERT tool. NETCONVERT can only convert following files to NETMAP file
Page |7
“SUMO native” XML descriptions (*.edg.xml, *.nod.xml, *.con.xml)
OpenStreetMap (*.osm.xml), including shapes
VISUM, including shapes and demands
Vissim, including demands
openDRIVE
MATsim
SUMO (*.net.xml)
Shapefiles (.shp, .shx, .dbf), e.g. ArcView and newer Tiger networks
Robocup Rescue League, including shapes
a DLR internal variant of Navteq’s GDF (Elmar format)
For my project I have chosen Open Street Map because it is very detailed, easy to import and modify. Open Street Map can be downloaded as .osm file. In our scenario based on user input we will extract the required area from a bigger size map supplied initially with the program. Every latitude and longitude in open street map represented as a node. Following shows representation of a node
A collection of node represents a way. Following is a representation of a way
Page |8
As in our scenario we are only dealing with vehicle transportation we removed all the Nodes and Ways that are not associated with any roads for faster computation. This Open Street Map then later transferred into NETMAP format using SUMO’s NETCONVERT tool. In NETMAP format, Node and Way relation are representing as Edge. For each corresponding Way in Open Street Map file there is at least one Node in edge file. The Nodes inside the Way are found inside the range of each Edge. Sometimes for representing away with lots of Nodes, NETMAP file uses multiple Edges. Here is the representation of an Edge
Other than representing relation between Way and Nodes, Edge also have attributes of various properties of lane in any highway. This file also contain information about traffic junction, traffic light rules etc.
(lat, lon)
Way
Ref
Node
Ref
Ref Edge
Ref as range
Net Convert
Figure 2: Map conversion process
In the next figure is a comparison between Open Street Map and NETMAP format of map.
Page |9
Figure 2: Map comparison
3.2 Trips Generation:
3.2.1 Program Configurations:
Program configurations are provided in a separate file named config.txt. This file defines various properties of the program. It has following property.
Maxlat
Defines the latitude of upper right and upper left corners of map.
Minlat
Defines the latitude of lower right and lower left corners of map.
Maxlon
Defines the longitude upper right and lower right corners of the map.
Minlon
Defines the longitude of upper left and lower left corners of the map.
UseTripData
Boolean value determining whether accurate latitude and longitude value (provided in trips.xls) will be used or not
UseFlowReplication
Boolean value determining whether flow file will be used or not
NumFlowReplication
Number of cars for each vehicle in flow
UseDistrict
Boolean value determining whether district will be used or not.
DivideByRow
Number of rows when dividing district
DivideByColumn
Number of column when dividing district
Debug
Boolean value determining whether using debug mode or not
3.2.2 Input Processing: 3.2.2.1 Coordinate Based:
Page |10
In coordinate based trips generation input will be given in a file named trips.xls. Usually this type of input is given to program when we want trip generation between accurate source and accurate destination. The input file trips.xls has the following property.
When parsing the input, my program checks whether the given coordinate is a valid road. Because as we are dealing here with vehicle mobility any coordinate which is not in a road is an invalid coordinate to the program. If given coordinate is not a valid road, our program will find the closest coordinate that is a valid road. For doing that initially program parse all the Nodes from Open Street Map and save their coordinates. When an invalid coordinate is given as an input program find the closest coordinate from the list of coordinates and use that as input.
Figure 3: Finding valid coordinate
After this step program stores this coordinate in a routing table. The representation of routing table is give below
LatSrc
LonSrc
LatDest
LonDest
Time
# cars
44.2224
-76.4912
44.223
-76.492
30
10
Src CoOrd
Dest CoOrd
Time
44.2224, -76.4912
44.223, -76.492
30
Page |11
44.2224, -76.4912
44.223, -76.492
30
44.2224, -76.4912
44.223, -76.492
30
In this routing table we repeat same trip thrice because in our input file the user indicated 3 cars will make a trip between this source and destination.
3.2.2.2District Based:
In District based Input the input will be given in a simple text file named dRoute.txt. This file has following properties.
Based on this input the program will generate random coordinates in source and destination district, which we created by diving the maps based on program configurations.
Src Dist.
Dest Dist.
Cars
Time
2
3
3
40
Figure 4: District based routing
Page |12
Randomly generated source and destination coordinates are replicated based on number of trips between source and destination, and these trips data are stored in routing table.
Src Coordinate.
Dest Coordinate.
Time
44.201,-76.491
44.223, -76.493
30
44.200,-76.501
44.221, -76.492
30
44.211,-76.511
44.220, -76.490
30
In later stages the program use this routing table to prepare trips.xml and flow.xml file and which are passed to simulator.
3.3 Generating Trip File from routing table:
Trip file is a simple .xml file that represents the source and destination with edge. It has the following property
The representation of a trip file is shown below
Before generating trip file the program need to compute source Edge and Destination Edge for each Source coordinate and Destination coordinate. In our routing table the source and destination coordinates represent a node in Open Street Map. For each entry in the routing table programs find the corresponding node in Open Street Map. At next step the program finds the Way which contains our corresponding Node. As NETMAP file Edge are related to Open Street Map’s Way and Node at next step our
… more trip def
Page |13 program find the corresponding Edge in the NETMAP file related to Way and Node and
create a new routing table.
After this step program use this table to create Trip file.
3.4 Generating Flow File from routing table:
Flow file is very similar to trip file but it has two extra property of replicating vehicle and create a flow of cars after a set time interval. Flow file has the following structure
The representation of a flow file is show below
Src Edge
Dest Edge
Time
73911354
73911387
30
….more flow def
…. more flow def
In the flow file program used the same table used in creating trip file and for creating flow it uses the NumFlowReplication parameter provided by user to generate number of replication for each file.
After this stage trip file and flow file are passed to simulator for creating simulation.
4. Vehicle Movement Generation and data extraction
For generating vehicle movement we pass the trip file and flow file to DUAROUTER tool provided by SUMO.
DUAROUTER imports different demand definitions, computes
vehicle routes that may be used by SUMO using shortest path computation; when called
Page |14
iteratively DUAROUTER performs dynamic user assignment (DUA). DUA router
generates definition of vehicles, vehicles types and routes and save them. In our
program we name it as rou.xml. Here is how this file is represented.
For each vehicle inside the route it contains its departure time and the edges that it travels through the trip. At this point we have all the necessary elements to run our simulation. NETMAP file contain maps and rou.xml contains vehicle information which is essential for running the simulation. We referenced rou.xml and NETMAP from another xml file named cfg.xml. This file contain the following
Initially we run this file with GUI Simulator to see a visual output of the program. It lets user visualize the vehicle movement.
Page |15
Figure 5a: Visual Simulation zoom-out view
Figure 5b: Visual Simulation zoom-in view
For saving the simulation we use another tool provided by SUMO name vTypeProb which saved our output as an .xml file. This file contains all the info related to our simulation. Below is the representation of vTypeProb file
x=”
… further vehicles …
Page |16
At the very end we run an xml parser to parse this .xml file and save our output in a .csv format file.
time
vehicle_id
lane
Lat
Lon
x
y
speed
count
0
1000010_0
56150114#0_0
44.223
-76.493
11446.65
2841.75
0
100
0
1000011_0
56150107_0
44.221
-76.494
11060.69
2353.29
0
100
0
1000012_0
59407145#0_0
44.212
-76.492
11326.85
2979.5
0
100
0
1000014_0
4630404#0_0
44.220
-76.491
11439.09
3696.55
0
100
The figure below show the whole simulation and data extraction process in my program
Figure 6: Simulation and Data extraction
Page |17
5. Conclusion
We believe this project can help scientific research by contributing vehicle mobility data. Any researcher who needs vehicle mobility data can use the developed tool with minimal knowledge of the underlying map convertors and microscopic vehicle simulators. For example it can help urban planners measure the effect of vehicle mobility in urban area in any change of city road network. Environmentalist can measure CO2 footprint of any area by measuring carbon emission of each vehicle and vehicle mobility in any particular area. I plan to improve the project in future as well. Our future development plan includes implementing better algorithm for faster computation, allowing user to provide their own road network and hosting the program in an external server which enable user to run simulation based on their input and make SUMO configuration file and simulation data available for download.