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]

Â