openSignalBox

The openSignalBox simulator framework.

Introduction

The openSignalBox software is a versatile framework which allows you to set up a signalling simulator in your signalbox, study, shelf, or cloud! From just connecting two block instruments together, to simulating a modern computer-based interlocking, this project provides a competent, flexible base on which to build out a variety of implementations. The system is based around modules which communicate between each other, allowing you to easily upgrade or switch out parts of your setup. Each instance of a “box” (signalbox) will be configured with a set of modules, such as a fastclock, train planning (timetabling), macros (rules), and interface modules for talking to physical equipment. We intend for wizards to be available to help setup modules and provide example designs.

Most boxes will include a web interface module, which hosts a local website and is used to configure the other modules and to operate the simulator. One advantage here is that rather than a large computer monitor to be hidden somewhere in a preserved signalbox, a simple tablet or mobile phone can be used to operate the simulator. Quick access pages can be made with often used functions, to allow failures, delays or extra trains to be added easily, or perhaps covertly whilst the current signaller is unaware!

The web-based nature also gives advantages with the physical interfaces - if you need to interface to equipment around your museum or garden, you can just run a standard network cable (or use existing) and put the interface board local to the equipment. We can write modules to talk to any interface with a known protocol, so openSignalBox can generally be run anywhere existing simulators are already working or have been designed.

Perhaps the most interesting aspect is that we are making sure that openSignalBox will provide ways to connect or chain different signalboxes together. This could be two physical boxes, two virtual browser-based boxes, or of course physical and virtual boxes! Control of the fringe inbetween can be configured for a user to control or delegated to an automatic signaller who makes regulating decisions based on predefined rules.

Below is a list of official modules which the openSignalBox Project will develop. Although we are initially focusing on British signalling, we have plans for other countries such as Germany and Australia. Get in touch to suggest other modules and we’ll use that information to prioritise our work.

Module nameDescription
FastclockControls the simulation state and speed.
Web UIProvides a web-based user interface.
MacroExecutes rules, provides timers, also used as a basic simulator.
Train PlanningTimetables, traction allocations.
Absolute BlockEasy integration with bells and block instruments.
Spatial SoundUses traction allocation and position/acceleration for realistic sound effects.
TRUSTUK railway status system, for VDUs in preserved boxes.
Virtual Lever FrameIn-browser lever frame for virtual boxes.
USB Serial IOSimple interfacing using serial over USB (with Arduino references).
SimulatorComprehensive physics-based simulator, with vector layout entry allowing map tracing.
Relay InterlockingsModules for the simulation of free-wired and geographical route-relay-interlockings.
SSIModules for the simulation of BR solid-state interlockings.
MQTTBridge between MQTT and internal ZeroMQ messaging. Used for JMRI and model railway integration.
Train DescribersSupport for electromechanical and electronic train describer hardware.
TelecomsTelephone concentrator and audio interfaces to virtual and historic telephones. Playback of recordings and AI text-to-speech.
Live Train Describer IntegrationUse of real time data feeds to trigger train entries e.g. for local preserved boxes.
3D VisualisationComputer game engine graphics for CCTV level crossing displays, signalbox windows or augmented reality.
and more later…

Technical Description

The openSignalBox software is a modular microservice framework written in Python with a web frontend and an efficient event-driven core. The backend is written using FastAPI, based on Starlette, and runs on a scalable ASGI server such as uvicorn or hypercorn. Events and async messaging is handled via ZeroMQ and Zyre. The front-end is written with Vue. The software uses modern standard practice and should be easy to modify and extend, by openSignalBox users or contractors. Modules can be written in any language and both the framework configuration and message APIs follow compatibility standards such as OpenAPI. For barebones usage of modules it is possible to import them into a Python program with a core library and no web frontend.

Modules are in the form of Python packages (please forgive the confusing naming), and users are encouraged to write their own modules as required. Ideally, they would then submit them to the openSignalBox Project to be considered as an official module, which will undergo checks and then be hosted on our repository. However, modules can of course be freely installed directly and shared privately between users. It is also possible to write closed-source modules which interact with openSignalBox, whilst preserving IP. Thus it becomes a useful tool for commercial use, where simple boilerplate simulator work can be delegated to openSignalBox to test other code.

A useful feature of the simulation engine is that it uses real layouts internally to calculate movements and allows the user to trace this layout from old/current maps or drawings using a web interface. Signalling equipment like signals and track circuits and virtual locations like platform stopping points can be annotated at this stage.

An online database of layouts, traction formations and other items will be made available to share and contribute to so that users can spend more time adding to the community rather than repeating existing work.