pid tutorial over view
TRANSCRIPT
-
8/3/2019 Pid Tutorial Over View
1/12
What Is PIDTutorial Overview
Get Tuning Tips Newsletter
PID stands for Proportional, Integral, Derivative. Controllers are designed to eliminate the needfor continuous operator attention. Cruise control in a car and a house thermostat are common
examples of how controllers are used to automatically adjust some variable to hold themeasurement (or process variable) at the set-point. The set-point is where you would like themeasurement to be. Error is defined as the difference between set-point and measurement.
(error) = (set-point) - (measurement) The variable being adjusted is called the manipulatedvariable which usually is equal to the output of the controller. The output of PID controllers willchange in response to a change in measurement or set-point. Manufacturers of PID controllersuse different names to identify the three modes. These equations show the relationships:
P Proportional Band = 100/gain
I Integral = 1/reset (units of time)
D Derivative = rate = pre-act (units of time)
Depending on the manufacturer, integral or reset action is set in either time/repeat orrepeat/time. One is just the reciprocal of the other. Note that manufacturers are not consistentand often use reset in units of time/repeat or integral in units of repeats/time. Derivative andrate are the same.
Choosing the proper values for P, I, and D is called "PID Tuning". Find out about PID TuningSoftware
Proportional Band
With proportional band, the controller output is proportional to the error or a change inmeasurement (depending on the controller).
(controller output) = (error)*100/(proportional band)
With a proportional controller offset (deviation from set-point) is present. Increasing thecontroller gain will make the loop go unstable. Integral action was included in controllers toeliminate this offset.
Integral
With integral action, the controller output is proportional to the amount of time the error ispresent. Integral action eliminates offset.
CONTROLLER OUTPUT = (1/INTEGRAL) (Integral of) e(t) d(t)
http://www.expertune.com/newsletter.htmlhttp://www.expertune.com/tutor.html#P%23Phttp://www.expertune.com/tutor.html#I%23Ihttp://www.expertune.com/tutor.html#D%23Dhttp://www.expertune.com/advanced.htmlhttp://www.expertune.com/advanced.htmlhttp://www.expertune.com/tutor.html#P%23Phttp://www.expertune.com/tutor.html#I%23Ihttp://www.expertune.com/tutor.html#D%23Dhttp://www.expertune.com/advanced.htmlhttp://www.expertune.com/advanced.htmlhttp://www.expertune.com/newsletter.html -
8/3/2019 Pid Tutorial Over View
2/12
Notice that the offset (deviation from set-point) in the time response plots is now gone.Integral action has eliminated the offset. The response is somewhat oscillatory and can bestabilized some by adding derivative action. (Graphic courtesy of ExperTune Loop Simulator.)
Integral action gives the controller a large gain at low frequencies that results in eliminatingoffset and "beating down" load disturbances. The controller phase starts out at 90 degreesand increases to near 0 degrees at the break frequency. This additional phase lag is what yougive up by adding integral action. Derivative action adds phase lead and is used tocompensate for the lag introduced by integral action.
Derivative
With derivative action, the controller output is proportional to the rate of change of themeasurement or error. The controller output is calculated by the rate of change of themeasurement with time.
dm
CONTROLLER OUTPUT = DERIVATIVE ----
dt
Where m is the measurement at time t.
Some manufacturers use the term rate or pre-act instead of derivative. Derivative, rate, and
pre-act are the same thing.
DERIVATIVE = RATE = PRE ACT
Derivative action can compensate for a changing measurement. Thus derivative takes actionto inhibit more rapid changes of the measurement than proportional action. When a load orset-point change occurs, the derivative action causes the controller gain to move the "wrong"way when the measurement gets near the set-point. Derivative is often used to avoidovershoot.
-
8/3/2019 Pid Tutorial Over View
3/12
Derivative action can stabilize loops since it adds phase lead. Generally, if you use derivativeaction, more controller gain and reset can be used.
With a PID controller the amplitude ratio now has a dip near the center of the frequencyresponse. Integral action gives the controller high gain at low frequencies, and derivativeaction causes the gain to start rising after the "dip". At higher frequencies the filter onderivative action limits the derivative action. At very high frequencies (above 314
radians/time; the Nyquist frequency) the controller phase and amplitude ratio increase anddecrease quite a bit because of discrete sampling. If the controller had no filter the controlleramplitude ratio would steadily increase at high frequencies up to the Nyquist frequency (1/2the sampling frequency). The controller phase now has a hump due to the derivative leadaction and filtering. (Graphic courtesy of ExperTune Loop Simulator.)
The time response is less oscillatory than with the PI controller. Derivative action has helpedstabilize the loop.
Control Loop Tuning
It is important to keep in mind that understanding the process is fundamental to getting a welldesigned control loop. Sensors must be in appropriate locations and valves must be sized
correctly with appropriate trim.
In general, for the tightest loop control, the dynamic controller gain should be as high aspossible without causing the loop to be unstable. Choosing a controller gain is accomplishedeasily with PID Tuning Software
PID Optimization Articles
Fine Tuning "Rules"
http://www.expertune.com/advanced.htmlhttp://www.expertune.com/articles.htmlhttp://www.expertune.com/advanced.htmlhttp://www.expertune.com/articles.html -
8/3/2019 Pid Tutorial Over View
4/12
This picture (from theLoop Simulator) showsthe effects of a PIcontroller with toomuch or too little P or Iaction. The process istypical with a dead time
of 4 and lag time of 10.Optimal is red.
You can use the pictureto recognize the shapeof an optimally tunedloop. Also see theresponse shape of loopswith I or P too high orlow. To get yourprocess response tocompare, put thecontroller in manualchange the output 5 or
10%, then put thecontroller back in auto.
P is in units ofproportional band. I isin units of time/repeat.So increasing P or I,decreases their actionin the picture.
View graphic in hi-resolution
Starting PID Settings For Common Control Loops
Loop TypePB%
Integralmin/rep
Integralrep/min
Derivativemin
Valve Type
Flow 50 to 5000.005 to0.05
20 to 200 noneLinear or ModifiedPercentage
LiquidPressure
50 to 5000.005 to0.05
20 to 200 noneLinear or ModifiedPercentage
Gas Pressure 1 to 50 0.1 to 50 0.02 to 10 0.02 to 0.1 Linear
Liquid Level 1 to 50 1 to 100 0.1 to 1 0.01 to 0.05Linear or ModifiedPercentage
Temperature 2 to 100 0.2 to 50 0.02 to 5 0.1 to 20 Equal Percentage
Chromatograph
100 to2000
10 to 1200.008 to0.1
0.1 to 20 Linear
http://www.expertune.com/LoopSimulator.htmlhttp://www.expertune.com/images/finetune.gifhttp://www.expertune.com/LoopSimulator.htmlhttp://www.expertune.com/images/finetune.gif -
8/3/2019 Pid Tutorial Over View
5/12
These settings are rough, assume proper control loop design, ideal or series algorithm and donot apply to all controllers. Use ExperTune's PID Loop Optimizer to find the proper PID settingsfor your process and controller. (From Process Control Systems (Shinskey) p.99 and Tuningand Control Loop Performance (McMillan) p 39)
Introduction
This tutorial will show you the characteristics of the each of proportional (P), the integral(I), and the derivative (D) controls, and how to use them to obtain a desired response. In
this tutorial, we will consider the following unity feedback system:
Plant: A system to be controlledController: Provides the excitation for the plant; Designed to control the overall
system behavior
The three-term controller
The transfer function of the PID controller looks like the following:
Kp = Proportional gain KI = Integral gain
Kd = Derivative gain
First, let's take a look at how the PID controller works in a closed-loop system using theschematic shown above. The variable (e) represents the tracking error, the difference betweenthe desired input value (R) and the actual output (Y). This error signal (e) will be sent to thePID controller, and the controller computes both the derivative and the integral of this errorsignal. The signal (u) just past the controller is now equal to the proportional gain (Kp) timesthe magnitude of the error plus the integral gain (Ki) times the integral of the error plus thederivative gain (Kd) times the derivative of the error.
This signal (u) will be sent to the plant, and the new output (Y) will be obtained. This newoutput (Y) will be sent back to the sensor again to find the new error signal (e). The controllertakes this new error signal and computes its derivative and its integral again. This processgoes on and on.
http://www.expertune.com/PIDLoopOpt.htmlhttp://www.expertune.com/PIDLoopOpt.html -
8/3/2019 Pid Tutorial Over View
6/12
The characteristics of P, I, and D controllers
A proportional controller (Kp) will have the effect of reducing the rise time and will reduce ,butnever eliminate, the steady-state error. An integral control (Ki) will have the effect ofeliminating the steady-state error, but it may make the transient response worse. A derivativecontrol (Kd) will have the effect of increasing the stability of the system, reducing the
overshoot, and improving the transient response. Effects of each of controllers Kp, Kd, and Kion a closed-loop system are summarized in the table shown below.
CL RESPONSE RISE TIME OVERSHOOT SETTLING TIME S-S ERROR
Kp Decrease Increase Small Change Decrease
Ki Decrease Increase Increase Eliminate
Kd Small Change Decrease Decrease Small Change
Note that these correlations may not be exactly accurate, because Kp, Ki, and Kd aredependent of each other. In fact, changing one of these variables can change the effect of theother two. For this reason, the table should only be used as a reference when you are
determining the values for Ki, Kp and Kd.
Example Problem
Suppose we have a simple mass, spring, and damper problem.
The modeling equation of this system is
(1)
Taking the Laplace transform of the modeling equation (1)
The transfer function between the displacement X(s) and the input F(s) then becomes
http://www.engin.umich.edu/group/ctm/extras/ess/ess.htmlhttp://www.engin.umich.edu/group/ctm/extras/ess/ess.html -
8/3/2019 Pid Tutorial Over View
7/12
Let
M = 1kg
b = 10 N.s/m
k = 20 N/m
F(s) = 1
Plug these values into the above transfer function
The goal of this problem is to show you how each of Kp, Ki and Kd contributes to obtain
Fast rise time
Minimum overshoot
No steady-state error
Open-loop step response
Let's first view the open-loop step response. Create a newm-fileand add in the following code:
num=1;
den=[1 10 20];
step(num,den)
Running this m-file in the Matlab command window should give you the plot shown below.
The DC gain of the plant transfer function is 1/20, so 0.05 is the final value of the output to anunit step input. This corresponds to the steady-state error of 0.95, quite large indeed.
http://www.engin.umich.edu/group/ctm/extras/mfile.htmlhttp://www.engin.umich.edu/group/ctm/extras/mfile.htmlhttp://www.engin.umich.edu/group/ctm/extras/mfile.htmlhttp://www.engin.umich.edu/group/ctm/extras/step.htmlhttp://www.engin.umich.edu/group/ctm/extras/mfile.htmlhttp://www.engin.umich.edu/group/ctm/extras/step.html -
8/3/2019 Pid Tutorial Over View
8/12
Furthermore, the rise time is about one second, and the settling time is about 1.5 seconds.Let's design a controller that will reduce the rise time, reduce the settling time, and eliminatesthe steady-state error.
Proportional control
From the table shown above, we see that the proportional controller (Kp) reduces the rise
time, increases the overshoot, and reduces the steady-state error. The closed-loop transfer
function of the above system with a proportional controller is:
Let the proportional gain (Kp) equals 300 and change the m-file to the following:
Kp=300;
num=[Kp];
den=[1 10 20+Kp];
t=0:0.01:2;
step(num,den,t)
Running this m-file in the Matlab command window should gives you the following plot.
Note: The Matlab function called cloop can be used to obtain a closed-loop transfer
function directly from the open-loop transfer function (instead of obtaining closed-looptransfer function by hand). The following m-file uses the cloop command that shouldgive you the identical plot as the one shown above.
num=1;
den=[1 10 20];
Kp=300;
[numCL,denCL]=cloop(Kp*num,den);t=0:0.01:2;
http://www.engin.umich.edu/group/ctm/extras/step.htmlhttp://www.engin.umich.edu/group/ctm/extras/step.html -
8/3/2019 Pid Tutorial Over View
9/12
step(numCL, denCL,t)
The above plot shows that the proportional controller reduced both the
rise time and the steady-state error, increased the overshoot, and
decreased the settling time by small amount.
Proportional-Derivative control
Now, let's take a look at a PD control. From the table shown above, we
see that the derivative controller (Kd) reduces both the overshoot and
the settling time. The closed-loop transfer function of the given
system with a PD controller is:
Let Kp equals to 300 as before and let Kd equals 10. Enter the
following commands into an m-file and run it in the Matlab commandwindow.
Kp=300;
Kd=10;
num=[Kd Kp];
den=[1 10+Kd 20+Kp];
t=0:0.01:2;
step(num,den,t)
This plot shows that the derivative controller reduced both the
overshoot and the settling time, and had small effect on the rise time
and the steady-state error.
http://www.engin.umich.edu/group/ctm/extras/mfile.htmlhttp://www.engin.umich.edu/group/ctm/extras/mfile.html -
8/3/2019 Pid Tutorial Over View
10/12
Proportional-Integral control
Before going into a PID control, let's take a look at a PI control.
From the table, we see that an integral controller (Ki) decreases the
rise time, increases both the overshoot and the settling time, and
eliminates the steady-state error. For the given system, the closed-
loop transfer function with a PI control is:
Let's reduce the Kp to 30, and let Ki equals to 70. Create an new m-file
and enter the following commands.
Kp=30;
Ki=70;
num=[Kp Ki];
den=[1 10 20+Kp Ki];
t=0:0.01:2;
step(num,den,t)Run this m-file in the Matlab command window, and you should get the
following plot.
We have reduced the proportional gain (Kp) because the integral
controller also reduces the rise time and increases the overshoot as
the proportional controller does (double effect). The above response
shows that the integral controller eliminated the steady-state error.
http://www.engin.umich.edu/group/ctm/extras/mfile.htmlhttp://www.engin.umich.edu/group/ctm/extras/mfile.html -
8/3/2019 Pid Tutorial Over View
11/12
Proportional-Integral-Derivative control
Now, let's take a look at a PID controller. The closed-loop transfer
function of the given system with a PID controller is:
After several trial and error runs, the gains Kp=350, Ki=300, and Kd=50
provided the desired response. To confirm, enter the following commands
to an m-file and run it in the command window. You should get the
following step response.
Kp=350;
Ki=300;
Kd=50;
num=[Kd Kp Ki];
den=[1 10+Kd 20+Kp Ki];
t=0:0.01:2;
step(num,den,t)
Now, we have obtained the system with no overshoot, fast rise time, and
no steady-state error.
General tips for designing a PID controller
When you are designing a PID controller for a given system, follow the
steps shown below to obtain a desired response.
1. Obtain an open-loop response and determine what needs to be
improved
-
8/3/2019 Pid Tutorial Over View
12/12
2. Add a proportional control to improve the rise time
3. Add a derivative control to improve the overshoot
4. Add an integral control to eliminate the steady-state error
5. Adjust each of Kp, Ki, and Kd until you obtain a desired overall
response. You can always refer to the table shown in this "PID
Tutorial" page to find out which controller controls what
characteristics.
Lastly, please keep in mind that you do not need to implement all three
controllers (proportional, derivative, and integral) into a single
system, if not necessary. For example, if a PI controller gives a good
enough response (like the above example), then you don't need to
implement derivative controller to the system. Keep the controller as
simple as possible.