# How to use Different Math Functions using the Siemens TIA Portal – Part 2

In this article, we will see different Math functions used in the Siemens TIA Portal.

The Siemens TIA Portal Math functions blocks are:

Please refer to the PART I Math Functions article for detailed data size used in the Siemens TIA Portal

Please refer to the PART I Math Functions article for various types of memory addressing 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.

1. The MIN function gives the output of the smallestnumber given in the input.
2. The number of inputs can be increased by clicking the star button given in the function.
3. The result is stored in %MW10. Where %MW is a single word size (16-bit).
1. The MAX function gives the output of the largest number given in the input.
2. The number of inputs can be increased by clicking the star button given in the function.
3. The result is stored in %MW11. Where %MW is a single word size (16-bit).
1. 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.
2. Similarly, it gives the largest number among the two inputs (MN &MX). When the IN value is greater than or equal to MX values.
3. The result is stored in %MW12. Where %MW is a single word size (16-bit). (The input cannot be increased for this Function).
1. The LN function takes the natural logarithm for the given input.
2. The result is stored in %MD2. Where %MD is a Double word size (32-bit). (The input cannot be increased for this Function).
3. The data type is declared as Real. (User can change the data type according to the requirement).
1. The EXP functiontakes the exponential power. i.e., ex, where x is the given input.
2. The result is stored in %MD3. Where %MD is a Double word size (32-bit). (The input cannot be increased for this function).
3. The data type is declared as Real. (User can change the data type according to the requirement).
1. These trigonometric functions write the trigonometric results such as sin, cos, and tan.
2. 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).
3. 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.
4. The data type is declared as real. (User can change the data type according to the requirement)
1. These Inverse trigonometric functions write the Inverse trigonometric results such as Asin, Acos, and Atan.
2. 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).
3. 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.
4. The data type is declared as Real. (User can change the data type according to the requirement)
1. Only the fractional part of the input is displayed in the result.
2. The result is stored in %MD10. Where %MD is a Double word size (32-bit). (The input cannot be increased for this Function).
3. The data type is declared as Real. (User can change the data type according to the requirement)
1. 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.
2. The result is stored in %MD11. Where %MD is a Double word size (32-bit). (The input cannot be increased for this Function).
3. 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.

(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)

1. The MIN blocks display the smallest value of input to the output.
2. The user can increase the number of inputs by clicking the star button.
3. The output is stored in the address %MW10. Where %MW is a single word size (16-bit).
1. The MAX blocks display the largest value of input to the output.
2. The user can increase the number of inputs by clicking the star button.
3. The output is stored in the address %MW11. Where %MW is a single word size (16-bit).
1. The LIMIT blocks display the output of either MN or MX value.
2. The LIMIT block has another input named IN. The IN input decides which value has to be displayed on the output.
3. If the IN value, is lesser than MX. The output of LIMIT %MW12 displays the MN value.
4. Similarly, if the IN value is greater than or equal to the MX value. The output of LIMIT %MW12 displays the MX value.
1. The LN block displays the natural Logarithm of input.
2. The output %MD2 gives the value of the Natural logarithm.
3. The user cannot be able to increase the number of inputs.
4. The output is stored in the address %MD2. Where %MDis a double word size (32-bit).
1. The EXP block gives output with exponential of input (i.e., ex, where x is the input).
2. The user cannot able to increase the number of inputs
3. The output is stored in the address %MW16. Where %MW is a single word size (16-bit).
1. This block gives trigonometric output for the corresponding trigonometric function.
2. The input for the trigonometry function is radiance.
3. The result is obtained at %MD4, %MD5, and %MD6 respectively (for each inverse trigonometry function).Where%MDis a double word size (32-bit).
4. The user cannot able to increase the number of inputs.
5. Similarly, for the remaining trigonometric functions.
1. This block gives Inverse trigonometric output for the corresponding trigonometric function.
2. The input for the Inverse trigonometry function is radiance.
3. The result is obtained at %MD7, %MD8, and %MD9 respectively (for each inverse trigonometry function).Where %MD is a double word size (32-bit).
4. The user cannot able to increase the number of inputs.
5. Similarly, for the remaining Inverse trigonometric functions.
1. The FRAC block gives the fractional part of the given fractional input.
2. The input data will be floating point variables. The output %MD10isvalue after the decimal point.
3. The user cannot able to increase the number of inputs.
1. The EXPT block gives the exponential of the two inputs. IN1 is the variable 1 and IN2 is the power of the variable.
2. The exponential result is obtained at %MD11. Where %MDis a double word size (32-bit).
3. 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