The objective of this tutorial is to explain how to insert and use the SEL operator in a MasterTool X project.
Components
Equipment: 1 computer/notebook.
Software: MasterTool X
Tutorial Sections
- ARCHITECTURE
- DEVELOPMENT
1. ARCHITECTURE
A computer/notebook will be required to use MasterTool X.
Figure 1. Computer running MasterTool X
2. DEVELOPMENT
SEL is a logical operator used to select between two input values based on a Boolean condition.
This operator is frequently used when it is necessary to automatically choose which value will be used in the process, depending on the state of a logical variable.
Functionality
The SEL operator functions as a value selector. It evaluates a Boolean condition and, based on this result, defines which of the two available values will be sent to the output.
Its operation is as follows:
- If the boolean condition is FALSE, the operator returns the value of the IN0 input.
- If the boolean condition is TRUE, the operator returns the value of the IN1 input.
In this way, the operator allows switching between two different values within the program's logic.
How to Insert into Code
To use the SEL operator in the program, it must be inserted directly into the program logic (such as in Ladder, FBD, or CFC) through the toolbox:
- Open the Toolbox
- Go to the Other Operators category
- Locate the SEL operator
- Drag the operator to the programming area
- Connect the boolean variable to input G
- Define the values or variables in inputs IN0 and IN1
- Use the OUT output in the program logic
Figure 2. Inserting the SEL operator into the code
Input Parameters
G (Gate or Condition)
Defines the logical condition that controls the selection of the value.
- Data type: BOOL
- Determines which input will be sent to the output.
IN0
First value available for selection.
- Data type: numeric or compatible with the output
- Will be selected when G = FALSE
IN1
Second value available for selection.
- Data type: same type as IN0
- Will be selected when G = TRUE
Output Parameters
The operator generates a single result:
OUT
- Data type: same type as inputs IN0 and IN1
- Represents the value selected based on condition G
Operation Logic
The operator's behavior can be represented as follows:
- If G = FALSE, then OUT = IN0
- If G = TRUE, then OUT = IN1
This operator functions similarly to a selector or logic switch, directing one of the values to the output.
Figure 3. SEL operator parameterization
Application Example
Consider a system where equipment can operate in automatic or manual mode, using different speeds.
Operator Configuration:
- G = Automatic_Mode
- IN0 = Manual_Speed
- IN1 = Automatic_Speed
Possible Results:
| Automatic Mode | SEL Output | Value in Numbers |
| FALSE | Manual_Speed | 50 |
| TRUE | Automatic_Speed | 100 |
Thus, when the system is in automatic mode, the automatic speed will be used. Otherwise, the system will use the speed defined for manual mode.
Figure 4. SEL Operator Operation
Applications in Automation
The SEL operator is frequently used in situations such as:
- Selection between manual and automatic mode
- Choice between two setpoints
- Switching between two sensors
- Selection of reference values
- Control of process parameters
In summary, the SEL operator allows selection between two values based on a logical condition, being a very useful tool for implementing simple decisions within the control logic in projects developed in MasterTool X.
Comments
0 comments
Please sign in to leave a comment.