PID Controller
PID Controller
PID Controller
1) Interactive Algorithm
1
1
2) NonInteractive Algorithm
1
2|Page
Control Laboratory
3) Parallel Algorithm
A high proportional gain results in a large change in the output for a given change in the error.
If the proportional gain is too high, the system can become unstable. In contrast, a small gain
results in a small output response to a large input error, and a less responsive or less sensitive
controller. If the proportional gain is too low, the control action may be too small when
responding to system disturbances. Tuning theory and industrial practice indicate that the
proportional term should contribute the bulk of the output change
3|Page
Control Laboratory
Figure 4: The effect of add ( , held constant
0
The integral term accelerates the movement of the process towards set-point and eliminates the
residual steady-state error that occurs with a pure proportional controller. However, since the
integral term responds to accumulated errors from the past, it can cause the present value
to overshoot the set-point value.
4|Page
Control Laboratory
Figure 5: The effect of add ( , held constant
Derivative action predicts system behavior and thus improves settling time and stability of the
system. An ideal derivative is not causal, so that implementations of PID controllers include an
additional low pass filtering for the derivative term, to limit the high frequency gain and noise.
Derivative action is seldom used in practice though - by one estimate in only 20% of deployed
controllers- because of its variable impact on system stability in real-world applications.
5|Page
Control Laboratory
Table 1: Effect of increasing parameter independently
3. Overview of Methods
There are several methods for tuning a PID loop. The most effective methods generally involve
the development of some form of process model, then choosing P, I, and D based on the dynamic
model parameters. Manual tuning methods can be relatively inefficient, particularly if the loops
have response times on the order of minutes or longer.
The choice of method will depend largely on whether or not the loop can be taken "offline" for
tuning, and on the response time of the system. If the system can be taken offline, the best tuning
method often involves subjecting the system to a step change in input, measuring the output as a
function of time, and using this response to determine the control parameters.
6|Page
Control Laboratory
4. Open Loop Method
In these methods, the PID is being tuned in open loop, isolated from the process plant. First a step
input is applied to the plant and the process reaction curve is obtained. Using the process reaction
curve with one of the First Order Plus Dead Time (FOPDT) estimation methods an approximation
of the process is calculated. Knowing , and the PID parameters can be evaluated from
the related correlations according to the method used.
First Order Plus Dead Time (FOPDT) is given by
1
4.1 Ziegler-Nichols Open Loop Method
In the 1940's, Ziegler and Nichols devised two empirical methods for obtaining controller
parameters. Their methods were used for 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.
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 S-shaped curve
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.
In this method, we obtain experimentally the open loop response of the FOPDT to a unit step input.
This method only applied if the response to a step input exhibits an s-shaped curve as shown in
figure 7. This means that if the plant involves integrators (like 2nd order prototypes system) or
complex-conjugate poles (general 2nd order system), then this method can’t be applied since s-
shaped will not be obtained.
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.
The Tuning Procedure:
To use the Ziegler-Nichols open-loop tuning method, you must perform the following steps:
1. Make an open loop step test
7|Page
Control Laboratory
2. From the process reaction curve determine the transportation lag or dead time, , the time
constant or time for the response to change, , and the ultimate value that the response
reaches at steady-state, , for a step change of .
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 controller (P, PI, or PID) to
calculate the controller constants. Use the table 3.
Figure 3: Open Loop of First order system plus dead Time (s-shaped curve)
Table 3: Open-loop Calculation of ( . . )
P‐ Controller ∞ 0
8|Page
Control Laboratory
The PID controller tuned by this method gives (according to the formula shown in Table (8.4)).
.
1
G c (s ) K p 1 T d s
Ti s
X 1
1.2 o m 1 0.5t d s
K m t d 2t d s
(s 1/ t d )2
0.6 m
s
This mean that the controller adds double zero at , and pole at origin
Advantages Ziegler-Nichols Open Loop Tuning Methods
1. Quick and easier to use than other methods
2. It is a robust and popular method
In this method the process response curve is obtained first, by an open loop test as shown in figure8
and then the process dynamics is approximated by a first order plus dead time model, with
following parameters:
9|Page
Control Laboratory
Figure 7: The open loop response of plant
3
2
Again the particular rules for this method are used to calculate the PID parameters. They are listed in
table 4
Controller
P 1 - -
3
PI 3 -
0.9 30
12
20
9
PD - 2
1.25 6
6
3
22
PID 6
1.33 32 4
4
8 2
13 11
10 | P a g e
Control Laboratory
5. Ziegler-Nichols Closed - Loop Tuning Method
The Ziegler-Nichols closed-loop tuning method allows you to use the critical gain value, , and
the critical period of oscillation, , to calculate . 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 , , and 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, . 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 value so that it is optimized for the controller. Another important
value associated with this proportional-only control tuning method is the critical period ( ). The
ultimate period is the time required to complete one full oscillation while the system is at steady
state. These two parameters, and , 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:
1. Remove integral and derivative action. Set integral time ( ) to ∞ or its largest value and
set the derivative controller ( ) 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 ( ) and period of oscillation ( ).
4. Plug these values into the Ziegler-Nichols closed loop equations and determine the
necessary settings for the controller.
11 | P a g e
Control Laboratory
Figure 9: System tuned using the Ziegler-Nichols closed-loop tuning method
P‐ Controller ∞ 0
2
PI‐ Controller 0
2.2 1.2
PID‐ Controller
1.7 2 8
12 | P a g e
Control Laboratory
The PID controller tuned by this method gives (according to the formula shown in Table 8.5).
1
G c (s ) K p 1 T d s
Ti s
1
0.6K cr 1 0.125Pcr s
0.5Pcr s
(s 4 / Pcr ) 2
0.075K cr Pcr
s
Thus the PID Controllers adds a pole at origin and double zeros at
If the system has a known mathematical model (Transfer function is given), then RL method can
be used to find K cr value (critical gain) and the frequency of the sustained oscillations w cr . After
that Pcr is found from
2
Pcr
w cr
These values can be found from the crossing points of the root locus branches with the jw axis.
This method doesn’t apply if the root locus doesn’t cross the jw axis.
Advantages Ziegler-Nichols Closed-Loop Tuning Methods
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 Ziegler-Nichols Closed-Loop Tuning Methods
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
The PID Tuner automatically designs a controller for your plant. You specify the controller
type (P, I, PI, PD, PDF, PID, PIDF) and form (parallel or standard). You can analyze the
design using a variety of response plots, and interactively adjust the design to meet your
performance requirements.
To launch the PID Tuner, use the pidTuner command:
pidTuner(sys,type)
where sys is a linear model of the plant you want to control,
type is a string indicating the controller type to design
14 | P a g e
Control Laboratory
PID Controller Type
The PID Tuner can tune up to seven types of controllers. To select the controller type, use one
of these methods:
Provide the type argument to the launch command pidTuner.
In PID Tuner, use the Type menu to change controller types.
2) SIMULINK
Select the PID controller block form Simulink Library
15 | P a g e
Control Laboratory
Drag the PID controller and place in the Simulink model , and double click on block.
Example 1:
This example shows how to use the PID tuner to design a controller for the plant
16 | P a g e
Control Laboratory
1
1
1. Create the plant model and open the PID Tuner to design a PI controller for a first pass
design.
2.
17 | P a g e
Control Laboratory
Right-click on the plot and select Characteristics > Rise Time to mark the rise time as a blue
dot on the plot. Select Characteristics > Settling Time to mark the settling time. To see tool-
tips with numerical values, click each of the blue dots.
5. Slide the Response time slider to the right to try to improve the loop performance. The
response plot automatically updates with the new design
18 | P a g e
Control Laboratory
Moving the Response time slider far enough to meet the rise time requirement of less than 1.5
s results in more oscillation. Additionally, the parameters display shows that the new response
has an unacceptably long settling time.
To achieve the faster response speed, the algorithm must sacrifice stability.
6. Change the controller type to improve the response.
Adding derivative action to the controller gives the PID Tuner more freedom to achieve
adequate phase margin with the desired response speed.
In the Type menu, select PIDF. The PID Tuner designs a new PIDF controller
19 | P a g e
Control Laboratory
The rise time and settling time now meet the design requirements. You can use the Response
time slider to make further adjustments to the response. To revert to the default automated tuning
result, click Reset Design.
7. Analyze other system responses, if appropriate.
To analyze other system responses, click Add Plot. Select the system response you want to
analyze.
For example, to observe the closed-loop step response to disturbance at the plant input, in
the Step section of the Add Plot menu, select Input disturbance rejection. The disturbance
rejection response appears in a new figure.
20 | P a g e
Control Laboratory
Example 2:
Assume the system in example 1 Bu
1) Build the Simulink block represent the closed loop system
21 | P a g e
Control Laboratory
2) Add PID Controller block
22 | P a g e
Control Laboratory
4) Choose the controller type , click apply and click tune
The PID tuner window will appear and can follow the steps as example 1
23 | P a g e
Control Laboratory
Note:
If need change the controller type , must be close the tuner window, and repeat step 4
24 | P a g e
Control Laboratory
References . . . .
1) http://www.mathworks.com/help/index.html
2) Farid Golnaraghi, Benjamin C.Kuo; Automatic Control Systems; Ninth Edition
3) Norman S.Nise; Control Systems Engineering; Sixth Edition
4) Richard C.Dorf, Robert H.Bishop; Modern Control Systems; Twelfth Edition.
25 | P a g e
Control Laboratory