Sunday 7 July 2024

IBM Engineering Rhapsody Tip #109 - Activity diagram swimlanes and allocation

Gosh, almost on a roll. This Rhapsody Tips and Tricks video which came from some new lab work I've done for my Rhapsody training labs. 

It covers both basic principles of swimlane allocation in IBM Engineering Rhapsody using SysML but it also has a fair share of advanced aspects. For example, I show how to create a context pattern table to show allocation and how Rhapsody creates inferred allocation relations. I then illustrate how it's possible to see allocation in compartments on a block definition diagram, and how Rhapsody also has a slightly hidden capability to show allocation using SysML Callouts, a type of new term comment added by the SysML profile.

Here's the transcript:

00:00:03

OK, my name is Fraser Chadburn. In this demo, I'm going to show you some things about swim lanes in activity diagrams. I'll just navigate to this activity diagram and show you what I mean. I've got double click here working with a Java helper.

00:00:22

This is an activity diagram that just shows control flow with Rhapsody and you can see how this activity diagram is quite useful for capturing the operational scenario perhaps of the system and also how we can link these actions to requirements. 

00:00:41

I'm just going to remove a customization as at the moment the drawing toolbar here has got some additional things like a derivation and that's been done through an applied profile which is a profile that which isn't globally applied but is applied if there's a dependency with applied profile on it.

00:00:59

I'm just going to delete that and then I'll reopen the activity diagram.

00:01:11

And here I've got the default drawing toolbar for an activity diagram. Let me just expand this a bit so we can see it. I've also got action pins and activity parameters.

00:01:22

I've got these swim lanes (in the toolbar). The concept of swim lanes is the ability to associate structure to those swim lanes and then, if I put the action inside of a swim lane, then there's an implicit thing in SysML that this behavioral element is allocated to this structural element. Let me just zoom out and.

00:01:42

I'll draw a swim lane frame of roughly the same size as these actions.

00:01:47

And I'll subdivide it into three different swimlanes (or partitions).

00:01:51

This is what we'd call a black box sequence; we're looking at the operational scenarios from the perspective of the user and we're treating the system as a black box.

00:02:06

Let me just resize these to be able to resize the frame. Here I need to hold down the alt key and that allows me to have some modification of the behavior of the resize.

00:02:22

I'll make them slightly bigger. The first thing with these swim lanes is that we could associate or get a swim lane to represent a structural element. Here's my first action. The operator logs in at the control panel and activates the teleportation system because this is a teleportation system.

00:02:44

I'll turn off the hovering toolbar. I'm going to say well that that's an action performed by the operator.

00:02:53

Within my use case package here I've got an operator actor so to represent that actor I could look at the features and then pick the element.

00:03:05

Or I can drag the element onto the name of the swim lane. If I drag it here I just get an object node. If I drag it directly onto the text, it will do that represents for me. This is the swim lane that represents the operator so I move this action into that swim lane.

00:03:24

I can use the arrow keys here to just shift it across.

00:03:30

What I'm saying is that this action is performed by that actor. Let me delete and redraw the initial flow. I could move it, but generally it's just easier to redraw.

00:03:43

So that's the first step. The operator has logged in at the control panel, so the second step here the Teleportee (actor) tells the Operator where they want to transport to. I'll shift that over with my arrow key on my keyboard andmove that into the second swim lane.

00:04:02

And that is an action performed by the Teleportee. Something that Rhapsody does automatically here, if I have a swimlane, if I look in here, is it it will create an inferred relationship. You can see here that an allocation relationship has been created in the model because of the presence of that action within that swimlane.

00:04:30

What I'll also show you then, is the ability to see this allocation of behavior to structure within a table. I'm going to create something powerful concept here called a context pattern table.

00:04:46

So I create a table layout of my swim lane allocations.

00:04:59

And I'll go to the features for that.

00:05:03

Go to the columns, and go to the advanced options. Not everybody needs to know how to create a context pattern, but they're useful to know what they do and how powerful they can be so that if you think well, actually it would be really useful to see this stuff in a table. You know that it's possible, perhaps as someone in your organization who's able to to understand the series of tokens you need to write to create a contacts pattern. So here's an example I'm going to say go to all the packages and any nested packages. Then if you find a use case.

00:05:34

Then list that, but underneath the use case is an activity diagram.

00:05:39

And I'll give that a token name of act, which is the system mail abbreviation. Effectively, I actually then want to have the actions.

00:05:52

These are states in Rhapsody.

00:05:55

And then I want to see the allocated to elements, so that's go to the allocation relationship and find the end element.

00:06:06

So this is a context pattern. If I collapse the first column I can use the fill defaults to populate columns from that context pattern. The table layout is like a template, so I'll create a view so this is a table view.

00:06:23

Of my swim lane allocations.

00:06:30

If I don't click Refresh, we can see that this action is performed by this actor.

00:06:40

OK, let's look at the next things. Operator sets the destination point, the Teleportee stands on it. I'll just get rid of the Interruptible Region here and what I'll do is move across these actions into the swim lanes.

00:07:00

Once they've moved across, if I go to table view and do a refresh.

00:07:04

Here you can see it's representing that (allocation).

00:07:07

So let's look at the next thing. Actually, this is something done by the system. I've got a third swim lane but I haven't actually allocated any structural element to it, and often when we use swim lanes, we actually have blocks or parts of the system that we're allocated behaviours to. If we go into the white box model. So I'll just create a package.

00:07:34

With a block in it. So I'll create a design synthesis package.

00:07:42

In that I'll create a block definition diagram. This is a BDD of the teleportation system.

00:07:56

And there's a block on it called Teleportation System.

00:08:04

And what I want to show with this is also compartment. So firstly let me take that block and I'll allocate it, or get the swim lane here, to represent it.

00:08:22

And then I'll move this action into that swim lane.

00:08:36s

And I'll check that it then appears OK (in the table). So here we go, we've got an allocation of the system analyzes target location to the teleportation system.

00:08:47

If I go to the display options of this block then what I could do is show that allocation in a compartment.

00:08:57

And an allocated from compartment is available in the pull down list here.

00:09:02

And now I can see the allocation of that behaviour to that structural element on my block definition diagram in a compartment using the specification view.

00:09:15

In terms of the activity if I go to the display options of this action, then there isn't the ability to do compartments, but there is this option to use the SysML callout tool. It's a type of stereotype comment and if I set the display options to the anchored info on here and I make sure that box style isn't shown.

00:09:38

And I anchor it.

00:09:41

Comment to that action.

00:09:44

It's going to pick up the allocated to relationship and show that in system. SysML call out notation.

00:09:52

I'll just show you this final thing here. If I had a a core behaviour here which is dematerialise and rematerialise and I'll just move that in to a swimlane.

00:10:13

Then the question is, is it the call behaviour, or the referenced activity, that I want to allocate to the teleportation system?

00:10:26

Now. If I look at the activity model that's underneath the activity diagram here.

00:10:35

You'll see that there are two different things I've got.

00:10:39

An activity which is dematerialized and rematerialized and then I've got the action that then invokes that activity.

00:10:48

So if I want this activity to be allocated soon, then rather than using inferred, I actually have to use an explicit relationship to allocate. The right click (menu) here would require me to create a dependency and then select that this activity is performed by the teleportation System block.

00:11:11

I'm explicitly creating a dependency here and making that an allocation new term.

00:11:20

And that means that it will then also appear in the allocated from compartment.

00:11:30

If I had the activity on here, we can see that relationship. The display options of the activity on a block definition diagram do allow me to put compartments.

00:11:50

So that’s it. A quick introduction to the idea of using swim lanes to do allocation of behaviors to structures from activity diagrams.

00:12:00

And also some of the support within Rhapsody for inferred allocation that comes from the presence of an action within and from lane.

00:12:10

Or explicit allocation which comes from creating allocation dependencies from the behavioral element to the structural element, in this case, and how we can see these in either compartments on a block definition diagram, or using call out notation on an activity diagram.

00:12:28

Hope that helps. My name is Fraser Chadburn and I do a lot of work with customization, specialization of Rhapsody. If you have any questions then give us a call. Thank you.





No comments:

Post a Comment

Note: only a member of this blog may post a comment.