[SysML] #25. How to draw a Sequence Diagram with EA

For an example of a Sequence Diagram to be drawn using EA, we will use the diagram below from the Sequence Diagram Chapter of Lenny Delligatti’s SysML Distilled.

This image shows a activity Diagram in order to assist How to draw a Sequence Diagram with EA

First, we will model the blocks that will participate in the Sequence Diagram.

Create a new project, create a package called Structure, and add bdd. Add 4 Blocks to the bdd and name them Propulsion Subsystem, Flight Computer, MANS, and finally Sequence Context.

And the Subsystem, Flight Computer, and MANS are related to the Sequence Context through Part Relation. And give them names ps, fc, and mans, respectively.

The reason it is named Sequence Context is because this modeling is simply for an example of drawing a Sequence Diagram and there is no need to think deeply about elements including Subsystem, Flight Computer, and MANS.

And because the elements that participate as Lifelines in the Sequence Diagram are not Blocks but instances of Blocks, the Interaction expressed by the Sequence Diagram must be included in the Sequence Context Block.

image 245

Now, in the context menu of Sequence Context Block, click New Child Diagram → Interaction → with Sequence Diagram and enter the name Execute Hohmann Transfer, Main Success Scenario.

image 246

Then, as in the Project Browser above, an Interaction called Execute Hohmann Transfer, Main Success Scenario is also created, along with a Sequence Diagram of the same name included in the Interaction. Press F2 to change the created Sequence Diagram to “Behavior Specification”.

image 248

Now it has become a Diagram Header like the example diagram. On the Project Browser, drag fc, ps, and mans, which are part properties of the Sequence Context Block, onto the Behavior Specification sd using drag and drop. Then, each part is created on the sd in the form of a lifeline.

image 249

Add Messages

Now let’s add a Message to Lifeline.

First, let’s add a Message that requests measureAltitude() in the example. measureAltitude() is a solid line with an open arrow, which is an asynchronous request. Therefore, for this, a reception called measureAltitude is needed in the mans block.

To do this, go back to Structure bdd and add a Signal called measureAltitude. And add the signal to the MANS block’s Features window → Receptions.

Go back to Behavior Specification sd and click message in Toolbox to connect from fc to mans. Then, click the message and select the measureAltitude that was just assigned to the MANS block in the Message in the properties window, and select Asynchronous in the Synch item and save.

You can then create an asynchronous message as shown below.

image 250

This time we will create a synchronous Message and Self-Message.

In the example above, this is the calculateCurrentOrbitRadius(currentAltitude) part. Synchronous functions require an Operation in the corresponding block.

Go back to Structure bdd and create an operation called calculateCurrentOrbitRadius in the Features → Operations tab of the MANS block. (For more precise modeling, you can specify parameters, return type, etc., but since this example focuses on drawing a sequence diagram with EA, precise modeling will be omitted.)

Now go back to sd and click on Self-Messgae in Toolbox and click on mans lifeline. Then click the created message, click calculateCurrentOrbitRadius just created in Properties window → message, and enter currentAltitude in Argument(s). (Synch is set to Sychronous by default.) Then, the synchronous message, Self-Message, and Argument input are completed as shown below.

image 252

Next, let’s create the Return Message of the synchronous message. Go back to bdd and this time create an operation called fireThrusters in the Propulsion Subsystem Block.

Then, create a synchronous message through fc → ps on the sd and assign fireThrusters. Then create a message with ps → fc and check Is Return at the bottom of the properties window.

image 253

Now let’s add Create Message. Since we need to add a new Lifeline, go back to bdd again, add a Block called MANS Device Driver, connect it to the Sequence Context with Part Association, and name it mansdd.

image 254

Go back to sd and add mansdd Lifeline. And then connect the message from fc to mansdd. If you set Lifecycle at the bottom of the Properties window of the created message to New, the message will change to Create Message and the Lifeline will move to the bottom.

If you set Delete in the menu, you can create a message (Destruction Occurrences) that terminates Lifeline. For example, if you connect a message with ps → fc and select Detete, you will see that an X appears in the fc Lifeline.

image 255
This is a Sequence Diagram drawn with Enterprise Architect. If you want to get more information about Sequence Diagram, this article may be helpful.

Let’s model the three types of Constraints, Time Constraints, Duration Constraints, and Invariant used in SysML’s Sequence Diagram in EA.

Time Constraint

In the above example, the point in time when the measureAltitude() message is sent from fc is set to t = now, and the point in time when the message is received in mans is set to t ~ t+3. In the context menu of the measureAltitude() message, click Timing Details..

In the various input windows, set Timing Observation to t = now to set the reference point for time, and enter Timing Constraints as t..t+3. Then, as shown in the diagram below, the message is tilted to the bottom right, Timing Observations are displayed at the tail of the message, and Timing Constraints are displayed at the arrow portion.

image 256

Timing Duration

This time we will set constraints on the interval between the fireThruster() message and the return message. When you click on the fireThrusters message, there is an upward arrow on the right.

If you click and drag the arrow and drop it on the return message, the Edit Duration Constraint input window will appear. Enter 2min..5min. You can then set a Duration Constraint between the fireThrusters() message and its return message, as shown in the diagram below.

image 257


Invariant is created on the canvas using State/Continuation in the Toolbox. If you place State/Continuation between fc’s t=now and fireThrusters() and double-click it, a window where you can set the Interaction State will appear.

You can add an Invariant Constraint by typing {currentCommand.orderedOrbitRadius} and setting State Invariant as shown in the following diagram.

image 259

Combined Fragment can be created on the Sequence Diagram Canvas by clicking Fragment in the Toolbox. Appropriately adjust the size and position of the created Fragment so that related elements are included in the Fragment.

And when you double-click the Fragment, a window appears where you can set the location and conditions of the Fragment. For example, set Type to alt and create System State == Normal, System State == Failure in Condition. (If there are two conditions, the Fragment partition is divided into two.) Then enter the appropriate Name and click OK.

image 260

The diagram with the completed alt fragment is as follows. For reference, if you click the icon with an arrow in the bottom folder among the four icons in the upper right corner that appear when you click on a Fragment, the elements within the Fragment will be fixed to the Fragment. When fragment modeling is completed, click the corresponding button to fix the elements.

image 261

Reference Interaction

In order to add another Interaction to the Sequence Diagram, an interaction called Another Interaction was added to the Sequence Context Block. And for example, fc and mans Lifeline were created as shown below and messages were connected appropriately.

image 262

Now go back to Behavior Specification sd. Then, drag the Another Interaction sd just created into the Behavior Specification sd using drag and drop. Then, the Select Type window will pop up, select Interaction Occurence and click OK. Then, you can create a Reference Interaction as shown below.

image 263

And you can connect Message to ref interaction in other Lifelines. For more accurate modeling, double-click Another Interaction to open the corresponding sd. Use the Diagram Gate in Toolbox to create points that enter and exit the diagram on the Canvas. Then, we connected the Diagram Gate to messages at the top and bottom of Another Interaction and assigned Init() and After Init() respectively.

image 264

Then click Another Interaction on the Project Browser and add Init to Feature → Operation. Then go back to Behavior Specification sd and connect ps → Another Interaction to Message. Then, you can assign the Init Operation that Another Interaction has to that message.

As shown below, MANS Block adds two Part Properties.

image 265

Then, go back to Behavior Specification sd, click mans Lifeline, and click Features → Parts / Properties to display part1 and part2 included in the MANS Block. Try clicking them all. Then, the part properties of the MANS Block of the Sequence Diagram can also be expressed.

image 267

Finally, create a Sequence Diagram between the parts of the MANs Block as shown in the diagram below and add the Sequence Diagram to the Behavior Specification as a Reference Interaction.

image 268

And by clicking Advanced → Show as Timeline in the context menu of the Reference Interaction, you can change the referenced Reference Interaction to Lifeline. In other words, Lifeline can be abstracted to a higher level.

This is a summary of what I studied about SysML Sequence Diagram. In the next post, we will cover State Machine Diagram.\

[SysML] #1. Understanding SysML Diagrams

[SysML] #2. Understanding SysML Package Diagram

[SysML] #3. Understanding Dependencies of Pkg Diagram

[SysML] #5. Understanding SysML Requirement Diagram

[SysML] #6. Understanding Relations In Req Diagram

[SysML] #7. How to draw a Req Diagram with EA

[SysML] #8. Understanding SysML UseCase Diagram

[SysML] #9. How to draw a UseCase Diagram with EA

[SysML] #10. Understanding SysML bdd Diagram

[SysML] #11. Understanding SysML ibd Diagram

[SysML] #12. Understanding Part Property of Block

[SysML] #13. Understanding Reference Property of Block

[SysML] #14. Understanding Value Type

[SysML] #15 Understanding Parametric Diagram

[SysML] #16. Understanding Flow Property

[SysML] #17. Understanding Port and Association Block

[SysML] #18. Understanding Behavior of Block

[SysML] #19. Understanding Generalizations

[SysML] #20. Understanding Dependencies, Allocate, Comment

[SysML] #21. Understanding Activity Diagram

[SysML] #22. How to draw a Activity Diagram with EA

[SysML] #23. Seq Diagram LifeLine and Message

[SysML] #24. Seq Diag Constraints Fragment Decompose

[SysML] #26. Understanding Stm Diagram State and Transition

[SysML] #27. Understanding Stm Diagram Event Pseudostate Region

[SysML] #28. How to draw a State Machine Diagram with EA

Leave a Comment