Main Content

Describe System Behavior Using Activity Diagrams

An activity diagram describes an activity in an architectural system. An activity describes system behavior that models the flow of tokens from inputs to outputs through a controlled sequence of actions. An activity diagram contains action nodes with pins connected by flow lines.

Actions are the building blocks of activities and describe what happens when activities execute. Each action can accept inputs and produce outputs, called tokens.

Use activity diagrams to conceptualize a system, visualize functional flow through actions or decisions, and understand how system components interact with one another.

You can allocate activity diagram elements to elements of a System Composer™ architecture model using the Allocation Editor to more fully describe your functional architectural design. For more information, see Design Architectures and Activity Diagram for Mobile Robot.

Concepts Activity Diagram

These concepts are relevant for authoring activity diagrams:

  • Tokens are objects that flow in the activity diagram. A token can represent data such as structures and integers, or a token can simply pass on the control.

    These are the types of tokens:

    • Object token — Represents an object, such as a piece of data

    • Control token — Represents a control or a triggering event that does not carry any data

  • A flow in an activity diagram connects two nodes. A dashed line represents a control flow. A solid line represents an object flow.

    These are the types of flows:

    • Object flow — Tokens in an object flow contains token data on which actions operate. You can use object flows to route input or output tokens to carry information or physical items between object nodes.

    • Control flow — Tokens in a control flow trigger the execution of actions. You can use control flows to model transfer of control from one Action Node to another.

  • An action node is a key building block in an activity diagram. An action node represents an action to be executed. Action nodes consume input tokens and produce output tokens on pins.

    Use a MATLAB® function or a nested activity diagram to describe the behavior of an action node.

  • A control node routes a logical flow of tokens through the system.

    Use control nodes and flows to route tokens. Control nodes can be used to initialize, split, merge, and terminate token flows.

    These are the various types of control nodes in an activity:

    • Initial Node — Dispatches a control token at the beginning of an activity.

    • Decision or Merge Node — A decision node routes an input token to an output flow based on the evaluation of guard expressions. A merge node routes tokens from multiple input flows to a single output flow. A merge decision node routes tokens from multiple input flows to certain output flows based on the evaluation of guard expressions.

    • Join or Fork Node — A join node consolidates multiple input tokens to one output flow given that a token is available at each input pin. A fork node replicates one input token on each output flow.

    • Flow Final Node — Terminates one object or control flow but not the entire activity.

    • Activity Final Node — Terminates the incoming token and the entire activity.

  • A pin directs tokens in or out of an action node. The directionality of the pin represents input or output. You can connect pins by object flows.

    Use pins to route an object token to or from an Action Node. Pins are also used to store object tokens before or during execution. You can use pins only for object flows.

  • A type defines the contents of a token that flows through a pin. A type has dimension, unit, complexity, minimum, maximum and description.

    These are three token types in activity diagrams:

    • Value type: A value type is a type assigned to a single value.

    • Composite type: A composite type is equivalent to a bus structure that contains field of different values and data types.

    • MATLAB class type: A MATLAB class type references a MATLAB class on the path that defines a complex object with properties and methods. You can use a built-in MATLAB class or define your own MATLAB class. For more information on using MATLAB class type, see Model Complex Objects in Activity Diagrams Using MATLAB Class Tokens.

  • A parameter node route tokens into or out of a nested activity diagram. When a pin is created, a corresponding parameter node will be created inside the nested activity.

    Use parameter node to define how tokens enter or leave a nested activity. There are two types of parameter nodes input and output.

Create New Activity Diagram

Create an activity diagram by launching the System Composer Start Page. Enter this command in the MATLAB Command Window.

systemcomposer

From the dialog box that opens, select Activity Diagram.

Activity Diagram from Simulink Start menu

Alternatively, you can use the systemcomposer.createActivity function to create a new activity diagram.

Author, Simulate, and Visualize Activity Diagrams

Activity diagrams are integrated with architecture models in System Composer. When designing a system, you can use an activity diagram to conceptualize a system and visualize the flow of actions or decisions. Activity diagrams help you to understand how the elements of your system interact with each other. In System Composer, you can also simulate and visualize activity diagrams to validate system behavior.

TopicDescription
Author Activity DiagramsInteractively create and edit an activity diagram and learn terminology.
Simulate, Visualize, and Validate Activity DiagramsSimulate and visualize an activity diagram to validate system behavior.

Tip

To learn more about how System Composer concepts apply to systems engineering design, see System Composer Concepts.

See Also

Functions

Tools

Blocks

Related Topics