About Simscape Run-Time Parameters

Simscape™ run-time parameters are MATLAB® variables or Simulink.Parameter objects that are run-time configurable. By default, run-time configurable parameters are noninlined during code generation. As such, they are coded not as constants, but as variables with values that you can change before or between simulations without recompiling the model.

Simscape run-time parameters help you work more efficiently than compile-time configurable parameters because they allow you to forgo model recompiling when you change parameter values:

  • Between fast-restart, iterative simulations on a development computer

  • In referenced models on a development computer

  • In the generated code in a Rapid Accelerator (Rsim) mode or on real-time target hardware

For more information on using Simscape run-time parameters for these types of simulation, see Improve Parameter-Sweeping Efficiency Using Simscape Run-Time Parameters.

By default, all Simscape block parameters are compile-time configurable parameters. You cannot change the value of a compile-time configurable parameter in the model or in generated code without recompiling the model. Therefore, you can change the value of compile-time parameters only in the plant model on your development computer. 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 Compile-time to Run-time. The figure shows a run-time configuration setting for the Constant voltage parameter of a Simscape voltage supply block.


To view the Run-time option, set your Simscape preferences to show runtime settings. For more information, see Show Simscape Run-Time Parameter Settings.

For an example that shows how to specify and change Simscape run-time parameters on development and target computers, see Specify and Change a Simscape Run-Time Parameter and Change Parameter Values on Target Hardware.

Simscape supports run-time configurability for some, but not all, dialog box parameters. To determine if you can specify a particular parameter as a Simscape run-time parameter, examine the block dialog box run-time setting for the parameter. If an enabled run-time setting appears next to the parameter on the block dialog box, you can specify the parameter as run-time configurable. If there is no run-time setting, or if the setting is not enabled, then the parameter is strictly compile-time configurable. You cannot specify a strictly compile-time configurable parameter as a Simscape run-time parameter.

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 Decrease Computational Cost by Inlining Simscape Run-Time Parameters. To learn how to inline Simscape run-time parameters, see Manage Simscape Run-Time Parameters.

Simscape run-time parameters are similar to, but different from Simulink® tunable parameters. For example, you can forgo recompiling when you change the value of a tunable parameter while a simulation is either running or stopped. You can change the value of a run-time configurable parameter, without having to recompile the model, only if you do so while the simulation is stopped. For more information on differences between the two types of parameters, see How Simscape Run-Time Parameters and Simulink Tunable Parameters Differ.


These data types are not supported for run-time parameters:

  • Structures

  • Cell arrays

Related Topics