Main Content

关于SimscapeRun-Time Parameters

Simscape™ run-time parameters are MATLAB®变量或金宝appSimulink.Parameter.Parameter.运行时间可配置的对象。默认情况下,在代码生成期间不束缚运行时间可配置参数。Simscape Run-Time参数允许您在更改参数值时跳过模型重新编译模型。您可以更改参数值:

  • 在快速重启之间,开发计算机上的迭代模拟

  • 在开发计算机上的引用模型中

  • 在快速仿真(RSIM)或实时目标硬件中的生成代码中

有关使用Simscape Run-Time参数的更多信息,请参阅使用Simscape Run-Time参数提高参数扫描效率

默认情况下,所有Simscape块参数都是编译时参数。您只能在开发计算机上更改工厂模型中的编译时参数的值。

Enabling Run-Time Configurability

查看simscape运行选项设置您的首选项以显示运行时设置。有关更多信息,请参阅Show Simscape Run-Time Parameter Settings

Simscape支金宝app持需要数值值输入的大多数参数的运行时间可配置性。要确定您是否可以将特定参数指定为Simscape Run-time参数,请查看块对话框中参数的设置。如果启用了运行时参数并且参数运行时间可配置,则会将对话框设置为默认设置,编译时间。你可以改变这个运行for the parameters that you want to be run-time configurable. You can change this setting at any time before you generate code from your Simscape model.

To specify a Simscape block parameter as run-time configurable, change the run-time configuration setting, which appears next to the dialog box for the parameter, from编译时间运行。该图显示了一个运行时配置设置恒压参数的永磁直流电机in thessc_dcmotor.Simscape榜样。参数条目是变量v1.,您在MATLAB工作区中指定的值。您还可以在对话框中以数字方式指定运行时参数值。

有关用于在开发和目标计算机上指定和更改Simscape Run-Time参数的示例,请参阅指定和更改Simscape Run-Time参数and更改目标硬件上的参数值

While Simscape run-time parameters can make iterative simulation more efficient, using them can decrease the efficiency of code that you generate. Code that contains compile-time or inlined run-time parameters is more computationally efficient because it does not have to store or retrieve parameter values. If you set the default parameter behavior for code generation to inlined, the generated code algorithm inlines the numeric values of all block parameters as constants.

For information that can help you decide when to inline Simscape run-time parameters, see通过联系Simscape Run-Time参数来降低计算成本。要了解如何在内联Simscape Run-Time参数,请参阅管理Simscape Run-Time参数

Simscape run-time parameters not the same as Simulink®可调参数。有关两种参数之间的比较信息,请参阅Simscape Run-Time参数和Simulink可调参数的不同程度金宝app不同

块级变量初始化目标值的运行时间可配置性

一些simscapt块Variables设置允许你设定了一个目标价值block-level variable initialization. For more information, see初始化模型仿真的块变量andSet Priority and Initial Target for Block Variables

包含在的变量Variables设置是默认配置的运行时。如果使用您将其保存到MATLAB工作区的变量指定目标值,则可以调整模拟之间的块级变量 - 初始化目标值。

Related Topics