Create the System Definition Diagram for the Race

Overview

To execute a simulation with Behavior Execution Engine, you need to have a model with a case to target. It is a good practice to design one, so that we can create a use case with actors and a subject.

Prerequisites

Prerequisite Description
Behavior Execution Engine Installation You must have installed Behavior Execution Engine.
Recommended Reading Before completing this section, you may want to read the following help topics:

Instructions for Creating a New Project

  1. Open the System Architecture Modeler web interface.
  2. Create a new project by selecting a Blank Project as the Creation method.
  3. Ensure SysML v2 is selected as the type.
  4. Give it a useful name such as TortoiseVsHare Part 1 and click Create.

Instructions

Creating the System Definition Diagram

The first thing to do is to create the structural representation with the part definitions necessary to represent the “system”, which consists of the racers and the race. In this case, you have two primary elements: the race itself and a racer who will participate in the race.

  1. Create a new General Diagram and give it the name System Definition.
  2. Create a Part Definition and name it Race.
  3. Create another Part Definition and name it Racer.

Structure Diagram showing Race and Racer part definitions

Creating the different racers

Since you know both the tortoise and the hare are going to be racers, you can create part definitions for them that are specializations of the Racer part definition. This will enable you to inherit features from the base definition but provide differing behavioral models for each of them.

  1. Create a Part Definition and name it Hare.
  2. Draw a Specialization Arrow from the Hare part definition to the Racer part definition so that Hare specializes (inherits from) Racer.
  3. Repeat this process for the Tortoise.

Specializations of the Racer part definition

Importing common libraries for execution

There are a few standard libraries that are useful for execution. Over the course of this tutorial, we will be using four of them. For specifying durations of time, we are going to use the “DurationValue”, “LengthValue”, and “SpeedValue” types from “ISQBase”. The “ScalarValues” package gives us the “Boolean” and “String” types. We will be using the “SI” package to write units in our expressions. Finally, we will be using the “Time” library for specifying specific “TimeInstants”. Behavior Execution Engine only supports TimeInstantValues in the form of attributes typed by “Iso8601DateTime”.

  1. Right click on the root package in the model tree explorer.
  2. Select Import library.
  3. Expand Standard libraries, select the ISQBase package, and press the Import button.
  4. Repeat the above steps for ScalarValues, SI, and Time libraries.

Libraries Imported into the model tree explorer

Adding properties to the Race and Racer

With the basic model defined, you can begin to explore what types of information you need to adequately describe the individual elements so Behavior Execution Engine can simulate them. In the case of the race, you can easily imagine there are a few attributes that you need to describe it, such as the start time and distance for the runners to cover. For the racers, you will need them to start and stop racing. You will need attributes to describe how fast they can run and how far they have run at any given time during the simulation. Since the racers will need to “know” about each other, you also need to describe the relationship between the racers and the race.

  1. For the Racer part definition do the following:
    1. Create an Attribute with the name distanceCovered, set the definition to LengthValue, and give it an initial value of 0 [m].
    2. Create an Attribute with the name raceFinished, set the definition to Boolean, and give it an initial value of false.
  2. For the Racer part definition do the following:
    1. Create an Attribute with the name distanceCovered, set the definition to LengthValue, and give it an initial value of 0 [m].
    2. Create an Attribute with the name raceFinished, set the definition to Boolean, and give it an initial value of false.

      Note - "isInitial" in SysML indicates that the value of an attribute is valid at the start of the owning Occurrence (such as a Part, Item, Action, or State), but that the value can change over the life of that Occurrence. If "isInitial" is false, this indicates that the attribute is bound to have that value for the entire life of the Occurrence.

    3. Create an Attribute with the name topSpeed and set the definition to SpeedValue.
    4. Create an Attribute with the name name and set the definition to String.
    5. Create an Action and name it startRacing.
    6. Create an Action and name it stopRacing.
    7. Create a State and name it existing.
  3. Create a Part with the name race.
    1. Draw a Definition Arrow from the Race part to the Race part definition so that race is defined by (inherits from) Race.
    2. Draw a Referential Containment Arrow from the Racer part definition to the Race part so that Racer can reference Race.
  4. For the Hare part definition do the following:
    1. Expand the Hare part definition in the model tree explorer.
    2. Redefine the inherited ^existing state.
    3. Redefine the inherited ^name attribute and give it a bound value of hare.
  5. For the Tortoise part definition do the following:
    1. Expand the Tortoise part definition in the model tree explorer.
    2. Redefine the inherited ^existing state.
    3. Redefine the inherited ^name attribute and give it a bound value of tortoise.

Diagram of the initial model

Configuring part usages as non-composite "references" to other parts is a way to have access to another part or actor without that part being considered physically inside the owning usage. When creating and ultimately destroying parts, destroying a part will also destroy any owned composite parts. So, consider whether each part is a physical sub-component of the owner. If not, it should probably not be a "composite" part and instead be a reference.

If you your diagram is missing any information that exists in the model but is not visible, you can right click on an element and click the Show/hide features or Show/hide relationships buttons.


Next Section >