Real-Time Workshop    

Simulation Performance

It is not possible to predict accurately the simulation speedup of an rsim simulation compared to a standard Simulink simulation. Performance will vary. Larger simulations have achieved speed improvements of up to 10 times faster than standard Simulink simulations. Some models may not show any noticeable improvement in simulation speed. The only way to determine speedup is to time your standard Simulink simulation and then compare its speed with the associated rsim simulation.

Batch and Monte Carlo Simulations

The rsim target is intended to be used for batch simulations in which parameters and/or input signals are varied for each new simulation. New output filenames allow you run new simulations without over-writing prior simulation results. A simple example of such a set of batch simulations can be run by creating a .bat file for use under Microsoft Windows.

This simple file for Windows is created with any text editor and executed by typing the filename, for example, mybatch, where the name of the text file is mybatch.bat.

In this case, batch simulations are run using the four sets of input data in files run1.mat, run2.mat, and so on. The rsim executable saves the data to the corresponding files specified after the -o option.

The variable names containing simulation results in each of these files are identical. Therefore, loading consecutive sets of data without renaming the data once it is in the MATLAB workspace will result in over-writing the prior workspace variable with new data. If you want to avoid over-writing, you can copy the result to a new MATLAB variable prior to loading the next set of data.

You can also write M-file scripts to create new signals, and new parameter structures, as well as to save data and perform batch runs using the bang command (!).

For additional insight into the rapid simulation target, explore rsimdemo1 and rsimdemo2, located in matlabroot/toolbox/rtw/rtwdemos/rsimdemos. These examples demonstrate how rsim can be called repeatedly within an M-file for Monte Carlo simulations.


  Running a Rapid Simulation Limitations