Lib.Mervis.v1_2.SimplePiControllerWithEn
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 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 |
| Name | Data Type | Meaning | |
| Output | real | Output | |
| InvalidParameters | bool | 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 | |
| AdjustToValue | Used 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:
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