Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

运行多个仿真

使用 parsim 函数、batchsim 函数或 Simulink® 中的“多个仿真”面板,提供输入集合以对这些输入进行建模并运行多个仿真

对于涉及多个并行仿真和记录大量数据的工作流,您可以使用 parsimbatchsim 函数,或使用 Simulink 编辑器中的多个仿真面板运行仿真。

如果您拥有 Parallel Computing Toolbox™ 许可证,则可以使用 parsim 函数并行运行仿真。该函数将多个仿真分配给并行工作进程,以加快整体仿真时间。通过将 parsim 函数与 Parallel Computing Toolbox 结合使用,您可以自动创建并行池,标识文件依存关系,并管理加速和快速加速仿真的编译工件。如果没有 Parallel Computing Toolbox 许可证,则 parsim 函数会以串行方式运行仿真。

您还可以将 batchsim 函数与 Parallel Computing Toolbox 和 MATLAB® Parallel Server™ 许可证结合使用。当您使用 batchsim 函数时,仿真会将其工作负载分散到一个计算集群上。您可以打开一个单独的 MATLAB 会话来访问作业和结果。

要快速入门,请参阅Running Multiple SimulationsRun Parallel Simulations for a Thermal Model of a House Using parsim

函数

batchsimOffload simulations to run on a compute cluster
parsim以并行或串行方式进行多次动态系统仿真
applyToModelApply configuration in SimulationIntput object to model
setBlockParameterSet block parameter values for simulation using SimulationInput or Simulation object
setModelParameterSet model parameter values for simulation using SimulationInput or Simulation object
setInitialStateSpecify initial state for simulation using SimulationInput or Simulation object
setExternalInputSpecify external input data for top-level input ports using SimulationInput or Simulation object
setVariableSimulationInput 对象设置变量值
validateValidate contents of SimulationInput object
setPreSimFcnSpecify MATLAB function to run before start of each simulation on Simulink.SimulationInput object
setPostSimFcn Set MATLAB function to run after each simulation
loadVariablesFromMATFileLoad variables from MAT file into Simulink.SimulationInput object
loadVariablesFromExternalSourceLoad variables from a custom file into Simulink.SimulationInput object (自 R2022b 起)
getSimulationJobsGet all Simulink.Simulation.Job objects from cluster
showContentsView summary of specification in SimulationInput or Simulation object (自 R2020a 起)

Simulink.SimulationInput创建 Simulink.SimulationInput 对象以对多个或单个仿真的模型进行更改
Simulink.Simulation.VariableVariables in Simulink.SimulationInput objects (自 R2020a 起)
Simulink.Simulation.BlockParameterBlock parameters in Simulink.SimulationInput objects (自 R2020a 起)
Simulink.Simulation.Future Create Future object for simulation
Simulink.Simulation.Job Simulink.Simulation.Job object for batch simulations

工具

多个仿真Run multiple simulations from the Simulink Editor (自 R2021b 起)
仿真管理器Monitor multiple simulations and visualize the simulation data

主题