8.3 Execution

A storyboard element is defined as executing when the element either resides in standbyState or in runningState.

When a storyboard element enters runningState, its direct child elements are set into:

  • standbyState if the child element defines a start trigger.

  • runningState in all other cases.

8.3.1 Duration of an execution

The duration of an execution is determined by three factors:

  • Waiting time for start triggers.

  • Execution time for nested Action instances.

  • Waiting time for stop triggers.

There is no other runtime aspect that consumes simulation time.

8.3.2 Execution framework

The execution of a scenario follows a general nested pattern:

  • A Storyboard is executed by running its nested Story instances (0..*).

  • A Story is executed by running its nested Act instances (1..*)

  • An Act is executed by running its nested ManeuverGroup instances (1..*). Each ManeuverGroup is executed as often as defined in its maximumExecutionCount.

  • A ManeuverGroup is executed by running its nested Maneuver instances (0..*)

  • A Maneuver is executed by running its nested Event instances (1..*), following defined priorities. Each nested Event is executed as often as defined in its maximumExecutionCount.

  • An Event is executed by running its nested Action instances (1..*).

  • An Action in a Storyboard is executed by applying the designated behavior to any actor defined in the ManeuverGroup.

8.3.3 Execution patterns

ASAM OpenSCENARIO applies several execution patterns while running the Storyboard:

  • Parallel execution: Nested StoryboardElement instances are usually executed in parallel, for example, multiple Act instances in a Story.

  • Loop execution: Event instances and ManeuverGroup instances are executed in a loop. maximumExecutionCount states the number of executions.

  • Priority based execution: Event instances are executed based on a defined priority. See Section 8.4.2, "Execution of an event" for details.

  • Bulk action execution: Action instances in a Storyboard are executed by applying the defined behavior to any defined actor concurrently. Parallel execution

When nested StoryboardElement instances are executed, the parent element forks into different execution paths. The parent execution completes when all execution paths have joined into a single path. Execution time of the parent element is defined by the nested element that takes the longest time to execute, as shown in Figure 35.

As an example, an Event completes when all concurrently executed Action instances are completed. The Action instance that took the longest time to execute defines the execution of the enclosing Event instance.

The execution of a Storyboard does not complete when all nested stories have been completed. See Section 8.4.7, "Execution of a storyboard" for more information.
When referencing parallel actions and making them dependent of each other, the creation of deadlocks or nondeterministic race conditions shall be avoided.
Figure 35. Petrinet model shows the parallel execution pattern with three nested elements Loop execution

ManeuverGroup and Event instances are executed as many times as specified by maximumExecutionCount. The executions are performed sequentially. Figure 36 illustrates how a ManueverGroup or an Event are executed when maximumExecutionCount is set to three:

Figure 36. Petrinet model that shows the loop execution pattern with three executions per element

Figure 37 shows a general representation of the same behavior:

Figure 37. Petrinet model that shows a general loop execution pattern Bulk action execution

A bulk action is a PrivateAction that must handle more than one entity at a time. This can occur when the actors of the enclosing ManeuverGroup are resolved to multiple ScenarioObject instances, rather than to a single one. Executing a bulk action is called a bulk execution. It applies the PrivateAction in parallel to all given ScenarioObject instances. Figure 38 shows how a bulk action is ran. It completes when all its child actions complete. The behavior is applied to multiple actors, that is ScenarioObject instances, in parallel.

A bulk action is in runningState as long as there is one child action instance in runningState. It reaches completeState with endTransition only under the condition that all child actions reach completeState with an endTransition. Otherwise the bulk action reaches completeState with stopTransition.

Figure 38. Petrinet model that shows a bulk execution of an action