Creating Your First SysML v2 Simulation

This tutorial will walk you through creating the model step by step. If at any time you would like to compare your version to the final tutorial version, please see the tutorial result example in <BEE Install Directory>/samples/sysml2/tutorialTortoiseVsHare/part-1/models. You can follow these instructions for more information on importing the file. Otherwise, we have provided an alternative format [.sysml] file as a reference to demonstrate the textual representation of the model.

As mentioned before, the first iteration of the model you are going to create for the race will make use of a traditional discrete time delay check in approach. While this approach functionally enables you to model the race and answer the basic question posed with Behavior Execution Engine, you will notice during execution that the fixed-step approach has the potential to result in imprecise solutions. Time to start creating your model of the race!

Section Description
Building the System Definition Diagram

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.

The Tortoise

At this point, you should start thinking about how to describe the behaviors of the two different racers as they perform the race simulation. You can use the process of constructing the behaviors to educate and guide aspects of defining the attributes and operations necessary for simulation of these systems. Now start creating some state diagrams.

The Hare

The Tortoise state behavior diagram was simple in that you know the tortoise starts the race and just runs until it ends. The hare, due to an inflated ego, is going to have a more complex behavior. The hare’s state diagram will have similar basic functions to the tortoise’s state diagram: it will have a waiting state, running the race state, and transition determine a “winner” or “loser” status.

However, you have added wrinkles. The hare could give the tortoise a head start, and the hare also could decide to take a quick (or not so quick) nap after taking the lead. Start by creating the framework for Hare’s behavior diagram.

Creating a Use Case Diagram

At this point, the state describing the arrogant behaviors of the hare is complete. At the beginning of the race, the hare has an opportunity to give the tortoise a head start if you provide a nonzero duration for “startingDelay.” Once the hare starts running, the behavior we described will have the hare to proceed to run until half way through the race. At that point the hare will consider resting if the tortoise is further behind in the race, assuming the “hasTakenANap” attribute is still “false.” The hare will continue to nap for a prescribed duration before resuming the race. Like the tortoise the determination of a "Winner” or “Loser” status is based on the status of the other reference part usage to the other racer.

A Retrospective on Design

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

Start Tutorial!