• Create Function Block for PID. Right-click on the Blocks folder and select Insert New Object > Function Block menu item.
• Set Symbolic Name to FB_PID, Symbol Comment with Function Block PID Control and the language to LAD.
• Open Attributes tab and in line 1 include the attribute S7_m_c with value true.
• Open function block FB8 FB_PID for editing. In Component View, double-click on the function block.
• In Interface, enter the OUT output parameters:
Name | Type | Description | S7_m_c |
---|---|---|---|
SA | Real | Analog output |
• In Interface, enter the IN_OUT input/output parameters:
Name | Type | Description | S7_m_c |
---|---|---|---|
PV | Real | Analog input | True |
SP | Real | Setpoint | True |
SPR | Real | Remote setpoint | True |
MV | Real | Manipulated variable | True |
PROP | Real | Proportional | True |
INTEG | Int | Integral | True |
DER | Int | Derivative | True |
BM | Real | Dead band | True |
MVMAX | Real | MV Maximum | True |
MVMIN | Real | MV Minimum | True |
FATOR_RANGE | Real | Range multiplication factor | True |
AM | Bool | Auto/Manual | True |
LR | Bool | Local/Remote | True |
DIR_REV | Bool | Direct/Reverse PID action | True |
• In Interface, enter the STAT parameters:
Name | Type |
---|---|
PID | PID |
PID type structure
IN input parameters:
OUT output parameters:
Name | Type |
---|---|
PROP_AUX | Real |
SP_AUX | Real |
PV_AUX | Real |
INT_DI1 | DInt |
INT_DI2 | DInt |
DINT_1000 | DInt |
INTEG_AUX | Time |
DER_DI1 | DInt |
DER_DI2 | DInt |
DER_AUX | Time |
• Insert logic for PID controller.
Network 1
When remote PID (LR = 1), move the value of the SPR parameter to the SP setpoint parameter.
Networks 2 and 3
Conversion of the PV and SP parameters to the 0 to 100% scale for internal use in the PID. This conversion is optional.
Network 4
FB41 PID CONT_C block.
Network 5
Conversion of the integral value entered by the operator to the time type used in the PID (x1000 - in milliseconds).
Network 6
Conversion of the value of the derivative in integer entered by the operator to the time type used in the PID (x1000 - in milliseconds).
Network 7
In direct action (DIR_REV = 0), the proportional value entered by the operator goes directly to the PID.
Network 8
In the reverse action (DIR_REV = 1), the proportional value entered by the operator has its sign reversed and goes to the PID.
Network 9
Movement of the manipulated variable MV to the analog output SA.