SysML: How to Use Activity Diagrams to Model System Behavior?

An activity diagram is a kind of behavior diagram; it’s a dynamic view of the system that expresses sequences of behaviors and event occurrences over time. In SysML, an activity diagram is inherited from UML with some minor modifications.

Activity diagrams, sequence diagrams, and state machine diagrams are the three options that SysML offers you to specify system behavior. All three can express sequential and concurrent behaviors and event occurrences over time. However, each one has strengths and weaknesses that make it more or less appropriate based on the needs of your target audience.

SysML diagram types

Why Activity Diagram?

Activity diagrams can express complex control logic better than sequence diagrams and state machine diagrams. An activity diagram is particularly good at expressing the flow of objects—matter, energy, or data—through a behavior, with a focus on how the objects can be accessed and modified in the execution of that behavior during system operation. Thus, it is typically used to specify behavior, with a focus on the flow of control and the transformation of inputs into outputs through a sequence of actions. Common usages of an activity diagram in SysML includes:

  • Activity diagrams are commonly used as an analysis tool to understand and express the desired behavior of a system.
  • Activity diagrams are often used to create graphical use case specifications which tend to be more concise and less ambiguous than the traditional text form of a use case specification.
  • In addition, an activity diagram is also a common technique is to dissect a single-use case specification either a text specification or an activity diagram, and subsequently for creating a set of sequence diagrams, one per path (scenario).

Activity Diagram – Learn by Examples

A basic activity diagram – flowchart like

Activity Diagram explained

Activity Diagram Notation Summary

Notation Description UML Notation
Activity

Is used to represent a set of actions

Activity Diagram Notation: Activity
Action

A task to be performed

Activity Diagram Notation: Action
Control Flow

Shows the sequence of execution

Activity Diagram Notation: Control Flow
Object Flow

Show the flow of an object from one activity (or action) to another activity (or action).

Activity Diagram Notation: Object Flow
Initial Node

Portrays the beginning of a set of actions or activities

Activity Diagram Notation: Initial Node
Activity Final Node

Stop all control flows and object flows in an activity (or action)

Activity Diagram Notation: Activity Final Node
Object Node

Represent an object that is connected to a set of Object Flows

Activity Diagram Notation: Object Node
Decision Node

Represent a test condition to ensure that the control flow or object flow only goes down one path

Activity Diagram Notation: Decision Node
Merge Node

Bring back together with different decision paths that were created using a decision-node.

Activity Diagram Notation: Merge Node
Fork Node

Split behavior into a set of parallel or concurrent flows of activities (or actions)

Activity Diagram Notation: Fork Node
Join Node

Bring back together with a set of parallel or concurrent flows of activities (or actions).

Activity Diagram Notation: Join Node
Swimlane and Partition

A way to group activities performed by the same actor on an activity diagram or to group activities in a single thread

Activity Diagram Notation: Swimlane

Describe High-Level Interactions between a System and External Systems

The figure below specifies how the Air Compressor interacts with the external systems, including the Air Tool, the Atmosphere, and indirectly with the Operator.

SysML Block Definition Diagram: Air Compressor

(*Source – Example extracted from – The Practical Guide to SysML 3rd ed by Morgan Kaufmann 2014)

The Block Definition Diagram includes a block called the Air Compressor Context that is composed of the Air Compressor and the entities that are external to the Air Compressor representing the user (Operator), external system (Air Tool), and the physical environment (Atmosphere).

The Air Compressor and the external systems are shown as activity partitions.

Activity Diagram: Air compressor example

(*Source – Example extracted from – The Practical Guide to SysML 3rd ed by Morgan Kaufmann 2014)

  1. The activity begins at the initial node (i.e., dark-filled circle), and then the Operator executes the Control Tool action.
  2. The activity completes its execution at the activity final node (i.e., bulls-eye symbol) after the Operator completes the Control Tool action.
  3. The Air Compressor performs the function (i.e., action) called Compress Air, which has a low-pressure air input and a high-pressure air output.

Model the Interaction within a Sub-System

The Compress Air action is further decomposed. Now, let’s continue the Air Compressor example, we can use an internal block diagram below to show how the components of the Air Compressor are interconnected.

Block Definition Diagram: Air Compressor System

(*Source – Example extracted from – The Practical Guide to SysML 3rd ed by Morgan Kaufmann 2014)

We can use the activity diagram to shows how the components interact within the Air Compressor when performing a compress Air action. The activity partitions in this activity diagram correspond to the four components of the air compressor as shown in the Swimlane Activity Diagram below:

  • The Motor Controller performs actions to Sense Pressure and Control Motor
  • The Motor performs the action to Generate Torque
  • The Pump performs the action to Pump Air
  • The Tank performs the action to Store Air.

Activity Diagram example: Compress Air

(*Source – Example extracted from – The Practical Guide to SysML 3rd Ed by Morgan Kaufmann 2014)

The low-pressure air input and high-pressure air output are consistent with the input and output of the Compress Air action contained in the Behavior package along with the Operate Air Tool activity in the previous high-level activity diagram example.

Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK