EXPT block
Short summary
Name |
|
→POU type |
|
Category |
|
Conform to →IEC-standard |
more possible than defined in IEC-standard; and
currently restricted |
Graphical interface |
|
Available since |
|
Functionality
The mathematical function exponentation is called: The block returns the result of IN1IN2
(the value connected to IN1
is exponentiated by the value connected to IN2
).
Behavior for calculation 0**0 The |
Observe as well:
-
No check of invalid connections
For some blocks, invalid connections are not checked by Neuron Power Engineer. Therefore, enter code in your application to detect invalid connections (e.g.
IF
-statements in the ST-code). See "Examples for invalid Connections".See "IEC-blocks for the application" for information what the consequences of an invalid connection might be.
You might want to use the
IS_VALID
block in your application to check the validity ofANY_REAL
values.Restriction
For the platform "vxWorks x86", the
EXPT
block does not return "Not-a-Number" (NaN
) in case of an invalid connection of theEXPT
block withANY_REAL
values. See also "EXPT block returns a wrong value under certain target system in case of an invalid connection".
-
For
ANY_INT
values (see under "Example for usage within ST-editor"):ANY_INT is...
USINT
,UINT
,UDINT
,ULINT
,SINT
,INT
,DINT
orLINT
(corresponds to →generic data typeANY_INT
)-
If the return value exceeds the upper limit of the data type, the block returns the upper limit of the data type. In this case, the output
ENO
is set to valueFALSE
. -
If the return value is below the lower limit of the data type, the block returns the lower limit of the data type. In this case, the output
ENO
is set to valueFALSE
as well.
-
Inputs, return value
|
Identifier |
Description |
|
---|---|---|---|
Inputs: |
|
|
1st value |
|
|
2nd value |
|
Return value: |
– |
|
|
Input EN
and output ENO
are available when →calling the block. See "Execution control: EN, ENO" for information on input EN
and output ENO
.
See:
-
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
-
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic.
Internal error diagnostic for block
The block checks the return value. The output ENO
of the block is set to value FALSE
(or an equivalent) in the following cases:
-
The return value exceeds the upper limit of the data type. (Moreover for this case, the blocks returns the upper limit of the data type.)
-
The return value is below the lower limit of the data type. (Moreover for this case, the blocks returns the lower limit of the data type.)
Example for usage within ST-editor
The calculated values are evaluated by using the Assert
block.
|
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.
Examples for invalid connections
Invalid connections might occur in the following cases during a calculation using EXPT
.
-
due to →overflows or →underflows
Examples for invalid connections
FUNCTION_BLOCK ExampleExptInvalid1
VAR
resultSint1, resultSint2 : SINT;
CheckENO1, CheckENO2 : BOOL;
END_VAR
resultSint1 := EXPT(IN1 := SINT#10, IN2 := SINT#3, ENO=>CheckENO1); (* The upper limit for SINT is '127'. '10**3' causes an overflow as '10**3' would evaluate to '1000'. *)
Assert(resultSint1 = 127);
Assert(CheckENO1 = FALSE);
resultSint2 := EXPT(IN1 := SINT#-10, IN2 := SINT#3, ENO=>CheckENO2); (* The lower limit for SINT is '-128'. '-10**3' causes a negative overflow as '-10**3' would evaluate to '-1000'. *)
Assert(resultSint2 = -128);
Assert(CheckENO2 = FALSE);
END_FUNCTION_BLOCK
-
if
IN1
<0
andIN2
is not an →integerExample for invalid connections
FUNCTION_BLOCK ExampleExptInvalid2
VAR
resultRealInvalid : REAL;
END_VAR
resultRealInvalid:= EXPT(IN1 := REAL#-25.0, IN2 := REAL#0.5);
(* For the built-in PLC, 'resultRealInvalid' evaluates to 'NaN' in the 'Values of Variables* view. *)
(* But this is not the case for vxWorks x86. *)
ASSERT(NOT IS_VALID(resultRealInvalid));
END_FUNCTION_BLOCK
See also "EXPT block returns a wrong value under certain target system in case of an invalid connection".