You can author sequence diagrams to describe expected system behavior as a sequence of interactions between components of a System Composer™ architecture model. New lifelines or messages authored on the sequence diagram are automatically reflected in the model. Incorporate model elements in a sequence diagram associated with the model the elements are from. You can create multiple sequence diagrams to represent different operational scenarios of the system.
Sequence diagrams are integrated into the Architecture Views Gallery in System Composer. Lifelines in a sequence diagram correspond to components in an architecture model. Messages in a sequence diagram correspond to the connectors between components in an architecture model.
In this example, you will learn about using sequence diagrams in System Composer with emphasis on how to:
Create a sequence diagram and co-create components and connections.
Add child lifelines in a sequence diagram.
Keep the architecture model and the sequence diagram in sync.
Create a basic architecture model in System Composer.

In the menu, navigate to Views > Architecture Views to open up the
Architecture Views Gallery for your model. Select New Sequence
Diagram under the
button to create a new sequence diagram.
Select Add Lifeline
from the menu. A box with a vertical dotted line appears on the canvas.
This is the new lifeline. Click the down arrow on the lifeline to view available options.
Select the component named Sensor to be represented by the
lifeline.

Select the gutter region, click, and drag to the lifeline. Name the
To port Source and the From
port Grid. See that a gate called Grid has been
created with a message ending on the Sensor lifeline at the port
Source.

Return to the architecture diagram. Observe that Grid is a root
architecture port connected to the Sensor component.

You can add child lifelines to a sequence diagram to represent model hierarchy and describe the interactions between them.
Select Component > Add Lifeline
from the toolstrip menu. From the list that appears, select the
PowerSource component.

Child components called Battery and Charger are
located inside the PowerSource component.

Select the PowerSource lifeline. Click the down arrow below
Component > Add Lifeline, then select Add Child
Lifeline Select Battery. The Battery
child lifeline is now situated below PowerSource in the hierarchy.

The co-creation workflow between the sequence diagram and the architecture model keeps the model synchronized as you make changes to the sequence diagram. Adding both lifelines and messages in a sequence diagram results in updates to the architecture model. This example shows component co-creation.
Select Component > Add Lifeline from the menu. Another box with a
vertical dotted line appears on the canvas. In the lifeline box, enter the name of a new
component named Machine.

Observe that the Machine component is co-created in the architecture
diagram.

Remove the Machine component from the architecture diagram. Return to
the sequence diagram and select Synchronize > Check Consistency. See
that the Machine lifeline is highlighted, as it has no corresponding
architectural component.

To restore the Machine component, either remove the
Machine lifeline or select the undo button in the architecture model.
Click Check Consistency again.
You can create a message from an existing connection. Draw a line from the
Sensor lifeline to the PowerSource lifeline. Start
to type InBus, which will automatically fill in as you type. When it
does, select InBus.

The message is created in the sequence diagram.

For more information on using message conditions, fragments, operands, and operand conditions in a sequence diagram, see Define Sequence Diagrams.
The Views Gallery model browser located on the bottom left of the canvas, is called
Model Components. Click and drag the Charger child component into the
sequence diagram.

The sequence diagram is updated with a new component.

You can view the final product of the workflow example for this topic.
Open the System Composer model that contains the sequence diagram.
model = systemcomposer.openModel('ArchModel');Open the Architecture Views Gallery to view the sequence diagram.
openViews(model);
In the MATLAB® Command Window, enter scKeylessEntrySystem. The
architecture model opens in the Simulink Editor.
In the menu, navigate to Views > Architecture Views to open the Architecture Views Gallery for the model.
Right-click the Sound System Supplier Breakdown view and select
New Sequence Diagram.

A new sequence diagram of lifelines is created with all the components from the view.
