DC motor speed control using bode plots
From the series: Using Bode Plots
“Learn how to use Bode plots for DC motor speed control in this MATLAB® Tech Talk by Carlos Osorio.
Published: 29 Apr 2013
I want to finish this series with a control design application example where we can make use of some of the practical concepts we have discussed so far. We're going to try to design a velocity controller for a standard DC motor. We will assume that the motor has been given to us, meaning that the parameters needed for the plant model, like armature resistance, inertia, torque constant, etc., have all been extracted from a manufacturer's data sheet or calculated using experimental data.
For our design, the controller input will be an applied voltage, and the measured output will be the motor speed. Before we get into the design itself, we should have an idea of what kind of performance we need to get from our closed loop system.
This is an example of a set of pretty typical performance targets. As you can see, our system needs to achieve zero steady state error, and we are allowed a maximum overshoot of 3%. We are also being given limits on the rise time, 0.15 seconds, and the settling time, 0.3 seconds, which are associated with how fast we want our controller to respond and closely relate to the desired system bandwidth. Finally, we need to make sure that our stability margins are above 60 degrees and 10 dBs. Sometimes you may also find requirements for the level of disturbance rejection below a certain frequency or the level of noise attenuation above a certain frequency.
Anyways, now we will start by creating a model of our closed loop system architecture. Notice that this system includes a mathematical model of our DC motor plant dynamics. And I have already closed the feedback loop with a controller, which, for starters, I have set as a constant gain of 1.
We want our system to track a 100 radians per second trapezoidal reference speed profile, seen here in the dashed blue line. And we're looking at the actual motor speed in solid orange. As you can see, our initial controller is not very good, but at least the response is stable, which is always a nice starting point. We can also see the effect of the low frequency disturbance we are injecting at the output of our plant, which is more than likely the reason for this drift on our measured velocity signal.
Just as an aside, I know this is a relatively simple example, but as control design engineers I hope you can appreciate the beauty of a tool like Simulink. Not only I can graphically build any block diagram or close loop architecture I can imagine, all I need to do is press the play button, and boom, I can observe the transient response of any signal in my system. In addition, I can mark my input and output points of interest directly on the diagram and let the tool extract the transfer functions that correspond to all the loops I just defined.
Here, I have set inputs on the reference, the disturbance, and the noise, and I have set the primary output on the velocity measurement. Here on our design view, we have the Bode diagram of our open loop transfer function PC in blue. And on our analysis view, I have the closed loop Bode plots for both the transmissibility transfer function in red and the sensitivity transfer function in green. And down here, I have the unit step response for the closed loop system.
The reason why we use step responses is that step excites an infinite range of frequencies, and that gives us a good idea not only of the performance, but also of the overall stability of our system. Notice that for our initial controller, our step response is way below 1. Looking at the open loop transfer function and remembering that our controller was set to a constant gain of 1 means that we are starting with just the frequency response of our plant.
We can see from the trace that this is a second order system with two single poles, and that it never crosses the 0 dB line and asymptotically approaches that -180 degrees line, but never crosses it. Hence its gain margin and phase margin are both infinity, which makes our system quite stable and well behaved. But as we can see, it has very poor performance.
Looking at the closed loop transmissibility transfer function, we should be able to tell that our tracking is not going to be very good because our gain and low frequencies is too low. So my first instinct would be to increase the gain. As I move this up, notice that as soon as it crosses the 0 dB line at the phase margin it appears, and my step response is rising.
If I push the gain higher, notice that I am approaching 1, but by my response starts becoming underdamped, and the reason for that is that the phase margin is rapidly decreasing. The phase margin is closely associated with the damping of the closed loop system. So as it approaches 0, my response becomes more and more oscillatory with an unacceptable overshoot. And still we haven't yet reached zero steady state error. So we're seeing that proportional gain alone will not give us that performance that we're looking for.
Let me bring the gain back down a bit and add a pure integrator to my controller. As soon as I add the integrator, I will achieve zero steady state error in my step response. Let me increase the gain a bit so we can see this better. I want you to notice a couple of things here.
First, because of the integrator, now the phase crosses the -180 degrees because everything has been shifted down 90 degrees. And because I have infinite gain at DC, now my transmissibility transfer function shows near perfect tracking at low frequencies.
By playing with the gain, I can make the step response look really smooth, but notice that it is also very slow. So the problem we have is that as we increase the gain to make the system faster, because the phase margin starts dropping as the phase at the crossover gets closer to -180, I start seeing the oscillations on my step response.
I can keep on increasing that gain, and notice how the response becomes less and less damped, actually, to the point where I cross to the other side of -180, and both my phase and gain margins go negative and the system becomes unstable. So ideally, we want to pick a gain that gets us close to the system response speed we're looking for.
Actually, I'm going to choose a crossover frequency of about 10 radians per second, which corresponds to approximately 0.15 seconds of rise time we want to target. But as you can see, it results in an unacceptable overshoot. So as we find out from the simple gain, a pure integrator alone will not be able to achieve that performance we need.
What we need is better damping, which means additional phase margin over here, where it's less than 30 degrees. This is where the structure like a lead compensator will be quite helpful because a lead will add a bump on the phase right around the crossover frequency. So I will at lead compensator right around the 10 radians per second crossover frequency.
Remember that a lead is just a single 0 before a single pole. And I can widen the distance between the two by moving the pole up the frequency range, and you can see how that phase margin is growing and the step response is becoming better damped.
Let me reduce the gain a bit, bring it back to the 10 radians per second crossover frequency, and maybe I can bring my pole back a little bit. So everything looks pretty good right now. That bump in the phase has resulted in 68 degrees of phase margin, which is good. We have 18.5 dBs of gain margin, which is above our requirement.
On the step response, we can check the peak response, which shows an overshoot of 1.45%, way below 3%, which was our requirement. We can also check the settling time, which is below 0.2 seconds. Our requirement was 0.3 seconds, so we're good. And the rise time, which is 0.118 seconds, which is below our 0.15 limit.
So as we just saw, all our requirements are satisfied by this controller. We have a pretty smooth step response, good roll off rate, which means good high frequency noise attenuation characteristics, and a nice low frequency gain, which will reflect here on the sensitivity transfer function and will translate into good low frequency disturbance rejection characteristics. We have a greater than -40 dBs of attenuation below 0.1 radians per second. So the final controller structure is a gain, a pure integrator, and a lead compensator, which is a zero and a pole.
As a final step, I will update my Simulink block parameters and go back to the simulation model, where my controller structure has now been updated. And I can run a simulation to verify my full system performance. You can clearly see that we have achieved both very good tracking of the desired trajectory and quite good disturbance and noise rejection.
Well, hopefully you were able to follow all that. And that, my friends, is how I believe you are supposed to do controls.