B35_REVERSE_PI_CONTROLLER
PROGRAM B35_TEST VAR XIN,WIN,COOLING:REAL; FB: LIB.CORE.V1_0.B35_REVERSE_PI_CONTROLLER; END_VAR FB(X:=XIN, W:=WIN, OUT=>COOLING); END_PROGRAM
LIB\CORE
V1.0
The block is an implementation of a PI controller (with parameters: P-band, Integration constant, Offset, Min and Max values, and output value of an inactive controller).
Input | Type | Description | Default value |
W | REAL | Setpoint (usually temperature) | 0 |
X | REAL | Measured value (usually temperature). | 0 |
CONTROLLERTYPE | CONTROLLERTYPE | Controller type (cooling/heating). | cooling |
BP | BOOL | When set to TRUE, the I part is disabled (the controller acts as a P controller) | False |
ENABLED | BOOL | Controller enable (FALSE = controller is deactivated). | True |
XP | REAL | Proportional band | 30 |
OFF | REAL | Offset, added to the setpoint W. | 0 |
TI | REAL | Integration constant | 120 |
MIN | REAL | Minimum output value OUT (usually 0). | 0 |
MAX | REAL | Maximum output value OUT (usually 100). | 100 |
DISVAL | REAL | Value of the OUT output when the controller is deactivated (ENABLED=FALSE). | 0 |
Output | Type | Description |
OUT | REAL | Output signal (mostly valve or damper, 0 to 100%). |
PFACTOR | REAL | P-part of the output signal |
IFACTOR | REAL | I-part of the output signal |
There is a control deviation at the controller input, E=(W+OFF)-X. The controller output OUT is given by the relation OUT=-100/Xp*(E+1/Ti*∫e)+MIN, where XP is the proportional band. The integration part (I-part) is calculated as follows: When OUT=0 at t=0 and the inputs are W+OFF=0, X=-1, then the I-part rises to OUT=100 at t=Ti, see figure below. The I-part is limited to 0…100 before it is added to the P-part. The resulting value is finally limited by MIN and MAX, see figure at block B33. The I-part helps to achieve the exact control value.
The BP input sets the I-part to 0, if set to true.
The ENABLED parameter switches the controller off (ENABLED=FALSE, controller disabled, and OUT=DISVAL). If Xp<0 then Xp=0, see below. If MAX<MIN then OUT=MAX (or minimum from (MIN, MAX)).