Simple PI Controller with Enable Input (v1.2)

Lib.Mervis.v1_2.SimplePiControllerWithEn

  • Lib.Mervis

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

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

    pi(Input := ..., SetPoint := ..., Enable := ..., Output => ...);
end_program
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
Name Data TypeMeaning
Output real Output
InvalidParametersbool Indicates invalid controller settings (Xp, Ti, Min, or Max out of allowed range)
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

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

  • Control deviation

e = SetPoint - Input

  • Integral component (every scan cycle)

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

  • Output

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

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

  • For use in heating control, connect the controller as follows
    • SetPoint = Desired value
    • Input = Measured value
  • For use in cooling control, connect the controller as follows
    • SetPoint = Measured value
    • Input = Desired value
  • ! Due to its definition and implementation of anti-windup, the controller does not support “non-zero” mode, meaning the range Min..Max does not include a zero value - this is also indicated by the InvalidParameters output
  • © Energocentrum Plus, s.r.o. 2017 - 2024