-

DERIVAT / DERIVAT_LTIME

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

RUN

XIN

CYCLE

Output

XOUT