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 into track 2 is possible, it should be coupled with its signal.

In the track plan, the two turnouts involved, the signal, and the balise are labeled.

Track plan

The balise should function as follows:

  • Clear (balise green) when turnout "PI-Dev-LH5" is set to straight.
  • Brake to minimum speed (balise orange) when turnouts "PI-Dev-LH5" is set to right and "PI-Dev-LH4" is set to left, and signal "PI-Dev-SB2r" shows red.
  • Slow speed (balise yellow) in all other cases.

It should be obvious that the balise needs three triggers, one for each of the turnouts "PI-Dev-LH4" and "PI-Dev-LH5", and one for the signal. The triggers should be named meaningfully to include the name of the trigger source:

All triggers

The triggers set the balise command ("cmd") only in cases where there is no dependency on the state of the others. For all other cases, a new function "AB3-fkt" was added to decide how the command should be set.

The trigger reacting to turnout "PI-Dev-LH5" sets clear (balise green) when set to straight ('s'). When set to right ('r'), it calls the function "AB3-fkt":

Trigger LH5

The trigger reacting to turnout "PI-Dev-LH4" sets slow speed (balise yellow) when set to straight ('s'). When set to left ('l'), it calls the function "AB3-fkt":

Trigger LH4

The trigger reacting to signal "PI-Dev-SB2r" always calls the function "AB3-fkt":

Trigger S-B2r

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 source.

So if turnout LH5 is set to right ('r'), the CTC-App calls the trigger "AB3-on-LH5" and passes it the new turnout value ('r'). The state (value) of the trigger is also set to 'r'. This makes it possible for the function "AB3-fkt" to check the states of turnouts "PI-Dev-LH4" and "PI-Dev-LH5" as well as signal "PI-Dev-SB2r" and set the balise command accordingly:

Function AB3-fkt