For workflows that involve multiple parallel simulations and logging of large amounts of
data, you can create simulation sets by using an array of
Simulink.SimulationInput objects. This is useful in scenarios like model testing,
experiment design, Monte Carlo analysis, and model optimization.
Using arrays of
Simulink.SimulationInput objects simplify
the running of multiple simulations and running them in parallel. With the Parallel Computing Toolbox™, you can use the
commands to run the simulations in parallel.
parsim command distributes each simulation to your workers to
decrease your overall simulation time. The
parsim command automates the
creation of a parallel pool, identifying file dependencies and managing build artifacts for
accelerator and rapid accelerator simulations.
batchsim command offloads the simulations to the compute cluster.
The execution of the simulations takes place on the cluster, giving you the ability to carry out
other tasks while the batch job is processing, or close the client MATLAB® and access the batch job later.
In the absence of a Parallel Computing Toolbox license, the
parsim behaves like the
command. The simulations then run in serial.
batchsim command uses the Parallel Computing Toolbox™ license to run
the simulations on compute cluster.
batchsim runs the simulations in serial if
a parallel pool cannot be created. If Parallel Computing Toolbox license is not used,
batchsim errors out.
You can make changes to your model using the
Simulink.SimulationInput object and run a simulation in parallel with those changes.
Simulink.SimulationInput object, overrides the
values in the model. The simulation uses the values in the
Simulink.SimulationInput object rather than the values defined in the model. This
way, you can change the model without dirtying it. The
Simulink.SimulationInput object allows you to change these settings in your model:
Simulink.SimulationInput object, you can also specify
MATLAB functions to run at the start and the end of
each simulation by using
When you use
Simulink.SimulationInput objects, the model
parameters are restored after the simulation ends. See Run Parallel Simulations Using parsim.
When the pool is not already open and simulations are run for the first time, simulations take an additional time to start. Subsequent parallel simulations are faster.
Outputs errors in the simulation output object for easier debugging
Compatible with rapid accelerator and fast restart
Compatible with file logging (to facilitate big data)
Compatible with MATLAB Parallel Server™ in addition to local parallel pools
Capable of transferring base workspace variables to workers
Avoids transparency errors
The Simulation Manager allows you to monitor multiple parallel simulations. It shows the
progress of the runs as they are running in parallel. You can view the details of every run such
as parameters, elapsed time, and diagnostics. The Simulation Manager acts as a useful tool by
giving you the option to analyze and compare your results in the Simulation Data Inspector. You
can also select a run and apply its values to the model. For more information, see
Simulink.SimulationOutput object, which contains the
simulation outputs, captures error messages and the simulation metadata. When you select the
Data Import/Export > Log Dataset data to file configuration parameter,
Simulink® creates a
Simulink.SimulationData.DatasetRef object for each
Dataset stored in the resulting MAT file. You can use the
DatasetRef object to access the data for a
Dataset element. For simulations that are run using the
Simulink.SimulationInput objects, the
object is returned as part of the
SimulationOutput object. As
a result, you have quicker access to and do not need to create them.
Parallel simulations can produce more logged data than the MATLAB memory can hold. Consider logging to persistent storage for parallel simulations
to reduce the memory requirement. When you select the Data Import/Export
> Log Dataset data to file configuration parameter
LoggingToFile), for parallel simulations in Simulink:
Data is logged in Dataset format in a MAT-file
Simulink.SimulationData.DatasetRef object is created
for each Dataset element (for example,
logsout) for each simulation
You can use
DatasetRef objects to access data for a
specific signal. You can create
matlab.io.datasetore.SimulationDatastore objects to use for streaming logged data
from persistent storage in to a model.