# Simulating Disturbance Rejection in Simulink | Understanding Control Systems, Part 4

From the series: Understanding Control Systems

*Melda Ulusoy, MathWorks*

This demonstration uses a car to show how you can simulate open- and closed-loop systems in Simulink^{®}. First, you will learn how to model and tune open-loop systems. The goal of the demonstration is to maintain the speed of a car. Then, you’ll explore the behavior of the open-loop system in the presence of a disturbance. To illustrate disturbance rejection, the video shows how to model and simulate a feedback control system . You will gain insight into how feedback control compensates for disturbance. You’ll investigate signals such as error (in this example, the error is the difference between the measured and desired output), actuating signal (here, the actuating signal is the pedal’s position) and system output (in this example, the output is speed).

**Recorded:
29 Nov 2016**

Hello! in this video, I’m going to simulate a car maintaining a certain speed. Ok, not like that. I’m going to use Simulink, which is a block diagram environment that lets us model our physical system visually, and then simulate it.

Here, you see a screenshot taken from the previous video where we used the car example. We want to control the speed of our car, keeping it steady at 20 m/s. First, I want to look at the open-loop system response. I’ll start with simulating this part which consists of the actuator and the plant. In order to model a system in Simulink, you use blocks from Simulink Library Browser. There are different add-ons. Here, I’m going to use a custom library that I’ve previously created and imported to this library browser. In my custom library, I have preconfigured blocks. If you want to look at what’s inside these subsystems, this demo model is available online. Download it by clicking the link below this video.

Using blocks from this library, I create the open-loop system. I’ll start with an input of pi/18 radians. This corresponds to 10⁰. To see how my speed changes when I press down the gas pedal by 10⁰, I’ll hit the play button and simulate this system. Here is my input of 10⁰ or pi/18 radians. And the speed converges to, if I zoom in here, approximately 6.6 m/s, but my goal was to get to 20 m/s, which means I need to press down further on the gas pedal. For an input of 10⁰, I get 6.6 m/s. I know that this is a linear system; therefore, to get to three times the current speed of 6.6 m/s, I need to triple the input. I increase the angle from 10⁰ to 30⁰ or pi/6 in radians and re-simulate my model. This is my input of 30⁰. As expected, my speed converges to the desired speed. Now I have tuned this open-loop system to make the car go 20 m/s, which is what we wanted.

Until now, I’ve been assuming that the car is driving on a flat road. But what if the car climbs a hill? Will it still be able to maintain the correct speed? To answer this question, I will simulate the car going uphill. When climbing the hill, there’s an additional disturbance force acting on the car. To address that, I’ll add this disturbance to my model. I’ve preconfigured this disturbance block such that the disturbance acts at 200 seconds. So, to see the effect of the disturbance in mu simulation I’m extending simulation time to 400 seconds. If I simulate my system now, I see that my speed drops significantly while going uphill. This means the open-loop system fails if there’s a disturbance acting on the system.

Are you with me so far? Don’t go anywhere yet because we came to the most exciting part where we’re going to close the loop and then the magic will happen. The simulation showed that open-loop fails in the presence of unpredicted disturbances.

However, we’re all set, because we already know from the previous videos that the solution to this problem is to use feedback control. So, that’s what I’m going to do next. I’ll close the loop using the pre-configured blocks from my custom library and simulate the closed-loop system. Noise enters the system through measurement. For realistic simulation results, I make sure to add noise to my model. I set the desired output to 20 m/s as this is the speed that we want to maintain. Once the feedback control system is ready, I hit the play button to simulate it. As opposed to open-loop control, we see that feedback control compensates for the disturbance. To gain insight into how it deals with the disturbance, let’s take a look at the error and the pedal position signals. The reason that open-loop control can’t compensate for the disturbance is that it only provides a static input to the actuator. But in the presence of a disturbance, like if we’re going uphill, we need to press down further on the gas pedal. This means we need to change the input to the actuator dynamically instead of keeping it constant. And this is exactly what feedback control does. The controller sees that the error is growing when there’s disturbance. And it increases the signal to the actuator, which in turn increases the engine force and the speed of the car. And in this way, the error is pulled back to zero.

I hope you learned little more about how you can simulate a control system in Simulink. In the next video, using Simulink we’ll simulate robustness to system variations.

Seleziona un sito web

Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .

Puoi anche selezionare un sito web dal seguente elenco:

## Come ottenere le migliori prestazioni del sito

Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.

### Americhe

- América Latina (Español)
- Canada (English)
- United States (English)

### Europa

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

### Asia-Pacifico

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)