Академический Документы
Профессиональный Документы
Культура Документы
1
2 Convservation Equations
For modelling dynamic chemcial processes, we need the following conservation equations.
5. Heat Capacity and Enthalpy For Liquids : For liquids, calculating cv is practically difficult since, one
needs to maintain constant volume during the processs. However, it is relatively easy to obtain cp
(why?). For liquids, the change in volume and pressure are negiligble compared to the changes in its
internal energy and hence we make the following approximation, dH = dU + P dV + V dP ≈ dU
2.1 Examples
2.1.1 Continuous Stirred Tank Reactor (CSTR)
d(ρV )
1. Mass Balance : dt = ρi Fi − ρF .
3. Energy Balance : dU dH
dt ≈ dt = ρi Fi hi (Ti ) − ρF h(T ) − Q. The l.h.s. can be computed using the chain
∂H dnA ∂H dnB
rule, dH ∂H dT ∂H dP ∂H dV
dt = ∂T dt + ∂nA dt + ∂nB dt + ∂P dt + ∂V dt . Again, we assume that the variations of H
∂H dnA ∂H dnB
w.r.t. V, P are negligible when compared to the other terms. Hence, dH ∂H dT
dt ≈ ∂T dt + ∂nA dt + ∂nB dt .
Now, dn dcA V dnB dcB V
dt = dt = cAi Fi − cA F − rV, dt = dt = −cB F + rV . Therefore,
A
dH dT
= ρV cp + HA (T )(cAi Fi − cA F − rV ) + HB (T )(−cB F + rV )
dt dt
= ρi Fi hi (Ti ) − ρF h(T ) − Q
Assuming an ideal mixture ρh(T ) = cA HA (T )+cB HB (T ), negligible changes in density and specific heat,
the final equations become,
dV
1. Mass Balance dt = Fi − F
dcA E
2. Component Balance V dt = Fi (cAi − cA ) − k0 e− RT cA
dT (−∆Hr )rV Q
3. Energy Balance : V dt = Fi (Ti − T ) + rcp − ρcp
Fi − F
V E
dx 1 (F (c − c ) − k e− RT cA )
Note that this is a system in the form = f (x, u, t) where x = cA and f (x, u, t) = V i Ai
dt
A 0
(−∆Hr )rV
T 1
V (Fi (Ti − T ) + rcp
− ρcQ
p
)
2
2.1.2 Inverted Pendulum on a Cart
m
x1
F
M
Let N represent the normal force in the x direction on the pendulum, then, force balances on the cart
and the pendulum give
d2 x dx
M =F −N −µ
dt2 dt
d2 (x + x1 )
m =N
dt2
The second equation can be further expanded using the geometrical constraints to give
d2 x d2 sin θ
N =m + ml
dt2 dt2
d2 x
d dθ
= m 2 + ml cos θ
dt dt dt
d2 x
= m 2 + ml −θ̇2 sin θ + θ̈ cos θ
dt
Substituting this into the first equation above,
M ẍ = F − mẍ − mlθ̇2 sin θ + mlθ̈ cos θ − µẋ
3
3 Simulation of Dynamical Systems
Since a dynamical system is an ODE driven by the input functions, it can be simualted using ODE solvers.
However, the input needs to be specified at each time point. For general nonlinear ODES, MATLAB tools
such as ode45, ode23, ode23s etc. can be used. For LTI systems, we ill use the graphical interface MATLAB
Simulink.
4
figure; plot(xs(:,2));
M = 0.5;
m = 0.2;
mu = 0.1;
l = 0.3;
J = 0.006;
gamma = 0.01;
g = 9.8;
Jt = J + m*l^2;
Mt = M+m;
x = xvec(1);
xdot = xvec(2);
theta = xvec(3);
thetadot = xvec(4);
xvecdot = zeros(4,1);
den = Mt - ((m*l*cos(theta))^2/Jt);
xvecdot(1) = xdot;
xvecdot(2) = (m*l*sin(theta)*thetadot^2) - ...
((m^2*g*l^2)/Jt)*sin(theta)*cos(theta) - ...
mu*xdot + ...
(gamma/Jt)*l*m*cos(theta)*thetadot + F;
xvecdot(2) = xvecdot(2)/den;
xvecdot(3) = thetadot;
xvecdot(4) = -m^2*l^2*sin(theta)*cos(theta)*thetadot^2 + ...
Mt*m*g*l*sin(theta) + ...
mu*m*l*cos(theta)*xdot - ...
gamma*Mt*thetadot - ...
F*m*l*cos(theta);
xvecdot(4) = xvecdot(4)/(den*Jt);
function invpend(block)
setup(block);
function setup(block)
% Register number of ports
block.NumInputPorts = 1;
block.NumOutputPorts = 1;
5
block.InputPort(1).Dimensions = 1;
block.InputPort(1).DatatypeID = 0; % double
block.InputPort(1).Complexity = ’Real’;
block.InputPort(1).DirectFeedthrough = true;
% Register parameters
block.NumDialogPrms = 0;
%
block.SimStateCompliance = ’DefaultSimState’;
block.RegBlockMethod(’PostPropagationSetup’, @DoPostPropSetup);
block.RegBlockMethod(’InitializeConditions’, @InitializeConditions);
block.RegBlockMethod(’Start’, @Start);
block.RegBlockMethod(’Outputs’, @Outputs);
block.RegBlockMethod(’Update’, @Update);
block.RegBlockMethod(’Derivatives’, @Derivatives);
block.RegBlockMethod(’Terminate’, @Terminate);
function DoPostPropSetup(block)
function InitializeConditions(block)
function Update(block)
function Terminate(block)
6
3.3.1 Example: CSTR
To find the steady state in the CSTR example, one needs to put f (x, u) = 0 where
E
!
1 − RT
V (Fi (cAi − cA ) − k0 e cA )
f (x, u) = 1 (−∆Hr )rV −T c)
V (Fi (Ti − T ) + rcp − U At (T
ρcp )
and x = (cA , T ), u = (cAi , Ti , Tc ). To simplify, we will consider cAi and Ti to be fixed. Then, we need to
solve for cA , T, Tc which satisfy the above equation. We will further fix Tc and plot the resulting surface for
cA , T . We note the presence of an unstable steady state.
10 9
1.8
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0
300 350 400 450 500 550 600 650 700
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
250 300 350 400 450 500 550 600 650 700
4 Lyapunov Stability
1. Lyapunov Stability Let x∗ be a steady state for ẋ = f (x). The steady state is said to be stable if
other solutions that start near x∗ stay close to x∗ .
∀ > 0, ∃δ > 0, kx(0) − x∗ k < δ =⇒ kx(t) − x∗ k < ∀t > 0
7
2. Asymptotic Stability : The steady state is said to Asymptotically stable, if it is Lyapunov Stable
and other solutions that start near x∗ reach x∗ eventually,
∃ > 0, kx(0) − x∗ k < =⇒ kx(t) − x∗ k → 0 as t → ∞
8
6 Negative State Feedback
Consider the system in Eq. 1. We want problem to bring the states to 0 as t → ∞ using some input. The
first question that arises is, is this always possible for all A, B, C, D.
dx1
= f1 (x1 , x2 , x3 )
dt
dx2
= f2 (x1 , x2 , x3 )
dt
dx3
= f3 (x1 , x2 , x3 )
dt
f (x0 + h) ≈ f (x0 ) + Df (x0 )h
Df (x0 ) is the Jacobian of f at x0 . The Jacobian is similar to the derivatives in the single variable case. The
definition of the Jacobian is based on the similar definition of derivative in the scalar case.
kf (x + h) − f (x) − Df (x0 )hk
lim =0
h→0 khk
It can be shown that for continuously differentiable functions, the Jacobian can be obtained as a matrix of
partial derivatives. ∂f
∂f1 ∂f1
∂x1 (x0 )
1
∂x2 (x0 ) ∂x3 (x0 )
∂f2 ∂f1 ∂f1
Df (x0 ) = ∂x (x0 ) ∂x (x0 ) ∂x (x0 )
1 2 3
∂f2 ∂f1 ∂f1
∂x1 (x0 ) ∂x2 (x0 ) ∂x3 (x0 )
9
Now, the partial derivatives with respect states (cA , T ) and the inputs (cAi , Ti , Tc ) are computed. Using
linearization we have,
!
∂f1 ∂f1
cA − cA0
∂cA ∂T
f (cA , T, cAi , Ti , Tc ) = f (cA0 , T0 , cAi 0 , Ti0 , Tc0 ) +
∂f2 ∂f2
T − T0
∂cA ∂T
cA0 ,T0 ,cAi 0 ,Ti0 ,Tc0
∂f1 ∂f1 ∂f1
!
cAi − cAi0
∂cAi ∂Ti ∂Tc Ti − Ti0
+
∂f2 ∂f2 ∂f2
∂cAi ∂Ti ∂Tc Tc − Tc0
cA0 ,T0 ,cAi 0 ,Ti0 ,Tc0
The linearization point should be chosen to be an equilibrium point, i.e., a point where f (cA0 , T0 , cAi 0 , Ti0 , Tc0 ) =
0, so that the Laplace transform theory is useful. Since, at a steady state the value f (cA0 , T0 , cAi 0 , Ti0 , Tc0 ) =
0, nonlinear systems are Linearized at those values.
2. Time Invariance: If F(u) = y then F(u0 ) = y 0 , where u0 , y 0 are shifted by the same amount
It can be shown that ẋ = Ax + Bu is an LTI system. It is easy to see the linearity property and the time
invariance can also be shown by writing the general solution to the state space equation (which we will not
do here).
In the general case, the impulse response will be a matrix, hi,j (t) where hi,j (t) represents the ith state
response to an impulse in the jth input. Similarly, we define the step response Hi,j (t).
10
u2
u1
$u_0$
Therefore, if a system is linear time invariant, its behaviour is completely described by its impulse response.
10 Laplace Transforms
Laplace Transform is a tool that converts Linear differential equations to Linear algebraic equations.
f : [0, ∞) → R
11
Definition 10.1. Exponential order |f (t)| ≤ M eαt , ∀t ≥ t0
Theorem 10.2. If f is piecewise continuous on [0, ∞) and of exponential order α, then the Laplace transform
L(f ) exists for Re{s} > α and converges absolutely.
Definition 10.3. Region of Convergence The region of convergence is defined as those points of s for which
the Laplace transform exists. This is always of the form Re{s} > a or Re{s} ≥ a for some a.
a
• f (t) = at, L(f ) = s2 , Re{s} >0
w
• f (t) = sin(wt), L(f ) = s2 +w2 , Re{s} >0
s
• f (t) = cos(wt), L(f ) = s2 +w2 , Re{s} >0
1 2 n−1
Theorem 10.4. Suppose f (t), f (t), f (t), · · · , f (t) are continuous on [0, ∞) and of exponential order
and f n (t) is piecewise continuous on [0, ∞), then
L(f n (t)) = sn L(f (t)) − sn−1 f (0+ ) − sn−2 f 1 (0+ ) · · · − f n−1 (0+ )
where
f (0+ ) = lim f (t)
t→0
12
Rt
Theorem 10.6. If f is piecewise continuous on [0, ∞) of exponential order α ≥ 0 and g(t) = 0
f (u)du
then
1
L(g) = L(f ), Re{s} > α
s
Theorem 10.7. Initial Value Theorem : Suppose that f, f 1 are such that f is continuous on [0, ∞) of
exponential order α and f 1 is piecewise continuous on [0, ∞). Let F (s) = L(f ). Then
Theorem 10.8. Final Value Theorem : Suppose f is continuous on [0, ∞) of exponential order α and
limt→∞ f (t) exists. Let F (s) = L(f ). Then
As mentioned before, Laplace transform is used to solve Linear ODEs. An example is given below.
d2 y
+ y = 1, y(0) = y 0 (0) = 0
dt2
L(y 2 ) + L(y) = L(1)
1
s2 L(y) + L(y) =
s
1 s
L(y) = −
s s2 + 1
1 s
y(t) = L−1 − 2
s s +1
y(t) = 1 − cos t
10.1 Examples
10.1.1 Level Dynamics in a Tank
dh √
A = Fi − β h
dt
dh0 β
A + √ h0 = Fi0
dt 2 hs
β
Ash0 (s) + √ h0 (s) = Fi (s)
2 hs
(Note: we used the fact that h0 (0) = 0 due to the linearization near the steady state)
Fi (s)
h0 (s) =
As + 2√βh
s
10.1.2 CSTR
After linearization, we obtain a linear system, ẋ = Ax + Bu. Now apply the Laplace transform to obtain,
sx(s) = Ax(s) + Bu(s). Rewriting this, we get
13
G11 (s) G13 (s) G13 (s) cAi (s)
cA (s)
= G21 (s) G22 (s) G23 (s) Ti (s)
T (s)
G31 (s) G32 (s) G33 (s) Tc (s)
Now, we already know that the system is BIBO stable if all the eigenvalues of A have negative real parts.
adj(sI−A)
Now, (sI − A)−1 = det(sI−A) . Hence, we can see that the denominator is the characteristic polynomial of A
(in s). The roots of this polynomial are the eigenvalues of A.
Recollect that in the beginnning, we have represented an input/output ODE using the state space form,
i.e.,
dn y dn−1 y dm v dm−1 v
+ an−1 + · · · + a0 y = b m + b m−1 + · · · + b1 v
dtn dtn−1 dtm dtm−1
was represented as
dx
= Ax + Bu
dt
where 1
y 0 1 0 ··· 0 0 0 0 ··· 0
y2 0 0 1 ··· 0 0 0 0 ··· 0
dx y3
.. . . ..
. . .
= ,A = . .. .. . 0 , B = ..
.. .. . . . 0
dt
..
. 0 0 0 ··· 1 0 0 0 ··· 0
yn −a1 −a2 −a3 · · · −an−1 b1 b2 b3 · · · bm
y v
y1 v1
2 2
x = y ,u = v ,
.. ..
. .
y n−1 vm
I can be checked that the characteristic polynomial of A, i.e., det(sI − A) equals sn + an−1 sn−1 + · · · + a0 .
Therefore, the system is BIBO stable if all the roots of sn + an−1 sn−1 + · · · + a0 have negative real parts.
y(t) = Kp (1 − e−t/τp )
14
11.1.1 Step Response of First Order System
dy 1
(0) =
dt τp
1
t = τp , y(t) = (1 − ) ∗ Kp = 0.632 ∗ Kp
e
12.0.1 Examples
Fi
h1
F1
h2
F2
dh1
τp1 + h1 = Kp1 Fi (t)
dt
dh2
τp2 + h2 = Kp2 h1 (t)
dt
15
K p1
G1 (s) = h1 (s)/Fi (s) =
τp1 s + 1
Kp2
G2 (s) = h2 (s)/h1 (s) =
τp2 s + 1
Kp1 Kp2
h2 (s)/Fi (s) =
(τp1 s + 1)(τps s + 1)
The poles have negative real parts so the system is stable.
Fi(t)
h1(t) h2(t)
F1(t) F2(t)
dh1
A1 = Fi − F1
dt
dh2
= F1 − F2
A2
dt
dh1 h1 − h2 dh2 h1 − h2 h2
A1 = Fi − , A2 = −
dt R1 dt R1 R2
h1,s − h2,s
Fi,s − =0
R1
h1,s − h2,s h2,s
− =0
R1 R2
d(h1 − h1,s ) (h1 − h1,s ) − (h2 − h2,s )
A1 = (Fi − Fi,s ) −
dt R1
d(h2 − h2,s ) (h1 − h1,s ) − (h2 − h2,s ) h2 − h2,s
A2 = −
dt R1 R2
h1 − h1,s = h01 , h2 − h2,s = h02 , Fi0 = Fi − Fi,s
16
12.0.2 General second order systems
y(s) Kp
= 2 2
u(s) τ s + 2ητ s + 1
• τ is the period of oscillation
• η damping factor
• Kp gain
13.1 Examples
13.1.1 Jacketed Cooler
17
dT1
Q1 − Q2 = m1 cP1
dt
Q2 = U A(T1 − Tc )
Q1 ∝ T − T1
Combining all these results in second order system. The idea is that when we have capacities or first order
systems in series, we get a higher order system.
Cooling Water
Feed Distillate
FD , xD
Ff , cf
Steam
Bottoms
FB , xB
yi /xi
α=
yj /xj
αxi
yi =
1 + (α − 1)xi
Assumption: One mole of condensing vapor releases enough heat to vaporize one mole of liquid
dMN
= FR + VN −1 − LN − VN = FR − LN
dt
dMN xN
= FR xD + VN −1 yN −1 − LN xN − VN yN
dt
dM1
= L2 − L1 + V − V1 = L2 − L1
dt
dM1 x1
= V yB − V1 y1 − L1 x1 + L2 x2
dt
18
VN
VN
FR
LN
VN−1
MRD
Top tray
L2
V1
L1
V
MB
FB
V
Bottom Tray
dMi
= Li+1 − Li + Vi−1 − Vi = Li+1 − Li
dt
19
Li+1 Vi
Li
Vi−1
ith tray
dMi xi
= Li+1 xi+1 + Vi−1 yi−1 − Li xi + Li+1 xi+1
dt
Lf −1
Vf
Lf
Vf −1
Feed Tray
dMf
= Ff + Lf +1 − Lf + Vf −1 − Vf = Ff + Lf +1 − Lf
dt
dMf xf
= Ff cf + Lf +1 xf +1 + Vf −1 yf −1 − Lf xf + Lf +1 xf +1
dt
Refulx Drum:
dMRD
= VN − FR − FD
dt
dMRD xD
= VN yN − (FR + FD )xD
dt
Column Base:
dMB
= L1 − V − FB
dt
dMB xB
= L1 x1 − V yB − FB xB
dt
Hydraulic Relationships:
Li = f (Mi )
2N + 4 nonlinear differential equations (state equations)
2N + 1 algebraic equations (equilibrium and hydraulic relationships)
14 Feedback Loop
The feedback loop is shown in Figure.
20
d
ysp ǫ u y
Σ Controller Control Valve
Process
Measuring
Device
• Response Time : The response time of RTDs, i.e., the time taken to reach steady state. This can
range from 0.5 − 5 seconds or more.
• Let p2 A be the force applied on the other side of the capillary. Assuming, the mass of the membrane
to be small, we have p2 A = kx + c dx
dt if the liquid in the capillary gets displaced by x. The sensing
diaphragm acts as a spring and hence results in a force kx. As the oil moves displacing the sensing
diaphragm a force in the opposite direction (i.e., in the same direction as kx) acts on the second
isolating diaphragm. This force is due to drag and is given by c dx
dt .
21
Figure 3: From [?]
d2 x d2 x
m 2
= p1 A − p2 A = ρAL 2
dt dt
dx d2 x
p1 A = kx + c + ρAL 2
dt dt
p1 (s)A = kx(s) + Csx(s) + ρALs2 x(s)
x(s) A
= 2
p1 (s) ρALs + cs + K
14.1.5 Pumps
There are two main types, i) Centrifugal Pump (commonly used) and ii) Positive Displacement pumps. In
a centrifugal pump, the water is drawn into the eye of the impeller due to creation of low pressure. The
volute casing steadily increases in area and therefore inside the volute casing, the fluid pressure increases
while the velocity decreases according to the Bernoulli’s principle.
22
Figure 4: From [?]
23
Figure 6: From [?]
Pump curves plot two important pump characteristics, i.e. Head vs Flow. Head is the height to which
the pump can raise water. It can also represent the downstream pressure drop. It is important to understand
that the flow rate decreases as the head increases. For very low flow rates pumps can operate at high heads
and vice versa.
The combination of a pump and a pneumatic valve is a common occurance in process control. Note that
when we derived the model for the pneumatic valve, we only modelled the stem position x. We will try to
understand why the flow rate changes when the stem position is changed.
When the stem position is changed a new steady state will be established. Let P1 , P0 = 1 atm be the
upstream and downstream pressures across the valve (i.e., ∆P = P1 − P0 ) and F be the steady state flow
rate. In the new steady state, K, P1 have to satisfy both the the valve equation and the pump curves. When
the valve is closed the flow rate decreases but the pressure P1 will increase.
14.2 Controllers
We focus of three widely prevalent types of controllers.
• Proportional :-
c(t) = Kc (t) + cs
0
c (t) = c(t) − cs = Kc (t)
c0 (s)
Gc (s) = = Kc
(s)
Kc is called the proportional gain. P B = 100/Kc is called the proportional band. Typically, 1 ≤
P B ≤ 500.
24
Figure 7: From [?]
• Proportional-Integral :- Z t
0 1
c (t) = c(t) − cs = Kc (t) + (t)dt
τI 0
1
Gc (s) = Kc 1 +
τI
τI is called the reset time and 1/τI is called the reset rate. Typically, 0.1 ≤ τI ≤ 50 min. Suppose,
there is a step change in the error to a value . Then, the initial controller output is Kc since the
contribution of the integral term is zero. However, after a period of τI minutes, the contribution of the
integral term would be exactly Kc .
Integral wind up occurs when the error stays high for a significant amount of time. The integral term
adds up these errors and results in a very large control output. However, as all actuators have limits
on the operability, the actuators saturate.
• Proportional Integral Derivative :-
1 t
Z
d
c(t) = Kc (t) + (t) + τD + cs
τI 0 dt
1
Gc (s) = Kc 1 + + τD s
τI s
The derivative term calculates the rate of change of error and hence can take anticipatory action.
14.2.1 Causality
N (s)
G(s) =
D(s)
If the degree of the numerator is less than or equal to the degree of the denominator then the system is
said to be causal. What is the inverse Laplace Transform of s, i.e. what is the function f (t) such that
25
R∞ R∞
0
f (t)e−st dt = s? The equation 0 f (t)e−st dt = s has meaning only in the sense of distributions, which
are generalized functions. In this set up, the solution is the derivative of the Dirac delta function!
Z t
y(t) = h(t − τ )u(τ )dτ
0
h(s) = y(s)/u(s)
If y(s)/u(s) is non-causal, then there are problems with obtaining its inverse transform: which implies
that the impulse response is not a well defined function.
Therefore, we require that the transfer function be proper. The transfer function for PID is non-causal :-
1
Gc (s) = Kc 1 + + τD s
τI s
• Therefore, PID is not realizable as an LTI system.
• An example form of PID which is realizable is
1 τD s
Gc (s) = Kc 1 + +
τI s ατD s + 1
F0
hsp ǫ c h
Σ Controller Control Valve
DP Cell
hm
Suppose that at time zero the entire system is in steady state i.e. none of the flows are changing with
time.
• Process :
dh
A = Fi − F0
dt
0 = Fi,s − Fo,s
Fi0 (s) Fo0 (s)
h − hs = h0 (s) = −
As As
• Sensor (Measuring device) :
2 d2 hm dhm t
τm + 2ηm τm + hm = Km ∆P (t)
dt dt
t
hm,s = Km ∆Ps
d2 h0m dh0
2
τm + 2ηm τm m + hm = Km h0
dt dt
h0m (s) Km
0
= 2 2
h (s) τm s + 2ηm τm s + 1
26
• Comparator :-
(t) = hsp − hm
0 = s = hsp,s − hm,s
(t) = h0sp − h0m
(s) = h0sp (s) − h0m (s)
• Controller :-
1
Gc (s) = Kc 1+
τI s
• Pneumatic Valve :-
d2 F0 (t) dF0
τv2 + 2ηv τv + F0 = Kv c0 (t)
dt2 dt
F0,s = 0
d2 F00 (t) dF00
τv2 + 2η v τv + F0 = Kv c0 (t)
dt2 dt
The general equations can be written as,
Kp Kc
lim y(t) = lim sy(s) =
t→∞ s→0 1 + Kp Kc
1
Offset : 1 − y(∞) = 1+Kp Kc
• Proportional Controllers can be used for level control, since perfect level control is seldom necessary.
For example, liquid level in storage tanks can be controlled using a proportional controller.
27
Figure 8: [?]
Figure 9: [?]
• Proportional controllers give no offset when the process has an integrator, i.e. a term 1/s in its transfer
function. Consider the example in the figure below.
• Boiler level control : If the level in the drum is too low, this causes damage to the tubes and the drum.
If the level is too high then water escapes into the steam.
• Condenser Level Control in a Distillation column
Hence, offset is removed with Integral action. The PI controller increases the order of the process and
hence makes the closed-loop respond slower. PI controllers should be used when only small steady state
errors are allowed. For example, in flow control. Since flow systems are typically fast, the PI does not create
very slow loops.
28
14.4.3 Derivative Action
The PI controller removes offset but the closed-loop can become slow since the order is increased. When
the process to be controlled is itself slow, this causes the closed-loop response to be very sluggish. In these
cases, it is better to add derivative action.
15 Routh-Hurwitz Criterion
After forming the closed loop system, the roots of the denominator needs to be checked for stability. However,
the denominator polynomial in a closed loop might have higher degrees. Since there is no general rule, for
higher degree polynomials, we use a test to count the number of roots lying in the R.H.P.
1
Consider the system Gp (s) = s2 +2s+2 and a PI controller. Gc (s) = Kc (1 + 1/τI s). Using the Routh
Array we can find whent the system becomes unstable.
16 Root Locus
p K
Suppose Gp (s) = (τ1 s+1)(τ 2 s+1)
and Gc = Kc . We want to know what happens when Kc is varied. The
Routh-Hurwitz criterion only gives whether the system is stable or not. To get a better picture we use the
root locus method.
For this example, the root locus can be computed by hand. In the general case we note the following
points.
1. The roots start at poles and end at zeros
2. A point s on the real axis will lie on the root locus if an odd number of real poles and zeros lie towards
the right of s
3. The root locus is symmetrical about the real axis
4. Breakaway points : Points of departure of the root locus from the real axis. Suppose the closed loop
G(s)H(s)
transfer function is given by 1+K c G(s)H(s)
, then the breakaway points can be found from dG(s)H(s)
ds =0
Theorem 16.1. Let p(s) = sm + p1 sm−1 + p2 sm−2 + · + pm and q(s) = sn + p1 sn−1 + p2 sn−2 + · + qn . The
asymptotes of the root locus of
kp(s) + q(s) = 0
are the n − m lines
q1 − p1
kπ kπ
x+ sin − y cos =0
n−m n−m n−m
1 −p1
where k = 0, 1, · · · , n − m − 1. All the asymptotes pass through the point (− qn−m , 0) and the branches of the
(2k+1)π
locus are asymptotic to the lines in the n − m directions given by n−m
Examples,
2(s+1)
1. s(s−4)
s+3
2. s2 (s+2)(s+4)(s2 +2s+9)(s3 +5)
In MATLAB to find root locus use the command rlocus. For example, if the system transfer function is
G, the root locus can be found via rlocus(G). Below is a code listing.
29
17 Frequency Response
Using frequency response, we can check the stability of the model even if the transfer function is not rational.
Classical control design techniques also rely on the frequency response. Frequency response techniques also
allow us to answer questions such as how much of uncertainity we can handle if the model does not match
the plant perfectly etc.
The fundamental question what is the output of an LTI system when the input is a sine (or cosine) wave?
(If u(t) = a sin(ωt) what is y(t)). It can be shown that the solution is y(t) ≈ a|G(ejω )| sin(ωt + arg(G(ejω ))
for large time t. Therefore, the output is also a sine (or cosine) with the same frequency but with a phase
shift and an amplitude ratio that depends on the transfer function.
Next, we show a brief derivation of the frequency response.
y(s) = G(s)u(s)
aω
y(s) = G(s) 2
s + ω2
C1 C2 Cn b1 b2
y(s) = + + ··· + +
s − p1 s − p2 s − pn s + jω s − jω
If the system is stable all the first n terms approach zero asymptotically. Therefore,
Bode Diagram
−10
Magnitude (dB)
−20
−30
0
Phase (deg)
−45
−90 −2 −1 0 1
10 10 10 10
Frequency (rad/sec)
bode(sys). It can be seen from the example that the higher frequencies are attenuated by this system.
30
Consider the example of a tank with a leak. As we know this is a first order system and is similar to the
example considered. What happens if we send a flow rate which is varying very fast (i.e., has high frequency)?
It can be seen that this system will allow the high frequency signals to pass only after a significant amount
of attentuation.
• Phase Margin = 180o − φ(1), where φ(1) is the phase corresponding to 0dB
In Matlab, the Gain and Phase margins can be found via margin(sys)
17.3.1 Examples
exp(−0.1s)
• Consider, the example Gp (s) = 0.5s+1 . Suppose we want to use a proportional controller and want
a gain margin of 5dB.
• Now, say the true dead time is 0.15 instead of 0.1. Is the closed loop process still stable?
• Tune the proportional controller for a phase margin of 30o .
• If the dead time is 0.15, is the closed loop stable? What phase margin is sufficient?
• Using the previous controller, what happens if the time constant is 0.25? Is closed loop still stable?
31
17.4.1 Winding Number
Assume F (s) = s − c and consider the closed curve Cs = c + exp(iθ) where θ ∈ [0, 2π].
• If c is contained inside the closed curve Cs , as s moves clockwise, the image F (s) will encircle the origin
once in the clockwise direction
• If c is contained outside the closed curve Cs , as s moves clockwise, the image F (s) will not encircle the
origin
1
Let F (s) = s−p and consider the closed curve Cs = p + exp(iθ) where θ ∈ [0, 2π].
• If p is contained inside the closed curve Cs , as p moves clockwise, the image F (s) will encircle the origin
once in the counterclockwise direction
• If p is contained outside the closed curve Cs , as p moves clockwise, the image F (s) will not encircle the
origin
Theorem 17.1. If f is a meromorphic function inside some closed contour C and has no zeros or poles on
C, then I
1 f (s)
winding number of f around origin = ds = N − P
2πi f 0 (s)
where N, P are the number of zeros and poles of f inside the contour respectively.
How to use this theorem for understanding stability? The idea is to use the Cauchy’s Principle of
Argument to f (s) = 1 + Gp (s)C(s). The winding number of f (s) around the origin is the same as the
winding number of f (s) − 1 around (−1, 0). To use this theorem for stability analysis, we need to first the
contour.
lim f (s) = 1
|s|→∞
Therefore, the curved portion of the contour maps to (0, 0) in the Nyquist plot of f (s) − 1 (alternately,
it maps to (1, 0) in the Nyquist plot of f (s)).
• For open-loop stable systems P = 0 the closed loop system is stable if and only if there are no
encirclements of the critical point (−1, 0)
• For open-loop unstable systems the closed loop system is stable if and only if there are P encirclements
of the critical point (−1, 0) in the counterclockwise direction
Using the Nyquist plot it is also possible to find out the Gain and Phase margins. Even though the gain
and phase margins provide robustness to model errors, a better indicator is the sensitivity peak. This is
defined as the distance between (−1, 0) and the closest point on the Nyquist curve. It can be shown that the
distance between (−1, 0) and any point in the Nyquist curve is given by 1/|S(jω)|, where S is the sensitivity
function (defined in the next section). The shortest such distance is therefore equal to the reciprocal of the
sensitivity peak. Hence, a large sensitivity peak implies that the closed loop is at the brink of instability.
32
18 Internal Stability
GC
In the feedback control loop, we have only looked at the relation between ysp and y, i.e., y = 1+GC ysp .
However, there are many other transfer functions relating the various signals in the feedback loop. Let
G = B/A, C = P/L.
1 A(s)L(s)
1. Sensitivity : Transfer Function between output distrubance to output S(s) = 1+G(s)C(s) = A(s)L(s)+B(s)P (s)
G(s)C(s)
2. Complementary Sensitivity: : Transfer Function between reference to output T (s) = 1+G(s)C(s) =
B(s)P (s)
A(s)L(s)+B(s)P (s)
G(s) B(s)L(s)
3. Input Sensitivity: Transfer Function between inpu distrubance to output Si (s) = 1+G(s)C(s) = A(s)L(s)+B(s)P (s)
Input Disturbance
C(s)
4. Control Sensitivity : Transfer Function between output disturbance to control output Su (s) = 1+G(s)C(s) =
A(s)P (s)
A(s)L(s)+B(s)P (s) Control
A closed loop system is said to be internally stable if all the four sensitivity functions given above are
stable. Consider the following example,
3 s−4
G(s) = , C(s) =
(s + 4)(s − 4) s
It is clear that the complimentary sensitivity is stable. However, the system is not internally stable. This is
because the input sensitivity is unstable.
33
Kc τI Td
P 0.5K
P
PI 0.45K 1.2
P
PID 0.6K 0.5P 8
Kc τI Td
τp τd
P K p τd (1 + 3τ p
)
τp τd τd (30τp +3τd )
PI Kp τd (0.9 + 12τp ) 9τp +20τd
τp 4 τd τd (32τp +6τd ) 4τp τd
PID Kp τd ( 3 + 4τp ) 13τp +8τd 11τp +2τd
19.1.1 ZN - Example
1
Gp (s) =
(s + 1)3
Matlab : [gm, pm, wgm, wpm] = margin(sys) wgm is the cross-over frequency ωco .
Alternately, solve arg(Gp (jω)) = −180o and then solve for Kc |Gp (jωco )| = 1. We get Pc = ω2πco
and
Kc = 8. Use the tuning rules with τD = 0.1 ∗ Td (Note: the smaller τD the larger the frequency range over
which approximation is better)
34
19.2.1 Loop Interactions for MIMO systems
Let y1 , u1 , y2 , u2 be respectively, the mole fraction of ethanol in D, the reflux flow L, the bottom plate
temperature, reboiler steam flow. The bottom plate temperature is a measure of the composition. The
objective is to use the reflux flow and reboiler steam flow to control the product purities in the distillate and
bottoms. The dynamic model relating these variables is,
y1 (s) G11 (s) G12 (s) U1 (s)
=
y2 (s) G21 (s) G22 (s) U2 (s)
0.66e−2.6s
G11 (s) =
6.7s + 1
−0.0049e−s
G12 (s) =
9.06s + 1
−34.7e−9.2s
G21 (s) =
8.15s + 1
0.87(11.6s + 1)e−s
G22 (s) =
(3.89s + 1)(18.8s + 1)
A change in input u1 affects not just y1 but also y2 . Hence, it is more difficult to design the controllers.
1. Assume that the input u2 remains constant and introduce a step change in the input u1 . Therefore,
ȳ1 (s) = G11 (s) 1s . The ratio of the steady
state change in y1 to that of u1 is equal to G11 (0) using final
∆y1
value theorem. We denote this as ∆u1 = G11 (0).
u2
2. Now, suppose
u2 is used to control y2 perfectly, i.e., ȳ2 (s) = 0. Then, y¯1 (s) = G11 (s)ū1 (s) +
−G21 (s)
G12 (s) G22 (s) ū1 (s). Now, introduce a step change in the input u1 and note the ratio of steady
state change in y1 to that of u1 as done previously. ∆u ∆y1
1
= G11 (0) − G12 (0) −G 21 (0)
G22 (0)
y2
∆y2 ∆y2 −G12 (0) ∆y1 ∆y1
3. Similarly, ∆u2 = G22 (0), ∆u 2
= G 22 (0) − G 21 (0) G11 (0) , ∆u 2
= G 12 (0), ∆u 2
=
u1 y1 u1 y2
G12 (0) − G11 (0) −G 22 (0)
G21 (0) ,
∆y2
∆u1 = G21 (0), ∆u∆y2
1
= G21 (0) − G22 (0) −G 11 (0)
G12 (0)
u2 y2
∆y1 ∆y1 ∆y1 ∆y1 ∆y2 ∆y2 ∆y2 ∆y2
Let λ11 = ∆u1 / ∆u1 , λ12 = ∆u2 / ∆u2 , λ21 = ∆u1 / ∆u1 , λ22 = ∆u2 / ∆u2
u2 y2 u1 y2 u2 y1 u1 y1
The relative gain array is defined as
λ11 λ12
λ21 λ21
1. If λ11 = 0 then the input u1 does not affect the output y1 and hence this pairing should not be used.
35
2. If λ12 = 0 then the input u2 does not affect the output y1 and hence this pairing should not be used.
3. If 0 < λ12 < 1 then there exists an interaction between the the outputs and the inputs. A small value
of λ11 suggests that the input u1 does not affect y1 significantly.
4. If λ11 < 0, there is a negative dependence between u1 and y1 . This pairing should not be used.
36
Since Φ is non-singular when A, B are relatively prime, we have a solution to the above linear system.
2 3(s+41)
Example : For G(s) = (s+1)(s+2) and D(s) = (s2 + 5s + 16)(s + 40) the solution is C(s) = 49s+517 . Is
this a PID controller?
transform:
N
1 X 2πk1 2πk1
u[k] = √ UN exp i k∆
N k1 =1 N∆ N∆
From the inverse transform, we see that the input is a linear combination of the exponentials ek1 [k] =
exp i 2πk
N
1
k , k 1 = 1, 2, · · · , N . The weight of each of the exponentials is given by UN (ω).
37
22.1 Sensors
1. Y (s) = −D1+C(s)G(s)
m (s)C(s)G(s)
= −T (s)Dm (s). |T (jω)| should be small for high frequencies where |Dm (jω)|
is usually high.
2. Therefore, an upper limit on the closed loop bandwitdth is required
22.2 Actuators
T (s)
1. Su (s) = G(s) , if the closed loop bandwidth is much greater than the model G(s), then Su (jω) will be
high for higher frequencies
2. U (s) = Su (s)(R(s) − Do (s)). Therefore, if the output disturbance or the reference has high frequency
components, the controller ouput will have large amplitude oscillations at these high frequencies.
3. Therefore to avoid, actuator saturation, the closed loop bandwidth needs to be limited.
Actuator Example
10 100
• Go (s) = (s+10)∗(s+1) , To (s) = s2 +12s+100
• From Bode plots it can be seen that the plant and closed loop bandwidhts are approximately 1 : 10
• Assume that R(s) = 0 and Do (s) = 1/s. Then lims→∞ sU (S) = − lims→∞ Su (s) = −10 and
lims→0 sU (S) = lims→0 Su (s) = −1. Therefore, we see that there is a large initial control action.
Hence, it can be expected ratio of initial to final control action will be equal to the ratio of the
bandwidhts.
• In the presence of high frequencies in R(s) or D0 (s), there will be sustained high amplitude oscillations
for sinusoidal changes.
22.3 Disturbances
We consider the case where the disturbances only contain slowly varying fluctuations. For example, in a
disitillation column the feed concentration may contain low frequency oscillations depending on the upstream
processes.
1. Y (s) = Si (s)Di (s)+S(s)Do (s), therefore, we need S(jω) ≈ 0 in the low frequency region where Do (jω)
is high which implies that T (jω) ≈ 1 in this band
2. Therefore, we need the closed loop bandwidth to be lower bounded, in contrast to the previous cases.
38
22.5 Delays
When there is a delay in the system, any disturbance takes at least that much time to pass through the
feedback loop. For example if do is the output disturbance, then for t < τ , y(t) = do . The disturbance
can only be cancelled after this delay. Therefore, the prefect sensitivity is 1 − exp(−sτ ). However, for this
sensitivity we have T (s) = exp(−sτ ). Since, |T (jω)| = 1 for all ω. In the presence of modelling errors and
other issues discussed large bandwidhts should be avoided. Hence, there is a trade-off between cancelling
the delay in the fastest manner and robustness, performance issues.
1−δ
Mu ≥
ects − 1
Proof. Since, the unit step response stabilizes, it is clear that the region of convergence of y(s) is Re(s) > 0.
Let v(t) = 1 − y(t), so that V (s) = (1 − H(s)) 1s .
Z ∞
1 − H(c) 1
V (c) = = = v(t)e−ct
c c 0
Z ts Z ∞
1
v(t)e−ct dt + |v(t)|e−ct dt ≥
0 ts c
Vmax = 1 + Mu > 0
ts Z ∞
1 − e−cts e−cts
Z
1 −ct
≤ Vmax e dt + δe−ct dt = Vmax +δ
c 0 ts c c
1
If cts 1 then Mu > cts . There is a trade off between, speed of response and the undershoot. Example
s2 −3s+2
G(s) = (s+1)4 .
Lemma 22.2. Let z = c with Re(z) < 0 be a LHP zero. Assume that the dominant pole is −p, p > 0,
η := |c/p| 1, |v(t)| = |1 − y(t)| < Ke−pt ∀t ≥ ts , then
1 Kη
Mo ≥ −cts 1−
e −1 1−η
Vmin = −Mo
Z ts Z ∞
1
≥ (−Mo )e−ct dt − K e−(p+c)t dt
c 0 ts
Z ts Z ∞
1
− ≤ (Mo )e−ct dt + K e−(p+c)t dt
c 0 ts
Lemma 22.3. Assume all closed loop poles are to left of −α, α > 0, controller has atleast one pole at origin,
then for uncancelled plant zero z0 or plant pole η0 to the right of −α, we have
39
1. For positive unit reference or negative output disturbance step
Z ∞
1
e(t)e−z0 t dt =
0 z 0
Z ∞
e(t)e−η0 t dt = 0
0
Proof. Since, the region of convergence of T (s) is Re(s) > −α and Re(z0 ) > −α, we see that e(t)e−z0 t de-
creases down to zero even though e−z0 t can increase exponentially. Now, as E(s) = S(s)(R(s)−D(s)), R(s) =
1 1 1
s or Do (s) = s , S(z0 ) = 1, S(η0 ) = 0. Similarly, since Y (s) = T (s)R(s), R(s) = s and the ROC of Y (s) is
1 L(η0 )
Re(s) > 0. Finally, E(s) = −Si (s)Di (s), −Di (s) = s , Si (z0 ) = 0, Si (η0 ) = P (η0 ) .
Important observations regarding closed loop behaviour can be made from the previous result. From the
first relation we see that if z0 < 0 or η0 > −α then y(t) has an overshoot as e(t) is initially positive. From
the second equation, we note that if z0 > 0, then y(t) have an undershoot. From the last relations, it can be
seen that input disturbances will lead to an overshoot if z0 > −α.
If the controller is designed properly, for a unit step reference, y(t) will eventually reach unity. The speed
depends on the magintude of the dominant pole. If this magnitude is very large then y(t) reaches unity very
quickly. The response will reach the steady state value roughly in time 1/p, where −p with p > 0 is the
dominant pole. To see this, consider the step response of a first order system, y(t) = K(1 − exp−t/τ ). It is
clear that y(t) reaches 63% of its steady state value by time t = τ (note that the pole here is −1/τ ).
As discussed above y(t) reaches close to its steady state value (i.e., unity) Rin time 1/p. Similarly, e−z0 t
∞
reaches zero in time approximately equal to 1/z0 . Now, consider the relation 0 y(t)e−z0 t dt = 0. For this
to be true withouth large undershoots, it is necessary that 1/p > 1/z0 , i.e., p < z0 . Since this relation is true
for every RHP zero, it can be inferred that if the magnitude of the dominant pole is less than the smallest
RHP zero then the undershoot will be small. Therefore, the magnitude of the dominant pole should be less
than the smallest RHP zero.
R ∞ Let −p where p > 0 be the dominant pole and η0 > 0 be an unstable pole. Since, e(t) is initially positive,
0
e(t)e−η0 t dt = 0 implies that the error has a rapid sign change in the beginning of the transient or has a
large negative value later on for a sustained period of time. Using the same argumentation as above, e(t)
becomes zero in time approximately equal to 1/p. Similarly, e−η0 t becomes zero in time approximately equal
to 1/η0 . If 1/η0 < 1/p then the fluctuations of the error will be larger (within the time span 1/η0 ). Therefore,
it is desired that η0 < p, i.e., the magnitude of the dominant pole is greater than the largest unstable pole.
Based on the reasoning above, better performance can be achieved if magnitude of the dominant closed
loop pole is less than the smallest RHP zero and greater than the largest unstable pole. Hence, it can be
seen that if the smallest RHP zero is less than the largest unstable pole, then the performance of the closed
loop might be bad.
40
22.7 Bode’s Integral Theorem
Theorem 22.1. Bode’s Theorem Let G(s)C(s) = e−sτ H(s), τ ≥ 0, k := lims→∞ sH(s). Assuming the
closed loop is stable, H(s) is proper and has no poles in the open RHP. Then,
Z ∞ (
0 τ >0
ln |S(jω)|dω = π
0 −k 2 τ =0
A proof is based on using the Cauchy’s Integral Theorem on a contour that encloses RHP and bounding
terms on the part of contour at infinity. The main point is that the result is applicable independent of the
1 1
contoller used. Examples: Take G(s)C(s) = s(s+4) , GC = s+4 , S = 1/(1 + GC). Use bode command to get
the magnitude data and compute the integral using trapz.
41