运行多个仿真
parsim
函数、batchsim
函数或 Simulink® 中的“多个仿真”面板,提供输入集合以对这些输入进行建模并运行多个仿真对于涉及多个并行仿真和记录大量数据的工作流,您可以使用 parsim
或 batchsim
函数,或使用 Simulink 编辑器中的多个仿真面板运行仿真。
如果您拥有 Parallel Computing Toolbox™ 许可证,则可以使用 parsim
函数并行运行仿真。该函数将多个仿真分配给并行工作进程,以加快整体仿真时间。通过将 parsim
函数与 Parallel Computing Toolbox 结合使用,您可以自动创建并行池,标识文件依存关系,并管理加速和快速加速仿真的编译工件。如果没有 Parallel Computing Toolbox 许可证,则 parsim
函数会以串行方式运行仿真。
您还可以将 batchsim
函数与 Parallel Computing Toolbox 和 MATLAB® Parallel Server™ 许可证结合使用。当您使用 batchsim
函数时,仿真会将其工作负载分散到一个计算集群上。您可以打开一个单独的 MATLAB 会话来访问作业和结果。
要快速入门,请参阅Running Multiple Simulations和Run Parallel Simulations for a Thermal Model of a House Using parsim。
函数
batchsim | Offload simulations to run on a compute cluster |
parsim | 以并行或串行方式进行多次动态系统仿真 |
applyToModel | Apply configuration in SimulationIntput object to
model |
setBlockParameter | Set block parameter values for simulation using
SimulationInput or Simulation
object |
setModelParameter | Set model parameter values for simulation using
SimulationInput or Simulation
object |
setInitialState | Specify initial state for simulation using
SimulationInput or Simulation
object |
setExternalInput | Specify external input data for top-level input ports using
SimulationInput or Simulation
object |
setVariable | 使用 SimulationInput 或 Simulation 对象为仿真设置变量值 |
setVariantConfiguration | Set variant configuration for simulation using SimulationInput
object (自 R2024a 起) |
getVariantConfiguration | Get name of variant configuration from SimulationInput
object (自 R2024a 起) |
validate | Validate contents of SimulationInput
object |
setPreSimFcn | Specify MATLAB function to run before start of each simulation on
Simulink.SimulationInput object |
setPostSimFcn | Set MATLAB function to run after each simulation |
loadVariablesFromMATFile | Load variables from MAT file into Simulink.SimulationInput
object |
loadVariablesFromExternalSource | Load variables from a custom file into Simulink.SimulationInput
object (自 R2022b 起) |
getSimulationJobs | Get all Simulink.Simulation.Job objects from
cluster |
showContents | View summary of specification in SimulationInput or
Simulation object (自 R2020a 起) |
类
Simulink.SimulationInput | 创建 Simulink.SimulationInput 对象以对多个或单个仿真的模型进行更改 |
Simulink.Simulation.Variable | Variables in Simulink.SimulationInput objects (自 R2020a 起) |
Simulink.Simulation.BlockParameter | Block parameters in Simulink.SimulationInput objects (自 R2020a 起) |
Simulink.Simulation.Future | Create Future object for simulation |
Simulink.Simulation.Job |
Simulink.Simulation.Job object for batch simulations |
simulink.multisim.DesignStudy | Create design study for multiple simulations (自 R2024a 起) |
工具
主题
- Running Multiple Simulations
Run multiple simulations from the
parsim
andbatchsim
commands, and the Multiple Simulations panel in Simulink Editor. - Run Parallel Simulations for a Thermal Model of a House Using parsim
Use a
Simulink.SimulationInput
object to run multiple parallel simulations command line workflow. - 运行并行仿真
以编程方式并行运行模型仿真。
- Configure and Run Simulations with Multiple Simulations Panel
Learn about the Multiple Simulations panel in the Simulink Editor.
- Comparison Between Multiple Simulation Workflows
Understand the similarities and differences between
parsim
,parsim
withRunInBackground
, andbatchsim
. - Analyze Results Using Simulation Manager
Use the Simulation Manager to visualize simulation data, analyze simulation results and trends.