Block signal in ABS territory.
Variables:
red_light: output variable for the Red LED of the searchlight signal.
green_light: output variable for the Green LED of the searchlight signal.
next_block: the block occupancy detector of the block ahead of us.
next_signal_track_circuit_in: connect this to the track_circuit_out variable of the signal ahead of us.
Track circuit: This variable should be
Inactive if the next signal shows a Stop aspect.
Active if the next signal shows any permissive aspect.
exported bool red_light;
exported bool green_light;
exported bool next_block;
exported bool next_signal_track_circuit_in;
exported bool track_circuit_out;
if (next_block is Active) {
red_light = On;
green_light = Off;
track_circuit_out = Off;
} else if (next_signal_track_circuit_in is Inactive) {
red_light = On;
green_light = On;
track_circuit_out = On;
} else {
red_light = Off;
green_light = On;
track_circuit_out = On;
}
This logic is for an ABS block signal that is facing a turnout or a grade crossing.
Variables:
The same variables as in the ABS main signal, plus
turnout_against_me: set this to "Thrown" if the turnout is in a state that you are not permitted to pass (e.g. arriving on main route and turnout set to diverging).
exported bool red_light;
exported bool green_light;
exported bool next_block;
exported bool turnout_against_me;
exported bool next_signal_track_circuit_in;
exported bool track_circuit_out;
if ((next_block is Active) or (turnout_against_me is true)) {
red_light = On;
green_light = Off;
track_circuit_out = Off;
} else if (next_signal_track_circuit_in is inactive) {
red_light = On;
green_light = On;
track_circuit_out = On;
} else {
red_light = Off;
green_light = On;
track_circuit_out = On;
}
This logic is for an automatically controlled (ABS) double-headed signal that is at the points of a turnout. There is main head showing ABS aspect for the closed route, and the diverging head showing ABS aspect for the diverging route. This signal can be used for a branchline turnout or at the entrance to a siding.
Variables:
Two sets of variables for the ABS main signal (main route and diverging route).
turnout: Thrown for the diverging route, Closed for the main route.
exported bool main_red;
exported bool main_green;
exported bool main_next_block;
exported bool main_track_circuit_in;
exported bool diverging_red;
exported bool diverging_green;
exported bool diverging_next_block;
exported bool diverging_track_circuit_in;
exported bool turnout;
exported bool track_circuit_out;
bool permissive = false;
if ((main_next_block is Active) or (turnout is Thrown)) {
main_red = On;
main_green = Off;
} else if (main_track_circuit_in is Inactive) {
main_red = On;
main_green = On;
permissive = true;
} else {
main_red = Off;
main_green = On;
permissive = true;
}
if ((diverging_next_block is Active) or (turnout is Closed)) {
diverging_red = On;
diverging_green = Off;
} else if (diverging_track_circuit_in is Inactive) {
diverging_red = On;
diverging_green = On;
permissive = true;
} else {
diverging_red = Off;
diverging_green = On;
permissive = true;
}
track_circuit_out = permissive;