Main Content

simulink.multisim.ModelParameter

Specify a range of values for model parameters

Since R2024a

Description

The simulink.multisim.DesignStudy object represents a design study that allows you to run multiple simulations at a large scale. With the simulink.multisim.ModelParameter object, you can specify model parameter values with a name-value pair for massive simulations using parameter combinations.

Creation

Description

mp = simulink.multisim.ModelParameter(Name=Value) sets the model parameter named Name to the value Value on the simulink.multisim.ModelParameter object mp.

You can use the simulink.multisim.ModelParameter object to specify a value for any model parameter.

Input Arguments

expand all

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: bp = simulink.multisim.ModelParameter(TimeOut="100") configures a simulink.multisim.ModelParamter object with a simulation timeout of 100 seconds.

Model configuration parameter, specified as a name-value argument that consists of the programmatic name of the configuration parameter and the configuration parameter value. For example, to specify a value for the Stop time parameter, use the programmatic parameter name StopTime as the name in the name-value argument and specify the simulation stop time as the value. This command sets the simulation stop time to 100 seconds.

bp = simulink.multisim.ModelParameter(StopTime="100");

You can use the simulink.multisim.ModelParameter function to specify the value for any model configuration parameter. When you simulate a model hierarchy, the configuration parameter values you specify apply to the top model.

Example: bp = simulink.multisim.ModelParameter(FixedStep="0.1") specifies a fixed step size of 0.1 seconds.

Tips

To get a list of model configuration parameters, use the getActiveConfigSet function and the get_param function. For example, to see the configuration parameters for a model named vdp, enter these commands in the MATLAB® Command Window.

configSet = getActiveConfigSet("vdp");
configSetNames = get_param(configSet,"ObjectParameters")

The get_param function returns a list of all the model configuration parameters, such as StopTime, SaveTime, SaveState, SaveOutput, and SignalLogging.

Simulation mode, specified as "normal", "accelerator", or "rapid-accelerator".

ValueDescription
"normal"

Run simulation using normal mode.

Normal mode simulations use the full model representation and provide the best support for interacting with the model during simulation.

Use normal mode for workflows that involve modifying the structure of your model between simulations. For best results, use normal mode for debugging simulations.

"accelerator"

Run simulation using accelerator mode.

Accelerator mode simulations generate an optimized representation of the model, called a simulation target, to use in simulation. The optimizations that improve the simulation performance can reduce the ability to interact with the model during simulation. Modifying the model between accelerator mode simulations can require regenerating the simulation target.

Use accelerator mode to speed up simulations in workflows that do not involve making structural changes to the model between simulations.

"rapid-accelerator"

Run simulation using rapid accelerator mode.

Rapid accelerator mode simulations generate a standalone executable to use for simulation. The standalone executable provides minimal support for interacting with the model during simulation. Modifying the model between rapid accelerator simulations can require rebuilding the standalone executable.

Use rapid accelerator mode for the fastest simulation execution when you modify the model between simulations only by tuning variable and parameter values. Tuning certain parameter values can require rebuilding the standalone executable.

For more information, see Choosing a Simulation Mode and Code Regeneration in Accelerated Models.

Example: bp = simulink.multisim.ModelParameter(simin,SimulationMode="rapid-accelerator") configures the simulation run to use rapid accelerator mode.

Tips

  • Visualization blocks update during simulation when you run simulations from a UI, such as the Simulink Editor, but do not update during simulation when you run rapid accelerator simulations programmatically.

  • To prevent rebuilding the standalone executable, you can disable the rapid accelerator up-to-date check by specifying the RapidAcceleratorUpToDateCheck parameter value as "off". With the up-to-date check disabled, changes you make that would require rebuilding the executable are ignored.

  • To simulate using rapid accelerator mode, you can specify "rapid" as a partial match for "rapid-accelerator". For more information about name-value arguments in MATLAB, see Validate Name-Value Arguments.

Data Types: char | string

Option to disable rebuilding rapid accelerator target, specified as "on" or "off". When you specify this argument as "on", changes that require rebuilding the rapid accelerator target are ignored. When you use this option, modify only options that do not require rebuilding the rapid accelerator target.

Example: bp = simulink.multisim.ModelParameter(RapidAcceleratorUpToDateCheck="off") configures a simulink.multisim.ModelParameter object to disable rebuilding the rapid accelerator target.

Data Types: char | string

Maximum simulation run time, specified as a positive scalar. Specify the time, in seconds, to allow the simulation to run. If the simulation runs for longer than the value you specify, the software issues a warning and stops the simulation. For example, if you specify TimeOut as 30, the software stops the simulation and issues a warning if computing simulation results takes more than 30 seconds.

The TimeOut parameter specifies a limit on the amount of clock time for a simulation to run. To specify the maximum time value to simulate, use the Stop time parameter.

Example: simin = setModelParameter(simin,TimeOut=60) sets a maximum run time of 60 seconds.

Data Types: char | string

Output Arguments

expand all

Specified model parameters with values for simulation, returned as a simulink.multisim.ModelParameter object.

Properties

expand all

Specified model parameter name, returned as a string or a character vector

Model parameter value, returned as a valid value for the specified model parameter.

Function handle to process the specified values that run on parallel workers, specified as a function handle or function name. The ProcessingFcn property allows you to perform additional processing on the variable values before the simulation. You can use the ProcessingFcn property to transform the values assigned to the simulink.multisim.BlockParameter object per your requirements. For example, you can use the function to transform a string values of a variable to a timeseries value.

Version History

Introduced in R2024a