Set simulation rate for improved animation viewing
This block does not produce deployable code.
Use the Sample time parameter to set how often the Simulink® interface synchronizes with the wall clock.
The sample time of this block should be considered for human interaction with visualizations. The default is 1/30th of a second, chosen to correspond to a 30 frames-per-second visualization rate (typical for desktop computers).
Caution Choose as slow a sample time as needed for smooth animation, since oversampling has little benefit and undersampling can cause animation "jumpiness" and potentially block the MATLAB® main thread on your computer.
The model that contains this block must have its solver set to Fixed-step. The sample time for this block must be discrete. In addition, the block sample time and its optional offset time must be finite. The block sample time must be either greater than 0.0 or an inherited sample time (-1).
Specifies the ratio of simulation time to clock time. The default is 1 second of simulation time per second of clock time.
Setting the Sleep mode parameter to off lets you disable the pace functionality and run as fast as possible.
If you select this check box, the block outputs the "pace error" value (simulationTime minus ClockTime), in seconds. The pace error is positive if the simulation is running faster than the specified pace and negative if slower than the specified pace.
Specify the sample time (-1 for inherited). Larger sample times result in more efficient simulations, but less smooth in output pace when there are multiple Simulink time steps between pacer block samples. If the Sample time is too large, the MATLAB interface may become less responsive as MATLAB and Simulink calculations are blocked from running when the block puts the MATLAB interface to sleep.
The block optionally outputs the "pace error" value (simulationTime minus ClockTime), in seconds. The pace error is positive if the simulation is running faster than the specified pace and negative if slower than the specified pace.
Outputting the pace error from the block lets you record the overall pace achieved during the simulation or routing the signal to other blocks to make decisions about the simulation if the simulation is too slow to keep up with the specified pace.
The simulation pace is implemented by putting the entire MATLAB thread to sleep until it needs to run again to keep up the pace. The Simulink software is single threaded and runs on the one MATLAB thread, so only one Simulation Pace block can be active at a time.