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:


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.


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. 


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.


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


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.


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.


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


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


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.


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.


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.


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


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.


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.


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


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.


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.


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.


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.


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


And I'll go to the features for that.


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.


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


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.


These are states in Rhapsody.


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


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.


Of my swim lane allocations.


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


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.


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


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


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.


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


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


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


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.


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


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.


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


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


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.


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.


And I anchor it.


Comment to that action.


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


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.


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


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


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


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


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.


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


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


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.


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


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


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.


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.