ControlP
ControlP (FB)
ControlP (FB)FUNCTION_BLOCK ControlP
Short description
Proportional-acting controller (P-controller) The direction of action (inverted / direct) is also adjustable. Typical application: control loops with actuators that have an integrating/storage character.
Representation

Interfaces
Inputs
rX
REAL
Analog measured value
rW
REAL
Analog setpoint
xEn
BOOL
Enable of the controller
Outputs
rY
REAL
0.0
Controller output signal
rDiff
REAL
Control deviation
xLimitActive
BOOL
Status - limit exceeded
Setpoints / parameters
rMax
REAL
100.0
Upper absolute limit of the output signal
rMin
REAL
-100.0
Lower absolute limit of the output signal
rKp
REAL
0.0 …
2.0
Gain factor
rOffset
REAL
0.0
Offset
rYDisabled
REAL
0.0
Disabled value
eAction
eControlMode
eControlMode.Inverted
Direction of action of the controller (Inverted, Direct)
eManModeN
eManNum
eManNum.Auto
Operating mode for the controller output signal
rManValue
REAL
Output signal in manual mode
Function description
General
This function block contains a proportional-acting controller (P-controller). The controller's output signal rY is calculated when the controller is enabled (xEn = TRUE) and in the controller's automatic operating mode (eManModeN = eManNum.Auto) is calculated as follows: rY = rKp * ((measured value + offset) - (setpoint)) Depending on the controller's direction of action eAction the measured and set values are determined as follows:
eAction
measured value
setpoint
Formula
Function
eControlMode.Inverted
rW
rX
rY = rKp * ((rW + rOffset) - (rX))
Direction of action - Inverted
eControlMode.Direct
rX
rW
rY = rKp * ((rX + rOffset) - (rW))
Direction of action - Direct
Enable input xEn
If the enable input is not active (xEn = FALSE) the disabled value rYDisabled is transferred to the output rY (precondition: eManModeN = eManNum.Auto) and limited by the absolute limits. With the enable input active (xEn = TRUE) the output signal is calculated according to the formula above and passed to the output rY (precondition: eManModeN = eManNum.Auto) and limited by the absolute limits.
Control deviation rDiff
The control deviation is calculated according to the following formula and passed to the output rDiff . rDiff = measured value - setpoint
Absolute limits rMin and rMax
The controller's output signal rY is limited downwards by the absolute limit rMin and upwards by rMax . The absolute limit rMin is set to the current value of rMax - 0.1 if it is >= the current value of rMax . The only exception is manual operation for the controller output signal (eManModeN = eManNum.Man).
Status - limit exceeded xLimitActive
The limit-exceeded status is activated (xLimitActive = TRUE) if a limit exceedance exists. The status of the limit exceedance is not set (xLimitActive = FALSE) if no limit exceedance exists. A limit exceedance exists if the controller's output signal rY reaches / exceeds the upper limit rMax or reaches / falls below the lower limit rMin .
Operating mode for the controller output signal eManModeN
The parameter eManModeN allows switching the output signal rY from automatic to manual mode and vice versa. In manual mode the output signal rY takes over the output signal in manual mode rManValue. The setpoint / parameter rManValue is overwritten with the current value of the output signal at every transition into automatic mode rY .
eManModeN
rY
Function
eManNum.Auto
signal according to formula / disabled value
Automatic mode - output signal
eManNum.Man
rManValue
Manual mode - output signal
CODESYS
InOut:
Input
rX
REAL
Input
rW
REAL
Input
xEn
BOOL
Input Const
rYMax
REAL
100
Input Const
rYMin
REAL
-100
Input Const
rKp
REAL
2
Input Const
rOffset
REAL
0
Input Const
rYDisabled
REAL
0
Input Const
eAction
eControlMode
eControlMode.Inverted
Input Const
eManModeN
eManNum
eManNum.Auto
Input Const
rManValue
REAL
Output
rY
REAL
0
Output
rDiff
REAL
Output
xLimitAktiv
BOOL
Last updated

