The objective of this tutorial is to explain how to insert and use the limit 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
LIMIT is an operator used to limit a value within a minimum and maximum range defined by the programmer.
It is widely used in automation applications to ensure that certain values do not exceed safe operating limits, preventing unwanted behavior in the process.
Functionality
The LIMIT operator compares an input value with two defined limits: minimum (MIN) and maximum (MAX).
Its operation is as follows:
- If the input value is less than the minimum limit, the result will be equal to the minimum value.
- If the input value is within the range, the result will be the input value itself.
- If the input value is greater than the maximum limit, the result will be equal to the maximum value.
Thus, the operator ensures that the final value always remains within the established range.
How to insert it in the code
To use the LIMIT operator in the program, it must be inserted as an operator within the program logic (for example in Ladder, FBD or CFC) from the toolbox:
- Open the Toolbox
- Go to the Other Operators category
- Select the LIMIT operator
- Drag the operator to the programming area
- Connect the variables or constants to the MIN, IN and MAX inputs
- Use the resulting output in the program logic
Figure 2. Inserting the LIMIT operator in the code
Input Parameters
MIN
Defines the minimum allowed value for the variable.
- Data type: numeric (INT, DINT, REAL, etc.)
- Represents the lower limit of the range.
IN
This is the value that will be evaluated by the operator.
- Data type: numeric
- Can be a variable, a calculation result, or a value from sensors.
MAX
Defines the maximum allowed value.
- Data type: numeric
- Represents the upper limit of the range.
Output Parameters
The operator returns a single result:
LIMIT Result
- Data type: same type as the inputs
- Will always be within the defined range between MIN and MAX
Operating Logic
The behavior can be represented as follows:
- If IN < MIN, then the result will be MIN
- If IN > MAX, then the result will be MAX
- If MIN ≤ IN ≤ MAX, then the result will be IN
Figure 3. LIMIT operator parameterization
Application Example
Consider a system where the speed of a motor must operate between 100 and 1500 rpm.
Operator configuration:
- MIN = 500
- IN = Calculated_Speed
- MAX = 1500
Possible results:
| Calculated Speed | LIMIT Output |
| 50 | 500 |
| 900 | 900 |
| 1800 | 1500 |
Even if the calculated value exceeds the established limits, the LIMIT operator ensures that the output remains within the defined range.
Figure 4. Operation of the LIMIT operator
Applications in Automation
The LIMIT operator is frequently used in:
- Motor speed limitation
- Temperature control
- Pressure restriction in processes
- Actuator protection
- Analog signal processing
In summary, the LIMIT operator is an important tool for controlling and protecting numerical values within safe limits, being widely used in automation projects developed in MasterTool X.
Comments
0 comments
Please sign in to leave a comment.