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 the STK Enterprise application.
Similar to Logging and Debugging, a big part of integrating the Ansys Systems Tool Kit® (STK®) application 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 enables you to see how all the systems and subsystems are interacting. While the STK application provides a time-dynamic 3D view of what is going on in the system environment, the state machines show details of the interactions with subsystems that are not displayed directly in the application. This also provides an avenue to show the interaction between systems represented in different tools. While this example focuses on the STK application, the systems represented in SysML may be using many different tools to represent all the systems, subsystems, 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 Application Installation | You must have installed the STK application version 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 prebuilt custom delegates for interacting with the STK application, 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 the STK application
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, there is 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 the STK application 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 the STK application
Instructions
-
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 the STK application. When inside, ensure that the buttons for the plugin are showing after installation. 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. 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 in Installing Behavior Execution Engine. Whether you run from inside or outside the STK application, the connections between the SysML process and the STK application will not change.
- Start a session to host Behavior Execution Engine by hitting Continue on the initial panel.
- Once the session starts, load the MDZIP project from \samples\tutorialUAVMission\Simulation_Sample_Tutorial_UAVMission.mdzip.
- Open the Models tab and click on the various Diagrams to open the state machines.
- 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 subtab or in the documentation for Debugging with State Machines. The arrangement of these diagrams in relation to the STK application, 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 to determine what makes the most sense based on what you need.
- Consider setting some breakpoints prior to starting the execution, and then on the Simulation tab, select the UAVAttachToStk simulation to run.
- 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