generated on 2018-12-14 00:24:44.845100 from the wiki page for Simulation/Railways for SUMO git

Train Simulation

This page describes simulations of trains in SUMO. To build an intermodal simulation scenario with trains, additional steps have to be take in comparison to a plain vehicular simulation.

Building a network for train simulation


Railways can be imported from OSM. They can also be explicitly specified using the existing vClasses.

Bidirectional track usage

In reality all tracks can be used in either direction if the need arises but many rails are used in only one direction most of the time. In SUMO, bidirectional track usage must be enabled explicitly. This simplifies routing as rails will only used in their preferred direction most of the timee.

Bidirectional track usage is modeled by two edges that have their geometries exactly reversed and using the attribute spreadType="center". This will result in lane geometries that are overlayed exactly. These edges are referred to as superposed (alternatively as bidirecticional rail edges).

Rail signals recognize superposed edges and automatically restrict their usage so that only one direction is accessible at a time.

SUMO-GUI automatically shows only one of both edges to avoid duplicate drawing of cross-ties. The visualisation option show lane direction can be used to identifiy superposed edges as arrows in both directions will be show.

NETEDIT supports the visualisation option spread superposed which draws both edges with an offset and thus makes it easier to edit them. Also, bidirectional tracks can be selected (and thus highligted) using edge attribute 'bidiRail' with value '1' in selection mode.

Importing Bidirectional rails from OSM

When importing networks from OSM, rails tagged with railway:preferred_direction:both are automatically imported as superposed edges.

Handling Problems in bidirectional railway networks

Commonly, rail networks import from OSM are incomplete in regard to bidirectional track usage. One example would be terminal tracks which a train can only leave by reversing direction. A large number of these issues can be fixed automatically be setting the NETCONVERT-option To analyze problems with bidirectional tracks, the option --railway.topology.output <FILE> can be used to identify problematic tracks. The option --railway.topology.all-bidi can be used to make all tracks usable in both directions.

Rail Signals

The node type rail_signal may be used to define signals which implement Automatic Block Signaling.

By setting the NETCONVERT-option --railway.signals.discard all signals can be removed from a network.

Rail Crossings

The node type rail_crossing may be used to define railway crossings. At these nodes trains will always have the right of way and road vehicles get a red light until there is a safe gap between approaching trains.

When importing networks from OpenStreetMap, rail crossings will be imported automatically. For other input data sources the crossings may have to be specified via additional xml files or set via NETEDIT after importing.

Modelling Trains

There is a dedicated carFollowMode for trains which can be actived by setting carFollowModel="Rail" trainType="<TYPE>" in the <vType> definition. Allowed values for trainType are

  • Freight
  • ICE1
  • ICE3
  • RB425
  • RB628
  • REDosto7
  • NGT400
  • NGT400_16

These types model traction and rolling resistance for particular trains. Alternatively, any other car following model may be used and configured with appropriate acceleration / deceleration parameters.

Train Interaction

When simulation trains on a network with railway signals, trains will only enter a block (a section of edges between signals) if it is free of other trains. When there are no rail signals or multiple trains have been inserted in the same block, they will automatically keep a safe distance according to their car following model. When using carFollowModel="Rail", trains will always keep enough distance to the leading train to come to a safe stop even if the lead train was to stop instantly.

Reversing Direction

Trains will reverse direction if all of the following conditions are met:

  • The head of the train is on a normal edge (not on an intersection / railway switch)
  • The whole length of the train is located on rail-edges that allow bidirectional use.
  • The speed of the train is below 0.1m/s.
  • The train does not have any further stops on the current edge
  • The succeeding edges in the train's route are the reverse-direction edges of those it is currently on
  • There is a "turn-around" connection from the current train edge to the reverse direction edge
adding a <stop> element to a trains route is recommended for making it reverse direction.
When importing public transport stops with option --ptstop-output, all bidirectional edges with a public transport stop will have the necessary turn-around connection and thus be eligible for reversing.


  • Individual rail cars / coupling / uncoupling cannot currently be modeled

This page was last modified on 20 November 2018, at 21:11.