Main Content

How Simscape Run-Time Parameters and Simulink Tunable Parameters Differ

Simscape™ run-time parameters and Simulink® tunable parameters both allow you to change the values of parameters on your development or target computer without model recompilation. However, they differ in these important ways:

  • You can change the value of a Simulink tunable parameter while a simulation is running, and it will impact the currently running simulation. Simscape run-time parameters are run-time configurable. You can only change the value of a run-time configurable parameter when a simulation is stopped.

  • Simulink tunable parameters are tunable by default. Simscape block parameters are only compile-time configurable by default. To make a Simscape block parameter run-time configurable, you must specify it as such.

  • For code generation, you specify Default parameter behavior as Tunable or Inlined. You cannot modify inlined parameters in generated code because the compiler specifies them as constants. You can change the values of tunable parameters in generated code because the compiler specifies them as modifiable global variables or structure fields.

    If you set the Default parameter behavior to Tunable, the compiler specifies all Simscape run-time parameters and Simulink tunable parameters as modifiable entities in the generated code. However, if you set the default behavior to Inlined, the compiler inlines only the Simscape run-time parameters. The Simulink tunable parameters are still generated as modifiable entities in the code. To change the value of a particular Simscape run-time parameter in the generated code when the default behavior is inlined, you declare that parameter as an exception to inlining.

The table shows the state, mode, and code section in which you can change a run-time parameter or run-time configurable parameter.

Machine

Simulink Simulation Mode

Simulation Status

Section of Generated Code That You Modify

Simscape Run-Time Parameter Is Modifiable

Simulink Tunable Parameter Is Modifiable

DevelopmentNormalStoppedNot ApplicableYesYes
DevelopmentNormalRunningNot ApplicableNoYes
Development or Target

Normal, Accelerator, Rapid Accelerator, SIL, PIL, or External

StoppedNot ApplicableYesYes
Development or TargetNormal, Accelerator, Rapid Accelerator, SIL, PIL, or ExternalRunningNot ApplicableNoYes
TargetNormal, SIL, PIL, or ExternalStoppedSetup-FunctionYesYes
TargetNormal, SIL, PIL, or ExternalRunning
  • Step-Function for a Simulink global variable

  • External code for a Simulink parameter object

NoYes

Between normal mode simulations, as long as your changes do not affect the structure of the model, you can avoid recompiling by using fast restart when you change Simscape run-time and Simulink tunable parameters.

Related Topics