Using Simulink    

Controlling and Displaying Block Execution Order

The Simulink Editor allows you to control and display the order in which Simulink executes blocks.

Assigning Block Priorities

You can assign execution priorities to nonvirtual blocks or virtual subsystem blocks in a model (see Virtual Blocks). Higher priority blocks execute before lower priority blocks, though not necessarily before blocks that have no assigned priority.

You can assign block priorities interactively or programmatically. To set priorities programmatically, use the command

where b is a block path and n is any valid integer. (Negative numbers and 0 are valid priority values.) The lower the number, the higher the priority; that is, 2 is higher priority than 3. To set a block's priority interactively, enter the priority in the Priority field of the block's Block Properties dialog box (see Block Properties Dialog Box).

Simulink honors the block priorities that you specify only if they are consistent with Simulink's block sorting algorithm (see Determining Block Update Order). If the specified priorities are inconsistent, Simulink ignores the specified priority and places the block in an appropriate location in the block execution order. If Simulink is unable to honor a block priority, it displays a Block Priority Violation diagnostic message (see The Diagnostics Pane).

Displaying Block Execution Order

To display the execution order of blocks during simulation, select Execution order from the Simulink Format menu. Selecting this option causes Simulink to display a number in the top right corner of each block in a block diagram.

The number indicates the execution order of the block relative to other blocks in the diagram. For example, 1 indicates that the block is the first block executed on every time step, 2 indicates that the block is the second block executed on every time step, and so on.


  Specifying a Block's Color Look-Up Table Editor