|
|
P controller
PI controller
The state equations for this problem are:
The design criteria (for a 10 m/s final velocity) are:
To see how this problem was originally set up, click here.
The first thing to do in this problem is to transform the state-space equations into transfer function form. Next, close the loop and add some proportional control to see if the response can be improved. Both of these steps can be done sequentially in Matlab. Create a new m-file with the following lines of code (or create a '.m' file located in the same directory as Matlab):
As you can see, the step response is not very good. The steady state error is more than 10%, and the rise time is still too slow. You can adjust the proportional gain to make the response better, but you will not be able to make the steady state value go to 10m/sec without getting rise times that are too fast. You must always keep in mind that you are designing a real system, and for a cruise control system to respond 0-10m/sec in less than half of a second is unrealistic. To illustrate this idea, adjust the k value to equal 10,000, and you should get the following velocity response:
The steady state error has been dropped to near zero, but the rise time on this step response is way too fast (about 0.2 seconds). The solution to this problem is to add some integral control to eliminate the steady state error. Adjust k until you get a reasonable rise time. For example, with k = 600, the response should now look like:
Now, try PI control. Change your m-file to look like the following:
We suggest starting with a ki value that is small, i. e. around 1, to get a feel for what the integral control is doing to the response. Remember, integral control makes the transient response worse, so adding too much initially can make the response unrecognizable. Now you can adjust the ki value to reduce the steady state error. With ki = 40 and k adjusted up a little more to 800, the response looks like the following:
As you can see, this step response meets all of the design criteria, and therefore no more iteration is needed. It is also noteworthy that no derivative control was needed in this example.
The system was originally critically damped, making the overshoot equal to zero. Had more integral control been needed to eliminate the steady state error, the transient response may have worsen to the point of needing derivative control.
It is easy to implement the derivative control in Matlab. Just change the num1 = [k ki]; line to num1 = [kd k ki];. However, this will make it necessary to adjust three variables simultaneously. The best way to do this would be to adjust one variable at a time starting with k, then kd, and then ki. You may have to go back and readjust, or tweak, the variables (gains) after they have all been set.
Tutorials