Updating Part Definitions
Overview
This step involves replacing functionality for the start and stop racing actions. When delegating for an action, it is important to keep in mind that Behavior Execution Engine will ignore any of the delegated action’s owned actions. For our model, this means the implementation details of the Racer diagram are no longer necessary, and can be deleted.
Prerequisites
Prerequisite | Description |
---|---|
Behavior Execution Engine Installation | You must have installed Behavior Execution Engine. |
Instructions
Updating Part Definitions for the System
- Open the System Architecture Modeler.
- Rename (or duplicate) your previously completed model or import the provided
TortoiseVsHare Part 1
sample XMI file.
In the first tutorial, you designed the current iteration of the model and simulation, as seen below, using a heartbeat mechanism to drive the simulation forward at a fixed cadence. With that consideration in mind, you used a DurationValue attribute for a check-in rate and a LengthValue for the keep track of the distance covered. This enabled you to perform simple math operations in assignment actions and expressions used by transitions.
Tortoise and Hare System Definition diagram
Execution does not require the transitions to have names. We are adding them in this tutorial so that you can differentiate between all the different transitions as they occur in the log with names rather than their element ids. See the troubleshooting page on how to locate the element ids.
Using delegates in this iteration grants you the power of precise time evaluation related to the events. This means you may do away with the constant fixed-cadence check-in. You will also drop the use of assignment actions for tracking distance and instead have Behavior Execution Engine enable better event finding and comparative operations. Go ahead and modify the part definitions to reflect these changes.
- Open the System Definition diagram.
- Remove the attribute
checkInRate
for theRace
part definition. - Remove the action
updateDistance
for theRacer
part definition. - Remove the value expression from the
distanceCovered
for theRacer
part definition.
Updated Tortoise and Hare System Definition diagram
You may have noticed that we removed the initial value for distanceCovered
attribute. Delegating an attribute from the model
requires that the attribute does not have a bound or initial value. The only exception to this rule is if the value is default.
Instead of simple math operations in the assignment actions, you are going to create a custom implementation of
a ScalarQuantityValue to handle the motion of the racers and facilitate the comparisons you need.
As part of this process, you will implement a custom math function that will enable you to find exactly when racers cross distance thresholds, so you can perform comparative operations regardless of the values specified for the race distance or the runners' speeds. Because the simulation will no longer depend on a fixed-step process, the execution speed will dramatically increase, and the trace will reduce down to only the more interesting key events.
Next Section >