Allen Bradley SLC 500 PID Instructions
Proportional, Integral, and Derivative Instruction

[Main Page] [Topic Index] [Command Index]

PID control is a common type of control used in manufacturing today. Its is used in output instructions which contain physical properties such as temperature, pressure, liquid level, or flow rate using process loops.

PID instructions normally control a closed loop using input and output controls from analog modules. For temperature control, you can convert the analog output module to control a time proportioning on/off output for a heating or cooling unit. An example of temperature PID control is shown here. The PID closed loop control holds a process variable at a chosen setpoint.

The PID equation controls this temperature process by sending an output signal to the control valve. The greater the error between the setpoint and the process variable, the greater the output signal and vice versa.

• Entering Parameters

• PID Instruction Flags

• The PID Equation

Standard equation with dependent gains:

Entering Parameters

When entering PID Parameters,the PID instruction is normally placed on the rung as an output module without the use of conditional logic. When there is no conditional logic:

• The output remains at it's previous value when the rung is false, and the integral term is cleared when the rung is false.

• During Programming you must enter locations for the Control Block, Process Variable, and Control Variable once the PID instruction is entered into the ladder logic.

Control Block

This file is the heart of the programming because it stores the data required to operate the PID function. The file length is fixed at 23 words and it should be entered as an integer file. For example, an entry of N10:0 will occupy elements N10:0 through N10:22. It is a good idea to use a unique data file to hold your PID control blocks. This is to avoid re-using the PID control addresses later in the program. N10:0 is a good example of this. Here is an example of the Control Block layout.

Process Variable PV

This is the address that stores the input variable. This address can be the location of the analog input word where the value of the input address is stored. You can enter this value as a integer as long as you pre-scale the input value to the range of 0-16383.

Control Variable CV

This variable stores the output of the PID instruction. Like the Process Variable, the CV's range is from 0 to 16383. 16383 is noted as the 100% or "on" position. This value is normally an integer, so you can scale the PID output range to fit your PID application. See the page on PID and Analog I/O Scaling for more information on this subject. The figure below shows a PID instruction with common addresses for these parameters entered.

Auto/Manual AM (word 0,bit 1)

This function of the PID controller is very important, especially while tuning your system. The AM function toggles between Auto and Manual mode. When the PID is in Auto mode the PID is controlling the output. When the PID is in Manual mode the user is controlling it. It is recommended that you tune your setup in manual mode. Once things are running smoothly you can switch to auto mode.

Mode TM (word 0,bit 0)

This function toggles the values between Timed and STI mode. Timed mode indicates that the PID updates its output by a specified value in the Loop Update parameter. Note: The processor scan time should be set at least 10 times faster than the loop update time to prevent disturbances. STI mode is when the PID updates itself whenever the output it scanned. When you select STI mode, the PID instructions should be programmed in a STI interrupt subroutine. The STI subroutine should have a time interval the same as the Loop Update Parameter. For example,set the STI period in word S:30. Check to see if the STI and Loop Update parameters are equal. If they aren't adjust accordingly.

Control CM (word 0,bit 2)

This function toddles betwee the E=SP-PV (Setpoint-Process Varable) and E=PV-SP. E=PV-SP is direct acting and causes the output Control Variable CV to increase when the input Process Varaiable PV is larger than the Setpoint. In reverse acting(E=PV-SP)it is just the opposite. When in this mode the CV increases when the input Process Variable PV is SMALLER than the setpoint SP.

Setpoint SP (word 2)

The Setpoint is the control point of the process variable. This value can easily be changed in the ladder logic. While using PID control you will probably be adjusting this value often. Write the value in the 3rd word in the control block (for example if your control block is N10:0 store the setpoint in N10:2). Without scaling, the range of this value is from 0-16383. Otherwise the range is min scaled (word 8) to max scaled (word 7).

Control Block Diagram

Gain Kc (word 3)

This is the Proportional gain. It ranges from .1 to 25.5 on the SLC 5/00 and 5/01's and 0-32767 for the SLC 5/03's and 5/04's. A rule of thumb is to set the gain to one half the value needed to cause the system to oscillate when the Reset and Rate terms are set to zero.

Reset Ti (word 4)

This is the Integral gain. The range for this gain ranges from .1 to 25.5 minutes per repeat. However as in the proportional gain, the SLC 5/03's and 5/04's range from 0-32767 minutes/repeat. A rule of thumb is to set the reset time equal to the natural period found in gain Kc.

Rate Td

This is the Derivative term. The range for this value is from .01 to 2.55 minutes. For the SLC 5/03's and 5/04's the range is from 0-32767. It is recommended that this value be set to 1/8 of the integral time.

Maximum Scaled Smax (word 7)

This parameter recognizes the setpoint value when it is in engineering units. The control input must be 16383 (or 32768 for the 5/03 and 5/04). The valid range is -16383 to +16383. The SLC 5/03's and 5/04's range is from -32768 to +32767.

Minimum Scaled Smin (word 8)

This parameter is exactly like the Smax except the control input must be zero.
Note: Smin-Smax, scaling allows you to enter the setpoint in engineering units. The deadband, error, and process variable will be displayed as enginerring units. The process variable must still be within it's range from 0-16383.SLC 5/03 and SLC 5/04 specific: Scaled errors larger or smaller than its range of -32768 to +32767 will be represented as the closest limit. For example if a scaled error is -32788, it will be represented as -32768 etc...

This parameter is always a positive value. The deadband's value ranges from above the setpoint value to below the setpoint value in which you enter. The deadband value is entered at the zero crossing point of the process variable (PV) and the setpoint (SP). This implies that the deadband is only effective once the PV enters the deadband and has passed through the setpoint (SP). The range of the deadband if it is scaled max (Smax) is 0, and if there is no scaling the range is from 0 to 16383.

Loop Update (word 13)

This is the time interval between PID calculations. The value is in 0.01 second intervals. A rule of thumb is to set the loop update time five to tens tims faster than the natural period of the load (this is determined by setting the reset and rate parameters to zero and then adjusting the gain until the output begins to oscillate). When in the STI mode, this value must equal the STI time interval value S:30. The valid range for this parameter is 1 to 2.55 seconds. For the SLC 5/03 and 5/04 the range is from 0.01 seconds to 10.24 seconds.

Scaled Process PV (word 14)

This parameter is for display only. This is the scaled value of the Process Variable (the analog input). Without scaling the range of this parameter is 0 to 16383. Otherwise, the range is Minimum Scaled (word 8) to Maximum Scaled (word 7).

Control Block Diagram

Scaled Error (word 15)

This parameter is also for display only. This is the scaled error,which is selested by the control mode parameter. The range is scaled maximum to scaled maximum, or 16383 to -16383 when no scaling exists.
Note: SLC 5/03 and SLC 5/04 specific: Scaled errors larger than +32767 or smaller than -32768 cannot be represented. If the error value is, for example, equal to +32787, it is represented as +32767. This is also true for the negative values.

Output CV% (word 16)

This parameter displays the 0 to 16383 CV output in terms of percentage (0% to 100%). If the AUTO mode is picked with the F1 function key, this is for display purposes only. If you pick manual mode and you are using an APS data monitor you can change the output % of the CV by adjusting it on the APS monitor. Writing to the CV using your program or non-intelligent programming device will not effect the CV. If you're using a non-APS device, you must write directly to the CV, which ranges from 0 to 16383.

Output (CV) Limit OL (word 0, bit 3)

This parameter toggles between yes and no. Select Yes if you want to limit the output to it's maximum and minimum values.

PID Instruction Flags

• The right column of the display above shows various flags associated with PID instruction. This section will describe the flags.

Timed Mode Bit (word 0, bit 0)

This function specifies the PID mode. It is only effective when the TIMED Mode (TM) is in effect. This bit is not cleared and is not effective when the STI mode is engaged. This bit can easily be edited within your ladder logic program.
Auto/Manual Bit (word 0, bit 01)
This flag specifies automatic operation when it is cleared and manual operation when it is set. This bit can also be set or cleared by the instructions in your ladder logic program. For more information about the Auto/Manual bit see the Auto/Manual Parameter earlier in this page.

Control Mode Bit CM (word 0, bit 02)

This bit is cleared if the control is E=SP-PV. It is set if the control is E=PV-SP. This bit can be set or cleared in you ladder logic program. To see more information on CM see the Control Mode Parameter description.

Note:It is a good idea to refer to the Control Block Diagram to see how these flags and the following flags fit into your program.

Output Limiting Enabled Bit OL (word 0, bit 03)

This flag is set when you choose to limit the Control Variable Parameter using function key [F4]. This bit can be set or cleared in your ladder logic program.

SLC 5/03 and SLC 5/04 specific - Reset and Gain Range Enhancement Bit RG (word 0, bit 4)

When this bit is set, it causes the Reset Minute/Repeat Value and the gain multiplier to be enhanced by a factor of 10, (reset multiplier of .01 and gain multiplier of .01).

Example with bit 4 set: With a reset value of 1 the integral value is 0.01 minutes/repeat(0.6 seconds/repeat). This value will be applied to the PID algorithm. A gain value of 1 means that the error will be multipied by 0.01 and applied to the PID algorithm. When bit 4 is clear the characteristics are the same except a reset or gain value of 1 indicates the integral value is 0.1 minutes/repeat and the error is multiplied by 0.1.

Scale Setpoint Flag SC (word 0, bit 05)

This flag is cleared when scaling values are specified for the Setpoint (SP).

Loop Update Time Too Fast TF (word 0, bit 06)

This bit is set in the PID algorithm if the Loop Update value you entered cannot be performed by the program (because of scan time limitations). If the bit is set try to correct the problem by changing your Loop Update value to a slower value or move the PID instruction to a STI routine. The Reset and Rate Gain parameteres will be in error if this bit is set.

Derivative (Rate) Action Bit DA (word 0, bit 07)

When this bit is set, the Derivative (Rate) calculation is evaluated on the Error instead of the PV. When this bit is cleared, the Derivative (Rate) calculation is performed by PV. This bit is only used by the SLC 5/03 and SLC 5/04 processors.

DB, Set When Error is in DB (word 0, bit 08)

This bit is set when the Process Variable is within the 0 crossing Deadband range.

Output Alarm, Upper Limit UL (word 0, bit 09)

This bit is set when the calculated control output CV exceeds the upper CV limit.

Output Alarm, Lower Limit LL (word 0, bit 10)

This flag is the same as the upper limit except the bit is set when the calculated control output CV exceeds the lower CV limit.

Setpoint Out of Range SP (word 0, bit 11)

The Setpoint Out of Range bit is set when the Setpoint exceeds the maximum scaled value or is less than the minimum scaled value.

Process Var Out of Range PV (word 0, bit 12)

This bit is set when the unscaled Process Variable exceeds 16383 or is less than zero.

PID Done DN (word 0, bit 13)

This is set on scans when the PID algorithm is computed. It is computed at the Loop Update rate.

PID Enabled EN (word 0, bit 15)

This bit is set when the rung which contains the PID instructions is enabled.

Jump to the Control Block Diagram to see where these bits are placed.

[Main Course Page] [Group Index]