Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Middle East Technical University Department of Aerospace Engineering

AEE 582 Fall 2009 Dr. Ali Türker Kutay

Homework #1
Given: Friday, 09/10/2009 Due: Friday, 16/10/2009 by 6 pm

1. (3 points) For any arbitrary transfer function


𝑎𝑚 𝑠 𝑚 + 𝑎𝑚 −1 𝑠 𝑚 −1 + ⋯ + 𝑎0
𝐺=
𝑏𝑛 𝑠 𝑛 + 𝑏𝑛−1 𝑠 𝑛−1 + ⋯ + 𝑏0
given by its numerator and denominator polynomials in Matlab vector format as
𝑛𝑢𝑚 = [𝑎𝑚 𝑎𝑚 −1 … 𝑎0 ] and 𝑑𝑒𝑛 = [𝑏𝑛 𝑏𝑛−1 … 𝑏0 ], write a Matlab m file that computes its
magnitude and phase for a given frequency vector. A sample m file that computes the magnitude and
phase for a second order transfer function from the analytical expressions was studied in class and is
posted on the website (http://www.ae.metu.edu.tr/~ae582/ in the Examples section: Bode plot
example). You can use this example as basis for your code. Your code should then generate the Bode
magnitude and phase plots (in degrees) and Nyquist plot from the computed magnitude and phase data.
The frequency vector will only include positive frequencies, but the Nyquist plot should be generated
using both the positive and negative frequencies.

In the class it was discussed that the transfer function 𝐾 𝑠 = 𝑠 is not physically realizable (you can still
generate its Bode and Nyquist plots though!). Using your code make the Bode and Nyquist plots for
𝐾 𝑠 =𝑠
and a realizable approximation for it given by
𝑠
𝐾 𝑠 =
0.1𝑠 + 1
a) for the frequency vector w=logspace(-3,-1,100)
b) for the frequency vector w=logspace(1,3,100)
For the Bode plots set the phase axis range from 0 to 90 degrees using the command ylim([0 90]).
Do the same by using the built-in Matlab functions bode and nyquist and make sure that your code
gives the same results.
Hint: You can use the Matlab function polyval to evaluate the numerator and denominator
polynomials for 𝑗𝜔. This will reduce the amount of code you need to write for this question to modify
the BodeExample.m file to just a few lines. You will get 2 extra points if you do not use the polyval
command.

2. A new graduate research assistant working in the controls lab is given an assignment to design and build
a controls experiment for undergraduate controls courses. The experiment is to control the position of
a mass attached to a wall with a spring and damper, similar to the example studied in the class. A
schematic of the setup is shown below.

1
Middle East Technical University Department of Aerospace Engineering
AEE 582 Fall 2009 Dr. Ali Türker Kutay

𝑚: mass in kg
𝑦 𝑢 𝑦 𝑦: position in m
𝐾𝑠 𝑦 𝑢: position of the control cart in m
𝑚 𝑚 𝐾𝑠 𝑢 − 𝑦
𝐵𝑦 𝐾: linear spring constant in N/m
𝐵: damping coefficient in Ns/m

The mass is to slide along rails with negligible friction. Different from the example in the class, instead
of applying a force directly to the mass, the mass is pulled through a second spring that has the same
stiffness 𝐾 as the first one. The other end of the second control spring is attached to another cart that
slides along the same rail. The position of the control cart 𝑢 is directly controlled with a servo motor
and is the control input for the experiment. The student writes the transfer function for the experiment
as

𝑦 𝑠 𝐾
𝐺 𝑠 = = 2
(1)
𝑢 𝑠 𝑚𝑠 + 𝐵𝑠 + 2𝐾
and designs the following PID controller:

𝐾𝐼
𝐺𝑐 𝑠 = 𝐾𝑎 𝐾𝑃 + + 𝐾𝐷 𝑠 . (2)
𝑠
The block diagram for his design is given below.

𝑒 𝑢
𝑟 𝐺𝑐 𝐺 𝑦 𝑟: reference mass position
− Controller Plant 𝑦: position of the mass
𝑢: control input (control cart position)

He performs some frequency domain analysis by using the loop transfer function 𝐿 𝑠 = 𝐺𝑐 𝑠 𝐺 𝑠 and
concludes that the system has infinite gain margin, meaning he can pick 𝐾𝑎 as large as he wants and the
closed-loop system will still be stable. He turns in his design with the following parameters:

m = 0.1;
K = 2;
B = 0.15;

% PID controller gains


Kp = 5;
Kd = 2;
Ki = 1;
Ka = 50;

a) (1 point) Examine the closed-loop stability of his design by making a Nyquist plot of 𝐿 𝑠 =
𝐺𝑐 𝑠 𝐺 𝑠 using your code. You can use the frequency vector w = logspace(-1.5,5,1000)'.
Determine the gain and phase margins graphically from your Nyquist plot and verify them with the
ones you get from the Matlab command margin(L). Is the student correct?
b) (1 point) Make a Simulik diagram for the above design by using a single transfer function block for
𝐿 𝑠 = 𝐺𝑐 𝑠 𝐺 𝑠 instead of having two transfer function blocks for 𝐺𝑐 𝑠 and 𝐺 𝑠 separately as

2
Middle East Technical University Department of Aerospace Engineering
AEE 582 Fall 2009 Dr. Ali Türker Kutay

shown in the block diagram above. Simulate the system for 0.1 seconds for a step reference
command of 𝑟 = 1. Find the time it takes for the mass to reach 𝑦 = 0.8 m (you can read this from
the plot). Can you use separate blocks for 𝐺𝑐 𝑠 and 𝐺 𝑠 ? Why?
c) (1 point) The student attempted to build the experiment setup and quickly discovered that the
controller he designed in (2) is not realizable. His advisor recommended implementing his controller
as follows:

𝐾𝐼 𝐾𝐷 𝑠
𝐺𝑐𝑟 𝑠 = 𝐾𝑎 𝐾𝑃 + + . (3)
𝑠 𝜏𝑠 + 1
Modify the Simulink file you made in part b) to replace the controller 𝐺𝑐 𝑠 with 𝐺𝑐𝑟 𝑠 and this
time put 𝐺𝑐𝑟 𝑠 and 𝐺 𝑠 separately. Simulate the system with 𝜏 = 0.001 seconds for the same
case in part b) and compare the responses. Find the largest value of 𝜏 so that the overshoot
remains below 5%. You can find this by trial and error from the simulation.
d) (2 points) Another aspect that is critical for implementing the experiment setup mechanically is the
servo mechanism used to drive the control spring. We can introduce the servo mechanism 𝐺𝑎𝑐𝑡 as
an additional block as follows:
𝑒 𝑢𝑐 𝑢
𝑟 𝐺𝑐𝑟 𝐺𝑎𝑐𝑡 𝐺 𝑦
− Controller Servo Plant

where 𝑢𝑐 is the commanded cart position and 𝑢 is the actual position of the cart driven by the servo.
The student assumed an ideal servo mechanism. In other words he assumed that 𝐺𝑎𝑐𝑡 𝑠 = 1, or,
the position of the cart can be controlled precisely without any errors or delays. In reality any servo
mechanism has some dynamics. Assume that a typical servo that can be used for this experiment
setup has second order dynamics as
1
𝐺𝑎𝑐𝑡 𝑠 = 2
𝑠 2𝜉𝑠
+ +1
𝜔𝑛2 𝜔𝑛
where 𝜔𝑛 and 𝜉 are the natural frequency and damping ratio. The best servo the student can find
for his experiment has 𝜔𝑛 = 100 rad/s and 𝜉 = 0.8. Make a Nyquist plot for the system that will
actually be implemented (𝐿 𝑠 = 𝐺𝑐𝑟 𝑠 𝐺𝑎𝑐𝑡 𝑠 𝐺 𝑠 ) and determine if the system will be stable for
the 𝜏 you found in part c) and the best servo that is available. Find the gain and phase margins. You
can read them from the Nyquist plot, or use the margin command directly.
e) (1 point) From the gain margin you found in part d) compute how much the student needs to
change the gain 𝐾𝑎 to make the experiment stable (keeping 𝐾𝑃 , 𝐾𝐼 , and 𝐾𝐷 fixed). You are only
looking for a stable response, do not worry about how the response looks like at this point. Plot the
step response for 𝑟 = 1 and compare it with the responses you obtained in parts b) and c) (with the
𝜏 that gives less than 5% overshoot).
f) (1 point) Find a value for 𝐾𝑎 (keeping 𝐾𝑃 , 𝐾𝐼 , and 𝐾𝐷 fixed) that gives less than 5% overshoot. Plot
the step response for 𝑟 = 1 in the same figure with the step responses from b), c), and e). Find the
time it takes for the new controller for the implementable experiment to reach 𝑦 = 0.8 m.
Compare this value with the one you found in part b) for the ideal case.

You might also like