beautypg.com

Pid code sample – Rockwell Automation 2080-LC10-12DWD Micro810 Programmable Controllers User Manual User Manual

Page 115

background image

Rockwell Automation Publication 2080-UM001D-EN-E - September 2012

107

IPID Function Block Appendix D

energy for the former and the inductive and capacitive storage energy for the
latter. Motor drive systems and heating systems can be typically modeled by the
LR and C electric circuit.

PID Code Sample

The illustration above shows sample code for controlling the PID application
example shown before. Developed using Function Block Diagrams, it consists of
a pre-defined function block, IPIDCONTROLLER, and four user-defined
function blocks. These four are:

• PID_OutputRegulator

This user-defined function block regulates the output of
IPIDCONTROLLER within a safe range to ensure that there is no
damage to the hardware used in the process.

IF RMIN

≤ RIN ≤ RMAX, then ROUT = RIN,

IF RIN < RMIN, then ROUT = RMIN,
IF RIN > RMAX, then ROUT = RMAX.

• PID_Feedback

This user defined function block acts as a multiplexer.

IF "FB_RST" is false, FB_OUT=FB_IN;
If "FB_RST" is true, then FB_OUT=FB_PREVAL.