In this example from our exhibition layout, there is a balise at the entrance of a station. If the turnouts are set so that entry to track 2 is possible, it should be linked to its signal.
In the track plan, the two involved turnouts, the signal, and the balise are labeled.
The balise should function as follows:
- Free passage (balise green) when the turnout “PI-Dev-LH5” is set to straight.
- Brake to minimum speed (balise orange) when the turnouts “PI-Dev-LH5” are set to right and “PI-Dev-LH4” to left, and the signal “PI-Dev-SB2r” shows red.
- Slow passage (balise yellow) in all other cases.
It should be clear that the balise needs three triggers, namely one for each of the turnouts “PI-Dev-LH4” and “PI-Dev-LH5”, as well as one for the signal. The triggers are appropriately named to include the name of the activator:
The triggers set the command (“cmd”) of the balise only in the cases where there is no dependency on the state of the other participants. For all other cases, a new function “AB3-fkt” has been added, which decides how the command should be set.
The trigger reacting to the turnout “PI-Dev-LH5” sets the command Free Passage (balise green) when straight (‘s’). When right (‘r’) it calls the function “AB3-fkt”:
The trigger reacting to the turnout “PI-Dev-LH4” sets the command Slow Passage (balise yellow) when straight (‘s’). When left (‘l’) it calls the function “AB3-fkt”:
The trigger reacting to the signal “PI-Dev-SB2r” always calls the function “AB3-fkt”:
The real magic happens in the function “AB3-fkt”. It uses the trick that the state of a trigger is always the value of its activator.
So, if the turnout LH5 is switched to right (‘r’), the CTC-App calls the trigger “AB3-on-LH5” and assigns it the new value of the turnout (‘r’). The state (value) of the trigger is also set to ‘r’. This makes it possible for the function “AB3-fkt” to check the state of the turnouts “PI-Dev-LH4” and “PI-Dev-LH5” as well as the signal “PI-Dev-SB2r” and set the command of the balise accordingly: