Control Design
Control Design
Stability – Introduction
BODE PLOT AND NYQUIST
CRITERIA
As we have seen what stability is and how to identify if a given system is
stable or not, in the PID Module. In this Module we will be looking further
into analyzing the system performance and its stability through Bode and
Nyquist plots.
Brushing Up of a Few
Concepts
Characteristic equation of a system is the denominator polynomial of its
transfer function equated to zero.
Figure 2:
Closed Loop System
Let us run through few basic stability criterions for better understanding of
the sections to follow,
BIBO stability, simply means that given a bounded input signal the system
gives a bounded output signal. This could be visualized as the poles of the
system’s transfer function when on the,
The other methods like Routh’s criterion, Root locus are all explained in
detail in the Control Design Module.
Stability – Bode Plot
Given the transfer function of a system, let’s say H(s) the Bode plot would
help us visualize H(s) in its frequency domain and determine its stability,
meaning,
Magnitude Plot
A Magnitude Plot gives the magnitude of the system (in decibels) as its
varied with ω.
Phase Plot
A Phase Plot gives the phase shift of the system (in degrees) as its varied
with ω.
How these two plots are plotted is discussed in detail in the next section
that follows.
Let’s run through some basic properties regarding logarithms and angles.
Given a transfer function H(jω) let’s evaluate its Bode plot
Now that we have understood what and how of a bode plot, but what is
this margin(sys) command that we used to plot the system F4. Let’s look
at how we can estimate the system’s stability factors from the very same!
Gain Margin(GM)
Gain Margin is the amount of gain variance required to make the loop gain
unity at the Phase Crossover frequency. For a system to be stable the
greater the gain margin greater is its stability in terms of how much the
gain can be modulated without making the system unstable.
For a system to be stable the greater the phase margin greater is its
stability in terms of how much the phase of the system can be modulated
without making the system unstable.
Frequency at which the phase curve cuts the -180 o axis in the phase plot.
Let us check out how they represent stability of a closed loop system
using its open loop transfer function.
Let’s take a simple open loop transfer function , G(s),H(s) then its closed
loop transfer function will be
Bode Magnitude plot that we are plotting is the log of the gain, so the gain
margin is the additional dB that is necessary to make the magnitude unity
at the phase crossover frequency.
Let’s write a Script file that would help us understand the Stability terms
defined above better.
For K=28.3
Figure 13: Bode plot of 28.3/(s^3+7s^2+5s+9)
Observation
Given a system whose open loop transfer function does not have poles or
zeros in the right half of s-plane the gain and phase margin should be
positive to ensure stability of the closed loop system. The closed loop
system becomes unstable upon addition of the said Gain and Phase
margins.
Significance
In case of a transfer function with the denominator polynomial of higher
order then determining the transfer, function’s poles would be difficult.
Nyquist plot would help reducing the problem.
Let us take,
And analyze its closed loop stability using Nyquist plot. Given below is a
simple Script file that would help you to do so,
So, the system is stable. But now let us vary the system’s stability using a
gain value, K=30.
As it can be clearly seen the number of clockwise encirclements around -1
is one.
Implies,
So, the closed loop system will be unstable for gain value of 30.
This shifting using a gain value can also be understood as addition of gain
margin that would make the system go unstable.
Terminologies
The importance of Nyquist stability lies in the fact that it can also be used
to determine the relative degree of system stability by producing the
phase and gain stability margins. These stability margins are needed for
frequency domain controller design techniques.
Gain Cross Over Frequency
(ωg)
In Short!
In this module we have gone through how to plot Bode and Nyquist plots
using MATLAB commands.
Bode Plot, consists of a magnitude plot and a phase plot, helps you
understand how much the constructed system can withstand changes in
gain and phase value before it becomes unstable.
x’ = Ax + Bu
y = Cx + Du
where, x and x’ are state vector (nx1) and time derivative of the state
vector (nx1) respectively,
u and y are input vector (px1) and output vector (qx1) respectively,
A is the system matrix (nxn),
B and C are input matrix (nxp) and output matrix (qxn) respectively,
D is the feedforward matrix (qxp).
Let’s take a simple mass-spring-damper system for better understanding
of state space representation,
The order of the above eqn. written above is 2, it is defined that the
number of state variables that could completely characterize the system
is the order of the equation.
So, let the two states that we observe be x and x’, i.e., the displacement
and velocity of the mass.
To avoid confusion, let us represent state vector by z.
Implies,
So, let us now write two first order ODEs each one characterizing the state
variables.
2. Arriving upon the nth order ODE representing the system, select n state variables.
3. Write n 1st order ODEs, each one characterizing the n state variables.
4. Put them all together in the form of matrices and vectors to come up with the
state space representation of the system.
State Space Representation – Working in
Laplace Domain
Using the above equations let’s try to get our transfer function of the
system described.
(Here, the term (sI – A)-1 is a matrix. So, matrix rules of multiplication
should be followed)
Here eqn.8 gives the transfer function of the system and that det(sI – A) =
0 is the characteristic equation and gives the poles of the system, in other
words the poles of the system could also be defined as the eigenvalues of
matrix A.
For better understanding of what are poles and their role in stability refer
PID Module.
In the next section let’s investigate State Feedback Controller, it’s purpose
and how to come up with it.
Here ‘r’ is the reference signal that needs to be tracked and ‘N’ is a Gain
value, whose need would be clearly explained using an example below.
Factors To Be Checked First
Controllability ————————————————————————
Observability ————————————————————————–
So, let’s write up a script file declaring the physical parameters and
defining its state space representation as discussed above and checking
out if the system is,
——•Controllable
——•Observable
Now that we know that the system’s state variables can be controlled and
observed, let’s proceed to the Gain matrix K which helps us in controlling
the state variables individually.
So far our Script code comprises of defining the parameters and analyzing
the system about whether it could be controlled and whether the state
variables could be observed. Now we will look into how the existing
system without a state feedback controller responds to a step input.
Figure 4:Continuation of Script file, Defining the Open Loop system
Upon adding the above lines in your existing script file and running it, you
would get the following results,
The step(sys) gives the step response of sys that we have defined in the
script and the sisotool(sys) gives its Bode plot and Root locus along with
its step response. Let us go to the Root locus plot and right click on it and
select Design Requirements >> New. As shown in the next page.
Figure 7: Creating a Design Requirement
In this you can specify the Design Requirement that you would want,
We get,
Figure 8: Unshaded Region, that denotes Settling time<0.5 s
Now why are we doing this? State feedback controller helps us in tracking
the input, i.e., step input of value 1, with a better performance just by
shifting the poles! Let’s check how this happens.
Now that we have understood how state feedback controller plays a major
role in the poles of the system. Let us now look into how it helps with its
performance.
Performance ————————————————————————–
Variable p in the code denotes the set of desired poles and K denotes the
gain matrix that would help us achieve poles at the said p using the
function called place(A, B, p), wherein A, B are system parameters in its
state space representation that we had calculated prioly and p is the set
of desired poles.
Now we need to integrate the State feedback controller with the system.
The above script file shows how to represent the Closed loop system. For
the closed loop system as we already saw,
Figure 12:Step response of the Closed Loop system with N=1
Performance of,
As we can clearly see that the closed loop system meets the design
requirements that we desired the system to achieve, with the exception of
it not reaching the desired value of 1.
This is where the gain value N comes into picture, now that we know that
our closed loop system’s steady state value is at 0.312 instead of 1, we
simply just have to scale our reference value, in other words amplify it, in
order to achieve one.
As we can clearly see now that our state feedback controller helped us in
improving the performance of the system and in tracking the reference
value of one.
PID Controller Design
PID with its simple design is one of the most common controllers found in
automobiles today. With its 3 gains, the PID is easy to understand and deploy for
beginners. Start your journey in the field of controls with the PID module. Learn
about the significance of the gains and familiarize yourself with the tuning
process.
This section explains the general terms commonly used in Control Design.
Transfer Functions
Figure 1:System
Let P(s) be the Laplace transform of the plant function p(t) then,
X(s) = 0 gives the poles of P(s) while Y(s)=0 gives the zeros. Poles are
used in control design to determine the stability of the system under
consideration. We will be studying more about stability of the system in
the next section.
Refer the Appendix for commonly used Laplace transforms.
Open Loop System
Open-loop system, also referred to as non-feedback system, is a type of
continuous control system in which the output has no influence or effect
on the control action of the input signal. In other words, in an open-loop
control system the output is neither measured nor “fed back” for
comparison with the input.
Linear Systems
A linear system is said to follow the principle of superposition and
linearity.
On giving inputs x1(t) and x2(t), we get y1(t) and y2(t) respectively as
outputs.
Causal System
A causal system is one where the output at any instant of time depends
on current and past inputs.
BIBO Stability
A system is said to be BIBO stable, when for a given bounded input the
output obtained is also bounded.
Implies,
And,
For the output to be bounded the poles of the plant transfer function
should lie in the left half of the complex plane (that is, have negative real
parts).
The following methods talk about how you can determine whether a given
system is stable or not by analyzing the denominator of the transfer
function.
Hurwitz polynomials
A polynomial is said to be ‘Hurwitz’ if all its roots have negative real parts.
Let the polynomial be
Routh’s Array
Sufficient Condition
The number of sign changes in the 1stcolumn of the Routh’s array should
be zero.
•Implies, the elements in the 1stcolumn of the Routh’s array should be
non-zero and of the same sign.
•The number of sign changes indicates number of roots in RHP.
•In case of zeros in the 1st column of the Routh’s array the roots might be
present at the imaginary axis or in RHP.
———•Roots on the imaginary axis implies that the system is marginally
stable. Marginally stable systems have sinusoidal oscillations, with a
constant amplitude and has poles on the imaginary axis.
Two sign changes indicate that there are 2 poles in RHP.
Next sub section describes the Root Locus Method. Till now we have seen
how to determine if the system is stable or not. Further we will see how
you can design a controller for a stable system.
Root Locus
Significance
Therefore, the root locus is the path of the roots of the characteristic
equation due to k ask is traced out to infinity.
In order to draw the root locus of the above open loop transfer function.
Step 1]
Locate open loop poles and zeros in the ‘s’ plane. (n- number of open loop
poles; m- number of open loop zeros)
Step 2]
Locate the parts of the real axis that lie on the root locus. By taking a test
point on the axis, if odd number of the open loop poles and zeros exist to
the right side of a point on the real axis, then that point is on the root
locus branch. Implies, the branch of points which satisfies this condition is
the real axis of the root locus branch.
Regions
(-∞, -5) test point in this region has 3(odd number) open loop poles on its
right, therefore this branch is Root Locus Branch.
•(-5, -1) test point in this region has 2(even number) open loop poles on
its right, therefore this branch is not a Root Locus Branch.
(-1, 0) test point in this region has 1(odd number) open loop pole on its
right, therefore this branch is Root Locus Branch.
•(0, ∞) test point in this region has 0(even number) open loop poles on its
right, therefore this branch is not a Root Locus Branch.
Step 3]
Step 4]
Step 5]
Find the angle of departure (φd) and the angle of arrival (φa) .
In the given transfer function, there are no complex conjugate open loop
poles and zeros.
Step 6]
Find the cross-over points (points where the root locus cuts the imaginary
axis)
•Substituting s = jꙍ in the closed loop characteristic equation and equate
it to zero.
•We get two equations,
——–Real part equal to zero.
——–Imaginary part equal to zero.
•On solving the equations, we get values of K (should be positive) and jꙍ
(cross-over points).
For the given transfer function cross-over points are ±j√5 .
On Running the above code, you can observe from the graph obtained
how a under, critically and over damped system responds to a step unit,
i.e., on giving a unit force as input.
Step Response Of a System
Here we will investigate the step response of a system and how to obtain
its performance characteristics.
Figure 15: Step response
Time it takes for the error |y(t) – yfinal| between the response y(t) and the
steady-state response yfinal to fall to within 2% or 5% of yfinal (depending on
the band chosen).
For step response of P(s) given above the settling time can also be
calculated directly,
Steady State Error(sse)
Time taken by the system response to reach 100% of its final value for the
first time.
1.stepinfo(sys)
Gives you the values of,
•RiseTime — Time it takes for the response to rise from 10% to 90% of
the steady-state response.
•SettlingTime — Time it takes for the error |y(t) – yfinal| between the
response y(t) and the steady-state response yfinal to fall to within 2% of
yfinal.
•SettlingMin — Minimum value of y(t) once the response has risen.
•SettlingMax — Maximum value of y(t) once the response has risen.
•Overshoot — Percentage overshoot, relative to yfinal).
•Undershoot — Percentage undershoot.
•Peak — Peak absolute value of y(t)
•PeakTime — Time at which the peak value occurs.
2.step(sys, Tfinal)
Step response plot of dynamic system till the specified time Tfinal.
After analysing the system and its response we turn to the controller design. In this section
we will only be covering PID controllers. PID is one of the most common controllers used
due its versatility and robustness. In this section we will get to know more about this popular
controller.
Note: The controller gain factors P, I and D are also represented as kp, ki and kd.
In a Closed Loop system, the variable (e(t)) represents the tracking error, the difference
between the desired output (x(t)) and the actual output (y(t)). This error signal (e(t)) is fed to
the PID controller, and the controller computes both the derivative and the integral of this
error signal with respect to time along with scaling it depending on the choice of controller.
Let us now design a PID controller for an under damped mass-spring-damper system. The
below script focuses on,
•Generating step responses of an open loop and closed loop mass-spring-damper system.
——Given that, the controller functions C(s)=0 the step response of closed loop mass-spring-
damper system is zero initially. So, the graph obtained shows the step response of open loop
system.
•Generating step response info of an open loop and closed loop mass-spring-damper system.
Figure 18: Script of PID Modelling
Figure 19: Step response of open loop system
UCTS
PID Controller Design | Designing a Controller –
Proportional controller (P)
Let us run the Script of PID Modelling by keeping the values of ki, kd as
zero and run it for kp= 7, 14, 21.
1. Kp=7
SSE observed – 0.125
Figure 21: Step response of closed loop system kp=7 ki=0 kd=0
2. Kp=14
SSE Observed – 0.0667
Figure 22: Step response of closed loop system kp=14 ki=0 kd=0
3. Kp=21
SSE Observed – 0.0455
Figure 23: Step response of closed loop system kp=21 ki=0 kd=0
Observation
Kp increases:
1. Rise time decreases
2. SSE decreases but not zero
3. Settling time very little change
4. Overshoot (%) increases
PID Controller Design | Designing a Controller – Integral
Controller (I)
PI
Let us run the Script of PID Modelling by keeping the value of kd as zero,
kp as 7 and run it for ki= 7, 14, 21.
Figure 25: Step response of closed loop system kp=7 ki=7 kd=0
Figure 26: Step response of closed loop system kp=7 ki=14 kd=0
Figure 27: Step response of closed loop system kp=7 ki=21 kd=0
Observation
With derivative control, the control signal can become large if the error
begins sloping upward, even while the magnitude of the error is still
relatively small. This anticipation tends to add damping to the system,
thereby decreasing overshoot. The addition of a derivative term, however,
has no effect on the steady-state error.
PD
Disadvantages: Steady state error is not zero, cannot be used for fast
moving process variables like flow, pressure. It is highly affected by
external noise. It amplifies high frequency noise if present.
Let us run the Script of PID Modelling by keeping the value of ki as zero,
kp as 7 and run it for kd= 7, 14, 21.
Figure 29: Step response of closed loop system kp=7 ki=0 kd=7
Figure 30: Step response of closed loop system kp=7 ki=0 kd=14
Figure 31: Step response of closed loop system kp=7 ki=0 kd=21
Observation