ControlPIext

ControlPIext (FB)

FUNCTION_BLOCK ControlPIext

Short description

Proportional-integral acting controller (PI controller), parameters as inputs. The action (inverted / direct) is also configurable. Typical application: control loops with actuators that do not have storing characteristics.

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

rYDisabled

REAL

0.0

Shutdown value

rInitValue

REAL

0.0

Initial value for the output signal

rKp

REAL

0.0 …

2.0

Gain factor

rTn

REAL

0.0 …

200.0

Reset time in seconds

rMin

REAL

0.0

Lower absolute limit of the output signal

rMax

REAL

100.0

Upper absolute limit of the output signal

Outputs

Name
Data type
Value range
Initial value
Function

rY

REAL

0.0

Controller output signal

rDiff

REAL

Control deviation

rPartP

REAL

Proportional part of the output signal

rPartI

REAL

Integral part of the output signal

xLimitActive

BOOL

Status - limit exceedance

Setpoints / Parameters

Name
Data type
Value range
Initial value
Function

rOffset

REAL

0.0

Offset

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-integral acting controller (PI controller). Some parameters are defined as inputs and thus not persistent. This allows the values to be changed continuously by the program. 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: Output signal: rY = Proportional component + Integral component Proportional component: Proportional component = rKp * control deviation Control deviation: Control deviation = rW - ( rx + rOffset ) [ Action - Inverted: eAction = eControlMode.Inverted ] Control deviation = rX - ( rW + rOffset ) [ Action - Direct: eAction = eControlMode.Direct ] Integral component: Integral component = ( Proportional component * ( sampling time / reset time )) + Integral component ( t-sampling time ) Legend: t-sampling time … time point which was one sampling time before the current time t Sampling time … time interval between two calls of the function block t … current time\

Control / Properties - Reset time rTn

It may only take values > 0. rTn >>> Sampling time: The integral component remains constant Control deviation = 0: The integral component remains constant Depending on the controller action eAction the actual and set values are determined as follows:

| **eAction** | Control deviation | Function | |-------------------------|-------------------------------|-----------------------| | eControlMode.Inverted | *rW* - ( *rx* + **rOffset** ) | Action - Inverted | | eControlMode.Direct | *rX* - ( *rW* + **rOffset** ) | Action - Direct |

Integral component

The integral component is limited both upwards and downwards by the following absolute limits: Upper limit = rMax - Proportional component Lower limit = rMin - Proportional component\

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. The integral component is set to 0.0. With active enable input ( 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. On every rising edge at the enable input xEn the control process is restarted. \

Restarting the controller

On every rising edge at the enable input xEn the control process is restarted. ( Preconditions: eManModeN = eManNum.Auto and xEn = TRUE ) The integral component is set to the difference between rInitValue and the proportional component. \

Control deviation rDiff

The control deviation corresponds to the value of the control deviation according to the formula given above. \

Proportional part of the output signal rPartP

The proportional part of the output signal is always available at this output, see the description above. \

Integral part of the output signal rPartI

The integral part of the output signal is always available at this output, see the description above. \

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 an upper or lower limit violation exists ( xEn = TRUE ). The status of the limit violation is not activated ( xLimitActive = FALSE ), if no limit violation exists or the enable signal is deactivated ( xEn = FALSE ). A limit violation 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 operation and vice versa. In manual mode the output signal takes over rY the output signal in manual mode rManValue. The integral component is set to the difference between rInitValue and the proportional component. \

eManModeN

rY

Function

eManNum.Auto

Signal according to formula / switch-off value

Automatic mode - output signal

eManNum.Man

rManValue

Manual mode - output signal

Visualization

\

Codesys

InOut:

Scope
Name
Type
Initial

Input

rX

REAL

Input

rW

REAL

Input

xEn

BOOL

Input

rYDisabled

REAL

0

Input

rInitValue

REAL

0

Input

rKp

REAL

2

Input

rTn

REAL

200

Input

rYMin

REAL

0

Input

rYMax

REAL

100

Input Const

rOffset

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

rPartP

REAL

Output

rPartI

REAL

Output

xLimitAktiv

BOOL

Last updated