Debugging

When using event-based scripts it can become difficult to keep track of what triggers what. Debug mode lets you test your automation scripts by simulating feedback events — without needing your physical layout.

Enabling

In the automate tab of the throttle you can enable debug mode. When activated, Model Train Script disconnects from your command station and switches to a built-in simulator. This means you can safely test scripts without affecting your real layout.

While debug mode is active, the track power button in the top-right corner is replaced by an ant icon. Tap the ant to exit debug mode and reconnect to your command station.

Simulating feedback

The key feature of debug mode is the ability to simulate feedback sensor events. In the layout tab, tap any track element that has a feedback sensor configured. A dialog appears where you can:

  • Toggle the sensor state — Mark the sensor as active (occupied) or inactive (free).

  • Set an occupancy address — For sensors on feedback buses that support RailCom (LocoNet, CAN), you can also specify which locomotive address is occupying the sensor.

These simulated events are processed by the automation engine exactly like real feedback from your command station. This allows you to test whether your scripts respond correctly to specific sensor states — for example, simulating a train entering a block section to verify that a signal changes or another train slows down.

Accessories (turnouts, signals) can also be toggled as usual, so you can fully simulate a running layout.

Recording

Sometimes you need a specific sequence of interactions to test your automation — for example, multiple trains arriving at different sensors in a particular order. To avoid repeating the same steps manually, you can record your interactions using the record button at the top of the screen.

Once a recording is completed, it can be played back with the original timing preserved. This is especially useful for testing scripts that depend on a precise sequence of events. Currently one recording at a time is supported, and recordings are not stored between sessions.

Last updated