Configuring a Moxie Simulation Project

Overview

Before you can run a simulation with Moxie, you need to ensure your No Magic project (.mdzip) is configured correctly. There are two ways to do this:

  1. Create a new project using the Moxie simulation project template. Use this option if you would like to start from scratch with a new project.
  2. Update an existing project to use Moxie. Use this option if you already have a model or state machines in a project and you would like to configure that project to use Moxie.

This section covers the following concepts:

Figure A1: The Moxie simulation project packages

Prerequisites

Prerequisite Description
Moxie Installation You must have installed Moxie.
Recommended Reading Before completing this section, you may want to read the following help topics:

Instructions for creating new projects

  1. In your No Magic modeling tool, select File > New Project... (or press CtrlShiftN).
  2. On the left side of the New Project dialog box shown in Figure B1, in the Simulation category, select Moxie Simulation Project.
  3. Enter a Name and Project location.
  4. (Optional) Select the Create directory for project and related data checkbox. This makes it easier to see which files are associated with which project.
  5. Click OK when finished.

    Figure B1: Creating a Moxie simulation project

  6. In the Containment Tree, you should now see the Moxie-Base, Moxie-Core, and Simulation packages. The Simulation package should contain a Simulation Configuration, a Simulation Configuration Diagram, and a simulation instance specification named simulation.
  7. (Optional) Double-click the Simulation Configuration Diagram to open it and drag the simulation instance specification onto the diagram. This shows all of the simulation-related parameters in one location.
  8. (Optional) In the Simulation Configuration Diagram, select the animationSpeed property and enter 80. This slows down the state machine animation so that you can easily observe each transition when you run the simulation.
  9. Save your work before continuing.
To learn more about the components that make up a Moxie simulation project, see Running Simulations. In particular, see the following sections:

Next Section >

Instructions for updating existing projects

Import the Moxie model libraries

  1. Open your No Magic project file (.mdzip).
  2. In your No Magic modeling tool, select Options > Project Usages and click Use Project.
  3. In the Use Project dialog box shown in Figure C1, select From predefined location.
  4. In the Paths to used projects box, select <install.root>\modelLibraries.
  5. In the list of .mdzip files, select Moxie-Core.mdzip and click Finish.

    Figure C1: Importing the Moxie model libraries

    If you do not see Moxie-Core.mdzip in the list, Moxie is not installed correctly. Please revisit the Installation Guide and make sure you have completed all of the steps.

  6. Close the Used Projects window.
  7. In the Containment Tree, you should now see the Moxie-Base and Moxie-Core packages.

Create a simulation configuration

  1. In the Containment Tree, right-click the top-level Model and select Create Element (or press CtrlShiftE).
  2. In the General category, select Package, enter Simulation as its name, and press Enter.
  3. Right-click the Simulation package and select Create Diagram (or press CtrlShiftD).
  4. In the Simulation category, select Simulation Configuration Diagram, enter Simulation Configuration Diagram as its name, and press Enter.
  5. In the Containment Tree, notice the hammer/wrench icon directly under the Simulation Configuration Diagram. This icon represents the simulation configuration, which was automatically created for you when you created a simulation configuration diagram.
  6. Right-click the icon, select Rename (or press F2), enter Simulation Configuration as its name, and press Enter.
  7. (Optional) In the Containment Tree, drag the Simulation Configuration Diagram into the Simulation Configuration. This keeps them grouped together as you add more elements and move things around, in addition to saving you some space in the Containment Tree.

Create a simulation instance specification

  1. In the Containment Tree, right-click Moxie-Base > Simulation > SimulationSpecification and select Tools > Create Instance....
  2. In the 1. Select parts page, clear and reselect SimulationSpecification to ensure that no sub-elements are selected, then click Next >.
  3. In the 2. Select a package page, select the Simulation package and click Next >.
  4. In the 3. Create a diagram page, clear the Create a new diagram checkbox and click Finish.
  5. In the Containment Tree, right-click the new simulationSpecification instance specification, select Rename (or press F2), enter simulation as the instance specification name (without changing the classifier after the :), and press Enter.

    Figure C2: The simulation configuration, diagram, and instance specification

  6. (Optional) Double-click the Simulation Configuration Diagram to open it and drag the simulation instance specification onto the diagram. This shows all of the simulation-related parameters in one location.

You will still need to set the simulation instance specification's roots slot before running a simulation.

Set the simulation configuration properties

  1. In the Containment Tree, right-click the Simulation Configuration and select Specification (or press Enter).
  2. In the upper-right corner of the Simulation Configuration Specification window shown in Figure C3, select Expert in the Properties filter.
  3. Click the cell to the right of Execution Target, search for simulation, and select simulation : SimulationSpecification.
  4. Click the cell to the right of Engines Priority then click the ... button in the upper-right corner of the cell.
  5. In the Engine Management and Ordering dialog box, select the Moxie Engine.
  6. Click Up until Moxie Engine is at the top of the list, then click OK.
  7. You should now see Moxie Engine at the top of the Engines Priority list. Click Close to exit the window.

    Figure C3: The simulation configuration properties

  8. Save your work before skipping to the final section of this tutorial.
To learn more about the components that make up a Moxie simulation project, see the Running Simulations. In particular, see the following sections:

Final Section >