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
Select the gutter region, click, and drag to the lifeline. Name the
Source and the From
Grid. See that a gate called
Grid has been
created with a message ending on the
Sensor lifeline at the port
Return to the architecture diagram. Observe that
Grid is a root
architecture port connected to the
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
Child components called
located inside the
PowerSource lifeline. Click the down arrow below
Component > Add Lifeline, then select Add Child
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
Observe that the
Machine component is co-created in the architecture
Machine component from the architecture diagram. Return to
the sequence diagram and select Synchronize > Check Consistency. See
Machine lifeline is highlighted, as it has no corresponding
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
InBus, which will automatically fill in as you type. When it
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
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.
In the MATLAB® Command Window, enter
architecture model opens in the Simulink Editor.
In the menu, navigate to Views > Architecture Views to open the Architecture Views Gallery for the model.
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.