ME 5281 Fall 215 Homework 8 Due: Wed. Nov. 4th; start of class. Reading: Chapter 1 Part A: Warm Up Problems w/ Solutions (graded 4%): A.1 Non-Minimum Phase Consider the following variations of a system: Stable Zero, Stable Pole: G 1 (s) = (s+1)/(s+1) Unstable Zero, Stable Pole: G 2 (s) = (s-1)/(s+1) Stable Zero, Unstable Pole: G 3 (s) = (s+1)/(s-1) Stable Zero, Unstable Pole: G 4 (s) = (s-1)/(s-1) (a) Sketch (or draw with Matlab) the Bode Plot for the following systems. Use the same axes for all windows: Gain: -2dB to db; Phase: -18 to 18. Make the frequency axis in Hz and range from 1^-2 to 1^2 Hz. (hint: h=bodeplot(1*g{i}); setoptions(h,'frequnits', 'Hz'); grid on % & use the axis command ) (b) Add the Gain and Phase margins for each plot. (hint: [Gm,Pm,Wgm,Wpm] = margin(g1}); title({ My system Title ; ['GM = ' num2str(db(gm)) ' db PM = ' num2str(pm) '\circ']}) (c) Do the magnitude plots change between the systems? Does the phase? (d) For the two stable systems (G 1 and G 2 ), what is the range of gain K that ensures stability if we implement a unity feedback configuration? (e) For the two stable systems (G 1 and G 2 ), which has a smaller range of phase (i.e., minimum phase)? SOLUTION: %% Hwk 6 Problem 2 Solution; Matlab Code clear G % define systems G{1} = (s+1)/(s+1) G{2} = (s-1)/(s+1) G{3} = (s+1)/(s-1) G{4} = (s-1)/(s-1) % Provide labels Lbls = {'Stable Pole, Stable Zero',... 'Stable Pole, Unstable Zero',... 'Unstable Pole, Stable Zero',... 'Unstable Pole, Unstable Zero'} figure(1); clf for i=1:length(lbls) subplot(2,2,i) h=bodeplot(1*g{i}); setoptions(h,'frequnits', 'Hz'); [Gm,Pm,Wgm,Wpm] = margin(1*g{i}); title({lbls{i}; ['GM = ' num2str(db(gm)) ' db PM = ' num2str(pm) '\circ']}) axis([1^-2, 1^2, -18 18]) grid on
Phase (deg) Phase (deg) Phase (deg) Phase (deg) end a & b): Stable Pole, Stable Zero GM = Inf db PM = -18 Stable Pole, Unstable Zero GM = 2 db PM = -18-1 -1-2 18 9-9 -18 1-2 1-1 1 1 1 1 2-2 18 9-9 -18 1-2 1-1 1 1 1 1 2 Unstable Pole, Stable Zero GM = 2 db PM = -18 Unstable Pole, Unstable Zero GM = Inf db PM = -18-1 -1-2 18 9-9 -18 1-2 1-1 1 1 1 1 2-2 18 9-9 -18 1-2 1-1 1 1 1 1 2 (c) Do the magnitude plots change between the systems? Does the phase? No, Magnitude is identical. The Phase changes in each plot. (d) For the two stable systems (G 1 and G 2 ), what is the range of gain K that ensures stability if we implement a unity feedback configuration? This is the gain margin. For G 1, K: <K< and G 2, K: <K< 1 (it can increase by 2dB) (e) For the two stable systems (G 1 and G 2 ), which has a smaller range of phase (i.e., minimum phase)? G 1 has a smaller range of phase. It is minimum phase. G 2 is non-minimum phase. A.2 Time Delay Consider the following system a) Find the phase margin if the system is stable for time delays of,.1,.2,.5, and 1 second. b) Find the gain margin if the system is stable for each of the time delays given in Part a. c) For what time delays mentioned in Part a is the system stable?
d) For each time delay that makes the system unstable, how much reduction in gain is required for the system to be stable? Solution: a.) The magnitude response is the same for all time delays and crosses zero db at.5 rad/s. The following is a plot of the magnitude and phase responses for the given time delays: Time Delay Phase Margin Stability 93.3 Stable.1 55.1 Stable.2 17 Stable.5-97 Unstable 1 72.2 Unstable based on GM To create the bode plots in matlab use the following commands: s = tf('s'); Td =.1; % value of the delay,.1,.2,.5,1 G = 1/((s+5)*(s+1)); Delay = exp(-s*td); figure; clf; margin(g*delay); grid on; b.) For T =, the phase response reaches 18o at infinite frequency. Therefore the gain margin is infinite. The system is stable. For T =.1, the phase response is -18o at 11.4 rad/s. The magnitude response is -5.48 db at 11.4 rad/s. Therefore, the gain margin is 5.48 db. The system is stable. For T =.2, the phase response is -18o at 7.55 rad/s. The magnitude response is -1.9 db at 7.55 rad/s. Therefore, the gain margin is 1.9 db and the system is stable. For T =.5, the phase response is -18o at 4.12 rad/s. The magnitude response is +3.9 db at 4.12 rad/s. Therefore, the gain margin is 3.9 db and the system is unstable. For T = 1, the phase response is -18o at 2.45 rad/s. The magnitude response is +4.84 db at 2.45 rad/s. Therefore, the gain margin is -4.84 db and the system is unstable. c.) T = ; T =.1; T =.2 d.) By looking at the gain margin T =.5, -3.9 db; T = 1, - 4.84 db;
Part B: Full Problem (graded 6%): B.2 Root Locus Your team inherits a very expensive desktop 3D printer/3-axis mini-mill combo. It has excellent actuators, mechanisms, sensors and a high-end controller for each axis. The previous owner tried to improve its speed by tweaking gains and now the system is useless. The documentation states that each axis is controlled via the diagram below. The software interface allows you to easily set Kp, Ki, Kd individually in the Gc block. You cannot change G or H. You are asked to _x this system. Each axis must meet or exceed the following specs: - Ts =.5 seconds - % OS for position commands - steady-state error to a step input (position control) and steady-state error to a ramp input (velocity control) For this problem, only consider one axis. a) The documentation describes a DC motor driving a linear gear train G = b and an expensive s(s+a) optical encoder with a flat frequency response." Based on this, assume H = 1. Given the Bode Plot, state the transfer function GH with numeric quantities. b) The Gc block is labeled `PID controller' which is documented by the following diagram. Given the high cost of the PID controller assume that it is ideal for this problem and thus can have more zeros than poles (i.e. the missing poles are so fast that they can be ignored). What is the transfer function Gc?
c) Use Root Locus to design a controller for this system that meets all design specifications. Assume the PID controller is ideal and H = 1. Assume you can place a pole or zero within +/-.5 with this expensive setup. Be sure to: - Sketch the root locus of your controller and system GcGH - Indicate the regions where your closed-loop poles meet all specifications (make them bold or use a different color). - Indicate what the gains Kp, Ki, Kd must be set to in order to meet these specifications. Provide numerical values for at least two gains. You can indicate the third gain as a region on your root locus plot between values k1 and k2 that you could get via MATLAB or similar tools. Mark the positions that correspond to gains k1 and k2 with arrows such that k1 < K? < k2. d) Suspicious of H = 1, you find the datasheet for the position sensor H. It turns out that yes, it reports position exactly (gain =1) so the Bode Plot magnitude is indeed flat. However, the sensor has constant 1ms time delay. If you estimate that the PM of your closed-loop system designed above is 9 deg at ω db = 5 Hz, with this 1ms delay will your system be stable? Explain your answer. [Hint: A time delay transfer function for T seconds of delay is: G delay (s) = exp( st) Consider that the frequency domain magnitude is constant G delay (jω) = 1 but the angle is: angle G delay (jω) = ωt] e) A truly ideal PID controller cannot exist in the real world. Its transfer function cannot have more finite zeros than finite poles. For this problem, assume that the expensive PID controller actually has an extremely fast pole at s = 1e6. Now, what is the approximate maximum overall gain you can set (the gain that moves closed-loop poles along root locus branches) that yields zero overshoot?
B.3 Root Locus and Time delay. You are given a motor and potentiometer and you measure the sinusoidal response of the system to obtain the Bode phase and magnitude plots. (Hint: the low pass filter has a cut off frequency of f c = 1 rad/s.
a. Given the following Bode plots what is the phase and gain margin b. Sketch the root locus plot from the bode plots and indicate the jω axis crossing on both the root locus and bode plot. c. We want to track a ramp. Potentiometer are noisy and bad at velocity tracking, so you decide to purchase an encoder [CUI Inc. AMT12-V], assume H = 1. (high resolution). The encoder allows you to remove the lowpass filter resulting in the bode plot below i. Specify a controller G c that has a maximum of 2 poles and 2 zeros. i.e. G c = K (s+z 1)(s+z 2 ) (s+p 1 )(s+p 2 ) ii. Sketch the open loop root locus and bode plots iii. Can you create a controller to track a ramp? d. You decide to implement your controller with a microcontroller [Arduino Uno] and have a time delay of T d = 1 ms while your code is executing. i. Specify a controller G c that has a maximum of 2 poles and 2 zeros. i.e. G c = (s+z 1)(s+z 2 ) (s+p 1 )(s+p 2 ) ii. Sketch the open loop bode plots iii. Can you create a controller to track a ramp?