Professional Documents
Culture Documents
Guia PID
Guia PID
RSLogix 5000
By
Jacques Venter
Introduction
The PLC was created to simplify the implementation of relay type logic control.
The control implemented with the help of PLCs, have since evolved to more
than mere sequence control.
The control solutions addressed by PLCs now include single input single output
type PID control, feed forward control, and multiple PID loops in cascade
control, to name but a few.
Every control engineer should develop the skill and be able to use and
implement PID control in simple control situations.
In this tutorial, you will get a fundamental understanding of the use of PID loops,
and how to program them in RSLogix 5000.
To appreciate the switch from one form to the other, let’s look at a simple
example.
Manual Valve Control
The problem exists that there are multiple forms of human error that may occur,
like:
The level he perceives to be the desired level, might not be the same as
instructed.
He needs to take breaks throughout his shift and can’t monitor this process
constantly.
Some days he might be more exhausted and thus the control carried out
will not be as required.
This simple process now utilizes an important human resource, that should be
used more efficiently.
To make the switch, the setup for this example should change to a similar
configuration as depicted below.
Automatic Valve Control
Here the human element has been removed. The visual monitoring that was
done by the operator, is now carried out by a Level Transmitter, which is
constantly measuring the level inside the tank. The final control element is
replaced with a pneumatic control valve.
The process controlling, decision-making process that was carried out by the
operator is now replaced with the Level Indicating Controller. The desired tank
level serves as a Setpoint (SP) input to the controller. The controller compares
the desired level setpoint, with the physical level measurement (PV). Depending
on the magnitude of the difference, the controller responds by changing the
output (OP) to the valve to change the inflow and get the tank level to the
desired point.
The Automatic process of controlling this tank level eliminates the drawbacks as
experienced by a Manual operator process. Automatic control may be achieved
by either installing a stand-alone PID controller or by connecting the instruments
(I/O) to a PLC and using the built-in PID control functionality.
The two images displayed are retrieved from the RSLogix5000 software’s help
files. For completeness, all operands are displayed, but only the key operands
which will be used in the majority of the cases will be discussed.
Setpoint: The desired value (SP), to where the process must be controlled
is written to PID.SP and is displayed here.
Process Variable: The current value of the Analog input is displayed here.
Output %: The control variable’s value or controller output value (OP) is
displayed here.
Tasks
This is a topic that needs brief attention before the actual programming occurs.
When a new project is created in RSLogix 5000, the following basic
configuration under the tasks folder is created automatically.
This will have an adverse effect on PID loops. The ‘tuning’ of parameters for a
PID loop is in fact the changing of variables for different calculations. When the
speed at which a continuous task is scanned changes, the frequency of how
often the calculations inside the PID instruction is executed also changes. This,
in turn, affects the frequency of output changes that is sent to the final control
element and thus the control loop may not react as to how it was initially
configured.
The icon for this task, as depicted above, looks like a watch. This type of task
only executes after a pre-set time (period) has elapsed. Executing the PID
instructions inside a periodic task ensures that the frequency remains the same,
overcoming the possible problems that may be experienced with the continuous
task.
The Engineering unit scaling range for both inputs and outputs are 0 – 100, as
can be seen in the images below.
After the preliminary steps have been completed, the programming may
commence.
Double click on the Question Mark (?) next to Routine Name and select
LevelControl from the drop-down.
Clear the ‘Input Par’ and ‘Return Par’ fields.
The MainRoutine should now look like this.
Every 250 ms the PID_Loops periodic task will be executed. In turn, the Task
will execute all assigned programs. In this case, it is only the ProcessControl
Program that is assigned. When the program is executed, the associated
routine with the ProcessControl Program will be called to be executed. In this
case, it is the MainRoutine that has been created. When the MainRoutine is
executed, the instruction that is given to the controller in Rung 0 is to Jump to a
Subroutine. So, in rung 0 execution will be shifted to the LevelControl routine.
After the LevelControl routine has been executed, the rest of the MainRoutine
will be scanned until finished and thus the execution of the Periodic Task is
complete.
Ensure that the LevelControl routine is the active routine by clicking on the
LevelControl tab.
Right-click on Rung 0 and select ‘Edit Rung Comment’
Next, input the key input operands and change the optional operands to 0
as follow:
PID: LevelControl
Process Variable: LevelTX
Tieback: 0
Control Variable: ControlValve
PID Master Loop: 0
Inhold Bit: 0
Inhold Value: 0
The tags that have been inserted has not been created yet. Right-click on
the LevelControl tag and select ‘New “LevelControl”’
The New Tag window appears. Note the default Data Type: PID.
Click Create. The LevelControl tag has now been created as a PID Data
Type, together with the members associated with the data type. This can
be seen in Controller Tags.
Right Click on the LevelTX and select ‘New “LevelTX”’
Do the same with the ControlValve tag, but this time select
‘Local:2:O.Ch0Data’, unless a different Analog Output Channel has been
used.
The PID instruction has been successfully implemented. Next, we want to make
sure that the setpoint (SP) that is given to the PID is within limits. This may be
limited to the physical limits of the process. In this example that is 0 – 100% of
the tank level. Alternatively, it may be limited between a minimum and
maximum allowed range, as allowed by the process, for example, 40% - 60% of
the tank level.
Right-click on Rung 0 and select Add Rung. Rung 1 is added to the routine.
Click and hold Rung 1 then drag and drop it, so that the empty rung moves
to the topmost rung in the routine.
Edit Rung 0’s rung comment and enter ‘Setpoint Limits’
Insert a Greater Than instruction to rung 0, by either selecting it from the
Compare Element Group or typing GRT in the ASCII Text field.
This rung will now test if the Setpoint to the PID is more than 100. If it is more
than 100, it will move 100 into the Setpoint.
Add a rung below Rung 0 and insert a Less Than (LES) instruction, as well
as a Move (MOV) instruction, and edit it so that it looks like the following.
This rung will test if the Setpoint to the PID is less than 0. If it is, then move 0
into the Setpoint. These two rungs effectively ensure that the Setpoint to the
PID is within the 0 – 100 % limits. They are intentionally placed before the PID
instruction to ensure that the setpoint is within limits before the calculations in
the PID instruction is executed.
This rung is placed here to easily switch between Manual and Auto mode for
the PID control.
The PID Setup – LevelControl window appears with the Tuning tab
selected
When you click on the Help button while in any of the windows, the Help
displayed will explain the details pertaining to the active window.
As an initial configuration, change the Proportional Gain (Kp) to 0.5 and the
Integral Gain (Ki) to 1.0.
Note: The explanation of the effect of PID parameter tuning is outside the scope
of this tutorial.
Unscaled Min.: 0
Change the Control Variable (CV) fields to represent the full range the
output to the final control element must be able to change.