Action Node
Process object tokens through MATLAB function or nested activity diagram
Since R2024a
Description
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 preconditions are met. That is, input pins must hold a minimum number of object tokens specified by the token multiplicity parameter, 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 Pins
An action node has input and output pins that act as buffers for object tokens.
When an action node begins execution, it consumes object tokens from its input pins. Based on the value of the token multiplicity parameter, an action node executes only after it receives a certain number of tokens at each input pin. The MATLAB function or nested activity diagram uses input object tokens to generate new output object tokens. Output object tokens exit through the output pin.
Action nodes can have two types of input and output pins:
Streaming pins
Non-streaming pins
Note
Streaming pins can only be configured for action nodes with a nested activity diagram.
Action nodes with both types of pins begin execution only once all pins hold the minimum number of object tokens.
Streaming Pins
A nested activity with streaming input pins starts executing when the token multiplicity for all input pins, including non-streaming pins, is satisfied.
Once the nested activity starts executing, streaming input pins continue to accept all tokens that arrive at the pin and buffer them. Upon arrival, the tokens are forwarded to the corresponding input activity parameter node. An input activity parameter node is a type of object node (a node that directs the flow of object tokens) that routes tokens into a nested activity diagram. When an input pin is created for the action node with a nested activity, a corresponding input activity parameter node is created inside the nested activity.
During execution, the nested activity continues to consume tokens from all the available streaming pins through the corresponding input activity parameters.
Any outputs from the nested activity are accepted by output activity parameter nodes, and then forwarded to the output pin.
A nested activity is considered complete when the following conditions are satisfied:
An output activity parameter node receives object tokens, or any final activity node within the nested activity receives a control token.
All output pin requirements are met.
Once the multiplicity condition of the streaming input pins is met, the condition will not be reevaluated until the nested activity is restarted. Until then, the upper bound of streaming pins is infinite.
When a nested activity completes execution, all tokens at the output activity parameter nodes are moved to the corresponding output pins. The remaining tokens in the nested activity are destroyed, and the states of all the nodes are reset.
After the nested activity ends, it can restart once again if the same token multiplicity conditions are met as described above.
Non-Streaming Pins
Non-streaming input pins block any incoming object tokens while the action node is executing, causing output object tokens to go into a pending state in the output pins of the previous nodes.
Non-streaming output pins deliver output object tokens only when the action node finishes execution.
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.