Rerunning a Simulation Without Recompiling - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : Using MapleSim : Simulating a Model : Rerunning a Simulation Without Recompiling

Rerunning a Simulation without Further Compiling


Use the Rerun Simulation feature in MapleSim to rerun your simulation without having to recompile the entire model. This capability significantly reduces the time required to update and test changes to parameters and initial conditions (ICs), making your workflow more efficient.

Initial Simulation

First, use the Parameter Block on your workspace to define the parameters that you would like to be able to adjust when you rerun your model. Ensure that that Make Parameters Available for Rerun is selected. For more information, see tasks,building,parameterSets,usingParameterBlocks

Next, click Play ( ) to build and simulate the model.

When you first run your model, MapleSim performs two main tasks:

1. 

Constructing the Simulation Model, which involves compiling the code and generating the necessary equations.

2. 

Integrating the Simulation Model and Event Handling.

After these processes are complete, MapleSim automatically creates a rerun module, which you can reuse after the model has finished its simulation run.

Rerun Simulation Process


After the initial simulation, you can then use the rerun module. This module allows you to rerun the simulation using the previously built model, avoiding the need for a full recompilation.

 

To use the Rerun Simulation feature:

1. 

Click Show Rerun Panel ( ) in the main toolbar to open the Rerun Simulation panel.

2. 

In the Rerun Simulation panel, you can modify parameters and initial conditions that have been defined and exposed to the rerun module.

Note: Only parameters within Parameter Blocks with Make Parameters Available for Rerun set to true can be adjusted here.

3. 

After making changes, click Rerun ( )  in the panel to re-initialize (if necessary) and rerun the simulation with the new parameter values. The simulation uses the previously built model, allowing for quick feedback and iterative tuning.



Notes:

• 

If you alter parameters or ICs at the main level of the model (outside the rerun module), you must rerun the entire simulation to generate a new rerun module that includes these changes.

• 

You can save your simulation settings within the Rerun Simulation panel, make further adjustments, and rerun the simulation multiple times to iteratively refine your model.

 

An Example

The example below illustrates the use of the Rerun Simulation feature as applied to a simple model. The example is intended to provide a look at the process of creating a model with the ability to quickly update certain parameters, initial conditions, etc. without having to recompile the entire model.

1. 

From the File menu, select New, then select Model. Alternatively, press Ctrl + N.

2. 

In the newly created Model Workspace, notice the Parameter Block automatically added to the model. By default, the Parameter Block is named sysParams.

 

3. 

From the Library Components panel, add the following components to the Model Workspace:

• 

From 1-D Mechanical, select Common, then add an Inertia component.

• 

From 1-D Mechanical, select Common, then add a Rotational Spring Damper component.

• 

From 1-D Mechanical, select Common, then add a Rotational Fixed Component.

4. 

Connect the components as shown below.

5. 

Attach a probe to the Inertia component

6. 

Double-click sysParams. Notice this brings up the Parameter settings window.

7. 

In the Name field, enter Damping, then select Rotational Damping Constant for the Type, enter 1 for the Default Value and select  for the Default Units. Press Enter. This creates another row to which you can add another Parameter.

8. 

In the newly created row, enter Inertia in the Name field, Inertia [[kg m2]] in the Type field, enter 1 for the Default Value and select kg m2 for the Default Units.

9. 

Click Diagram View (Home) ( ) to return to the Model Workspace.

10. 

In the Model Workspace, click the Inertia component, then select Simulation Settings ( ).

11. 

Under Parameters-> General, change the Moment of Inertia value from the default to Inertia (the same as the Name field in step 8).

12. 

Similarly, in the Model Workspace, click the Rotational Spring Damper, then select Simulation Settings ( ).

13. 

Under Parameters-> General, change the Damping Constant value from the default to Damping (the same as the Name field in step 7).

Now, you are automatically using the values in the model as defined in the Parameter Block.

Notice that the Make Parameters Available for Rerun option has been selected. This means that, after the model has run one complete simulation, the parameters that are defined in the Parameter Block can be retuned and used in follow up simulation, without having to recompile the entire model.

You can turn off this option by clearing the Make Parameters Available for Rerun check box.

14. 

Press Play ( ) to run the simulation.

15. 

Once the simulation has finished running, click Rerun ( ) to open the Rerun Simulation panel.

16. 

In the Rerun Simulation panel, change the Initial Velocity to 10 rad/s.

17. 

Click Rerun Simulation ( ).

18. 

After the simulation has finished you can examine your results in the Analysis Window.

19. 

Note, in the Rerun Simulation panel, in addition to the parameters defined in the Parameter Block and the initial conditions, you can also change simulation settings such as, the duration of the simulation and error tolerances.

20. 

To save these Rerun results, first select the Simulation Results tab on the side of the Analysis Window. This will open the Simulation Results panel.

21. 

In the Stored Results section, right-click on Latest Rerun.

22. 

Assign a name to this Rerun Simulation.

23. 

Go back to the Rerun Simulation panel and change the Damping value to 10.

24. 

Rerun the simulation.

25. 

Notice the new rerun simulation, plotted alongside the named simulation from step 22.

 

See Also

Using Parameter Blocks

The Rerun Simulation Results Tab