LogixNG Reference - Chapter 4
Actions and Expressions
LogixNG has four basic building blocks: Actions, Expressions, Male sockets and Female sockets.
Actions do something, for example throw a turnout or sets a signal mast. Expressions ask something, for example if a sensor is active or if a signal head has a particular appearance. The actions and expressions form a tree and complex logic can be built with them.
Each action/expression is embedded in one or several male sockets. Male sockets allow actions/expressions to be connected to a female socket of the correct type.
A ConditionalNG has a female socket that is the root of the ConditionalNG tree. And some actions/expressions have one or several female sockets as children. There are several different types of female sockets and the female socket type decides which types of actions or expressions can be connected.
Categories
Since there is a large number of actions and expressions, they are assigned a category. The main categories are Item, Common and Flow Control.
- Item - Actions and expressions related to items on the layout, for example turnouts and signal masts.
- Common - Important actions and expressions that are not in the Item category, such as Many, And, Or, and Not.
- Flow Control - Program logic actions and expressions, such as If Then Else and Call Module.
- Display - Actions and expressions related to Panels.
- LocoNet - Actions and expressions related to LocoNet.
- Other - Other actions and expressions.
Action and Expression types
Each action and expression is built for a specific socket type.
| Symbol | Type | Description | Categories |
|---|---|---|---|
| ! | Digital action | Execute, no parameter | Item, Common, Flow Control, Other, Display, LocoNet |
| !b | Digital boolean action | Execute using a boolean parameter | Common |
| !~ | Analog action | Execute using a double parameter | Item, Common |
| !s | String action | Execute using a string parameter | Item, Common |
| ? | Digital expression | Return boolean | Item, Common, Flow Control, Other, LocoNet |
| ?~ | Analog expression | Return a double | Item, Common |
| ?s | String expression | Return a string | Item, Common |
| ?* | Generic expression | Return an Object | (Digital, Analog, and String merged) |
Notes:
- string is text, such as "hello world"
- boolean is true or false
- double is a number, such as 42 or 3.14
- Generic expression can handle any expression type
Adding an action or expression
When Add is selected from the context menu for an empty socket, the category and type sub-menus are displayed.
The first sub-menu list contains the Category names. The second level contains the available Type names for the selected category. For example, Digital Action socket using the Item category is quite long while Analog Action socket using the Common category is short. The Type list always displays the valid selections for the socket type and category.
There are many combinations of socket types, categories. These are described in Chapter 5 - Actions and Chapter 6 - Expressions.
