How to use Different Math Functions using the Siemens TIA Portal – Part 2
- Size of Data Type Used by the Different Math Functions in Siemens TIA Portal
- Various types of Address allocation by Siemens TIA Portal
- Different Math Functions of PLC Ladder Logic used in Siemens TIA Portal
- Declaration of Address for different Math Function
- Working with different Math Functions used in the Siemens TIA Portal
- Simulation screenshots of Different Math Function
MATH FUNCTION’S PART II
In this article, we will see different Math functions used in the Siemens TIA Portal.
The Siemens TIA Portal Math functions blocks are:
S. NO | TYPES OF FUNCTIONS | FUNCTION |
1 | MINMAX | Function finds the minimum or maximum mentioned by the operand based on the data type given in the input. |
2 | LN | Find the Natural Logarithm of a given input |
3 | EXP | Find the Exponential of a given input |
4 | SINCOSTAN | Trigonometrical functions of a given input in radian |
5 | ASINACOSATAN | Inverse Trigonometrical functions of a given input in radian |
6 | FRAC | Find the Fractional part of the given input |
7 | EXPT | Find the Exponential of a two-given input |
Size of Data Type Used by the Different Math Functions in Siemens TIA Portal
Please refer to the PART I Math Functions article for detailed data size used in the Siemens TIA Portal
Various types of Address allocation by Siemens TIA Portal
Please refer to the PART I Math Functions article for various types of memory addressing used in the Siemens TIA Portal
Different Math Functions of PLC Ladder Logic used in Siemens TIA Portal
MINIMUM, MAXIMUM AND LIMIT FUNCTION
NATURAL LOGARITHMIC AND EXPONENTIAL
TRIGONOMETRIC FUNCTIONS
INVERSE TRIGONOMETRIC FUNCTIONS
FRACTION OF GIVEN NUMBER AND EXPONENTIAL TWO NUMBER
Declaration of Address for different Math Function
S. No | Operation | Input/Output Address | Output Address | Data type |
1 | MIN | Output | %MW10 | Int |
2 | MAX | Output | %MW11 | Int |
3 | LIMIT | Output | %MW12 | Int |
Input | %MW14 | Real | ||
4 | LN | Output | %MD2 | Real |
5 | EXP | Output | %MD3 | Real |
6 | SIN | Output | %MD4 | Real |
7 | COS | Output | %MD5 | Real |
8 | TAN | Output | %MD6 | Real |
9 | ASIN | Output | %MD7 | Real |
10 | ACOS | Output | %MD8 | Real |
11 | ATAN | Output | %MD9 | Real |
12 | FRAC | Output | %MD10 | Real |
13 | EXPT | Output | %MD11 | Real, Int |
Working with different Math Functions used in the Siemens TIA Portal
Siemens TIA Portal V16 software is used to develop the PLC program. As stated above, the following Sections explain the various PLC Math blocks.
MINIMUM, MAXIMUM AND LIMIT FUNCTION
MINIMUM
- The MIN function gives the output of the smallestnumber given in the input.
- The number of inputs can be increased by clicking the star button given in the function.
- The result is stored in %MW10. Where %MW is a single word size (16-bit).
MAXIMUM
- The MAX function gives the output of the largest number given in the input.
- The number of inputs can be increased by clicking the star button given in the function.
- The result is stored in %MW11. Where %MW is a single word size (16-bit).
LIMIT
- The LIMIT function is different from the above two functions. It gives the smallest number among the two inputs (MN&MX). When the IN value is lesser than the MN value.
- Similarly, it gives the largest number among the two inputs (MN &MX). When the IN value is greater than or equal to MX values.
- The result is stored in %MW12. Where %MW is a single word size (16-bit). (The input cannot be increased for this Function).
NATURAL LOGARITHMIC AND EXPONENTIAL
NATURAL LOGARITHMIC
- The LN function takes the natural logarithm for the given input.
- The result is stored in %MD2. Where %MD is a Double word size (32-bit). (The input cannot be increased for this Function).
- The data type is declared as Real. (User can change the data type according to the requirement).
EXPONENTIAL
- The EXP functiontakes the exponential power. i.e., ex, where x is the given input.
- The result is stored in %MD3. Where %MD is a Double word size (32-bit). (The input cannot be increased for this function).
- The data type is declared as Real. (User can change the data type according to the requirement).
TRIGONOMETRIC FUNCTIONS
SIN, COS, TAN
- These trigonometric functions write the trigonometric results such as sin, cos, and tan.
- The result is stored in %MD4,%MD5 and %MD6 respectively.Where %MD is a Double word size (32-bit). (The input cannot be increased for this function).
- The Input of all trigonometric functions is radiance. i.e.,we know that sin (300) =0.5, therefore for the sin Function 300 is the input it has to converter into radiance. (π X300/180 = 0.5235988. This will give 0.5 as a result in %MD4.
- The data type is declared as real. (User can change the data type according to the requirement)
INVERSE TRIGONOMETRIC FUNCTIONS
ASIN, ACOS, ATAN
- These Inverse trigonometric functions write the Inverse trigonometric results such as Asin, Acos, and Atan.
- The result is stored in %MD7,%MD8 and %MD9 respectively.Where %MD is a Double word size (32-bit). (The input cannot be increased for this function).
- The Input of all trigonometric functions is radiance. i.e., we know that sin-1(0.5) =0.5235988, 0.5 is given as the input it will write the value as 0.5235988 in %MD7.
- The data type is declared as Real. (User can change the data type according to the requirement)
FRACTION OF GIVEN NUMBER AND EXPONENTIAL TWO NUMBER
FRACTION
- Only the fractional part of the input is displayed in the result.
- The result is stored in %MD10. Where %MD is a Double word size (32-bit). (The input cannot be increased for this Function).
- The data type is declared as Real. (User can change the data type according to the requirement)
EXPONENTIAL
- This exponential function is similar to the above one. But the difference in this function, if xy is the operation x and y input value can be defined by the user. In the previous case only, y is definable.
- The result is stored in %MD11. Where %MD is a Double word size (32-bit). (The input cannot be increased for this Function).
- The data type is declared as real. (User can change the data type according to the requirement)
(NOTE: All the MATH function in this article is declared either with INT or REAL based on the type of the function. But the user can change the data type based on the requirement and usage)
The following is the procedure you can follow to program ladder logic on the SIEMENS TIA portal. (Simulation).
Note: For a detailed explanation of how to use the Siemens TIA Portal to program ladder logic, please refer to the page mentioned above.
Our dedicated team extensively tested the simulation functions outlined in this content using Siemens TIA Portal V16 software. This comprehensive guide offers practical insights into PLC programming, addressing, and automation techniques, ensuring a thorough understanding of various math functions in the Siemens TIA Portal environment.
Simulation screenshots of Different Math Function
(Note: For all the math blocks, values(variable) are given for understanding. Users can change the memory address in place of value such as %MW, or %MD. So, that the input can be changed during run time)
MINIMUM, MAXIMUM AND LIMIT FUNCTION
MINIMUM
- The MIN blocks display the smallest value of input to the output.
- The user can increase the number of inputs by clicking the star button.
- The output is stored in the address %MW10. Where %MW is a single word size (16-bit).
MAXIMUM
- The MAX blocks display the largest value of input to the output.
- The user can increase the number of inputs by clicking the star button.
- The output is stored in the address %MW11. Where %MW is a single word size (16-bit).
LIMIT
- The LIMIT blocks display the output of either MN or MX value.
- The LIMIT block has another input named IN. The IN input decides which value has to be displayed on the output.
- If the IN value, is lesser than MX. The output of LIMIT %MW12 displays the MN value.
- Similarly, if the IN value is greater than or equal to the MX value. The output of LIMIT %MW12 displays the MX value.
NATURAL LOGARITHMIC AND EXPONENTIAL
NATURAL LOGARITHMIC
- The LN block displays the natural Logarithm of input.
- The output %MD2 gives the value of the Natural logarithm.
- The user cannot be able to increase the number of inputs.
- The output is stored in the address %MD2. Where %MDis a double word size (32-bit).
EXPONENTIAL
- The EXP block gives output with exponential of input (i.e., ex, where x is the input).
- The user cannot able to increase the number of inputs
- The output is stored in the address %MW16. Where %MW is a single word size (16-bit).
TRIGONOMETRIC FUNCTIONS
- This block gives trigonometric output for the corresponding trigonometric function.
- The input for the trigonometry function is radiance.
- The result is obtained at %MD4, %MD5, and %MD6 respectively (for each inverse trigonometry function).Where%MDis a double word size (32-bit).
- The user cannot able to increase the number of inputs.
- Similarly, for the remaining trigonometric functions.
INVERSETRIGONOMETRIC FUNCTION
- This block gives Inverse trigonometric output for the corresponding trigonometric function.
- The input for the Inverse trigonometry function is radiance.
- The result is obtained at %MD7, %MD8, and %MD9 respectively (for each inverse trigonometry function).Where %MD is a double word size (32-bit).
- The user cannot able to increase the number of inputs.
- Similarly, for the remaining Inverse trigonometric functions.
FRACTION OF GIVEN NUMBER AND EXPONENTIAL TWO NUMBER
FRACTION
- The FRAC block gives the fractional part of the given fractional input.
- The input data will be floating point variables. The output %MD10isvalue after the decimal point.
- The user cannot able to increase the number of inputs.
EXPONENTIAL
- The EXPT block gives the exponential of the two inputs. IN1 is the variable 1 and IN2 is the power of the variable.
- The exponential result is obtained at %MD11. Where %MDis a double word size (32-bit).
- The user cannot able to increase the number of inputs.
By doing the above exercise the user can understand the math function (Mentioned above) used in the Siemens TIA Portal