You are on page 1of 51

Introduction: PID Controller Design

In this tutorial we will introduce a simple yet versatile feedback compensator structure,
the Proportional-Integral-Derivative (PID) controller. We will discuss the effect of each
of the pid parameters on the closed-loop dynamics and demonstrate how to use a PID
controller to improve the system performance.
Key MATLAB commands used in this tutorial are: tf , step , pid , feedback ,
pidtool , pidtune

Contents

PID Overview
The Characteristics of P, I, and D Controllers
Example Problem
Open-Loop Step Response
Proportional Control
Proportional-Derivative Control
Proportional-Integral Control
Proportional-Integral-Derivative Control
General Tips for Designing a PID Controller
Automatic PID Tuning

PID Overview
In this tutorial, we will consider the following unity feedback system:

The output of a PID controller, equal to the control input to the plant, in the time-domain
is as follows:
(1)
First, let's take a look at how the PID controller works in a closed-loop system using the
schematic shown above. The variable ( ) represents the tracking error, the difference
between the desired input value ( ) and the actual output ( ). This error signal ( ) will be
sent to the PID controller, and the controller computes both the derivative and the integral
of this error signal. The control signal ( ) to the plant is equal to the proportional gain (

) times the magnitude of the error plus the integral gain ( ) times the integral of the error
plus the derivative gain ( ) times the derivative of the error.
This control signal ( ) is sent to the plant, and the new output ( ) is obtained. The new
output ( ) is then fed back and compared to the reference to find the new error signal ( ).
The controller takes this new error signal and computes its derivative and its integral
again, ad infinitum.
The transfer function of a PID controller is found by taking the Laplace transform of Eq.
(1).
(2)
= Proportional gain

= Integral gain

= Derivative gain

We can define a PID controller in MATLAB using the transfer function directly, for
example:
Kp = 1;
Ki = 1;
Kd = 1;
s = tf('s');
C = Kp + Ki/s + Kd*s
C =
s^2 + s + 1
----------s
Continuous-time transfer function.

Alternatively, we may use MATLAB's pid controller object to generate an equivalent


continuous-time controller as follows:
C = pid(Kp,Ki,Kd)
C =
1
Kp + Ki * --- + Kd * s
s
with Kp = 1, Ki = 1, Kd = 1
Continuous-time PID controller in parallel form.

Let's convert the pid object to a transfer function to see that it yields the same result as
above:

tf(C)
ans =
s^2 + s + 1
----------s
Continuous-time transfer function.

The Characteristics of P, I, and D Controllers


A proportional controller ( ) will have the effect of reducing the rise time and will
reduce but never eliminate the steady-state error. An integral control ( ) will have the
effect of eliminating the steady-state error for a constant or step input, but it may make
the transient response slower. A derivative control ( ) will have the effect of increasing
the stability of the system, reducing the overshoot, and improving the transient response.
The effects of each of controller parameters,
summarized in the table below.

, and

on a closed-loop system are

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
No Change
Note that these correlations may not be exactly accurate, because , , and are
dependent on each other. In fact, changing one of these variables can change the effect of
the other two. For this reason, the table should only be used as a reference when you are
determining the values for , and .

Example Problem
Suppose we have a simple mass, spring, and damper problem.

The modeling equation of this system is


(3)
Taking the Laplace transform of the modeling equation, we get
(4)
The transfer function between the displacement

and the input

then becomes

(5)
Let
M
b
k
F

=
=
=
=

1 kg
10 N s/m
20 N/m
1 N

Plug these values into the above transfer function


(6)
The goal of this problem is to show you how each of

and

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 new m-file and run the following
code:
s = tf('s');
P = 1/(s^2 + 10*s + 20);
step(P)

The DC gain of the plant transfer function is 1/20, so 0.05 is the final value of the output
to an unit step input. This corresponds to the steady-state error of 0.95, quite large indeed.
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
eliminate the 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:

(7)
Let the proportional gain (
Kp = 300;
C = pid(Kp)
T = feedback(C*P,1)
t = 0:0.01:2;

) equal 300 and change the m-file to the following:

step(T,t)
C =
Kp = 300
P-only controller.
T =
300
---------------s^2 + 10 s + 320
Continuous-time transfer function.

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 closedloop transfer function of the given system with a PD controller is:

(8)
Let equal 300 as before and let equal 10. Enter the following commands into an mfile and run it in the MATLAB command window.
Kp = 300;
Kd = 10;
C = pid(Kp,0,Kd)
T = feedback(C*P,1)
t = 0:0.01:2;
step(T,t)
C =
Kp + Kd * s
with Kp = 300, Kd = 10
Continuous-time PD controller in parallel form.
T =
10 s + 300
---------------s^2 + 20 s + 320
Continuous-time transfer function.

This plot shows that the derivative controller reduced both the overshoot and the settling
time, and had a small effect on the rise time and the steady-state error.

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 closedloop transfer function with a PI control is:

(9)
Let's reduce the
commands.

to 30, and let

Kp = 30;
Ki = 70;
C = pid(Kp,Ki)
T = feedback(C*P,1)
t = 0:0.01:2;
step(T,t)

equal 70. Create an new m-file and enter the following

C =
1
Kp + Ki * --s
with Kp = 30, Ki = 70
Continuous-time PI controller in parallel form.
T =
30 s + 70
-----------------------s^3 + 10 s^2 + 50 s + 70
Continuous-time transfer function.

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.

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:

(10)
After several trial and error runs, the gains = 350, = 300, and = 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;
C = pid(Kp,Ki,Kd)
T = feedback(C*P,1);
t = 0:0.01:2;
step(T,t)
C =
1
Kp + Ki * --- + Kd * s
s
with Kp = 350, Ki = 300, Kd = 50
Continuous-time PID controller in parallel form.

Now, we have obtained a closed-loop 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.
2.
3.
4.
5.

Obtain an open-loop response and determine what needs to be improved


Add a proportional control to improve the rise time
Add a derivative control to improve the overshoot
Add an integral control to eliminate the steady-state error
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 a derivative controller on the system. Keep the controller as simple as
possible.

Automatic PID Tuning


MATLAB provides tools for automatically choosing optimal PID gains which makes the
trial and error process described above unnecessary. You can access the tuning algorithm
directly using pidtune or through a nice graphical user interface (GUI) using pidtool.
The MATLAB automated tuning algorithm chooses PID gains to balance performance
(response time, bandwidth) and robustness (stability margins). By default the algorthm
designs for a 60 degree phase margin.
Let's explore these automated tools by first generating a proportional controller for the
mass-spring-damper system by entering the following commands:
pidtool(P,'p')

The pidtool GUI window, like that shown below, should appear.

Notice that the step response shown is slower than the proportional controller we
designed by hand. Now click on the Show Parameters button on the top right. As
expected the proportional gain constant, Kp, is lower than the one we used, Kp = 94.85 <
300.
We can now interactively tune the controller parameters and immediately see the
resulting response int he GUI window. Try dragging the resposne time slider to the right

to 0.14s, as shown in the figure below. The response does indeeed speed up, and we can
see Kp is now closer to the manual value. We can also see all the other performance and
robustness parameters for the system. Note that the phase margin is 60 degrees, the
default for pidtool and generally a good balance of robustness and performance.

Now let's try designing a PID controller for our system. By specifying the previously
designed or (baseline) controller, C, as the second parameter, pidtool will design another

PID controller (instead of P or PI) and will compare the response of the system with the
automated controller with that of the baseline.
pidtool(P,C)

We see in the output window that the automated controller responds slower and exhibits
more overshoot than the baseline. Now choose the Design Mode: Extended option at the
top, which reveals more tuning parameters.

Now type in Bandwidth: 32 rad/s and Phase Margin: 90 deg to generate a controller
similar in performance to the baseline. Keep in mind that a higher bandwidth (0 dB
crossover of the open-loop) results in a faster rise time, and a higher phase margin
reduces the overshoot and improves the system stability.
Finally we note that we can generate the same controller using the command line tool
pidtune instead of the pidtool GUI

opts = pidtuneOptions('CrossoverFrequency',32,'PhaseMargin',90);
[C, info] = pidtune(P, 'pid', opts)
C =
1
Kp + Ki * --- + Kd * s
s
with Kp = 320, Ki = 169, Kd = 31.5
Continuous-time PID controller in parallel form.
info =

Stable: 1
CrossoverFrequency: 32
PhaseMargin: 90

Effects
Tips

PIDTuningClassical
<analytics uacct="UA-11196190-1" ></analytics> Title: PID Tuning Via Classical
Methods
Note: Video lecture available for this section!
Authors: James Bennett, Ajay Bhasin, Jamila Grant, Wen Chung Lim
Stewards: Arthur Edge III, Kathryn Mientel, Renu Rao, Kaveh Saba
Date Presented: 10/19/2006 // Date Revised: 10/16/2007

First round reviews for this page


Rebuttal for this page

Contents
[hide]

1 Introduction

2 Trial and Error


o 2.1 Flow
o 2.2 Level
o 2.3 Pressure
o 2.4 Temperature
3 Process Reaction Curve
4 Ziegler-Nichols Method
o 4.1 Ziegler-Nichols closed-loop tuning method
4.1.1 Closed Loop (Feedback Loop)
4.1.2 Advantages
4.1.3 Disadvantages
o 4.2 Ziegler-Nichols Open-Loop Tuning Method or Process Reaction
Method:
4.2.1 Open Loop (Feed Forward Loop)
4.2.2 Advantages
4.2.3 Disadvantages
5 Cohen-Coon Method
o 5.1 Advantages
o 5.2 Disadvantages and Limitations
6 Other Methods
o 6.1 Internal Model Control
o 6.2 Auto Tune Variation
7 Examples
o 7.1 Worked out Example 1
7.1.1 Problem
7.1.2 Solution
o 7.2 Worked out Example 2
7.2.1 Problem
7.2.2 Solution
o 7.3 Tuning the parameters of a PID controller on an actual system
o 7.4 Multiple Choice Question 1
o 7.5 Multiple Choice Question 2
o 7.6 Sage's Corner
8 References

Introduction
Currently, more than half of the controllers used in industry are PID controllers. In the
past, many of these controllers were analog; however, many of today's controllers use
digital signals and computers. When a mathematical model of a system is available, the
parameters of the controller can be explicitly determined. However, when a mathematical
model is unavailable, the parameters must be determined experimentally. Controller
tuning is the process of determining the controller parameters which produce the desired

output. Controller tuning allows for optimization of a process and minimizes the error
between the variable of the process and its set point.
Types of controller tuning methods include the trial and error method, and process
reaction curve methods. The most common classical controller tuning methods are the
Ziegler-Nichols and Cohen-Coon methods. These methods are often used when the
mathematical model of the system is not available. The Ziegler-Nichols method can be
used for both closed and open loop systems, while Cohen-Coon is typically used for
open loop systems. A closed-loop control system is a system which uses feedback control.
In an open-loop system, the output is not compared to the input.
The equation below shows the PID algorithm as discussed in the previous PID Control
section.

u is the control signal


is the difference between the current value and the set point.
Kc is the gain for a proportional controller.
i is the parameter that scales the integral controller.
d is the parameter that scales the derivative controller.
t is the time taken for error measurement.
b is the set point value of the signal, also known as bias or offset.
The experimentally obtained controller gain which gives stable and consistent
oscillations for closed loop systems, or the ultimate gain, is defined as Ku . Kc is the
controller gain which has been corrected by the Ziegler-Nichols or Cohen-Coon methods,
and can be input into the above equation. Ku is found experimentally by starting from a
small value of Kc and adjusting upwards until consistent oscillations are obtained, as
shown below. If the gain is too low, the output signal will be damped and attain
equilibrium eventually after the disturbance occurs as shown below.

On the other hand, if the gain is too high, the oscillations become unstable and grow
larger and larger with time as shown below.

The process reaction curve method section shows the parameters required for open loop
system calculations. The Ziegler-Nichols Method section shows how to find Kc, Ti, and Td
for open and closed loop systems, and the Cohen-Coon section shows an alternative way
to find Kc, Ti, and Td.
Open loop systems typically use the quarter decay ratio (QDR) for oscillation dampening.
This means that the ratio of the amplitudes of the first overshoot to the second overshoot
is 4:1.

Source(s): PIDTuningClassical

Trial and Error


The trial and error tuning method is based on guess-and-check. In this method, the
proportional action is the main control, while the integral and derivative actions refine it.
The controller gain, Kc, is adjusted with the integral and derivative actions held at a
minimum, until a desired output is obtained.
Below are some common values of Kc, Ti, and Td used in controlling flow, levels, pressure
or temperature for trial and error calculations.

Flow
P or PI control can be used with low controller gain. Use PI control for more accuracy
with high integration activity. Derivative control is not considered due to the rapid
fluctuations in flow dynamics with lots of noise.
Kc = 0.4-0.65
Ti = 6s

Level
P or PI control can be used, although PI control is more common due to inaccuracies
incurred due to offsets in P-only control. Derivative control is not considered due to the
rapid fluctuations in flow dynamics with lots of noise.
The following P only setting is such that the control valve is fully open when the vessel is
75% full and fully closed when 25% full, being half open when 50% filled.
Kc = 2
Bias b = 50%
Set point = 50%
For PI control:
Kc = 2-20
Ti = 1-5 min

Pressure

Tuning here has a large range of possible values of Kc and Ti for use in PI control,
depending on if the pressure measurement is in liquid or gas phase.
Liquid
Kc = 0.5-2
Ti = 6-15 s
Gas
Kc = 2-10
Ti = 2-10 min

Temperature
Due to the relatively slow response of temperature sensors to dynamic temperature
changes, PID controllers are used.
Kc = 2-10
Ti = 2-10 min
Td = 0-5 min

Process Reaction Curve


In this method, the variables being measured are those of a system that is already in
place. A disturbance is introduced into the system and data can then be obtained from this
curve. First the system is allowed to reach steady state, and then a disturbance, Xo, is
introduced to it. The percentage of disturbance to the system can be introduced by a
change in either the set point or process variable. For example, if you have a thermometer
in which you can only turn it up or down by 10 degrees, then raising the temperature by 1
degree would be a 10% disturbance to the system. These types of curves are obtained in
open loop systems when there is no control of the system, allowing the disturbance to be
recorded. The process reaction curve method usually produces a response to a step
function change for which several parameters may be measured which include:
transportation lag or dead time, dead, the time for the response to change, , and the
ultimate value that the response reaches at steady-state, Mu.

dead = transportation lag or dead time: the time taken from the moment the disturbance
was introduced to the first sign of change in the output signal

= the time for the response to occur


Xo = the size of the step change

Mu = the value that the response goes to as the system returns to steady-state

An example for determining these parameters for a typical process response curve to a
step change is shown below.
In order to find the values for dead and , a line is drawn at the point of inflection that is
tangent to the response curve and then these values are found from the graph.

To map these parameters to P,I, and D control constants, see Table 2 and 3 below in the ZN and Cohen Coon sections.

Ziegler-Nichols Method

In the 1940's, Ziegler and Nichols devised two empirical methods for obtaining controller
parameters. Their methods were used for non-first order plus dead time situations, and
involved intense manual calculations. With improved optimization software, most manual
methods such as these are no longer used. However, even with computer aids, the
following two methods are still employed today, and are considered among the most
common:

Ziegler-Nichols closed-loop tuning method


The Ziegler-Nichols closed-loop tuning method allows you to use the ultimate gain value,
Ku, and the ultimate period of oscillation, Pu, to calculate Kc . It is a simple method of
tuning PID controllers and can be refined to give better approximations of the controller.
You can obtain the controller constants Kc , Ti , and Td in a system with feedback. The
Ziegler-Nichols closed-loop tuning method is limited to tuning processes that cannot run
in an open-loop environment.
Determining the ultimate gain value, Ku, is accomplished by finding the value of the
proportional-only gain that causes the control loop to oscillate indefinitely at steady state.
This means that the gains from the I and D controller are set to zero so that the influence
of P can be determined. It tests the robustness of the Kc value so that it is optimized for
the controller. Another important value associated with this proportional-only control
tuning method is the ultimate period (Pu). The ultimate period is the time required to
complete one full oscillation while the system is at steady state. These two parameters, Ku
and Pu, are used to find the loop-tuning constants of the controller (P, PI, or PID). To find
the values of these parameters, and to calculate the tuning constants, use the following
procedure:
Closed Loop (Feedback Loop)
1. Remove integral and derivative action. Set integral time (Ti) to 999 or its largest
value and set the derivative controller (Td) to zero.
2. Create a small disturbance in the loop by changing the set point. Adjust the
proportional, increasing and/or decreasing, the gain until the oscillations have
constant amplitude.
3. Record the gain value (Ku) and period of oscillation (Pu).

Figure 1. System tuned using the Ziegler-Nichols closed-loop tuning method


4. Plug these values into the Ziegler-Nichols closed loop equations and determine the
necessary settings for the controller.
Table 1. Closed-Loop Calculations of Kc, Ti, Td

Advantages
1. Easy experiment; only need to change the P controller
2. Includes dynamics of whole process, which gives a more accurate picture of how
the system is behaving
Disadvantages
1. Experiment can be time consuming
2. Can venture into unstable regions while testing the P controller, which could
cause the system to become out of control

Ziegler-Nichols Open-Loop Tuning Method or Process Reaction Method:

This method remains a popular technique for tuning controllers that use proportional,
integral, and derivative actions. The Ziegler-Nichols open-loop method is also referred to
as a process reaction method, because it tests the open-loop reaction of the process to a
change in the control variable output. This basic test requires that the response of the
system be recorded, preferably by a plotter or computer. Once certain process response
values are found, they can be plugged into the Ziegler-Nichols equation with specific
multiplier constants for the gains of a controller with either P, PI, or PID actions.
Open Loop (Feed Forward Loop)
To use the Ziegler-Nichols open-loop tuning method, you must perform the following
steps:
1. Make an open loop step test
2. From the process reaction curve determine the transportation lag or dead time, dead, the
time constant or time for the response to change, , and the ultimate value that the
response reaches at steady-state, Mu, for a step change of Xo.

3. Determine the loop tuning constants. Plug in the reaction rate and lag time values to
the Ziegler-Nichols open-loop tuning equations for the appropriate controllerP, PI, or
PIDto calculate the controller constants. Use the table below.
Table 2. Open-Loop Calculations of Kc, Ti, Td

Advantages
1. Quick and easier to use than other methods
2. It is a robust and popular method
3. Of these two techniques, the Process Reaction Method is the easiest and least
disruptive to implement
Disadvantages
1. It depends upon purely proportional measurement to estimate I and D controllers.

2. Approximations for the Kc, Ti, and Td values might not be entirely accurate for
different systems.
3. It does not hold for I, D and PD controllers

Cohen-Coon Method
The Cohen-Coon method of controller tuning corrects the slow, steady-state response
given by the Ziegler-Nichols method when there is a large dead time (process delay)
relative to the open loop time constant; a large process delay is necessary to make this
method practical because otherwise unreasonably large controller gains will be predicted.
This method is only used for first-order models with time delay, due to the fact that the
controller does not instantaneously respond to the disturbance (the step disturbance is
progressive instead of instantaneous).
The Cohen-Coon method is classified as an 'offline' method for tuning, meaning that a
step change can be introduced to the input once it is at steady-state. Then the output can
be measured based on the time constant and the time delay and this response can be used
to evaluate the initial control parameters.
For the Cohen-Coon method, there are a set of pre-determined settings to get minimum
offset and standard decay ratio of 1/4(QDR). A 1/4(QDR) decay ratio refers to a response
that has decreasing oscillations in such a manner that the second oscillation will have 1/4
the amplitude of the first oscillation . These settings are shown in Table 3..
Table 3. Standard recommended equations to optimize Cohen Coon predictions

where the variables P, N, and L are defined below.

Alternatively, K0 can be used instead of (P/NL). K0,, and dead are defined in process
reaction curve section. An example using these parameters is shown here [1].

The process in Cohen-Coon turning method is the following:


1. Wait until the process reaches steady state.
2. Introduce a step change in the input.
3. Based on the output, obtain an approximate first order process with a time constant
delayed by dead units from when the input step was introduced.
The values of and dead can be obtained by first recording the following time instances:
t0 = time at input step start point t2 = time when reaches half point t3 = time when
reaches 63.2% point

4. Using the measurements at t0, t2, t3, A and B, evaluate the process parameters , dead,
and Ko.
5. Find the controller parameters based on , dead, and Ko.

Advantages

1. Used for systems with time delay.


2. Quicker closed loop response time.

Disadvantages and Limitations


1.
2.
3.
4.

Unstable closed loop systems.


Can only be used for first order models including large process delays.
Offline method.
Approximations for the Kc, i, and d values might not be entirely accurate for
different systems.

Other Methods
These are other common methods that are used, but they can be complicated and aren't
considered classical methods, so they are only briefly discussed.

Internal Model Control


The Internal Model Control (IMC) method was developed with robustness in mind. The
Ziegler-Nichols open loop and Cohen-Coon methods give large controller gain and short
integral time, which isn't conducive to chemical engineering applications. The IMC
method relates to closed-loop control and doesn't have overshooting or oscillatory
behavior. The IMC methods however are very complicated for systems with first order
dead time.

Auto Tune Variation


The auto-tune variation (ATV) technique is also a closed loop method and it is used to
determine two important system constants (Pu and Ku for example). These values can be
determined without disturbing the system and tuning values for PID are obtained from
these. The ATV method will only work on systems that have significant dead time or the
ultimate period, Pu, will be equal to the sampling period.

Examples
Worked out Example 1
Problem
You're a controls engineer working for Flawless Design company when your optimal
controller breaks down. As a backup, you figure that by using coarse knowledge of a
classical method, you may be able to sustain development of the product. After adjusting

the gain to one set of data taken from a controller, you find that your ultimate gain is
4.3289.
From the adjusted plot below, determine the type of loop this graph represents; then,
please calculate Kc, Ti, and Td for all three types of controllers.

Solution
From the fact that this graph oscillates and is not a step function, we see that this is a
closed loop. Thus, the values will be calculated accordingly.
We're given the Ultimate gain, Ku = 4.3289. From the graph below, we see that the
ultimate period at this gain is Pu = 6.28

From this, we can calculate the Kc, Ti, and Td for all three types of controllers. The results
are tabulated below. (Results were calculated from the Ziegler-Nichols closed-loop
equations.)

Worked out Example 2


Problem
Your partner finds another set of data after the controller breaks down and decides to use
the Cohen-Coon method because of the slow response time for the system. They also
noticed that the control dial, which goes from 0-8, was set at 3 instead of 1. Luckily the
response curve was obtained earlier and is illustrated below. From this data he wanted to
calculate Kc, Ti and Td. Help him to determine these values. Note that the y-axis is percent
change in the process variable.

Solution
In order to solve for Kc, Ti and Td, you must first determine L, Cp, and T. All of these
values may be calculated by the reaction curve given.

From the process reaction curve we can find that:


L=3
T = 11
Cp = 0.55 (55%)

Now that these three values have been found N and R may be calculated using the
equations below.
N=
R=
Using these equations you find that
N = .05
R = 0.27
We also know that since the controller was moved from 1 to 3, so a 200% change.
P = 2.00
We use these values to calculate Kc, Ti, and Td, for the three types of controllers based on
the equations found in Table 3.

Tuning the parameters of a PID controller on an actual


system
There are several ways to tune the parameters of a PID controller. They involve the
following procedures. For each, name the procedure and explain how the given measured
information is used to pick the parameters of the PID controller.
Questions
a. The controller is set to P only, and the system is operated in "closed-loop", meaning
that the controller is connected and working. The gain is tuned up until a resonance is
obtained. The amplitude and frequency of that resonance is measured.
b. The system is kept in "open-loop" mode, and a step-function change is manually made
to the system (through a disturbance or through the controller itself). The resulting
response of the system is recorded as a function of time.
Answers
a. We will use the Ziegler-Nichols method.
Ki=0.5Ku
Ku is the ultimate gain when the system started oscillating.
b. We will use the Cohen-Coon method.

We can locate the inflection point of the step function and draw a tangent. dead is located
at the crossing of that tangent with t, and is located at the cross of the tangent with M(t)

Multiple Choice Question 1


Which of the following do you RECORD during the Ziegler-Nichols Method?
a.
b.
c.
d.

Kc
i
Ko
d

Answer:C

Multiple Choice Question 2


For the Ziegler-Nichols Method, it is important to:
a.
b.
c.
d.

Find a gain that produces damped oscillation


Set P and I controllers to zero
Record the period of oscillation
Calculate Tc

Answer:A,C

Sage's Corner
Powerpoint Slides without narration

Powerpoint Slides without narration

References

Svrcek, William Y., Mahoney, Donald P., Young, Brent R. A Real Time Approach
to Process Control, 2nd Edition. John Wiley & Sons, Ltd.
Astrom, Karl J., Hagglund, Tore., Advanced PID Control, ISA, The
Instrumentation, Systems and Automation Society.
"ACT Ziegler-Nichols Tuning,"
http://ourworld.compuserve.com/homepages/ACTGMBH/zn.htm
Ogata, Katsuhiko. System Dynamics, 4th Edition. Pearson Education, Inc.

Page

Discussion
View source
History

Log in

Navigation

Text home
2006 Text
About
Editing help
Recent changes

Search

Toolbox

What links here


Related changes
Special pages
Printable version
Permanent link

This page was last modified on 26 January 2013, at 09:43.


This page has been accessed 387,351 times.
Content is available under Creative Commons Attribution 3.0 Unported License.
Privacy policy
About ControlsWiki
Disclaimers

ABOUT

BASICS

INDEX

NEXT

INTRODUCTION

CRUISE CONTROL

MOTOR SPEED

MOTOR POSITION

SUSPENSION

INVERTED PENDULUM

AIRCRAFT PITCH

BALL & BEAM

Introduction: Root Locus Controller


Design
In this tutorial we will introduce the root locus, show how to create it using MATlAB,
and demonstrate how to design feedback controllers using the root locus that satisfy
certain performance criteria.

Key MATLAB commands used in this tutorial are: feedback , rlocus , step , sisotool

Contents

Closed-Loop Poles
Plotting the Root Locus of a Transfer Function
Choosing a Value of K from the Root Locus
Closed-Loop Response
Using SISOTOOL for Root Locus Design

Closed-Loop Poles
The root locus of an (open-loop) transfer function
is a plot of the locations (locus) of
all possible closed-loop poles with proportional gain K and unity feedback.

The closed-loop transfer function is:


(1)
and thus the poles of the closed-loop poles of the closed-loop system are values of such
that
.
If we write

, then this equation has the form:

(2)
(3)
Let = order of
and = order of
that appears in it).

(the order of a polynomial is the highest power of

We will consider all positive values of K. In the limit as


loop system are
or the poles of
. In the limit as
closed-loop system are
or the zeros of
.

, the poles of the closed, the poles of the

No matter what we pick K to be, the closed-loop system must always have poles,
where is the number of poles of
. The root locus must have branches, each

branch starts at a pole of


and goes to a zero of
. If
has more poles than zeros
(as is often the case),
and we say that
has zeros at infinity. In this case, the
limit of
as
is zero. The number of zeros at infinity is
, the number of
poles minus the number of zeros, and is the number of branches of the root locus that go
to infinity (asymptotes).
Since the root locus is actually the locations of all possible closed-loop poles, from the
root locus we can select a gain such that our closed-loop system will perform the way we
want. If any of the selected poles are on the right half plane, the closed-loop system will
be unstable. The poles that are closest to the imaginary axis have the greatest influence on
the closed-loop response, so even though the system has three or four poles, it may still
act like a second or even first order system depending on the location(s) of the dominant
pole(s).

Plotting the Root Locus of a Transfer Function


Consider an open-loop system which has a transfer function of
(4)
How do we design a feedback controller for the system by using the root locus method?
Say our design criteria are 5% overshoot and 1 second rise time. Make a MATLAB file
called rl.m. Enter the transfer function, and the command to plot the root locus:
s = tf('s');
sys = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));
rlocus(sys)
axis([-22 3 -15 15])

Choosing a Value of K from the Root Locus


The plot above shows all possible closed-loop pole locations for a pure proportional
controller. Obviously not all of those closed-loop poles will satisfy our design criteria, To
determine what part of the locus is acceptable, we can use the command
sgrid(Zeta,Wn) to plot lines of constant damping ratio and natural frequency. Its two
arguments are the damping ratio ( ) and natural frequency ( ) [these may be vectors if
you want to look at a range of acceptable values]. In our problem, we need an overshoot
less than 5% (which means a damping ratio of greater than 0.7) and a rise time of 1
second (which means a natural frequency greater than 1.8). Enter the following in the
MATLAB command window:
Zeta = 0.7;
Wn = 1.8;
sgrid(Zeta,Wn)

On the plot above, the two dotted lines at about a 45 degree angle indicate pole locations
with = 0.7; in between these lines, the poles will have > 0.7 and outside of the lines <
0.7. The semicircle indicates pole locations with a natural frequency = 1.8; inside the
circle, < 1.8 and outside the circle > 1.8.
Going back to our problem, to make the overshoot less than 5%, the poles have to be in
between the two white dotted lines, and to make the rise time shorter than 1 second, the
poles have to be outside of the white dotted semicircle. So now we know only the part of
the locus outside of the semicircle and in betwen the two lines are acceptable. All the
poles in this location are in the left-half plane, so the closed-loop system will be stable.
From the plot above we see that there is part of the root locus inside the desired region.
So in this case, we need only a proportional controller to move the poles to the desired
region. You can use the rlocfind command in MATLAB to choose the desired poles on
the locus:
[k,poles] = rlocfind(sys)

Click on the plot the point where you want the closed-loop pole to be. You may want to
select the points indicated in the plot below to satisfy the design criteria.

Note that since the root locus may have more than one branch, when you select a pole,
you may want to find out where the other pole (poles) are. Remember they will affect the
response too. From the plot above, we see that all the poles selected (all the "+" signs) are
at reasonable positions. We can go ahead and use the chosen K as our proportional
controller.

Closed-Loop Response
In order to find the step response, you need to know the closed-loop transfer function.
You could compute this using the rules of block diagrams, or let MATLAB do it for you
(there is no need to enter a value for K if the rlocfind command was used):
K = 350;
sys_cl = feedback(K*sys,1)
sys_cl =
350 s + 2450
-------------------------------------s^4 + 40 s^3 + 475 s^2 + 1850 s + 2450

Continuous-time transfer function.

The two arguments to the function feedback are the numerator and denominator of the
open-loop system. You need to include the proportional gain that you have chosen. Unity
feedback is assumed.
If you have a non-unity feedback situation, look at the help file for the MATLAB
function feedback, which can find the closed-loop transfer function with a gain in the
feedback loop.
Check out the step response of your closed-loop system:
step(sys_cl)

As we expected, this response has an overshoot less than 5% and a rise time less than 1
second.

Using SISOTOOL for Root Locus Design


Another way to complete what was done above is to use the interactive MATLAB GUI
called sisotool. Using the same model as above, first define the plant,
.

s = tf('s');
plant = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));

The sisotool function can be used for analysis and design. In this case, we will focus on
using the Root Locus as the design method to improve the step response of the plant. To
begin, type the following into the MATLAB command window:
sisotool(plant)

The following window should appear. To start, select the tab labeled Graphical Tuning.
Within this window, turn off Plot 2 and make sure Plot 1 is the Root Locus and verify
that Open Loop 1 is selected. Finally, click the button labeled Show Design Plot to bring
up the tunable Root Locus plot.

In the same fashion, select the tab labeled Analysis Plots. Within this window, for Plot 1,
select Step. In the Contents of Plots subwindow, select Closed Loop r to y for Plot 1. If
the window does not automatically pop up, click the button labeled Show Analysis Plot.

The next thing to do is to add the design requirements to the Root Locus plot. This is
done directly on the plot by right-clicking and selecting Design Requirements, New.
Design requirements can be set for the Settling Time, the Percent Overshoot, the
Damping Ratio, the Natural Frequency, or a Region Constraint. There is no direct
requirement for Rise Time, but the natural frequency can be used for this.

Here, we will set the design requirements for the damping ratio and the natural frequency
just like was done with sgrid. Recall that the requirements call for = 0.7 and = 1.8.
Set these within the design requirements. On the plot, any area which is still white, is an
acceptable region for the poles.
Zoom into the Root Locus by right-clicking on the axis and select Properties, then click
the label Limits. Change the real axis to -25 to 5 and the imaginary to -2.5 to 2.5.
Also, we can see the current values of some key parameters in the response. In the Step
response, right-click on the plot and go to Characteristics and select Peak Response. Do
the same for the Rise Time. There should now be two large dots on the screen indicating
the location of these parameters. Click each of these dots to bring up a screen with
information.
Both plots should appear as shown here:

As the characteristics show on the Step response, the overshoot is acceptable, but the rise
time is incredibly off.
To fix this, we need to choose a new value for the gain K. Similarly to the rlocfind
command, the gain of the controller can be changed directly on the root locus plot. Click
and drag the pink box on the origin to the acceptable area where the poles have an
imaginary component as shown below.

At the bottom of the plot, it can be seen that the loop gain has been changed to 361.
Looking at the Step response, both of the values are acceptable for our requirements.

You might also like