Discrete transfer function
Root-Locus in z-plane
Compensation using a digital controller
In this digital control version of the cruise control problem, we are going to use the root-locus design method to design the digital controller. The open-loop transfer function was derived as
The design requirements are
Let the sampling time equals 1/50 sec assuming that the bandwidth frequency is 1 rad/sec. Now enter the following commands to an m-file and run it in the command window.
The following matrices should be returned to the command window.
numDz = 1.0e-04* 0 0.1999 denDz = 1.0000 -0.9990
From these matrices, the discrete transfer function can be written as
where
Since our rise time and overshoot requirements are 5 seconds and 10%, respectively, we can determine that the natural frequency (Wn) must be greater than 0.36 rad/sec and the damping ratio (zeta) must be greater than 0.6.
Let's generate the root-locus and use the zgrid to find the acceptable region of the root-locus. The natural frequency argument for zgrid needs to be in the unit of rad/sample, so let the Wn = 0.36*Ts = 0.0072 rad/sample. Now add the following commands to the above m-file and rerun it. You should get the following plot.
The dotted line on the right, which is very small and can not be seen in this case, indicates the locations of constant natural frequency (Wn), and the natural frequency is greater than 0.0072 outside the line. The other dotted line indicates the locations of constant damping ratio (zeta), and the damping ratio is greater than 0.6 inside the line.
In the above plot, you see that the root-locus is drawn in the desired region. Let's find a gain (K) using the Matlab function rlocfind and obtain the corresponding step response. Add the following commands to the above m-file and rerun it in the Matlab command window.
In the command window, you should see the prompt asking you to select a point on the root-locus. Click on the root-locus around +0.9. The gain (K) and the pole location should be returned to the command window. Also, you should see the closed-loop stairstep response shown below.
As you noticed, this response satisfies all of the design requirements. But the gain associated with this response is approximately 4500. The system having this large gain (too much control effort) might not be available in a real physical system , even though it is possible in the Matlab simulation. To obtain a desired response with a reasonable control effort, we will modify the discrete controller.
However, design method described there generally applies for improving the system response. In this this particular problem, we are not going to use the method described in that page and use our own educated analysis to design the compensator.
First, we need to reduce the gain (K) while keeping the reasonable response. Recall from your control textbook, the gain (K) equals 0 at poles and infinity at zeros. Thus, if we place the pole inside the desired region and pick a locus near that pole, we should have a reasonable response with smaller gain. Moreover, for the system to be stable, all poles must be placed inside the unit circle.
Consider these two things, we will place the compensator pole somewhere outside the natural frequency requirement and inside the damping ratio requirement, say at +0.6, and the zero at the left of that pole, say at -0.6. The location of this zero can be changed later, if necessary.
Now we got the discrete compensator transfer function. Let's generate the root-locus and obtain the step response. Create an new m-file and enter the following commands.
Running this m-file in the command window give you the following root-locus.
In the command window, you should be asked to pick a point on the root-locus. Click on the locus near +0.9. You should now have the step response similar to the one shown below.
This response is about the same as what we obtained without the additional controller. However, if you check the command window, the gain has decreased to around 1000. This system satisfies all design requirements with the reasonable control effort.
Note: A design problem does not necessarily have a unique answer. For practice, you may try other compensators to obtain a better response than the one shown above.