Table of Contents

Simple PI Controller with Enable Input (v1.2)

Full Name

Lib.Mervis.v1_2.SimplePiControllerWithEn

Required Project References

Description

This auxiliary block is used to implement a simple PI controller with an Enable input.

Usage in ST

program test
    var
        pi: lib.mervis.v1_2.SimplePiControllerWithEn := (Xp := ..., Ti := ..., Min := ..., Max := ...);
    end_var

    pi(Input := ..., SetPoint := ..., Enable := ..., Output => ...);
end_program

Inputs

Name Data TypeAllowed RangeRetainRequired Meaning
Input real No Yes Actual value
SetPointreal No Yes Desired value
Enable bool No No Function enable, if false the output is 0
Min real ⇐ 0 No No Minimum output value
Max real >= 0 No No Maximum output value
Xp real > 0 No No Proportional gain
Ti real > 0 No No Integral time constant

Outputs

Name Data TypeMeaning
Output real Output
InvalidParametersbool Indicates invalid controller settings (Xp, Ti, Min, or Max out of allowed range)

Block Methods

Name Meaning
Adjust Used to adjust the integral component so the output reaches the maximum value
AdjustToValueUsed to adjust the integral component so the output reaches the desired value
Restart Used to reset internal values and restart the calculation

Detailed Function Description

The functional block implements a PI controller. The following formulas are used for output calculation:

e = SetPoint - Input

IPart = IPart + (Max - Min) / (Xp * Ti) * e * ΔT

Output = (Max - Min) / Xp * e + IPart

The controller includes algorithms to limit the size of the integral component in case of saturation - Anti-windup

Usage Notes

Versions