Main Content

SystemActionPhase

Specify logic phase that executes system action

Since R2025a

    Description

    A SystemActionPhase object represents a logic phase in the RoadRunner scenario logic that executes actions without an actor.

    Creation

    You can create a SystemActionPhase object in these ways:

    • The addPhaseInSerial function creates a logic phase with the specified phase type, and adds it before or after the specified existing phase in the RoadRunner scenario logic. Specify the phaseType argument as "SystemActionPhase" to create a SystemActionPhase object.

    • The addPhaseInParallel function creates a phase with the specified type and adds it in parallel to the specified existing phase or serial sequence of phases in the RoadRunner scenario logic. Specify the phaseType argument as "SystemActionPhase" to create a SystemActionPhase object.

    • The addPhase function creates a new phase of the specified type and adds it as the last child of the specified serial or parallel phase in the RoadRunner scenario logic. Specify the phaseType argument as "SystemActionPhase" to create a SystemActionPhase object.

    Properties

    expand all

    Name of the phase, specified as a string scalar or character vector.

    Action contained in the phase, specified as an array of WaitAction objects. The WaitAction action type specifies for the simulation to wait in this phase until a condition ends the phase.

    Note

    You must specify a nonempty value for this property before you can run the simulation.

    This property is read-only.

    Parent phase of this phase, represented as a ParallelPhase object or SerialPhase object. RoadRunner Scenario returns an empty object if this phase has no parent phase.

    Condition to trigger phase completion, specified as one of these objects:

    • ActorSpeedCondition — Represents an Actor Speed condition in the RoadRunner scenario logic. Specifies for the associated phase to end when an actor reaches the specified speed.

    • DurationCondition — Represents a Duration condition in the RoadRunner scenario logic. Specifies for the associated phase to end after the specified amount of time elapses.

    • CollisionCondition — Represents a Collision condition in the RoadRunner scenario logic. Specifies for the associated phase to end when the actor specified by FirstActor collides with the actor specified by SecondActor.

    • PhaseStateCondition — Represents a Phase State condition in the RoadRunner scenario logic. Specifies for the associated phase to end when the referenced phase reaches the specified state.

    • DistanceToActorCondition — Represents a Distance To Actor condition in the RoadRunner scenario logic. Specifies for the associated phase to end when the actor is a certain distance away from the reference actor.

    • DistanceToPointCondition — Represents a Distance To Point condition in the RoadRunner scenario logic. Specifies for the associated phase to end when an actor is a certain distance away from a specified point.

    • LongitudinalDistanceToActorCondition — Represents a Longitudinal Distance To Actor condition in the RoadRunner scenario logic. Specifies for the associated phase to end when an actor reaches a certain longitudinal distance from another actor.

    If any actions are still executing when the condition triggers, RoadRunner Scenario ends those actions early.

    Condition to fail scenario if triggered during phase execution, specified as one of these objects:

    • ActorSpeedCondition — Represents an Actor Speed condition in the RoadRunner scenario logic. Specifies for the associated phase to end when an actor reaches the specified speed.

    • DurationCondition — Represents a Duration condition in the RoadRunner scenario logic. Specifies for the associated phase to end after the specified amount of time elapses.

    • CollisionCondition — Represents a Collision condition in the RoadRunner scenario logic. Specifies for the associated phase to end when the actor specified by FirstActor collides with the actor specified by SecondActor.

    • PhaseStateCondition — Represents a Phase State condition in the RoadRunner scenario logic. Specifies for the associated phase to end when the referenced phase reaches the specified state.

    • DistanceToActorCondition — Represents a Distance To Actor condition in the RoadRunner scenario logic. Specifies for the associated phase to end when the actor is a certain distance away from the reference actor.

    • DistanceToPointCondition — Represents a Distance To Point condition in the RoadRunner scenario logic. Specifies for the associated phase to end when an actor is a certain distance away from a specified point.

    • LongitudinalDistanceToActorCondition — Represents a Longitudinal Distance To Actor condition in the RoadRunner scenario logic. Specifies for the associated phase to end when an actor reaches a certain longitudinal distance from another actor.

    Examples

    collapse all

    Use addPhaseInSerial to create a SystemActionPhase object that specifies for the simulation to wait 5 seconds before starting the initial phase of the actor car.

    This example assumes that you have prior knowledge of working with RoadRunner in MATLAB®. Before proceeding, follow the steps outlined in Set Up MATLAB Environment for RoadRunner Authoring Functions to set up your scenario using MATLAB functions for scenario authoring.

    Create SystemAcionPhase Object

    Use addPhaseInSerial to add a system action phase, systemPhase, before the initial phase of the actor. Then, use addAction to specify the action type of the new phase as "WaitAction". To set the duration of the Wait action, use setEndCondition and specify the condition type as "DurationCondition". The DurationCondition object has a Duration property value of 5 seconds by default.

    systemPhase = addPhaseInSerial(rrLogic,initPhase,"SystemActionPhase",Insertion="before");
    systemAct = addAction(systemPhase,"WaitAction");
    duration = setEndCondition(systemPhase,"DurationCondition");

    Run the simulation by using the simulateScenario function. The system action phase systemPhase specifies for the simulation to wait 5 seconds before starting the initial phase of the actor car.

    simulateScenario(rrApp)

    Version History

    Introduced in R2025a