The Sequence Viewer window has:
A navigation toolbar, which contains:
The model hierarchy path
Toggle button to select an automatic or manual layout
Toggle button to choose to show or hide inactive lifelines
Buttons for saving and restoring information in the viewer, setting parameters on the block, and accessing the Sequence Viewer documentation
A header pane, which contains the lifeline headers.
A message pane, which displays the messages.
To see the interchange of messages between Stateflow® charts during simulation, add a Sequence Viewer block to the model. You can visualize the movement of entities between blocks when simulating SimEvents® models. The Sequence Viewer block also displays function calls and calls from MATLAB Function blocks. For more information on function calls, see Function Calls in Sequence Viewer.
The Sequence Viewer block uses a Sequence Viewer window that acts like a sequence diagram showing how blocks interact using messages.
The Sequence Viewer enables you to view event data related to Stateflow chart execution and the exchange of messages between Stateflow charts. The Sequence Viewer shows where messages are created and sent, forwarded, received, and destroyed at different times during model execution. You can also view the movement of entities between SimEvents blocks. All SimEvents blocks that can store entities appear as lifelines on the Sequence Viewer. Entities moving between these blocks appear as lines with arrows. The Sequence Viewer also enables you to view calls to Simulink Function blocks and Stateflow MATLAB® functions.
This topic uses the Stateflow example
sf_msg_traffic_light to show you how to use the Sequence
You can add one or more Sequence Viewer blocks to the top level of a model or any subsystem. If you place a Sequence Viewer block in a subsystem that does not have messages, the Sequence Viewer informs you that no messages are available to display. A viewer can be inactive if, for example, it is in a subsystem that has been commented out. In such a case, the Sequence Viewer displays that it is inactive.
Consider this subsystem, Traffic Light1:
Traffic Light1 contains two Stateflow charts.
Ped Button Sensor
The charts in this subsystems use messages to exchange data. As messages pass through the system, you can view them in a Sequence Viewer.
Add a Sequence Viewer block to a subsystem or model whose messages you want to see. When you open a Sequence Viewer block and simulate the model:
Observe the contents of the Sequence Viewer.
The header (top) pane of a Sequence Viewer shows the lifeline headers. In this example, the lifelines are the two Traffic Light blocks and the GUI. Lifeline headers show the name of the corresponding blocks in the model that generate or act on messages. The top of the lifeline is a header, which corresponds to a block in the model. Gray headers with straight edges correspond to subsystems. Yellow headers with rounded edges correspond to Stateflow charts. In the header pane, the lifeline hierarchy corresponds to the model hierarchy. When the model is paused or stopped, you can expand and close lifelines.
In the message pane, a thick gray lifeline indicates that you can expand the lifeline to see the children in the lifeline. Clicking a lifeline name opens the corresponding block in the model.
Messages between lifelines display in the message pane. Message lines are arrows from the sender to the receiver. For more information on navigation in the message page, see Navigation in Sequence Viewers.
To show the children of a lifeline, click the expander under a parent lifeline .
Lifelines are hidden by double-clicking their headers.
Make a lifeline the root of focus for the viewer. Hover over the bottom left corner of the lifeline header and click the arrow. Alternatively, use the navigation toolbar at the top of a Sequence Viewer. The Sequence Viewer displays the current root lifeline path and shows its child lifelines.
Any external sending and receiving events display as vertical bars (slots) in the diagram gutter . To highlight the associated block in the model, click the relevant slot.
You can use the navigation toolbar to move the current root up and down the lifeline hierarchy. To move up the current root one level, hit the Esc key.
This graphic also illustrates how the Sequence Viewer displays masked subsystems. The Traffic Lamp 1, Ped Lamp 1, Traffic Lamp 2, and PED Lamp 2 are masked subsystems. The Sequence Viewer displays masked subsystems as white blocks.
To show the children of a masked subsystem, hover over the bottom left corner of the masked and subsystem and click the arrow.
The child lifeline displays.
Activations, which correspond to executions of the lifeline, are at the start and end of each message line.
If a message line is not completely shown, hover over the line. You can also, hover over a truncated message label to see it in its entirety. In this example, the send time of the commIn message line is not visible. To see it, hover over the message line.
If you hover over an activation that represents a function call, the function prototype is displayed in the tool tip.
If you hover over partially shown activation symbols, the times for any truncated activations also appear.
A Sequence Viewer shows the interactions (hops) that a message or function call goes through in its lifetime. It also shows message and function call payloads. To highlight the hops for a message or function call and display its payload, click the corresponding message line. See the result in the payload inspector to the right. Use Search Up and Down buttons to move through the hops.
A Sequence Viewer block saves the order and states of lifelines between simulation runs. Similarly, when you close and reopen a Sequence Viewer, it preserves the last open lifeline state. To save a particular viewer state with the block, click in the navigation toolbar. Saving the model then saves that state information across sessions. Use to load the saved settings.
A Sequence Viewer shows message events vertically, ordered in time. Multiple events in Simulink® can happen at the same time. Conversely, there can be long periods of times during simulation with no events. As a consequence, time in the message pane is nonlinear. Each time grid row, bordered by two blue lines, contains events that occur at the same simulation time. The time strip gives the times of the events in that grid row.
The time ruler shows linear simulation time. To show messages in that simulation time range, use the scroll wheel or drag the time slider up and down the time ruler.
To navigate to the beginning and end of the simulation, click the Go to first event and Go to last event buttons.
To zoom the ruler, hold the space bar and use the mouse wheel. This action increases and decreases the amount of time ruler space the slider occupies.
To see the entire simulation duration on the time ruler, click the Fit to view button .
To reset the zoom to 100%, hold Ctrl + 0.
To scroll in the header and message panes, use the mouse wheel. In addition,
The header pane has a vertical scroll bar.
The message page has a horizontal scroll bar at the bottom that scrolls both panes.
To pan in the message pane, move the mouse while holding down either the middle mouse button or space bar. This action moves both panes.
You can scale the view in two ways:
Fit all lifeline headers to window — Press the space bar.
Zoom by a fixed increment to a predefined minimum or maximum value — Press Ctrl- or Ctrl+. Alternatively, hold the space bar and use the mouse wheel.
Zooming does not scale the navigation toolbar or time ruler.
The Sequence Viewer block displays these function calls and replies to them.
|Function Call Type||Support|
Calls to Simulink Function blocks
Calls to Stateflow graphical or Stateflow MATLAB functions
The Sequence Viewer block does not display these function calls:
Function calls connected to function-call subsystems.
For an example of functions calls in Sequence Viewer, see
Sequence Viewer displays function calls with solid lines terminated with solid arrows
and a label with the format
Replies to function calls display as dashed lines with open arrows and a label with the