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 nestedStory
instances (0..*). -
A
Story
is executed by running its nestedAct
instances (1..*) -
An
Act
is executed by running its nestedManeuverGroup
instances (1..*). EachManeuverGroup
is executed as often as defined in itsmaximumExecutionCount
. -
A
ManeuverGroup
is executed by running its nestedManeuver
instances (0..*) -
A
Maneuver
is executed by running its nestedEvent
instances (1..*), following defined priorities. Each nestedEvent
is executed as often as defined in itsmaximumExecutionCount
. -
An
Event
is executed by running its nestedAction
instances (1..*). -
An
Action
in aStoryboard
is 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
StoryboardElement
instances are usually executed in parallel, for example, multipleAct
instances in aStory
. -
Loop execution:
Event
instances andManeuverGroup
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 aStoryboard
are 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
.