PID (proportional-integral-derivative)

PID is an output instruction that controls physical properties such as temperature, pressure, liquid level, and flow rate using process loops.
Operation details:
  • When enabled, PID controls the process using the input parameters, including SP and Gains of the PID controller.
  • Run to Program mode transition, the PID instruction is disabled, parameter values are retained.
  • Program to Run mode transition, the PID instruction remains disabled until a user resets Enable to true.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the L20E, L50E, and L70E controllers.
PID
PID
PID parameters
Parameter
Parameter Type
Data Type
Description
Enable
Input
BOOL
Enable instruction.
  • TRUE: Start execution with the current input parameters.
  • FALSE: PID does not execute. Set CV to 0 and calculate AbsoluteError.
PV
Input
REAL
Process Value. This value is typically read from an analog input module.
The SI unit must be the same as Setpoint.
SP
Input
REAL
The set point value for the process.
AutoManual
Input
BOOL
Auto or manual mode selection.
  • TRUE: CV is controlled by PID.
  • FALSE: PID is running and CV is controlled by CVManual input.
CVManual
Input
REAL
Control value input defined for manual mode operation.
The valid range for CVManual is:
CVMin < CVManual < CVMax.
CVMin
Input
REAL
Control value minimum limit.
  • If CV < CVMin, then CV = CVMin.
  • If CVMin > CVMax, an error occurs.
CVMax
Input
REAL
Control value maximum limit.
  • If CV > CVMax, then CV = CVMax.
  • If CVMax < CVMin, an error occurs.
Gains
Input
PID_GAINS
Gains of PID for controller.
Use the PID_GAINS data type to configure the Gains parameter.
Control
Input
BOOL
Control direction of the process:
  • TRUE: Direct acting, such as Cooling.
  • FALSE: Reverse acting, such as Heating.
Active
Output
BOOL
Status of the PID controller.
  • TRUE: PID is active.
  • FALSE: PID is stopped.
CV
Output
REAL
The control value output.
If any error occurred, CV is 0.
AbsoluteError
Output
REAL
Absolute error is the difference between process value (PV) and set point (SP) value.
Error
Output
BOOL
Indicates the existence of an error condition.
  • TRUE: Operation encountered an Error.
  • FALSE: Operation completed successfully or the instruction is not executing.
ErrorID
Output
USINT
A unique numeric that identifies the error. The errors are defined in PID error codes.
PID_GAINS data type
Parameter
Parameter Type
Data Type
Description
Kc
Input
REAL
Controller gain for PID.
Proportional and Integral are dependent on this gain. (>= 0.0001).
Increasing Kc improves response time but also increases overshoot and oscillation of the PID.
If Kc is invalid, an error occurs.
Ti
Input
REAL
Time integral constant in seconds (>= 0.0001).
Increasing Ti decreases the overshoot and oscillation of the PID.
If Ti is invalid, an error occurs.
Td
Input
REAL
Time derivative constant in seconds (>= 0.0).
When Td equals 0, there is no derivative action and PID becomes a PI controller.
Increasing Td reduces the overshot and removes the oscillation of the PID controller.
If Td is invalid, an error occurs.
FC
Input
REAL
Filter constant (>= 0.0). Recommended range for FC is from 0 through 20.
Increasing FC smooths the response of the PID controller.
If FC is not valid, an error occurs.
PID error codes
Error Code
Error Description
0
PID is working normally.
1
Kc is not valid.
2
Ti is not valid.
3
Td is not valid.
4
FC is not valid.
5
CVMin > CVMax or CVMax < CVMin.
6
CVManual < CVMin.
CVManual is invalid.
7
CVManual > CVMax.
CVManual is invalid.

PID examples

PID function block diagram example
PID ladder diagram example
PID ladder diagram example
PID structured text example
PID structured text example
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal