Retrospective on the State Behavior Design

Overview

Looking back at the design decisions in retrospect, we identify some of the strengths and shortcomings of our modeling approach.

Prerequisites

Prerequisite Description
Behavior Execution Engine Installation You must have installed Behavior Execution Engine.
Tutorial Project You must start this section with the Behavior Execution Engine simulation project from the previous section.

The Results

For making this training simple, the animals reference each other to determine whether they have won the race. This is problematic in several ways. Firstly, this is not scalable when you want to have more than one racer. If every animal had to reference every other animal, then you would have an explosion of logical checks that grow exponentially with every added racer.

There is also an issue with race conditions. Consider the Tortoise and Hare example race chart (below) as a reference. Depicted is a distance-over-time measurement of an example race between the Tortoise and the Hare, represented by the red and the green lines, respectively. The purple line denotes the race’s finish distance. The Tortoise is moving at a but slower rate, while the Hare is conversely moving very fast but takes breaks.

When you look at the whole picture, you can tell that, based on this data, the Tortoise made it across the finish line first. However, when you use a discrete time system of using a check-in rate and guards, the states only know about the data when they sample it. Since the code is checking in at a given rate, it could be the case where the Behavior Execution Engine samples their distances before either crosses the finish line, right to a point where both have crossed the finish line. They both technically crossed the finish line. The SysML standard does not determine which guard to trigger first. This nondeterministic nature leads to a potential for the hare to finish second but for the transition to the Winner state to be traversed. It is important to be mindful of these types of situations when designing models.

Tortoise and Hare Example Race Chart


Next Tutorial >