Main Content

systemcomposer.activity.TimeAction

R2026b

Time action node in activity diagram

Since R2026b

    Description

    A TimeAction object represents a time action node in an activity diagram model. A time action node outputs a control token after a specified duration or at a specific simulation time.

    Creation

    Create a time action node in an activity diagram using the addNode function with the nodeType argument specified as timeaction.

    timeAction1 = addNode(activity,'Warmup Delay','timeaction');

    Properties

    expand all

    Time mode of the time action node, specified as one of these options:

    • Absolute — Node activates when the simulation clock reaches the specified time value.

    • Relative — Node activates when the specified duration elapses after the input control token arrives.

    Dependencies

    When TimeMode is set to Relative, the time action node requires an input control flow.

    Data Types: char

    Time value for the time delay, specified as a positive double in simulation time units. The time expression appears below the node on the canvas as for relative mode or at T for absolute mode.

    Data Types: double

    Activity that contains the time action node, specified as a systemcomposer.activity.Activity object.

    Name of time action node, specified as a character vector.

    Example: 'Warmup Delay'

    Data Types: char

    Position on canvas, specified as a vector of coordinates, in pixels: [left top right bottom].

    Each vector specifies the location of the top left corner and bottom right corner of the component, specified as a 1-by-4 numeric array. The array denotes the top left corner in terms of its x and y coordinates followed by the x and y coordinates of the bottom right corner.

    Data Types: double

    Parent activity diagram model, specified as a systemcomposer.activity.Model object.

    Simulink® handle, specified as a double.

    This property is necessary for several Simulink workflows and for using Requirements Toolbox™ programmatic interfaces.

    Example: handle = get(object,'SimulinkHandle')

    Data Types: double

    Universal unique identifier, specified as a character vector.

    Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'

    Data Types: char

    Unique external identifier, specified as a character vector. The external ID is preserved over the lifespan of the element and through all operations that preserve the UUID.

    Data Types: char

    Object Functions

    applyStereotypeApply stereotype to model element
    changeStereotypeChange currently applied stereotype to new stereotype in its stereotype hierarchy
    destroyRemove model element
    getFlowGet flow from activity diagram
    getPinsGet pins from action node
    getStereotypesGet stereotypes applied on model element
    hasStereotypeFind if element has stereotype applied
    removeStereotypeRemove stereotype from profile
    connectCreate activity diagram flows

    Examples

    collapse all

    Create an activity diagram model and get the root activity.

    adModel = systemcomposer.createActivity("timeActionModel");
    activity = get(adModel,"Activity");

    Add an initial node, an action node, and an activity final node.

    initialNode = addNode(activity,"Start","initial");
    action1 = addNode(activity,"Process Data","action");
    finalNode = addNode(activity,"End","activityfinal");

    Add a time action node with a relative time delay. A relative time action delays execution by a specified duration after the input control token arrives.

    warmupDelay = addNode(activity,"Warmup Delay","timeaction");
    warmupDelay.EventType = "relative";
    warmupDelay.TimeValue = 5
    warmupDelay =
    
      TimeAction with properties:
    
                  EventType: Relative
                  TimeValue: 5
                     Parent: [1×1 systemcomposer.activity.Activity]
                       Pins: [0×0 systemcomposer.activity.Pin]
                       Name: 'Warmup Delay'
                   Position: [230 245 270 295]
                      Model: [1×1 systemcomposer.activity.Model]
             SimulinkHandle: 178.0001
        SimulinkModelHandle: 159.0004
                       UUID: 'e3ac4720-8876-4c63-83ea-f706ebed5872'
                ExternalUID: ''

    Add a second time action node with an absolute time. An absolute time action activates when the simulation clock reaches the specified time value.

    timeout = addNode(activity,"Timeout","timeaction");
    timeout.EventType = "absolute";
    timeout.TimeValue = 30
    timeout =
    
      TimeAction with properties:
    
                  EventType: Absolute
                  TimeValue: 30
                     Parent: [1×1 systemcomposer.activity.Activity]
                       Pins: [0×0 systemcomposer.activity.Pin]
                       Name: 'Timeout'
                   Position: [230 245 270 295]
                      Model: [1×1 systemcomposer.activity.Model]
             SimulinkHandle: 179.0001
        SimulinkModelHandle: 159.0004
                       UUID: 'a11a0fff-6431-40bb-90ff-660b495a9ee8'
                ExternalUID: ''

    Connect nodes to create the activity flow. The relative time action delays execution between the initial node and the action, while the absolute time action provides a timeout path to the final node.

    connect(initialNode,warmupDelay);
    connect(warmupDelay,action1);
    connect(action1,finalNode);
    connect(timeout,finalNode);

    More About

    expand all

    Version History

    Introduced in R2026b