Professional Documents
Culture Documents
System Engineering and Process Control: Exercises
System Engineering and Process Control: Exercises
Exercises
March 2020
Contents
Problems
1. Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. State-Space Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3. Input-Output Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4. Step Response Analysis. MATLAB/Control System Toolbox . . . . 13
5. Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6. Simulation using MATLAB/Simulink . . . . . . . . . . . . . . . . . . 19
7. Feedback Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8. PID Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9. Analysis in the Frequency Domain . . . . . . . . . . . . . . . . . . . . 30
10. Control Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
X. Discrete-Time and Sequential Control . . . . . . . . . . . . . . . . . 37
Y. Multivariable Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Solutions
1. Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2. State-Space Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3. Input-Output Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4. Step Response Analysis. MATLAB/Control System Toolbox . . . . 58
5. Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6. Simulation using MATLAB/Simulink . . . . . . . . . . . . . . . . . . 65
7. Feedback Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8. PID Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9. Analysis in the Frequency Domain . . . . . . . . . . . . . . . . . . . . 73
10. Control Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
X. Discrete-Time and Sequential Control . . . . . . . . . . . . . . . . . 81
Y. Multivariable Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
MATLAB help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
1. Basics
1.1 Many situations in everyday life can be described and analyzed using con-
cepts from systems engineering and control theory. Think about the sit-
uations described below and try to give a corresponding description that
captures the relevant system properties. Which are the measured quanti-
ties? Which are the control quantities? Identify possible disturbances, and
try to map human behavior to common control structures such as feedback
and feedforward. Use block diagrams to capture relevant features of the
systems.
a. When you take a shower, you strive to achieve desired temperature and
flow. How can this be achieved? What are the relevant measured variables?
Control variables?
b. What is the situation when driving a car? What information does the driver
use? What can the driver do to affect the behavior of the car? Is feedback
or feedforward used? Or both? What conditions can be regarded as distur-
bances? Draw a block diagram including the car, the driver and relevant
signals.
c. When you boil potatoes you are likely to use a stove, a pot and some water to
achieve the desired result: tasty boiled potatoes. But what strategy do you
use? Think about which measurement and control signals that are involved.
What senses do you use?
1.2 a. Figure 1.1 (a) shows a water tank with varying inflow. A person is watching
the water level and trying to control it by adjusting the outflow valve. Is this
a feedback or feedforward system? What would it be if the person instead
is looking at the inflow?
b. In Figure 1.1 (b), the person has been replaced with a sensor, a controller
and an actuator. Draw a block diagram that shows how the four elements
are interacting.
(a) (b)
Sensor Controller
Tank
Actuator
Figure 1.1 (a) Manually controlled water tank. (b) Automatically controlled water tank.
1.3 A tank and its equipment is shown in Figure 1.2. The level in the tank
should be controlled. This is done using a controller, a transmitter (sensor),
and an actuator.
Identify the controller, the transmitter, and the actuator in the figure. What
is the manipulated process variable, the measured process variable, and the
controlled process variable?
3
Exercise 1. Basics
LC
q in
LT
q out
1.4 Four different processes are shown in Figure 1.3. The measured process
variables should in each case be controlled so that the correct value is
maintained.
b. Explain the relationship that exists between the manipulated process vari-
able and the controlled process variable. Should the valve be opened or
(1) (2)
CAC
C
B C
A
LT
LC
CAT
(3) (4)
TT
FT FC
TC
Figure 1.3 Four different processes and their control systems in Problem 1.4. (1) Tank
reactor. (2) Buffer tank. (3) Exoterm tank reactor with cooling. (4) Pump with control valve.
4
Exercise 1. Basics
c. Identify possible disturbances that can affect the controlled process vari-
ables.
1.5 Two different control systems are shown in Figure 1.4. Both can be used
to control the level in a tank. What control strategy is used in each case?
Draw block diagrams for the two control systems.
FT
LT
LC FC
Figure 1.4 Two different control systems used to control a tank in Problem 1.5.
1.6 A preliminary design of a reactor system is shown in Figure 1.5. The vari-
ables that should be controlled are the output flow, level, temperature, and
concentration. Variations in the temperature, the concentration of the reac-
tant and the concentration of the solvent are disturbances that may affect
the system. Also the temperature of the cooling water may vary.
c. Suggest how to connect the transmitters, the actuators and the controllers.
React.
A
Solv-
ent
Cooling
water
Figure 1.5 A process diagram for the reactor system in problem 1.6.
5
2. State-Space Models
2.1 For each of the processes in Figure 2.1, derive the process dynamics and
write the system in state-space form. What is the order of the system? Is
the system linear or nonlinear?
c. Two tanks with cross sections A1 and A2 , outlet hole areas a 1 and a 2 ,
manipulated inflow u, and measured liquid level y. Let the liquid volumes
V1 and V2 be the state variables of the system.
LT y1
LT y
V
V V1
u2
FT y2
LT y
V2
2.2 For each of the linear dynamical systems below, determine the eigenvalues
of the system matrix and conclude whether the system is asymptotically
stable, marginally stable, or unstable.
a.
0 1 0
ẋ =
x+
u
5 −4 1
y = 2 0 x + u
b.
ẋ = u
y = −x
6
Exercise 2. State-Space Models
c.
−2 0 0 1
ẋ =
1 −3 0
x+
0u
−2 4 −1 0
y = 0 0 1 x
where u and y are the input and the output, respectively. Choose the state
variables x1 = y, x2 = ẏ and x3 = ÿ.
2.4 Two stirred tanks are connected in series, see Figure 2.2. The tanks have
constant volume V = 1 and constant flow q = 1.
a. Derive the state-space description for the concentration dynamics in the two
tanks. The state variables are the concentrations in the first and second
tanks, c 1 and c 2 . The input signal is the feed concentration, c 0 , and the
output signals are the concentrations in both tanks, c 1 and c 2 .
b. Calculate the eigenvalues of the system matrix. Is the system stable? Is the
system asymptotically stable?
c0
c1
c2
2.5 Consider a continuous stirred tank reactor with constant volume V , constant
flow q, and the two reactants R and P, see Figure 2.3.
For each of the cases below, derive the process dynamics and write the
system in state-space form. Use the state vector x = ( c R c P )T , the input
signal u = c R0 , and the output signal y = c P . Finally determine whether
the system is asymptotically stable.
7
Exercise 2. State-Space Models
c R0
cR cP
2.6 The moving cart in Figure 2.4 with position z and velocity v is affected by
two forces: a spring force Fs = − kz and an external force Fe = u.
a. Derive the process dynamics for the cart and write the system in state-space
y = z as the
form. Use z and v as state variables, u as the input signal, and P
output signal. Hint: Use Newton’s second law of motion: mv̇ = F.
b. Calculate the eigenvalues of the system matrix and determine whether the
system is asymptotically stable, marginally stable, or unstable.
k
m u
z
0
8
3. Input-Output Models
3.1 Calculate the transfer function from u to y for each of the linear dynamical
systems below. Assume that all initial conditions are zero.
a.
ÿ + 3 ẏ + 2y = 4u
b.
dy( t)
= Ku( t − L), L>0
dt
c.
0 1 0
ẋ =
x+
u
0 −0.05 0.01
y = 1 0 x
3.2 Figure 3.1 shows a continuous stirred tank. The tank has a constant flow
q and a constant volume V . The concentration of a chemical component is
described by a first-order differential equation,
V
ẏ = − y + u,
q
b. Calculate the poles and zeros of the system. Is the system asymptotically
stable, marginally stable or unstable?
c. Let q = 1 and V = 2, and assume that the system is at rest before time
zero. Calculate and draw the output response y( t) when the input is an
impulse at time zero, u( t) = δ ( t). Interpret the response in terms of what
is happening in the tank.
9
Exercise 3. Input-Output Models
3.3 A linear time-invariant system with input signal u( t) and output signal y( t)
is described by the transfer function
s+2
G(s) =
s+1
a. Find the differential equation that relates the input and output signals.
b. Assume that the system is at rest before time zero. Calculate and draw the
output response of the system when the input is a unit step at time zero,
u( t) = 1.
1 1
G1 (s) = 4, G2 (s) = , G3 (s) =
s+3 s
(a)
G1
u y
Σ G3
G2
(b) r y
Σ G1 G3
−1
(c)
G1
r e y
Σ G3 Σ G2
−1
10
Exercise 3. Input-Output Models
H 2O Hg glass
θ2
θ1
a. Find the transfer function from the temperature of the water to the tem-
perature of the mercury.
b. Assume that the system is at rest at time zero: θ 1 (0) = θ 2 (0) = 0. Compute
and sketch how the temperature of the mercury will change when the
temperature of the water changes as a step,
I
a, t≥0
θ 1 ( t) =
0, t<0
c. Compute and sketch how the temperature of the mercury will change when
the temperature of the water increases linearly,
I
bt, t≥0
θ 1 ( t) =
0, t<0
3.6 Calculate the transfer function from u to y for the block diagrams in Fig-
ure 3.4.
11
Exercise 3. Input-Output Models
(a)
H1
u y
G1 Σ G2
H2
(b)
G3 Σ
u y
Σ G1 G2
12
4. Step Response Analysis. MATLAB/Control
System Toolbox
4.1 In Figure 4.1 there are four different processes and four different step
responses. Each step response corresponds to one of the processes and one
of the transfer functions below. Match each process with the correct step
response and the correct transfer function.
K K
G1 (s) = G2 (s) =
s 1 + sT
K
G3 (s) = G4 (s) = e−sL
(1 + sT1 )(1 + sT2 )
4.2 Calculate (by hand) the transfer function, the static gain, the impulse re-
sponse, and the step response of the following systems:
a.
dx −2 0 5
=
x+
u
dt 0 −3 2
y = 1 1 x
b.
dx −7 2 3
=
x+
u
dt −15 4 8
y = −2 1 x
4.3 Repeat Problem 4.2, but now using MATLAB and Control System Toolbox
instead:
• State-space models are created with ss.
• Conversion to a transfer function model is done with tf.
• The static gain is computed using dcgain.
• The impulse response is plotted using impulse.
• The step response is plotted using step.
Use help on the commands above to find out how they are used!
13
Exercise 4. Step Response Analysis. MATLAB/Control System Toolbox
P1 S1 y
u = c in
c =y
ut
t
u=q
in S2 y
P2
L h=y
t
u= c cB= y
P3 A,in S3 y
A B
t
u= T T=y
P4 in S4 y
4.4 In this problem, we will consider a very simple model of a bicycle. The input
to the system is the steer angle δ and the output is the bicycle tilt angle φ.
Assuming small angles, a linear model of the system dynamics is given by
the transfer function
1.3s + 20
G(s) = 2
s − 10
a. Enter the bicycle model as a transfer-function model in MATLAB using tf.
Compute the poles of the system. Is it stable?
b. Plot the step response of the system. Think about the real bicycle—how
realistic is the response?
14
Exercise 4. Step Response Analysis. MATLAB/Control System Toolbox
Enter the bicycle model as a state-space system in MATLAB using ss. Plot
the pole-zero diagram of the system using pzmap.
δ = K (r − φ )
where K is the feedback gain, and r is the reference value for the tilt angle
(typically zero). Show that the resulting closed-loop system becomes
dx
= ( A − B KC ) x + B Kr
dt
φ = Cx
4.5 Figure 4.2 shows the step responses of five different linear time-invariant
systems. Each of them corresponds to one of the seven transfer functions
below. Pair them up! First reason analytically. Then use MATLAB to verify
your conclusions.
0.1 1
I. G(s) = V. G(s) =
s + 0.1 s+1
4 4
II. G(s) = 2 VI. G(s) =
s + 2s + 4 s2
+ 0.8s + 4
0.5 2
III. G(s) = 2 VII. G(s) = 2
s − 0.1s + 2 s +s+3
−0.5
IV. G(s) = 2
s + 0.1s + 2
15
Exercise 4. Step Response Analysis. MATLAB/Control System Toolbox
A D
1.5 1.5
1 1
0.5 0.5
0 0
0 5 10 0 5 10
B E
1.5 1
1 0.5
0.5 0
0 −0.5
0 5 10 0 5 10
C
1.5
1
0.5
0
0 5 10
16
5. Linearization
ẋ = − x3 + u
√
y= x
a. Calculate the stationary state x0 and the stationary output y0 of the system,
given the stationary input u0 = 1.
ẋ = h( x) + u
2
h ( x)
−1
−2
−2 −1 0 1 2 3 4
x
For each of the cases below,
• find the stationary input u0 corresponding to the specified stationary
state x0 .
• (graphically) linearize the system around ( x0 , u0 ).
• determine the stability of the linearized system.
a. x0 = −1
b. x0 = 1
c. x0 = 2
5.3 Consider the Lotka-Volterra system that models the population dynamics
of two species
dN
= N ( a − bP )
dt
dP
= P (c N − d )
dt
17
Exercise 5. Linearization
Sin, q
S, X
S, X, q
5.4 In a continuous well-stirred biological tank reactor, see Figure 5.1, biomass
is growing following Monod kinetics,
µmax S ( t)
µ( S ( t)) = ,
K S + S ( t)
d X ( t) 1 q2
= µ( S ( t)) − X ( t)
dt V
d S ( t) µ( S ( t)) q! "
=− X ( t) + S in − S ( t)
dt YX / S V
18
6. Simulation using MATLAB/Simulink
http://www.mathworks.com/products/simulink/
The Step block is found under Simulink/Sources, the Transfer Fcn block
under Simulink/Continuous, and the Scope block is found under Simulink/
Sinks.
Select Simulation/Start in the menu of the model (or press Ctrl-t) to simu-
late the system for 10 seconds (the default simulation length). Investigate
the result by double-clicking on the Scope block. Note that you can auto-zoom
the plot by clicking on the binoculars.
When does the step in the input occur? What is the final value of the
output? Edit the parameters of the Transfer Fcn block to instead model the
second-order system
1
G(s) = 2
s + 0.2s + 0.5
and repeat the simulation. Is the result as expected? Select Simulation/
Configuration Parameters and change the stop time to 50 seconds under
Solver. Repeat the simulation and see that the step response indeed con-
verges to the stationary gain 2.
The resolution of the simulation is a bit too coarse to be satisfactory in this
case. Change the relative tolerance to 1e-6 under Solver and repeat the
simulation. Verify that the output looks smoother now.
19
Exercise 6. Simulation using MATLAB/Simulink
d x( t)
= f ( x( t))
dt
The initial state x(0) can be set by editing the initial condition parameter
of the Integrator block.
In this problem we will simulate a liquid tank with a free outflow. A nor-
malized model of the process is given by the nonlinear equation
dh √
=− h+u
dt
a. Model the tank system by creating a new Simulink model like the one below:
b. Run a new simulation where the step change in the input occurs already at
time t = 0 and where the initial state of the tank is h(0) = 1. What is the
response now?
20
Exercise 6. Simulation using MATLAB/Simulink
c. We now want to linearize the tank system around the stationary point
( h0 , u0 ) = (1, 1). Assuming a change of variables, ∆ h = h − h0 , ∆u = u − u0 ,
the analytical solution is given by
d∆ h 1
= − √ ∆ h + ∆u
dt 2 h0
In order to use Simulink for linearization, we must modify the model, adding
explicit input and output blocks to the model. Change the model so that it
looks like below and save it under the new name tank_lin.mdl.
The In1 block is available under Simulink/Sources, and the Out1 block is
found under Simulink/Sinks.
Then use the MATLAB command linmod to linearize the model:
>> h0 = 1;
>> u0 = 1;
>> [A,B,C,D] = linmod(’tank_lin’,h0,u0)
d. We now want to compare the step response of the linearized system to the
step response of the nonlinear system, drawing both responses in the same
MATLAB plot.
Open the original model tank.mdl again. In order to save the variables t
and h to the MATLAB workspace, we must modify the model like below:
21
Exercise 6. Simulation using MATLAB/Simulink
>> plot(t,h)
Finally, compute and plot the step response of the linearized system in the
same figure:
Note that we must add the stationary level h0 to the linear step response if
we want to compare it to the nonlinear response.
How much does the nonlinear and the linear response differ?
6.3 Consider the continuous biological tank reactor from Problem 5.4. Letting
X ( t) denote the biomass concentration, S ( t) the substrate concentration,
and D( t) = q( t)/ V ( t) the dilution rate, the reactor dynamics is modeled by
the nonlinear differential equations
d X ( t) 1 2
= µ( S ( t)) − D( t) X ( t)
dt
d S ( t) 1 2 µ( S ( t))
= D( t) Sin − S ( t) − X ( t)
dt YX / S
µmax S ( t)
µ( S ( t)) =
K S + S ( t)
a. The nonlinear model has been implemented in the Simulink model reactor.mdl,
which is available on the home page. The model has one input, D( t), and
two outputs/states, X ( t) and S ( t). Open the model by typing reactor. Open
up the Reactor block and locate the two state variables (integrator blocks).
What are their initial values?
22
Exercise 6. Simulation using MATLAB/Simulink
c. Modify the model so that it can be linearized by Simulink, i.e., connect the
appropriate input and output ports to the reactor. Save the model in a new
name, e.g. reactor_lin.mdl.
Then use the command linmod to linearize the system around the operating
point:
>> X0 = ...
>> S0 = ...
>> D0 = ...
>> [A,B,C,D] = linmod(’reactor_lin’,[X0;S0],D0)
What are the poles of the linearized system? Is the linearized system stable?
Compare with the answer to Problem 5.4 c.
23
7. Feedback Systems
7.1 For what values of k is the closed-loop system in Figure 7.1 asymptotically
stable?
Σ Σ 1
s Σ 1
s
k −2
−1
a. Gr (s) = K (a P-controller)
1
! "
b. Gr (s) = K 1 + sTi (a PI-controller)
r feedback
v
r e u y
+ Gr + Gp
−1
24
Exercise 7. Feedback Systems
7.3 Consider the buffer tank system in Figure 7.3. The inflow q in is determined
by a nonlinear valve. The valve position, θ , is the manipulated variable. The
inflow q d is a disturbance. The outflow q out depends on the tank level. The
measured process variable is the level in the tank h.
The nonlinear system is linearized around an equilibrium point to give
dy 1 b 1
=− y+ u+ v 0.5 < b < 5
dt T T T
c. Calculate and compare the time constant for the open-loop and the closed-
loop systems.
d. Calculate and compare the static gain from v to y in open loop and closed
loop, respectively.
e. Calculate the static gain from u to y in open loop and see how the value
changes when the parameter b from the nonlinear valve varies from 0.5
to 5. Investigate the ratio between the largest possible static gain and the
smallest possible gain. Repeat the same calculations for the closed-loop
system, that is the static gain from r to y for varying values of b. In the
closed-loop case consider also the influence on the static gain due to small
and large values of the controller gain K.
θ
qd q in
LT h
q out
25
Exercise 7. Feedback Systems
r e u y
+ Gr + Gp
−1
y = G1 u + G2 d
u = K1 d + K2r
u = K1r + K2 y
that handles the process variations better than the feedforward controller
in a–b.
26
8. PID Controller Design
8.2 Solve Preparatory Exercise 3.1 for Laboratory 2, that is, design a PI-
controller
3 Zt 4 3 4
1 1
u( t) = K e( t) + e(τ ) dτ \ U (s) = K 1 + E (s)
Ti 0 sTi
for the process
ρτ1
Gp (s) =
1 + sτ1
so that the closed-loop system gets the characteristic polynomial
s2 + 2ζ ωs + ω 2
In the answer, K and Ti should be expressed in terms of the parameters ρ,
τ1 , ω, and ζ .
8.3 Solve Preparatory Exercise 3.6 for Laboratory 2, that is, design a PID-
controller
3 Zt 4 3 4
1 de( t) 1
u( t) = K e( t) + e(τ ) dτ + Td \ U (s) = K 1 + + sTd E (s)
Ti 0 dt sTi
for the process
ρτ2
Gp (s) =
(1 + sτ1 )(1 + sτ2 )
so that the closed-loop system gets the characteristic polynomial
(s + αω )(s2 + 2ζ ωs + ω 2 )
In the answer, K. Ti , and Td should be expressed in terms of the parameters
ρ, τ1 , τ2 , ω, ζ , and α.
27
Exercise 8. PID Controller Design
8.5 Assume that you are trying to tune a PID controller for the lower tank in
the double-tank process. Figure 8.3 shows the closed-loop step response of
the level in the lower tank when the reference value is changed from 0 to
1 at time zero. From time 300, water is being drained from the upper tank
at a constant rate, i.e. a load disturbance affects the system.
a. You are not satisfied with the oscillatory step response. Which of the follow-
ing actions will give a less oscillatory response?
• Double K
• Double Td
• Halve Ti
b. You are not satisfied with the slow supression of the load disturbance. Which
of the following actions will give a faster supression of the load disturbance?
• Double K
Step Response
1.2
0.8
Amplitude
0.6
0.4
0.2
0
0 2 4 6 8 10 12
Time [s]
Nyquist Curve
ω=1
0
Im
−0.5
−1
−1 −0.5 0 0.5 1
Re
28
Exercise 8. PID Controller Design
1.5
0.5
0
0 100 200 300 400 500 600
Time
• Double Td
• Halve Ti
29
9. Analysis in the Frequency Domain
9.1 The relationship between the outdoor temperature and the temperature
inside a cave is modeled by the transfer function
1
G(s) =
1 + sT
a. Calculate the frequency function G(iω ), the amplitude function pG(iω )p and
the phase function arg G(iω ).
b. Assume that the outdoor temperature varies as a sinusoid with the am-
plitude 5 ○ C over one day, and that the day-average temperature varies as
a sinusoid with the amplitude 8 ○ C over one year. Use the amplitude and
phase functions derived in a to calculate how the temperature will vary
inside the cave.
0.01(1 + 10s)
G(s) =
(1 + s)(1 + 0.1s)
b. The Bode plot of the system is shown in figure 9.1. Determine the output
y( t) (approximately) using the Bode plot instead.
−1
10
Magnitude
−2
10
−3
10
−3 −2 −1 0 1 2 3
10 10 10 10 10 10 10
90
Phase [deg]
45
−45
−90
−3 −2 −1 0 1 2 3
10 10 10 10 10 10 10
Frequency [rad/s]
30
Exercise 9. Analysis in the Frequency Domain
9.3 Consider the Nyquist curves in figure 9.2. Assume that the corresponding
systems are controlled by a P-controller
u = K (r − y )
9.4 The Bode plot and the Nyquist plot of a linear system are shown in Figure 9.3
and Figure 9.4.
a. Determine the amplitude margin of the system using (i) the Bode plot and
(ii) the Nyquist plot.
b. Determine the phase margin of the system using (i) the Bode plot and (ii)
the Nyquist plot.
31
Exercise 9. Analysis in the Frequency Domain
10 1 Amplitude
10 0
10 -1
10 -2
10 -3
10 -2 10 -1 10 0 10 1
Phase
100
-100
-200
-300
10 -2 10 -1 10 0 10 1
0.5
-0.5
Imag
-1
-1.5
-2
-2.5
-3
-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5
Real
32
Exercise 9. Analysis in the Frequency Domain
1.5 1.5
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
-1.5 -1.5
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
-0.2 -0.2
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 -1
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
Figure 9.5 The frequency responses in Problem 9.5. The dotted curves are the input u and
the solid curves are the system output y.
33
10. Control Structures
10.1 This exercise concerns temperature control of a house. We assume that the
temperature in the house, Th , can be controlled with a heater and that Th
can be measured. Th is also affected by the outside temperature, Ty , which
varies with the time of the day, time of the year etc.
There is a controller connected to the heater that controls the house tem-
perature, see Figure 10.1. The transfer function G1 (s) represents the heater
dynamics, G2 (s) describes the temperature dynamics of the house, and H (s)
describes how the outer temperature affects the house temperature. Gr (s)
can be assumed to be a PI-controller.
The existing PI-control works well but is too slow when fast changes in the
outer temperature occur. Therefore, an additional sensor that measures the
outer temperature Ty is installed.
Design the feedforward link Gff (s) so that the disturbance Ty does not have
an impact on the house temperature. For the calculations the following
transfer functions can be assumed:
1 1 1
G1 (s) = G2 (s) = H (s) =
s+1 s + 0.25 s + 0.5
Ty
Gff (s) H ( s)
Tref u Th
Σ Gr (s) Σ G1 (s) Σ G2 (s)
−1
10.2 In this exercise we want to control the level in the reactor shown in Fig-
ure 10.2 (top). The reactor level is controlled by the inflow, which is in its
turn controlled by the valve. This is a cascade control loop. The outflow
disturbance is measured and can therefore be used for feedforward control.
The control system is seen in the block diagram in Figure 10.2 (bottom).
a. Design a P-controller for the inner loop that speeds up the valve by a factor
five.
b. Design a PI-controller for the outer loop that makes the outer closed loop
ten times slower than the inner closed loop. When we have this large dif-
ference in time scale between the inner and outer loop, we can approximate
the inner loop by its steady-state behaviour: Gin (s) ( Gin (0). Also deter-
mine the characteristic polynomial for the closed-loop system (without the
approximation) and check that it is stable.
d. Draw the control system in the process flow sheet in Figure 10.2 (top).
34
Exercise 10. Control Structures
q out
FF
−1
r u1 u2 q in y
Σ PI Σ Σ P
2
s+2 Σ 1
s
−1
−1
Figure 10.2 The reactor (top) and the control structure (bottom) in Problem 10.2.
10.3 Figure 10.3 shows a process where mid-range control is used to regulate a
steam flow. The relationship between the control signals u1 and u2 and the
steam flow y is given by the relationship
1 100
Y (s) = U1 (s) + U2 (s)
1+s 1 + 10s
R2 R1
u1
u2 FT
35
Exercise 10. Control Structures
c. Calculate the closed-loop transfer function from yref (i.e., the reference value
of R 1 ) to y, assuming K = 1 and Ti = 100 in the controllers. Compute the
stationary gain of the closed-loop system.
10.4 Figure 10.4 shows a block diagram of a level control system for a tank. The
influx x( t) of the tank is determined by the valve position and the outflux
v( t) is governed by a pump. The cross section of the tank is A = 1 m2 .
The goal is to control the system so that the level h in the tank is held ap-
proximately constant despite variations in the flow v. The transfer function
of the valve from position to flow is
1
Gv (s) =
1 + 0.5s
feedforward
v
G
F
−1
−1
Figure 10.4 Block diagram of the level control system in Problem 10.4.
36
X. Discrete-Time and Sequential Control
b
X.1 Consider the continous-time system G(s) = s+ a .
1 Td s
U (s) = K ( E (s) + E (s) − Y (s))
Ti s 1 + sTd / N
X.3 What happens if the logical signal, b, becomes true in the functional dia-
grams in Figure X.1.
1 2 1 2 1 2
1 1
b b ab abc
ab
2 2 3 3 4 3 4
X.4 Design a sequential controller for a batch reactor and use Grafcet in order
to describe the controller. The desired sequence is described as follows.
37
Exercise X. Discrete-Time and Sequential Control
X.5 Make a Grafcet diagram that describes a sequence for an automatic gas
chromatograph (GC). The GC takes a sample with a certain sampling in-
terval. Two different top detections are made on every sample. The top
detection is done by an external equipment. This is the specifications on the
sequence:
38
Y. Multivariable Control
Y.1 Figure Y.1 shows a multivariable system with two inputs and two outputs.
u1 y1
1
s+2
6
s+3
u2 y2
1 Σ
s+1
b. Calculate the relative gain array (RGA) of the system. How should two
single loop controllers be connected to a process like this?
c. With the pairing suggested above, the actions of the first controller will still
be visible in the second output. Design a feedforward compensator so that
the interaction is eliminated.
Y.2 In the connected tank system in Figure Y.2 the two tank levels h 1 and h 2
should be controlled by the two influent flows, q 1 and q 2 . A mass balance
over the two tanks gives the following state-space description.
q1 q2
h1 h2
q3 q4
−2
5 6 5 6
1 1 0
ḣ = h+ u
1 −3 0 1
5 6
1 0
y = h
0 1
39
Exercise Y. Multivariable Control
c. Make a dynamical decoupling of the system, i.e. choose new inputs, m 1 and
m 2 , related to the process inputs
5 6 5 6
u1 m1
= D(s)
u2 m2
such that the compensated system G(s) D(s) = T (s) is diagonal.
Y.3 A flash column is used for separation of light components. The process flow
is heated under pressure before the column. In the column there is much
lower pressure, which means that the light components in the feed flow
evaporates (flashes). The column is controlled by two valves, feed and vapor
outlet. These valves are used for control of the liquid level and the column
pressure.
4 2
C D5
L(s) Vf (s)
5 6 6
s+4 s+4
= 4 −s −20
P (s) (s+4)(s+0.5) e s+10 Vv (s)
a. Calculate the relative gain array, Λ. Decide how two PID-controllers should
be connected to the process based on the Λ result.
Y.4 Consider a gas-fired heater. The outlet water temperature T and the oxygen
in the flue gas A can be controlled by adjusting the fuel pressure Psp (flow)
and the stack damper V2 (%) open. A dynamic model is given in a paper by
Zhuang et al. (1987)
0.6 −0.04
C D5
T (s) Psp (s)
5 6 6
2400s2 +85s+1 3000s2 +90s+1
= G(s) = −1.1 0.30
A(s) 70s+1 70s+1
V2 (s)
Y.5 A distillation column is shown in Figure Y.3. Two transfer function descrip-
tions were given in a paper by Waller et al. (1987). The controlled product
compositions were not measured directly. They were inferred from tray tem-
peratures (○ C) near the top, T4 , and near the bottom, T14 . The bottom flow
B and distillate flow D are determined by inventory control. The influence
of the feed composition z f is also included. System I describes "conven-
tional energy balance control" using reflux flow L and boilup V , or rather
steam flow, S, as manipulated variables. System II uses quotient control,
R = D/( L + D), instead of L. The flows are in kg/h, and time is minutes.
40
Exercise Y. Multivariable Control
V, y N
Recycling
Tray N L, x D
L i+1 ,x i+1
Mi
Tray i L i ,x i V i ,y i
Condenser
V i −1 ,y i −1
Accumulator
Feed
F, z f M D, x D
Top product
D, x D
Tray 1
S
Reboiler
Bottom product
B, x B
T4 (s) L(s)
5 6 5 6
= G I (s) + G z f I (s) Z f (s)
T14 (s) S (s)
0.004e−s
C −0.045e−0.5s 0.048e−0.5s
D C D
8.1s+1 11s+1 8.5s+1
G I (s) = , G z f I (s) = −0.65e−s
−0.23e−1.5s 0.55e−0.5s
8.1s+1 10s+1 9.2s+1
T4 (s) R(s)
5 6 5 6
= G I I (s) + G z f I I (s) Z f (s)
T14 (s) S (s)
C 6.7e−0.5s 0.01e−0.5s −0.026e−2.5s
D C D
11s+1 13s+1 23s+1
G I I (s) = , G z f I I (s) =
34e−1.3s 0.35e−0.5s −0.81e−s
12s+1 10s+1 13s+1
a. Assume that the systems should be controlled by two single loop controllers.
Determine, based on the relative gain array, how these should be connected
to the two systems.
41
Exercise Y. Multivariable Control
42
Solutions to Exercise 1. Basics
1.1 a. The situation can be illustrated as in Figure 1.1. The temperature and
flow are detected by the skin of the person taking the shower. Using this
information, the faucets are used to adjust the water flow and temperature
to the desired levels. The situation can be described mainly in terms of
feedback.
Temp Hot
Person Shower
Cold
Flow
c. The scenario can be described as in Figure 1.3. The primary control variable
available is the temperature of the hot plate, upon which the pot containing
the water and the potatoes is placed. The temperature of the potatoes
(which is what we really want to control) is affected only indirectly by
the control signal. During the boiling sequence we use different senses to
measure relevant quantities. Visual as well as audio information can be
used to detect when the boiling starts. We might use a stick or fork to
directly measure the state of the potatoes. We are likely to use feedback
from different measured variables at different times.
1.2 a. The water level is the variable the person wants to control. By looking, we
can measure the water level and affect it with the valve. This is a feedback
system because we are both measuring and affecting the water level.
43
Solutions to Exercise 1. Basics
Heat
Desired Heat
Stove Pot & Water Potatoes
Temperature
Audio / Visual
Human
Softness
If the person instead is watching the inflow, he/she can see the increase
before it affects the water level and can faster adapt the valve when an
increase of inflow occurs. On the other hand, he/she doesn’t know the actual
water level. This is a feedforward system, because we are using measure-
ments of a disturbance (the inflow) and trying to compensate for it. We don’t
affect the inflow with the valve.
b. The block diagram can be drawn as in Figure 1.4. Often, actuators and
sensors are not drawn as separate blocks, but are assumed to be included
in the process (in this case the tank).
44
Solutions to Exercise 1. Basics
(a) The measured process variable is the level. The level transmitter
can be based on measurements of the pressure, measurements of
the capacitivity, or it can be given by a float.
(b) The manipulated process variable is the outflow and the controlled
process variable is the level. The outflow affects the level in the
buffer tank. By closing the control valve the value of the controlled
process variable is increased.
(c) A possible disturbance is variations in the inflow.
3. Exothermic tank reactor:
(a) The measured process variable is the temperature. The tempera-
ture transmitter can be a Hg-thermometer, resistant, semiconduc-
tor, thermo-element.
(b) The manipulated process variable is the heat and the controlled
process variable is the temperature. The temperature of the cooling
water affects the temperature in the tank. By closing the control
valve the value of the controlled process variable is increased.
(c) A possible disturbance is variations in the temperature of the
cooling water.
4. Pump:
(a) The measured process variable is the flow through the valve. The
flow transmitter can be based on measurements of the pressure or
on an induction transmitter.
(b) The manipulated process variable is the flow and the controlled
process variable is the flow. The inflow affects the outflow. By open-
ing the control valve the value of the controlled process variable is
increased.
(c) Variations in the pump velocity is a possible disturbance.
1.5 The left system uses feedback from a level sensor to adjust the outflow. The
right system uses feedforward from a flow sensor in the inflow to adjust the
outflow. The two block diagrams are shown in Figure 1.5.
1.6 An example of how the reactor system could be controlled is given in Fig-
ure 1.6. Several other possibilities exist.
a. In order to measure the process variables one transmitter is needed for each
variable
• one flow transmitter (FT)
• one level transmitter (LT)
• one temperature transmitter (TT)
• one concentration transmitter (CT)
45
Solutions to Exercise 1. Basics
Inflow
Feedback Tank
Controller
Outflow Level
Inflow
Feedforward
Tank
Controller
Outflow Level
Figure 1.5 Feedback (top) and feedforward (bottom) control of the tank level in Problem 1.5.
CC
React.
A
Solv-
ent LC LT
Cooling FC
water TC
TT CT FT
Figure 1.6 A control system for the reactor system in Problem 1.6.
46
Solutions to Exercise 1. Basics
47
Solutions to Exercise 2. State-Space Models
Acc = In − Out
V̇ = u1 − u2
V
We measure y = A. The state-space model becomes
V̇ = u1 − u2
1
y= AV
Acc = In − Out
V̇ = u − q out
√ q
2 V V
where q out = a 2 h = a A . We measure y1 = A and y2 = q out =
q
2 V
a A . The state-space model becomes
q
2 V
V̇ = − a A +u
1
y1 = AV
q
2 V
y2 = a A
Acc = In − Out
V̇1 = u − q 1
V̇2 = q 1 − q 2
q q
2 V1 2 V2 V2
where q 1 = a 1 and q 2 = a 2
A1 A2 . We measure y = A2 . The state-
space model becomes
q
2 V1
V̇1 = − a 1 A1 +u
q q
2 V1
V̇2 = a 1 A1 − a2 2 AV2 2
1
y= A2 V2
2.2 The eigenvalues λ of the matrix A are given by the solutions to the charac-
teristic equation det(λ I − A) = 0.
48
Solutions to Exercise 2. State-Space Models
a. System matrix:
0 1
A=
5 −4
Eigenvalues:
λ − 1 2
−5 λ + 4 = λ + 4λ − 5 = 0
λ1 = 1, λ2 = − 5
The system is unstable, since there is one eigenvalue in the right half plane.
b. System matrix:
A=0
Eigenvalue:
λ=0
c. System matrix:
−2 0 0
A=
1 −3 0
−2 4 −1
The eigenvalues are given by the diagonal elements of A since the system
matrix is triangular:
λ1 = −2, λ2 = −3, λ3 = − 1
The system is asymptotically stable, since all eigenvalues are located in the
left half plane.
2.3 We have
ẋ1 = ẏ = x2
ẋ2 = ÿ = x3
...
ẋ3 = y = − x1 − 2x2 − 3x3 + u
y = x1
49
Solutions to Exercise 2. State-Space Models
50
Solutions to Exercise 2. State-Space Models
mv̇ = − kz + u
ż = v
ż = v
k 1
v̇ = − z+ u
m m
y=z
z
Introducing the state vector x =
, this can be written in matrix form
v
as
0 1 0
ẋ = k
x+
1 u
−m 0 m
y = 1 0 x
51
Solutions to Exercise 3. Input-Output Models
3.1 a. Taking the Laplace transform of the equation and solving for Y (s), we
obtain
K −sL
The transfer function is hence G(s) = e .
s
c. Using the formula G(s) = C (s I − A)−1 B + D, we obtain
s −1
−1
0
G(s) = 1 0
+0
0 s + 0.05 0.01
1 s + 0.05 1 0
= 1 0
s(s + 0.05) 0 s 0.01
0.01
=
s(s + 0.05)
3.2 a. Taking the Laplace transform of the differential equation and solving for
Y (s) gives
V
sY (s) = − Y (s) + U (s)
q
1
Y (s) = U (s)
1 + s Vq
1
G(s) =
1 + s Vq
b. The system has no zeros. The system has a single pole in s = − Vq . As-
suming q, V > 0, the pole is located in left half plane and the system is
asymptotically stable.
52
Solutions to Exercise 3. Input-Output Models
1
Y (s) = G(s)U (s) =
1 + 2s
0.5
0.4
0.3
Output
0.2
0.1
0
0 2 4 6 8 10
Time
3.3 a. In the transfer-function domain, the relation between the input and the
output is given by
s+2
Y (s) = U (s)
s+1
We thus have
(s + 1) Y (s) = (s + 2)U (s)
Taking the inverse Laplace transform gives
dy du
+y= + 2u
dt dt
s+2 1 s+2
Y (s) = G(s)U (s) = · =
s+1 s s(s + 1)
2 1
Y (s) = −
s s+1
y( t) = 2 − e− t
53
Solutions to Exercise 3. Input-Output Models
1.5
Output
1
0.5
0
0 0.5 1 1.5 2
Time
3.4 a.
1 2
Y (s) = G3 (s) G1 (s) + G2 (s) U (s)
4s + 13
Y (s) = U (s)
s2 + 3s
b.
1 2
Y (s) = G3 (s)G1 (s) R(s) − Y (s)
G3 (s)G1 (s)
Y (s) = R(s)
1 + G3 (s)G1 (s)
4
Y (s) = R(s)
s+4
c.
M cp
T=
UA
dθ 2 ( t)
T = θ 1 ( t) − θ 2 ( t)
dt
54
Solutions to Exercise 3. Input-Output Models
Output
0
0 T
Time
Figure 3.1 The water temperature (dashed line) and the mercury temperature (solid line)
as a function of time, when the water temperature is changed as a step at t = 0.
A plot of the solution is shown in Figure 3.1. Note that, eventually, the
thermometer will show the correct temperature.
c. The Laplace transform of the input is
b
Θ 1 (s) =
s2
The output is computed as
b
Θ 2 (s) = G(s) Θ 1 (s) =
s2 (1 + sT )
Inverse Laplace transform then gives
1 2
θ 2 ( t) = b t − T (1 − e− t/T )
A plot of the solution is shown in Figure 3.2. Note that there is a stationary
error of bT in the temperature measurement.
55
Solutions to Exercise 3. Input-Output Models
Output
bT
0
0 T
Time
Figure 3.2 The water temperature (dashed line) and the mercury temperature (solid line)
as a function of time, when the water temperature is increasing linearly.
3.6 a.
Y = G2 ( H1U + G1U + H2 Y )
Y (1 − G2 H2 ) = (G2 H1 + G2 G1 )U
G2 H1 + G2 G1
Y = U
1 − G2 H2
Z = G1 (U + G3 ( Z + G2 Z ))
Z ( 1 − G 1 G 3 − G 1 G 3 G2 ) = G 1 U
G1
Z= U
1 − G 1 G3 − G 1 G 3 G 2
G2 G1
Y = U
1 − G 1 G3 − G 1 G 3 G 2
Here we can directly identify the poles and zeros. The poles are located in
−2 and −3, i.e., in the left half plane, so the process is (asymptotically)
stable. The zeros are located in −1 and 1.
1
U (s) =
s−1
The Laplace transform of the output is
y( t) = 6e−2t − 12e−3t
56
Solutions to Exercise 3. Input-Output Models
57
Solutions to Exercise 4. Step Response
Analysis. MATLAB/Control System Toolbox
G(s) = C (s I − A)−1 B
s + 2 0
−1
5
= 1 1
0 s+3 2
2 5
= +
s+3 s+2
7s + 19
= 2
s + 5s + 6
58
Solutions to Exercise 4. Step Response Analysis. MATLAB/Control System Toolbox
G(s) = C (s I − A)−1 B
s + 7 −1
−2
3
= −2 1
15 s−4 8
1 1
= +
s+1 s+2
2s + 3
= 2
s + 3s + 2
59
Solutions to Exercise 4. Step Response Analysis. MATLAB/Control System Toolbox
b. >> step(sys)
The step response shows that the output (the title angle) grows unbounded
when the input (the steering angle) is a step. It is realistic that the output
deviates, but not that the angle goes towards infinity—a real bicycle will
crash when the tilt angle reaches π /2.
c. >> A = [0 10; 1 0];
>> B = [1; 0];
>> C = [1.3 20];
>> sys = ss(A,B,C,0)
>> pzmap(sys)
In the pole-zero map, it is again seen that one pole is in the right half plane.
d. We have the open-loop system
dx
= Ax + Bδ
dt
φ = Cx
The control law is
δ = K (r − φ ) = Kr − KC x
Inserting this into the equations above gives the closed-loop system
dx
= Ax + B( Kr − KC x) = ( A − B KC ) x + B Kr
dt
φ = Cx
e. >> K = 10;
>> syscl = ss(A-B*K*C,K*B,C,0);
>> step(syscl)
>> pole(syscl)
The closed-loop system is stable with both poles are located in the left half
plane. This seems to correspond well with the step response. It can also be
noted that the step response does not converge to 1 which means the static
gain is not equal to 1. This is usually not desirable since it means the tilt
angle might not end up at the reference value.
4.5 There are several properties to analyze for a dynamical system. First we
can look at the stability for each system. All systems except III have poles
in the left half plane. System III then corresponds to Figure E, since the
amplitude of its oscillations grows. Second, we can look at the steady state
values. System VII has a steady state value where G(0) = 23 for s = 0, which
corresponds to Figure C. There are two systems of order one, I and V, which
corresponds to Figure D. By investigating the time constants for the two
systems, we see that system V has a time constant of 1, which corresponds
to Figure D. The step response for system I would be similar but ten times
slower. We can also investigate the slope of the step response and find that
the first-order systems have a slope similar to Figure D, whereas all other
systems have initial slopes as a parabolic curve. Finally we look at the
damping coefficient ζ for the systems II and VI. We then see that system
VI is less dampened than system II so system VI corresponds to Figure B.
Then system II corresponds to Figure A.
A → II, B → VI, C → VII, D → V, E → III.
60
Solutions to Exercise 5. Linearization
5.1 We have
ẋ = − x3 + u = f ( x, u)
√
y= x = ( x, u)
− x30 + 1 = 0
x0 = 1
Further, y0 = ( x0 , u0 ) = 1.
f f
= −3x2 =1
x u
1
= √ =0
x 2 x u
∆˙x = −3∆ x + ∆u
1
∆y = ∆x
2
ẋ = h( x0 ) + u0 = 0
u 0 = − h ( x0 )
dh 0
• Linearize h( x) by reading the slope a = dx (x )
from the graph. The
equation is already linear in u. After a change of variables,
∆ x = x − x0 , ∆u = u − u0
∆ ẋ = a∆ x + ∆u
61
Solutions to Exercise 5. Linearization
dh
a. u0 = −1 and a = 0
dx (x ) = −2. The linearized system becomes
∆ ẋ = −2∆ x + ∆u
The system is stable (but not asympotically stable), since the eigenvalue
(0) is on the imaginary axis.
dh
c. u0 = 0.5 and a = 0
dx (x ) = 1. The linearized system becomes
∆ ẋ = ∆ x + ∆u
The system is unstable, since the eigenvalue (1) is in the right half
plane.
N 0 ( a − bP 0 ) = 0
P 0 (c N 0 − d ) = 0
b. We should linearize
Ṅ = N ( a − bP ) = f1 ( N, P )
Ṗ = P (c N − d ) = f2 ( N, P )
Around the first stationary point, ( N 0 , P 0 ) = (0, 0), we get the linearized
system
∆ Ṅ a 0 ∆ N
=
∆ Ṗ 0 −d ∆P
Around the second stationary point, ( N 0 , P 0 ) = dc , ba , we get the linearized
! "
system bd
∆ Ṅ 0 − c ∆ N
=
ca
∆ Ṗ b 0 ∆P
62
Solutions to Exercise 5. Linearization
c. For the system linearized around (0, 0), we have a diagonal A-matrix where
the eigenvalues can be directly identified as a and − d. The linearized system
is unstable, since there is one eigenvalue, a, in the right half plane.
!d a
"
For the system linearized around c, b , the eigenvalues are given by
bd
s c
= s2 + ad = 0
det(s I − A) = det
ca
−b s
√ √
with the solutions s = −i ad and s = +i ad. Since the eigenvalues are
located on the imaginary axis, the linearized system is stable, but not
asympotically stable.
where
µmax S 0
µ( S 0 ) =
K S + S0
S0
X 0 = 0, S 0 = S in = 10 g/{, µ( S 0 ) = µmax = 0.98 h−1
K S + S0
µ( S 0 ) K S
µ( S 0 ) = q/ V = 0.5 h−1 , S0 = = 0.2 g/{,
µmax − µ( S 0 )
qYX / S
X0 = ( Sin − S 0 ) = 4.9 g/{
µ( S 0 ) V
b. We should linearize
dX 1 q2
= µ( S ) − X = f1 ( X , S )
dt V
dS µ( S ) q! "
=− X+ S in − S = f2 ( X , S )
dt YX / S V
where
µmax S
µ( S ) =
KS + S
Compute partial derivatives:
f1 q f1 µ( S )
= µ( S ) − = ·X
X V S 3S 4
f2 µ( S ) f2 q X µ( S )
=− =− +
X YX / S S V YX / S S
63
Solutions to Exercise 5. Linearization
where
µ( S ) µmax · K S
=
S ( K S + S )2
d∆ X 1 q2 µ( S 0 )
= µ( S 0 ) − ∆X + · X0 · ∆ S
dt V s
− µ( S 0 ) X 0 µ( S 0 )
3 4
d∆ S q
=− ∆X − + · ∆S
dt YX / S V YX / S s
d∆ X
= 6.125∆ S
dt
d∆ S
= − ∆ X − 12.75∆ S
dt
d∆ X
= 0.48∆ X
dt
d∆ S
= −1.96∆ X − 0.5∆ S
dt
64
Solutions to Exercise 6. Simulation using
MATLAB/Simulink
6.1 –
b. The output is constant since the system is in steady state, see below.
d. The responses have different final values: the nonlinear step response con-
verges to 4, while the linear response converges to 3. The response is very
similar in the beginning, though. See the plot below.
65
Solutions to Exercise 6. Simulation using MATLAB/Simulink
6.3 a. –
>> X0 = 4.9;
>> S0 = 0.2;
>> D0 = 0.5;
>> [A,B,C,D] = linmod(’reactor_lin’,[X0;S0],D0)
A =
0 6.1250
-1.0000 -12.7500
B =
-4.9000
9.8000
C =
66
Solutions to Exercise 6. Simulation using MATLAB/Simulink
1 0
0 1
D =
0
0
>> eig(A)
ans =
-0.5000
-12.2500
d. Open the model reactor.mdl again. Edit the initial values of the integrators
inside the Reactor block, setting X 0 = 4.9 and S 0 = 0.2. Change the value
of the constant input to 0.6, or replace the Constant block by a Step block
that makes a change from 0.5 to 0.6 at time 0 (the result will be exactly the
same). Set the simulation stop time to 2 seconds and run the simulation.
Create a linear state-space system based on the linearization and compute
a step response. Scale the result by 0.1 (the size of the input step), add the
stationary values to the outputs, and plot both results in the same figure:
67
Solutions to Exercise 7. Feedback Systems
1 1
s− k s+2 1
G(s) = =
1 + s−1 k s+1 2 s2 + (2 − k)s + (1 − 2k)
s2 + (2 − k)s + (1 − 2k) = 0
1 Gp (s)
E (s) = R(s) − V (s)
1 + Gr (s)Gp (s) 1 + Gr (s)Gp (s)
a.
I
Gr =K s+a 1 b 1
1
[ E (s) = −
R(s) = V (s) = s
(s + a + bK ) s (s + a + bK ) s
a−b
e(∞) = lim s E (s) =
s→0 a + bK
b. I
1
Gr (s) = K (1 + Ti s )
[
R(s) = V (s) = 1s
s(s + a) 1 bs 1
E (s) = − 2
(s2 + ( a + bK )s + bK /Ti ) s (s + ( a + bK )s + bK /Ti ) s
The final value theorem gives
7.3 a. The open-loop and closed-loop systems are shown in Figure 7.1.
68
Solutions to Exercise 7. Feedback Systems
u 1 y
b Σ 1 + sT
r u y
1
Σ K b Σ 1 + sT
−1
Figure 7.1 The open-loop system (upper) and closed-loop system (lower).
b 1
Y (s) = U (s) + V (s)
Ts + 1 Ts + 1
Kb 1
Y (s) = R(s) + V (s)
Ts + 1 + Kb Ts + 1 + Kb
T
Topen = T, Tclosed =
1 + Kb
1
Gyv,open (0) = 1, Gyv,closed (0) =
1 + Kb
Kb
Gopen (0) = b, Gclosed (0) =
1 + Kb
Gopen (0)max 5
= = 10
Gopen (0)min 0.5
69
Solutions to Exercise 7. Feedback Systems
This shows that if we use small values of K, the gain may vary a factor
10. If we increase K the variation in closed loop decreases. If K → ∞ the
variation disappears, but then there will be problems with measurement
noise and large control signals, which should be avoided.
−Gp (s)
G ev (s) =
1 + KGp (s)
and the Laplace transform of v( t) is V (s) = 1/s. The final value theorem
then gives
1
lim e( t) = lim s E (s) = lim sG ev (s) V (s) = G ev (0) = −
t→∞ s→0 s→0 2+ K
s3 + 6s2 + (12 − K )s + (8 + 4 K ) = 0
Stability conditions:
12 − K > 0 [ K < 12
8 + 4K > 0 [ K > −2 [ −2 < K < 6.4
6(12 − K ) > 8 + 4 K [ K < 6.4
u = −10d + 10r
Now, if the real system is changed to G1 = −0.1 and G2 = 1.1, the resulting
output is
y = (G1 K 1 + G2 ) d + G1 K 2 r = 2.1d − r
which is very far from the desired relation. The disturbance is amplified
and the output has the wrong sign with respect to the reference value. The
feedforward controller yields a system that is very sensitive to variations in
the system parameters, especially G1 .
70
Solutions to Exercise 7. Feedback Systems
G1 K 2
=1
1 − G1 K 1
y = r + 0.01d
That is, a unit gain from r to y and a significant attenuation of the distur-
bance.
If the system parameters are changed to G1 = −0.1 and G2 = 1.1 the
controlled system becomes
y = 1.02r − 0.01d.
As we can see, the system is not significantly changed. The relation between
y and r is close to the requirement and the disturbance is still attenuated.
(In reality we would also have to consider the fact that large values of K
can give large control signals and an increased sensitivity to measurement
noise. In general it is recommended to use a combination of feedback and
feedforward if possible.)
71
Solutions to Exercise 8. PID Controller Design
8.2 —
8.3 —
8.4 Step response method: With the customary notion we obtain a = 0.3 and
b = 0.8. The controller parameters become K = 1.2/ a = 4, Ti = 2b = 1.6
and Td = b/2 = 0.4.
Frequency method: The Nyquist curve intersects the negative real axis in
−1/3 for ω = 1 rad/s, which yields To = 2π /ω = 2π and K c = 3. The
controller parameters become K = 0.6 K c = 1.8, Ti = To /2 = 3.1 and
Td = To /8 = 0.8.
The Lambda method: By drawing the tangent to the step response, an
approximation of the dead time is obtained, L ( 0.8. The step response has
reached 63% of its final value after approximately 2.6 s. The time constant
thus becomes T = 2.6 − 0.8 = 1.8. The static gain is K P = 1. With λ = T,
we get the PID controller parameters
1 L/2 + T
K= =1
K p L/2 + λ
Ti = T + L/2 = 2.2
TL
Td = = 0.33
L + 2T
8.5 a. • Doubling K gives a faster but also more oscillatory response.
• Doubling Td improves the damping
• Halving Ti gives more integral action but also a more oscillatory re-
sponse.
Doubling Td is the correct action.
b. • Doubling K gives faster supression of the load disturbance.
• Doubling Td mainly affects the high-frequency gain of the controller,
and hence does little to improve the supression of the low-frequency
(constant) load disturbance.
• Halving Ti gives more integral action and hence improves the supres-
sion of the load disturbance.
Doubling K and Ti are the correct actions.
72
Solutions to Exercise 9. Analysis in the
Frequency Domain
1
G(iω ) =
1 + iω T
1
pG(iω )p = p
1 + (ω T )2
u( t) = 5 sin(ω 1 t) + 8 sin(ω 2 t)
where ω 1 = 2π 2π
24 rad/hour and ω 2 = 24·365 rad/hour. Since the system is
linear, each component can be analyzed separately.
Over one day, the amplitude of the temperature variation will be
pG(iω 1 )p · 5 ○ C = 0.0038 ○ C
pG(iω 2 )p · 8 ○ C = 2.1 ○ C
where √
0.01 1 + 100ω 2
pG(iω )p = √ √
1 + ω 2 1 + 0.01ω 2
and
arg G(iω ) = arctan 10ω − arctan ω − arctan 0.1ω
For ω = 3 one obtains pG(iω )p = 0.0909 and arg G(iω ) = −0.003 which
gives
y( t) = 0.0909 sin(3t − 0.003)
73
Solutions to Exercise 9. Analysis in the Frequency Domain
b. Reading from the plot yields pG(3i)p ( 0.09 and arg G(3i) ( 0. We obtain
y( t) = 0.09 sin 3t
9.3 The closed-loop system is asymptotically stable for those K > 0 that makes
the Nyquist curve not encircle the point −1.
a. K < 2
9.4 a. The amplitude margin Am tells how much the amplitude can be increased
until the system becomes unstable. It can be calculated from
From the Bode plot it can be seen that ω o ( 2.4 rad/s and that pG(iω o )p (
0.6, see Figure 9.1.
Amplitude
10 1
10 0
0.6
10 -1
10 -2
10 -3
10 -2 10 -1 10 0 10 1
100 Phase
-100
-200
-300
10 -2 10 -1 10 0 ωo 10 1
Figure 9.1 Bode diagram for the system G(s) in Problem 9.4.
Also from the Nyquist plot it can be seen that pG(iω o )p ( 0.6, see Figure 9.2.
This means that the amplitude margin is
1
Am = = 1.67
0.6
74
Solutions to Exercise 9. Analysis in the Frequency Domain
0.5
-0.5
Imag
-1
-1.5
-2
-2.5
-3
-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5
0.6 Real
Figure 9.2 Nyquist diagram for the system G(s) in Problem 9.4.
b. The phase margin φ m tells how much the phase can be decreased before
the system becomes unstable. It can be calculated from
pG(iω c )p = 1
arg G(iω c ) − φ m = −180○
From the Bode plot it can be seen that ω c ( 1.77 and that arg G(iω c ) (
−150○ , see Figure 9.3.
10 1 Amplitude
10 0
10 -1
10 -2
10 -3
10 -2 10 -1 10 0 ωc 10 1
100 Phase
-100
-150
-200
-300
10 -2 10 -1 10 0 10 1
Figure 9.3 Bode diagram for the system G(s) in Problem 9.4.
Also from the Nyquist plot it can be seen that arg G(iω c ) ( −150○ , see
Figure 9.4.
This means that the phase margin is
75
Solutions to Exercise 9. Analysis in the Frequency Domain
0.5
-0.5
Imag -150
-1
-1.5
-2
-2.5
-3
-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5
Real
Figure 9.4 Nyquist diagram for the system G(s) in Problem 9.4.
9.5 When the input signal u( t) is a sinusoidal, the output signal y( t) also
becomes a sinusoidal (after a transient). The relation between the input
signal and the output signal is given by
u( t) = sin(ω t)
y( t) = pG(iω )p sin(ω t + φ )
The amplitude margin Am can be determined from the third frequency re-
sponse. In this response, the phase φ = −180○ and the amplitude pG(iω )p =
0.5. The amplitude margin is given by
1
Am = = 2.0
0.5
The phase margin φ m can be determined from the second frequency re-
sponse. In this response, the amplitude is unchanged, pG(iω )p = 1.0, and
the output y is delayed some time compared to the input u. Measurements
in the figure give that the period of the input is approximately 5.5 seconds.
The delay from a minimum in u to a minimum in y is roughly 2.5 seconds.
This gives a phase lag of φ = 2.5 ○
5.5 · 360 ( 160 . The phase margin is
76
Solutions to Exercise 10. Control Structures
Hence
H (s) s+1
Gff (s) = − =−
G1 (s) s + 0.5
10.2a. The open inner loop Gvalve (s) = s+2 2 has time constant T = 1/2. The closed
inner loop
K 1 Gvalve 2 K1
Gin (s) = =
1 + K 1 Gvalve s + 2 + 2 K1
has time constant T = 1/(2 + 2 K 1 ) = 1/10, if we choose K 1 = 4, which
makes the closed inner loop five times faster.
b. With the approximation Gin (s) ( Gin (0) = 8/10 the outer loop becomes
The requirement that the outer loop should be ten times slower than the
inner loop could be translated to ω = 1. If we then match coefficients as
usual in pole placement design we get ω 2 = K 2 8
TI 10 = 1. We also have to
choose an appropriate damping coefficient ζ . Choose e.g. K 2 = 2.5 and
TI = 2 to get a double pole at −1, which means we have used the damping
coefficient ζ = 1.
Without the approximation we have the characteristic polynomial s3 + 10s2 +
20s + 10, which is stable.
c. Choose the feedforward such that GFF Gin = 1. However, 1/Gin (s) = 18 s + 108
includes taking the derivative of the disturbance. It can be very difficult
and introduce a lot of noise when using a derivate of a measured signal, so
we use the inner loop approximation instead and choose GFF = 1/Gin (0) =
1/0.8 = 1.25. At least the steady state error from a step disturbance is then
eliminated.
77
Solutions to Exercise 10. Control Structures
P Σ
F
PI
FF
u1 ref u2 100
R2
1 + 10s
yref u1 1 y
R1 Σ
1+s
1 100
c. With P1 = 1+s and P2 = 1+10s the closed-loop transfer function can calcu-
lated as
1 1 100
R 1 ( P1 + R 2 P2 ) + 10s2 + 2s + 1
Gcl = == 1+s 1 100s11+10s
100
=
1 + R 1 ( P1 + R 2 P2 ) 1 + 1+s + 100s 1+10s
10s3 + 21s2 + 3s + 1
The stationary gain of the closed-loop system is Gcl (0) = 1, which is exactly
what we want.
10.4 A block diagram for the system is shown in figure 10.3. Mass balance for
the tank yields
dh
A = x( t) − v( t)
dt
Laplace transformation gives ( A = 1 m2 )
1
H (s) = ( X (s) − V (s))
s
1
GT (s) =
s
78
Solutions to Exercise 10. Control Structures
Feedforward
v
GF
−1
P controller Valve Tank
h ref x h
Σ K Σ GV Σ GT
−1
Figure 10.3 Block diagram of the level controlling system in Problem 10.4.
GT G V K K
G(s) = = 2
1 + GT G V K 0.5s + s + K
s2 + 2s + 2 K
(s + ω )2 = s2 + 2ωs + ω 2
GT 1 + 0.5s
H (s) = − V (s) = − V (s)
1 + GT G V K s(1 + 0.5s) + K
GT G V G R K (1 + sTi )
G(s) = =
1 + GT G V G R s(1 + 0.5s)sTi + K (1 + sTi )
79
Solutions to Exercise 10. Control Structures
2K
s3 + 2s2 + 2 Ks +
Ti
(s + ω )3 = s3 + 3ωs2 + 3ω 2 s + ω 3
c. The relation between the flow disturbance v and the level h is given by
GT (G V G F − 1)
H (s) = V (s)
1 + GT G V G R
1
G F (s) = = 1 + 0.5s
GV
80
Solutions to Exercise X. Discrete-Time and
Sequential Control
b dy( t)
G(s) = [ + ay( t) = bu( t)
s+a dt
y( kh + h) − y( kh)
+ ay( kh) = bu( kh)
h
or rewritten
y( kh) − y( kh − h)
+ ay( kh) = bu( kh)
h
or rewritten
1
y( kh) = ( y( kh − h) + bhu( kh))
1 + ah
c. If u( kh) = 0 then the discrete system will converge to a steady state if the
discrete system is stable. A discrete system is stable if the coefficient, α, in
front of the previous y-value is less then one and greater then minus one,
−1 < α < 1.
• In a) this gives: p1 − ahp < 1 [ ah < 2. The forward discretized system
is stable if we choose 0 < ah < 2.
• In b) we get: p 1+1ah p < 1. If G(s) is stable (a > 0) then the backward
discretized system is always stable.
X.2 PID-controller
1 Td s
U (s) = K E (s) + K E (s) − K Y (s)
| {z } Ti s 1 + sTd / N
p( t)
| {z } | {z }
i( t) d ( t)
1 K
I (s) = K E (s) → s I (s) = E (s)
Ti s Ti
81
Solutions to Exercise X. Discrete-Time and Sequential Control
di( t) K
= e( t)
dt Ti
K
i( kh + h) ( i( kh) + he( kh)
Ti
We want to calculate the integration part for the time instant i( kh),
so we change the time argument one step back for all expressions. We
then get
K
i( kh) ( i( kh − h) + he( kh − h)
Ti
When we discretize we also change the notation from i( t) to i( kh)
to emphasize that we now only sample the system in discrete time
instants. We can see that we can calculate the I-part one step in
advance, since i( kh) only depends on values from the previous sample
time.
• Backward discretization of the D-part:
1
D(s) = s K Td (− Y (s))
1 + sTd / N
Td dd ( t) dy( t)
+ d ( t) = − K Td
N dt dt
Td d ( kh) − d ( kh − h) y( kh) − y( kh − h)
+ d ( kh) = − K Td
N h h
This gives
Td K Td N
d ( kh) = d ( kh − h) − ( y( kh) − y( kh − h))
Td + N h Td + N h
X.3 a. The transition between step 1 and step 2 will fire, see Figure X.1.
82
Solutions to Exercise X. Discrete-Time and Sequential Control
1 b becomes 1
true
b b
2 2
1 b becomes 1
true
b b
2 2
1 2
a is true
b become true ab
3
1 2
ab
3 1 2
a is false
b becomes true ab
3
c. Depending on the status of a, the transition will or will not fire, see Fig-
ure X.3.
d. Depending on the status of a, the transition will or will not fire, see Fig-
ure X.4.
X.4 The Grafcet for controlling the batch reactor is shown in Figure X.6.
X.5 The Grafcet for controlling the automatic gas chromatograph is shown in
Figure X.7.
83
Solutions to Exercise X. Discrete-Time and Sequential Control
1 2
a is true
b becomes true ab
1 2 3 4
ab
3 4 1 2
a is false
b becomes true ab
3 4
1 2 a is false or true 1 2
b becomes true
c is false or true
abc abc
3 4 3 4
X.6 The Grafcet for controlling the batch reactor is shown in Figure X.8. Some
additions are made compared with Problem X.4.
84
Solutions to Exercise X. Discrete-Time and Sequential Control
s1
Start
s2 P
L2
s3 Q
T
s4
empty
s5 V
L1
s1
START
s2 SAMPLE
DONE
s3 s6
T1 T3
s4 DETECT s7 DETECT
T2 T4
s5 s8
T5
85
Solutions to Exercise X. Discrete-Time and Sequential Control
s1
s2 P
L2 large + L 3 large
s3 Q
T
s4 toohot L3 large
empty
s5 V s6 error
L1 restart
Figure X.8 The modified diagram from Problem X.4 in order to solve Problem X.6.
86
Solutions to Exercise Y. Multivariable Control
Y.1 a. 1
s+2 0
G(s) =
6 1
s+3 s+1
Gff G21
u2 y2
Σ G22 Σ
Choose the pairing (1 Q 1) and (2 Q 2). Elements are close to one, so the
coupling is probably quite weak.
−G
C D C D
1 12
G11 1 − s+1 3
D= =
−G 21
G22 1 − s+1 2 1
The decoupling filter does not contain pure derivatives or negative time
delays, and can hence be implemented without problems.
87
Solutions to Exercise Y. Multivariable Control
Choose the pairing (1 Q 1) and (2 Q 2), i.e. control the level by the feed
flow and the pressure by the vapor outlet. The elements are close to one, so
the coupling is probably quite weak.
1 − 21
5 6
D(0) =
1 1
−0.04
5 6
0.6
G(0) =
−1.1 0.30
b.
−0.04 −0.32
5 6 5 6 5 6
"T 0.6 2.2 9.1 1.32
Λ = G(0) .∗ G(0)−1
!
= .∗ =
−1.1 0.3 0.29 4.4 −0.32 1.32
c.
−G 2400s2 +85s+1
C D C D
1 12 1
G11 1 15 · 3000s2 +90s+1
D(s) = G21
=
−G 1 11
22 3 1
The transfer functions in the matrix are proper (the degree of the denomi-
nator is the same or larger than the degree of the numerator). The matrix
can therefore be realized.
Y.5 a.
"T
Λ I = G I (0) .∗ G I (0)−1
!
88
Solutions to Exercise Y. Multivariable Control
−17.0 −0.17
5 6 5 6 5 6
6.7 0.01 0.17 1.17
= .∗ =
34 0.35 −0.0050 3.3 −0.17 1.17
89
MATLAB help
Some useful commands from Control System Toolbox
General.
ltimodels - Detailed help on the various types of LTI models.
Data extraction.
tfdata - Extract numerator(s) and denominator(s).
zpkdata - Extract zero/pole/gain data.
ssdata - Extract state-space matrices.
get - Access values of LTI model properties.
Conversions.
tf - Conversion to transfer function.
zpk - Conversion to zero/pole/gain.
ss - Conversion to state space.
System interconnections.
parallel - Generalized parallel connection (see also overloaded +)
series - Generalized series connection (see also overloaded *).
feedback - Feedback connection of two systems.
Model dynamics.
dcgain - D.C. (low frequency) gain.
pole, eig - System poles.
zero - System (transmission) zeros.
pzmap - Pole-zero map.
Time-domain analysis.
step - Step response.
impulse - Impulse response.
Frequency-domain analysis.
bode - Bode diagrams of the frequency response.
nyquist - Nyquist plot.
margin - Gain and phase margins.
Simulation.
sim - Simulate a Simulink model from the command line.
simset - Define options to SIM Options structure.
90