User`s guide
Building for the Rapid Simulation Target
13-13
Simulation Performance
It is not possible to predict accurately the simulation speed-up 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
speed-up 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 95 or Windows NT.
This simple file (for Windows 95 or Windows NT) is created with any text editor
and executed by typing the filename, for example,
mybatch,wherethenameof
the text file is
mybatch.bat:
rsimtfdemo -f rsimtfdemo.mat=run1.mat -o results1.mat -s 10.0
rsimtfdemo -f rsimtfdemo.mat=run2.mat -o results2.mat -s 10.0
rsimtfdemo -f rsimtfdemo.mat=run3.mat -o results3.mat -s 10.0
rsimtfdemo -f rsimtfdemo.mat=run4.mat -o results4.mat -s 10.0
In this case, batch simulations are run using the four sets of input data in files
run1.mat, run2.mat,andsoon.rsim 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,locatedinmatlabroot/toolbox/rtw/rtwdemos. These examples