JMRI: Signal Mast Logic introduction
Author: Bob Jacobsen, Egbert Broerse

# JMRI: Signal Mast Logic

## Introduction to SML

JMRI Signal Mast Logic (in short: SML) allows you to build up a set of criteria for a Signal Mast as to what Aspect it should be displaying for a specific route through to a destination Signal Mast.

Each Signal Mast Logic is built from a source and destination Signal Mast pair, along with a series of Blocks, Turnouts and Sensors between the two Signal Masts and the state that they must be in for the source Signal Mast to be released from a "Danger" or "Stop" Aspect.

### Example 1

In this first example, you have a source Signal Mast SM20, and two destination Signal Masts: SM22 and SM23.
The logic behind signaling pair SM20 to SM23 is that Blocks 2 & 3 must be unoccupied, and Turnout IT1 must be set to "Closed". Once those criteria are met Signal Mast SM20 will be released from "Danger" to "Caution", if Signal Mast SM23 was set to "Caution" then SM20 would be set to "Proceed" and show a Green Aspect. As soon as Block 2 or 3 becomes Active or Turnout 1 is set to Thrown, the Signal Mast SM20 is set back to "Danger".

Each Signal Mast pair must be directly reachable from the other, without any other other Signal Mast in-between in the same direction.

### Example 2

In this second example, a Signal Mast Logic from SM20 to SM24 would be invalid as SM23 is in between the two. You would have to create two separate Signal Mast Logics, one as in example 1 for SM20 to SM23, the second for SM23 to SM24.

Which Aspect our source Signal Mast displays after being released from "Danger" is firstly determined by the Aspect mapping that has been defined in the Signal Mast Appearance definition file. If there is only one Aspect that could be displayed, then the Signal Mast will be set to that Aspect.
However if multiple Aspects could potentially be displayed then the logic looks at two areas to determine the resulting Aspect to be displayed:

- Diverging route
  - If there are Aspects for a Diverging route and any of the Turnouts on the path are set to Thrown then it will use the Aspect for a Diverging route.
  - If none of the Turnouts on the route are set to Thrown, then the Aspect that is not designated as a Diverging aspect will be used.
- Block/Signal Speed
  - If the Diverging route is not available on the signal Aspects, or it does not return a single potential Aspect, then the speed of the Block and speed rating of the Aspect are used.
    Each Aspect and Block can be configured with a Speed value. The Signal Mast Logic will take the lowest Speed defined on the Blocks in the route and choose the Aspect with the highest Speed which is under the routes lowest speed. I.e. if the routes lowest Speed is 65 mph, then it will choose the Aspect that has a speed equal or less than 65 mph.

In addition to being able to specify the Turnouts, Blocks and Sensors that make up a Signal Mast Logic, you can also specify which other Signal Masts must be set to a specific Aspect before the source Signal Mast can be released. In general, there should be no need to add extra Signal Masts in the Signal Mast Logic as the route between all the different source mast to destination mast Logis pair should have unique criteria. However there are certain situation such as where two tracks crossover on the same level where a conflicting route could be set. Therefore to get around this, the Signal Mast or Masts that are protecting the crossover should be part of each others criteria.

## Manual and Auto Generated Logic Information

The Signal Mast Logic window holds two areas showing Block and Turnout information: the first is user generated, the second is where a tool such as used with the Layout Editor (see below) has automatically built up a set of Blocks or Turnouts from the panel layout as signaling criteria.

Both sets of information are used by JMRI to determine if a Signal Mast can be released or not, however the manually created information has a higher priority over the automatically generated information thus allowing the user to over-ride what the system has determined.

The automatically generated information is not saved with the rest of the panel information, but the manually generated user information is. If the Layout Editor is being used to base the Signal Mast Logic on (see below) then JMRI will rediscover this information from the panel each time it is loaded, and if any changes have been saved in the meantime they will be discovered. Please note, that this re-generation of information is not done on the "fly" when a Layout Editor panel is changed and saved without exiting JMRI.

## Using the Layout Editor for Signal Mast Logic

By using the Layout Block Editor, it is possible to have the Signal Mast Logic determine the signaling pairs, along with the Blocks and Turnouts that make up the criteria. This can be done across all the Signal Masts on the Layout Editor or on a source Signal Mast basis.

It has the advantage that if the Layout Editor panel is changed, JMRI will discover this change when the panel is reloaded and use the new Block and Turnout information. Please be aware that the re-discover at load process will not discover any new Signal Logic pairs or remove invalid Signal Logic pairs, it will simply update the information between existing pairs.

### Placing Signal Masts

Signal Masts can be placed at Turnouts, anchor points and level crossings, but only where there is a boundary between two different layout blocks.

To add a Signal Mast using a Layout Editor Panel, right click on the Turnout, level crossing or anchor point and if a block boundary exists you will be given the option to "Set Signal Mast..."

### Example 3

You will then be presented with a fresh window that allows you to enter in the name of the Signal Mast that will protect a boundary between two blocks.
For turnouts and crossings, you can only add a Signal Mast for the boundary going into the turnout or crossing, it is not possible to add a Signal Mast for the boundary going out from the turnout or crossing. E.g. if block A is the section of track attached to the Turnout and the Turnout is in block B, you can only add a Signal Mast that faces into block A that protects block B; you can not add a Signal Mast that faces into block B to protect block A.

Using the Panel Editor and not having defined Blocks, the Signal Mast Logic can't be automatically discovered as this type of Panel only displays individual icons over a layout graphic so you have to manually add the connections as Blocks using the Blocks Tool or add Signal Logic Pairs in the Signal Logic Table for every possible connection.
Manually add Signal Icons to your panel by right-clicking and choosing "Add icon".

## Create Signal Mast Logic

Signal Mast Logic can automatically be generated in three different ways:

- The first method is to build it on a Signal Mast by Signal Mast basis. This can be done by selecting "Signal Mast Logic" from the pop up menu for the Signal Mast icon on the panel. After click on the "Discover" button, the system will go and find all potential destination Signal Masts that are valid from the selected Signal Mast.
- The second method is from the Tools > Auto generate Signaling Pairs menu in the Signal Mast Logic Table. This will generate Signal Mast Logic based upon all the Signal Masts on the Layout Editor panel. If not yet active, it will give you the option to activate Layout Block Routing.
  Please be aware that on large layouts with a large number of signal masts configured, this can take some time.
- It is even easier if you use hardware like RR-Circuits Signalman, and the easiest using pre-configured Signalist SC1 that support the NMRA signal aspect commands. You can skip the Signal Head and Layout Editor steps and go right to creating the Signal Mast as a single entry and the hardware handles all of the LED/lamp lighting, etc.

You manually add new Signal Mast Logic pairs by clicking either

- the "Add..." button at the bottom of the Signal Mast Logic table or
- the "Add Logic" button at the bottom of the Signal Mast Logic Pairs pane.

Both will take you to the "Add Edit Signal Mast Logic" pane.

### Changing Signal Mast Logic

Configuration of an existing Signal Mast Logic can be accessed from three different locations:

- In the Signal Mast Logic Table there is an Edit button for each Signal Mast Logic pair.
- In the Signal Mast Table, there is an "Edit Logic" button for each Signal Mast, which opens a pane from which you can select one of the Signalling Pairs set for this source Signal Mast.
- In the pop-up menu that appears when you right-click on a Signal Mast Icon on a Layout Editor Panel, using the Signal Mast Logic menu item.

## Logic to Un-Signaled Areas or Buffer Stops

The Signal Mast Logic works only between a source and destination Signal Mast, so if you have a valid route to an End Bumper/Buffer Stop/Dark Area, then there is no specific destination Signal Mast. In this situation you would create a "dummy" Signal Mast of type Virtual in the Signal Mast Table to act as your destination Signal Mast. It doesn't have to represent a signal on the layout or have Signal Heads associated. All that this Virtual Signal Mast has to do is display a "Danger" aspect.

Back to the Signaling main help page.