Gert Witvoet
G.Witvoet@tue.nl
Gert.Witvoet@tno.nl
2
Exercise
(s + 2)2
s2 (s + 3)(s2 + s + 25)
(1.1)
(j + 2)2
,
2 (j + 3)( 2 + j + 25)
(1.2)
which is a complex function. The expressions for the magnitude and phase of its real and
imaginary parts are the exact definitions of the Bode diagrams. These expressions can be very
complicated (you might want to try this yourself as an exercise). Fortunately, the asymptotes
(slopes) for limit cases like 0 and can also be determined directly from P (s)
with s 0 and s .
d) For the limit case 0, determine the asymptote of P (s) in terms of s. To what
slope does this correspond?
e) For the limit case , determine the asymptote of P (s) in terms of s. To what
slope does this correspond?
f) Compare the answers to b, c with d, e and draw your conclusions.
g) Verify your results by drawing a Bode diagram.
1.2
Exercise 1.1 indicated that you can predict parts of the Bode diagram by using system properties like the number of poles or the relative degree. Now lets turn this around.
For the Bode diagrams below, determine
3
Magnitude [dB]
Bode diagram
180
Phase [degrees]
Phase [degrees]
90
90
0
90
180
180
Frequency [Hz]
Frequency [Hz]
Download the frequency response fitting toolbox frffit.zip from OASE, extract the files
to a Matlab directory (e.g. $matlabroot\toolbox\frffit) and add this directory to the
Matlab path (e.g. by using pathtool.m). In the end type >>rehash toolbox.
1.3
Download frfdata.mat from OASE and load it in your workspace. It contains two plant
measurements, stored in a frequency vector hz and complex response vectors H1 and H2.
Plot the frequency reponses of both measurements in a Bode diagram. Which of the
two plants is unstable? Predict the location of the unstable poles (in Hz) from the Bode
diagram.
Make models of the two measurements using either frsfit.m (stable fit) or frfit.m
(possibly unstable fit). Choose an appropriate structure (number of poles, zeros and
integrators) and choose an inverse weighting function (type >>help frsfit first).
What are the unstable poles of your model? Does this match your previous result?
Create a system from the obtained model parameters (e.g. by using ss.m or tf.m).
Plot your systems together with the data in a Bode diagram and comment on them.
Without designing a controller, which of the two plants do you think is easier to control
(i.e. with a small controller order) to a 20Hz bandwidth? Explain why.
Exercise
2.1
A notch filter is a controller element which is meant to suppress a very specific frequency. It
is defined, in continuoustime, as
1
s2 +
(2f1 )2
F (s) =
1
s2 +
(2f2 )2
21
s+1
2f1
,
22
s+1
2f2
where f1 and f2 are the locations of the zeros and poles (in Hz) respectively, and 1 and 2
are the dampings of these zeros and poles. For a pure notch filter f1 = f2 .
a. Create a Simulink model with a notch filter, e.g. with a standard Transfer Fcnblock
from the Simulink library. Apply a broadband noise (Random number) as input to
the filter. Place the zeros (numerator) and the poles (denominator) of the notch at
40 Hz, with a damping of 0.01 for the zeros and a damping of 1 for the poles.
b. Simulate the notch over a time interval of 30 s with a fixed step solver (e.g. ode1 or
ode3) with a step size of 0.001 s. Save both the input and output of the filter to the
Matlab workspace. Compare the filter response with its input in time domain. Do
you see any difference?
c. Compare the input and output in frequency domain by calculating their auto power
spectral densities. What do you see now? Hint: see Matlab functions fft.m, pwelch.m
or periodogram.m.
d. Determine the FRF of the notch filter using the ratio between the appropriate cross and
auto power spectral densities. Also, determine the corresponding coherence function.
Does the outcome match your expectation? Hint: see Matlab functions cpsd.m and
mscohere.m.
e. Increase the damping of the zeros by a factor 10. How do the FRF and coherence
change? Explain what you see.
2.2
In this exercise you will perform a closedloop FRF measurement of a simple mass, controlled
by a PD. Mathematically, this plant and controller are defined as
H(s) =
1
ms2
and
C(s) = P + Ds,
2.3
Download the Simulink file frf_ex3.mdl from OASE (this file is meant for Matlab r2006b
or higher; Matlab 7.0.4 users can download frf_ex3_m7.mdl, Matlab 6.1 users can download
frf_ex3_m6.mdl).
1. Open the Simulink file frf_ex3.mdl. This model simulates a real experiment, where the
plant FRF has to be determined. It contains an unknown lowbandwidth controller, and
an unknown plant. Assume that the controller cannot be measured separately. Check
whether the simulation parameters are set to the right values: fixedstep solver, ode1
(Euler), simulation time of 30 seconds with a step size of 0.001.
2. Determine the sensitivity of the closed loop system by performing an FRF measurement,
i.e. by inserting noise at the right place and measuring the right signals. Use the
Matlab function tfe.m or tfestimate.m, and choose nfft such that the resolution of
the frequency vector is 0.25 Hz. Choose noverlap to be half this size. Make sure to plot
6
the amplitude, the phase and the coherence of the sensitivity. Why is the coherence
not equal to 1 at low frequencies? So between which frequencies is this measurement
reliable?
3. Which signals have to be measured to determine the process sensitivity of the closed
loop? Perform this measurement. Make sure to plot the amplitude, the phase and the
coherence of the process sensitivity. What happens to the coherence at high frequencies?
Can you explain this? Between which frequencies is this measurement reliable?
4. How can you determine the plant dynamics using only sensitivity and process sensitivity
(without measuring the controller)? Determine the plant FRF and plot amplitude and
phase. Keeping in mind that this is a simulation of a real experiment, what could cause
the two high frequent phenomena: bad amplitude estimate and phase drop? How much
is this phase drop and can you explain this?
5. Repeat this exercise with different values for nfft en different simulation times in
Simulink. What differences do you notice and how can you explain these differences?
Exercise
Stability
3.1
Consider the classic massspringdampermass system, depicted in figure 3.1. A motor applies
a force F to a mass m1 , resulting in translations x1 and x2 of both masses m1 and m2 .
x1
F
x2
m1
m2
d
3.2
Inverted pendulum
Consider the inverted pendulum problem, see figure 3.2. The objective of this problem is to
keep the pendulum in upward vertical position = 0, by only applying a horizontal force F
to the cart. It is easy to see that this system is nonlinear. However, around the equilibrium
= 0 the system can be linearized, resulting in the following transfer function (you might
want to show this yourself):
H(s) =
(s)
s
= 1
,
2
3
F (s)
6 (4M + m)Ls 3 Lbs2 + g(M + m)s + gb
(3.1)
where L is the length of the pendulum and b is the friction between the cart and the floor.
Furthermore, assume that
M = 0.05,
m = 0.04,
b = 0.02,
g = 9.81,
L = 0.15.
Fg = mg
M
x
3.3
s3
s+6
+ 20s2 + 5000s
s3
s6
.
+ 20s2 + 5000s
10
Exercise
4.1
11
4.2
Noncollocated plant
r

d
C
12
4.3
For this exercise you will need the ShapeIttoolbox installed. The ShapeIttoolbox can be
downloaded for free from the CSTwiki http://cstwiki.wtb.tue.nl. You also need to download waferstage.mat from OASE.
1. Load waferstage.mat in your workspace. It
contains a specific FRFmeasurement (hz,frf)
of a wafer stage.
2. Use frsfit.m to make a model of this measurement. Make an appropriate estimation of
struc = [nden,nnum,nint] beforehand and use
an inverse weighting function.
3. Use either your model or the FRFmeasurements
in ShapeIt to design a controller (and answer the
questions) in the following steps:
Try to obtain a high as possible bandwidth (400Hz should be possible!), maintaining a robustness margin S < 10dB, phase margin over 30 and gain margin of at
least 6dB.
A typical control scheme for this system is shown below:
em
r

d
C
ym
The goal of controller design is usually to minimize e = ry (6= em ). With this the
influence of the various input signals can be derived:
e = r y = r CP em d = r CP (e ) d
Which transfer function thus denotes the influence of the measurement error ?
Assume that this measurement error contains frequencies of 100Hz and higher.
These frequencies should thus be suppressed (smaller than 0dB) by the transfer
function of the previous question. Is your highbandwidth controller capable to do
so? Why (not)?
Again design a controller with a high as possible bandwidth, but now also suppressing measurement errors of 100Hz and higher.
Play around with ShapeIt and try to get used to the toolbox. Try to import your own systems, design different controllers and compare them, export your controller to Simulink, etc.
Convince yourself that ShapeIt can save you time, especially during the experiments.
13
Exercise
Feedforward control
5.1
1000 3202
.
+ 20s + 3202)
s2 (s2
Design a stabilizing controller with a bandwidth of 10 Hz. Use a third order setpoint and
apply an acceleration feedforward to achieve the lowest tracking error possible. Can you
explain this acceleration feedforward by looking at the transfer function?
5.2
Open ShapeIt and choose the first example (mass) as plant. Assume that this plant represents a rotating mass connected to a DCmotor. The transfer function is thus from a motor
voltage in [mV] to a rotation in [rad]. Furthermore assume that this rotation is measured
with an encoder with 8000 pulses per revolution.
Determine the resolution of the measurements in [rad].
Design three simple controllers (leadfilters) yielding bandwidths of 1 Hz, 10 Hz and
100 Hz, each one with the same robustness margins.
Choose the default 3rd order setpoint in ShapeIt as the reference and compare the time
responses of each of the closed loops. Which controller would you prefer for feedforward
design? Explain why.
14
5.3
ShapeIt is a very useful tool to design both a suitable trajectory and an appropriate controller
for eventual feedforward tuning. A good exercise is the following.
Load the viscous damping example, and design a controller and a 3rd degree setpoint,
such that the error profile has the desired shape (and magnitude) to accurately tune the
feedforward terms kf a and kf v later on. Export the plant and the controller, implement them
in a Simulink closed loop scheme, and tune these feedforward terms to suppress the error.
Note that you still need the Ref3toolbox to implement your designed reference trajectory.
5.4
Feedforward design
15
Experiments
X.1
Connect the setup for the motorfeedback case. Replace ref3 for a constant 0 for this exercise.
a. Start with Kp = Kd = 0; carefully increase Kp . Feel stiffness.
b. Start with Kp = Kd = 0; carefully increase Kd . Feel damping.
c. Alternately increase Kp and Kd , without the system getting unstable. Feel the influence of each change. Use the error signal for evaluation of the found values for Kp and
Kd , and try to find an optimal setting.
d. Is it theoretically possible for the system to become unstable? Does this correspond
to your observations? Explain why (not).
X.2
For parts a, b and c use the closed loop Simulink scheme. Connect the setup in the motorfeedback case.
a. Determine the plant FRF using a sampling frequency of 4000 Hz. What do you
observe? Try to relate all (anti)resonances and phase phenomena to the setup.
b. Change the sampling frequency to 2000 Hz and 1000 Hz respectively and again determine the plant FRF. Compare the measurements. What do you observe?
c. Design 2 or 3 different PDcontrollers with significantly different bandwidths and measure the sensitivity and plant FRF of the system for each controller. Interpret results,
and determine the influence of the bandwidth on your measurements.
d. Measure again the plant FRF, but now in openloop using QadScope. Compare the
result with the closedloop measurement.
16
X.3
Connect the setup for the loadfeedback case (both in hardware and Simulink).
In this experiment youll need to show all your loopshaping tricks to design and implement a
high performance controller for the system.
a. Look back to exercise 3.1 and try to predict the new frequency response based on your
previous (motor feedback) measurements. Design a very simple controller based on
this prediction which should stabilize the load feedback case.
b. Perform an FRF measurement with this controller, using a sampling frequency of 4000
Hz. Interpret the result by explaining what you see.
c. Design a controller (offline) with an as high as possible bandwidth, given the constraints of stability and max(S) < 6dB. Show your designed transfer functions of
CH and S and determine the bandwidth.
d. Implement the designed controller in an experiment. If you run into problems (broken
axis, unstable system, etc), try to explain why, and solve it!
e. Measure the actual achieved open loop and sensitivity transfer functions (CH and S),
and show these in your report. Determine from these transfers the achieved bandwidth.
Mention the controller parameters youve used in your report!
f. Optional: Alternatively, you might try to design your controller online using pato03.mdl
and the available RTscope. Tuning must be done with care however! Small parameter
changes might lead to instability immediately!
Notice:
The system is very critical under load feedback, so start with a very safe Kp and Kd
and first do a frequency response measurement (part a.)
Then tune in a safe way and use ShapeIt to create filters.
Keep the cover in place for protection of your eyes. The axis can break and fly around!
X.4
Feedforward Tuning
Connect the setup for the motorfeedback case. You might want to use pato01.mdl (with a
realtime implementation of QadScope) instead of mini01.mdl for this exercise.
a. Define an appropriate (and challenging) setpoint trajectory and monitor the tracking error. Use a welltuned PD controller, i.e. a controller which is suitable for a
feedforward tuning procedure.
b. Minimize the error by adjusting the feed forward gains Kf c , Kf v and Kf a .
c. Determine the level of improvement.
17