Simulation pacing enables you to slow down a simulation to understand and observe the system's behavior. Visualizing simulations at a slower rate makes it easier to understand underlying system design, identify design issues and demonstrate near real-time behavior. You can view the results and inspect your system while the simulation is in progress. Slow down animations in scopes, to observe how and when the system changes state.
Simulation pacing is useful in scenarios where one simulation-second is completed in a few wall clock time milliseconds. You can also manually interact with the model while it is running at a slower rate, which can help you to explore how your changes affect the simulation behavior. Note that the simulation will run at an approximation of the specified pace.
To start, specify the rate of simulation. This rate is a ratio of elapsed simulation time to elapsed wall clock time.
This example shows how to use simulation pacing during a simulation.
In the Simulation menu, click Pacing Options
In the Simulation Pacing Options dialog, select the Enable pacing to slow down simulation. On enabling, the specified pace gets automatically aplied to the simulation.
Select the pace at which the model should run by using the slider or entering the pace in the Simulation time per actual second field. This field also accepts values outside of the range on the slider. The value entered in the field can only be a finite positive number.
On simulating the model, you can watch the simulation progress at the specified pace in the scope. You can also change the pace through the dialog box and enable/disable pacing while your simulation is running.
To enable Pacing from the command line, use
'EnablePacing', 'on') command. To enter the value use
set_param(model, 'PacingRate', value) where the value is a
finite positive number.
run button changes to , when a simulation is run with Pacing enabled.
The status bar indicates if a simulation is running with pacing enabled. It also
indicates if the simulation can not run at the specified pace.
This example shows how to adjust simulation pacing while interacting with the simulation using Dashboard library blocks.
The example uses the
sldemo_househeat model, which is a system
that models the thermal characteristics of a house, its outdoor environment, and a
house heating system. This model calculates heating costs for a generic
In this example, observe the effects of different outside temperatures on the heating cost. The goal of this example is to determine the outside temperature for which the heating cost stays stable at 15 dollars. Use the Knob block from the Dashboard library to change the outside temperatures while the simulation is running. This model is set up such that it simulates the system over a period of several days.
Open the model.
Knob block, from the Dashboard library. To control the
temperature, connect it to the Average Outdoor Temperature block. To connect the
blocks, double-click the Knob block, then click on the Average Outdoor Temperature
block and confirm your selection connect in the Knob block dialog box by selecting
the Connect radio button in the Knob block dialog box.
In the Simulation menu, click Pacing Options. Set the pace to an approximation of 0.8 simulation time per wall clock second.
Simulate the model. Observe the simulation run in the scope.
While the simulation is running, change the Average Outdoor Temperature in the Knob block to observe the heat cost. On observing the simulation at a slower pace, you can see that the heat cost is 15 dollars at 61 degrees Farenheit.
Simulation pacing is not compatible with:
Simulation pacing is not supported in rapid accelerator mode