Inno2020 Emt4203 Control II Chap2a Pids
Inno2020 Emt4203 Control II Chap2a Pids
PID Controller
1.0.1 Introduction
A proportional-integral-derivative controller (PID controller) is a control loop feedback
mechanism (controller) widely used in industrial control systems. A PID controller calculates an
error value as the difference between a measured process variable and a desired setpoint. The
controller attempts to minimize the error by adjusting the process through use of a
manipulated variable.
The PID controller algorithm involves three separate constant parameters, and is accordingly
sometimes called three-term control: the proportional, the integral and derivative values,
denoted P, I, and D. Simply put, these values can be interpreted in terms of time: P depends on
the present error, I on the accumulation of past errors, and D is a prediction of future
errors, based on current rate of change. The weighted sum of these three actions is used to
adjust the process via a control element such as the position of a control valve, a damper, or
the power supplied to a heating element.
By tuning the three parameters in the PID controller algorithm, the controller can provide
control action designed for specific process requirements. The response of the controller can be
described in terms of the responsiveness of the controller to an error, the degree to which the
controller overshoots the setpoint, and the degree of system oscillation. Note that the use of the
PID algorithm for control does not guarantee optimal control of the system or system stability.
Some applications may require using only one or two actions to provide the appropriate system
control. This is achieved by setting the other parameters to zero. A PID controller will be called a PI,
PD, P or I controller in the absence of the respective control actions. PI controllers are fairly
common, since derivative action is sensitive to measurement noise, whereas the absence of an
integral term may prevent the system from reaching its target value due to the control action.
2
1) Interactive Algorithm
1 𝑡 𝑑
𝑢(𝑡) = 𝐾𝑐 [𝑒(𝑡) + ∫ 𝑒(𝜏)𝑑𝜏] × [1 + 𝑇𝑑 𝑒(𝑡)]
𝑇𝑖 0 𝑑𝑡
2) NonInteractive Algorithm
1 𝑡 𝑑
𝑢(𝑡) = 𝐾𝑐 [𝑒(𝑡) + ∫ 𝑒(𝜏)𝑑𝜏 + 𝑇𝑑 𝑒(𝑡)]
𝑇𝑖 0 𝑑𝑡
3) Parallel Algorithm
𝑡
𝑑
𝑢(𝑡) = 𝐾𝑝 𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒(𝜏)𝑑𝜏 + 𝐾𝑑 𝑒(𝑡)
0 𝑑𝑡
For the sake of simplicity, we consider the transfer function of the plant as a simple first order
system without time delay as:
We now consider each of the terms, assuming that the others are zero.
Proportional control:
With Ki = Kd = 0, we simply have u(t) = Kp e(t) . Thus at any instant in time, the control
is proportional to the error. It is a function of the present value of the error. The larger the
error, the larger the control signal. One way to look at this term is that the farther away
from the desired point we are, the harder we try. As we get closer, we dont try quite as
hard. If we are right on the target, we stop trying. As can be seen by this analogy, when we
are close to the target, the control essentially does nothing. Thus, if the system drifts a bit
from the target, the control does almost nothing to bring it back.
With the proportional control action only, the closed loop system looks like:
Where
Effects:
1
1. The time response improves by a factor 1+KK p
(i.e. the time constant decreases)
2. There is a steady state offset between the desired response and the output response =
KKp A
A{1 − }=
1 + KKp 1 + KKp
This offset can be reduced by increasing the proportional gain; but that may also cause
increase oscillations for higher order systems.
The offset, often termed as steady state error can also be obtained from the error transfer
function and the error function e(t) can be expressed in terms of the Laplace transformation
form:
Using the final value theorem, the steady state error is given by:
6
In a PID controller, the PB (Proportional Band) is the inverse of the Gain. One can
write: PB = 100 / Gain or Gain = 100 / PB where PB is in percent.
Take, for example, a level controller on a tank where we measure the level from bottom
to top as 0 to 100%. We have a control valve on the outlet of the tank whose job is to
maintain the level in the tank. The PB is defined as the range of level over which the control
valve will go from fully closed to fully open. Suppose we decide that if the tank level should
fall to 20% we want the control valve fully closed (0% open). Additionally, if the tank level
rises to 60% full, we want the control valve to be fully open (100% open). If the tank level
is between 20% and 60% we want the control valve to be open ”in proportion” the the level.
So if the tank level were to rise to 40% (half way up the PB), the control valve should be
set to 50% open). This controller would have a PB of 40% (60% - 20%).
Integral Control:
Rt
Assuming now that Kp = Kd = 0, we simply have u(t) = ki 0 e(τ )dτ . The addition of
this integral makes the open-loop forward path of Type I. Thus, the system, if stable, is
guaranteed to have zero steady-state error to a step input. This can also be viewed as an
application of the internal model principle. If e(t) is non-zero for any length of time (for
example,positive), the control signal gets larger and large as time goes on. It thus forces
the plant to react in the event that the plant output starts to drift. We can think of the
integral term as an accumulation of the past values of the error. It is not uncommon for the
integral gain to be related to the proportional gain by Ki = Kτip where τi is the integral time.
Generally, by itself, the I term is not used. It is more commonly used with the P term to
give a P I control. The I term tends to slow the system reactions down. In order to speed
up the system responses, we add the derivative term.
So the major advantage of this integral control action is that the steady state error due
to step input reduces to zero. But simultaneously, the system response is generally slow,
oscillatory and unless properly designed, sometimes even unstable. The step response of this
closed loop system with integral action is shown in Fig. 4.
8
Proportional Plus Integral (P-I) Control:
It is evident from the above discussions that the P-I action provides the dual advantages
of fast response due to P-action and the zero steady state error due to I-action. The error
transfer function of the above system can be expressed as:
In the same way as in integral control, we can conclude that the steady state error would
be zero for P-I action. Besides, the closed loop characteristics equation for P-I action is:
Comparing these two, one can easily observe that, by varying the term Kp , the damping
constant can be increased. So we can conclude that by using P-I control, the steady state
error can be brought down to zero, and simultaneously, the transient response can be im-
proved. The output responses due to (i) P, (ii) I and (iii) P-I control for the same plant can
be compared from the sketch shown in Fig. 6.
9
Derivative controller:
where N is typically in the range from 10 to 20. This matter of the differentiator could
also be viewed using the Taylor expansion of e(t) .
A derivative controller may able to provide anticipative action but can also make the system
become noisy. Almost always used in conjunction with P control.
10
Proportional Plus Derivative (P-D) Control:
C(s) = Kp (1 + τd s)
K
P-D control for the process transfer function P (s) = 1+τ s
apparently is not very useful, since
it cannot reduce the steady state error to zero. But for higher order processes, it can be
shown that the stability of the closed loop system can be improved using P-D controller. For
this, let us take up the process transfer function as P (s) = js12 . Looking at Fig.7, we can
easily conclude that with proportional control, the closed loop transfer function is
and the characteristics equation is js2 + Kp = 0; giving oscillatory response. But with
P-D controller, the closed loop transfer function is:
whose characteristics equation is js2 + Kp τd s + Kp = 0; that will give a stable closed loop
response.
The step responses of this process with P and P-D controllers are compared in Fig.8.
11
Proportional-Integral-Derivative (PID) control:
The order of the controller is low, but this controller has universal applicability; it can
be used in any type of SISO system, e.g. linear, nonlinear, time delay etc. Many of the
MIMO systems are first decoupled into several SISO loops and PID controllers are designed
for each loop. PID controllers have also been found to be robust, and that is the reason, it
finds wide acceptability for industrial processes.
2. Integral Control:
It does not exhibit steady state error, but is relatively slow responding. It is particularly
effective for:
The PID controller performs especially well when the system has first order dynamics (a single
pole). Actually, in this case, the P controller is a state-feedback control! In general, for the
system with first-order dynamics the PI control is sufficient, and the D is not needed. For the
system with essentially second-order dynamics, the PD control corresponds to state feed-back.
The PID control generally works well for these systems. The PID controller can also work for
some systems of higher order. Generally speaking, the derivative term is beneficial when the
time constants of the system differ by orders of large magnitude. It is sometimes helpful when
tight control of higher-order dynamics is required. This is because the higher order dynamics
prevent the use of high proportional gain. The D provides damping and speeds up the
transient response.
The PID controller, of course, is not the end-all of controllers. Sometimes the controller
just wont work very well. The following are cases when the PID control does not perform
well. In general, these require the use of more sophisticated methods of control.
• Tight control of higher order process Systems with long delay times. In this case, the
derivative term is not helpful. A Smith predictor is often used in this case.
The PID control thus considers past, present and future values of the error in assigning its
control value. This partly explains its success in usage. Introducing a derivative controller
will add damping and in doing so:
1. increases system stability (add phase lead)
2. reduces overshoot
3. generally improves transient response
13
All three blocks of PID have something to offer in controlling system response
14
Manual tuning of PID control is still surprisingly common. Relies on intuitive links be-
tween what each of the component blocks offers in terms of performance.
Will only consider P and PI control.
16
Manual procedure is trial and error process. Kp changes speed of response and Ki alters
the settling time, with a tendency to overshoot
Excessive overshoot needs to be avoided but settle time must be reasonably short so that
desired output level is achieved
Solution
1. Reference tracking mode only required. Engineer decides to use reference step changes
of 100 C. Settling constraint means that system must settle to within 5%of the 100 C
reference signal within 20 minutes
3. Proportional control tuning involves repeated step response tests with increasing Kp
values until system response is within 3 minutes.
4. Integral control tuning involves repeated step response tests with increasing Ki values
until system has 5% settle time of better than 20 minutes
To use the Ziegler-Nichols open-loop tuning method, you must perform the
following steps:
Here the process is assumed to be a stable first order system with time delay. The closed loop
system is broken as shown in Fig.2; a step input is applied at m, output is measured at b. In
fact, a bias input may be necessary so that the plant output initially becomes close to the
nominal value. The step input is superimposed on this bias value. The input and the output
response are plotted by suitable means as shown in Fig. 3.
Figure 3: Open Loop of First order system plus dead Time (s-shaped curve)
20
Table 3: Open-loop Calculation of (𝐾𝑝 . 𝑇𝑖 . 𝑇𝑑 )
𝑲𝒑 𝑻𝒊 𝑻𝒅
𝑋𝑜 𝜏𝑚
P- Controller ∞ 0
𝐾𝑚 𝑡𝑑
𝑋𝑜 𝜏𝑚
PI- Controller 0.9 3.3 𝑡𝑑 0
𝐾𝑚 𝑡𝑑
𝑋𝑜 𝜏𝑚
PID- Controller 1.2
𝐾𝑚 𝑡𝑑
2 𝑡𝑑 0.5 𝑡𝑑
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 o m 1
1.2 1 0.5t d s
K m t d 2t d s
(s 1/ t d ) 2
0.6 m
s
1
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
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.
𝑲𝒑 𝑻𝒊 𝑻𝒅
𝐾𝑐𝑟
P- Controller ∞ 0
2
𝐾𝑐𝑟 𝑃𝑐𝑟
PI- Controller 0
2.2 1.2
𝐾𝑐𝑟 𝑃𝑐𝑟 𝑃𝑐𝑟
PID- Controller
1.7 2 8
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
4
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
23
2.3 Closed Loop Technique (Damped oscillation method):
In many cases, plants are not allowed to undergo through sustained oscillations, as is the
case for tuning using continuous cycling method. Damped oscillation method is preferred
for these cases. Here, initially the closed loop system is operated initially with low gain
proportional control mode with τd = 0 and τi = ∞. The gain is increased slowly till a decay
ratio p2
p1
of 1/4th is obtained in the step response in the output, as shown in Fig. 5. Under
this condition, the period of damped oscillation, Td is also noted. Let Kd be the proportional
gain setting for obtaining 1/4th decay ratio.
3. Cohen-Coon Method
The Cohen-Coon tuning rules are suited to a wider variety of processes than the Ziegler-Nichols
tuning rules. The Ziegler-Nichols rules work well only on processes where the dead time is less
than half the length of the time constant. The Cohen-Coon tuning rules work well on processes
where the dead time is less than two times the length of the time constant (and you can stretch this
even further if required). Also it provides one of the few sets of tuning rules that has rules for PD
controllers.
Like the Ziegler-Nichols tuning rules, the Cohen-Coon rules aim for a quarter-amplitude damping
response. Although quarter-amplitude damping-type of tuning provides very fast disturbance
rejection, it tends to be very oscillatory and frequently interacts with similarly-tuned loops.
Quarter-amplitude damping-type tuning also leaves the loop vulnerable to going unstable if the
process gain or dead time doubles in value.
In this method the process response curve is obtained first, by an open loop test as shown in
figure 3 and then the process dynamics is approximated by a first order plus dead time
model, with following parameters:
24
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 + 𝑑
𝜏𝑚 𝜏𝑚
not support certain types of plant models, such as unstable plants, high-order plants, or plants with
little or no time delay.
You can automatically tune PID controllers to achieve the optimal system design and to meet
design requirements, even for plant models that traditional rule-based methods cannot handle well.
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
26
2) SIMULINK
Select the PID controller block form Simulink Library
27
Drag the PID controller and place in the Simulink model , and double click on block.
Example 1: 28
This example shows how to use the PID tuner to design a controller for the plant
1
𝐺(𝑠) =
(𝑠 + 1)3
1. Create the plant model and open the PID Tuner to design a PI controller for a first pass
design.
2.
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
30
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
31
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.
32
Example 2:
Assume the system in example 1 Bu
1) Build the Simulink block represent the closed loop system
33
Note:
If need change the controller type , must be close the tuner window, and repeat step 4