User Tools

Site Tools


Commuter Train Avoid Deadlock

Userpages - Hermann (hermannk)Commuter Train Avoid Deadlock

Direct jump to the Rocrail-Workspace-Download

Foreword 1:
This documentation was created with this: Status 03/29/2023

Area Details Remarks
Control Rocrail Version 2.1.3088+ (macOS "Ventura" on Apple M2 CPU)
Computers MacBook Pro (M2) macOS 13.2.1 (Ventura)

Foreword 2:
- the use of this solution is at your own risk;
- Regular backups of the Rocrail workspace are recommended.


A commuter service between two stations should run randomly and continuously.
Four locomotives are to run for a total of five station blocks.
In this solution example there are:
- two blocks in the branch station (on the left);
- three blocks in the main station (on the right).

- two blocks are planned between the stations;
- no locomotives should get stuck in the intermediate blocks;
- a change of direction in the intermediate blocks is not permitted.

Likewise, a locomotive should only drive to the neighboring station if a block is free there.

Solution Details

a) Prevent getting stuck

The intermediate blocks "bk03" and "bk04" are combined into a "block group" and are given the attribute "critical section".

This ensures that only one locomotive enters the block group from one side.
For more details see

b) Target must be clear

A locomotive should only start driving if it finds a free block in the destination station.
To do this, "Conditions" are defined for the block group:

- Travel from right to left (ENTER block "bk04"): at least one block in the secondary station must be free; ("bk01" or "bk02")
- Travel from left to right (ENTER block "bk03"): at least one block in the main station must be free; ("bk05", "bk06" or "bk07")
For more details see

c) Rocrail workspace

The download work area "" contains the following files:

file meaning
plan.xml the Rocrail plan file

back to the Solution Details.

d) Outlook

You are welcome to implement your own ideas on the basis of this solution.
Have fun and good luck.

userpages/hermannk/commutertrainavoiddeadlock-en.txt · Last modified: 2023/03/30 07:55 by hermannk