ControlP (FB)

FUNCTION_BLOCK ControlP

Short Description

Proportional controller (P-controller)
The direction of action (inverted/direct) is also adjustable.
Typical application: Controlled systems with actuators where storage is possible.

Portrayal

../_images/ControlP_FB.png

Interfaces

Inputs

Name

Datatype

Range

Init-Value

Function

rX REAL    

Analog actual value

rW REAL    

Analog setpoint

xEn BOOL    

Enable the Controller

Outputs

Name

Datatype

Range

Init-Value

Function

rY REAL   0.0

Output signal of the controller

rDiff REAL    

Control deviation

xLimitActive BOOL    

Status - Exceeding the limit value

Setpoints / Parameters

Name

Datatype

Range

Init-Value

Function

rMax REAL   100.0

Upper absolute limit value of the output signal

rMin REAL   -100.0

Lower absolute limit value of the output signal

rKp REAL 0.0 ... 2.0

Gain factor

rOffset REAL   0.0

Offset

rYDisabled REAL   0.0

Switch-off 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

Functional Description

General

This function block contains a proportional-acting controller (P-controller).
The output signal of the controller rY is calculated as follows when the controller is enabled (xEn = TRUE) and in the controller automatic mode (eManModeN = eManNum.Auto):


rY = rKp * (( actual value + offset ) - ( setpoint value ))


Depending on the direction of action of the eAction controller, the actual and setpoint values ​​are determined as follows:
eAction

Actual value

Setpoint value

Formula

Function

eControlMode.Invertiert rW rX rY = rKp * (( rW + rOffset ) - ( rX ))

Direction of action - Inverted

eControlMode.Direct rX rW rY = rKp * (( rX + rOffset ) - ( rW ))

Direction of action - direct

Enabling input xEn

If the enabling input is not active (xEn = FALSE), the switch-off value rYDisabled is transferred to the output rY
(Requirement: eManModeN = eManNum.Auto) and limited by the absolute limits.

When the enable input is active (xEn = TRUE), the output signal is calculated according to the formula above and transmitted to the output rY
(Requirement: eManModeN = eManNum.Auto) and limited by the absolute limits.

Control deviation rDiff

The control deviation is calculated according to the following formula and transmitted to the output rDiff.


rDiff = actual value - setpoint value


Absolute rMin and rMax limits

The output signal of the controller rY is limited by the absolute limit values ​rMin downwards and rMax upwards.
The absolute limit rMin is set to the current value of rMax - 0.1 if it is > = the current value of rMax.
Excluded is only the manual operation mode for the output signal of the controller (eManModeN = eManNum.Man).

Status - limit exceeded xLimitActive

The status of the limit violation is activated (xLimitActive = TRUE), if there is a limit violation.
The status of the limit violation is not activated (xLimitActive = TRUE), if there is a limit violation.

A limit value violation occurs if the output signal of the controller rY reaches/exceeds the upper limit value rMax or
reaches/falls below the lower limit rMin.

Operating mode for the output signal of the eManModeN controller

The parameter eManModeN allows for the output signal rY to be switched from automatic to manual mode and vice versa.
In manual mode, the output signal rY adopts the output signal in manual mode rManValue.
The setpoint / parameter rManValue is overwritten with the current value of the output signal rY with each transition to automatic mode.

eManModeN rY

Function

eManNum.Auto

Signal according to the formula / switch-off value

Automatic operation - Output signal

eManNum.Man rManValue

Manual operation - Output signal

Visualization




Information

Element

Authors

Date

Version

Notes

Function

Adam Bartod 02.2017 1.0

Initial version

Programming

Adam Bartod 02.2017 1.0

Initial version

Test Jochen Reu 11.2017 1.0

Initial version

Documentation

Jochen Reu 11.2017 1.0

Initial version

Codesys

InOut:
Scope Name Type Initial Comment
Input rX REAL  

Analog actual value

rW REAL  

Analog setpoint

xEn BOOL  

Enable the Controller

rYMax REAL 100

Upper absolute limit value of the output signal

rYMin REAL -100

Lower absolute limit value of the output signal

rKp REAL 2

Gain factor

rOffset REAL 0

Offset

rYDisabled REAL 0

Switch-off 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

Output rY REAL 0

Output signal of the controller

rDiff REAL  

Control deviation

xLimitAktiv BOOL  

Status - Exceeding the limit value