0:36

So, the first thing that you notice here is that if you have a previous version of

this toolbox, then you might want to go through the uninstall procedure.

It's very simple, you just run a command called TBClean.

Then you check where you have your minimum system requirements, and

the minimum here is R13.

And my computer, we have updated to R14, and

you might have a newer version, and this software runs in newer versions as well.

2:10

The first thing that it's going to ask me is whether I would like to add the toolbox

permanently into my startup path and I recommend that to say yes to that.

That's the default option.

Now it's going to install all these files.

Look, they're installing them mostly in your Documents folder so

that you can actually find them.

2:39

And then once installation is finished this system is ready to use.

One of the features that toolbox has is that it integrates seamlessly with,

not only the work space, but

also with simulating, so that's what's happening right now.

But if we go back to our location where our files are,

then we can go back to our Documents.

And now in MATLAB we will have that folder

HyEQ_Toolbox_V2_04 where you will find basically all of the files.

In addition in the Download location once you install that,

the installation file has disappeared.

But the PDF with all of instructions associated to the toolbox is here and

it has a number of details in more than 70 pages that you might find interesting and

important in how we actually coded it this way.

Most of this is also in the help files in the model installation.

So once you finish this installation which is still,

which is taking a little bit of time to update on that.

Then you can actually see that some of these

things have passed without any problem.

There is an error there that might be because of the version,

but I will debug that later.

And there are some changes and you may need to do locally.

But those are suggested in the document that I mentioned to you already

with instructions.

So but the first thing that you can do is actually see whether this works.

So I will go back to my Home folder and then to My Documents and

then to MATLAB, and then to that folder.

And there is a subfolder called examples,

where you will see a number of examples.

So the number of examples here that are listed in this folder

are matching with the number of examples given in the PDF that I mentioned earlier.

And one of the simplest hybrid system is a ball that falls and

eventually hits the ground where it generates a rebound.

And then the ball moves in the vertical up and

then this behavior keeps repeating over and over until

all of the energy of the ball is dissipated and the ball becomes at rest.

So that type of hybrid system is modeled in these first example, Example 1.2.

So I'm going to do is to get into that example and

then run that example to make sure that everything has run.

So this is a script command that runs what we call the light simulator,

it's a simulator that does not require Simulink.

And this is the result of it, so

let's take a look at the trajectory that we obtained.

5:54

And this is velocity of the ball versus the time.

So, for a rather large step size,

what you see is that the ball starts to fall from height equal to one,

hits the ground, at which time the velocity is negative,

that corresponds to the ball moving towards the ground.

After the impact the velocity gets changed sign, and it's magnitude is decreased

by some factor which is adjusted by the restitution

factor from where it goes up and then hits the ground again.

So the velocity is positive, eventually becomes zero, at this apex time.

And then it becomes negative until it reaches the ground.

And then this behavior continues evolving over and over.

Similarly, we can only simulate up

to a certain amount of flow time and jump time, as you know.

And the trajectory that you take from the simulator stops after making

a finite many of those.

And as you see the energy tends to zero as the position tends to zero and

the velocity tends to zero.

So it's a sanity check that this is working.

The plot that you saw here is a plot that actually

generates the hybrid arc that defines the solutions to our CPS as well.

And as you see here, at every impact j is being incremented

as t grows and the hybrid time domain that you obtain

is a hybrid time domain that is of the form of a sceneo hybrid time domain.

And this is due to the fact that the time of flow after each impact gets smaller and

smaller because the restitution coefficient is small.

Actually you can take a peek about what those numbers are, so for

instance that would be the GEM map.

So if you double click on this function the GEM map,

it actually is the case that the restitution coefficient is 0.8 and

therefore the energy decreases every time that impact occurs.

8:27

So if you are familiar with Simulink,

it's a graphical user interface that will allow you to simulate system using

modular functions and mock up blocks that actually can be interconnected to

build a somewhat complex system that you'd like to simulate.

Now one of the things that we did was to integrate

the Hybrid Equation Toolbox within Simulink.

So now you can click here and you can see that there are three sub

8:55

types in here that can be used to simulate hybrid systems.

And for this course the interest is in the first one,

the one that corresponds to cyber physical systems.

As you see right here, we have a block that is already configured.

All we need to do is to change the constant that defines how

often the conversion from analogue to digital occurs for

this analogue to digital converter.

We have also a digital to analog converter, or zero order hold block.

We also have a finite state machine block, we also have a physical system block,

which is essentially a differential equation,

potentially with constraints, and also a network.

9:38

So the idea is that with these blocks now, we will be able to build our CPS.

We will be able to interconnect converters with physics,

with algorithms, and with networks and simulate them in

a similar that you simulate any type of mechanical system,

and validate some of our analysis.

[MUSIC]