Running a Simulation with Moxie

Overview

Once you have described both the structure and behavior of your system, you are ready to run a simulation! If you completed the previous sections, then you already modeled a simple system of a UAV, its power system, and its onboard computer. In this section, you will execute the state machine for your system and observe its operation.

This section covers the following concepts:

Figure A1: Running a simulation configuration

Prerequisites

Prerequisite Description
Moxie Installation You must have installed Moxie.
Tutorial Project You must start this section with the Moxie simulation project from the previous section. If you did not complete the previous section, you can use the following project from the Moxie installation: \documentation\tutorialFiles\01\SimpleStateMachines.mdzip

You could instead use a preexisting project that you configured for Moxie simulation, but the names of the elements in your project might not match the names in this section.

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

Instructions

Set the root instance specifications

When you run a simulation, the Moxie Engine uses the roots slot of the simulation instance specification to determine what classifier behaviors (e.g., state machines) to start. This roots slot must specify the instance specifications that own those classifier behaviors.

  1. Open the project from the previous section.
  2. In the Containment Tree, double-click the Simulation > simulation instance specification to open its specification window. Select Slots from the left pane of the window.
  3. In the center pane, select the roots slot and click Create Value.
  4. Select the Simulation > uav.powerSystem instance specification. Then click OK then Close. This instructs Moxie to start the Structure::PowerSystem::PowerSystem State Machine when the simulation begins, because the PowerSystem State Machine is the classifier behavior for the classifier (the PowerSystem block) of the uav.powerSystem instance specification.

Run the simulation

  • If you do not have STK installed, and you have not yet set the DelegateModuleHomePath for your environment, then configure your delegate module home directory now (e.g., C:\Moxie\DelegateHome).
  • If you previously installed any of the UAV mission delegates from the final tutorial or from the sample fully-completed tutorial included in the Moxie installation, then remove them from your delegate module home directory before running the simulation.

As it runs, the simulation will log messages to the simulation log file and the simulation console. These messages can be especially helpful for debugging simulations involving complex state machines and delegates that connect to external analysis tools.

  1. If the Simulation Console window is not already displayed (typically at the bottom of your No Magic modeling tool), click Window > Simulation to open it.
  2. Select the Simulation Configuration from the Simulation Execution toolbar and click the Run button ().

    Figure B1: Running the simulation configuration

    When executing a Moxie simulation, make sure to use the Run () button on the main Simulation Execution toolbar. If you do not see the toolbar, select View > Main Toolbars > Simulation Execution. You can also run a simulation from a simulation configuration diagram by right-clicking in the diagram and selecting Simulation > Run (or by pressing CtrlAltX). Do not use the Run () button on the diagramming toolbar, as this will not trigger Moxie to execute.

  3. Verify that the simulation completes successfully.
    If the simulation completes successfully, the following notification displays briefly in the lower-right corner of your No Magic Modeling Tool:

    Figure B2: Simulation Completed notification

    If the simulation fails to complete due to an error, the following notification displays briefly in the lower-right corner of your No Magic Modeling Tool:

    Figure B3: Simulation terminated notification

    Either way, you can also see the message in the Simulation Console window.
  4. Save your work before continuing.
To learn more about running a simulation using Moxie, see the Running Simulations help. In particular, see the following sections:

Next Tutorial!