parsim
or the
batchsim
functionFor workflows that involve multiple parallel simulations and logging of
large data, you can create simulation sets using an array of Simulink.SimulationInput
objects. SimulationInput
objects help you run multiple
simulation variants without changing your model. Arrays of
SimulationInput
objects enable you to run multiple
simulations.
With a Parallel Computing Toolbox™ license, you can use the parsim
function to run the
simulations in parallel. The function distributes multiple simulations to
parallel workers to speed up overall simulation time. parsim
with Parallel Computing Toolbox also automates the creation of parallel pools, identifies file
dependencies, and manages build artifacts for Accelerator and Rapid
Accelerator simulations. The parsim
command run multiple
simulations in serial if Parallel Computing Toolbox license is not available.
In addition, you can use batchsim
with Parallel Computing Toolbox and MATLAB®
Parallel Server™ licenses. When you use batchsim
,
simulations are offloaded onto a compute cluster. You can open a separate
MATLAB session to access the job and the results.
To get started, see Run Multiple Simulations and Run Parallel Simulations Using parsim.
batchsim | Offload simulations to run on a compute cluster |
parsim | Simulate dynamic system multiple times in parallel or serial |
applyToModel | Apply changes to the model specified through a SimulationInput object, in |
setBlockParameter | Set block parameters to be used for a specific
simulation through SimulationInput object, in |
setModelParameter | Set model parameters to be used for a specific
simulation through SimulationInput object, in |
setInitialState | Set initial state to be used for a specific
simulation through SimulationInput object, in |
setExternalInput | Set external inputs for a simulation through SimulationInput object, in |
setVariable | Set variables for a simulation through SimulationInput object, in |
validate | Validate the contents of the SimulationInput object, in |
setPreSimFcn | Specify a MATLAB function to run before start of
each simulation through SimulationInput object,
in |
setPostSimFcn | Specify a MATLAB function to run after each simulation is complete through
SimulationInput object, in |
loadVariablesFromMATFile | Load variables from MAT-file into a Simulink.SimulationInput
object, in
|
getSimulationJobs | Get all Simulink.Simulation.Job objects from
cluster |
contents | View the contents of the Simulink.SimulationInput
object |
Simulink.SimulationInput | Creates SimulationInput objects to make changes to a model for
multiple or individual simulations |
Simulink.Simulation.Variable | Variables in Simulink.SimulationInput objects |
Simulink.Simulation.BlockParameter | Block parameters in Simulink.SimulationInput objects |
Simulink.Simulation.Future | Create Future object for simulation |
Simulink.Simulation.Job | Execute batchsim to create a
Simulink.Simulation.Job object, simJob |
Simulation
Manager | Monitor multiple simulations and visualize the simulation data |
Directly run multiple simulations from the parsim
and
batchsim
commands.
Run Parallel Simulations Using parsim
Example of multiple parallel simulations workflows.
Programmatically run model simulations in parallel.
Understand the similarities and differences between parsim
,
parsim
with RunInBackground
, and
batchsim.
Analyze Results Using Simulation Manager
Use the Simulation Manager to visualize the simulation data, analyze the simulation results and the simulation trends.