Main Content

Determine Parameters from Generated Code

Simulink® Design Verifier™ selects the parameters whose value can be changed in the generated code for parameter configuration.

For such parameters, the minimum or maximum value from Simulink.Parameter object is used as parameter configuration for analysis.

Note

  • This workflow is recommended when you have generated the code before the analysis is run.

  • This parameter configuration can be used for both Model and Code workflows.

The PreLoadFcn callback function model, defines codeTunableParam and constParam in the MATLAB® workspace.

Simulink model with tunable parameter.

The code generation settings for the model:

Model properties window.

Set storage class of constParam to Const and codeTunableParam to ExportedGlobal.

Code Generation settings window.

Configuring Parameters by Using Determine from generated code

This example shows how to configure parameters by using Determine from generated code workflow during the Simulink Design Verifier analysis.

  1. Open Model Settings > Design Verifier > Parameters and Variants.

  2. Click on the drop down for Parameter Configuration and select Determine from generated code.

    This automatically infers the parameters that will be selected based on the code generated and the parameter settings based on their definition.

In the above example, the parameter constParam cannot be changed in the generated code. So Simulink Design Verifier selects codeTunableParam for parameter configuration.

The Undecided objectives are related to the code corresponding to Multiport Switch1.

See Also

|

Related Topics