Debug Models Using Animation

Introduction

The animation capability animates the entities and signals in a SimEvents® model. With animation, you can observe SimEvents entities and signals as they move through the model. This behavior is enabled by default in the debugger. With animation, you can observe the following operations listed in this table.

Animation IconOperation

Entity advancing through the block.

Path history for the currently active entity motion. In the case of a virtual subsystem, this icon indicates that the entity is advancing within the subsystem; to observe that animation, open the subsystem. When the darker icon appears outside the subsystem, it indicates that the entity has exited the subsystem.

Signal update currently being executed.

Signal blocks executed so far for currently independent operation. In the case of a virtual subsystem, this icon indicates that the signal updates are occurring within the subsystem; to observe that animation, open the subsystem. When the darker icon appears outside the subsystem, it indicates that the signal has exited the subsystem.

Enabling entity animation also displays the number of entities currently in the storage block in the bottom left corner of the block icon, as follows. This text appears on all storage blocks in the model. The software updates this number as simulation proceeds.

In this block, the 0 of 1 indicates that no entity is currently in the storage block.

Use the sedb.animate command to control animation settings. For example, you can turn the animation off and on, control the animation speed, and so forth.

Start and Stop Animation

By default, animation of a SimEvents model is enabled without the debugger. To view the animation, in the MATLAB® Command Window, start the debugger for that model (sedebug('model').

At the debugger prompt, to disable animation, type:

animate off

To restart animation, type:

animate on

Alternatively, you can type animate to toggle animation on and off.

Animate Signals and Entities

The sedb.detail command controls the amount of animation content in the model. By default, animation is enabled for signals and entities.

If you want to disable the animation of entities and signals, use the detail to disable them. For example:

 detail('en', 0, 'sig', 0);

This command also disables all animation. Turning off entity details also turns off the display of the number of entities currently in storage blocks.

Control Animation Speed

By default, the animation delay is 0.0 seconds. You can change the animation speed by specifying a value between 0.0 and 5.0 seconds as the animation delay. For example, the following command slows the animation to update every 5 seconds:

animate 5.0

If you turn off the animation and then turn it on again, the animation delay is that of the previously specified delay value.

Animate Without Debugger Text

This example uses the Output Switching Using SignalOutput Switching Using Signal model. To use the SimEvents debugger to animate the model:

  1. Begin a debugger session for the model. At the MATLAB command prompt, type:

    sedemo_outputswitch
    sedebug('sedemo_outputswitch')
  2. Turn on animation with an update delay of 0.5 seconds. Turn off debugger text output.

    animate on 0.5;
    detail off
  3. Simulate the model to the end.

    runtoend
  4. Observe the animation in the model, as illustrated.

    Note:   When you animate your model without debugger text, there is no prompt visible in the command window that allows you to pause or exit the debugger. In this case, to pause the debugger, press CTRL+C. To exit, at the resulting prompt, type quit.

Was this topic helpful?