Dispatcher System

The Dispatcher System is a set of Python tools to extend the capabilities of the Dispatcher.


This is an automated system designed to enable you to run trains using the Dispatcher system between locations (normally sidings or stations, but really any set of blocks) designated by yourself.

Provided you have set up a system as described in System Requirements, by pressing a few buttons on theSystem Generation Panel, a complete system will be set up for you complete with Transits, Train Info files, and buttons for you to press which will route trains across your layout.

A network will be set up behind the scenes which will find the best route from the train's location to the required location, and set in place a set of transits which will guide the train to the required location.

The train will either stop at all stations on the route, or travel without stopping at intermediate stops, depending on whether express or stopping mode is selected

Provision is made for multiple train operation, the trains stopping for each other. This is a feature of Dispatcher, but the system allows easy selecting of each train to control each one.

Unfortunately there is a fault somewhere either in the program or dispatcher and two trains cannot work at once. The first train stops when the second starts.

Steps in setting up the system

There are several stages to set up the system for automatic train running:

Fulfill the prerequisites, which include having speed profiled your locos that you wish to run with the system

System Requirements

To use the Dispatcher System there are several prerequisites

Running Stage1 — Editing the panel

Run DispatcherSystem.py in the main jython directory. You will get something like this:

You are prompted to run Stage1 which adds all the icons required to run the system on a new panel.

if the old panel name was WR.xml, the new panel will be WR_icons.xml

Some checks are done first

The following checks are made

If no trains are present in the roster with speed profiles, this will be picked up, and can be corrected at run time.

When the icons file is produced, a message similar to the following will be produced:

A new panel has been created. You should close down and load the new panel, instead of the original.


The panel will have been created by loading the original xml file (in this case WR.ml), editing the details and saving to a new file (WR_icons.xml).

If there were any unsaved edits in the original file these will not be present in the new file, but you will not loose them provided you save them either to the original file or another file once Stage1 has completed. We advise saving all edits before running Stage1, so they are picked up.

Running Stage2 Producing the transits

PanelPro should be restarted and the icons file produced in stage 1 should be loaded.

A screen similar to the following will be produced:

Once the Stage2 button is pressed one gets a confirmatory messages:

Transits required to move the train from stop to stop will be produced, and corresponding train-info files which contain the information required for running the train are produced. Some of the information is overwritten when the train-info files are used such as the train name, so train info files do not have to be produced for each train.

Train-info files are produced for each route allowed, and all routes are allowed which are physically possible to travel. Train-info files are produced for forward and reverse operation, so there can be quite a number produced.

Once the transits and train-info files are produced we get a message:

You should then restart JMRI and load the run panel instead of the icons panel, in this example WR_run.xml

Running Stage3 Final Checks

Restart JMRI and load the newly produced run panel, in our example WR_run.xml

Run dispatcher System again to get

Click Stage3 and one gets two screens opening,the Dispatcher options screen and another saying the options that need to be set for the Dispatcher system to work

Set the required option and we get a message reminding you to save the changed options

Select the dispatcher window that has opened automatically and click Options => Save Options

Running the Program

To run the system it is advised to have the thread monitor running (Panels => Thread Monitor)

You will notice several buttons in the top RH corner.

The first two start and end the four threads required for the program to run. The threads need to be in operation for the other buttons to work.

If one inadvertently presses the run button twice eight threads will be produced. It is best to start again. Clicking the stop Dispatcher System will close four of them, but the other will need to be closed from the Thread monitor.

Choosing the Direction

Register a Train

The first step is to register a train in a siding or at a stop. Drive a train to the required stop, and press Setup Train in Siding.

We need to tell the system which way the train is pointing.

  • At a siding it's easy there is one direction the train can go, and we say which way it is facing out of the siding
  • At another stop we have to indicate which way we are talking about and we highlight one direction

suppose we have the following layout

Choosing the Train

We click SetupTrain in siding

If the train is siding 1b as indicated one gets the following message

Where if we click the dropdown we get all the trains in the system with a speed profile. We choose the required train and click OK

Register the Direction the train is facing

The following message then pops up

Select the correct direction and click OK.

The train will appear in the memory location for the block

Set up a dispatch

To set up a dispatch a train (or several trains bust be registered with the system, and located in a stop).

Clicking a red button will allow a dispatch to be set up to that location.

Suppose one has the following layout with a train in siding1. Click the Passing Loop button as indicated to set up a dispatch to Passing Loop.

There is an express icon. If set the train type will default to express (moves without stopping at intermediate stations), If unset, will default to stopping as shown.

Select the required train from the drop down, and a dispatch will be set up to the next stop (Siding1A).

The train will start moving, and the speed indicated in the Auto trains window.

The train will move to Siding1B, stop and the dispatch will terminate, another dispatch will start up to the next stop which will be to passing loop.

Editing the Signal Logic

Automatic Signal Logic is not perfect. It works well when there is one turnout per section, but when there are more it may get one or more routes in a section wrong.

This can be overcome by editing the signal logic. You can see whether the logic is wrong either by attempting to run a train over the route, or by setting the turnouts along the route and seeing whether the signals are green

In the set route from goods siding and back one can see that the automatic signal logic failed.


Right click on the signal mast and bring up the signal mast logic editor.for one of the routes (Board2toPT11) we get when we press the edit button:

You can see that for this route Board2toPT11 (the route from the bottom to top) only 2 turnouts instead of 4 are shown, and also one of the aspects is closed instead of thrown. The Dispatch will not work.

Note that the essential thing to note is that all the turnouts used in the route should be present in the signal logic, and that they should have the correct aspect. If that isn't the case we should delete and replace.

Delete the route, Press Add Signal Logic. And add a new route.

Ensure Use Layout Paths, Use Turnout Details from Layout Editor and Use Block Details from Layout Editor are ticked (this will ensure that the transits already produced will not get broken, and set up the transit. Save the panel and restart.

Dispatcher should now run along the route.