Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

ControlP

ControlP (FB)

FUNCTION_BLOCK ControlP

Short description

Proportional controller (P controller) The action direction (inverted / direct) can also be set. Typical application: control loops with actuators that have a storage characteristic.

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

rX

REAL

Analog actual value

rW

REAL

Analog setpoint value

xEn

BOOL

Controller enable

Outputs

Name
Data type
Value range
Initial value
Function

rY

REAL

0.0

Controller output signal

rDiff

REAL

Control deviation

xLimitActive

BOOL

Status - limit exceedance

Setpoints / Parameters

Name
Data type
Value range
Initial 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

Action direction 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 controller (P controller). The controller output signal rY is calculated when the controller is enabled (xEn = TRUE) and in automatic mode of the controller (eManModeN = eManNum.Auto) as follows: rY = rKp * ((Actual value + Offset) - (Setpoint value)) Depending on the action direction of the controller eAction the actual and setpoint values are defined as follows:

eAction

Actual value

Setpoint

Formula

Function

eControlMode.Invertiert

rW

rX

rY = rKp * ((rW + rOffset) - (rX))

Action direction - Inverted

eControlMode.Direct

rX

rW

rY = rKp * ((rX + rOffset) - (rW))

Action direction - Direct

Enable input xEn

If the enable input is not active (xEn = FALSE) the switch-off value rYDisabled to the output rY is transferred (prerequisite: eManModeN = eManNum.Auto) and limited by the absolute limit values. If the enable input is active (xEn = TRUE) the output signal is calculated according to the formula above and to the output rY is transferred (prerequisite: eManModeN = eManNum.Auto) and limited by the absolute limit values.

Control deviation rDiff

The control deviation is calculated according to the following formula and to the output rDiff transferred. rDiff = Actual value - setpoint value

Absolute limit values rMin and rMax

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

Status - limit exceedance xLimitActive

The limit exceedance status is activated (xLimitActive = TRUE) if a limit exceedance is present. The limit exceedance status is not activated (xLimitActive = FALSE) if no limit exceedance is present. A limit exceedance exists if the controller output signal rY the upper limit value rMax reaches / exceeds or the lower limit value rMin reaches / falls below.

Operating mode for the controller output signal eManModeN

The parameter eManModeN allows switching the output signal rY from automatic mode to manual mode and vice versa. In manual mode, the output signal takes over rY the output signal in manual mode rManValue. The setpoint / parameter rManValue is overwritten each time the system switches to automatic mode with the current value of the output signal rY overwritten.

eManModeN

rY

Function

eManNum.Auto

Signal according to formula / switch-off value

Automatic mode - output signal

eManNum.Man

rManValue

Manual mode - output signal

CODESYS

InOut:

Scope
Name
Type
Initial

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

xLimitActive

BOOL

Last updated