Pendel
Basic pendel script
This tutorial describes how to make a basic pendel script letting the locomotive travel from point A to B and back.
Our script will let our vehicle travel from A to B, wait 15 seconds, travel in the reverse direction, wait again 15 minutes and drive in the other direction.
Pointwise we will explain you how to create a pendel script on your layout.
0. Vehicles
Before we can do any automation, please make sure you have vehicles configured we can use in the automation scripts.
1. Layout
It starts with defining your layout. Within the profile screen you can find the layout editor. With the plus sign you can create a schematic overview of your layout.
For this tutorial we are going for a very simple straight track with bumpers on both ends.

Since Model Train Scripts needs to know when a train is either at location A or B we need to define feedback sensors. In this basic scenario we assume we are using basic feedback modules with only occupancy detection and address reporting (so no RailCom).
At A and B we configure a feedback module with the pencil and settings option of the editor. Using the R-Bus For A we select module 1 port 1, and for B we select module 1 port 2.

After the layout has darker track sections indicating a feedback module was configured.

Our layout is now configured, time for some automation!
2. Automation
On the profile screen within the "Automation" section you find the scripts. Start by creating a new script. For this basic tutorial we keep it simple: we give the script a proper name and we enable the "repeat" option since we want a train to continuously pendel between A and B.

Model Train Script by default gives you an example section. We scroll down to the "sections" in the script and open "Section1".
We rename the section to "Pendel" and delete the default wait action.

Now we can define the actual logic of our automation. We start by adding actions for selecting our vehicle, setting the direction of travel and set the speed for the vehicle to move towards B.

Now we want our vehicle to stop at B. Therefore we add a "Wait for condition" action. We make it a feedback condition and select the feedback module of B via the layout.

After our vehicle has been detected at B we want to stop it, wait a couple of seconds and reverse it in the opposite direction.

Our vehicle is now ready to depart back to A. At A we repeat the steps we did at B.

Our automation is ready!
3. Execution
We can start our new "Pendel" script directly from the script editor or from the throttle. Since we enabled repeat for our script it will continuously loop until we stop it manually.

Enjoy your Script!
4. Improvements
To keep this tutorial as simple as possible we left out several options, hereby some suggestions to improve your script.
Use different sections with functional names like "Travel from A to B", "At station B" etc. This will provide better overview of your scripts for future changes.
Use RailCom for detecting the vehicle instead of selecting one in the beginning of your script.
By using vehicle profiles you prevent configuring speed or functions in your scripts on a central place. This will ease future changes to the driving behavior of your vehicle.
Last updated
Was this helpful?