TrainControl
Software to conveniently control & fully automate large Marklin CS2/CS3 digital layouts using your computer / keyboard. Designed for users with many trains and accessories where two knobs just aren't enough. Includes an extensive GUI and Java / Python APIs, with full DCC support.
Install / Use
/learn @bob123456678/TrainControlREADME
TrainControl for Marklin Central Station 2 and 3
This powerful, free, cross-platform Java program allows you to use your computer to easily control your entire Marklin / Trix / DCC digital model train layout. It connects to a Central Station 2, 3, or 3 Plus over the network. It is primarily designed for users with a large layout and many locomotives, as the standard Marklin UI makes many common tasks (such as quickly switching between locomotives or triggering functions) overly tedious. Convenient keyboard hotkeys are available for controlling locomotives, switching between locomotives, enabling functions, function presets, smooth deceleration, emergency stop, etc. You can also open windows with interactive track diagrams and edit track diagrams.
As such, TrainControl is designed to be a complete replacement for the CS2/CS3 for operating your layout, with the Central Station serving solely as the track interface and MFX locomotive database. If your existing controller is taking the fun out of running your trains, consider trying TrainControl!
Under the hood, this program implements the Marklin CAN protocol and can therefore also be used to programmatically control the entire layout (see API). Layout and locomotive information is automatically downloaded from the CS2/CS3 (with minor limitations on the CS3). Track diagrams can also be designed entirely in TrainControl.
For easy scripting or interactive control, you can write Python (Jython) scripts to call the TrainControl API.
TrainControl also provides a UI for creating a graph model of your layout, which when paired with S88 sensors, enables tracking train locations for fully autonomous operation at the push of a single button, as well as semi-autonmous point-to-point operation between stations. You can of course also set up traditional/conditional routes to automate switch and signal commands while operating trains manually.
Translations are now available:
- Jetzt auf Deutsch verfügbar
- Nu tilgængelig på dansk
Overview
Main UI
You can assign locomotives to any letter on the keyboard, then quickly switch between them. Easy keyboard shortcuts let you control locomotives. Thumbnails are automatically downloaded from the CS2/CS3 or can be set manually.

Right-click a locomotive or function icon to change it or set additional options, such as preferred speed or function presets.


Multi-units can be configured in TrainControl, which can be simpler than using the Central Station.

Layout View & Layout Editing
Track diagrams for your layout are downloaded automatically from the CS2 / CS3 (Track Boards only), or customizable through locally managed layout files. All components (switches, signals, S88, routes) are clickable and reflect the layout state. Multiple pages can be opened across unlimited popup windows.

From v2.5.0, full cross-platfrom track diagram editing support is available in TrainControl.

Between v2.0.x and v2.4.x, you can also edit local track diagrams via a bundled Windows-only program (TrackDiagramEditor).
<details> <summary>Instructions for Managing and Importing Layouts</summary>Layouts and the CS3
This program was originally written to import and display layouts created/configured from within the CS2, but you can also customize your own layouts without a Central Station.
Because the CS3 uses a different layout format than the CS2, this program does not support displaying native CS3 layouts. However, from CS3 v2.5.0, the CS3 now exports its Track Board layouts using the CS2 file format. Support for such layouts is therefore available from TrainControl v2.2.0+, and they are automatically imported by default. In some cases, you may need to use a double slip switch or a Y-switch from the "manual" menu in the CS3 to get tracks that cross over each other to render correctly. You may also need to change certain straight tracks as the CS3 has a tendency to incorrectly connect tracks in the CS2 format.
If you have an older CS3 or don't want to use the CS3 Track Board layouts, you can import and edit layouts in TrainControl as follows:
- If you have a CS2/CS3 with a layout, import your layout:
- From the Layouts menu in TrainControl, switch to the Central Station layout, then select "Download Central Station Layout".
- Or, import your layout manually:
- Create an empty folder on your PC
- From your CS2/CS3, export
/config/gleisbild.cs2,/config/gleisbilder/*, and optionally/config/magnetartikel.cs2, to the new folder, maintaining the same subdirectory structure starting with theconfigfolder. You can open this location from "Show Current Data Source" in the Layouts menu, or by accessing the Central Station's IP in your web browser. - Start TrainControl, then from the Layouts menu, click on "Open Layout", then select the path to your folder
- The local layout will now be shown in the Layout tab and can be edited if desired
- Otherwise, to create a new layout:
- Start TrainControl, then from the Layout menu, click on "Create New Layout"
- If no Central Station layout is detected and no static layout is manually selected, TrainControl will automatically create an editable demo layout at startup.
Complete editing support is accessible via the "Edit" button within the Layout tab. Pages can be managed from the Layouts menu item. This will let you fully customize your layout.
If you change the local files, clicking on "Sync Database w/ Central Station" from the Locomotives menu will update the layouts. This effectively lets you customize the layout even without a CS2/CS3. Some users might find this easier than inputting data into the Central Station UI.
Some sample files are included in the cs2_sample_layout folder.
As the CS3 has its own web-based UI which can be used as an alternative, native support for CS3 layouts is currently under consideration.
</details>
Routes
Conditional routes can be defined for semi-automatic layout operation, such as setting a switch to guide an incoming train to an unoccupied station track, or triggering an emergency stop. Manual routes can also be defined and activated directly or via the layout tab.
In addition to all Central Station functionality, complex logical expressions are supported.

Keyboard
Useful for testing, individual accessories can be directly controlled via their digital address. The cumulative number of actuations of each accessory is shown as a tooltip.

Full Autonomy
Defined via a special JSON configuration file that can be built using the UI, represent your layout as a graph and enable complete automation of trains using just S88 sensors and an initial list of locomotive locations. TrainControl will automatically keep track of where each train is located at any given time. You can pick destinations for specific trains, or let the system continuously execute random routes. All state is auto-saved on exit.

The graph UI will show you which routes are active, which edges are locked, and where different trains are stationed. This can also help you debug your graph as you build it. While trains are not running, you can right-click any station to reassign a train and view possible routes.
<img src="assets/graphview.png?raw=true" alt="UI screenshot: autonomous graph visualizer" width="500">In addition to the continuous automated operation and point-to-point commands, you can also specify timetables and run your trains according to a predefined list of paths, subject to the constraints and protections of the graph model.
<img src="assets/timetable.png?raw=true" alt="UI screenshot: timetable" width="500">From v2.4.12, autonomy / point-to-point operation can also be controlled directly from track diagrams through specially named labels.
<img src="assets/easyauto.png?raw=true" alt="UI screenshot: easy autonomy" width="500">Statistics
Monitor the usage of different locomotives.

Features
- Easily control locomotives (MM2, MFX, DCC), multi-units, signals/switches (MM2, DCC), and routes
- Download locomotive, layout, and route information from the CS2/CS3
- Customize locomotive icons and function icons without needing to set them in the CS2/CS3
- Powerful keyboard interface
- Configure up to 10 different key mappings for up to 260 locomotives
- Convenient hotkeys for power off, emergency stop, and smooth deceleration
- Simultaneous operation across multiple PCs
- Track diagrams
- View unlimited layout diagrams, with support for multiple windows
- Toggle signals, switches, lights, uncouplers, and routes
- View S88 feedback
- Full UI for editing track diagrams
- Basic automation
- Set up automatic and conditional routes triggered by S88 feedback modules
- Automate bulk tasks such as turning off all functions
- Set function and speed presets for locomotives
- Advanced automation
- Graph model w/ JSON configuration for location tracking and fully autonomous train operation
- Semi-autonomously operate trains simply by clicking the destination station (when graph model is enabled)
- Full UI for editing autonomy graph models
