ControlP

ControlP (FB)

FUNCTION_BLOCK ControlP

Short description

Proportional controller (P-controller) The action (inverted / direct) is also adjustable. Typical application: control loops with actuators that have an integrating (storage) character.

Representation

Interfaces

Inputs

Name
Data type
Value range
Initial value
Function

rX

REAL

Analog actual value

rW

REAL

Analog setpoint

xEn

BOOL

Enable of the controller

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

Shutdown value

eAction

eControlMode

eControlMode.Inverted

Controller action (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 ) as follows: &#xNAN;rY = rKp * (( actual value + offset ) - ( setpoint )) Depending on the controller action eAction the actual and set values are defined as follows:\

eAction

Actual value

Setpoint

Formula

Function

eControlMode.Inverted

rW

rX

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

Action - Inverted

eControlMode.Direct

rX

rW

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

Action - Direct

Enable input xEn

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

Control deviation rDiff

The control deviation is calculated according to the following formula and transferred to the output rDiff . &#xNAN;rDiff = actual value - setpoint \

Absolute limits rMin and rMax

The controller's output signal rY is limited downward by the absolute limits rMin and upward rMax . The absolute limit rMin is set to the current value of rMax - 0.1 if it >= the current value of rMax . The only exception is the manual operation for the controller's 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 is present 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 operation 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 with the current value of the output signal each time there is a transition to automatic operation. rY \

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

xLimitAktiv

BOOL

Last updated