A module is a special ConditionalNG which is invoked from regular ConditionalNGs or other Modules. In programing terms it is a sub-routine, method, def, etc. It can use zero or more inputs and return zero or more outputs. It does not respond to expression changes.
A common use would be to return the state of a set of expressions that can be called by various ConditionalNGs rather than listing each expressions in each ConditionalNG. Another exmaple is setting a common group of actions.
When combined with tables, a module could be passed the name of a table row. It would then perform the actions based on the table row data.
The Module Table provides the details on creating a module.
This is a digital expression socket. It can have inputs and outputs as well as returning true or false based on the current state of the expression list.
This is a digital action socket. This can be used to create an action only module or complex modules with any combination of expressions and actions, such as if then else structures. These can have inputs and outputs.
The input and outputs are defined by doing a right click and edit on the first line of the tree. In the module, the inputs and outputs are defined as local variables.
Click on the Add parameters button. Enter a name and select whether it is for input, output or both. The Select option is used to delete the row or move it up or down.
The first row is updated to show the inputs and outputs.
Expression modules are called from ConditionalNG expressions and return true or false.
Use the Call module type in the Flow Control category.
After clicking Create, the Module detail window will open. Select the module from the list. It only shows expresson modules. Click OK to add to the tree.
If there are parameters that need configuration, edit the newly added row and the parameter list will be displayed. If necessary, configure the input and return variables as described in the next section.
Use the Call module type in the Flow Control category.
After clicking Create, the Module detail window will open. Select the module from the list. It only shows action modules. Click OK to add to the tree.
If there are parameters that need configuration, edit the newly added row and the parameter list will be displayed. If necessary, configure the input variables
When Edit is selected on the row, the parameters window will open.
For Input types there are a variety of sources. They range from literals to various type of references. The Input data field has the literal value or the reference name.
For Output types there are two choices. The Output data field contains the name of the choice.
The selections in this example are local variables.
The resulting ConditionalNG with the local variables and a comment on the module call.
Thanks and congratulations to all who contributed! Contact us via the JMRI users Groups.io group.
Copyright © 1997 - 2024 JMRI Community. JMRI®, DecoderPro®, PanelPro™, DispatcherPro™, OperationsPro™, SignalPro™, SoundPro™, TrainPro™, Logix™, LogixNG™ and associated logos are our trademarks. Additional information on copyright, trademarks and licenses is linked here.
View the