Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

运行多个仿真

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

对于涉及多个并行仿真和记录大量数据的工作流,您可以使用 parsimbatchsim 命令的命令行 API,或使用 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 changes to the model specified through a SimulationInput object, in
setBlockParameterSet block parameters to be used for a specific simulation through SimulationInput object, in
setModelParameterSet model parameters to be used for a specific simulation through SimulationInput object, in
setInitialStateConfigure Simulink.SimulationInput object to set initial state for simulation
setExternalInputSet external inputs for a simulation through SimulationInput object, in
setVariable通过 SimulationInput 对象 in 设置仿真的变量
validateValidate the contents of the SimulationInput object, in
setPreSimFcnSpecify 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
loadVariablesFromMATFileLoad variables from MAT-file into a Simulink.SimulationInput object, in
getSimulationJobsGet all Simulink.Simulation.Job objects from cluster
contentsView the contents of the Simulink.SimulationInput object

Simulink.SimulationInput创建 SimulationInput 对象以对多个或单个仿真的模型进行更改
Simulink.Simulation.VariableVariables in Simulink.SimulationInput objects
Simulink.Simulation.BlockParameterBlock 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

工具

多个仿真Run multiple simulations from the Simulink Editor
仿真管理器Monitor multiple simulations and visualize the simulation data

主题