OpenScenarioEngine::GetDuration incomplete w.r.t. to Rules, ConditionEdges, Delay, or other Conditions
I just checked the GetDuration method for completeness and have the following concerns:
It generally works, but only with a lot of restrictions...
- The current implementation only checks the duration of the
SimulationTimeCondition
s defined within theStoryboard
. It already does a good job by selecting the one with the smallest value. But that's it. - It does not consider delays, condition edges, and rules (eg. EQUAL_TO, LESS_THAN, etc.)
- AFAIK it is not not possible to parse "LESS_THAN" correctly, as the engine does not know about the external step width, i.e how much should it add to value to calculate the duration. In such cases it's just an educated guess.
- We should also consider that there are OTHER conditions involved (e.g. ByEntityConditions) and at least warn if there is an additional condition combined with a SimulationTimeCondition
A note fore completeness: In my initial analysis, I also was afraid that Act
s might also interfere, but if I understand the standard right, simulation will continue, even if there are no more acts to play. So no issues with acts ;)
TLDR:
GetDuration
for the current tree would say "5s", which is not right or just an educated guess at best.
<Storyboard>
...
<StopTrigger>
<ConditionGroup>
<Condition name="ReachedEndPosition" delay="0" conditionEdge="rising">
<ByEntityCondition>
<DistanceCondition ... />
</ByEntityCondition>
</Condition>
<Condition name="EndTime" delay="10" conditionEdge="falling">
<ByValueCondition>
<SimulationTimeCondition value="5.0" rule="lessThan"/>
</ByValueCondition>
</Condition>
</ConditionGroup>
</StopTrigger>
</Storyboard>