Sunteți pe pagina 1din 13

Understanding Proportional, Integral, and Derivative Control

REV 1
For ME 4031 by Adam A. Krzmarzick

---------------------------------------------------------------------------------------------------------------------

SUMMARY

This document aims to provide an intuitive understanding of PID control fundaments.

---------------------------------------------------------------------------------------------------------------------

Contents
Introduction and Motivation..................................................................................................................................2
Control Systems...................................................................................................................................................2
Open Loop versus Closed Loop Control Systems.....................................................................................2
PID Parameters..........................................................................................................................................................3
Proportional Action Term..................................................................................................................................3
Integral Action Term...........................................................................................................................................3
Integral Windup...............................................................................................................................................5
Derivative Action Term......................................................................................................................................6
Noise Amplification due to Differentiation.............................................................................................6
Continuous Mathematical Representation of the PID Parameters........................................................7
Discretized Mathematical Representation of the PID Parameters........................................................8
Transfer Function and Laplace Representation........................................................................................11
Tuning........................................................................................................................................................................12
Command Tracking and Disturbance Rejection......................................................................................12
Enhancing PID control.........................................................................................................................................13
Conclusion................................................................................................................................................................13
Reference Documents...........................................................................................................................................13
Introduction and Motivation
Control Systems
Controls systems come in a wide variety of configurations, but one aspect they all have in
common is task automation. Some may be entirely automated requiring no user input, while
others may seek continual user input to produce the desired automated output. Examples of
control systems include household temperature control, cruise control, artificial hearts, robots,
washing machines, and all automated manufacturing processes. A backhoe or a skid-steer is also
a control system, where the operator is the controller. These few examples only scratch the
surface, as control systems intertwine the lives of average citizens and permeate the entire
engineering world.

Open Loop versus Closed Loop Control Systems


Control systems can be grouped into two general classes: open loop systems and closed loop
systems. Open loop control systems make automated decisions without any knowledge or
feedback from the device or condition they are controlling, while closed loop systems make
automated decisions based on signals received from one or more sensors that are monitoring the
device or the condition that is being controlled. The structure of an open loop system is shown in
Figure 1 and that of a closed loop system is shown in Figure 2.

Input Signal Amplifier System Input Signal System System Output

Figure 1: Open Loop Control System

Set Point (Reference)


åå Measured Error Controller System Input Signal
System System Output

Measured Output Sensor

Figure 2: Closed Loop Logic Structure

A closed loop control system has a reference value, also known as the set point. The reference is
a parameter that the operator must specify. For instance, if it is desired to maintain a transplant
organ at 40.0°F, the technician would specify 40.0°F as the set point on the refrigeration unit.
The sensor, perhaps a thermocouple, would send a signal that would be converted to a
temperature reading. This reading would then be compared with the user specified set point. The
deviation between the reading and the set point, known as the measured error, is sent to a
controller unit. Based on the magnitude and the sign of this error signal, the controller algorithms

2
decide what magnitude of output signal should be sent to the system to correct for the measured
error. Even in the event of a system disturbance, such as the cooler being transferred to a warmer
room, the closed loop feedback system continuously corrects for any deviation from the set
point.

The concept of a closed loop control system is straightforward and its utility in a wide range of
applications is evident. However, it is possible that some uncertainty exists regarding the logic
that is programmed into the control unit.

PID Parameters

Proportional Action Term


By definition, every type of closed loop control system uses knowledge of error (deviation from
set-point) to make a corrective decision. The most commonly used feedback controller is a
proportional-integral-derivative (PID) controller. PID controllers are generic; that is, in theory
they can be used to control any system that has a desired set point, a measureable output, and a
means to adjust the output. The exceptional utility of a PID type control system lies in the
method it employs to decide on a corrective response, based on its knowledge of the system
error. An intuitive means of correcting for system error would be to output a real-time corrective
signal that is directly proportional to the real-time system error. If zero system error is measured,
no change in the controller's output signal will be made; however, if a large system error is
measured, an aggressive increase or decrease in the controller's output signal will be made. This
is the idea of proportional gain. By itself, proportional gain can offer satisfactory system control
is some situations. If the gain is set too high, overly aggressive corrective action may result,
causing the system to overshoot the set-point in an oscillatory manner. This aggressive and
possibly damaging oscillation is called system instability, and as mentioned, can result from the
gain (proportional coefficient, !!) being assigned too large of a value.

Integral Action Term


In addition to a proportional corrective action term, PID control incorporates an integral corrective
action term. This integral term, also referred to as the reset term, calls for a corrective action to be
made that is proportional to the integral of error over time. This can be thought of as taking
corrective action in proportion to accumulation of past error. Let us now look at a quick example of
why integral gain is often necessary. Imagine there is a ship that is to be steered in a straight line, due
west in Figure 3. The control system to automatically accomplish this steering only has proportional
gain. That is, the corrective signal sent by the controller is directly proportional to the deviation from
the desired course. This logic seems reasonable and the ship should stay on course, right? Not
exactly. Imagine that a gale force wind starts blowing from the north. This gale introduces a constant
disturbance to the system; this disturbance balances in a compromising manner with the proportional
corrective signal from the controller. This balance between the constant disturbance and the
proportional gain could result in a straight line of travel
3
that deviates from the desired course by a constant distance. A properly tuned integral term
works to cancel this constant deviation, referred to as offset or droop.

Proportionally
Controlled Ship

GALE!
GALE!
GALE!

The offset between the courses


results from a balance between
the continual disturbance and
Desired Course
the proportional corrective
Actual Course signal. Adding integral control
would work to eliminate the
offset between the desired
course and the actual course.

Figure 3: Offset (also known as droop) condition due to lack of integral control: Ship analogy

Perhaps this is a more clear way to understand the concept:


Think of the proportional action term to be a spring with natural length !!, where !! can be thought of as the set-point. Upon any deviation from !!,
a corrective force will arise that is in proportion to the magnitude of the deviation. A momentary disturbance will briefly perturb the spring, but
the spring will quickly settle back to its natural length. However, a continual disturbance would balance with the corrective spring force and the

spring would remain at !! instead of the desired !!. (Figure 4 shows an illustration of the scenario.) An integral action term could be implemented
to solve such a problem. The integral term would track the integral formed by the magnitude of deviation from !! with respect to time, and it
would implement a corrective action force proportional to the integral. As with the ship example, the integral term would work to eliminate offset

4
Constant Disturbance
Natural Length (Analogous to Set-point)

Offset
The proportional
spring force balances
with the constant
disturbance, resulting
in a constant offset or
droop.

Figure 4: Spring Example to illustrate the demand for integral control to complement proportional control

Integral Windup
A notable problem that can arise from the integral gain is integral windup, also referred to as
integral saturation. Windup occurs when the integral of the error with respect to time becomes
large, during a change in set-point for example. Even once the new set point is reached, the
integral term will demand a corrective action proportional to the accumulated error, causing a
potentially aggressive overshoot of the set point. The integral term will provide a pull to
overshoot until all of the integral-error of a particular sign has been "unwound" or cancelled by
integral-error of the opposite sign. The proportional and derivative terms will fight to limit the
over shoot, but may not be able to do so satisfactorily if the windup is especially aggressive.
Figure 5 shows a visual of the cause and consequence of excessive windup.

5
Set Point and Process Variable Values

Set Point

Process Variable

Integral Error

Time

Figure 5: Integral Windup Diagram

Several actions can be taken to solve the problem of windup. Some of these actions include:

1) Implementing bounds for the allowed magnitude of the integral term


2) Truncating the integral so it only includes error accumulated over a fixed depth of time. In other words, the
left bound of the integral moves with time, rather than being fixed at ! = 0.

3) Turning off the integral term when implementing set point changes.

4) Increasing the set point as a ramp function rather than as a step function.

Derivative Action Term


Lastly, there is a term in PID control that dictates corrective action that is proportional to the rate
of change of real-time error. This rate of change of real-time error can be thought of as a
prediction of future error. The function of the derivative term is to "pull back" any process
variable in proportion to the rate at which it is deviating. This function serves to increase the
speed of controller response to an error.

Noise Amplification due to Differentiation


Consider the signal !(!) shown in Equation 1.

! ! = !!sin (!!!) + !"#$% ! = !!sin (!!!) + !!sin (!!!)

Equation 1: Sinusoidal input signal with a noise component

6
!"
= ! ω cos ! ! + ! ! !"#! !
!" ! ! ! !! !

Equation 2: Derivative of the input signal and the noise component


Now notice, in Equation 1 the signal to noise ratio of the original signal is !! , while in Equation
!
!
!! !!
2, the signal to noise ratio of the differentiated signal is . It is evident that for noise
!! !!

! !! !
components with frequencies much higher than the signal frequency, the noise component can come to dominate the differentiated signal. That is, the ratio can be arbitrarily small if !! is
!! !!

large. For this reason, one must use care to ensure that the differentiated signal is not saturated
with noise. Filters and other more in depth modifications to the derivative term can be
implemented to help solve the problem of noise amplification.
As is shown below in Equation 11, the transfer function ! ! = ! of the differential term tends to infinity for large values of !.

Continuous Mathematical Representation of the PID Parameters


PID control dictates an overall corrective action based on the weighted sum of the
corrective actions calculated from knowledge of past, present, and future errors.

However, some systems require only one or two terms to provide necessary system control. For
example, some systems only need PI, PD, P, or I control. The mathematical expressions that
represent each PID term follow directly from the descriptions given in the preceding paragraphs.
!!"# = !!!(!)

!!"#: !ℎ ! !"#!#"$%#&'( !"#$ !" !"#$"#


!!: !"#!#"$%#&'( !"#$, ! !"#$#% !"#"$%&%#

! ! : !""#" !" !"#$ ! = !" − !" = !"#$%"! − !"#$!%

!": !"#$%&'#, !ℎ! !"#$%"! !"#$%

!": !"#$%&& !"#$"%&', !ℎ ! !"#$%&"' !"#$%


! = !"#$ (!ℎ! !"#$#%&)

Equation 3: Proportional Term, Continuous


!

!!"# = !! ! ! !"
!

!!"#: !ℎ ! !"#$%&'( !"#$ !" !"#$"#


!!: !"#$%&'( !"#$, ! !"#$#% !"#"$%&#
! = !"##$ !"#$"%&' !" !"#$%&'#!("

! ! : !""#" = !" − !" (!"" !"#$%)


! = !"#$ (!ℎ! !"#$#%&)

7
Equation 4: Integral Term, Continuous
!
!
!"# = !! !" !(!)

!!"#: !ℎ! !"##$%&'$%" !"#$ !" !"!"#!


!!: derivative !"#$, ! !"#$#% !"#"$%&%#

! ! : !""#" = !" − !" (!"" !"#$%)

Equation 5: Derivative term, Continuous


!
!

!(!)
! ! = !!"# + !!"# + !!"# = !!! ! + !! ! ! !" + !!
!"
!

u t : controller output

Equation 6: Combining Equations 3 through 5 gives the controller output u(t)

Discretized Mathematical Representation of the PID Parameters


Computers cannot handle analog (continuous) signals; rather, the analog signal must be
converted to a discretize signal by sampling the analog signal. The greater the sampling
frequency, the more accurate the computer’s discrete representation of the continuous signal.
Translating the Proportional, Integral, and Derivative terms into discrete domain is accomplished
as follows:
!!"# = !! ∗ !""#"

!!"#: !ℎ ! !"#!#"$%#&'( !"#$ !" !"#$"#


!!: p!"#"!$%"&'( !"#$, ! !"#$#% !"#"$%&%#
!!!"!: !""#" !" !"#$ ! = !" − !"

!": !"#$%&'#, !ℎ! !"#$%"! !"#$%

!": ! !"#$%& !" !ℎ ! !"#$%&& !"#$"%&' !ℎ !" !" !"#$% !"#$ ! !"#$%&' !"#$%&'( !" !"#$

Equation 7: Proportional Term, Discrete


!!"# = !! ∗ !""#"_!"#

!!"#: !ℎ ! !"#$%&'( !"#$ !" !"#$"#


!!: !"#$%&'( !"#$, ! !"#$#% !"#"$%&#
!""#"_!"#: !""#$#%!&'( !!!"!, !"# !" !"#$%&'& !""#" !"#$ !"#$

In a programmed loop, the line of code e!!"!_!"#: !""#" + !""#"_!"# would keep a running total of the accumulated error
Recall from above: !!!"!: !""#" !" !"!" ! = !" − !"

!": !"#$%&'#, !ℎ! !"#$%"! !"#$%

!": ! !"#$%& !" !ℎ ! !"#$%&& !"#$"%&! !ℎ !"

8
!" !"#$% !"#$ ! !"#$%&' !"#$%&'( !" !"#$
Equation 8: Integral Term, Discrete

!""#" − !"#_!""#"
! =!
!"# !
Δ!

!!"#: !ℎ ! !"##$%&'$%" !"#$ !" !"#$"#


!!: derivative !"#$, ! !"#$#% !"#"$%&%#
!!!"!: !""#" !" !"#$ ! = !" − !"

!": !"#$%&'#, !ℎ! !"!"#$% !"#$%

!": ! !"#$%& !" !ℎ ! !"#$%&& !"#$"%&' !"#$% !" !"#$ !"#$%&"


!!!"!!"#: !" − !"

!": !"#$%&'#, !ℎ ! !"#$%"! !"#!"

!": ! !"#$%& !" !ℎ ! !"#$%&& !"#$"%&' !"#$% !" !"#$ !"#$%&' Δ! = !"#$%&" − !"#$%&'=time step interval

Equation 9: Derivative Term, Discrete

!""#" − !"#_!""#"
! = !!"# + !!"# + !!"# = !! ∗ !""#" + !! ∗ !""#!!"# + !!
Δ!

u: controller output

Equation 10: Combining Equations 7 through 9 gives the controller output u(t)

Equation 10 is a discretized approximation of Equation 6. Since it is discretized, it is easily


programmable in computer code. Figure 6 shows the formula block used in LabVIEW to
implement the discretized PID control algorithm. The code is consistent with the notation used
above and is commented to expedite understanding.

9
Figure 6: LabVIEW Formula Block, Discretized PID Control Algorithm

Note that the controller output u is added to the previous output output_old. The reason for this is
that the output required for maintaining the system at the set point value when the measured error
is zero is not zero. Rather, if the system is at the set point, then the controller output u will equal
zero and no correction to the previous output output_old will be made. However, if a corrective
action is required, then the controller output u will modify the output accordingly.

10
P_out

Measured Error I_out System Input Signal u(t)

Set Point
(Reference)
å System System Output

åå å
D_out

++++
Measured Output Sensor

Figure 7: PID Control Loop Logic Structure


Note: The listed order of the PID parameters is of no affect. The only reason why it is called PID control instead of DIP or IPD control is
because !! is generally the largest and the least commonly omitted of the three parameters, while !! is generally the smallest and the most
commonly omitted.

Table 1: Summary of Term Adjustment Affects

Proportional gain, !! In theory, a larger value of !! translates into a more aggressive

correction for an error of a given magnitude. This will pull the process
variable back to equilibrium faster, but setting the proportional gain
too large will result in system instability due to overcorrection.
Integral gain, !! In theory, a larger value of !! will eliminate steady state errors more

aggressively. The downside to a larger !! value is increased over-

shoot.
Derivative gain, !! In theory, a larger value of !! will serve to decrease overshoot.

However, a larger value of !! will also slow the response to a set

point change (transient response). A large value of !! can also result

in system instability since signal noise is amplified while


differentiating the error.

Transfer Function and Laplace Representation


Proportional control values are represented by a gain !!, derivative control values by !!, and integral control values by !!. Combing all of these into one
compact control function in the Laplace domain gives Equation 11.
!!
! ! =! +! !+
! ! ! !

Equation 11: Equation 4 written in the Laplace domain

11
Tuning
Even though PID controllers are generic and can be applied to a multitude of systems, the PID
parameters, namely !!, !!, !"# !!, must be specially tailored to the system at hand. This tailoring of the PID
parameter to a particular system is called system tuning. Aside from blind trial and error, there are several
PID tuning strategies available. Over the years, software has been developed to expedite and optimize
PID tuning. However, a simple tuning strategy called the Ziegler-Nichols method can still be an effective
and efficient means to obtain suitable PID parameters. A possible disadvantage of the Ziegler-Nichols
tuning method is that it involves bringing the system to a point of instability, which may be unsafe or
damaging, depending on the nature of the system. The Ziegler-Nichols tuning method is simple and is
explained below:
Step 1: Set the integral gain !! and the derivative gain !! to zero.
Step 2: Gradually increase the proportional gain !! (starting from zero) until it reaches the ultimate gain !!. (!! is the approximate value of !! at which the system begins to oscillate.)
At this point, the process variable oscillates with constant amplitude at a given frequency. Based on the ultimate gain !! and the oscillation period !!, the
PID control parameters can be determined from Table 2.

Table 2: Ziegler-Nichols Tuning Method Relations

Control Type !! !
!
!
!

P !!
- -
2

PI !
!
!!

2.2
1.2

!!
-
PID !! !!
!!

2
0.6!!
8
!!

Command Tracking and Disturbance Rejection


A robust control system will reject disturbances so that the process variable clings to the set point
at all times. The Ziegler-Nichols tuning method provides good disturbance rejection at a given
set point. However, it does not, in general, provide the best command tracking performance. A
control system with good command tracking performance would be able to hone in on a new set
point quickly and accurately. In summary, the Ziegler-Nichols method provides good
performance in terms of disturbance rejection, but provides somewhat poor performance in terms
of command tracking. The necessity of good command tracking depends on the physical system,
and in general, there is a tradeoff between command tracking performance and disturbance
rejection performance. Many advanced tuning strategies and enhancements to the basic PID
algorithm have been developed to address the needs of control systems that demand more
specialized performance.

12
Enhancing PID control
There are many strategies available to enhance the performance of the PID algorithm. As with signal filters, PID
controllers can be daisy-chained (or cascaded) in order to boost performance. Gain scheduling is another
enhancement that can be implemented. It automatically modulates one or all of the controls parameters in a strategic
manner based on the state of the system. For example, during a change in set point, the integral gain !! may be
automatically reduced until the new set point is reached; this would serve to limit undesirable integral windup
effects. Fuzzy logic can also be integrated with PID control to improve the performance of certain systems.

Conclusion
Having a basic understanding of the general process and concepts of controls is critical in present
day engineering. With a solid understanding of these concepts, a mechanical engineer should feel
competent when coordinating a project with the company's control engineers team. A mechanical
engineer should also be able to select proper stock hardware and controllers in order implement
simple control systems. Competency in control and control systems is a critical skill set for an
engineer in today's highly automated world.

Reference Documents

[1] K. J. Astrom and R. M. Murray. (2010, "PID control," in Feedback Systems: An Introduction
for Scientists and Engineers (2nd ed.)Anonymous .

13

S-ar putea să vă placă și