Monday, 3 August 2020

IBM Rational Rhapsody Tip #81 - Understanding actor test benches (intermediate)

I did this tips and tricks video in response to a few questions that people have asked as to whether they should tick the box to generate code for use case and generate code for actors? To answer this you need, of course, to understand better what you're doing when it comes to system simulation. 

In this video I look at the concept of actor test benches. An actor test bench is part of a simulation that plays the role of an actor. By including the actor in a higher level system, you can show the interactions that is has with named external entities, rather than with the system border. In Rhapsody, this is possible because actors have full classifier status, i.e. they can have ports, operations, event receptions (signals), and state machines, in the same way as blocks do.  This is one of my silent videos (it takes longer to create videos with sound, hence I need to balance my time with paid work).

Note: This is not the case for all UML/SysML tools. 

This is the transcript:

Rhapsody’s code generator is used for both software (embedded C++/C) and systems engineering simulation.
Occasionally I get asked what the checkbox means to generate code for actors and generate code for use cases. In this short video I will attempt to explain it by creating a simple simulation model.

The first thing to note is that Actor and Use Case are types Classifier in Rhapsody. This means that they can have operations, attributes/value properties and state behavior just like Blocks.
Use Cases can therefore be placed sequence diagrams and used in the same way as if they were a Blocks, e.g., receiving signals or sending events or invoking operations. They could also own state or activity-based behaviors.
This should answer the first question, which is why one would tick the box to generate code for use cases?
Of course, if you do this then you need to treat the Use case as if it were a Block being used for simulation, i.e., set the name as legal as I’m doing here by changing its name to Camel case. 

Now I can simulate the behavior of the use case by injecting events and see the changes in state on the animated sequence diagrams. The Government actor here. However, is not sown as injecting the event but I could drag a System Border on to show that the event is coming from outside the use case classifier.
Suppose, that I want to show the event as coming from the actor?
Well, this is where the concept of what is conventionally called an Actor test bench comes in.
Let’s create a build that includes the actor and the use case.
I’ll connect them for now, using rapid ports. Rapid ports are ports that have no interfaces. They can be used for building simulations quickly. 

An actor test bench is one that has its own behavior, typically described using a state machine. We’ll get this statechart to send a antibody test event to the port, whenever it receives it as a trigger. We’ll do the same for the test invalidated event.
These are both reactions in state as no state change is needed.
Now, instead of building a simulation of the use case, I’m going to build a simulation of the test bench and it’s owned elements.
In this instance, I need to make sure that generate code for actors is checked. 

The Government actor is now bold in the browser. This means that it is in the scope of the build, so I’ll regenerate and build the application.
In this simulation, the Actor test bench is now in scope and has it’s won state-based behavior. I can stimulate the simulation by getting the actor to generate the event on the use case.
Of course, it’s possible for the actor to have more than simple forwarding behavior. However, the approach shown here is the basis for how testbenches were designed to work with the Hamrony/SE toolkit.

This answers the question as to why one might check the boxes to generate code for actors and use cases?

Hopefully, that helps. If you need any more help, or want to discuss hands-on tool-based training options tailored to your company then let me know.  

Tuesday, 21 July 2020

IBM Rational Rhapsody Tip #80 - Package Diagrams in SysML/UML (Simple)

Slightly delayed on getting this one out but this is the seventh in a series of videos on the different types of diagrams in UML and SysML.

This short video (unusually with audio!) covers Package Diagrams one of the simplest structure diagrams that SysML inherits unmodified from UML. In general they show containment and dependency relationships between packages, although it's important to note that any of the structural elements might also be shown such as nested hierarchies of requirements or blocks.

The video covers some tips and tricks to get the most out of Rhapsody including setting the TreeContainmentStyle property depending on the style of containment relationship that you want to show. The video uses Rhapsody 9.0.1 (released July 7 2020).

Here's the transcript (in case people need additional info to help understand):

This is the seventh in my series of videos on the different diagrams in the UML and SysML languages. In this video, I’m going to cover how Package Diagrams are implemented in IBM Rhapsody.

Package diagrams - like use case, sequence, and state machine diagrams, are inherited into the Systems Modeling Language directly from the UML without modification.

The PDF I’m showing here is actually the first UML 2.0 spec from 2003. Here we can see that it states that there are no strict boundaries between the different structure diagram types, and it is possible to display elements such as objects, classes and packages, in any of the variations, it’s just that usually package diagrams are focused - as you’d expect - on packages.

If I switch to the UML menus in Rhapsody so that the SysML profile is not active, then you’ll notice that Rhapsody doesn’t have an explicit Package Diagram type, rather it expects an Object Model Diagram to be used for this purpose.

It does this on the basis that the Object Model Diagram drawing toolbar already allowed in 2003, the modeler to draw any of the structure diagram elements including objects, classes and packages.

If I switch back to the SysML menus, however, you’ll see that there is an explicit menu for a Package Diagram, and that the SysML profile has added this to Rhapsody’s pop-up menus.

Package diagrams are one of the simplest diagrams in the UML’SysML language.

Since all diagrams SysML have a diagram frame, the fact that this is a package diagram can be seen from the pkg abbreviation in the top left-hand corner of the frame.
Packages in Rhapsody are shown with a blue folder icon. They act like folders and are used to split up and organize model elements for access and understandability.

In the case of Rhapsody, they also map to separate units, or files, and hence form the basis of configuration management operations like check in and check out, and for sharing of common model elements between different projects.

Packages, like folders on a file system, can be nested underneath other packages. The package diagram allows useful groupings such as these to be visualised on a diagram.
If you try to show something out of context, then you can see here, that Rhapsody denotes this with a dashed line.

In this instance, I could right-click to change its ownership, in which case the browser will re-structured to match the diagram.
The Nesting style shown here is using Rhapsody’s default display option.

If we look in the latest SysML specification, Figure D.3 here shows us the two different containment notations. Both mechanisms shown here are possible in Rhapsody, but you may need to set a display property to get the top-one to work.

Let’s have a go at drawing this diagram. I’ll add a new package diagram to the HSUVModel package, but before doing anything else, I’m going to set a display property on the diagram called TreeContainmentStyle.

This notation style is also referred to as “alternative membership notation”. The property could be set at diagram, package, or project level.

It can be used to depict hierarchical relationships, not just with packages but also other model elements such as requirements, diagrams, and blocks.

With Tree Containment Style set, if I drag elements from the browser then the containment relationship will be populated on the diagram.

Before doing this, I’m just going to set the default display size for packages, to the one that I’ve got here. These means that when I drop elements on the diagram they’ll take this as their default size.

Notice that in 8.4 onward's I can drag a group of elements from the browser, by dragging the category to select them.

Here we can see that any existing containment relations we will automatically populated, if we drag something on to the diagram from the browser.

Conversely, If I remove the relationship in the model then the diagrams will be updated accordingly to remove the containment display, so that the diagram and model are always in sync.

If the related elements are already on the diagram, then we can choose to populate existing relationship using the Complete relations menu in the main Layout toolbar.
Notice that I can drag any model element on to the diagram.

For example, here is the containment relation shown between the HSUV Structure package and the Automotive Domain block.

The second form of the containment notation will still work with the TreeContainmentStyle property set. This is the default way of showing the HSUV Specification is underneath the HSUV Requirements package.

Package diagrams are also used to show other types of relationship between packages. Most commonly these are dependency relationships with stereotypes applied. The stereotypes could be built in or user-defined.

Here I am saying that the HSUV Use Cases package has a Usage dependency on elements in the HSUV Requirements package.

Profiles are types of packages and can be used on package diagrams in the same way.
If a profile is not globally applied but contains properties that you want to apply to only part of the project, then it can be applied to a package and its children using a built-in Rhapsody stereotype called AppliedProfile.

Sometimes I use colour to differentiate profiles from packages on the diagram. There are no conventions in the use of colour in SysML or Rhapsody, however. Of course, you must be careful in using colour alone as a reasonable proportion of the population is colour blind, hence other formatting could be used.

Don’t forget that you need to set the TreeContainmentStyle property if you want to show containment links on diagrams and that it’s perfectly possible for package diagrams to contain model elements other than packages.

There we have it. Package diagrams. One of the simplest structure diagrams that SysML inherits directly from UML without modification.

My name is Fraser Chadburn and I specialist in tool-based training and consulting in IBM products and in particular in setting up Rhapsody using domain-specific profiles.

Using Java automation, I can simplify and speed up modeling tasks so that users can focus on creative and fun systems and software engineering.

If you do have any questions, then feel free to email me.

Thursday, 16 July 2020

IBM Rhapsody HandsOn Labs Menu - V11 - 16 Jul 2020 - 1.pdf

Over the last 5 years I've been delivering hands-on tool-based training to a variety of Rhapsody customers. This has meant that I've developed 21-26 hours of labs that can be done with the latest Rhapsody releases. This is much more than can be delivered in a 3 or 4 day training hence I usually do a call with a client first to decide what they really need. Here's the latest Lab Menu IBM Rhapsody HandsOn Labs Menu - V11 - 16 Jul 2020 - 1.pdf: .

If you're looking for tool-based training in Rhapsody then let me know.

Small SysMLHelper profile update

Just a quick note to say that I uploaded some fixes to create a v3.0.x version of the SysMLHelper on For those that don't know I host this an open source project on GitHub (with a GPL 3.0 license).

The SysMLHelper profile is a super-set of profiles and actually includes a number of different profiles that re-use a common Java code base:
a) A backwardly compatible update of the original v2.0 SysMLHelper profile
b) An ExecutableMBSE profile (my new term update to the original SysMLHelper), and
c) A FunctionalDesign profile (the first example of a few).
d) A Tau G2 model migration profile (work done for a specific customer).

I have a second stream of profile development underway focused on a function block-based Automotive Profile.

This new stream includes better meta-modelling support to make it easier to build Domain-Specific profiles with Rhapsody very quickly but is not yet available for distribution. This also follows the principal of re-using Java code for Rhapsody helpers so that it's quick to create customer-specific versions that are packed with usability features.

Wednesday, 8 July 2020

Interesting paper on functional architectures in SysML

This is an interesting paper on Functional Architectures in SysML: .

It's similar in thinking to some of the work I'm being doing this year with automotive customers. This work has "driven me" ;-) to use meta-modelling and advanced customisation techniques in Rhapsody to build custom profiles for automotive systems engineering with Rhapsody. It also highlights how automotive differs from other sectors in the way it "thinks" (particularly when it comes to functional safety and ISO 26262 although one could argue it both ways about the challenges of this).

Tuesday, 23 June 2020

IBM Rhapsody Tip #79 - Some shortcuts you may or may not know! (Simple)

We're all creatures of habit, I guess, hence we tend to find our own ways of doing these and sometimes it's not always the fastest. This short (and mostly silent) tips and tricks video for the IBM Rational Rhapsody UML/SysML tool came off the back of a recent webinar I did with IBM where somebody pointed out a shortcut I don't use for one of the menus that I use all the time. This made me think that a little video on shortcuts would be a good refresher for people. The video covers some "accelerators" (keys that perform actions) and modifiers (keys that modify actions) that you may or may not know.

Here's the transcript:

This short (and mostly silent) tips and tricks video came off the back of a recent webinar I delivered where an ex-IBM colleague commented about his favourite Rhapsody shortcut and I thought, why don't I use that? Anyway, here's a small selection to refresh our minds ;-)

Rhapsody includes various keyboard shortcuts (also known as accelerators). An accelerator key is a key (or combination of keys) designed to achieve a specific action.

Some of these are common to Windows applications but others may be specific to Rhapsody features such as diagram editing or controlling the workspace.

E.g., Edit > Select > Select Same Type is one of the tucked away menus I use a lot in Rhapsody! Ctrl+Alt+T is the shortcut for Select Same Type.

Ctrl+Alt+T selects all the elements of the same type, useful for using the Layout toolbar to align or space elements

Multi-select also enables you to set common display options, e.g., to show Description compartment in all the selected graph elements.

Ctrl+L is Navigate > Locate in browser.

Modifying with Shift, i.e. Ctrl+Shift+L, will Navigate > Locate on diagram.

If a diagram is selected then Ctrl+P will launch the print dialog.

Less familiar, did you know that Ctrl+R, will display the References for a selected element?

Rhapsody's Enhanced Tooltip is sometimes a useful feature (and sometimes not)...

There's some shortcut clues down here...

E.g., Ctrl+F2 will persisted the Enhanced Tooltip window.

Ctrl+Alt+F2 will toggle enhanced tooltip on and off.

Shift+Alt+F2 and it's off.

Shift+Alt+F2 again and it's on.

Another useful toggle is Ctrl+0 (zero). Ctrl+0 will hide/show the browser.

If we want to reset our workspace window layout then Ctrl+W will Window > Arrange Options.

Modifiers change the behavior of a command.

E.g. Delete will normally Remove from View, i.e. element is still in model!

Adding the Ctrl modifier, i.e., Ctrl+Delete, will Delete from model.

Modifiers also work with other commands

E.g. Ctrl+F is a conventional Windows shortcut for launching a Search dialog.

Shift+Ctrl+F will modify to Search in Diagram...

There are more, of course. However, do you know the shortcut for zoom to fit?

F6 will Zoom to fit for a diagram.

... and the Shift modifier, i.e., Shift+F6, does Undo Zoom to go back.

My Rhapsody YouTube channel subscribers now over 500!

Cause for celebration! Last week I got an email from YouTube telling me that my MBSETraining YouTube Channel had enough subscribers to fill a jumbo jet.  Of course, this is before social distancing. That said, they then told me that there was still way short of being able to generate any revenue from my efforts. Oh well.