51872020 ‘Tuning PID Control by Simulation
MICROSTAR Tuning PID Control by Simulation
LABORATORIES’
cwticanl meligene since 1982 Technical Note TN-031 Version 1.10
Home View more Control information.
Products Introduction
‘Applications The PID1 command of DAPL provides a compact and simple pelted Product
ase Studies ‘means to implement a single variable PID (Proportional-integral-
coum Derivative) controller. Since a controller defined by DAPL is @
Seoul software task, rather than specialized hardware, one Data
ose ‘Acquisition Processor™ can control many processes as easily as
software one. A control system using DAPL can also take advantage of the
Techniques high speed data capture, interactive graphics displays, data
lagging, and process monitoring features that a Data Acquisition
ltepted mers (099i, and proces
Documents Control and montor many channels witha
ena The performance characteristics ofthe controller and the system DaPserver package
ia to be controlled are both important, This Technical Note will help
IschnlcalNetes to explain how a DAPL PID1 task operates in a process control system, and how to tune parameters using a
anvals simplified process model, Examples at the end of this nate illustrate the tuning technique for three types of
PressRalaases — S7SROME
Support Control Systems Background ~ The Regulation Problem
Contacts Ina regulated system, an input signal called the setpoint specifies the desired response level atthe system
« output. The output could be a temperature, the flow rate in a pipe, or the position of a cutting tool, o name just
‘ompany a few possibilities. In a perfect world, you would provide the setpoint signal to the system input, and it would
Search immediately provide the desired output level. This configuration, sometimes called open loop control, is
illustrated in Figure 1
desired
setpoint —_,|
m idesl System response level
Figure 1. Ideal system and open loop control.
Very often, real processes cannot be operated in this way. The output may drift away from the setpoint for a
variety of reasons, or may respond too slowly to changes, or may oscillate too much in response to transient
changes. In these situations, the output of the system can be measured and processed by a separate
controller (sometimes called a regulator). The controller compares the system output to the setpoint level to
determine a new control input for the system. This configuration, called closed loop control, is illustrated in
Figure2.
desired
setpoint. ——]
e Controller system response
rl level
Figure 2. Typical system under closed loop control.
Various strategies have been used to implement the controller, Three of the most common are:
+ (P) Proportional error correction. The difference between the setpoint and actual system output is.
‘amplified and fed back to provide the correction signal. The larger the deviation from the setpoint, the
larger the correction signal
+ (V) Integral error correction. Persistent differences between the setpoint and actual system output,
accumulate over time, until they become large enough to drive the system output back toward the
setpoint.
+ (D) Derivative error correction. The correction signal opposes rapid deviations in system output, reducing
the response to disturbances and transient conditions
wm [Link]/[Link] a051872020 ‘Tuning PID Control by Simulation
There is nothing that requires these strategies to be utilized in isolation. Usually, some combination provides
better performance. The multipliers P, and D specify the degree to which each of the correction terms affects
‘the controllers output. Figure 3 shows a simplified block diagram of a PID controller.
feedback
Figure 3. Simplified block diagram of the DAPL PID1 controller.
‘Another common nomenclature for PID control parameters is given below. The configuration is the same as
Figure 3, with parameter conversions given by:
+ Pak Ke/ Ti KoTa
+ Ke=P Ty=P/1 Tg=D/P
Applying the PID1 Processing Command
The DAPL implementation of PID in the PID1 command is slightly different from a conventional PID controller.
The Data Acquisition Processor is a computing device, so instead of operating directly on voltage signals, it
actually operates on digitized samples using fixed-point arithmetic. A detailed block diagram of a DAPL PID
controller is provided in Figure 4
setpoint
“Spa OPES
‘SH T ba
Figure 4. Detailed block diagram of DAPL PID1 controller.
ADAP requires an external sensor to measure the system output and signal conditioning electronics to
Cconvert the measurement to an appropriate voltage for digitization. The sensor and signal conditioning are
represented in Figure 4 by the Si scaling factor. The voltage is typically a single-ended voltage in the range -5
to +5 volts. itis sampled by an A/D converter under control of a DAPL input procedure.
The numerical output of the PID1 task is converted to an output voltage by a D/A converter. The output
voltage range is typically -5 to +5 volts. Figure 4 represents the output range limits as an explicit limiter block
External electronics may be required to convert the output voltage into a signal suitable for driving the system
input. The output scaling introduced by the external electronics is represented by the multiplier So in Figure 4,
If possible, the output scaling should take advantage of the output range limits, to protect system devices
from excessive control signal drive. For good transient response, the scaling also should allow some room for
short-term control signal levels which significantly exceed the normal range.
The PID controller calculations proceed at the rate that data samples are placed into the PID input pipe. The
sampling rate should allow sufficient time for the system to respond between samples, but should be
sufficiently fast for observing system changes as they are happening, In the examples at the end of this note,
‘the controlled processes require a few seconds to respond to input changes, so the PID samples are captured
at tenth of a second intervals. The T notation in Figure 4 represents sampling time.
The Integral and Derivative control calculations do not include the element of time, which must be introduced
by scaling the PID coefficient values. The next few paragraphs will explain how the scaled coefficients P, and
Ds shown in Figure 4 are related to the P and D parameters in Figure 3.
wm [Link]/[Link] 2n051872020
‘Tuning PID Control by Simulation
The integral operation is approximated by summing the values of the error input, and then applying the Ig
‘multiplier. The relationship between the real time system coefficient | and the sampled coefficient Ig is
Wel*T
To understand what this represents, suppose that the sample time T is reduced by half, causing the sample
rate to double, The summation approximating the integral will then be updated twice as often, causing it to
grow twice as fast, Without any correction, this increased growth would lead to a doubling ofthe integral
control effort. The T term in lg above compensates for the faster growth.
The derivative is approximated by differences of consecutive inputs. The relationship between the real time
Derivative coefficient and the sampled Derivative coefficient is
Ds=D/T
‘Again suppose that the sample rate Is doubled, The Derivative term observes the input twice as often, soit
sees changes of roughly half the size at each sampling interval, and without compensation it will produce
about half the effective control response. The 1/T term in Ds above compensates for the smaller change
observed between samples,
The proportional gain parameter is not affected by sample time,
Py=P
Tuning PID Parameters
‘Selecting optimal values for the P and D parameters of a closed loop control system is usually an iterative
process. This process is called PID tuning.
Before tuning begins, verify that all components of the control loop operate correctly. Test input processing
tasks to verify that the measurements of system output are sampled correctly. Test output procedures to
verify that the control output is correctly scaled. Verify that the PID controller processes the sampled input
and produces an output sequence which is consistent withthe input. If possible, verify that the system
responds correctly to its contral input.
Knowing that the components work individually still does not guarantee that they will work together. How do.
you establish initial parameter settings and evaluate closed loop operation without driving the actual system?
You can use the mult-tasking capabilities of DAPL to simulate the essential characteristics of your system
Under closed loop control, using the PID parameters that you specify. Then, when you are satisfied that the
settings are reasonable, you can disconnect the simulated system and connect the real system in its place.
‘The DAPL commands provided in Listing 1 at the end of this note simulate the response of an inertial third-
order linear system under closed loop PID control. The simulated system samples its control input from
‘analog input channel 0 and sends its output level to analog output channel 0. The PID controller samples its
input from analog input channel 1 and produces a control output on analog output channel 1. A sample time
of 1/10 second is used both for the PID controller and for the simulated system,
‘Some simple hardware connections are required to run the simulation. Connect an MSTB 003-01 termination
board to a Data Acquisition Processor. Connect output pin DAC! to input pin $0, to route the output of the
simulated system to the input of the PID control. Connect input pin $1 to output pin DACO, to connect the
input of the simulated system to the output of the PID. After your tuning is completed, remove the connections
to $1 and DAC. Replace them with connections from your system output voltage to SO, and from DACO to
your system control input.
You will want to edit some of the coetficients in Listing 1 to configure the operation of your PID controller and
simulated system. The variables AQ and B3 specify the behavior of the system, in the form of a Laplace
transform
(A2 2+ A1 8+ A0) /(B3 32+ B2 s?+B1 5 +B0)
(Por't worry if you are unfamiliar with Laplace transforms and the s variable; you can use and modify the
Coefficient values from the three test cases at the end of this note.) The SETPT variable specifies the setpoint
The variables PV, IV and DV specify the PID response characteristics, and the variable RAMP sets the
maximum setpoint ramping change per update.
Thats all you need. Download the edited DAPL program, run it under DAPview, and display PSET, PIDIN, and
PIDOUT. The setpoint level will plot as a blue line, the system response will plot as a red line, and the PID
wm [Link]/[Link] ano51872020 ‘Tuning PID Control by Simulation
control output will plot as a green line on your DAPview display,
Test Cases
The following test cases illustrate PID control for three typical systems. These cases show the capabilities
and the side effects of each of the three kinds of feedback control. The units on the vertical scale of the
output plots shown in Figures 5 through 15 represent the digital values provided to the D/A output stage. In
‘the figures, the system response is plotted as a bold line, and the PID control output is plotted as a thin line.
The controller is limited to the range -20,000 to 20,000 in the test cases. You can edit the system response
and PID control variables as you wish, but the rest ofthe listing should require no changes.
One of the figures for each test case shows the response of the system without PID control. To replicate these