Main Content

Action Node

Process object tokens through MATLAB function or nested activity diagram

Since R2024a

  • Action Node


An action node represents a specific action to execute within an activity diagram. This action is realized either through a MATLAB® function or a nested activity diagram.

Action nodes process incoming object tokens to produce new object tokens. Input object tokens are consumed through input pins, and newly generated object tokens exit through the output pins of an action node.

Action nodes begin execution only when all pre-conditions are met. That is, input pins must hold a minimum number of object tokens specified during pin configuration, and all incoming control flows must offer a control token.

For a roadmap of the activity diagram topics, see Describe System Behavior Using Activity Diagrams.

Action Node Queue Behavior

When an action node begins execution, it consumes object tokens from its input pins. Based on the value of the multiplicity parameter, the action node removes a certain, minimum number of tokens from each input pin during execution. The action node then passes these token values on to the MATLAB function or nested activity diagram where new output object tokens are generated for continued use in the activity.

While an action node consumes object tokens, more tokens may arrive at its input pins. These new tokens are not used because the action node is already occupied. The new tokens are queued in the input pin, which has these characteristics:

  • First in, first out — Object tokens that enter first are queued first for exiting the pin.

  • Blocking queue — If a new object token arrives when the queue is already full, it is blocked from entry until at least one token in the queue enters the action node to make space. While the new object token is waiting to enter the queue, it is said to be in the pending state.

The capacity of an input pin is determined by its multiplicity, defined in the Token Multiplicity parameter.

Once an action node generates output object tokens, they exit through the output pin. The output pin of an action node has these characteristics:

  • Multiplicity of one — The output pin of an action node can hold only one object token at a time.

  • Overwriting queue — If a new object token exits when the output pin already contains a token, then the new token replaces the old token.

Create an Action Node

You can create an action node on the activity diagram canvas in two ways:

  • Drag and drop the Action Node block from the palette on the left to any location on the canvas.

  • Hold down the left mouse button at the desired location on the canvas and drag in any direction. A blue outline of a node appears on the canvas. Select Create Action from the horizontal menu that appears below the outline.


expand all

Action Node Parameters

Name of the action node. By default, the activity diagram editor names the first action node placed on the canvas as Action. As more action nodes are added, the editor attaches increasing numerical suffixes to the name Action.

Example: Action2

Indicate how an action node is set up for operation.

  • MATLAB — Contains a pre-existing MATLAB function such as rand or a custom function written in a .m file.

  • Activity — Contains another activity diagram that consumes and produces tokens.

When you select this check box, the names of all pins on the selected action node are displayed.

Name of the MATLAB function that an action node implements. The function can either be a pre-existing MATLAB function or a custom function that you have authored in a .m file.

Example: customfunction_add


To enable this parameter, set Behavior Type to MATLAB in the Property Inspector.

The number of time units an activity diagram spends on the execution of an action node. An activity diagram executes MATLAB functions of an action node at the end of the duration period.

Pin Parameters

An action node has input and output pins that act as buffers for object tokens. Pins store object tokens until such time as required for execution by the action node.

Pins are characterized by a flow specification, which dictates the minimum number of tokens that must be present in an input pin before an action node can be executed. The number of tokens that an input or output pin can hold also has an upper limit.

Each pin is associated with a certain data type. All tokens of a pin must have the data type associated with the pin. One pin can hold multiple object tokens if they have the same data type. Such pins have a multiplicity greater than one.

These are the pin parameters:

Name of the input or output pin. By default, the pin is called InputPin or OutputPin depending on its configuration. As more input or output pins are added to action nodes, increasing numerical suffixes are added to InputPin or OutputPin, respectively.

The number of tokens required at an input pin for the corresponding action node to begin execution. If an input pin has a multiplicity greater than one, it can hold multiple tokens. Upon execution, an action node takes in exactly the number of object tokens specified by the multiplicity parameter.

Token multiplicity applies only to input pins of an action node.

The order of evaluation of an input or output pin. The tokens of a pin with a lower argument order is processed before tokens of a ping with a greater argument order.

Object Type Parameters

An input or output pin can handle object tokens of a certain type. In the Property Inspector, the Object Type section for a pin allows you to specify the type and other properties of an object token.

The type of the object or structure held by an action node pin.

  • <owned> — Select properties for an object token, such as type, dimension, complexity, and unit from the Property Inspector.

  • <inherit> — Inherit the object type from the previous pin.

  • custom type — Choose from the list of all custom types that you had created using the Types Editor.

The direction of token flow through a pin of an action node. This parameter is automatically set to Input or Output, depending on whether you create an input pin or output pin, respectively.

Data type of the token. The list of allowed data types includes any custom data types that you may have created in the Types Editor, and any bus types loaded in the base workspace.

Dimensions of the token.

Custom unit that you assign to the token.

Complexity of the token.

Version History

Introduced in R2024a