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:
-
The
roots
slot of a Moxie simulation instance specification - The simulation console
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.
- Open the project from the previous section.
- 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.
-
In the center pane,
select the
roots
slot and click . -
Select the Simulation >
uav.powerSystem
instance specification. Then click then . This instructs Moxie to start theStructure::PowerSystem::PowerSystem State Machine
when the simulation begins, because thePowerSystem State Machine
is the classifier behavior for the classifier (thePowerSystem
block) of theuav.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.
- 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.
-
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 ). Do not use the Run () button on the diagramming toolbar, as this will not trigger Moxie to execute.
-
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. - Save your work before continuing.
Next Tutorial!