Debugging State Machines During Execution

Overview

You will only be able to fully follow along in this tutorial if you acquired Behavior Execution Engine as part of STK Enterprise.

Similarly to Logging and Debugging, a big part of integrating STK and SysML together is understanding how the SysML behaviors are affecting the behaviors of objects inside the STK Scenario. Being able to pause a SysML model execution at critical decision points as it modifies the STK Objects and settings allows you to see how all the systems and sub-systems are interacting. While STK provides a time-dynamic 3D view of what is going on in the system environment, the state machines show details of the interactions with sub-systems that are not displayed directly in STK. This also provides an avenue to show the interaction between systems represented in different tools. While this example focuses on STK, the systems represented in SysML may be using many different tools to represent all the systems, sub-systems, and components. Seeing the behaviors will help provide a cohesive picture across all the tools.

This section covers the following concepts:

Prerequisites

Prerequisite Description
Behavior Execution Engine Installation You must have installed Behavior Execution Engine and have the prerequisites for developing delegates for Behavior Execution Engine.
STK Installation You must have installed STK 12.9 or later.
Tutorial or Sample Project

You can start this section with the UAV Mission simulation project and delegate module project from the previous section. If you did not complete the previous section, you can use the files from the Behavior Execution Engine installation: \samples\tutorialUAVMission. That sample includes pre-built custom delegates for interacting with STK, as described in STK Connection and STK Integration.

Recommended Reading Before completing this section, you may want to read the following help topics:

Running State Machines Alongside STK

With all the customizability and configuration from the previous section, you can now execute the SysML Model to automate the creation of the STK Scenario. In this example, we have created a "Scenario First" model that requires an existing STK Scenario as an initial template. However, in general, that is not required. Some models may start with a completely blank STK Scenario and create everything from the data in the SysML model as the authoritative source of truth. Depending on the stereotypes configured on your SysML simulation element, the scenario may either be newly created, load automatically, or require you to have the scenario already loaded in STK prior to executing the model. For more details, see STK Simulation Configuration Stereotypes.

Figure 1: Debugging with state machines as the Behavior Execution Engine builds the UAV Route automatically in STK.

Instructions

  1. First, open the SysML Client. There are two ways to run the SysML Client to execute the Behavior Execution Engine:
    • Use the UI Plugin available inside STK. When inside STK, ensure that the buttons for the plugin are showing after installing. For more detailed instructions, see Install STK Plugin. If you can't find the button, you can always launch the UI for the SysML client through the Utilities menu. Note that if you load a new scenario, you may need to reinitialize the SysML Client UI inside the new scenario.
    • Launch the client separately. If you can't find the desktop shortcut or the "SysML Client Application" in your start menu, see detailed instructions for proper installation here: Installing Behavior Execution Engine. Whether you run from inside or outside STK, the connections between the SysML process and STK will not change.
  2. Start a session to host Behavior Execution Engine by hitting Continue on the initial panel.
  3. Once the session starts, load the MDZIP project from \samples\tutorialUAVMission\Simulation_Sample_Tutorial_UAVMission.mdzip.
  4. Open the Models tab and click on the various Diagrams to open the state machines.
  5. Arrange the state machines so that you can see them animate as they build out the STK Scenario. You can see more information on how to set breakpoints and interact with the diagrams on the Legend sub-tab or in the documentation here: Debugging with State Machines. The arrangement of these diagrams in relation to STK, the SysML client application, and any other tools you may have involved during execution will always be a challenge. Having multiple monitors can help, but it is up to you what makes the most sense based on what you need.
  6. Consider setting some breakpoints prior to starting the execution, and then on the Simulation tab, select the UAVAttachToStk simulation to run.
  7. Press Run Simulation and watch as the state machines highlight throughout the execution, stopping at any breakpoints you have set. As the execution proceeds through the behaviors, you will also see updates to the STK Objects as the execution builds out the route of the UAV as its onboard camera interacts with the environment to collect data.

The result should look something like the screenshot above. Combined with the other delegate debugging tools to develop and debug analysis tool interactions, you now have what you need to bridge the gap between SysML and Digital Mission Simulation.

Finish Tutorial