PD

The library util.lib provides the following PD controller function block:

../_images/35f49abc0a32e29e0a317f34500fd06e
Inputs of the function block
Variable Data type Description
ACTUAL REAL Current value of the controlled variable
SET_POINT REAL Desired value, command variable
KP REAL Proportionality coefficient, unity gain of the P-part
TV REAL Derivative action time, unity gain of the D-part  in seconds, e.g. “0.5” for 500 msec
Y_MANUAL REAL Defines output value Y in case of MANUAL = TRUE
Y_OFFSET REAL Offset for the manipulated variable Y
Y_MIN, Y_MAX REAL Lower resp. upper limit for the manipulated variable Y. If Y exceeds these limits, output LIMITS_ACTIVE will be set to TRUE and Y will be kept within the prescribed range. This control will only work if Y_MIN<Y_MAX.
MANUAL BOOL If TRUE, manual operation will be active, i.e. the manipulated value will be defined by Y_MANUAL.
RESET BOOL TRUE resets the controller; during reinitialization Y = Y_OFFSET.
Outputs of the function block
Variable Data type Description
Y REAL Manipulated value, calculated by the function block (see below)
LIMITS_ACTIVE BOOL TRUE indicates that Y has exceeded the given limits (Y_MIN, Y_MAX).

Y_OFFSET, Y_MIN und Y_MAX are used for the transformation of the manipulated variable within a prescribed range.

MANUAL can be used to switch on and off manual operation. RESET serves to reset the controller.

In normal operation (MANUAL = RESET = LIMITS_ACTIVE = FALSE) the controller calculates the controller error e as difference SET_POINT - ACTUAL, generates the derivation with respect to timede/ dt and stores these values internally.

The output, i.e. the manipulated variable Y is calculated as follows:

Y = KP (D + TV dD/dt) + Y_OFFSET whereby D = SET_POINT-ACTUAL

So besides the P-part also the current change of the controller error (D-part) influences the manipulated variable.

Additionally Y is limited on a range prescribed by Y_MIN and Y_MAX. If Y exceeds these limits, LIMITS_ACTIVE will get TRUE. If no limitation of the manipulated variable is desired, Y_MIN and Y_MAX have to be set to 0.

As long as MANUAL=TRUE,  Y_MANUAL will be written to Y.

A  P-controller can be easily created by setting TV=0.