Lab 4: Design control systems using Simulink

Today you will design and analyze a control system in Matlab simulink that controls the speed of a car. Initially you will build an open-loop model to simulate what happens with the speed of a car when the driver keeps the gas pedal at a fixed angle. Next, you will investigate what happens to the speed of the car when the driver encounters a hill. As you will see, the speed of the car will decrease when climing the hill. Obviously this is not desriable. Therefore you will develop a closed loop controler that aims to keep the car at a constant speed even when you encounter a hill.

Part 1: Open-loop model

In this first part you will develop an open-loop model for a car that is driving along a flat surface. When the driver keeps the gas pedal at a fixed angle, the car will reach a certain fixed velocity. The problem is described in more detail in the following video:

1. In this lab we will use a special Simulink library that contains the models for relevant components in our system (i.e., gas pedal, car, etc). You can download the library here. In addition you need a skeleton of the simulink model which can be found here. Download both files and place them in the same directory.

2. Open the simulink file car-model.slx in Matlab simulink and make sure that this file is inside the current directory in Matlab. You should see a screen similar to:

3. Make all the connections between the different components as also shown in the video. The final simulink model should then look as follows:

4. Set the angle of the gas pedal to pi/18.

5. Simulate the model in simulink by pressing the play button on the top icon bar. Once the simulation finishes you can inspect the speed of the car by looking at the scope. What is the maximal speed the car reaches with this angle of the gas pedal?

6. Adjust the angle of the gas pedal to ensure that a speed of 20 km/h is reached eventually. You can use the fact that there is a linear relation between the angle of the gas pedal and the speed of the car to find the correct angle quickly.

Part 2: Open-loop model with disturbance

In this next part you are going to extend the model and let the car drive up a hill starting from time 200. Since the driver won't change the angle of the gas pedal this will result in a slow down of the car.

1. Open the library that you previously downloaded in simulink. You should see a screen similar to:

2. Drag and drop the 'Plant (with disturbance input)' into your model and replace the existing 'Plant' model with this new model. In addition you should also add the 'Disturbance' model from the library to your own model. Finally you should connect all components as shown in the picture below.

3. What happens to the speed of the car when it is driving up the hill?

Part 3: Closed-loop model with disturbance

The open-loop control is not able to maintain the constant speed of the car when an external disturbance (hill) is encountered. To keep the speed of the car constant a closed-loop control system (i.e., a cruise-control system) is needed. In this part you will change the open-loop control to a closed loop control system.

1. Adapt the model from an open-loop to a closed-loop system. Similar to what you did in the previous part you need to add new components from the library to your model and adapt the connections. The final model should look like this:

2. Simulate the model. Does the closed-loop system show an overshoot? How much time does it take to get back to the original speed when the car start climbing the hill?

Part 4: Change controller design

In the previous part you used a PI-controller from the library that was specially designed for this exercise. Simulink offers however many options to develop and your own controller. In this part you will replace the controller used in the previous exercise with your own PID controller. You will tune this controller with the objective to reach the original speed of the car more quickly when climbing the hill. This will however result in an overshoot (and hence possibly a fine in case the police puts a speed camera at the bottom of the hill)

1. Replace the controller (brain image) with a PID controller from the standard Simulink library. The resulting model should look as follows:

2. Watch this video to see how you can tune a PID controller in simulink

3. Tune the PID controller in your model with the objective to reach the desired speed as quickly as possible. What is the maximal speed your car reaches in that case?