From Sumo
Revision as of 12:46, 30 October 2008 by Behrisch (talk | contribs) (Types)
Jump to navigation Jump to search

This document focuses on the main parts of a traffic simulation, that is streets (edges) including lanes, junctions (nodes), and vehicles with their routes. It contains nothing about traffic lights, detectors, visualization or stuff like that. On the other hand this document aims at a precise description which serves as a template for implementation as well as for an xml schema for the input files. Therefore there is a table for all allowed attributes together with their type (and possibly unit). If the attribute is not mandatory, a default value is defined as well. The names of all elements and attributes consist of lowercase letters and underscores only. Keep in mind that the values of attributes which are ids should consist of letters, numbers, and underscores, hyphens, points and colons only, starting with a letter or an underscore (this is called "valid XML id" in the following).


A single vehicle is not modeled, it is always the vehicle on a journey, that means once a vehicle has reached its destination it is deleted from the system and cannot be referenced any longer. The physical parameters of the vehicle are defined with its type, which also defines its membership in some vehicle categories. A vehicle is defined by the combination of its type and its route, together with parameters specifying the start and end behavior. Additional parameters such as color only serve visualization purposes. A vehicle can have routes and stops as child elements.

Attribute Type Range Default Remark
id string valid XML ids -
refid(1) string another vehicle id - all attributes and childs are copied from the given vehicle and maybe overwritten
route string route or routedist id - either this id or a route child element are mandatory
type string vtype or vtypedist id default type
depart float(s) ≥0 -
departlane int/string ≥0,"random","free","departlane" "departlane" "free" is the least occupied lane (by sum of the vehicle lengths)
departpos float(m)/string ≥0(2),"random","free" 0 "free" means the point closest to the start of the departlane where it is possible to insert the vehicle
departspeed float(m/s)/string ≥0,"random","max" 0 "max" refers to the maximum velocity the vehicle can achieve when being inserted
arrivallane int/string ≥0,"current" "current"
arrivalpos float(m)/string ≥0,"random","max" "max"
arrivalspeed float(m/s)/string ≥0,"current" "current"

We still need a specification for emitting similar vehicles repeatedly. This should somehow unify the existing "repno" attribute with the emitter (and possibly calibrator) approaches.

  • (1): will probably be not supported; the issue is that one would have to assure the referenced vehicle is still within the net (is still available)
  • (2): in fact, negative positions are currently allowed, too. In this case, this value is added to the lane's length. This means, the position is counted from the end of the lane.


Types define physical parameters such as length, acceleration, decelaration and maximum speed and give a list of categories cars of this type belong to. All theses parameters are identical among all vehicles of a type.

Attribute Type Range Default Remark
id string valid XML ids - This attribute is disallowed when the type is defined inside a distribution.
refid string another vtype id - all attributes and childs are copied from the given vtype and maybe overwritten
class string list of category ids empty list
accel float(m/s2) ≥0 2.6 the real acceleration is calculated as (1-speed/maxspeed)*accel
decel float(m/s2) ≥0 4.5
sigma float 0≤sigma≤1 0.5
length float(m) >0 5
maxspeed float(m/s) >0 70
tau float >0 1
carFollowModel string model id (at the moment only Krauss) Krauss This is for future implementation of different driver behavior (car following) models
laneChangeModel string model id (at the moment only dkrajzew2008) dkrajzew2008 This is for future implementation of different driver behavior (lane changing) models
speedfactor float >0 1 the factor by which the driver multiplies the speed read from street signs to estimate "real" maximum allowed speed
speeddev float ≥0 0 the standard deviation of the estimated maximum speed (see speed factor) divided by this speed.
frequency float >0 1 this is only useful in distributions

There is a default type defined with the id "DEFAULT_VEHTYPE", having all the default parameters above, which may be redefined once but only if it was not used beforehand (either by a vehicle or as a refid).

Type distributions

Type distributions define probability distributions of vehicle types. They should have at least two vtype childs.

Attribute Type Range Default Remark
id string valid XML ids -
isdefault bool true,false false There can be only one default type or type distribution per simulation setup.


Categories define vehicle classes such as cars, trucks, busses, but also height, width and weight categories might (to some extent) be modeled here. The sole purpose of the category is to determine whether a car is allowed to (or prefers to) drive on a certain street or lane.

Attribute Type Range Default Remark
id string valid XML ids -
description string description of the category - serves only documentation and visualization purposes


Strictly speaking, junctions or nodes need nothing but a unique id, which makes them referenceable by streets which start or end there. Since our network is always embedded into the plane, they also need x- and y-coordinates, though.

Attribute Type Range Default Remark
id string valid XML ids -
x float(m) -10^6<x<10^6 -
y float(m) -10^6<y<10^6 -


Streets need a unique id, a starting node and an ending node. Since the nodes are embedded into the plane, the length is optional and (if not given) can be calculated as the euclidean distance between starting node and end node. There may be further points in the plane (no junctions) given to describe the shape of the street respectively calculate its length as the cumulative distance. The length has to be strictly positive (not zero). This means that if starting node and end node are identical, the length has either to be given explicitly or there needs to be at least one shape node at a position different from the start/end node. Optionally a number of lanes may be given (defaulting to 1, respectively to the number of lane elements in the definition of the street). If the number of lanes given as an attribute is smaller than the number of lane child elements this is an error. All parameters which can be given to lanes can also be given to the street and serve as a default for the corresponding lane parameter.

Attribute Type Range Default Remark
id string valid XML ids -
refid string another edge id - all attributes and childs are copied from the given edge and maybe overwritten
from string node id -
to string node id -
function string normal,internal,ramp normal cannot be given as input, appears only in generated nets
length float(m) ≥0 -
nolanes int >0 - either this one or lane child elements are mandatory
departlane int 0≤departlane<nolanes 0


Lanes have a maximum allowed speed, and lists of allowed, disallowed and preferred vehicle categories. The allowed list defaults to all vehicle categories and the disallowed list to none. A vehicle is allowed to drive on a lane if its category list contains no member of the disallowed list and contains some member of the allowed list.

Attribute Type Range Default Remark
index int 0≤index<edge.nolanes smallest non-explicit index
maxspeed float(m/s) ≥0 13.9
allow string list of category ids,all all
disallow string list of category ids empty list
prefer string list of category ids empty list


Routes give a description of the path a vehicle will follow, that is they merely consist of a non-empty list of streets which are consecutive. Optionally they can have a list of stops as child elements.

Attribute Type Range Default Remark
id string valid XML ids - The attribute is disallowed for routes defined inside a vehicle or a route distribution.
refid string another route id -
edges string list of edge ids -
repeat int >0 1 This is the same as connecting "repeat" times the edge list
frequency float >0 1 This only useful in connection with route distributions

Route distributions

Route distributions define probability distributions of routes. They should have at least two route childs.

Attribute Type Range Default Remark
id string valid XML ids -


Attribute Type Range Default Remark
id string valid XML ids -
edge string edge id - the edge has to be part of the corresponding route
lane int 0≤lane≤edge.nolanes 0
startpos float(m) 0≤startpos≤edge.length edge.length
endpos float(m) startpos≤endpos≤edge.length startpos
duration float(s) >0 -

How the vehicle drives

Before start

On route loading (which is not necessarily the same as application startup) Sumo checks the route for connectivity and for proper placement of stops. On vehicle loading it also checks whether the vehicle is allowed to drive on all edges of its route and whether all other parameters are in the allowed ranges. If any violation of parameter ranges occurs, the simulation stops immediately with an error message. (It is still in discussion whether it should be possible to disable some of the checks via a command-line option, resulting in a vehicle which stops at the end of the last "valid" edge.)


At the given departure time the simulation tries to insert the vehicle with the given parameters. If this is not possible because it would result in a collision, the simulation retries in the next simulation step. If "free" or "random" are specified for startpos and/or startlane, they are recalculated for the next try. The parameters are evaluated in the following order:

  1. Determination of the lane
  2. Determination of the position (even if lane and position are both set to "free", we do not choose a different lane if we cannot find a free position on the lane chosen)
  3. Determination of the start speed (if position is "free" and speed is "max" we do not choose the position where we can reach the highest speed but choose the highest speed we can use at the position chosen before).

When determining the maximum speed and the possibility of insertion the next vehicle(s) upstream and the next vehicle(s) downstream have to be respected even if they are located on the next road section. Thus it may be necessary to take all road sections into account which lead into or follow the current section.


At each step the model calculates a new target speed and accelerates (decelerates) the vehicle accordingly. The acceleration is constant for the step such that a car which is at position s with speed v and gets during the step an acceleration of a has after a timestep of length t the new position s' = s + v*t + a*t^2/2 and v' = v + a*t.


A vehicle tries to reach the most downstream position of a stop area before it actually stops. It can only be forced to stop earlier by other vehicles blocking the rest of the stop area. The duration of the stop starts counting with the first step in which the vehicle's position is in the stop area and its speed is 0. That means if a vehicle stops at timestep 10 (reaches the area and speed 0) and has a stop duration of 2, it stays there for step 11 and 12 and has a new speed and position in step 13 (provided no other blocking occurs).


If the vehicle reaches the point of final destination it is removed from the simulation. That means if the s' as calculated above is larger or equal to the destination point, the vehicle gets removed in this step.