Guy and Seth on Simulink

Running a Simulation Step by Step 5

Posted by Guy Rouleau,

As you probably know, when you simulate a model, there is a lot of stuff going on that you do not see.

Yesterday I showed a user how to visualize the execution of a simulation step by step using the Simulink Debugger and he was very impressed. Let's take a look at the debugger animation.

Simulink Debugger Animation

If you are interested in seeing every method executed by the Simulink engine during the simulation, start the Simulink Debugger from the Tools menu. Then click on the Animation Mode button and start your simulation.

Simulink debugger in action

What are all those methods?

The documentation for the Debug Pointer gives a description of the rectangular patches displayed on the blocks and the meaning of their color.

Debug Pointer

If you are interested to learn more about all those steps taken by the Simulink engine, I recommend going through the documentation page How the Simulink Engine Interacts with C S-Functions.

This documentation will show you in which order those methods are executing and you will find a link describing each of them. S-functions provide all the methods used by Simulink to simulate a model, so if you understand how S-functions work, you will understand how Simulink works.

What's Next?

What I showed today is only one of the many feature of the Simulink Debugger. If you are interested in learning more about what the Simulink Debugger can do for you, let me know by leaving a comment here.

Now it's your turn

Now you can cancel your cabel/satelite subscription! Open your favorite model, get a cold beer, some snacks, and sit back to enjoy the Simulink Debugger Animation! (Can you tell it is Friday?)

5 CommentsOldest to Newest

Would be nice if you could show some more features of the debugger. I think there are lots of people (including me) who have no idea about what you can do with it.

Kind Regards,

Eike

I also would like to see a much more detailed usage of tracing through a model to debug specific outputs.

I agree with the above comments. A long video giving detailed explanation with examples of debugging will help out hundreds of frustrated grad students (like me).

Did the debugger change in 2012b? It looks like it’s now located under Simulation->Debug->Debug Model, but I don’t see the animate buttons anywhere on the debugger window.

@Nathan: You are correct. In R2012b, the animation is not available in the Simulink debugger. If find this very infortunate, but we are looking on something better for a future release.

About incompatibilities of the Simulink debugger, the Simulink R2012b release notes mention the following:

The following capabilities are not available in the debugger:

- Animations
- Adding breakpoints while in the initialization phase
- Displaying I/O while in the initialization phase

Add A Comment

What is 2 + 8?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.