Simple PI Controller with Enable Input (v1.2)
Full Name
Lib.Mervis.v1_2.SimplePiControllerWithEn
Required Project References
- Lib.Mervis
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 Type | Allowed Range | Retain | Required | Meaning | |
Input | real | No | Yes | Actual value | ||
SetPoint | real | 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 Type | Meaning | |
Output | real | Output | |
InvalidParameters | bool | 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 | |
AdjustToValue | Used 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:
- 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
Usage Notes
- 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