Math - Advanced for IEC
See also: IEC 61131 Language Editor Programming
See also: Project Toolbox for IEC
Topic Menu
Power of X 
Operator – This function raises IN to the EXPth power and places the result in Q.
Inputs
IN: Number which needs to be raised to EXP’th Power (TYPE : REAL These numbers use IEEE 754-1985 format to store numbers in following ranges.
32-bit single-precision floating point (REAL) – -3.40282E+38 to +3.40282E+38
64-bit double-precision floating point (LREAL) – -1.79769E+308 to +1.7976E+308
Floating Point refers to both REAL and LREAL data types.)
EXP: Number used for increasing the Input IN to this power (TYPE : REAL)
Outputs
Q : The result of IN raised to the power of EXP. (TYPE : REAL)
Q = IN^^EXP
ST Language
Q = EXPT (IN, EXP)
FBD Language
LD Language
IL Language
Return to the Top: Math - Advanced for IEC
Power of e 
Operator – This function determines the value of e (the base of natural logarithms) raised to the INth power and places the result in Q.
Inputs
IN: Number used for finding the natural log. (TYPE : REAL These numbers use IEEE 754-1985 format to store numbers in following ranges.
32-bit single-precision floating point (REAL) – -3.40282E+38 to +3.40282E+38
64-bit double-precision floating point (LREAL) – -1.79769E+308 to +1.7976E+308
Floating Point refers to both REAL and LREAL data types.)
Outputs
Q : The result of e raised to the power of IN. (TYPE : REAL)
Q = EXT(IN)
ST Language
Q = EXT (IN) ;
FBD Language
LD Language
IL Language
Return to the Top: Math - Advanced for IEC
Base 10 Logarithm 
LOG10
Function – Calculates the logarithm (base 10) of the input.
Inputs
IN: Input to determine LOG to base 10. ( TYPE : REAL These numbers use IEEE 754-1985 format to store numbers in following ranges.
32-bit single-precision floating point (REAL) – -3.40282E+38 to +3.40282E+38
64-bit double-precision floating point (LREAL) – -1.79769E+308 to +1.7976E+308
Floating Point refers to both REAL and LREAL data types.)
Outputs
Q : Outputs LOG to base 10 for the Input at IN. (TYPE: REAL)
ST Language
Q := LOG10 (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Natural Logarithm 
Function - Calculates the logarithm (base e) of the input.
Inputs
Outputs
Q : REAL Result: logarithm (base e) of IN
Remarks - In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q : = LOG (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Sine 
Function - Calculate a sine.
Inputs
Outputs
Q : REAL/LREAL Result: sine of IN
Remarks - In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q := SIN (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Cosine 
Function - Calculate a cosine.
Inputs
Outputs
Q : REAL/LREAL Result: cosine of IN
Remarks - In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q := COS (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Tangent 
Function - Calculate a tangent.
Inputs
Outputs
Q : REAL Result: tangent of IN
Remarks - In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q := TAN (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Inverse Sine
Function - Calculate an arc-sine.
Inputs
Outputs
Q : REAL/LREAL Result: arc-sine of IN
Remarks - In LD language, the operation is executed only if the EN is TRUE. The ENO keeps the same value as the EN. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q := ASIN (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Inverse Cosine 
Function - Calculate an arc-cosine.
Inputs
IN : REAL Real value
Outputs
Q : REAL Result: arc-cosine of IN
Remarks - In LD language, the operation is executed only if the EN is TRUE. The ENO keeps the same value as the EN. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q := ACOS (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Inverse Tangent 
Function - Calculate an arc-tangent.
Inputs
Outputs
Q : REAL Result: arc-tangent of IN
Remarks - In LD language, the operation is executed only if the EN signal is TRUE. The ENO keeps the same value as the EN. In IL, the input must be loaded in the current result before calling the function.
ST Language
Q := ATAN (IN) ;
FBD Language
LD Language
(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
IL Language
Return to the Top: Math - Advanced for IEC
Convert to Radians 
Operator – Converts Degrees to Radians.
Inputs
Outputs
Q : Converted input to Radians. ( TYPE : REAL)
ST Language
Q := DegToRad (IN) ;
FBD Language
LD Language
IL Language
Return to the Top: Math - Advanced for IEC
Radians to Degrees 
Operator – Converts Radians to Degrees.
Inputs
Outputs
Q : Converted input to Degrees. ( TYPE : REAL)
ST Language
Q := RadToDeg (IN) ;
FBD Language
LD Language
IL Language
Return to the Top: Math - Advanced for IEC