The purpose of this tutorial is to explain how to insert and use the LIN_TRAFO functional block in a MasterTool X project.
Components
Equipment: 1 computer/laptop.
Software: MasterTool X
Tutorial Sections
- ARCHITECTURE
- DEVELOPMENT
1. ARCHITECTURE
A computer/laptop will be required to use MasterTool X.
Figure 1. Computer running MasterTool X
2. DEVELOPMENT
The LIN_TRAFO block is used to perform a linear transformation of values, that is, it converts an input value from a certain range to another proportional range.
This type of block is widely used when working with analog signals, such as:
- Sensor scaling
- Conversion of input values (e.g., 0–10V, 4–20mA)
- Adjustment of operating ranges
Prerequisite
Just like the BLINK block, the LIN_TRAFO is only available in the Util library.
Therefore, to use it, the library must be previously added to the project via the Library Manager.
Operation
The block applies a linear transformation based on the relationship between the ranges:
If the input value is within the defined range, it will be converted proportionally to the output range.
Inserting the block into the logic
The LIN_TRAFO block does not appear directly in the toolbox, so it must be inserted manually.
To do this:
- Create a new network in the logic
- Insert a generic box (empty box with EN/ENO)
- From the toolbox (General)
- Or by right-clicking on the network
- Inside the box, type the block name:
LIN_TRAFO
After that, the system will automatically recognize the block.
Figure 2. Adding the Lin_Trafo Functional Block
Input Parameters
IN
- Input value to be converted
IN_MIN
- Minimum value of the input range
IN_MAX
- Maximum value of the input range
OUT_MIN
- Minimum value of the output range
OUT_MAX
- Maximum value of the output range
Output
OUT
- Value converted proportionally to the new range
Application example
Consider an analog sensor that operates from 0 to 27648 (raw PLC value) and you want to convert it to 0 to 100%.
Configuration:
Value_Analogico :REAL; //IN
Value_min_IN: REAL := 0; //IN_MIN
Value_max_IN: REAL := 27648; //IN_MAX
Value_min_OUT: REAL := 0; //OUT_MIN
Value_max_OUT: REAL := 100; //OUT_MAX
Result:
- If IN = 13824, then OUT ≈ 50
- If IN = 27648, then OUT = 100
Figure 3. Parameterization of the Lin_Trafo block
Applications in automation
The LIN_TRAFO block is widely used in:
- Scaling of analog signals
- Conversion of sensor values
- Adjustment of operating ranges
- Interface with HMIs and SCADA systems
- Signal normalization
Important note
- The block will only be available if the Util library is added
- All parameters must be consistent with the range used
- Avoid incorrect values to prevent unexpected results
In summary, the LIN_TRAFO block is essential for working with signal conversion and scaling, allowing you to adapt values from one range to another simply and efficiently within MasterTool IEC XE.
Figure 4. Operation of the Lin_Trafo block
Comments
0 comments
Please sign in to leave a comment.