CH 8
CH 8
CH 8
D4-454
PID Loop Calculations
ations
Manufacturing Process
Analog Output
DirectSOFT programming software, release 6.1, or later, is used for configuring analog control
loops in the D4-454. DirectSOFT uses dialog boxes to help you set up the individual loops.
After completing the setup, you can use DirectSOFT’s PID Trend View to tune each loop. The
configuration and tuning selections you make are stored in the D4-454’s V-memory , which
can be set as retentive. The loop parameters also may be saved to disk for recall later.
69° SETPOINT
67°
ON ON ON
TIME
The ON-OFF controller is used in some industrial control applications, but is not practical in
the majority of industrial control processes.
The most common process controller that is used in industry is the PID controller.
The PID controller controls a continuous feedback loop that keeps the process output (control
variable) flowing normally by taking corrective action whenever there is a deviation from the
desired value (setpoint) of the process variable (PV) such as, rate of flow, temperature, voltage,
etc. An error occurs when an operator manually changes the setpoint or when an event (valve
opened, closed, etc.) or a disturbance (cold water, wind, etc.) changes the load, thus causing a
change in the process variable.
The PID controller receives signals from sensors and computes corrective action to the actuator
from a computation based on the error (Proportional), the sum of all previous errors (Integral)
and the rate of change of the error (Derivative).
We can look at the PID controller in more simple terms. Take the cruise control on an
automobile as an example. Let’s say that we are cruising on an interstate highway in a car
equipped with cruise control. The driver decides to engage the cruise control by turning it
ON, then he manually brings the car to the desired cruising speed, say 70 miles per hour. Once
the cruise speed is reached, the SET button is pushed fixing the speed at 70mph, the setpoint.
Now, the car is cruising at a steady 70mph until it comes to a hill to go up. As the car goes up
the hill, it tends to slow down. The speed sensor senses this and causes the throttle to increase
the fuel to the engine. The vehicle speeds up to maintain 70mph without jerking the car and
it reaches the top at the set speed. When the car levels out after reaching the top of the hill it
will speed up. The speed sensor senses this and signals the throttle to provide less fuel to the
engine, thus, the engine slows down allowing the car to maintain the 70mph speed. How does
this application apply to PID control? Lets look at the function of P, I and D terms:
• Proportional - is commonly referred to as Proportional Gain. The proportional term is the corrective
action which is proportional to the error, that is, the change of the manipulated variable is equal to
the proportional gain multiplied by the error (the activating signal). In mathematical terms:
Proportional action = proportional gain X error
Error = Setpoint (SP) - Process Variable (PV)
• Applying this to the cruise control, the speed was set at 70mph which is the Setpoint. The speed
sensor senses the actual speed of the car and sends this signal to the cruise controller as the Process
Variable (PV). When the car is on a level highway, the speed is maintained at 70mph, thus, no error
since the error would be SP - PV = 0. When the car goes up the hill, the speed sensor detected a
slow down of the car, SP-PV = error. The proportional gain would cause the output of the speed
controller to bring the car back to the setpoint of 70mph. This would be the Controlled Output.
• Integral - this term is often referred to as Reset action. It provides additional compensation to the
control output, which causes a change in proportion to the value of the error over a period of time.
In other words, the reset term is the integral sum of the error values over a period of time.
• Derivative - this term is referred to as rate. The Rate action adds compensation to the control
output, which causes a change in proportion to the rate of change of error. Its job is to anticipate the
probable growth of the error and generate a contribution to the output in advance.
The analog input module receives the process variable in analog form along with an operator
entered setpoint; the CPU computes the error. The error is used in the algorithm computation
to provide corrective action at the control output. The function of the control action is based
on an output control, which is proportional to the instantaneous error value. The integral
control action (reset action) provides additional compensation to the control output, which
causes a change in proportion to the value of the change of error over a period of time. The
derivative control action (rate change) adds compensation to the control output, which causes
a change in proportion to the rate of change of error. These three modes are used to provide
the desired control action in Proportional (P), Proportional-Integral (PI), or Proportional-
Integral-Derivative (PID) control fashion.
Standard DL405 analog input modules are used to interface to field transmitters to obtain the
PV. These transmitters normally provide a 4–20 mA current or an analog voltage of various
ranges for the control loop.
For temperature control, thermocouple or RTD can be connected directly to the appropriate
module. The PID control algorithm, residing in the CPU memory, receives information from
the user program, primarily control parameters and setpoints. Once the CPU makes the PID
calculation, the result may be used to directly control an actuator connected to a 4-20mA
current output module to control a valve.
With DirectSOFT, additional ladder logic programming, both time proportioning (e.g.,
heaters for temperature control) and position actuator (e.g., reversible motor on a valve) type
of control schemes can be easily implemented. This chapter will explain how to set up the PID
control loop, how to implement the software and how to tune the loop.
The following block diagram shows the key parts of a PID control loop. The path from the
PLC to the manufacturing process and back to the PLC is the closed loop control.
This form of the PID equation is referred to as the position form since the actual actuator
position is computed. The velocity form of the PID equation computes the change in actuator
position. The CPU modifies the standard equation slightly to use the derivative of the process
variable instead of the error as follows:
n
Mn = Kc * en + Ki (ei + Kr (PVn - PVn-1) + Mo
i=1
These two forms are equivalent unless the setpoint is changed. In the original equation, a large
step change in the setpoint will cause a correspondingly large change in the error resulting in a
bump to the process due to derivative action. This bump is not present in the second form of
the equation.
The D4-454 also combines the integral sum and the initial output into a single term called the
bias (Mx). This results in the following set of equations:
Mxo = Mo
Mx = Ki * en + Mxn-1
Mn = Kc * en - Kr(PVn-PVn-1) + Mxn
The D4-454 by default will keep the normalized output M in the range of 0.0 to 1.0. This is
done by clamping M to the nearer of 0.0 or 1.0 whenever the calculated output falls outside
this range. The D4-454 also allows you to specify the minimum and maximum output limit
values (within the range 0 to 4095 in BCD if using 12 bit unipolar).
NOTE: The equations and algorithms, or parts of, in this chapter, are only for references. Analysis of these
equations can be found in most good text books about process control.
Freeze Bias
If the “Freeze Bias” option is selected when setting up the PID loop (discussed later) then the
CPU simply stops changing the bias (Mx) whenever the computed normalized output (M) goes
outside the interval 0.0 to 1.0.
Mx = Ki * en + Mxn-1
M = Kc * en - Kr(PVn - PVn-1) + Mx
Mn = 0 if M < 0
Mn = M if 0 < M < 1
Mn = 1 if M > 1
Mn = 0 if M < 0
Mn = M if 0 < M < 1
Mn = 1 if M > 1
Mxn = 0 if Mx < 0
Mxn = Mx if 0 < Mx < 1
Mxn = 1 if M > 1
Bumpless Transfer
The D4-454 loop controller provides for bumpless mode changes. A bumpless transfer from
manual mode to automatic mode is achieved by preventing the control output from changing
immediately after the mode change.
When a loop is switched from Manual mode to Automatic mode, the setpoint and Bias are
initialized as follows:
• Position PID Algorithm Velocity PID Algorithm
SP = PV SP = PV
Mx = M
The bumpless transfer feature of the D4-454 is available in two types: Bumpless I and Bumpless
II (see page 8-27). The transfer type is selected when the loop is set up.
Loop Alarms
The D4-454 allows the user to specify alarm conditions that are to be monitored for each loop.
Alarm conditions are reported to the CPU by setting up the alarms in DirectSOFT using the
PID setup alarm dialog when the loop is setup. The alarm features for each loop are:
• PV Limit – Specify up to four PV alarm points.
High-High
PV rises above the programmed High-High Alarm Limit.
High PV rises above the programmed High Alarm Limit.
Low PV fails below the Low Alarm Limit.
Low-Low PV fails below the Low-Low Limit.
• PV Deviation Alarm – Specify an alarm for High and Low PV deviation from the setpoint (Yellow
Deviation). An alarm for High High and Low Low PV deviation from the setpoint (Orange
Deviation) may also be specified. When the PV is further from the setpoint than the programmed
Yellow or Orange Deviation Limit the corresponding alarm bit is activated.
• Rate of Change – This alarm is set when the PV changes faster than a specified rate-of-change limit.
• PV Alarm Hysteresis – The PV Limit Alarms and PV Deviation Alarms are programmed
using threshold values. When the absolute value or deviation exceeds the threshold, the
alarm status becomes true. Real-world PV signals have some noise on them, which can
cause some fluctuation in the PV value in the CPU. As the PV value crosses an alarm
threshold, its fluctuations will cause the alarm to be intermittent and annoy process
operators. The solution is to use the PV Alarm Hysteresis feature.
Ts
Y n = Yn-1 + * (PV n - Y n-1 )
Ts + ( Td )
Kd
Position Algorithm
Mx = Ki * en + Mxn-1
M = Kc * en - Kr * (Yn-Yn-1) + Mx
Velocity Algorithm
DM = Kc * (en - en-1) + Ki * en - Kr * (Yn - 2 * Yn-1 + Yn-2)
Channel 3
Channel 4
WARNING: Be sure the Emergency Stop and power-down provision is readily accessible,
in case the process goes out of control. Damage to equipment and/or serious injury to
personnel can result from loss of control of some processes.
NOTE: It is recommended to set the V-memory used to store the PID Setup Parameters to retentive. If
power is removed from the CPU, these parameters will not be written to zero on power up.
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
If you use the DirectSOFT loop setup dialog box, its automatic range checking prohibits
possible setup errors. However, the setup parameters may be written using other methods such
as RLL, so the error flag register may be helpful in those cases. The following table lists the
errors reported in V7642.
As a quick check, if the CPU is in Run mode and V7642=0000, there are no programming
errors.
Bit Error Description (0 = no error, 1 = error)
0 The starting address (in V7640) is out of the lower V-memory range.
1 The starting address (in V7640) is out of the upper V-memory range.
2 The number of loops selected (in V7641) is greater than 16.
3 The loop table extends past (straddles) the boundary at V7377. Use an address closer to V1400.
4 The loop table extends past (straddles) the boundary at V36777. Use an address closer to V10000.
User Data
READ/
Ladder WRITE LOOP
Program DATA
CONFIGURE/
MONITOR
PID Loop
Task
Setup Parameters
READ V7640, V7641
(at powerup)
DirectSOFT 6.1 or later Programming Software
NOTE: The D4-454 CPU’s PID algorithm requires DirectSOFT Version 6.1 (or later) and firmware version 1.0
(or later). See our website for more information: www.automationdirect.com.
Determine the block of V-memory to be used for each PID loop. Besides being the beginning
of the PID parameter memory block, the first address will be the start of loop 1 parameters.
Remember, there are 32 words (0 to 37 octal) needed for each loop. Once you have determined
the beginning V-memory address to be used, you can setup and store the PID parameters either
directly in your RLL program or by the using PID Setup in DirectSOFT.
NOTE: Whether one or more loops are being setup, this block of V-memory will only be used for the PID loop
parameters, do not use this block of memory for anything else in your program.
Using DirectSOFT is the simplest way to setup the parameters. To setup the PID parameters,
the D4-454 must be powered up and connected to the programming computer. The
parameters can only be entered in PID setup when the PLC is in the Program mode. Once
the parameters have been entered and saved for each loop, changes made through the PID
setup can be made, but only in Program Mode. You can type the beginning address in the PID
Table Address dialog found when the PID Setup is opened in DirectSOFT. This can be seen
in the diagram below. After the address has been entered, the memory range will appear. Also,
entering the number of PID loops (1 to 16) will set the total V-memory range for the number
of loops entered. After the V-memory address has been entered, the necessary PID parameters
for a basic loop operation for each loop can be setup with the dialogs made available.
NOTE: Have an edited program open, then click on PLC > Setup > PID to access the Setup PID dialog.
Bits 8–15 must be read as a byte to indicate the current segment number of the Ramp/Soak
generator in the profile. This byte will have the values 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
F, and 10, which represent segments 1 to 16 respectively. If the byte=0, then the Ramp/Soak
table is not active.
Addr Addr
Step Description Step Description
Offset Offset
+ 00 1 Ramp End SP Value + 20 9 Ramp End SP Value
+ 01 1 Ramp Slope + 21 9 Ramp Slope
V–Memory Space + 02 2 Soak Duration + 22 10 Soak Duration
User Data
+ 03 2 Soak PV Deviation + 23 10 Soak PV Deviation
+ 04 3 Ramp End SP Value + 24 11 Ramp End SP Value
V2000 LOOP #1
V2037 32 words + 05 3 Ramp Slope + 25 11 Ramp Slope
LOOP #2 + 06 4 Soak Duration + 26 12 Soak Duration
32 words
+ 07 4 Soak PV Deviation + 27 12 Soak PV Deviation
+ 10 5 Ramp End SP Value + 30 13 Ramp End SP Value
V3000 Ramp/Soak #1
32 words
+ 11 5 Ramp Slope + 31 13 Ramp Slope
+ 12 6 Soak Duration + 32 14 Soak Duration
+ 13 6 Soak PV Deviation + 33 14 Soak PV Deviation
+ 14 7 Ramp End SP Value + 34 15 Ramp End SP Value
V2034 = 3000 Octal
Pointer to R/S table
+ 15 7 Ramp Slope + 35 15 Ramp Slope
+ 16 8 Soak Duration + 36 16 Soak Duration
+ 17 8 Soak PV Deviation + 37 16 Soak PV Deviation
NOTE: If more than 4 loops are programmed, enter a minimum of 0.1 second.
Select Forward/Reverse
It is important to know which direction the control output will respond to the error (SP-
PV), either forward or reverse. A forward (direct) acting control loop means that whenever the
control output increases, the process variable will also increase. The control outputs of most
PID loops are forward acting, such as a heating control loop. An increase in heat applied will
increase the PV (temperature).
A reverse acting control loop is one where an increase in the control output results in a decrease
in the PV. A common example of this would be a refrigeration system, where an increase in the
cooling input causes a decrease in the PV (temperature).
The Transfer Mode
Choose either Bumpless I or Bumpless II to provide a smooth transition of the control output
from Manual Mode to Auto Mode. Choosing Bumpless I will set the SP equal to the PV when
the control output is switched from Manual to Auto. If this is not desired, choose Bumpless II.
The characteristics of Bumpless I and II transfer types are listed in the chart below. Note that
their operation also depends on which PID algorithm you are using, the position or velocity
form of the PID equation. Note that you must use Bumpless Transfer type I when using the
velocity form of the PID algorithm.
Transfer PID Algorithm Manual-to-Auto Auto-to-Cascade
Transfer Type Select Bit 3 Transfer Action Transfer Action
Position Forces Bias = Control Output Forces Major Loop Output =
Bumpless Forces SP = PV Minor Loop PV
Transfer I 0
Velocity Forces SP = PV Forces Major Loop Output =
Minor Loop PV
Bumpless Position Forces Bias = Control Output None
1
Transfer II Velocity None None
The transfer type can also be selected in an RLL program by setting bit 3 of PID Mode 1, V+00
setting as shown.
PID Mode 1 Setting V+00
Bumpless Transfer I/II Select
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The data format determines the numerical interface between the PID loop and the PV sensor
and the control output device. This selects the data format for both the SP and the PV.
Loop Mode
Loop Mode is a special feature that allows the PID loop controller to perform closed-loop
control while the CPU is in the Program Mode. Careful thought must be taken before using
this feature called Independent of CPU mode in the dialog. Before continuing with the PID
setup, a knowledge of the three PID loop modes will be helpful.
The DL405 provides the three standard control modes: Manual, Automatic, and Cascade. The
sources of the three basic variables SP, PV and control output are different for each mode.
In Manual Mode, the loop is not executing PID calculations (however, loop alarms are still
active). With regard to the loop table, the CPU stops writing values to location V+05 (control
output) for that loop. It is expected that an operator or other intelligent source is manually
controlling the output by observing the PV and writing data to the control output as necessary
to keep the process under control. The drawing below shows the equivalent schematic diagram
of manual mode operation.
Input from Operator Manual
Control Output V+05
Loop
Calculation
Auto
In Automatic Mode, the loop operates normally and generates new control output values. It
calculates the PID equation and writes the result in location V+05 every sample period of that
loop. The equivalent schematic diagram is shown below.
Input from Operator Manual
Control Output V+05
Loop
Calculation
Auto
In Cascade Mode, the loop operates as it does in Automatic Mode, with one important
difference. The data source for the SP changes from its normal location at V+02 to using
the control output value, V+05, from another loop. So in Auto or Manual modes, the loop
calculation uses the data at V+02. In Cascade Mode, the loop calculation reads the control
output from another loop’s parameter table, V+05.
As pictured below, a loop can be changed from one mode to another, but cannot go from
Manual Mode directly to Cascade, or vice versa. This mode change is prohibited because a loop
would be changing two data sources at the same time, and could cause a loss of control.
Once the CPU is operating in the Run Mode, the normal operation of the PID loop controller
is to read the loop data and perform calculations on each scan of the RLL program. When the
CPU is placed in the Program Mode, the RLL program halts operation and all PID loops are
automatically put into the Manual Mode. The PID parameters can then be changed if desired.
Similarly, by placing the CPU in the Run mode, the PID loops are returned to the operational
mode which they were previously in, i.e., Manual, Automatic and Cascade. With this selection
you automatically affect the modes by changing the CPU mode.
CPU Modes:
Mode change
Program Run
If bit 15 is set to one, then the loops will run independently of the CPU mode. It is like having
two independent processors in the CPU... one is running the RLL program and the other is
running the process loops.
Having the ability to run loops independently of the RLL program makes it feasible to make a
ladder logic change while the process is still running. This is especially beneficial for large-mass
continuous processes that are difficult or costly to interrupt. The Independent of CPU is the
feature used for this.
If you need to operate the PID loops while the RLL program is halted, in Program Mode,
either select the Independent of CPU mode in the dialog or edit your program to set and reset
bit 15 of PID Mode 1 word (V+00) in your RLL program. If the bit is set to a zero, the loop
will follow the CPU mode; then, when the CPU is placed in the Program Mode, all loops will
be forced into the Manual Mode.
When Independent of CPU mode is used, you should also set the PV to be read directly from
an analog input module. This can easily be done in the PID setup dialog, SP/PV.
You should also select the analog output for the control output
to be transferred to. This is done in the PID setup Output dialog
shown here. The block of information in this dialog is grayed-
out until the box next to Auto transfer to I/O module is checked.
Once checked, enter the slot number where the output module
is residing and then enter the analog output channel number.
NOTE: To make changes to any loop table parameters, the PID loop must be in Manual mode and the
PLC must be stopped. If you have selected to operate the PID loop independent of the CPU mode,
then you must take certain steps to make it possible to make loop parameter changes. You can
temporarily make the loops follow the CPU mode by changing bit 15 to 0. Then, you will be able to
place the loop into Manual Mode using DirectSOFT. After you change the loop’s parameter settings,
restore bit 15 to 1.
You may optionally configure each loop to access its analog I/O (PV and control output) by
placing proper values in the associated loop table registers in your RLL program. The following
figure shows the loop table parameters at V+36 and V+37 and their auto transfer role to access
the analog values directly.
Loop Table
V2036 0X XX Base/Slot /Channel number for PV
V2037 0X XX Base/Slot/Channel number for Output
XX 0X
Channel number 1 to 4
Slot number 1 to 4
Base 0
When these loop table parameters are programmed directly, a value of 0102 in register V2036
directs the loop controller to read the PV data from channel 1 of the analog input. A value of
0000 in either register tells the loop controller not to access the corresponding analog value
directly. In that case, ladder logic must be used to transfer the value between the analog input
and the loop table.
NOTE: When auto transfer to/from I/O is used, the analog data for all of the channels on the analog module
cannot be accessed by any other method, i.e., pointer or multiplex.
SP/PV Addresses
An SP/PV dialog will be made available to setup how the setpoint (SP) and the process variable
(PV) will be used in the loop. If this loop is the minor loop of a cascaded pair, enter that control
output address in the Remote SP from Cascaded Loop Output area. It is sometimes desirable to
limit the range of setpoint values allowed to be entered. To activate this feature, check the
box next to Enable Limiting. This will activate the Upper and Lower fields for the values to be
entered. Set the limits around the SP value to prevent an operator from entering a setpoint
value outside of a safe range. The Square root box is only checked for certain PID loops, such as
a flow control loop. If the Auto transfer from I/O module is selected, a first-order low-pass filter
can be used by checking the Enable Filter box. The filter coefficient is user specified. The use of
this filter is recommended during closed loop auto-tuning. If the Independent format had been
checked previously, make the Data format selections here.
NOTE: The SP/PV dialog can be left as it first appears for basic PID operation.
Check the box next for Auto transfer to I/O module if there is a need to send the control output
to a certain analog output module, as in the case of using the Loop Mode Independent of
CPU Mode; otherwise, the PID output signal cannot control the analog output when the PLC
is not in RUN Mode. If the Auto transfer to I/O module feature is checked, all channels of the
module must be used for PID control outputs. If Independent format has been previously
chosen, the Output Data Format will need to be setup here, that is, select Unipolar or Bipolar
format and the bit structure. This area is not available and is grayed out if Common format has
been chosen (see page 8-26).
WARNING: If the Upper Limit is set to zero, the output will never get above zero. In effect,
there will be no control output. The default value is zero, so this value MUST be changed.
Recall the position and velocity forms of the PID loop equations which were introduced earlier.
The equations basically show the three components of the PID calculation: Proportional Gain
(P), Integral Gain (I) and Derivative Gain (D). The following diagram shows a form of the
PID calculation in which the control output is the sum of the proportional gain, integral
gain and derivative gain. With each calculation of the loop, each term receives the same
error signal value.
Loop Calculation
P
Setpoint Error T erm + Control Output
+ I +
– D +
Process Variable
The P, I and D gains are 4-digit BCD numbers with values from 0000 to 9999. They contain
an implied decimal point in the middle, so the values are actually 00.00 to 99.99. Some gain
values have units – Proportional gain has no unit, Integral gain may be selected in seconds or
in minutes, and Derivative gain is in seconds.
Gain (Proportional Gain) – This is the most basic gain of the three. Values range from 0000
to 9999, but they are used internally as xx.xx. An entry of “0000” effectively removes the
proportional term from the PID equation. This accommodates applications which need
integral-only loops.
Reset (Integral Gain) – Values range from 0001 to 9998, but they are used internally as xx.xx.
An entry of “0000” or “9999” causes the integral gain to be “infinity”, effectively removing
the integrator term from the PID equation. This accommodates applications which need
proportional-only loops. The units of integral gain may be either seconds or minutes, as shown
in the above dialog.
Rate (Derivative Gain) – Values can be entered in the range of 0001 to 9999, but they are
used internally as XX.XX. An entry of “0000” allows removal of the derivative term from
the PID equation (a common practice). This accommodates applications which require only
proportional and/or integral loops. Most control loops will operate as a PI loop.
NOTE: You may elect to leave the tuning dialog blank and enter the tuning parameters in the DirectSOFT
PID View.
Enable Deadband – When selected, the enable deadband function takes a range of small error
values near zero, and simply substitutes zero as the value of the error. If the error is larger than
the deadband range, then the error value is used normally.
Freeze Bias
The term reset windup refers to an undesirable characteristic of integrator behavior which
occurs naturally under certain conditions. Refer to the figure below. Suppose the PV signal
becomes disconnected, and the PV value goes to zero. While this is a serious loop fault, it is
made worse by reset windup. Notice the bias (reset) term keeps integrating normally during
the PV disconnect, until its upper limit is reached. When the PV signal returns, the bias value
is saturated (windup) and takes a long time to return to normal. The loop output consequently
has an extended recovery time. Until recovery, the output level is wrong and causes further
problems.
PV
PV loss PV loss
0
Reset windup Freeze bias enabled
Bias
Output
In the second PV signal loss episode in the figure, the freeze bias feature is enabled. It causes the
bias value to freeze when the control output goes out of bounds. Much of the reset windup is
thus avoided, and the output recovery time is much less.
For most applications, the freeze bias feature will work with the loop as described above. It is
suggested to enable this feature by selecting it in the dialog. Bit 10 of PID Mode 1 Setting
(V+00) word can also be set in RLL.
NOTE: The freeze bias feature stops the bias term from changing when the control output reaches the end of
the data range. If you have set limits on the control output other than the range (i.e, 0–4095 for a unipolar/12-
bit loop), the bias term still uses the end of range for the stopping point and bias freeze will not work.
NOTE: The Alarm dialog can be left as it first appears, without alarm entries. The alarms can then be setup
in the DirectSOFT PID View.
If the process remains out of control for some time, the PV will eventually cross one of the
outer alarm thresholds, named High-high alarm and Low-low alarm. Their threshold values
are programmed using the loop table registers listed above. A High-high or Low-low alarm
indicates a serious condition exists, and needs the immediate attention of the operator.
The PV Absolute Value Alarms are reported in bits 3, 4, 5 PID Mode and Alarm Status V+06
and 6 of the PID Mode and Alarm Status word (V+06) in
the loop table, as shown to the right. We highly recommend Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
using ladder logic to monitor these bits. The bit-of-word High-high Alarm
instructions make this easy to do. Additionally, you can High Alarm
Low Alarm
monitor PID alarms using DirectSOFT. Low-low Alarm
PV Deviation Alarms
The PV Deviation Alarms monitor the PV deviation with respect to the SP value. The deviation
alarm has two programmable thresholds, and each threshold is applied equally above and below
the current SP value. In the figure below, the smaller deviation alarm is called the Yellow
Deviation, indicating a cautionary condition for the loop. The larger deviation alarm is called
the Red Deviation, indicating a strong error condition for the loop. The threshold values use
the loop parameter table locations V+17 and V+20 as shown.
The thresholds define zones, which fluctuate with the SP value. The green zone which surrounds
the SP value represents a safe (no alarm) condition. The yellow zones lie outside the green zone,
and the red zones are beyond those.
The PV Deviation Alarms are reported in bits 7 and 8 of the PID Mode and Alarm Status V+06
PID Mode and Alarm Status word (V+06) in the loop table,
as shown to the right. We highly recommend using ladder Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PV Rate-of-Change Alarm
An excellent way to get an early warning of a process fault is to monitor the rate-of-change of
the PV. Most batch processes have large masses and slowly-changing PV values. A relatively
fast-changing PV will result from a broken signal wire for either the PV or control output, a
SP value error, or other causes. If the operator responds to a PV Rate-of-Change Alarm quickly
and effectively, the PV absolute value will not reach the point where the material in process
would be ruined.
The D4-454 loop controller provides a programmable PV Rate-of-Change Alarm, as shown
below. The rate-of-change is specified in PV units change per loop sample time. This value is
programmed into the loop table location V+21.
Loop Table
PV slope OK PV slope excessive
V+21 XXXX PV Rate-of-Change Alarm
PV
PID Mode and Alarm Status V+06
rate-of-change alarm
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Sample time Sample time
PV Rate of
Change Alarm
As an example, suppose the PV is the temperature for your process, and you want an alarm
whenever the temperature changes faster than 15 degrees/minute. The PV counts per degree
and the loop sample rate must be known. Then, suppose the PV value (in V+03 location)
represents 10 counts per degree, and the loop sample rate is 2 seconds. Use the formula below
to convert our engineering units to counts/sample period:
15 degrees 10 counts / degree 150
Alarm Rate-of-Change = X = = 5 counts / sample period
1 minute 30 loop samples / min. 30
From the calculation result, you would program the value 5 in the loop table for the rate-of-
change. The PV Rate-of-Change Alarm can be independently enabled and disabled from the
other PV alarms, using bit 14 of the PID Mode 1 Setting V+00 word.
The alarm hysteresis feature (discussed next) does not affect the Rate-of-Change Alarm.
PV Alarm Hysteresis
The PV Absolute Value Alarm and PV Deviation Alarm are programmed using threshold
values. When the absolute value or deviation exceeds the threshold, the alarm status becomes
true. Real-world PV signals have some noise on them, which can cause some fluctuation in
the PV value in the CPU. As the PV value crosses an alarm threshold, its fluctuations cause
the alarm to be intermittent and annoy process operators. The solution is to use the PV Alarm
Hysteresis feature.
The PV Alarm Hysteresis amount is programmable from 1 to 200 (binary/decimal). When
using the PV Deviation Alarm, the programmed hysteresis amount must be less than the
programmed deviation amount. The figure below shows how the hysteresis is applied when the
PV value goes past a threshold and descends back through it.
Alarm threshold
Hysteresis
Loop Table
PV
V+22 XXXX PV Alarm Hysteresis
Alarm 1
0
The hysteresis amount is applied after the threshold is crossed, and toward the safe zone. In this
way, the alarm activates immediately above the programmed threshold value. It delays turning
off until the PV value has returned through the threshold by the hysteresis amount.
Alarm Programming Error
The PV Alarm threshold values must have certain
mathematical relationships to be valid. The
PID Mode and Alarm Status V+06
requirements are listed below. If not met, the Alarm
Programming Error bit will be set, as indicated to Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
the right.
Alarm Programming Error
• PV Absolute Alarm value requirements:
Low-low < Low < High < High-high
• PV Deviation Alarm requirements:
Yellow < Red
Loop Calculation Overflow/Underflow Error PID Mode and Alarm Status V+06
Ramp/Soak
R/S (Ramp/Soak) is the last dialog available in the PID setup. The basic PID does not require
any entries to be made in order to operate the PID loop. Ramp/Soak will be discussed in
another section.
Save to disk
Save to PLC
NOTE: It is good practice to save your project after setting up the PID loop by selecting File from the menu
toolbar, then Save project > to disk. In addition to saving your entire project, all the PID parameters are also
saved.
WARNING: Only authorized personnel fully familiar with all aspects of the process should
make changes that affect the loop tuning constants. Using the loop auto tune procedures
will affect the process, including inducing large changes in the control output value. Make
sure you thoroughly consider the impact of any changes to minimize the risk of injury to
personnel or damage to equipment. The auto tune in the D4-454 is not intended to be used
as a replacement for your process knowledge.
Open-Loop Test
Whether you use manual or auto tuning, it is very important to verify basic characteristics of a
newly-installed process before attempting to tune it. With the loop in Manual Mode, verify the
following items for each new loop.
• Setpoint – verify that the SP source can generate a setpoint. Put the PLC in Run Mode
and leave the loop in Manual Mode, then monitor the loop table location V+02 to see the
SP value(s). (If you are using the ramp/soak generator, test it now).
• Process Variable – verify that the PV value is an accurate measurement, and the PV data
arriving in the loop table location V+03 is correct. If the PV signal is very noisy, consider
filtering the input either through hardware (RC low-pass filter), or using the filter in this
chapter.
• Control Output – if it is safe to do so, manually change the output a small amount
(perhaps 10%) and observe its affect on the process variable. Verify the process is direct-
acting or reverse acting, and check the setting for the control output (inverted or non-
inverted). Make sure the control output upper and lower limits are not equal to each other.
• Sample Rate – while operating open-loop, this is a good time to find the ideal sample rate
(see Configure the PID Loop on page 8-25). However, if you are going to use auto tuning,
the auto tuning procedure will automatically calculate the sample rate in addition to the
PID gains.
• Adjust the gains so the Proportional Gain = 0.5 or 1.0 (1.0 is a good value based on
experience), Integral Gain = 9999 (this basically eliminates reset) and Derivative Gain =
0000. This disables the integrator and derivative terms, and provides some proportional
gain.
• Check the bias value in the PID View and set it to zero.
• Set the SP to a value equal to 50% of the full range.
• Now, select Auto Mode. If the loop will not stay in Auto Mode, check the troubleshooting
tips at the end of this chapter. Allow the PV to stabilize around the 50% point of the
range.
SP 50% here
PV
60% here
10% of
SP range
PV response
SP 50% here
PV
• Increase the Proportional gain, for example to 2.0. The control output will be greater and
the response time will be quicker. The trend should resemble the figure below.
• Increase the Proportional gain in small increments, such as 4, 6, 7, etc., until the control
output response begins to oscillate. This is the Proportional gain that should be recorded.
Error
60% here
50% here
SP
PV
• Now, return the Proportional gain to the stable response; for example, 9.7. The error, SP-PV, should
be small, but not at zero.
• Next, add a small amount of Integral gain (reset) in order for the error to reach zero. Begin by using
80 seconds (adjust in minutes if necessary). The error should get smaller.
• Set the Integral gain to a lower value, such as 50 for a different response. If there is no response,
continue to decrease the reset value until the response becomes unstable. See the figure below.
60% here
10% of
SP range
SP 50% here
PV Under-damped PV response
• For discussion, let us say that a reset value of 35 made the control output unstable. Return the
reset value to the stable value, such as 38. Be careful with this adjustment since the oscillation can
destroy the process.
• The control output response should be optimal now, without a Derivative gain. The example
recorded values are: Proportional gain = 9.7 and Integral gain = 38 seconds. Note that the error has
been minimized.
Minimum Oscillations
The foregone method is the most common method used to tune a PID loop. Derivative gain
is almost never used in a temperature control loop. This method can also be used for other
control loops, but other parameters may need to be added for a stable control output.
Test your loop for a high PV of 80% and again for a low PV of 20%, and correct the values if
necessary. Small adjustments of the parameters can make the control output more precise or
more unstable. It is sometimes acceptable to have a small overshoot to make the control output
react quicker.
The derivative gain can be helpful for those control loops which are not controlling temperature.
For these loops, try adding a value of 0.5 for the derivative gain and see if this improves the
control output. If there is little or no response, increase the derivative by increments of 0.5 until
there is an improvement to the output trend. Recall that the derivative gain reacts with a rate
of change of the error.
WARNING: Only authorized personnel fully familiar with all aspects of the process
should make changes that affect the loop tuning constants. Using the loop auto tuning
procedures will affect the process, including inducing large changes in the control output
value. Make sure you thoroughly consider the impact of any changes to minimize the
risk of injury to personnel or damage to equipment. The auto tune in the D4-454 is not
intended to be used as a replacement for your process knowledge.
Once the physical loop components are connected to the PLC, auto tuning can be initiated
within DirectSOFT (see the DirectSOFT Programming Software Manual), and it can be used
to establish initial PID parameter values. Auto tuning is the best “guess” the CPU can do after
some trial tests.
The loop controller offers both closed-loop and open-loop methods. The following sections
describe how to use the auto tuning feature, and what occurs in open and closed-loop auto
tuning.
The controls for the auto tuning function uses bits 5, 6, and 7 in the PID Mode 2 word V+01,
as shown below. DirectSOFT will manipulate these bits automatically when you use the auto
tune feature within DirectSOFT. Or, you may have your ladder logic access these bits directly
for allowing control from another source such as a dedicated operator interface. The individual
control bits allow you to start the auto tune procedure, select PID or PI tuning and select
closed-loop or open-loop tuning. If you select PI tuning, the auto tune procedure leaves the
derivative gain at 0. The Loop Mode and Alarm Status word V+06 reports the auto tune status
as shown. Bit 12 will be on (1) during the auto tune cycle, automatically returning to off (0)
when done.
Auto Tune Function
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PLC System
Process Variable
Control
Setpoint Value Error Term Loop Output Manufacturing
+ Calculation Process
–
Process Variable
NOTE: In theory, the SP value does not matter in this case, because the loop is not closed. However, the
requirement of the firmware is that the SP value must be more than 5% of the PV range from the actual PV
before starting the auto tune cycle (for the D4-454, 12 bit PV should be 205 counts or more below the SP for
forward-acting loops, or 205 counts or more above the SP for reverse-acting loops).
When auto tuning, the loop controller induces a step change on the output and simply observes
the response of the PV. From the PV response, the auto tune function calculates the gains and
the sample time. It automatically places the results in the corresponding registers in the loop
table.
The following timing diagram shows the events which occur in the open-loop auto tuning
cycle. The auto tune function takes control of the control output and induces a 10%-of-span
step change. If the PV change which the loop controller observes is less than 2%, then the step
change on the output is increased to 20%-of-span.
• When Auto Tune starts, step change output m=10%
• During Auto Tune, the controller output reached the full scale positive limit. Auto Tune stopped and
the Auto Tune Error bit in the Alarm word bit turned on.
• When PV change is under 2%, output is changed at 20%. Open Loop Auto Tune Cycle Wave: Step
Response Method.
PV
Tangent Rr = Slope
(%)
SP
Process Wave
Base Line
LrRr
(%)
Lr
(sec.)
Time (sec)
Step Change m=10%
Output Value
(%)
When the loop tuning observations are complete, the loop controller computes Rr (maximum
slope in %/sec.) and Lr (dead time in sec). The auto tune function computes the gains according
to the Zeigler-Nichols equations, shown below:
PID Tuning PI Tuning
P=1.2*im/LrRr P=0.9*im/LrRr
I=2.0* Lr I=3.33* Lr
D=0.5* Lr D=0
Sample Rate = 0.056* Lr Sample Rate = 0.12*Lr
im = Output step change (10% = 0.1, 20% = 0.2)
We highly recommend using DirectSOFT for the auto tuning interface. The duration of each
auto tuning cycle will depend on the mass of the process. A slowly-changing PV will result in a
longer auto tune cycle time. When the auto tuning is complete, the proportional, integral, and
derivative gain values are automatically updated in loop table locations V+10, V+11, and V+12
respectively. The sample time in V+07 is also updated automatically. You can test the validity
of the values the auto tuning procedure yields by measuring the closed-loop response of the
PV to a step change in the output. The instructions on how to do this are in the section on the
manual tuning procedure (located prior to this auto tuning section).
Closed-Loop Auto Tuning
During a closed-loop auto tuning cycle the loop controller operates as shown in the diagram
below.
PLC System
Process Variable
Control
Setpoint V alue Error T erm Loop Output Manufacturing
+ Calculation Process
–
Process Variable
When auto tuning, the loop controller imposes a square wave on the output. Each transition of
the output occurs when the PV value crosses over/under the SP value. Therefore, the frequency
of the limit cycle is roughly proportional to the mass of the process. From the PV response, the
auto tune function calculates the gains and the sample time. It automatically places the results
in the corresponding registers in the loop table.
The following timing diagram shows the events which occur in the closed-loop auto tuning
cycle. The auto tune function examines the direction of the offset of the PV from the SP. The
auto tune function then takes control of the control output and induces a full-span step change
in the opposite direction. Each time the sign of the error (SP – PV) changes, the output changes
full-span in the opposite direction. This proceeds through three full cycles.
This example is direct–acting.
• Mmax = Output Value upper limit setting.
• Mmin = Output Value lower limit setting.
Xo
SP
Process Wave
PV
Output Value
To
PID Cycle PID Cycle
Auto Tune Cycle
When set to reverse–acting, the output will be inverted. When the loop tuning observations are
complete, the loop controller computes To (bump period) and Xo (amplitude of the PV). Then
it uses these values to compute Kpc (sensitive limit) and Tpc (period limit). From these values,
the loop controller auto tune function computes the PID gains and the sample rate according
to the Zeigler-Nichols equations shown below:
Kpc = 4M / (f *X0) Tpc = 0
M = Amplitude of output
PID Tuning PI Tuning
P = 0.45*Kpc P = 0.30*Kpc
I = 0.60*Tpc I = 1.00*Tpc
D = 0.10*Tpc D=0
Sample Rate = 0.014*Tpc Sample Rate = 0.03*Tpc
NOTE: If your PV fluctuates rapidly, you probably need to use the built-in analog filter (see page 8–55) or
create a filter in ladder logic (see example on page 8–56).
The Data View window can be used just as it is shown above for troubleshooting your PID
logic, and it can be most useful when tuning the PID loop.
The PID View will open and appear over the Ladder View which can be brought into view by
clicking on its tab. When using the Data View and the PID View together, each view can be
sized for better use as shown on the facing page.
The two views are now ready to be used to tune your loop. You will be able to see where the
PID values have been set and see the process that it is controlling.
The diagram below illustrates how to use the views to see the current SP, PV and Output
values, along with the other PID addresses. Refer to the Loop Table Definitions page 8-21 for
details of each word in the table. This is also a good data type reference for each word in the
table.
Scale the time axis of the viewing The trend can be cleared and
window by using this input box. restarted from the left at anytime.
Process Variable
and Setpoint trends are
color coded.
When both windows are positioned in this manner, you are able to see where the PID values
have been set and see the process that it is controlling.
PID Mode
Control
PID Mode 1 Setting V+00 Loop Mode and Alarm Status V+06
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Operator’s Panel
Manual
Auto
Mode Request Mode Monitoring
Cascade
PID Mode 1 Setting V+00 Loop Mode and Alarm Status V+06
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PV Analog Filter
A noisy PV signal can make tuning difficult and can cause the control output to be more
extreme than necessary, as the output tries to respond to the peaks and valleys of the PV. There
are two equivalent methods of filtering the PV input to make the loop more stable. The first
method is accomplished using the D4-454’s built-in filter. The second method achieves a
similar result using ladder logic.
The D4-454 Built-in Analog Filter
The D4-454 provides a selectable first-order low-pass PV input filter. We only recommend
the use of a filter during auto tuning or PID control if there is noise on the input signal. You
may disable the filter after auto tuning is complete, or continue to use it if the PV input signal
is noisy.
Bit 2 of PID Mode Setting 2 provides the enable/disable control for the low-pass PV filter
(0=disable, 1=enable). The roll-off frequency of the single-pole low-pass filter is controlled by
using register V+24 in the loop parameter table, the filter constant. The data format of the filter
constant value is BCD, with an implied decimal point 00X.X, as follows:
• The filter constant has a valid range of 000.1 to 001.0. The smaller the filter value, the
greater the filtering performed; for example, the value 001.0 provides no filtering.
• DirectSOFT converts values above the valid range to 001.0 and values below this range
to 000.1
• Values close to 001.0 result in higher roll-off frequencies, while values closer to 000.1
result in lower roll-off frequencies.
NOTE: For information on the Filter Over Time-Binary Ibox IB-402, see the DL405-IBOX-S manual.
Ramp/Soak Generator
Introduction
Our discussion of basic loop operation noted the setpoint for a loop will be generated in
various ways, depending on the loop operating mode and programming preferences. In the
figure below, the ramp/soak generator is one of the ways the SP may be generated. It is the
responsibility of your ladder program to ensure only one source attempts to write the SP value
at V+02 at any particular time.
Setpoint Sources:
Operator Input
Setpoint V+02 Loop Control Output
Ramp/soak generator
+ Calculation
Ladder Program –
Another loop’s output (cascade)
Process Variable
If the SP for your process rarely changes or can tolerate step changes, you probably will not
need to use the ramp/soak generator. However, some processes require precisely-controlled SP
value changes. The ramp/soak generator can greatly reduce the amount of programming required
for these applications.
The terms ramp and soak have special meanings in the
process control industry, and refer to desired setpoint (SP) SP
values in temperature control applications. In the figure to Soak
the right, the setpoint increases during the ramp segment. Ramp
It remains steady at one value during the soak segment.
slope
Complex SP profiles can be generated by specifying a
series of ramp/soak segments. The ramp segments are Time
specified in SP units per second time. The soak time is
also programmable in minutes.
It is instructive to view the ramp/soak generator as a dedicated function to generate SP values,
as shown below. It has two categories of inputs which determine the SP values generated. The
ramp/soak table must be programmed in advance, containing the values that will define the
ramp/soak profile. The loop reads from the table during each PID calculation as necessary. The
ramp/soak controls are bits in a special loop table word that control the real-time start/stop
functionality of the ramp/soak generator. The ladder program can monitor the status of the
ramp soak profile (current ramp/segment number).
Ramp/soak table
Ramp/soak Setpoint Loop Control Output
Ramp/soak controls Generator + Calculation
–
Process Variable
Now that we have described the general ramp/soak generator operation, we list its specific
features:
• Each loop has its own ramp/soak generator (use is optional).
• You may specify up to eight ramp/soak steps (16 segments).
• The ramp soak generator can run any time the PLC is in Run mode. Its operation is independent of
the loop mode (Manual or Auto).
• Ramp/soak real-time controls include Start, Hold, Resume, and Jog.
• Ramp/soak monitoring includes Profile Complete, Soak Deviation (SP minus PV), and current
ramp/soak step number.
The following figure shows an SP profile consisting of ramp/soak segment pairs. The segments
are individually numbered as steps from 1 to 16. The slope of each of the ramp segments may
be either increasing or decreasing. The ramp/soak generator automatically knows whether to
increase or decrease the SP based on the relative values of a ramp’s end points. These values
come from the ramp/soak table.
15 16
13 14 Soak
Ramp
5 6 Soak
Ramp
3 4 Soak
Ramp
Step 1 2 Soak
Ramp
Soak
Ramp
SP
Ramp/Soak Table
The parameters which define the ramp/soak profile for V–Memory Space
a loop are in a ramp/soak table. Each loop may have its
own ramp/soak table, but it is optional. Recall the Loop User Data
The parameters in the ramp/soak table must be user-defined. the most convenient way is to
use DirectSOFT, which features a special editor for this table. Four parameters are required to
define a ramp and soak segment pair, as pictured below.
• Ramp End Value – specifies the destination SP value for the end of the ramp. Use the same data
format for this number as you use for the SP. It may be above or below the beginning SP value, so
the slope could be up or down (we don’t have to know the starting SP value for ramp #1).
• Ramp Slope – specifies the SP increase in counts (units) per second. It is a BCD number from 00.00
to 99.99 (uses implied decimal point).
• Soak Duration – specifies the time for the soak segment in minutes, ranging from 000.1 to 999.9
minutes in BCD (implied decimal point).
• Soak PV Deviation – (optional) specifies an allowable PV deviation above and below the SP value
during the soak period. A PV deviation alarm status bit is generated by the ramp/soak generator.
Ramp End
SP Value Soak PV Ramp/Soak Table
deviation V+00 XXXX Ramp End SP Value
V+01 XXXX Ramp Slope
Slope Soak
SP V+02 XXXX Soak Duration
duration
V+03 XXXX Soak PV Deviation
segment becomes active
The ramp segment becomes active when the previous soak segment ends. If the ramp is the first
segment, it becomes active when the ramp/soak generator is started, and automatically assumes
the present SP as the starting SP.
Many applications do not require all 16 R/S steps. Use all zeros in the table for unused steps.
The R/S generator ends the profile when it finds ramp slope = 0.
Ramp/Soak Controls
The four main controls for the ramp/soak generator are
in bits 0 to 3 of the Ramp/Soak Setting V + 33 word Ramp/Soak Settings V+33
in the loop parameter table. DirectSOFT controls these
bits directly from the ramp/soak settings dialog. However, Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
you must use ladder logic to control these bits during
Jog
program execution. We recommend using the bit-of-
Resume
word instructions.
Hold
Ladder logic must set a control bit to a 1 to command the Start
corresponding function. When the loop controller reads
the ramp/soak value, it automatically turns off the bit for
you. Therefore, a reset of the bit is not required, when the
CPU is in Run Mode.
The example program rung to the right shows how an Start R/S Generator
external switch X0 can turn on, and the PD contact uses X0 B2033.0
the leading edge to set the proper control bit to start SET
the ramp soak profile. This uses the Set Bit-of-word
instruction.
The normal state for the ramp/soak control bits is all zeros. Ladder logic must set only one
control bit at a time.
• Start – a 0 to 1 transition will start the ramp soak profile. The CPU must be in Run Mode, and the
loop can be in Manual or Auto Mode. If the profile is not interrupted by a Hold or Jog command,
it finishes normally.
• Hold – a 0 to 1 transition will stop the ramp/soak profile in its current state, and the SP value will
be frozen.
• Resume – a 0 to 1 transition will cause the ramp/soak generator to resume operation if it is in the
hold state. The SP values will resume from their previous value.
• Jog – a 0 to 1 transition will cause the ramp/soak generator to truncate the current segment (step),
and go to the next segment.
V-memory, one of the bits to the right will turn on when Starting Address set in
reserved system V-memory
the ramp/soak generator is started. We recommend using
Starting Address set out of
DirectSOFT to configure the ramp/soak table. It automatically V-memory upper range
range checks the addresses for you. Starting Address set out
of V-memory lower range
Testing Your Ramp/Soak Profile
It’s a good idea to test your ramp/soak profile before using it to control the process. This is easy
to do, because the ramp/soak generator will run even when the loop is in Manual Mode. Using
DirectSOFT’s PID View will be a real time-saver, because it will draw the profile on-screen for
you. Be sure to set the trending timebase slow enough to display completed ramp-soak segment
pairs in the waveform window.
Cascade Control
Introduction
Using cascaded loops is an advanced control technique, superior to individual loop control in
certain situations. As the name implies, cascade means that one loop is connected to another
loop. In addition to Manual (open loop) and Auto (closed loop) Modes, the D4-454 also
provides Cascaded Mode.
NOTE: Using cascaded loops is an advanced process control technique; therefore, we recommend their use
only for experienced process control engineers.
When a manufacturing process is complex and contains a lag time from control input to
process variable output, even the most perfectly tuned single loop around the process may yield
slow and inaccurate control. It may be the actuator operates on one physical property, which
eventually affects the process variable, measured by a different physical property. Identifying the
intermediate variable allows us to divide the process into two parts as shown in the following
figure.
PROCESS
Intermediate Process
Control input Process A Variable Process B Variable (PV)
The principle of cascaded loops is simply that we add another process loop to more precisely control
the intermediate variable! This separates the source of the control lag into two parts, as well.
The diagram below shows a cascade control system, showing that it is simply one loop nested
inside another. The inside loop is called the minor loop, and the outside loop is called the
major loop. For overall stability, the minor loop must be the fastest responding loop of the
two (try a factor of 10 for a better response time). We do have to add the additional sensor to
measure the intermediate variable (PV for process A). Notice the setpoint for the minor loop
is automatically generated for us, by using the output of the major loop. Once the cascaded
control is programmed and debugged, we only need to deal with the original setpoint and
process variable at the system level. The cascaded loops behave as one loop, but with improved
performance over the previous single-loop solution.
External External
Disturbances Disturbances
Output B/
Setpoint Loop B Setpoint A Loop A Output A Process A Process B
+ Calculation + Calculation (secondary) (primary)
– –
Minor
Major Loop
Loop PV, Process A
PV, Process B
One of the benefits to cascade control can be seen by examining its response to external
disturbances. Remember the minor loop is faster acting than the major loop. Therefore, if a
disturbance affects process A in the minor loop, the Loop A PID calculation can correct the
resulting error before the major loop sees the effect.
You can cascade together as many loops as necessary on the D4-454, and you may have multiple
groups of cascaded loops. For proper operation on cascaded loops you must use the same data
range (12/15 bit) and unipolar/bipolar settings on the major and minor loop.
To prepare a loop for Cascade Mode operation as a minor loop, you must program its remote
Setpoint Pointer in its loop parameter table location V+32, as shown below. The pointer must
be the address of the V+05 location (control output) of the major loop. In Cascade Mode, the
minor loop will ignore its local SP register (V+02), and read the major loop’s control output
as its SP instead.
Major Loop (Auto mode) Minor Loop (Cascade Mode)
Loop Table Loop Table
V+02 XXXX SP V+02 XXXX SP
When using DirectSOFT’s PID View to watch the SP value of the minor loop, DirectSOFT
automatically reads the major loop’s control output and displays it for the minor loop’s SP. The
minor loop’s normal SP location, V+02, remains unchanged.
Now, we use the loop parameter arrangement above and draw its equivalent loop diagram,
shown below.
Remember that a major loop goes to Manual Mode automatically if its minor loop is taken out
of Cascade Mode.
Time-Proportioning Control
The PID loop controller in the D4-454 CPU generates a smooth control output signal across a
numerical range. The control output value is suitable to drive an analog output module, which
connects to the process. In the process control field, this is called continuous control, because the
output is on (at some level) continuously.
While continuous control can be smooth and robust, the cost of the loop components (such
as actuator, heater amplifiers) can be expensive. A simpler form of control is called time-
proportioning control. This method uses actuators which are either on or off (no in-between).
Loop components for on/off-based control systems are lower cost than their continuous control
counterparts.
In this section, we will show you how to convert the control output of a loop to time-
proportioning control for the applications that need it. Let’s take a moment to review how
alternately turning a load on and off can control a process. The diagram below shows a hot-air
balloon following a path across some mountains. The desired path is the setpoint. The balloon
pilot turns the burner on and off alternately, which is his control output. The large mass of air
in the balloon effectively averages the effect of the burner, converting the bursts of heat into a
continuous effect: slowly changing balloon temperature and ultimately the altitude, which is
the process variable.
Desired
Effect
On/Off On
Control Off
If we were to plot the on/off times of the burner in the hot-air balloon, we would probably see
a very similar relationship to its effect on balloon temperature and altitude.
Feedforward Control
Feedforward control is an enhancement to standard closed-loop control. It is most useful for
diminishing the effects of a quantifiable and predictable loop disturbance or sudden change in
setpoint. Use of this feature is an option available to you on the D4-454. However, it’s best to
implement and tune a loop without feedforward, and adding it only if better loop performance
is still needed. The term feedforward refers to the control technique involved, shown in the
diagram below. The incoming setpoint value is fed forward around the PID equation, and
summed with the output.
Feedforward path
kf
+
Setpoint Loop Control Output
+ Calculation +
–
Process Variable
In the previous section on the bias term, we said that “the bias term value establishes a working
region or operating point for the control output. When the error fluctuates around its zero point,
the output fluctuates around the bias value.” Now, when there is a change in setpoint, an error
is generated and the output must change to a new operating point. This also happens if a
disturbance introduces a new offset in the loop. The loop does not really know its way to
the new operating point... the integrator (bias) must increment/decrement until the error
disappears, and then the bias has found the new operating point.
Suppose that we are able to know a sudden setpoint change is about to occur (common in some
applications). We can avoid much of the resulting error in the first place, if we can quickly
change the output to the new operating point. If we know (from previous testing) what the
operating point (bias value) will be after the setpoint change, we can artificially change the
output directly (which is feedforward). The benefits of using feedforward are:
• The SP–PV error is reduced during predictable setpoint changes or loop offset disturbances.
• Proper use of feedforward will allow us to reduce the integrator gain. Reducing integrator
gain gives us an even more stable control system.
Feedforward is very easy to use in the D4-454 loop controller, as shown below. The bias term
has been made available to the user in a special read/write location, at PID Parameter Table
location V+04.
Parameter Table location V+04.
Loop Calculation
kp P
V+04
Setpoint Error T erm + Control Output
+ ki I XXXX Bias Term
+
– +
Process Variable kd D
To change the bias (operating point), ladder logic only has to write the desired value to V+04.
The PID loop calculation first reads the bias value from V+04 and modifies the value based
on the current integrator calculation. Then it writes the result back to location V+04. This
arrangement creates a sort of transparent bias term. All you have to do to implement feed
forward control is write the correct value to the bias term at the right time (see the following
example).
NOTE: When writing the bias term, one must be careful to design ladder logic to write the value only once,
at the moment when the new bias operating point is to occur. If ladder logic writes the bias value on every
scan, the loop’s integrator is effectively disabled.
Feedforward Example
How do we know when to write to the bias term, and what value to write? Suppose we have an
oven temperature control loop, and we have already tuned the loop for optimal performance.
Refer to the figure below. We notice that when the operator opens the oven door, the
temperature sags a bit while the loop bias adjusts to the heat loss. Then, when the door closes,
the temperature rises above the SP until the loop adjusts again. Feedforward control can help
diminish this effect.
Oven Closed
Open Closed
door
PV PV sags
PV excess
Bias
First, we record the amount of bias change the loop controller generates when the door opens
or closes. Then, we write a ladder program to monitor the position of an oven door limit
switch. When the door opens, our ladder program reads the current bias value from V+04, adds
the desired change amount, and writes it back to V+04. When the door closes, we duplicate
the procedure, but subtracting desired change amount instead. The following figure shows the
results.
Oven Closed
Open Closed
door
PV
Feed-forward Feed-forward
Bias
The step changes in the bias are the result of our two feed-forward writes to the bias term. We
can see the PV variations are greatly reduced. The same technique may be applied for changes
in setpoint.
LDF
X14
K3
OUTX
CH 1 Input
Store the binary value for Ch.1 input into the V-memory for PID loop 1 process value, PV V2000
On
SP1 LD
2
CH 1 Input
V2000
OUT
Loop 1 PID PV
V3003
Store PID loop 1 control value, CV, (binary format) to a V-memory location for use in the
program.
On
SP1 LD
Maintenance
3
Loop 1 PID Output
V3005
OUT
V4000
The setpoint (SP) value stored in V-memory is converted from BCD to binary and stored to
PID loop 1 setpoint, SP.
NOTE: The value stored in V1400 must be in the same scale as the PV value.
On
SP1 LD
4
V1400
BIN
OUT
Loop 1 PID SP
V3002
7 ( END )
8 ( NOP )
.
Note that the modules used in the PID loop example program were set up for binary format.
They could have been set up for BCD format. In the later case, the BCD data would have to
be converted to binary format before being stored to the setpoint and process variable, and the
control output would have to be converted from binary to BCD before being stored to the
analog output.
By following the steps outlined in this chapter, you should be able to setup workable PID
control loops. The DirectSOFT Programming Software Manual provides more information
for the use of PID View.
For a step-by-step tutorial, go to the Technical Support section located on our website,
automationdirect.com. Once you are at the website, click on Technical Support Home. After
this page opens, find and select Guided Tutorials located under the Using Your Products
column. An Animated Tutorial page will open. Under Available Tutorials, find PID Trainer
and select View the Powerpoint slide show and begin viewing the tutorial. The Powerpoint
Viewer can be downloaded if your computer does not have Powerpoint installed.
Troubleshooting Tips
Q. The loop will not go into Automatic Mode.
A. Check the following for possible causes:
• A PV alarm exists, or a PV alarm programming error exists.
• The loop is the major loop of a cascaded pair, and the minor loop is not in Cascade Mode.
Q. The Control Output stays at zero constantly when the loop is in Automatic
Mode.
A. Check the following for possible causes:
• The Control Output upper limit in loop table location V+31 is zero.
• The loop is driven into saturation, because the error never goes to zero value and changes
(algebraic) sign.
Q. The Ramp/Soak Generator does not operate when I activate the Start bit.
A. Check the following for possible causes:
• The Ramp/Soak enable bit is off. Check the status of bit 11 of loop parameter table
location V+00. It must be set =1.
• The hold bit or other bits in the Ramp/Soak control are on.
• The beginning SP value and the first ramp ending SP value are the same, so first ramp
segment has no slope and consequently has no duration. The ramp/soak generator moves
quickly to the soak segment, giving the illusion the first ramp is not working.
• The loop is in Cascade Mode, and is trying to get the SP remotely.
• The SP upper limit value in the loop table location V+27 is too low.
• Check your ladder program to verify it is not writing to the SP location (V+02 in the loop
table). A quick way to do this is to temporarily place an end coil at the beginning of your
program, then go to PLC Run Mode, and manually start the ramp/soak generator.
Q. The PV value in the table is constant, even though the analog module receives
the PV signal.
A. Your ladder program must read the analog value from the module successfully and write it
into the loop table V+03 location. Verify the analog module is generating the value, and the
ladder is working.
Q. The Derivative gain doesn’t seem to have any affect on the output.
A. The derivative limit is probably enabled (see section on derivative gain limiting).
Q. The SP and PV values I enter with DirectSOFT work okay, but these values
do not work properly when the ladder program writes the data.
A. The PID View in DirectSOFT lets you enter SP, PV, and Bias values in decimal, and
displays them in decimal for your convenience. For example, when the data format is 12 bit
unipolar, the values range from 0 to 4095. However, the loop table actually requires these in
hex, so DirectSOFT converts them for you. The values in the table range from 0 to FFF, for
12-bit unipolar format. Your ladder program must convert constant values from their BCD
format (when entered as Kxxxx) to binary with the BIN instruction or you must enter them in
the constant field (Kxxxx) as the hex equivalent of the decimal value.
Q. The loop seems unstable and impossible to tune, no matter what gains I use.
A. Check the following for possible causes:
• The loop sample time is set too long. Refer to the section near the front of this chapter on
selecting the loop update time.
• The gains are too high. Start out by reducing the derivative gain to zero. Then reduce the
integral gain, and the proportional gain if necessary.
• There is too much transfer lag in your process. This means the PV reacts sluggishly to
control output changes. There may be too much “distance” between actuator and PV
sensor, or the actuator may be weak in its ability to transfer energy into the process.
• There may be a process disturbance that is over-powering the loop. Make sure the PV is
relatively steady when the SP is not changing.
PID Loop A mathematical method of closed-loop control involving the sum of three terms based on
proportional, integral, and derivative error values. The three terms have independent gain constants,
allowing one to optimize (tune) the loop for a particular physical system.
Position Algorithm The control output is calculated so it responds to the displacement (position) of the
PV from the SP (error term)
Process A manufacturing procedure which adds value to raw materials. Process control particularly refers
to inducing chemical changes to the material in process.
Process Variable (PV) A quantitative measurement of a physical property of the material in process,
which affects final product quality and is important to monitor and control.
Proportional Gain A constant that determines the magnitude of the PID proportional term in response
to the current error.
PV Absolute Alarm A programmable alarm that compares the PV value to alarm threshold values.
PV Deviation Alarm A programmable alarm that compares the difference between the SP and PV values
to a deviation threshold value.
Ramp/Soak Profile A set of SP values called a profile, which is generated in real time upon each loop
calculation. The profile consists of a series of ramp and soak segment pairs, greatly simplifying the task of
programming the PLC to generate such SP sequences.
Rate Also called differentiator, the rate term responds to the changes in the error term.
Remote Setpoint The location where a loop reads its setpoint when it is configured as the minor loop in
a cascaded loop topology.
Reset Also called integrator, the reset term adds each sampled error to the previous, maintaining a running
total called the bias.
Reset Windup A condition created when the loop is unable to find equilibrium, and the persistent error
causes the integrator (reset) sum to grow excessively (windup). Reset windup causes an extra recovery
delay when the original loop fault is remedied.
Reverse-Acting Loop A loop in which the PV increases in response to a control output decrease. In other
words, the process has a negative gain.
Sampling time The time between PID calculations. The CPU method of process control is called a
sampling controller, because it samples the SP and PV only periodically.
Setpoint (SP) The desired value for the process variable. The setpoint (SP) is the input command to the
loop controller during closed loop operation.
Soak Deviation The soak deviation is a measure of the difference between the SP and PV during a soak
segment of the Ramp/Soak profile, when the Ramp/Soak generator is active.
Step Response The behavior of the process variable in response to a step change in the SP (in closed loop
operation), or a step change in the control output (in open loop operation)
Transfer To change from one loop operational mode to another (between Manual, Auto, or Cascade).
The word “transfer” probably refers to the transfer of control of the control output or the SP, depending
on the particular mode change.
Velocity Algorithm The control output is calculated to represent the rate of change (velocity) for the PV
to become equal to the SP.
Bibliography
Fundamentals of Process Control Theory, Second Edition Application Concepts of Process Control
Author: Paul W. Murrill Author: Paul W. Murrill
Publisher: Instrument Society of America Publisher: Instrument Society of America
ISBN 1–55617–297–4 ISBN 1–55617–080–7
PID Controllers: Theory, Design, and Tuning, 2nd Edition Author: Fundamentals of Temperature, Pressure, and Flow Measurements,
K. Astrom and T Hagglund Third edition
Publisher: Instrument Society of America Author: Robert P. Benedict
ISBN 1–55617–516–7 Publisher: John Wiley and Sons
ISBN 0–471–89383–8
Process / Industrial Instruments & Controls Handbook, Fourth pH Measurement and Control, Second Edition
Edition Author: Gregory K. McMillan
Author (Editor-in-Chief): Douglas M. Considine Publisher: Instrument Society of America
Publisher: McGraw-Hill, Inc ISBN 0-07-012445-0 ISBN 1–55617–483–7
Programmable Controllers Concepts and Applications, First Edition Fundamentals of Programmable Logic Controllers, Sensors, and
Authors: C.T. Jones and L.A. Bryan Communications
Publisher: International Programmable Controls Author: Jon Stenerson
ISBN 0-915425-00-9 Publisher: Prentice Hall ISBN 0-13-726860-2
Process Control, Third Edition Instrument Engineer’s Handbook Process Measurement and Analysis, Third Edition Instrument
Author (Editor-in-Chief): Bela G. Liptak Engineer’s Handbook
Publisher: Chilton ISBN 0–8019–8242–1 Author (Editor-in-Chief): Bela G. Liptak
Publisher: Chilton ISBN 0–8019–8197–2