Tutorials/ScenarioGuide

generated on 2018-11-16 00:21:39.472755 from the wiki page for Tutorials/ScenarioGuide for SUMO git

Introduction

This Tutorial is meant to serve as a high-level guide for building a SUMO scenario. It provides an outline of the typical steps when building a scenario and lists the recommended wiki pages for each step.

Note:
This tutorial assumes familiarity with Tutorials/Hello Sumo, Tutorials/quick start or Tutorials/Quick Start old style.

Build the road network

Every simulation requires a road network. The application NETCONVERT is used to create a network which can be used by the simulation SUMO. It is also possible to build/modify a simulation network by hand with use of NETEDIT, which provides a graphical user interface.

If you already have some network data

Check whether a direct import is possible: Networks/Import. Otherwise you will need to convert the data to a simple XML-format which can be read by NETCONVERT. Read this page: Networks/Import.

If you do not yet have any network data

Use publicly available network data from OpenStreetMap as described here: Networks/Import/OpenStreetMapDownload. Then import the network as described here: Networks/Import/OpenStreetMap.

Generate the traffic

First you should understand the basics of vehicle modelling: Definition_of_Vehicles,_Vehicle_Types,_and_Routes. You have various ways to insert vehicles into the map. Your choice basically depends on what kind of information about the traffic you have: Demand/Introduction_to_demand_modelling_in_SUMO.

Improve your Scenario

Most methods for network import leave some aspect of deficient network quality. Very often this manifests as unexpected/unrealistic traffic jams and teleporting vehicle errors.

Modifying the Network

You will have to patch your network data to add missing roads, prohibit some turns, correct the number of lanes and add/remove some traffic lights. The recommended ways to perform the necessary changes include:

  1. Encode the changes in plain-xml files as described in Networks/Building_Networks_from_own_XML-descriptions. Most XML-attributes are optional so you only need to set the values you would like to change.
  2. patch your network using NETCONVERT by loading the net.xml along with the plain-xml files. You can even use this during the initial import (i.e. load an OSM-file along with your plain-xml files)
  3. directly adjust your network with GUI: after opening the program NETEDIT you load the network file (*.net.xml)that needs to be modified. Then you choose the respective funtions in NETEDIT to modify e.g. the number of lanes, road shapes, traffic signal plans, intersection geometries, and to combine intersections or edges.

Example: Patching the type of a node

prepare a file like this:

patch.nod.xml :

 <nodes>
    <node id="id_of_the_node_you_want_to_modify" type="right_before_left"/>
 <nodes>

and patch the network like this:

 netconvert --sumo-net-file your.net.xml --node-files patch.nod.xml -o yourpatched.net.xml

or perform the patch during the initial import:

netconvert --osm-file yourOSMfile.xml --node-files patch.nod.xml ...<other options>

Modifying an imported network via plain.xml

Instead of patching individual elements you can also convert your network to plain.xml and modify the plain file and then re-assemble the network like this:

 netconvert --sumo-net-file your.net.xml --plain-output-prefix yourplain

or during import:

 netconvert --osm-files yourOSMinput.xml --plain-output-prefix yourplain ... <your other options>

This will give you the files:

 yourplain.edg.xml
 yourplain.nod.xml
 yourplain.con.xml
 yourplain.tll.xml

You can edit these files and then reassamble the network buy loading some or all of them:

 netconvert --edge-files yourplain.edg.xml --node-files yourplain.nod.xml -o new.net.xml

or

 netconvert --edge-files yourplain.edg.xml --node-files yourplain.nod.xml --connection-files yourplain.con.xml -o new.net.xml
Note:
When working with networks based on OSM input, the .edg.xml file will contain information on the OSM-type of an edge (i.e. highway.residential. When loading such an .edg.xml file with NETCONVERT you need to supply the option --ignore-errors.edge-type or load a type-file to prevent errors of the form Type ... not defined.

Traffic Light Programs

In almost all cases the traffic light programs will have been guessed by NETCONVERT and turn out different from the real traffic lights. A simple way to improve traffic lights programs is making them start their program cycle at a different time. Experiment with the option --tls.half-offset and all the other --tls.* options of NETCONVERT.

A more practical and efficient way to improve your traffic lights is to give the program explicitly with a tls.xml file.

At this time NETCONVERT only supports the creation of static traffic light programs. For dynamic traffic lights see Tutorials/TraCI4Traffic_Lights. Furthermore, actuated traffic control can also be set, either based on time gaps or time loss. More information about actuated traffic control and settings can be found at Simulation/Traffic_Lights#Actuated_Traffic_Lights).

Manage Scenarios

If you have two networks A.net.xml and B.net.xml you may wish to find out how they differ. This can be accomplished using the tool <SUMO_HOME> /tools/net/netdiff.py. Running this tool will give you a set of plain-XML difference files. They only contain the differences grouped by deleted, created and changed elements. It is even possible to load these files along with A.net.xml to recreate B.net.xml.


This page was last modified on 24 September 2018, at 14:50.