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 tab, select Run > Simulation Pacing
In the Simulation Pacing Options dialog, select Enable pacing to slow down simulation. On enabling, the specified pace gets automatically applied 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 wall clock 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.
You can use Dashboard blocks to view signals and tune variables and parameters in your model while slowing a simulation using simulation pacing. Using Dashboard blocks with simulation pacing allows you to build an intuitive understanding of your model and how it responds to changes as you tune parameters in your model.
The example model uses simulation pacing to slow the simulation pace to approximately equivalent to wall clock time, or one simulation second per one wall clock second. You can push the Signal Select button to select whether the sine wave or sawtooth input signal passes to the output, which is visualized using a Dashboard Scope block.
Open the model and run a simulation. During the simulation, press and release the Signal Select button and observe the effect on the output signal.
For more information about creating the example model, see Control Merging Signals with the Push Button Block.
Simulation pacing is not compatible with:
Simulation pacing is not supported in rapid accelerator mode