ControlPI (FB)

FUNCTION_BLOCK ControlPI

Functional Description

Proportional integral acting controller (PI controller)
The direction of the action (inverted / direct) is also adjustable.
Typical application: Controlled systems with actuators that do not have a storage character.

Portrayal

../_images/ControlPI_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

rPartP REAL    

proportional component at output signal

rPartI REAL    

Integral term at output signal

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   0.0

Lower absolute limit value of the output signal

rTn REAL 0.0 ... 200.0

Reset time time in seconds

rKp REAL 0.0 ... 2.0

Gain factor

rOffset REAL   0.0

Offset

rInitValue REAL   0.0

initialization value for the output signal

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-integral acting level (PI 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):


Output signal: rY = Proportional part + Integral part


Proportional part: Proportional part = rKp control deviation

Control deviation: Control deviation = rW - (rx + rOffset) [ Direction of action - inverted eAction = eControlMode.Inverted ]

Control deviation= rX - (rW + rOffset) [ Direction of action - direct eAction = eControlMode.Direct ]

Integral part: Integral part = ( proportional part * (sampling time / reset time)) + Integral part (t-sampling time)


Legend: t-sampling time ... time point that was before the current time t by the sampling time
sampling time ... Time duration between two calls of the function block
t ... current time point

Controlling / Properties - reset time rTn

This may only accept values > 0.
rTn >>> sampling time: The integral part remains constant
Control deviation = 0: The integral part remains constant
Depending on the direction of action of the eAction controller, the actual and setpoint values ​​are determined as follows:
eAction

Control deviation

Function

eControlMode.Inverted

rW - ( rx + rOffset )

Direction of action - Inverted

eControlMode.Direct rX - ( rW + rOffset )

Direction of action - direct

Integral part

The integral part is limited both upwards and downwards by the following absolute limit values:
Upper limit = rMax - proportional part
Lower limit = rMax - proportional part

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. The integral part is set to 0.0.

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.

At each rising edge at the enable input xEn the controlling process is restartet.

Restart of the controller

At each rising edge at the enable input xEn the controlling process is restartet. (Requirement: eManModeN = eManNum.Auto and xEn = TRUE)
The integral part is set to the difference between rInitValue and the proportional part.

Control deviation rDiff

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

Proportional part at the signal output rPartP

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

Integral part at the signal output rPartl

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

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 value overstepping is activated (xLimitActive = TRUE) if the limit value is exceeded up or down (xEn = TRUE).
The status of the limit value exceedance is not activated (xLimitActive = FALSE) if there is no limit value exceedance or the enable signal is deactivated (xEn = FALSE).

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 operation, the output signal rY takes over the output signal in manual operation rManValue. The integral part is set to the difference between rInitValue and the proportional part.

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

Initial version

Programming

Adam Bartod 03.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 0

Lower absolute limit value of the output signal

rTn REAL 200

Reset time time in seconds

rKp REAL 2

Gain factor

rOffset REAL 0

Offset

rInitValue REAL 0

initialization value for the output signal

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

rPartP REAL  

proportional component at output signal

rPartI REAL  

Integral term at output signal

xLimitAktiv BOOL  

Status - Exceeding the limit value