The interaction with trains is modeled with an event-based deleting and creating of doors. When a train arrives on the platform, doors are created and again deleted when the train departs.

Train constraints

Information regarding trains are organized in two different files:

  • Train types: In this file types of trains are defined.
  • Train timetable: This file defines arrival and departure times of trains and specifies their location on tracks.

Train types


A train is defined through the following information:

  • type (string): unique key to identify train
  • length (float): length of the train
  • agents_max (int): maximal number of passengers
  • door:
    • id (int): id of the train door
    • distance (float): distance to train start
    • width (float): width of the door


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <train type="RE" agents_max="15" length="9">
        <door id="1" distance="1" width="1"/>
        <door id="3" distance="5" width="1"/>

    <train type="ICE" agents_max="20" length="23">
        <door id="1" distance="1.5" width="2"/>
        <door id="2" distance="10" width="3"/>
        <door id="3" distance="18" width="2"/>

Schematic overview of train type definition.

Capacity of a train

The number of agents in a train is calculated every time step as the sum of all agents passing through the train’s doors.

When this number exceeds the agents_max parameter, all train’s doors are closed.

Train timetable


A train is defined through the following information:

  • id (int): id of the train
  • type (string): identifier of the train defined with the train types
  • track_id (int): id of the track the train arrives, more information on tracks (geometry defintion)
  • train_offset (float): offset of the train to the track start
  • reversed (bool):
    false: train starts at track start (default),
    true: train starts at track end
  • arrival_time (float): time the train arrives
  • departure_time (float): time the train departs


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <train id="1" type="RE"
           arrival_time="5" departure_time="15">

    <train id="2" type="ICE"
           train_offset="1" reversed="true"
           arrival_time="20" departure_time="30">

With the train defined as above, this would lead to the positioning of the train doors as seen here: Schematic overview of train arrival on platform.

Geometry definition

For using trains in the simulation, tracks need to be defined in the geometry. A track is a consecutive line sequence, marked by the type type="track". For each track, one point needs to be marked as a starting point with start="true", which represents the reference point for the location of trains on tracks (defined in Train timetable).


<room id="1" caption="floor">
    <subroom id="2" caption="Room 2" A_x="0" B_y="0" C_z="0">
        <polygon caption="wall" type="track" track_id="1">
            <vertex px="-10" py="10" start="true" />
            <vertex px="-5" py="10" />
        <polygon caption="wall" type="track" track_id="1">
            <vertex px="-5" py="10" />
            <vertex px="0" py="10" />

Geometry adaptation

For realizing trains in the simulation, doors need to be added or removed dynamically during the simulation when trains are arriving or departing.

Calculation of train door positions

For calculating the train door coordinates, the following rules apply:

  • Distance between train start and door start is calculated along the track walls
  • Distance between door start and door end is calculated as direct connection (see below)

Splitting of the track walls

Case 1: Door on one single wall element

Door on a single wall element.

Case 2: Door on two neighboring wall elements

Door on two neighboring wall elements.

Case 3: Door on more than two wall elements

Door on more than two wall elements.