Type
| Function block |
Description
| Implements differentiation with respect to time. The function block is executed when ENABLE = TRUE.The following program fragment describes the functionality of the DERIVAT function block:
IF RUN THEN XOUT := (3*(XIN-X3)+X1-X2)/ (10*TIME_TO_REAL(CYCLE)); X3 := X2; X2 := X1; X1 := XIN; ELSE XOUT := 0; X1 := XIN; X2 := XIN; X3 := XIN; END_IF |
Notes
|
- The value of the operand connected to CYCLE has to correspond to the cycle time of the task in which the function block is executed.
- Function blocks have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU.
|
Parameters
| Inputs
ENABLE
Data type: | BOOL |
Description: | TRUE = The function block is executed. |
RUN
Data type: | BOOL |
Description: | FALSE = The execution of the function block is halted, and the output is set to zero. |
XIN
Data type: | DERIVAT: REALDERIVAT_LTIME: LREAL |
Description: | Input value. |
CYCLE
Data type: | DERIVAT: TIMEDERIVAT_LTIME: LTIME |
Description: | Sampling period corresponding to the cycle of the task where the function block is executed. |
Output
XOUT
Data type: | DERIVAT: REALDERIVAT_LTIME: LREAL |
Description: | Output value. |
|