CMU
UM


Example: Solution to the Cruise Control Problem Using Frequency Response

Bode plot and open-loop response
Proportional controller
Lag controller

The state-space equations for this problem are:

The design criteria (for a steady-state speed of 10 m/s) are:

Rise time < 5 sec
Overshoot < 10%
Steady state error < 2%

To see how this problem was originally set up, click here.

Bode plot and open-loop response

The first step in solving this problem using frequency response is to change the transfer function to Bode form. You can find out what the transfer function is by creating the following m-file (or create a '.m' file located in the same directory as Matlab):
The numerator and denominator should now be shown in the Matlab command window. The transfer function currently should be:

Converting it into Bode form the new transfer function should be:

In this form, it is easier to see where the frequency break points lie. In Matlab, we can look at the Bode plot and step response of the closed loop system by using either transfer function.

Before we begin, look again at the transfer function. Note that there is a pole-zero cancellation at the origin. Matlab does not automatically cancel the pole and zero for you, and their presence may cause numerical errors, so it is a good idea to make the changes manually if you notice it. This can be done in this case by entering the following code at the end of your m-file:

To see the Bode and step response, copy the following code to the end of your m-file:
By running this m-file, the bode and step response plots (for unity gain in closed loop) should be generated.

Proportional controller

Let's first see what we can determine about the system's characteristics from its Bode plot. The requirement that the overshoot must be under 10% implies that the phase margin must be over 60 degrees. Since the phase plot never drops below -90 degrees this is not a problem. The steady state error criteria dictates that the low frequency gain Kp > 9 (19dB); it is currently about -35dB or 0.02. Obviously we are going to need some sort of proportional gain.

From the step response (above) with unity gain, we see that the steady state value is about 0.2. In addition, there happens to be a long rise time. By adding proportional gain to the system, i.e. increasing k, the Bode plot will be shifted up. With k = 100, and changing the axis command to axis([0 20 0 10]), a new set of bode and step response plots will be generated. First let's look at the bode plot.

The gain now crosses the 0dB (gain = 1) axis. The low frequency gain is about 6dB (magnitude 2) which predicts a steady-state error of 1/3 (= 1/(1+Kp)). The bandwidth is about 0.1. Since the bandwidth frequency is roughly equivalent to the natural frequency, a rough estimate of the rise time from the bode plot is tr=1.8/BW. In this case that predicts a rise time of about 18 seconds (tr = 1.8/Wn). Let's look at the step response plot to see if this is confirmed.

As we predicted, the steady state value is still too low and the rise time is still too long. To correct this, the bandwidth frequency must be made higher. There is an inverse relationship between the bandwidth frequency and the rise time, so an increase in the BW will result in a decrease in the rise time. This can be done by increasing the gain even more, which will make the bandwidth frequency higher. With k=600, you get the following bode and step response.

As you can see, the rise time is much better than before. A bandwidth of 0.6 predicts a rise time of 1.8/.6 = 3 seconds, which is about right. The steady-state value is still not quite satisfactory, though. If the k value is increased even further, the steady state response will improve even more, but the rise time will become too fast for this physical system. For now it is best to leave the k value where it is and introduce a lag controller to handle the steady state error.

Lag controller

To design the lag controller, we need to know where to place the corner frequencies. Since the phase margin is fine, it is not a matter of moving the cross-over frequency to a desired location. the best solution would be to place the corner frequencies in the low frequency range, so they will have a minimal effect on the transient response, and only alleviate the steady state error. If T is chosen to be 700, one corner frequency will be at 1/T=0.0014 rad/sec. Since we have a large steady-state error, we should not place the other corner frequency very close to the first. If a is chosen to be 0.05, the other corner frequency will be at 1/Ta=0.03 rad/sec. As you can see from the bode magnitude plot, both of these corner frequencies would be in the low frequency range. To implement this controller, delete your m-file from k=600 to the end. Enter instead the following lines of code:

Running this m-file should get you a new set of bode and step response plots:

The corner frequencies were an initial guess, with some trial and error work, but it seems to do the trick. It may be hard to see, but there should be a red, dotted line across the screen just below 10. This line shows the steady-state value of the step, and indicates that the steady state error has been met. However, the settling time is just too long. To fix this problem, raise the gain to k=1500. This gain was chosen from trial and error work that will not be described here in the interest of length. Try different gains and see how they affect the response. With this change made, the following bode and step response plots can be generated.

As you can see, the overshoot is in fact zero, the steady state error is close to zero, the rise time is about 2 seconds, and the settling time is less than 3.5 seconds. The system has now met all of the design requirements. No more iteration is needed.


User Survey
Your anonymous answers to the following questions will help us to improve future versions of these tutorials.
How useful was this example?
Very useful Useful Somewhat useful Not very useful A waste of time
How was the level of the example?
Too simple About right Too difficult
How much time did you spend on it?
Less than 30 mins. 30 - 60 mins. More than 60 mins.
How much of the Matlab code did you run?
None Some Most

We would like to hear about suggestions you have for improvement, difficulties you had with the tutorials, errors that you found, or any other comments that you have. This feedback is anonymous.

If you would like to receive a response, send your comments or questions to ctm-feedback@umich.edu


Frequency Response Examples
Cruise Control | DC Motor | Bus Suspension | Inverted Pendulum

Cruise Control Examples
Modeling | PID | Root Locus | Frequency Response | State Space

Tutorials

Basics | Modeling | PID | Root Locus | Frequency Response | State Space | Examples

HOME INDEX COMMANDS

8/22/96 JDP