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:
-
standbyStateif the child element defines a start trigger. -
runningStatein 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
Actioninstances. -
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
Storyboardis executed by running its nestedStoryinstances (0..*). -
A
Storyis executed by running its nestedActinstances (1..*) -
An
Actis executed by running its nestedManeuverGroupinstances (1..*). EachManeuverGroupis executed as often as defined in itsmaximumExecutionCount. -
A
ManeuverGroupis executed by running its nestedManeuverinstances (0..*) -
A
Maneuveris executed by running its nestedEventinstances (1..*), following defined priorities. Each nestedEventis executed as often as defined in itsmaximumExecutionCount. -
An
Eventis executed by running its nestedActioninstances (1..*). -
An
Actionin aStoryboardis executed by applying the designated behavior to any actor defined in theManeuverGroup.
8.3.3 Execution patterns
ASAM OpenSCENARIO applies several execution patterns while running the Storyboard:
-
Parallel execution: Nested
StoryboardElementinstances are usually executed in parallel, for example, multipleActinstances in aStory. -
Loop execution:
Eventinstances andManeuverGroupinstances are executed in a loop.maximumExecutionCountstates the number of executions. -
Priority based execution:
Eventinstances are executed based on a defined priority. See Section 8.4.2, "Execution of an event" for details. -
Bulk action execution:
Actioninstances in aStoryboardare executed by applying the defined behavior to any defined actor concurrently.
8.3.3.1 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. |
8.3.3.2 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 37 shows a general representation of the same behavior:
8.3.3.3 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.