Real-Time Workshop | ![]() ![]() |
Using the Model Parameter Configuration Dialog
The Model Parameter Configuration dialog is available only when the Inline parameters option on the Advanced page is selected. Selecting this option activates the Configure button.
Clicking on the Configure button opens the Model Parameter Configuration dialog.
Figure 5-1: The Model Parameter Configuration Dialog
The Model Parameter Configuration dialog lets you select workspace variables and declare them to be tunable parameters in the current model. The dialog is divided into two panels:
To declare tunable parameters, you select one or more variables from the source list, add them to the Global (tunable) parameters list, and set their storage class and other attributes.
Source List Panel. The Source list panel displays a menu and a scrolling table of numerical workspace variables.
The menu lets you choose the source of the variables to be displayed in the list. Currently there is only one choice: MATLAB workspace. The source list displays names of the variables defined in the MATLAB base workspace.
Selecting one or more variables from the source list enables the Add to table button. Clicking Add to table adds selected variables to the tunable parameters list in the Global (tunable) parameters panel. This action is all that is necessary to declare tunable parameters.
In the source list, the names of variables that have been added to the tunable parameters list are displayed in italics (See Figure 5-1).
The Refresh list button updates the table of variables to reflect the current state of the workspace. If you define or remove variables in the workspace while the Model Parameter Configuration dialog is open, click the Refresh list button when you return to the dialog. The new variables are added to the source list.
Global (Tunable) Parameters Panel. The Global (tunable) parameters panel displays a scrolling table of variables that have been declared tunable in the current model, and lets you specify their attributes. The Global (tunable) parameters panel also lets you remove entries from the list, or create new tunable parameters.
You select individual variables and change their attributes directly in the table. The attributes are:
SimulinkGlobal(Auto)
, you can add a qualifier (such as const
or volatile
) to the generated storage declaration. To do so, you can select a predefined qualifier from the list, or add additional qualifiers to the list. Note that the code generator does not check the storage type qualifier for validity. The code generator includes the qualifier string in the generated code without syntax checking.
The Remove button deletes selected variables from the Global (tunable) parameters list.
The New button lets you create new tunable variables in the Global (tunable) parameters list. At a later time, you can add references to these variables in the model.
If the name you enter matches the name of an existing workspace variable in the Source list, that variable is declared tunable, and is displayed in italics in the Source list.
To define a new tunable variable, click the New button. This creates an empty entry in the table. Then, enter the name and attributes of the variable and click Apply.
Declaring Tunable Variables
To declare an existing variable tunable:
![]() | Storage Classes of Tunable Parameters | Tunable Expressions | ![]() |