Use Parameter Table to Find Constraints
By using the Parameter Table, you can now find and autogenerate constraints for
parameters in your model. This example uses the following model, which contains
Gain and Constant parameters defined as
m
and b
, respectively.
The model callback function PreLoadFcn
defines m
and b
in the MATLAB® workspace.
When the model opens:
m
is set to 5.b
is aSimulink.Parameter
object of typeint8
whose value is set to 5.
Find Parameters
This example shows how to specify values or ranges of values used for model parameters during Simulink® Design Verifier™ analysis.
Open the Parameter Table.
On the Design Verifier tab, in the Prepare section, from the drop-down menu for the mode settings, click Settings.
In the Configuration Parameters dialog box, select Design Verifier > Parameters and Variants.
Select Use parameter table
from
Parameters configuration drop-down list.
Find parameters that can be constrained for analysis.
At the bottom of the Parameter Table, click Find parameters. The Parameter Table searches your model for parameters that can be configured and loads them in the table.
When possible, the Parameter Table autogenerates constraint values for parameters. You can use these autogenerated values or specify your own constraint.
In this example, in the Parameter Table, rows for model parameters
m
and b
appear.
Each row represents a parameter configuration. You can edit the parameter’s constraint value(s) in the field under Constraint. To use your specified parameter configuration in analysis, select the check box in the field under Use. The following table provides more details about these and other columns in the Parameter Table.
For parameter in row, the column... | Shows... |
---|---|
Use | Whether specified constraint for parameter is used in analysis. To include parameter configuration in analysis, select the check box. To exclude parameter configuration from analysis, clear the selection. |
Name | Name of parameter. |
Constraint | Autogenerated or user-specified constraint value(s) for parameter. To change the specified constraint value(s), double-click in this field and enter new constraint value(s). |
Value | Value of parameter. If the parameter is defined in a Simulink data dictionary that is linked to the model, the column shows the value of the parameter in the data dictionary. Otherwise, it shows the value of the parameter in the base workspace. |
Min | Specified minimum value for parameter, if
parameter is of type
|
Max | Specified maximum value for parameter, if
parameter is of type
|
Model Element | Path to model component(s) where parameter is used. |
Source | Workspace information about model parameters, including base workspace, model workspace, or data dictionary parameters. |
Note
If you use Simulink.ValueType
object for the
parameter, Simulink
Design Verifier analysis does not consider the parameter as
tunable.
Note
If you use a MATLAB variable from a data dictionary as a model parameter,
Simulink
Design Verifier analysis does not consider the parameter as tunable. If
you want the parameter to be tunable for the analysis, use a
Simulink.Parameter
object for the parameter. To
create a Simulink.Parameter
object in the data dictionary:
In the Model Explorer, on the Model Hierarchy pane, select the workspace under the data dictionary that contains your MATLAB variable.
Select Add > Simulink Parameter. You see a new variable titled
Param
in the workspace.Rename the variable. Assign the same data type as the original MATLAB variable.
In your model, use the variable that you just created as your parameter.
Edit Parameter Constraints
For each parameter you want to treat as a variable during analysis, specify constraint values.
In the Parameter Table, in the Constraint column, double-click the field for the parameter you want to constrain. Enter your constraint values.
For this example:
For parameter
b
, specify the value range [4, 10].For parameter
m
, specify the value 5.
To enable a parameter configuration for analysis, click to select the row that corresponds to the configured parameter. Click Enable.
To enable multiple parameter configurations at once, shift-click to select multiple rows, and click Enable.
To exclude parameter configurations from analysis, click to select the row that corresponds to the configured parameter. Click Disable.
When you disable a parameter configuration, the specified constraint for this parameter is not used in the analysis.
To disable multiple parameter configurations at once, shift-click to select multiple rows, and click Disable.
To exclude a parameter configuration from analysis and delete its specified constraint, click to select the row that corresponds to the configured parameter. Click Clear.
The Parameter Table clears the specified constraint for the parameter, and the parameter configuration is excluded from analysis.
To clear multiple parameter configurations at once, shift-click to select multiple rows, and click Clear.
Highlight Constrained Parameters in Model
Highlight model components that use the parameters for which you have specified constraints.
Select the parameter(s) you want to highlight in the model.
To select a parameter, click anywhere inside the Name or Constraint columns for either parameter. Shift-click to select multiple parameters.
Click Highlight in Model.
In the Simulink Editor, model components that use the selected parameters are highlighted.
You can also define constraints for parameters by using Parameter Configuration File. For more information, see Template Parameter Configuration File in Set Parameters Using Parameter Configuration File.
To define constraints for structure or bus parameter, see Specify Parameter Configuration for Structure or Bus Parameters.