Open-loop Bode Plot
Phase-Lead Controller
Adding More Phase
The open-loop transfer function of the plant for the ball and beam experiment is given below:
The design criteria for this problem are:
To see the derivation of the equations for this problem refer to the ball and beam modeling page. A schematic of the closed loop system with a controller is given below:
m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); %simplifies input num = [-K]; den = [1 0 0]; bode(num,den)
You should get the following Bode plot:
From this plot we see that the phase margin is zero. Since the phase margin is defined as the change in open-loop phase shift necessary to make a closed-loop system stable this means that our zero phase margin indicates our system is unstable. We want to increase the phase margin and we can use a lead compensator controller to do this. For more information on Phase and Gain margins please refer to the Frequency Response Tutorial.
The phase-lead compensator will add positive phase to our system over the frequency range 1/aT and 1/T, which are called the corner frequencies. The maximum added phase for one lead compensator is 90 degrees. For our controller design we need a percent overshoot of 5, which corresponds to a zeta of 0.7. Generally zeta * 100 will give you the minimum phase margin needed to obtain your desired overshoot. Therefore we require a phase margin greater than 70 degrees.
To obtain "T" and "a", the following steps can be used.
1. Determine the positive phase needed:
2. Determine the frequency where the phase should be added (center frequency):
3. Determine the constant "a" from the equation below, this determines the required space between the zero and the pole for the maximum phase added.
4. Determine "T" and "aT" from the following equations:
Now, we can add our lead controller to the system and view the bode plot. Remove the bode command from your m-file and add the following:
k=1; numlead = k*[5.67 1]; denlead = [0.176 1]; numl = conv(num,numlead); denl = conv(den,denlead); bode(numl,denl)You should get the following bode plot:
You can see that our phase margin is now 70 degrees. Let's check the closed-loop response to a step input of 0.25m. Add the following to your m-file:
[numcl,dencl] = cloop(numl,denl); t=0:0.01:5; step(0.25*numcl,dencl,t)You should get the following plot:
Although the system is now stable and the overshoot is only slightly over 5%, the settling time is not satisfactory. Increasing the gain will increase the crossover frequency and make the response faster. Make k = 5, your response should look like:
The response is faster, however, the overshoot is much too high. Increasing the gain further will just make the overshoot worse.
function[ ] = phaseball() %define TF m = 0.111; R = 0.015; g = -9.8; L = 1.0; d = 0.03; J = 9.99e-6; K = (m*g*d)/(L*(J/R^2+m)); %simplifies input num = [-K]; den = [1 0 0]; %ask user for controller information pm = input('Phase Margin?.......'); w = input('Center Frequency?...'); k = input('Gain?...............'); %view compensated system bode plot pmr = pm*pi/180; a = (1 - sin(pmr))/(1+sin(pmr)); T = sqrt(a)/w; aT = 1/(w*sqrt(a)); numlead = k*[aT 1]; denlead = [T 1]; numl=conv(num,numlead); denl=conv(den,denlead); figure bode(numl,denl) %view step response [numcl,dencl]=cloop(numl,denl); t=0:0.01:5; figure step(0.25*numcl,dencl,t)With this m-file you can choose the phase margin, center frequency, and gain. Run your m-file with the following values and you should see the plots below on your screen.
Phase Margin?.......80 Center Frequency?...1 Gain?...............1
The overshoot is fine but the settling time is just a bit long. Try different numbers and see what happens.
Using the following values the design criteria was met.
Phase Margin?.......85 Center Frequency?...1.9 Gain?...............2
Note: A design problem does not necessarily have a unique answer. Using this method (or any other) may result in many different compensators. For practice you may want to go back and change the added phase, gain, or center frequency.
Tutorials