====== P controller - Cooling ======
{{:en:mervis-ide:35-help:b32.png}}
===== Block name =====
B32_P_CONTROLLER
===== ST call =====
PROGRAM B32_TEST
VAR 
   XIN,WIN,COOLING:REAL;   
    FB: LIB.CORE.V1_0.B32_P_CONTROLLER;
END_VAR
  FB(X:=XIN, W:=WIN, OUT=>COOLING);
END_PROGRAM
===== Library =====
LIB\CORE
===== Version =====
V1.0
===== Description =====
The block is an implementation of a P controller (with parameters: P-band, Offset, Min and Max values, and output value of an inactive controller).
===== Inputs =====
|Input         |Type                              |Description                                                                |Default value|
|W             |REAL                              |Setpoint (usually temperature).                                            |0            |
|X             |REAL                              |Measured value (usually temperature).                                      |0            |
|CONTROLLERTYPE|[[en:mervis-ide:35-help:035-software_basic:060-libraries:015-proto|CONTROLLERTYPE]]|Controller type (cooling/heating).                                         |cooling      |
|ENABLED       |BOOL                              |Controller enable (FALSE = controller is deactivated).                     |True         |
|XP            |REAL                              |Proportional band                                                          |30           |
|OFF           |REAL                              |Offset, added to the setpoint W.                                           |0            |
|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            |
===== Outputs =====
|Output|Type|Description                                       |
|OUT   |REAL|Output signal (mostly valve or damper, 0 to 100%).|
===== Function =====
There is a control deviation at the controller input, E=(W+OFF)-X. The controller output OUT is given by the relation OUT=-Xp/100×E+MIN, where XP is the proportional band. The resulting value is finally limited by MIN and MAX, see figure below. The ENABLED parameter switches the controller off (ENABLED=FALSE, controller disabled, and OUT=DISVAL). If Xp<0 then Xp=0, see below. If MAX