Hello! in this video, I’m going to simulate a car

maintaining a constant 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 my

simulation I’m extending simulation time to 400

seconds. If I simulate my system now, this is my

disturbance which is constant and acts at 200

seconds and 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.

Great video, keep up the good work. i'll be waiting for the next videos ๐

Pretty good demonstration! Thanks a lot, I'm waiting for the next video.

Did you use the PID tuner application to develop the Controller?

great video ! and …how could someone move the mouse so fast!!!!!!!!!!!!

Wonderfull, i'm waiting for the next one! amazing video, amazing explanation!

can we simulate with two different lanes to avoid collision of vehicle at intersection

brilliant, just brilliant…

so what's in it for the viewer if you use custom functions :

madam, is it possible to analyse the wear and thermal on brake pad?? if so please help me

how do i add disturbances to my code?

T = Feedback(R(s)*G(s),1)

step(T)

Very useful video.

Download the model used in this video here: https://www.mathworks.com/matlabcentral/fileexchange/69001-simulating-disturbance-rejection-in-simulink

"ok not like that"

.

.

i think engineer cant take a joke.

Perfect example to build a intuition of Control System ๏ผ Thank you !

Perfect example to build a intuition of Control System ๏ผ Thank you !

In case you were wondering, this was unfortunately not the same guy.

R.I.P.

They never saw it coming.