B31_REVERSE_ON_OFF_CONTROL_SEQUENCE
PROGRAM B31_TEST VAR IN1, IN2:REAL; O1: BOOL; FB: LIB.CORE.V1_1.B31_REVERSE_ON_OFF_CONTROL_SEQUENCE; END_VAR FB(X:=IN1, W:= IN2); O1:= FB.OUT; END_PROGRAM
LIB\CORE
V1.1
The block is an On/Off controller, parametrable according to CONTROLLERTYPE, bandwidth Xp, and offset OFF.
Input | Type | Description | Default value |
ENABLED | BOOL | Enable of operation. | True |
X | REAL | Controlled value (e.g. temperature). | 0 |
W | REAL | Setpoint value (e.g. temperature). | 22 |
CONTROLLERTYPE | CONTROLLERTYPE | Controller type (Heating, Cooling). | cooling |
XP | REAL | Hysteresis | 1 |
OFF | REAL | Offset, added to the setpoint W. | 0 |
Output | Type | Description |
OUT | REAL | Output signal (usually heating valve). |
The output variable “OUT” has a flag since function block version 1.1 RETAIN to keep the last state when the PLC is restarted.
The block is an implementation of a 2-state controller, or On/Off controller, where X is the controlled value, and W+OFF is the setpoint (the OFF parameter is an offset). It works as follows: Supposing temperature X is too low, then OUT=TRUE and heating (if CONTROLLERTYPE=HEATING) is activated. As soon as the measured temperature X rises above W+OFF, the block sets OUT=FALSE and heating goes off, which results in the temperature X falling. When temperature falls below X=W+OFF-XP, then OUT=TRUE, and heating is activated again. Temperature rises and the whole process repeats.
The offset OFF is used to compensate the W parameter. There are 3 ways to set the offset, see below. Off = 0: Heating controller. Off = Xp/2: Middle value is used as setpoint. Off = -Xp : Minimum level controller.
The ENABLED parameter may switch the controller off. When ENABLED=FALSE, then the controller is off and OUT=FALSE.
Note:
When X= W+OFF then OUT=FALSE. When X = W+OFF+XP then OUT is not defined (it depends if it is reached from left or right).