SysML Tutorial
SysML Tutorial
SysML Tutorial
Version 7.3-a
Atego
5930 Cornerstone Court West
Suite 250
San Diego
CA 92121
USA
Atego
701 Eagle Tower
Montpellier Drive
Cheltenham
GL50 1TA
UK
www.Atego.com
1 Contents
Introduction ........................................................................................................................... 1
Purpose ......................................................................................................................................... 1
Assumptions ................................................................................................................................. 1
Structure ....................................................................................................................................... 2
Using the SysML Tutorial .............................................................................................................. 3
The Artisan Studio SysML Profile ................................................................................................. 3
1 The Supplied SysML Model .............................................................................................. 4
1.1
Installing and Opening the Model .................................................................................... 4
1.2
The Artisan Studio SysML UI ............................................................................................ 5
1.3
Menus and Toolbars ......................................................................................................... 6
1.4
Using the Explorer Panes.................................................................................................. 8
1.5
The Output Panes ........................................................................................................... 14
1.6
Context Menu Options ................................................................................................... 18
1.7
Diagrams and the Diagram Pane .................................................................................... 19
1.8
Property Pages ............................................................................................................... 22
2 Building a SysML Model ................................................................................................. 25
2.1
Applying the SysML Profile ............................................................................................. 26
2.2
Developing the Model .................................................................................................... 29
2.2.1 Capturing Requirements ............................................................................................ 29
2.2.2 Blocks and Block Diagrams ......................................................................................... 35
2.2.2.1 Block Definition Diagram (BDD) ......................................................................... 35
2.2.2.2 Internal Block Diagram (IBD) .............................................................................. 39
2.2.2.3 Ports, Interfaces and Item Flows ........................................................................ 41
2.2.3 Constraint Blocks and Parametric Diagrams .............................................................. 51
2.2.4 Use Case Modeling ..................................................................................................... 57
2.2.5 Activities and Activity Diagrams ................................................................................. 61
2.2.6 Allocation .................................................................................................................... 75
2.2.7 Interactions................................................................................................................. 79
2.2.8 State Machine Diagrams ............................................................................................ 98
2.2.9 Relating Requirements to Other Model Items ......................................................... 107
2.2.10 The Package Diagram ........................................................................................... 114
Introduction
Introduction
The Unified Modeling Language (UML) has, since its inception in the 1990s, become
the de facto modeling language for software engineers involved in the creation of object
oriented software systems. For systems engineers, UML has not been adopted so
readily. Although it provides a potentially useful underlying set of concepts and
diagrams, a significant numbers of aspects of systems modeling were omitted or difficult
to apply.
In 2001 the International Council on Systems Engineering (INCOSE) and the Object
Management Group (OMG) proposed that work should begin on an adapted version of
UML for systems engineering. The subsequent production of a SysML specification in
2006 has led to considerable interest within the systems engineering community. OMG
SysML is based on UML. It adopts some of UML, it adapts and extends UML in other
areas, and it also introduces some new modeling concepts.
Artisan Studio (Studio) is a powerful, coherent and comprehensive set of tools for
developers of complex real-time systems. It provides multi-user modeling for
architecture frameworks, SysML and UML. Its support of SysML is seen as a logical
extension to allow systems engineers to benefit from its modeling and support
capabilities. It also provides a means of seamlessly linking systems and software models.
Purpose
The primary aims of this tutorial are to show how Artisan Studio supports SysML and to
provide some practical guidance in using Artisan Studio to construct SysML models and
artifacts. To do this the tutorial specifies certain activities that you should carry out
against Artisan Studio SysML models, one of which is downloadable from the Artisan
Studio product web page (http://www.atego.com/download-center/product-guides/).
These activities are identified by this font and are numbered , to distinguish them from the
explanatory text.
Assumptions
The tutorial makes little attempt to teach the principles, concepts and notation of SysML
itself; it is assumed that the reader is familiar with these (if not, the SysML Final Adopted
Specification can be obtained at http://www.omg.org/spec/SysML/1.2/PDF).
Alternatively, (and probably somewhat easier to digest) a SysML text may be helpful in
understanding some elements of this tutorial.
It is also assumed that the reader has access to a copy of Artisan Studio with an
appropriate license.
Introduction
Structure
The first section of the tutorial examines the structure and content of a complete
supplied Artisan Studio SysML model. We look at how this relates to the structure of
SysML itself and how you can navigate your way around this model. We also take a
quick look at the Artisan Studio SysML profile and the mechanisms it uses to create a
SysML modeling environment.
In the second section, we look at how you use the Artisan Studio SysML profile to create
a SysML model in Artisan Studio, and how you build SysML products and artifacts in that
model. The order in which the various SysML diagrams are created is related more to
the structure of SysML (see the following diagram) than to any definition of process. As
with good systems engineering practice, building a SysML model is an iterative process,
each iteration refining aspects of the model. It is unlikely that a complete SysML model
would be built by simply constructing a sequential set of diagrams as we have illustrated
in the tutorial. However, the order shown here could be the basis for an iteration.
Requirements might first be captured. Then high-level structural elements identified
together with key aspects of their connectivity. Following that, required high-level
behavioral elements of the systems might be identified and explored, with some
allocations of behavior to structure made (that is, what components do what things).
The next iteration might then move down a layer of abstraction, refining and elaborating
requirements, structure and behavior.
SysML Diagram
{Abstract}
Behavior Diagram
{Abstract}
Activity Diagram
State Machine
Diagram
Sequence
Diagram
Same as UML 2
Requirement
Diagram
Block Definition
Diagram
Structure Diagram
{Abstract}
Internal Block
Diagram
Parametric
Diagram
Package Diagram
Introduction
Interactions
Capturing Requirements
Allocations
If you have any comments or questions regarding the use of the SysML Tutorial, please
email us at [email protected].
3
The remainder of this section (1.1) only applies if you do not have
access to the HSUV model in the Examples repository.
If you have not already downloaded the SysML Tutorial self-extracting zip file and
extracted the contained files, you will need to do so now, before attempting any of the
activities in this section. Instructions can be found on the Artisan Studio product web
page (http://www.atego.com/download-center/product-guides/).
After extracting the files from the download, the model, as an exported zip file, should
be found in the <target>\SysMLTutorial\HSUV\ directory, where <target> is the
pathname you specified to extract the files (default is C:\ArtisanTutorials\).
2. Open Model Explorer from your desktop
3. Click the Models repository name to open this
repository.
4. Right-click in a blank area of Models repository
window and from the context menu select Import
Model (as opposite).
5. Use the Open dialog to locate and open the
HSUV.zip file. Select Yes when asked to confirm the
import and wait while the model is imported to your
Models repository.
6. When the new model name appears in the repository, double-click to open the model
in Studio.
If you do not see a Models repository in the Models Explorer window, there may
another repository available to you in which you can import or create new Artisan
Studio models. If so, substitute the Models name in the activities below with the name
of this repository.
If not, you will need to create and start a Models repository before continuing with the
section. The Artisan Studio Help (Repository, Model, Component, /Repository
Management/ AdministEation Tasks/) has pages explaining how to do both tasks.
After creating and starting the new repository you will then need to add it to Model
Explorer. Again the Help system provides information on how to do this (Repository,
Model, Component, /Model Management/Artisan Model Explorer/Working with
repositories/).
Once you have a repository running and set-up in Model Explorer, import the model
using activities 2 to 6 above.
Explorer
panes
(browser)
Output panes
Diagram pane
Property pages
Your initial screen should look similar to that above. If not, use the View, Reset Layout
menu option which will alter the layout to that shown. You will find that you can drag
the internal borders of the panes to re-size them, as required.
Different toolbars are displayed dependent upon your current activities. For example,
when you have a diagram open, you will see a common diagram toolbar and also a
toolbar specific to that diagram type. We will examine the diagram toolbars in later
sections of this tutorial. Here we will briefly examine the three toolbars seen on the
Artisan Studio screen shown earlier.
One facility not available from the menu is the navigate facility. The navigation toolbar
buttons
allow you to navigate to items that have been previously selected in
the Explorer and Output panes, also to items you have selected on Property Pages, and
to symbols you have selected on diagrams (see activity 1 below).
1. Spend some time (5-10 minutes, we suggest) exploring the structure and contents of
the Help system. In particular, use the Help menu Help Topics option to bring up the
Index facility, and from here, input navigate to learn about the use of the navigation
buttons.
You can show or hide toolbars using the View menu option. We will not need to use the
Change Tracking toolbar so it can be hidden.
2. Use the View menu option to
hide the Change Tracking
toolbar as shown opposite.
select
the
There are three top level packages: ModelingDomain, HSUVModel and Profiles.
Below these entries you can see a couple of Artisan Studio Text Diagrams: a ReadMe
and a copy of the introductory information from Annex B of the SysML specification.
5. Double-click the ReadMe text diagram name in the Packages view.
This opens the text diagram in the diagram pane, which explains a little about the
diagrams in this model. You may also want to open the Annex B text diagram if youre
not familiar with the SysML sample problem.
6. When you have read the text, close the text diagram by clicking
the close icon on the diagram tab in the Diagram pane (as
opposite).
7. Now expand the Profiles package.
The SysML profile is contained within the SysML Profile package (it has a customized
package icon). We will examine some of the concepts behind this profile later in this
section of the tutorial and we will see how this it used in section 2. There is also a UML
Profile package (also with a customized icon) remember SysML reuses some of UML,
including some standard UML stereotypes which are in this package. Also within the
Profiles package you will see symbol style item called Model Custom Styles. This defines
customized presentation options for certain item types within this model. You can see
which item types through the Model Item Types drop down selection on the Items
property page for the symbol style item. You can also see details of the presentation
customization through the Edit button on the Style property page.
The other two top level packages, ModelingDomain and HSUVModel (with the standard
package icon), contain the HSUV model information. We will need to examine these
although much of the information is also accessible through the other panes.
The main purpose of the Packages tab is to allow
you to structure the model content in a
meaningful way.
8. Collapse the Profiles package and expand the
HSUVModel package (as opposite).
This
will
open
package
diagram
that
diagrammatically shows the package structure of the HSUV model together with a few
key items and relationships.
Although it is outside the scope of this tutorial to explain the significance of these items
and relationships (see the SysML specification for full details), you can see the
description of the diagram as contained in the SysML specification (with a correction
by Atego) through the diagram properties.
All diagrams in this model have the SysML specification description added to their
properties.
10. Select the diagram name in the Package browser and examine its Description property
via the property pages Text tab (as shown below).
The other top level package visible in the Packages pane is the ModelingDomain
package. This package contains domain items and sub-packages that define domain
specific value types and stereotypes. It also contains two more package diagrams, one of
which shows the value types and their units, the other shows how the items and subpackages here relate to each other. Both of these diagrams have a Description property
pasted from the SysML specification.
You can expand the ModelingDomain package and examine its content if you wish. You
can also open the contained package diagrams. However, be sure to close these
diagrams and collapse the package before continuing with the remainder of the tutorial.
Now we will look at the SysML panes and return to the Parts pane later. We will
consider these panes in the order that we will cover their topics in the tutorial, rather
than the order their tabs appear in the Explorer panes.
11. Select the Requirements pane.
10
addedRequirements
deletedRequirements
modifiedRequirements
11
Blocks are one of the key elements in SysML. They are new, that is, not inherited from
UML. A good description of blocks and some of the other folders you see with this tab
can be found in the Description property of the top 'block' folder in the Blocks pane.
Each folder in all five of the SysML panes has a Description property that describes what
the folder holds.
Like the Requirements pane, the Blocks pane provides a flat, dictionary-like view of
block-related elements in the model. Each folder displays its content in alphanumeric
order, making it easy for you to locate any specific item.
14. Expand a few of the Blocks view folders to get an idea of how much block-related
information is in the model.
15. Now switch back to the Packages pane, and expand the HSUVStructure package within
the top-level HSUVModel package.
Here you will see many (but not all some are elsewhere) of the blocks and block
diagrams visible from the Blocks pane view. Block definition diagrams (BDDs) are visible
at the foot of the package that scopes them, but to see internal block diagrams (IBDs),
you will need to expand the block that owns the IBD.
Because IBDs are owned by a block, you can open an IBD from the context menu of the
parent block. If a block has one or more child IBDs (not all do), you can right-click that
block in either the browser or on a diagram and use the Open option to select and open
a child IBD.
The remaining SysML Explorer panes (Allocations, Constraint Blocks, Ports and Flows) all
provide similar, folder-organized, alphanumerically-ordered lists of relevant model
elements. If you wish you can select these tabs to see what sort of information they
contain.
That leaves us with the Parts pane. As the name implies, this pane is used to show the
decomposition of anything that can contain parts (for example, requirements, blocks,
constraint blocks, etc.). It is typically used to view the decomposition of a block.
16. From the Packages pane, expand the HSUVStructure package within the top-level
HSUVModel package and then expand the AutomotiveDomain block as shown below.
12
Note that the parts on the diagram (in this case, with some customized symbols), as in
the browser, have a name that shows their part name (for example, drivingConditions)
followed after a colon with the name of the block that types the part (Environment).
Two additional pieces of information are also visible on the diagram. Firstly, it shows
which parts connect to which other parts. Secondly, the drivingConditions part is itself
13
composed of lower level parts (weather, object, road), all of which are external to the
domain, as indicated by the external stereotype.
18. Now switch to the Parts pane, where you will also be able to find and expand the
AutomotiveDomain block (as opposite).
The intention is for you to get an overview of what this model contains and how this
content is organized. It may help if you also relate this to Annex B in the SysML
specification (if you have this available).
Contents Pane
Results Pane
Results 2 Pane
Favorites Pane
Output Pane
Diagram Thumbnail Pane
The Contents Pane displays the contents of the currently selected item in the currently
open browser pane. You can use the drop-down View list to select another browser
pane that you wish to view in the Contents Pane.
14
The content display format can be changed using the display option buttons. The order
in which the content is displayed can be changed by clicking into one of the column
headings (for example, the Type heading).
Unlike the browser panes, items displayed in the Output panes can be multi-selected
(using the Shift or Ctrl keys). This can be useful for multi-deletion, common property
setting, or moving items between packages.
In the following illustration the Contents pane is showing the contents of the Blocks
browser, which has been selected from the drop-down list.
What you see (above) may at first look strange; you appear to be seeing a list of
stereotypes and not the folder list that you get when you select the Blocks explorer
pane. The reason for this is a consequence of the Artisan Studio SysML Profile
implementation and is explained in the next section on Property Pages. It is no
15
coincidence that the stereotypes have the same name as the folders; double-clicking on
the block stereotype will provide exactly the same list of blocks as you would see
from double-clicking the blocks folder in the Blocks Explorer pane.
The two Results panes both act similarly in showing the list of elements (including
diagrams) that result from a model item search. You can normally select which Results
pane to receive your output, thereby allowing you to compare search results for
example.
In the example above, we are seeing the results of a request to report all usage of a
specific actor (Driver). From the list in the Results pane, we could double-click a diagram
name to open the diagram in the Drawing pane.
1. On the previously opened Automotive Domain IBD (as above), right-click on the
Maintainer actor and select Report, Usage.
2. When the list appears in the Results pane, double-click the name of the Use Case
Diagram to open that diagram.
16
3. Then right-click on the Maintainer actor entry in the Results pane and select Find, On
Diagram to locate the actor on the use case diagram.
4. Finally, right-click the linked Maintain the vehicle use case on the use case diagram
and select Find, In Package Browser to locate the package scoping the use case.
With the Output pane selected you are able to look at any textual output generated by
Artisan Studio or the add-ins. These include error messages, status messages and Report
Writer outputs (see the Help system for details of the Report Writer).
5. Right-click in a blank area of the currently open use case diagram and select Report,
Consistency.
You will notice that the Output pane is automatically selected to show the report
output.
The set of consistency check applied depends upon the type of diagram. You can use
Help to find what consistency checks are performed for each diagram type.
The Favorites pane allows you to quickly access items and diagrams that you use
regularly. You can add any item or diagram to the Favorites pane and then use that
item's or diagram's context menu commands as you would anywhere else in Studio. In
addition, you can use the items and diagrams in the Favorites pane for performing dragand-drop operations in Studio.
Items can be added to the favorites pane either by dragging the item into the pane from
the browser window, or by right-clicking on the item (in the browser window or on the
open diagram) and selecting Add To Favorites from the context menu.
17
options appear in many contexts whereas others are much more context specific. It is
worthwhile briefly considering some of the more useful and generic options now.
Populate provides a quick way of adding existing
model items and relationships to a diagram. The
Populate sub-menu is context sensitive depending on
whether you invoke it from the diagram canvas or an
item on the diagram, and what type of diagram or item
it is.
New can be used to create new items that belong to
the source item; this includes child diagrams.
Open allows you to open child or associated diagrams.
Links is a powerful mechanism for creating
associations between appropriate model diagrams
and/or model items. A Links Editor dialog box is used
to create or break links.
The Find option here allows you to locate a selected
item or diagram in one of the Explorer panes, or an
item on a large diagram.
Add To Favorites and Remove From Favorites provide
a method of adding the source item to the Favorites
pane.
Applied Stereotypes provides a quick method of
applying a stereotype to a model element. The list of
stereotypes offered is dependent on the element type.
Delete and Delete from Model. Delete simply removes
an item from the current diagram but leaves it in the
model and therefore on other diagrams. Delete from
Model is more powerful as it totally removes an item
from the model and all diagrams (you will be asked to
confirm this type of deletion).
View Options allows you to show or hide information for one or more diagram items.
The Properties option provides one way of displaying the Property Sheets for a selected
diagram, model item or set of similar model items.
The Help system has more specific information on many of the above options.
19
Model in the previous section). The model item can be represented symbolically on
many diagrams and, in some cases, many times on the same diagram.
Most other issues are related to toolbars. The common diagram toolbar is shown below.
symbol
alignment
symbol
spacing
symbol
sizing
align
to grid
diagram
resizing
page
breaks
diagram
lock
20
Show page breaks toggles the visibility of printing breaks on a large diagram. Where
these will occur will depend on your print option settings.
The diagram lock button allows you to control whether other model users can edit a
diagram that you have opened with write access. The whole issue of permissions is a
complex one in a multi-user tool like Artisan Studio, and is outside the scope of this
tutorial. The Help system contains a large amount of information on this topic.
In addition to the common diagram toolbar, each individual diagram type has its own
toolbar. This will contain buttons specific to the modeling relevant to that type of
diagram. However, they nearly all contain a set of buttons, shown below, that are
identical for each diagram type.
Note
Constraint
Comment
Frame
Link
A Note is just that: a note that you can add to a diagram to add some information. It is
merely a diagram symbol with no corresponding model item. Often you will want to use
the Link button to link the note with a specific item or items it relates to.
A Comment is similar to a Note, the difference being that a comment is a model item
that belongs either to the package that contains the diagram (if unlinked), or to the
model item it is first linked to.
A Constraint is similar to a Comment but is shown on the diagram enclosed in { }, as
specified by the UML.
Both Comments and Constraints show up as model items, scoped to their package or
their parent item, in the Packages and Relationships panes. They can also be created
from their Parent item using the context menu New option.
Finally the Frame button is used to create a frame box on a diagram that can be resized
to enclose a set of diagram items. Frame boxes have no model item significance, they
are simply diagram symbols, adornments for the viewer's benefit. However, they can be
named and the name can be shown using View Options.
1. Spend a little time now using the toolbar buttons explained in this section on some of
the diagrams in the HSUV model. Make sure you undo any changes you make.
21
22
The Browsable check box you see here is used to define requirement as a stereotype
that is shown as a folder in the Requirements (browser) pane, which is why we see it as
a folder here.
4. Now select the More Options tab.
The selected check boxes on this page, together with properties defined on other
property pages, will result in UI and behavior changes for any item to which this
stereotype is applied. One such item is the Acceleration requirement
5. Expand the requirement folder, open the property pages for the Acceleration
requirement and select the General tab.
Acceleration has had the requirement stereotype applied, automatically, at its creation,
with the result that:
it has a requirement type (the use of Override Type Name check box, in the
preceding image),
it has a profile-defined requirement icon (similar to that in the browser
pane),
it has a set of requirement properties, seen through its requirement tab.
23
Here youll see the set of tags linked to all requirements (through the requirement
stereotype).
7. Now expand the Acceleration requirement in the browser pane.
Here you will a subset of the tags visible through the property sheet. Why just a subset?
8. Open the properties for the derived tag in the browser pane, and select the Usage tab.
You will see that this tag has its Browsable check box selected, and therefore is visible in
the browser pane. The additional tags that showed up in the requirement properties of
Acceleration had this check box cleared, and so are not visible in the browser pane.
The other thing you will have noticed on the requirement property page of the
Acceleration requirement is that most of the tag values appear grayed-out. These are
derived values, dynamically updated as you open the property page from current model
information. What does the updating is a script defined as a property of the tag.
9. With the derived tag still selected in the browser pane, open the Derivation Script tab
of its properties.
Youll see the script being used to update this property. Scripts are a key aspect of an
ergonomic profile and are also used by SysML profile stereotypes. A script is a piece of
code that gets executed when an event occurs on a stereotyped item, such as the
selection of a context menu option or a double-click.
10. Now re-select the requirement folder in the browser pane, open its properties and
select the Menu tab.
The list of context menu items you see here are those that the profile has defined as
being specific to a requirement stereotyped item. Each entry here has an associated
script that will be executed when the context menu option is selected.
11. Select the UI Events tab.
You will see that for a requirement stereotyped item, a script is executed whenever
the item is double-clicked.
The scripts and properties of the stereotypes and tags that constitute the SysML profile
have been preset by Atego to create a SysML modeling environment consistent with
that defined by SysML. If you change any of these scripts or properties, you are likely to
adversely affect that environment. You should not, therefore, attempt to change any of
these scripts or properties unless you fully understand the implications of the change.
12. Finally, close the Artisan Studio application.
24
25
Your Model Explorer window may show more repositories than those shown above; that
does not matter as long as one of them is the Models repository.
If you do not see the Models repository, try
right-clicking the server in the left-hand pane of
the Models Explorer window and selecting Show
All Repositories, as in the diagram opposite.
26
27
This will automatically select the UML checkbox so that both profiles will be added to
the model.
5. In the Model Name text box, enter the name My SysML Model, as shown above. Then
click the OK button.
It will take some time to create the model with the required profiles.
6. When My SysML Model appears in the Models repository in the Model Explorer
window, double-click the name to open the model and maximize the Artisan Studio
window.
The SysML and UML profile packages are visible in the Packages pane. Note that like all
profiles, they are protected and therefore their content cannot be changed unless the
model owner unprotects them.
WARNING: CHANGING THE SysML or UML PROFILE CAN RESULT IN SEVERE FAILURE IN A
SysML MODEL AND MAY MAKE IT IMPOSSIBLE TO UPGRADE THE PROFILE AT A LATER
POINT. IT SHOULD BE DONE ONLY IN EXCEPTIONAL CIRCUMSTANCES, AND EVEN THEN
ONLY BY SOMEONE WHO FULLY UNDERSTANDS ALL ASPECTS OF THE PROFILE.
At present your model, with the SysML and UML profiles added, can be used to build
both SysML and UML models. This can be very useful when you want to combine UML
design elements in with a SysML model. However, if you want to create a SysML-only
modeling environment, you should remove the UML-oriented Explorer panes following
activities 1 - 3 on page 8.
28
29
30
7. Click onto the diagram, inside the diagram frame to create a new requirement.
8. Name it Performance.
You will see that most of the tags are derived, their values cannot be set from this
property tab. One that is not a derived tag is id#.
10. To set a requirement id# value, doubleclick in the Tag Value column for id#, and
enter the required text value (REQ_1 in
the example opposite).
You will have noticed that neither of these additional properties are yet visible on the
diagram. Artisan Studio typically gives control to you regarding how much information is
shown on diagrams, using the View Options dialog, or, as in this case, via a context
menu option to toggle compartments.
13. Right-click Performance on the diagram and select Toggle Compartments id# (as
below).
31
14. Repeat the last activity, this time selecting the txt compartment.
If you wish, you can resize the Performance requirement on the diagram, so that it looks
something like that opposite.
Note that you can hide compartments using the
Toggle Compartment option (we have done so for
following screen shots).
We mentioned earlier that many of the derived tag
values for a requirement are set by creating
relationships between the requirement and other model items. We will return later to
consider traceability relationships to other model items, but now we will consider
relationships between requirements.
15. Use the Requirement toolbar icon, as previously, to create another
requirement on the diagram called Acceleration.
16. Now select the Requirement Containment Link icon
32
The other relationship to cover here is the derive dependency, where a client
requirement is derived from a supplier requirement. This time we will show an
alternative way to create a requirement.
18. In the Packages browser, right-click the HSUVRequirements package and select New
SysML Requirements Requirement.
19. Name the new requirement Power.
Another thing you might want to do is to define the specific information that goes into
the table. There will be a row for each requirement within the selected scope, but you
have control over what columns are created when you open the table.
24. Right-click the table name in the browser and select Set Column Definitions.
This adds a new entry to the list, by default another Name entry.
27. Click (you may need to double-click) the new
Name entry to expose the drop-down list (see
opposite).
28. Scroll the drop-down list to find the required
entry (for example, the id# entry shown
opposite) and select it (do not click the OK
button yet).
34
The table will open in Excel. You may want to adjust column width and row height using
standard Excel formatting functions, but be aware that these changes will not be
preserved. You can confirm that the required information is present and that it is correct
and consistent with that on the requirements diagram.
33. Close Excel and choose not to Save the table when asked.
The table gets re-generated from current model information each time you open it in
Artisan Studio, so you only need to save if you want to baseline the table at a point in
time.
Before leaving requirements modeling, you should switch to the Requirements browser
pane and open the folders there to see the model elements you have created.
34. Finally, close the requirements diagram and collapse the HSUVRequirements package
in the Packages pane.
2. Right-click on the HSUVStructure package and select New SysML Blocks Block
Definition Diagram as shown in the following image. Leave the diagram name as the
default.
This creates a BDD with the same name as the package scoping it. We will use this to
build a preliminary block hierarchy for the HSUV.
3. Select the Block toolbar icon
block HybridSUV.
4. Create three other blocks on the diagram, either using the Block toolbar icon, or by
right-clicking the HSUVStructure package in the browser, selecting New SysML
Blocks Block (see the previous screen image) and then dragging the block to the
diagram. These blocks should be named BrakeSubsystem, ChassisSubsystem and
PowerSubsystem.
, first click on
You will see the name bk appear also on the diagram (you may want to move it to see it
more clearly).
We have modeled that 1 HybridSUV contains 1 part called bk that is typed by the
BrakeSubsystem block. Part names are also called role names (the part plays a specific
role with the parent block). Both the numbers and the part/role name can easily be
changed.
7. Open the properties
for the composition
relationship
and
select the End Role
tab, as opposite.
8. Select the tbd entry
from the drop-down
list (as shown above).
37
This creates a similar looking relationship to composition, except that the diamond is
unfilled (see the following diagram). In SysML this type of relationship is used to model a
shared item. The BrakePedal instance that belongs to the BrakeSubsystem, is shared by
the PowerSubsystem. We will see the implications of this shortly. Composition (part
association, in SysML terminology) and aggregation (shared association) have similar
sets of properties.
13. Select the shared association from PowerSubsystem to BrakePedal and use its
properties to set the End Role role name to bkp and the multiplicities to tbd.
Your diagram should now look much like the one below.
bdd [Package] HSUVStructure
block
HybridSUV
c
block
ChassisSubsystem
bk
block
BrakeSubsystem
bkp
block
PowerSubsystem
bkp
block
BrakePedal
The BDD tells us what blocks have what parts and what type (of block) those parts have.
In the Packages browser, you should see the five blocks and the diagram within the
HSUVStructure package. Note that you cannot expand the HybridSUV's bk part (to see
38
its contained bkp part) in the Packages pane, you have to select the Parts pane to see
multiple levels of decomposition.
As well as showing part properties, BDDs can also be used to create and show other
block features. You will find BDD toolbar icons for both Block Property (Value) and
Operation. Selecting either of these and clicking on a block on the diagram will create a
value property for the block or a block operation (a function carried out by the block).
You can also create block features in the browser by right-clicking the block and using
the New context menu option.
To show block properties on a BDD you use the same Toggle Compartments context
menu option that you used for toggling compartments for requirements.
14. Right-click on the HybridSUV on the diagram and select Toggle Compartments
Parts.
This will open the parts compartment, to show the three parts and their block types. In
our case this duplicates information already visible from the composition relationships,
so having seen the mechanism for showing block properties, you might want to now
hide this compartment.
In practice, as your structural model becomes more complete, the use of compartments
on a BDD can be a very useful way to see a variety of block properties. As well as the
examples weve already mentioned, you can also show compartments for constraints,
references and ports.
2.2.2.2 Internal Block Diagram (IBD)
It is important to note that what we havent captured so far is information about the
connectivity of the parts. The composition and aggregation relationships on the BDD
show 'ownership' not 'connectivity' .
1. Right-click on the HybridSUV block on the diagram and select New SysML Internal
Block Diagram (as below).
2. Change the default diagram name from [block] HybridSUV to [block] HybridSUV [Part
Connections].
39
We want to add the three parts inside the IBD frame the frame representing the
HybridSUV block. We could do this by dragging the parts from the browser to the
diagram, or we could use a Populate context menu option.
3. Right-click inside the IBD
diagram frame and select
Populate Block Properties
(Part) (as opposite).
5. Drag the connector line to create a waypoint if you want one, and with the connector
selected open its properties.
6. Select the General tab and
change the default
name
(Connects) to c-bk (as shown
opposite).
40
We could have left the use of the View Options until both connectors were created.
Then, by selecting both connectors (using the Ctrl key), we could have right-clicked on
either and set View Option for both. You will find that can multi-select similar items on
many diagrams to change their View Options collectively, rather than individually.
Your diagram should look something like the one that follows. You can resize most of
the items if you wish by selecting them and then dragging a border.
All that happens is that just one part is added, the bkp part, typed by the BrakePedal
block, that is owned by the BrakeSubsystem, but shared by the PowerSubsystem. The
dashed boundary indicates it is a non-composite (in this case, shared) part.
We can create parts, and, if we wish, the blocks that type them, on the IBD.
41
Two things will happen: in the browser, you will see the new InternalCombustionEngine
block appear, and on the diagram a new part typed by this block is created, with the
input box selected for you to enter a part name to replace the default BlockProperty1.
6. Enter the name ice for the part, as shown opposite.
7. Using the previous three activities as a guide, create
three more parts (trsm, ecu, ft) within the PowerSubsystem block as shown below.
42
At this more detailed level of modeling, the connections between these parts will go via
ports. We will illustrate the creation and use of both standard ports and flow ports
(including atomic and conjugated flow ports), as described in the SysML specification.
We will start with standard ports. We will create standard ports on both the ice and ecu
parts that specify the provided and required services for these parts. Consequently we
will use an option in Artisan Studio that allows a standard port to be untyped, the typing
being done by the provided and required interfaces defined on these ports.
8. Select the Standard Port toolbar icon
9. When the Type Selector dialog appears, click the NoType option and confirm that you
want an untyped item.
This will add a standard port to the ice part, using the
default name Port1. You can change this to
something more meaningful through the properties
of the port (the General tab), but its quicker and
easier to name it in-situ using the Explorer pane.
10. Click the already selected port (or use the context
menu rename option) and enter the name ctlPrt to
replace the default name shown opposite.
Move the port around the edge of the ice part, and then
move its name to the position shown opposite (for straight
line connection to the ecu part).
11. Use the last four activities to add a standard port to the
ecu part. Name it icePrt, and position it for straight line connection to the ctlPrt.
Now for the interfaces. An interface is one of the UML concepts inherited by SysML. An
interface is defined by a class that specifies a set of operations that the interface
provides.
12. Select the Provided Interface toolbar icon
, click the ctlPrt on the ice part, move
the mouse pointer to the left (see the
following image) of the port and then
double-click.
13. In-situ, change the default name (Interface1)
to I_ICECmds, as opposite.
43
This also adds the required interface symbol to the diagram and adds the I_ICEData
interface to the HSUVStructure package.
The procedure for adding a provided or required interface to a diagram where the
interface already exists in the model is very similar except that the double-click is with
the right mouse button not the left mouse button. This opens the Type Selector dialog
from which you can select the required interface.
16. You should now use these same two
toolbar icons to create provided and
required interfaces on the ecu parts icePrt.
However, note that for this port the
interface selections are reversed: I_ICEData
defines the provided interface, I_ICECmds
defines the required interface (see
opposite).Remember to double-right-click
to open the Type Selector.
By default, when you create interfaces using the diagram toolbar, the interfaces are
scoped to the package scoping the diagram. We will create a sub-package within
HSUVStructure to hold these interfaces.
17. Right-click on the HSUVStructure package in the Package browser, select New
Package, and name the new package HSUVInterfaces.
18. In the browser pane select each interface in turn, drag it and drop it on the
HSUVInterfaces package name to rescope it. (Note that you could use the Contents
pane to multi-select both interfaces and do the drag-drop in one operation.)
The final step here is to add a connector between these two ports.
19. Select the Connector toolbar icon
(although the order is not important).
We will take a look now at flow ports, and we will start with atomic flow ports.
20. Select the Flow Port toolbar icon
44
This opens the Type Selector dialog. Flow ports may be typed or untyped. We will create
a Value Type (Torque) to type the atomic flow ports that will be used to connect the ice
part to the trsm part. We will then show how you can set the unit and dimension
properties for a Value Type. We could have created the Torque Value Type, including
any necessary units and dimensions, before attempting to use it when creating the flow
port (as with the icePrt interfaces).
21. Select the Create a New Type
option, and enter the name
Torque.
22. Select Value Type from the dropdown Types list and click the OK
button.
23. When the Value Selector dialog
appears (see below), select the
out option (the engine delivers
torque to the transmission), and
click the OK button.
The flow port is now created on the ice part on the diagram, and
the browser shows the flow port as a new property of the
InternalCombustionEngine block that types the ice part. The
browser view has this new port selected, ready for you to replace
the default name.
24. Enter the name trsmPrt (you can rename block properties in the browser view at any
time, using the context menu Rename option).
45
25. Select the Flow Port toolbar icon again, and click on the trsm part. This time, in the
Type Selector dialog you choose Select an Existing Type, select Value Type from the
Types drop-down list and then select Torque from the list of All Value Types before
clicking the OK button.
26. From the Value Selector dialog select the in option, click OK and name the new port
icePrt.
Before we connect these two flow ports and define what flows between them, we will
just finish with the Torque value type weve created. Currently Torque is scoped by, and
visible within, the HSUVStructure package. In practice, it may be sensible to create a
separate package to hold types created specifically for the automotive domain. This
could then be exported (see package import/export in the Help) and reused in other
automotive projects. Because we will only need a couple of specific types we wont
bother to do this now. But we should set the unit and dimension properties for this
value type.
To do this we make use of the generic set mechanism provided by the SysML profile.
There is a Set context menu option for a number of model items where properties can
be set we will see some other examples later.
27. Right-click Torque in the browser and select Set Dimension Property., as shown
below.
The Type Selector dialog opens, with the Types drop-down set automatically to
dimension, and the Select an Existing Type option selected. Because the Artisan SysML
Profile has a built-in library of SI units and dimensions, we can use this.
28. Expand the All dimensions folder in the
Type Selector, then scroll down and
select Force, then press OK.
29. Now right-click Torque again; this time
select Set Unit Property.
30. Use the Type Selector to create a new
unit called ft-lbf (as shown opposite).
46
To finalize this connection we will create an item flow for the connector.
33. Select the Item Flow toolbar icon
For a connector between atomic flow ports, the type of the item flow must match the
type of the ports.
34. Use the Type Selector dialog to select Value Type from the drop-down list and then, by
expanding the All Value Types folder, select Torque.
35. When the pop-up (opposite) appears on the
diagram, select the target port (as shown).
36. Name the item flow g1 (as in the original HSUV
model).
47
create a flow specification as we create the first flow port (like we did with the Torque
Value Type), but its probably more sensible to create it before we need to use it.
First, we will create a package to hold this and any other flow specifications.
37. Right-click the HSUVStructure package and select New Package. Name it
HSUVFlowSpecs.
38. Now right-click on the HSUVFlowSpecs package and select New SysML Ports and
Flows Flow Specification. Name it FuelFlow.
We now need to define the set of flow properties for FuelFlow. Each flow property
specifies a type and direction for one or more flow items that can flow in or out of a port
typed by FuelFlow.
39. Right-click FuelFlow and select New SysML Flow Property (as below).
48
45. Now use the Set Direction option to confirm the direction for fuelReturn is 'in'.
Note that Artisan Studio automatically creates a non-atomic bi-directional flow port,
, because the port type is a flow specification.
49. Position ftPrt along the bottom boundary of the ice part.
50. Now create another non-atomic flow port, also typed by FuelFlow, on the ft part.
51. Name this port icePrt, and position it along the right boundary of the ft part.
52. Now right-click icePrt (either on the
diagram or in the browser) and select
Set IsConjugated (as opposite).
53. In the Value Selector dialogue, select
TRUE.
The name of the block typing the port is now prefixed with a
tilde (~) on the diagram to indicate a conjugated flow port,
using the same flow specification as ftPrt, but where the flow
property directions are reversed (that is, what is sent by ftPrt
is received by icePrt, and vice-versa).
Finally we will make the connection between these ports and add the specific item
flows.
54. Select the Connector toolbar icon
, and make a connection between the two flow
ports (remember you can drag the connector line after creating it, to create a
waypoint).
55. Now select the Item Flow toolbar icon
56. From the Type Selector dialog, select the Fuel block as the type for the item flow (you
may find it easier to locate Fuel through the Package Hierarchy folder, as shown
below).
49
The final diagram should look something like that below. Note we have added a simple
connector to the bkp (BrakePedal) part.
50
The constraint block is added to the diagram, with a constraints compartment showing
an empty constraint between { } symbols. In the Packages browser, within the
HSUVStructure package, you will see the FlowConstraint constraint block.
We now need to define the three formula variables as parameters (n will be fixed at 4
for us as there are 4 injectors). This can be done using the diagram toolbar, or, in the
51
(New
SysML
5. Use the Type Selector dialog to select the Value Type Real as the type for this
parameter.
6. Name (in situ, in the browser) this first parameter: flowrate.
We will now use these parameters to specify the constraint for FlowConstraint.
If you expand FlowConstraint in the browser, below the three
parameters you will see an item called Constraint1, as shown
opposite. It is through Constraint1 that we specify the
constraint.
This is a bit of SysML inherited from UML, the SysML constraint block acting as a
wrapper for the UML constraint, the constraint (or constraints there can be more
than one) being a property of the constraint block.
The constraint itself has a set of properties and it is through these that we specify the
formula.
8. Select
the
constraint
(Constraint1, not the constraint
block) in the browser, open its
properties and select the Full
Text tab.
9. Enter the formula (as opposite)
by dragging the parameter
names from the browser and
typing the other characters.
Click on the diagram and you will see that the formula has been entered into the
Constraints compartment of the constraint block.
Finally, for this diagram, we should model the relationship FlowConstraint has with the
PowerSubsystem block. We will use a composition relationship, to indicate that a
specific usage (instance) of the constraint block is owned by PowerSubsystem.
52
You have used this relationship before and should therefore be familiar with the use of
the composition properties to set the role name and multiplicity values (see activities 7
to 9 in the Block Definition Diagram (BDD) section above).
11. Set the role name to fc, and the multiplicity values to tbd.
c
block
ChassisSubsystem
bk
block
BrakeSubsystem
block
PowerSubsystem
fc
bkp
block
BrakePedal
bkp
constraint
FlowConstraint
constraints
{flowrate=pressure/(4*demand)}
parameters
demand : Real
flowrate : Real
pressure : Real
We can now move on to create a parametric diagram that will show how the
parameters for FlowConstraint relate to specific value properties of the
PowerSubsystem component.
However, before we can do this we should elaborate the internal structure of
PowerSubsystem a little more, to create the components directly involved in fuel flow.
12. Close the HSUVStructure BDD and open the PowerSubsystem IBD (either from
Packages browser by expanding the PowerSubsystem block, or from the Blocks
browser IBD folder).
53
Each of these new parts needs to have a value property that will relate to each of the
constraint block parameters. Parts have value properties as defined by the blocks that
type those parts. This means that we have to create the value properties through the
block that types each part rather than through the part itself.
19. Right-click on the FuelPump block in the browser and select New SysML Block
Property (Value), as below.
20. Use the Type Selector to define the type for the value
property as the Value Type Real (for compatibility with
the parameter). Name the value property flowRate
(upper case R to distinguish it from the parameter
name).
21. Use the last two activities to create value properties for
the FuelInjector and FuelRegulator blocks, both of
Value Type Real, names are fuelDemand (for the
injector) and fuelPressure (for the regulator).
22. Select the Parts pane, locate the PowerSubsystem
block and expand it as opposite.
54
Although we have created these value properties for the blocks, parts typed by those
blocks will have these same properties. You can clearly see them in the Parts browser.
Note that fc : FlowConstraint, with its three parameters, is also visible as a part of
PowerSubsystem (a 'constraint property' in SysML).
It is an important requirement of SysML that all elements that appear on a parametric
diagram are scoped, at some level, by the parent block of that diagram. Using the Parts
browser allows us to drill down into all the levels of nested parts for a block to confirm
that we have all the required elements.
Now that we have done all the hard work, creating the parametric diagram is pretty
straightforward .
23. Right-click the PowerSubsystem block in the Parts browser and select New SysML
Parametric Diagram (you can leave the default name for now).
The diagram will open but its name does not appear scoped to the PowerSubsystem.
This is because we are using the Parts browser and the diagram is not a part of the
block. It is scoped to the block though, and this is clearly visible in the Packages pane.
However, we want to stay with the Parts browser pane for now, so to change the
diagram name we do so on the diagram, rather than in the browser.
24. Select the diagram frame and then click into the frame header. This will allow you to
change the default diagram name to [block] PowerSubsystem [Fuel Flow].
25. Now ensure the Parts browser pane is selected and the PowerSubsystem block is
expanded as shown in the preceding image.
26. Then drag the fc : FlowConstraint from the Parts browser pane to the centre of the
diagram.
27. Right-click on fc : FlowConstraint on the diagram and select Populate Constraint
Parameters (as below).
55
flowrate : Real
pressure : Real
fc : FlowConstraint
constraints
{flowrate=pressure/(4*demand)}
The final diagram should look similar to that below. Note the names on the value
properties, showing their scoping. The key point to be aware of here is that we have
been able to drag these items to the diagram because they are all parts within the
PowerSubsystem block that owns the diagram.
par [block] PowerSubsystem [Fuel Flow]
PowerSubsystem.ice.fi.fuelDemand : Real
demand : Real
flowrate : Real
pressure : Real
fc : FlowConstraint
constraints
{flowrate=pressure/(4*demand)}
PowerSubsystem.ft.fp.flowRate : Real
PowerSubsystem.ice.fr.fuelPressure : Real
56
57
As you can see from the above image, you can also create two of the items that can
appear on use case diagrams (actors and use cases) directly in the package for dragging
on to the diagram, or (as we will do) you can use the diagram toolbar to create these
items. Increments are an Artisan Studio-specific item, that allow you to relate particular
use cases to increments for an incremental development approach.
The first thing youll probably notice about the diagram, is that there is no diagram
frame. Use case modeling in SysML is inherited from UML, where diagram frames are
optional. If you want to add a SysML diagram frame, its quite simple. Heres how you do
it.
4. Select the Frame Box toolbar icon
The result is that the frame gets a name box in the top left
corner as shown opposite. The name that appears after
the uc identifier (from the Page reference property) is
simply the name of the diagram. You can easily change the name in the browser if you
wish and the diagram frame name will automatically change as well.
Now lets add the diagram content, inside this frame.
9. Select the Actor toolbar icon
10. Use the Use Case toolbar icon
diagram.
11. Add five more use cases to the diagram, name them Start Vehicle, Cold Start, Warm
Start, Accelerate and Brake.
58
The HSUV example has other use cases, but these will be sufficient for our purposes,
one of which is to create use case relationships. Before we consider these, we will add
another frame box to the diagram. It is conventional on a use case diagram to enclose
the use cases in a frame box, with the actor(s) outside the frame box, to separate what
is happening inside our system (the execution of the use cases) from external actor(s).
12. Use the Frame Box toolbar icon again to create a frame box enclosing the use cases
only (you may have to move diagram items around to do this see the final diagram
that follows shortly).
13. Now, with the HSUVStructure package expanded in the Packages browser, drag the
HybridSUV block from the browser and drop it on the frame box boundary (like you did
when creating the diagram frame).
The result is to label the frame box with the block name, but also to apply the style
properties of a block item to the frame to make it look like a block and hide the use
cases. This is easily corrected.
14. Right-click the name compartment of
this frame and select View Options.
15. On the Style tab select the Default
option (as opposite) and then click
the OK button.
16. Select the Interaction toolbar icon
, click on the Driver actor, then on
the Drive the Vehicle use case.
59
So driving includes both accelerating and braking, but what about the Start Vehicle?
Sometimes the vehicle is driven off with it already started (every time we stop but leave
the engine running); only occasionally do we have to start the vehicle before driving off.
We need the extend relationship.
19. Select the Extend Flow toolbar icon
, and click first on Start Vehicle
and then on Drive the Vehicle.
(Again the order is important, if you
get it wrong (see opposite), you cannot use the Delete context menu option or the
Delete key this removes the relationship from the diagram, but leaves it in the model.
You must Undo or Delete from Model).
Finally we will look at the cold and warm start use cases.
Both are ways of staring the vehicle, but starting from cold is not the same as starting
when already warm (for example, cold starting requires a richer air-fuel mixture). The
generalization relationship is appropriate here.
20. Select the Generalization toolbar
icon
, first click on Cold Start,
then on Start Vehicle (yet again,
order is important if you get the
direction wrong use Undo or Delete
from Model).
21. Use the Generalization toolbar icon again to create this relationship going
from Warm Start to Start Vehicle. When the pop-up (opposite) appears,
select 1 (as shown), to indicate that this the same type of generalization
as the first one you created to Start Vehicle, rather than a completely new
type.
We now need to consider how SysML can model more detailed levels of behavior.
60
61
3. Now right-click the Accelerate activity and select New Activity Diagram (as below).
Opaque actions are often used in SysML modeling where precise (and lengthy!)
execution semantics are not required. Artisan Studio provides a comprehensive set of
specific action types, many of which are largely relevant only to UML modelers needing
to create executable activity models relating to OO programming languages. You can
see many of this set of action types by opening the drop-down list toolbar button
.
Other action types have their own toolbar buttons; these actions are often used in
SysML modeling, although we will only make use of one of these (CallBehaviorAction).
Opaque actions themselves show their UML code oriented origination in that they have
a Body and a Language property which can be used to define the semantics for the
opaque action. For SysML modeling these properties are typically left empty, the action
name and its pins (see later) are sufficient to adequately define its semantics.
Our PushAccelerator action produces output (the accelerator position) which will be
used by another action, as we will see shortly. We model inputs to and outputs from
actions as pins. A pin is a type of object node (there are other types - Central Buffer and
Data Store also visible on the diagram toolbar).
5. Select the Output Parameter/Pin toolbar icon
and click on the right-hand boundary
of PushAccelerator on the diagram. Name it accelPosition.
62
Opaque actions are atomic actions, they do not need further decomposition. Actions
that are complex enough to require further decomposition can be modeled as
CallBehaviorActions, actions that invoke the behavior of another activity. That activity
can itself own an activity diagram that defines the more complex behavior, and which
may contain other CallBehaviorActions. CallBehaviorActions are one of main ways of
handling behavioral decomposition in SysML.
There are two ways to create a CallBehaviorAction; one is to create the activity first and
then drag it on to the diagram, the other is to use the diagram toolbar. We will show
both, starting with the use of the toolbar.
6. Select the Call Behavior Action toolbar icon
This opens the Select Object dialog to allow you to select an activity that will be invoked
through the CallBehaviorAction. This may be an existing activity or you can create a new
one.
7. On the Select Object dialog,
MeasureVehicleConditions.
click
on
the
New
button,
and
name
it
Now you see both parts of the name (below). When you
create a CallBehaviorAction, Artisan Studio uses the name
of the activity as the name of the action. In general you are not so interested in the
action name as the activity name hence the default view option. Either name (action
or activity) can be changed
independently of the other.
10. Open the properties for the CallBehaviorAction and select the General tab.
11. Use this property page to change the name of the
CallBehaviorAction to CBA1.
63
64
As you can see in the browser pane this has created two model items:
Both items have identical properties, including their name, direction and type (had we
defined one). Unlike the CallBehaviorAction and its linked activity, these common
properties are linked; changing the name for the pin will result in the parameter name
also changing. You might want to explore and possibly change the properties of these
items. If you do make sure you set them back to their current settings before continuing.
Now lets see the alternative way to create a CallBehaviorAction. This time we will
create the activity and its parameters first and then drag it to the diagram.
15. Right-click the HSUVActivities package in the browser, select New Activity Model
Activity and name the activity ProvidePower.
16. Now right-click the ProvidePower activity, select New Parameter and name it
accelPosition.
17. Repeat the above to create three further parameters called
vehCond, drivePower and transModeCmd (as opposite).
18. Use the Options property page for both drivePower and
transModeCmd to set their direction (Mechanism) to Out (as
below).
19. Now
drag
the
ProvidePower activity to the
diagram.
This
creates
a
CallBehaviorAction, on the
diagram and - scoped to the
Acceleration activity - in the
browser. Note again that the
CallBehaviorAction has the
same name as its linked
activity.
65
We now need to consider flow, both flow of control and flow of data. The concept of
flow, is central to UML/SysML activity modeling. Conceptually, what flows are tokens;
control tokens to represent transfer of control, object tokens to represent the
availability of objects or data. It is not the objective of this section of the tutorial to
provide a detailed explanation of activity modeling concepts and elements for that you
should refer to a SysML or UML text but we do need to show how certain key concepts
and elements have been implemented in Artisan Studio.
66
Control flow is concerned with defining execution order for the actions. It is often the
case when refining an activity into its composite actions that there is a definite
sequence, with various control nodes being used to specify starting, stopping,
branching, merging, etc.. The Accelerate activity is interesting because its three actions
are not executed sequentially, but in parallel and continuously. The power provided is
continuously adjusted according to the accelerator position and the vehicle conditions.
Lets see how we model that.
21. Select the Fork Node toolbar icon
actions.
This creates a control node that allows you to model situations where a single incoming
flow is split into multiple outgoing parallel flows. The Fork can be lengthened to cover
the three actions as in the following diagram.
22. Select the Join Node toolbar icon
This creates another control node (looking very similar to the fork node) which allows
multiple incoming parallel flows to be joined into a single outgoing flow.
23. Use the Initial Node toolbar icon
67
We use control flows to show flow of control through actions and control nodes on an
activity diagram. In SysML, as opposed to UML, control flows can be modeled using
either dashed line or solid arrowed lines. Artisan Studio uses dashed lines as the default,
although this can be changed through View Options. Control flows have a name but by
default these names are not shown on the diagram. They can also have a guard
condition defined (through their properties); guard conditions, where they exist, are
shown by default. You can use View Options for the diagram to preset display options,
or View Options for individual items to change default settings.
Control flows are directional, as implied by the arrow. It is therefore important when
adding flows to click first on the sender and then on the receiver. You will find that
Artisan Studio has a number of built in checks that stop you creating illegal control flows
(for example, multiple incoming flows to a fork node). It is generally safer to use Delete
from Model (from the context menu) rather than the Delete key to remove incorrect
flows.
25. Use the Control Flow tool bar icon
68
Note that control flow lines can be moved or have waypoints inserted in situ (left click)
or afterwards (select and drag). Note also that in the above image we have used View
Options to hide the action name for the MeasureVehicleConditions CallBehaviorAction.
Now we will add the object flows to show data flow in our model.
Object flows in SysML must have a solid line. They have similar name and guard
properties as control flows, but in addition have a more complex set of properties as
seen through the Options tab in Artisan Studio. It is beyond the scope of the tutorial to
address the meaning of these additional properties; the Artisan Studio Help system has
some information about them, but for a detailed understanding you should read the
UML specification or an appropriate UML/SysML text.
As with control flows Artisan Studio imposes UML/SysML defined restrictions on where
and how these can be used. Object flows are only permitted between object nodes
(such as pins) or certain control nodes (such as forks and joins). Object flows are also
directional, so similar rules apply regarding defining and changing direction you will
find, for example, that Artisan Studio will not allow you to create an object flow going to
an output pin.
26. Use the Object Flow toolbar icon
to add object flows between the two
accelPosition pins and the two vehCond pins.
This leaves us with the two output pins of ProvidePower having no outgoing object
flows. These two pins produce outputs that are available as parameters of the parent
activity of the diagram, Accelerate. If the Accelerate activity already had a set of
parameters, you could simply drag the required parameters to the diagram frame
boundary to create the boundary pins to act as destinations for the object flows.
However, Accelerate currently has no parameters so it is easier to create both the pins
and the parameters at the same time using the Output Parameter/Pin toolbar icon.
27. Select the Output Parameter/Pin toolbar icon
hand boundary of the diagram frame.
69
29. Add the other Parameter/Pin to the diagram frame and the Accelerate activity, naming
it transModeCmd (see the following diagram on page 71).
30. Create object flows going from the two output pins on ProvidePower to the pins on the
diagram frame.
The final issue to address for this diagram is to indicate that the model of object flow we
have created is continuous. SysML (and the Artisan SysML Profile) provides a
continuous stereotype which can be applied to flows (activity edges to give them
their formal name) and parameters. Whether you show continuous against a flow or a
parameter pin is to some extent dictated by the actual model, but also by personal
preference. We will include an example of both.
Artisan Studio provides a quick and easy mechanism for allowing you to see all
stereotypes that can be applied to a model item and then selecting one to be applied.
You can use this mechanism from a diagram or from a browser pane.
31. Right-click on the object flow between the two accelPosition pins and select Applied
Stereotypes 1 continuous (as below).
70
The stereotype now appears and can be moved anywhere along the object flow.
34. Use the same approach to apply and show continuous on the object flow between
the two vehCond pins.
Rather than apply continuous to the drivePower object flow, this time we will apply it
to the drivePower parameter of the Accelerate activity and show it on the associated
diagram frame pin. Remember the parameter and the pin are separate but linked model
items. SysML states that continuous can be applied to a parameter, but it cannot be
applied to a pin. However, Artisan Studio recognizes that most modelers would want to
see a stereotype that has been applied to a model item on a diagram element linked to
the stereotyped model item. If we apply a stereotype to a parameter, we want to be
able to see the stereotype on the linked pin. (The same is true for other similar
situations; for example, you want to be able to see a stereotype applied to an activity on
a CallBehaviorAction linked to that activity.)
35. In the browser, right-click the drivePower parameter of the Accelerate activity and
select Applied Stereotypes 1 continuous.
36. Now right-click on the drivePower pin on the diagram frame (not the one on the
ProvidePower CallBehaviorAction) and use View Options to show the stereotype.
71
To finish this section on activity modeling we will develop the concept of activity
decomposition a little more and introduce a few more activity modeling items.
37. In the browser, right-click the ProvidePower activity (in the HSUVActivities package),
and select New Activity Diagram.
This will create a child activity diagram for ProvidePower (as you would expect) for you
to define the detail of that activity. Note how the four parameters of ProvidePower have
resulted in the automatic addition of four linked pins on the diagram frame.
We will not evolve this diagram in any great detail, just sufficient to illustrate the
additional elements.
The first of these additional elements is an activity partition (often called a swimlane).
38. Select the Activity Partition toolbar icon
frame. Name it pcu.
The result is to display them vertically but also to hide their names. You can, of course,
still see their names in the browser, scoped to the parent ProvidePower activity. The
reason we set the View Options the way we did was because we are about to link each
activity partition with another model item and it is the linked item name and type that
we want to see.
The items we are going to link with are parts of
the PowerSubsystem block that was created in a
previous section of the tutorial. You can see the
two parts we want highlighted opposite; the
icepart, typed by the InternalCombustionEngine
block, and the ecu part, typed by the
PowerControlUnit block.
72
The rationale behind this linking will become clearer with the next section of the
tutorial, but is basically to do with linking behavior to structure in this case linking the
ProvidePower activity to the PowerSubsystem block.
43. Expand the HSUVStructure package to expose the PowerSubsystem block, then
expand that block as above.
44. Use the property pages to identify the eng activity partition.
45. Drag the ice part from the browser and drop it in the name compartment of the eng
activity partition. Then widen the activity partition so that the name and type appear on
a single line.
46. Now drag the ecu part to the name compartment of the other activity partition and
widen that partition also.
The reason we have linked the activity partitions to parts of the PowerSubsystem is to
indicate a structural location for any action nodes or object nodes placed in those
activity partitions. As we add items to this diagram we will need to enlarge the activity
partitions. To make this easier we can join individual activity partitions to form a single
group that can be re-sized as a unit (rather than having to re-size each activity partition
separately).
47. Arrange both activity partitions with the ice partition to the right of the ecu partition, as
opposite.
73
If you move the activity partition group, you will see that the CallBehaviorAction also
moves within its activity partition. Further confirmation that the activity partition
provides a conceptual location for the CallBehaviorAction can be seen through their
properties, as indicated below (pcu is the activity partition name).
Note how the two parameters result in two input pins being created on the
CallBehaviorAction (although you will need to separate them). To finish our work on this
diagram, we will see how these pins get their data.
52. Move the diagram frame a little to the right.
53. Drag
the
vehCond
parameter around the
boundary
of
the
diagram frame to the left
hand
edge
(see
opposite).
54. Select
the
Decision
74
We would normally complete the detail of the ProvidePower activity before addressing
the next layer in the activity decomposition, that is, creating activity diagrams for
ProportionPower and any other linked activities for CallBehaviorActions created for
ProvidePower.
2.2.6 Allocation
Before we move on to consider the remaining two behavioral diagrams (sequence and
state diagrams), we should briefly consider the topic of allocation. Allocation, in SysML,
is a general term for cross-associating items from different parts or levels of a model. It
normally involves the creation of the allocate relationship and its visibility on diagrams
and in tables. We will illustrate the use of this relationship in the common context of
allocating behavior to structure.
In the previous section we showed an example of creating a CallBehaviorAction in an
activity partition (the ecu swimlane) on the basis that the parent activity for that
diagram (ProvidePower) was in some way linked to the PowerSubsystem block that
contained the ecu part. We can now make this link more concrete using allocation.
1. In the Packages browser expand the HSUVStructure package (if necessary) to expose
the PowerSubsystem block.
2. Expand the HSUVActivities package (as below) to expose the activities created earlier,
including ProvidePower.
3. Right-click on ProvidePower and
select Start Link, as shown opposite.
4. Now
right-click
on
the
PowerSubsystem
block
in
the
HSUVStructure package and select
End Link (as below).
75
We can also show these allocation relationships on certain diagrams where the related
items appear.
7. Open the ProvidePower activity diagram (you may still have this open from the
previous section).
8. Right-click the ProvidePower diagram frame (easiest to right-click in the frame name)
and select Add Note Allocated (as below).
You can also use the Add Note context menu option here. However, theres an
alternative way to display the relationship for a block.
10. Right-click on the PowerSubsystem block and select Toggle Compartments
Allocated From (as below).
76
This results in the PowerSubsystem block displaying a new compartment showing any
allocatedFrom items (as below).
block
PowerSubsystem
allocatedFrom
ProvidePower (in accelPosition, in vehCond, out drivePower, out transModeCmd)
Note that you get the full signature of the activity (name and parameters). However,
unlike the Add Note, theres no indication of which type of model item this is.
The Toggle Compartments context menu option is a powerful feature of Artisans SysML
profile and you will find it as a option for many items on many diagram types as a way of
displaying model relationships, not just allocations.
The use of Start/End Link makes allocation both simple and quick; almost any types of
model item can be linked, not just activities and blocks. It is also very flexible as you can
right-click items on diagrams or in the browser. We have also seen the use of both
compartment and callout notation for displaying allocations; we will see more of these
later.
To finish we will see how allocations can be summarized in matrix and table form. To
make this a little more realistic we will create another allocation relationship. This will
also be allocating an activity (ProportionPower) to a block (PowerControlUnit). This is
not just arbitrary the ProvidePower activity diagram (page 74) shows a
CallBehaviorAction invoking this activity located in an activity partition linked to a part
typed by this block. If this activity was invoked on this diagram only, it might be sensible
to allocate it to the block typing the part.
77
11. Right-click the ProprtionPower activity in the HSUVActivities package and select Start
Link.
12. Then right-click the PowerControlUnit block in the HSUVStructure package and select
End Link.
13. Select the allocated to relationship in the Quick Link dialog and click the ok button.
Note that you cannot create the allocation on the ProvidePower activity diagram. You
are not trying to allocate the CallBehaviorAction to the activity partition.
So now we have two allocations in the HSUV model. Allocation matrices and tables are
created scoped to a package and detail any allocations relating to items within the scope
of that package and its sub-packages. The package can be a high-level package (for
example, HSUVModel) if you want to summarize all allocations in the model, or a subpackage if you only want to summarize a subset of those allocations.
14. In the Packages browser, right-click the HSUVActivities package and select New
SysML Allocations Allocation Matrix.
15. Change the default name to [Package] HSUVActivities [Allocation Matrix].
After a few seconds the matrix opens in Microsoft Excel. It will show any items within
the HSUVActivities package that are involved in allocations, along with the allocated
items in a matrix format.
17. Close Excel and choose not to save (there is no point in saving, each time you open
the matrix Artisan Studio regenerates the content).
18. Now right-click the HSUVStructure package in the Packages browser and select New
SysML Allocations Allocation Table.
The table name (use the default) appears scoped to the HSUVStructure package and is
opened as the matrix by double-clicking the name. This also uses Excel, but this time it
presents allocation information for the selected package in a tabular format. The
information in the table is similar to that in the matrix, it really depends upon what
format you want.
Finally, lets look at how we can see allocations in a browser pane in Artisan Studio.
One of the additional browser panes added by the SysML Profile is the Allocations pane.
78
19. Select this pane and expand its contained elements as below.
This shows all allocations, allocation matrices and tables in the model as flat lists. Any
unwanted entries can be easily removed by right-clicking one of the allocate entries and
selecting Delete. Allocations can also be removed from the model by invoking the Links
dialog from the context menu one of the linked items. The use of the Links dialog is very
intuitive, but further details can be found in the Help.
2.2.7 Interactions
Interactions describe messaging between items; in a SysML model these items are
normally structural items such as block parts or ports. In UML, four diagram types exist
to support interaction modeling; in SysML only one of these is used: the sequence
diagram.
The sequence diagram provides a different approach to the activity diagram as a way of
modeling behavior. The key difference is that with sequence diagrams the focus is on
the sequence of message passing between elements of the system whereas with activity
diagrams the focus is on flow of control and information between actions. Sequence
diagrams implicitly relate structure to behavior; the lifelines, defining the senders and
receivers of the messages, being used typically to represent blocks, their parts or ports,
or even actors; each message represents a request to invoke behavior in the receiver.
Rather than trying to show all possible paths of behavior, sequence diagrams are
79
80
81
You can also create a sequence diagram scoped to a package rather than a use case by
right-clicking the package and selecting New Diagram Sequence Diagram.
Other permissible parent items for a sequence diagram include Events and Operations.
When the diagram is created from a use case, the use case name is added to the top
left. No diagram frame is created on a sequence diagram. Just like the earlier use case
diagram, this is an inherited UML diagram, and UML diagrams do not have frames by
default. If you wish you can add a frame in the same way as you did for the use case
diagram (activities 4 - 8 on page 58).
The two vertical lines visible on the diagram are the System Boundary the thick gray
line that separates external actors from elements within the system, and the
Architectural Boundary - the dashed line that can be used for whatever purpose you
wish, and is often just ignored (but cannot be deleted).
Because the sequence diagram is a UML diagram it has a rich set of toolbar icons, many
of which can be ignored for SysML modeling. If you are interested in what they all do,
you can look in the Help system or at the section on sequence diagrams in Part 2 of the
Artisan Studio Tutorial.
The Description box labels the area of the diagram where you build up the description
steps for the message sequence. In Artisan Studio each message must have a
corresponding description step, and the step must be created before the message can
be added. You can do this one message at a time or, as we will do, define all description
steps before adding messages.
4. Select the Sequence toolbar icon
Description box.
We will use this step to invoke the Start Vehicle use case. However, if you look at the
use case diagram, you will see that Start Vehicle is an extension of Drive the Vehicle. We
need to define the condition under which Start Vehicle is invoked.
6. Select the Selection toolbar icon
startup step.
82
83
included and extended use cases) where the message sequences are shown. To create
the references we need to have the lower level diagrams to make the references to.
11. Switch to the use case diagram and right-click the Start Vehicle use case to create a
child sequence diagram as in step 0. Immediately close the sequence diagram when it
opens (we wont need it yet).
12. Do the same for the Accelerate and Brake use cases.
13. Now return to the Drive the Vehicle sequence diagram and select the Interaction Frame
toolbar icon
The interaction frame changes, with the label showing the keyword ref - to indicate that
the frame is now a reference to another diagram, and the name of the referenced
diagram (Start Vehicle) in the body of the frame (see following illustration).
84
The frame (its formal name in UML/SysML is an interaction use) can be re-sized and
moved horizontally but not vertically (its tied to the startup description step). It can also
be used to access the referenced diagram.
17. Right-click the interaction frame
and select Referenced Diagram
Open
(as
opposite).
Alternatively, double click on
the interaction frame.
Note that you can also change the linked diagram or break the link through this context
menu.
18. Return to the Drive the Vehicle sequence diagram, and use the Interaction Frame
toolbar icon to create another frame, with an empty label, against the brake description
step.
19. Expand the Brake use case in the browser and drag its child sequence diagram on to
the interaction frame, just as you did with Start Vehicle.
20. Repeat the last two activities to create an appropriate frame for the accelerate step
ref
Start Vehicle
end if
implementation of the operation. Both the operation and its implementing activity must
be scoped to the block and they must have identical signatures (number, type and
direction of parameters). Given that we now have a child sequence diagram for the
Accelerate use case, we will change the role of the Accelerate activity and its child
diagram to that of defining the implementation for an associated operation for the
HybridSUV block. The need for block operations can often be identified by analyzing
internal block diagrams (IBDs) containing parts or ports typed by that block. Although
our simple model has no such IBD, the original HSUV model does and it shows the
HybridSUV typed part with a connector to the Driver actor. It would not be
unreasonable therefore to assume that the HybridSUV block would need to provide an
Accelerate behavior as a response to driver input.
21. Expand the HSUVStructure package to expose the HybridSUV block.
22. Right-click the HybridSUV block and select New UML Operation. Name the
operation AccelerateOp.
The acceleration behavior provides both drive power and transmission mode commands
as output (as defined by the Accelerate activity). Therefore the operation requires
similar parameters.
23. Right-click the AccelerateOp operation and select New Parameter. Name it dP.
24. Create another parameter for the AccelerateOp operation called tMC.
We have now created an operation which has the same number and type (that is, no
type) of parameters as the Accelerate activity. However, they are not of the same
direction.
25. Select the AccelerateOp operation, open its properties and select the Sigture tab.
26. Replace the in with out (a simple text replacement) for both parameters (as below).
This is a quicker way of changing the direction (called Mechanism in Artisan Studio)
property of each parameter than using each parameters property sheets.
86
27. Now expand the Accelerate use case in the browser and drag the Accelerate activity
from the use case to drop it on the HybridSUV block.
28. Rename the activity AccelerateAct (this is purely to make it easier to distinguish from
the operation).
In doing this, we are redefining the purpose of the activity from that of defining classifier
behavior for the Accelerate use case to that of defining some behavior detail for the
HybridSUV block. If we now want to create the specification/implementation
relationship between operation and activity in the model, we do so through the
properties of the operation.
29. Open the properties for the AccelerateOp operation again and select the Items tab.
30. Select Specified Activities from the Show associated drop-down list, and then click the
Link icon, highlighted below.
31. Ensure the Types drop-down shows Specified Activities and that the AccelerateOp
operation is visible in the left pane (as above). Then select the AccelerateAct activity in
the central pane to add it to the selected items in the right pane (as above), and click
the OK button.
87
The relationship is now visible through the Items properties of both the operation and
the activity (as below).
The key point to remember is that, although the names of the operation and activity do
not need to be the same, their signatures must match in terms of the number, order,
direction and type (but again, not names) of their parameters.
We now have an Accelerate use case with a child sequence diagram and the HybridSUV
block with an AccelerateOp operation that has an associated AccelerateAct activity as its
implementation.
We can now model how the AccelerateOp operation is used on the Accelerate sequence
diagram. However, before we do this we need to replicate the situation in the original
HSUV model where the HybridSUV block is used to type an HSUV vehicle as a part of the
automotive domain (see the IBD on page 13).
32. In the Packages browser, right-click the HSUVStructure package and select New
SysML Blocks Block. Name the new block AutomotiveDomain.
33. Now right-click on the AutomotiveDomain block and select New SysML Block
Property (Part).
34. Use the Type Selector dialog to select the HybridSUV block as the type for the part,
and name the part HSUV.
Acceleration is triggered by the driver depressing the accelerator pedal. The vehicle then
responds by invoking acceleration behavior.
35. Open the Accelerate sequence diagram, either from the browser (by double-clicking)
or from the Drive the Vehicle sequence diagram (Referenced Diagram context menu
option).
36. Use the Sequence toolbar icon to create two sequence steps: driver depresses pedal
and vehicle accelerates (see the following diagram).
37. Drag the Driver actor from the HSUVUseCases package in the browser and drop it on
the diagram, to the left of the system boundary, as shown in the following image (you
88
will not be able to drop it to the right of this boundary, but you can position it
anywhere to the left of this boundary, and in doing so, move the boundary).
Now we will add some messages. We will use an event message to represent the event
occurrence of the driver depressing the pedal.
41. Select the Event toolbar
icon
and click on
the Driver lifeline in line
with
the
driver
depresses pedal step.
42. Move the mouse pointer
to the right and click on the HSUV:HybridSUV lifeline.
43. In the Select Object dialog click the New button and name the event message depress
pedal.
An event message is created on the diagram and the depress pedal event is created in
the HSUVUseCases package (as this is the package that indirectly scopes the diagram).
Now we will add the AccelerateOp operation.
44. Expand the HybridSUV block in the HSUVStructure package to see the AccelerateOp
operation.
45. Drag the operation from the
browser and drop it on the
HSUV:HybridSUV lifeline in line
with the vehicle accelerates
step.
89
This creates an operation message going from the HSUV:HybridSUV lifeline back to that
lifeline.
Some modelers may have chosen to capture this differently, for example, by having just
a single step with the operation message going from Driver to HSUV. The approach we
have taken is not necessarily more correct but it does separate external events from
internal behavior and it has also allowed us to demonstrate more of the tool
functionality (a key objective for the tutorial).
In Artisan Studio we can indicate that an operation is an event handler through its
properties.
46. Open the properties for the
AccelerateOp
operation
and select the Items tab.
47. Select Events in the Show
associated drop-down list
and click the Link icon.
48. Use the Select Object
dialog to select the depress
pedal event and make the
link as shown opposite
The use of reference frames (InteractionUse) allows you to structure sequence diagrams
to any number of levels. We will now examine an alternative way to model behavioral
decomposition by considering the detail of the Start Vehicle sequence diagram.
Unlike the Accelerate use case, where the next level of decomposition below the
sequence diagram is described using the AccelerateAct activity diagram, we will model
the Start Vehicle use case at two levels: black box and white box. This will also allow us
to illustrate the other decomposition mechanism in Artisan Studios sequence diagram.
49. In the browser, rename the existing Start Vehicle sequence diagram to Start Vehicle
black box (either right-click and use Rename, or left-click twice (not a double-click) on
the name). Then open the diagram.
At this black box level we want to show the driver turning the ignition key and the HSUV
dealing with this event. This is just a single message going from Driver actor to HSUV.
50. Use the Sequence toolbar icon to create a description step driver starts vehicle.
51. Drag both the Driver actor and the HSUV part (of the AutomotiveDomain block) to the
diagram, and use View Option to hide full names (as before).
90
52. Click the New button on the resulting Select Object dialog, and name the new event
turn key.
It also creates a turn key event, scoped to the HSUVUseCases package (which indirectly
owns this diagram).
Events in Artisan Studio
have a rich property set
which you can see by
selecting either the event in
the browser or the message
on the diagram and opening
the property pages.
53. Open the property pages
for turn key and select
the Rate tab.
This, and the other tabs, allow you to capture potentially useful information about this
type of event in the model. The Help system has details if you want to know more.
Let us now consider the white box sequence diagram for the Start Vehicle use case. The
HybridSUV block that types the HSUV part itself has parts. The white box diagram is
going to show the detail of what happens inside a part typed by the HybridSUV block
the interactions between its parts - when the turn key message arrives. In practice,
were going to model only a little of what happens, enough to illustrate key concepts
91
and techniques. To start we need to create the white box diagram and allow it to be
referenced from the black box diagram.
54. Right-click on the Start Vehicle use case and select New Sequence Diagram to create
another 'Start Vehicle' child sequence diagram and rename it Start Vehicle white
box.
55. Immediately close the new diagram to return to the black box diagram.
56. Drag the white box diagram from the browser and drop it on the HSUV:HybridSUV item
on the black box diagram (see the following image).
A reference to the white box diagram now appears in the HybridSUV item name, as is
shown below. This is called a PartDecomposition, implying the referenced diagram will
show the internal interaction between the parts of HybridSUV.
57. Right-click on the HSUV:HybridSUV item and select Referenced Diagram Open, to
open the white box diagram.
On the white box diagram we will want to show the event message being detected by
the ignition subsystem and a message being sent on to the power subsystem to power
up the vehicle. The HybridSUV already has a power subsystem part (p), but it does not
have an ignition subsystem part. We could create this on either the BDD or IBD that
shows the high level breakdown of the HSUV, or we could create it in the browser and
then use a Populate option on the diagrams to add the extra part, if required.
58. Expand the HSUVStructure package in the browser, right-click the HybridSUV block
and select New SysML Block Property (Part), as below.
92
We now have what we need to model this level of functionality on the white box
diagram. This time we will create the sequence steps as we add the messages, but
remember the step must be added before the message can be.
60. Use the Sequence toolbar icon to add a description step detect key turn.
61. Drag the newly created ig part (of the HybridSUV) to the diagram, and use View
Options to hide its full name (we know its a part of the HybridSUV).
62. Now drag the turn key event from the browser (see below) and drop it on the system
boundary, in line with the description step.
63. Select the second option (shown below) from the pop up box.
This adds the event to the diagram, as a message going from the system boundary to
the ig part. At this level of abstraction we are not concerned with where the message
93
came from, just how it will be handled. We can envisage the system boundary on the
diagram as though it were the boundary of the HybridSUV block.
64. Now add a second description step (using the Sequence icon again) activate ABS.
65. Drag the bk (BrakeSubsystem) part of the HybridSUV to the diagram, to the right of the
ig part, and use View Options to hide its full name.
bk[Instance]:BrakeSubsystem
The answer is to do with multiplicity. When this part was created on a block definition
diagram (in section 2.2.2.1) we set the multiplicity value for it to tbd. This means there
may be more than one instance of this part. The tool recognizes this and allows you to
specify which instance you want represented on the diagram. You did not get [Instance]
appearing with the ig part, because that was created with the default multiplicity of 1.
66. To remove [Instance], right-click on the name and select Anonymous Symbol Instance.
We want to show a message going from the ig part to the bk part requesting activation
of the ABS. The message this time will be an operation call, the operation being an
operation provided by the block typing the bk part, that is BrakeSubsystem.
67. Select the Operation toolbar icon
, click on the ig part lifeline (in line with the
activate ABS step) then click on the bk part lifeline.
The Select Object dialog opens, showing any current BrakeSubsystem operations
available to the bk part none at present.
68. Click the New button and name the operation message activateABS.
You will also now see the activteABS operation scoped to the
BrakeSubsystem block in the Packages browser pane (as
opposite).
94
As a consequence of this message arriving at the brake subsystem within the HSUV, that
subsystem will need to execute the required behavior (which could be modeled with
another, lower level sequence diagram or an activity diagram for the implementation
activity for this operation).
On the current diagram we might want to model that information is returned back to
the ig part confirming ABS activation - before the ig part sends a power up message to
the power subsystem part (p).
69. Add another sequence step to the description, called get reply.
70. Select the Reply toolbar icon
, click on the lifeline of the bk part, in line with get
reply, then click on the ig part lifeline, to open the Select Object dialog below.
71. Select the activateABS operation in the Signature column, and click the OK button.
A reply message, with the dashed line, is added to the diagram, going from the bk part
to the ig part.
We can, if we wish, add some important information about this reply message,
specifically what sort of information is returned and how quickly this should happen.
This is done through the instance properties of that message. Instance properties for a
message allow you to model specific information relating to a particular instance or use
of the operation call.
95
So the ig part gets back the ABS status within 20 ms. In practice you would probably
want to both check the status was ok and set a watchdog on the time. We will just
simplify this to a single reply ok test.
75. Use the Selection
and Sequence toolbar icons, to create the
description steps opposite.
76. Drag the p (PowerSubsystem) part of the HybridSUV block from the browser to the
diagram, to the right of the bk part, hide its full name and make it an anonymous
symbol instance.
We will now add the powerUp operation, but this time using the approach we used with
the Accelerate sequence diagram.
77. Right-click the PowerSubsystem block in the browser, and select New UML
Operation. Name the operation powerUp.
96
78. Drag the powerUp operation from the browser and drop it on the lifeline of the ig part,
in line with the power up description step.
The message is automatically drawn to terminate at the p part. Because Artisan Studio
knows that the receiver must be a lifeline typed by the PowerSubsystem block, and
there is only one such item currently on this diagram (the p part), it creates an operation
call message going from the sender lifeline (the ig part where you clicked) to the
receiver, as below. Where there is more than one potential target for the message, you
will be presented with a list from which you need to select the correct item.
For many real-time systems the ability to define timing constraints is important. The
Artisan Studio sequence diagram provides a simple mechanism for doing this.
This will add a timing constraint between these two steps, and open an input box for
you to enter some text but do not do this yet.
80. Instead click an empty area
of the diagram to close the
input box, select the timing
constraint and open its
properties.
81. Enter the values shown
opposite and click on the
diagram.
97
The effect this has, other than indenting the selection construct, is
to fill out the corresponding section of the ig part lifeline (as highlighted below),
creating what is called in SysML an ExecutionSpecification, indicating that it is the ig
part that is making the test and sending the powerUp message.
In practice there would be other Start Vehicle activities that might be modeled here, but
we have probably done enough for you to understand the mechanisms by which this
diagram could be extended. Hopefully, we have also illustrated how behavior can be
decomposed into levels of abstraction that often relate to the levels of abstraction
defined in the structural BDD and IBD diagrams. For example, it would now be possible
to drill down inside the PowerSubsystem to model how its parts dealt with the powerUp
message. The final behavioral diagram for us to examine is the State Diagram.
98
this section is not to provide detailed coverage of every single feature of state modeling
in Artisan Studio, but to show those key techniques that will enable you to build simple
state machines from which you can develop further expertise should you need to do so.
State modeling is closely aligned with interaction modeling, with sequence diagram
messages often forming the basis for the events and actions depicted on the state
diagrams. In both UML and SysML, state diagrams must be child diagrams of a parent
entity, known as a state machine.
In SysML, a state machine is a specification of the dynamic behavior of a block, being
used to describe the state behavior of all instances of that block (for example, parts or
ports typed by the block) over their lifetime. A state machine is represented
diagrammatically in Studio via a state diagram that is a child diagram of the state
machine it represents. Thus a state diagram is an indirect child diagram of a block; a
block owns a state machine which in turn owns a state diagram. This is established when
the state machine and state diagram are created.
In this tutorial we will build a state diagram for the BrakeSubsystem block. It will not be
complete, or even particularly realistic, but it will be enough to show the key techniques
and relationships with other diagrams. The diagram below is what we will gradually
build toward.
1. To start, use the Window, Close All menu option to close all currently open diagrams.
2. Expand the HSUVStructure package in the Packages browser (if necessary) to expose
the BrakeSubsystem block.
99
3. Right-click this block and select New UML State Machine. Name the state
machine BrakeSubsystem.
4. Right-click on this state machine and select New State Diagram. Name the diagram
ABS states.
These would be typically used to define power on and power off (respectively). When
power is applied, the brake subsystem initially goes into its inactive state.
100
Note how the Inactive state appears scoped to the BrakeSubsystem state machine in the
browser.
7. Repeat the last step to add the Faulty state to the right of Inactive.
The Active state is a sequential composite state (it contains other sub-states within a
single region). Entry is triggered by the arrival of the same activateABS message we
modeled on the white box sequence diagram in the previous section.
8. Select the Sequential State toolbar icon
, and click on the diagram below and to
the right of the Inactive state. Name this state Active.
9. Enlarge the Active state and use the Initial State and Atomic State icons to create the
Idle and Braking sub-states, with an initial state, inside the Active state. (Select the
icon and click inside the Active state).
10. Finally use the Junction State toolbar icon
Active.
Note how the states are being added to the browser. You can expand Active to see its
contained atomic states.
Now we will add the transitions that connect the states as shown in the previous
diagram. This is very easy, made even more so by the use of the Ctrl key.
11. Select the Transition toolbar icon
. Now hold the Ctrl key down on the keyboard,
then simply click into the source and destination states to add each transition in turn,
holding the Ctrl key the entire time. (if you add each transition separately, without
using the Ctrl key, you need to press the Enter key or click on the diagram to ignore
the pop-up box that appears for each transition).
12. Press the Esc key on your keyboard after you have added the final transition.
You may need to separate the two transitions between Idle and Braking (they may be
created overlapping each other), and dont forget that, like all link lines in Artisan
Studio, you can add waypoints either as you go (left click) or afterwards by dragging the
link.
You can also remove all waypoints by right-clicking the link and selecting Cancel
Waypoints. You can remove a single waypoint by selecting the link, right-clicking on a
specific waypoint and selecting Remove this Waypoint.
101
You can also alter the line style to create straight rather than curved lines if you wish.
Look in the Help system at the Working with diagrams/Customizing the presentation
topic. Alternatively look at the Diagrams section in Part 1 of the Artisan Studio Tutorial.
By now your diagram should be taking shape, and look something like that below.
The / characters on the transitions are acting as placeholders for the events and possible
actions that we now need to add. However, those on the transitions from/to the
initial/final states are not really necessary. We can easily remove them.
13. Select all four of these transitions, by using the Ctrl key (standard Windows multiselect).
14. Right-click on any one of the selected transition lines
and select View Options.
15. Clear the Show Event Action Blocks checkbox on the
Transition tab, as opposite, and click the OK button.
We need to think about the events that cause the other transitions to trigger. We
already have in the model the event that causes the transition from Inactive to Active; it
is the activateABS operation message shown on the Start Vehicle white box sequence
diagram. Whenever this message is sent to a part typed by BrakeSubsystem, the
response should be either to change state to Active - if the current state is Inactive, or to
ignore it - if already Active or Faulty.
102
16. Drag the activateABS operation from the browser, and drop it on the transition, as
illustrated below.
Note that you can move the triggering event anywhere along or around the transition
line.
Operations of the block that owns the state machine that owns the state diagram are
often used as transition triggers on the diagram, although, strictly, it is the arrival of a
message requesting the execution of the operation that constitutes the trigger (note
that the state diagram does not let you see the sender of the message thats what you
use sequence diagrams for). The brakeOn and brakeOff triggers between the Idle and
Braking sub states are also operations, as is deactivateABS. We will need to create these
now; in practice, they would probably already have been created in the model if we had
used sequence diagrams as a way of refining the Brake use case.
17. Right-click the BrakeSubsystem block in the Packages browser and select New UML
Operation to create deactivateABS. Repeat twice more to create brakeOn and then
brakeOff operations.
18. Drag these operations from the browser to the correct transitions (see the final
diagram near the start of this section) and move the events to make them easily
visible.
Not all transition triggers are operation requests. ABSfault is an event model item. We
have already met events as messages on sequence diagrams, which is typically where
they are created and used. Events cannot be owned by blocks, only by packages, so we
need to create the event from a package. In our case this might be the HSUVUseCases
package or the HSUVStructure package; in reality some other package may be a more
natural home for a set of events.
103
Artisan Studio allows you to create different event types (see the Help for details). We
will create an opaque event, this being the most general.
19. Right click the HSUVStructure package in the browser, and select New Object
Interaction Model Event Opaque Event. Name it ABSfault.
20. Drag this event from the browser and drop it on the transition from Active to Faulty
(see the following diagram or that near the start of this section).
This leaves just two transitions without triggers. These two transitions are controlled by
guard conditions. There is a context menu option that will let you edit a guard condition.
The alternative, and in some respects, better way to add a guard condition, is through
the properties of the event action block (EAB). This is the term used in Artisan Studio
for the set of information that can appear on a transition. It really includes three parts: a
trigger (the event), an optional guard condition and an optional action. It is quite
common to see guard conditions without events on transitions coming from a choice
symbol.
21. Select the transition going from
the choice symbol (the diamond)
to the Active state, open its
properties and select the Options
tab (as opposite).
104
Guard conditions are always used with choices as a way of defining which outgoing
transition to take; they can also be used on other transitions. For example, if we wanted
to model that the deactivateABS transition is only valid when the vehicle is stationery,
we can add a guard.
24. Select that transition and open its Options property sheet.
25. Enter speed = 0 in the Guard Condition text box and click on the diagram.
The third part of an EAB is an optional action. Many transitions will not need to specify
an action to take when the triggering event occurs. But we have a couple on the diagram
we are creating. We need to invoke ABS system checks when the ABS is activated (look
back at the Start Vehicle white box sequence diagram), and we need to do something
if a fault event occurs. For the first of these, we can create a runChecks operation for
the BrakeSubsystem block that is invoked when needed.
26. Right-click on the BrakeSubsystem block in the browser and select New UML
Operation to create the runChecks operation.
You cannot simply drag this operation to the activateABS transition, as you might think.
If you do this, all that will happen is that you will replace activateABS with runChecks as
the triggering event. You have to use the properties of the EAB.
27. Select the activateABS transition and open its Options property page.
28. Drag runChecks from the browser and drop it in the Action text box, as below.
The operation name appears in blue text in both the text box and on the diagram. This
blue text is indicating that this is not just plain text, it is a model reference; if this
operation name gets changed anywhere in the model (for example, in the browser), the
text on the diagram will automatically get updated. Model references can be used
105
almost anywhere in Artisan Studio where text can be entered. They are a good way to
make your model more robust to change, as well as providing a quick way to examine
the properties of the referenced item.
The other action we identified earlier was to handle the fault event. What we might
want to do here is set a warning indicator on the drivers display panel. Lets assume
some other, yet to be defined, subsystem is responsible for this panel. All we can do
now is model the need for the sending of an appropriate message.
We would want this message to be sent either if the runChecks operation returned a fail
or if some fault developed while in the Active state. Rather than add an action on both
incoming transitions to the Faulty state, it is better to define an entry action for that
state. To do this we need to create what UML calls in internal transition. The name is
misleading, no actual transition occurs, it is merely an event[guard]/action construct (an
EAB) inside a state. When the event occurs while in that state, and if the guard (if there
is one) is true, the specified action is carried out.
To add an internal transition we use the Event Action Block toolbar icon
29. Select the Event Action Block toolbar icon and click inside the Faulty state.
30. When the in-line edit box appears, enter the text notify ABS fault.
Click on the diagram to see an EAB with the correct action (but no
event as yet) appear inside the Faulty state (as opposite).
106
To finish this section we will illustrate another link between behavior models. Activity
modeling in SysML has strong support for continuous behavior, as we saw in the section
on activity modeling, and as would be required for an ABS. We can invoke an activity as
continuous behavior from within a state using a doActivity.
33. In the Packages browser pane, right-click on the HSUVActivities package and select
New Activity Model Activity. Name the new activity applyABS.
34. Now simply drag applyABS from the browser and drop it on the
Braking sub-state within the Active composite state to create the
doActivity, as opposite.
This completes the state diagram, and this section. You can close the state diagram.
107
The first relationship we will create is a satisfy dependency, and we will do this on the
open requirement diagram. We are going to model that the PowerSubsystem block
satisfies the Power requirement.
3. Expand the HSUVStructure package in the browser and drag the PowerSubsystem
block on to the requirements diagram, below the Power
requirement.
4. Now select the Satisfy dependency toolbar icon, click first
on the PowerSubsystem block, then on the Power
requirement.
requirement
Power
satisfy
block
PowerSubsystem
This opens the Links Editor dialog (below), where again the relationship is visible.
108
The Links Editor is a powerful facility, which as well as providing visibility of existing
links, also allows you to make new ones or break existing ones. You might want to try
doing this and note the effect on item properties and the currently open diagram. Use
Undo to restore the model to its current state.
The second relationship we will create is the verify dependency, and again, we will do
this on the requirement diagram, but in a completely different way. A verify dependency
can only be created between a requirement and a model item that has had the
testCase stereotype applied. testCase can only be applied to certain model item
types: certain behavioral diagrams or behavioral items such as operations or activities
which can own diagrams. You need to decide which items in your model constitute test
cases and apply the stereotype before you can create the verify dependency.
We will apply the testCase stereotype to the AccelerateAct activity created earlier and
then show that this activity verifies the Acceleration requirement.
8. Expand the HybridSUV block in the Packages browser,
to see the AccelerateAct activity, as opposite.
9. Right-click
AccelerateAct,
and
select
Applied
Stereotypes n testCase (n is an item number in the
alphabetical list of valid stereotypes).
109
This applies the testCase stereotype and the properties of the activity will now show a
testCase tab (more shortly).
10. Now
right-click
the
AccelerateAct activity in
the browser and select
Start Link.
11. Then
right-click
the
Acceleration
requirement
on
the
diagram and select End
Link to open the Quick
Link dialog.
12. Use the drop-down list
control to select the
'verifies' relationship (as
shown opposite) and
click the OK button.
110
14. Select the Problem icon and click on the diagram, close to the Acceleration
requirement and the verifiedBy note (we have moved items around on the following
image).
15. Enter the text need to specify test conditions in the pop up text box, and press the
Enter key.
, click on
Problem
need to specify test conditions
Problem
need to specify test conditions
requirement
Acceleration
If you wish you can add a further note link from the Problem note to the verifiedBy
note, but this will not affect its scoping in the model.
Exactly the same approach is used with Rationale. You can, if you wish, create and link
the Rationale note shown on the final version of the requirement diagram as follows. If
you do this, you will find the Rationale as a model item scoped within the
PowerSubsystem block.
111
It is clear that the relationship between the Power requirement and the
PowerSubsystem block is now held in the model. We can therefore see this from the
PowerSubsystem end.
17. Expand the HSUVStructure package and double-click the HSUVStructure BDD shown
near the foot of the package content to open the diagram (see the following diagram,
and note that we have hidden all compartments for clarity)).
18. Right-click the PowerSubsystem block on this diagram and select Add Note Satisfies
(as below).
This adds a note, linked to PowerSubsystem, stating its relationship with the Power
requirement. View Options can also be used to change this note to a box, if preferred.
You may need to move things around slightly on this diagram, as below.
bdd [Package] HSUVStructure
block
HybridSUV
satisfies
requirement Power
c
block
ChassisSubsystem
bk
block
BrakeSubsystem
block
PowerSubsystem
fc
bkp
block
BrakePedal
112
bkp
constraint
FlowConstraint
constraints
{flowrate=pressure/(4*demand)}
parameters
demand : Real
flowrate : Real
pressure : Real
Not only can we see related requirements on other diagrams, we can create such
relationships.
19. Expand the HSUVUseCases package in the browser and double-click the Operational
Use Cases diagram at the foot of the package content to open the diagram.
20. Drag the Acceleration requirement from the browser and drop it on the use case
diagram, as shown in the following illustration.
requirement
Acceleration
refinedBy
Use Case Accelerate
113
23. Right-click on the HSUVRequirements package in the Packages browser, and select
Report Unsatisfied Requirements.
This opens the Results pane and lists any unsatisfied requirements in the
HSUVRequirements package. You will also see a number of other requirements related
options from the Report context menu.
2.2.10
The package diagram is typically used to capture the structure of, and dependencies
between, packages, but can also be used to show views and viewpoints (if you are not
familiar with these, you can find more information in the SysML specification). As with
other sections of this tutorial, the intention here is not to show all features of Artisan
Studios package diagram implementation, but enough to enable you to use it
effectively. To do this we will firstly create a simple diagram to show our model
structure and then create a view and show the items that might relate to this view.
The package diagram showing model structure is typically held within the top-level
model package: HSUVModel in our case.
1. Collapse the packages in the Packages browser pane as
opposite, to see the package structure within HSUVModel
(note we have not shown most of the items in the
HSUVStructure package for space reasons).
114
HSUVActivities
HSUVRequirements
HSUVStructure
HSUVUseCases
Note that we did not select Populate Contents. That would have resulted in all items
scoped to the HSUVStructure package being added to the diagram, whereas all we want
to add are the two nested (sub-) packages.
5. Move the two nested packages as shown below.
pkg [Package] HSUVModel [Structure]
HSUVActivities
HSUVRequirements
HSUVStructure
HSUVFlowSpecs
HSUVUseCases
HSUVInterfaces
115
As well as showing the structure of the HSUVModel packages, we can also show package
dependencies on this diagram. A dependency exists when something in one package
references something in another package and identifies a need to be careful regarding
change in the dependee package. An example in our model is the dependency between
the HSUVUseCases package and the HSUVStructure package that arises because the
child sequence diagrams in the HSUVUseCases package contain items scoped to the
HSUVStructure package. It is useful to capture this dependency more visibly in the
model, on the package diagram.
6. Click the arrow on the right of the Abstraction toolbar icon
and from the drop-down menu (see opposite) select Dependency.
7. Click first on the HSUVUseCases package (click on the name tab
or the boundary you are not selecting the package if you click
inside it somewhere), then on the HSUVStructure package name
tab to create the dependency relationship in the model and show
it on the diagram.
HSUVActivities
HSUVRequirements
HSUVStructure
HSUVFlowSpecs
HSUVUseCases
HSUVInterfaces
There are other dependencies that could be added to this diagram, but we will move on
to look at how the package diagram can also be used to model views and viewpoints.
To start we will create a package in the model to hold this package diagram and the
elements we create on it (and in doing so, we should of course update the above
diagram).
116
8. Right-click the HSUVModel package and select New Package. Name it HSUVViews.
9. Now right-click the HSUVViews package and select New Diagram Package
Diagram. Give the diagram the name '[Package] HSUVViews [Operational View]'.
As you will see (from the tool tips) there are package diagram toolbar icons for creating
a view and a viewpoint as well as the relationships that connect them and other items.
10. Select the View toolbar icon
OperationalView.
Note how both the view and viewpoint appear in the browser, along with the package
diagram, within the HSUVViews package.
12. Select the OperationalViewpoint, either on the diagram or in the browser, open its
properties and select the
Viewpoint tab.
conform
Viewpoint
Operational Viewpoint
{Abstract}
We want to show that the OperationalView imports from both the HSUVUseCases
package and also from the HybridSUV block in the HSUVStructure package.
117
14. Expand the HSUVModel package in the Packages browser (if necessary) and drag both
the HSUVUseCases package and the HSUVStructure package to the diagram (see the
following image).
We only want to import from the one block in the HSUVStructure package, so the use of
the context menu Populate option is not sensible (too many things to then remove). In
this case it is better to simply enlarge the HSUVStructure package symbol on the
diagram and drag the HybridSUV block to the diagram. We could either drop it inside its
package on the diagram or we could drop it outside the package and then use the
Nesting Link icon
15. Drag the HybridSUV block to the diagram using either approach to show it is scoped to
the HSUVStructure package.
16. Now use the Import toolbar icon
from the Abstraction dropdown menu (see opposite), to link the OperationalView to both the
HSUVUseCases package and the HybridSUV block (make sure you
always click on OperationalView first; undo or Delete from Model
if you get the arrow the wrong way round).
import
import
View
Operational View
conform
118
Viewpoint
Operational Viewpoint
{Abstract}
The final use we will show for the package diagram is to model the relationships
between the HSUVModel, the SysML Profile and its contained SI Definitions package,
and the UML Profile. We will create this diagram and the diagram elements in a new
package called Context.
17. Right-click on the HSUVModel package to create the Context package (New
Package).
18. Now right-click on the Context package to create a new package diagram called
[Package] Context.
19. Select the Model toolbar icon
, click on the diagram and
name this new element HSUV Model.
model
HSUV Model
These too are abstract representations of the actual profile packages in the model.
21. Enlarge the SysML Profile element on the diagram, select the Model Library toolbar
icon
and click inside the SysML Profile element to create a fourth diagram element
named SI Definitions.
Again, this is an abstract representation of the actual SI Definitions package within the
SysML Profile. Note the scoping of these diagram elements in the Packages browser.
22. Arrange the diagram elements as below.
pkg [Package] Context
profile
UML Profile
profile
SysML Profile
modelLibrary
SI Definitions
model
HSUV Model
119
We can now model the relationships between these elements. We want to show that:
a) the HSUV Model applies both profiles;
b) the HSUV Model imports the SI Definitions;
c) the SysML Profile is dependent on the UML Profile.
It is beyond the scope of this tutorial to explain these relationships, although most are
obvious. You can refer to the Help system or the SysML specification for further details.
All of these relationships are directional, so in carrying out the following activities, it is
important to get the mouse click order correct: you must click first on the from
element, then on the to element. If you get the direction wrong, undo and re-create.
You will find it easiest to select elements by clicking in their name compartment.
Remember also that you can add or remove waypoints to improve the readability or
presentation of the links on the diagram. You can also move or resize the diagram
elements.
We will create the diagram relationships in the a) c) order defined above.
23. Use the Apply toolbar icon
SysML Profile.
24. Use the same toolbar icon to create the relationship from HSUV
Model to UML Profile.
25. Use the Import toolbar icon
from the Abstraction drop-down
menu (opposite) to create the import relationship from HSUV
Model to SI Definitions.
26. Use the Dependency toolbar icon
from the Abstraction dropdown menu to create a dependency relationship from SysML Profile to UML Profile.
120
modelLibrary
SI Definitions
apply {isStrict}
apply {isStrict}
model
HSUV Model
import
This completes this section and the tutorial. You can now close the model.
121