Real-Time Workshop | ![]() ![]() |
Tunable Parameter Storage
A tunable parameter is a block parameter whose value can be changed at run-time. A tunable parameter is inherently noninlined. A tunable expression is an expression that contains one or more tunable parameters.
When you declare a parameter tunable, you control whether or not the parameter is stored within rtP
. You also control the symbolic name of the parameter in the generated code.
When you declare a parameter tunable, you specify:
Note that the term "storage class," as used in Real-Time Workshop, is not synonymous with the term storage class specifier, as used in the C language.
const
or volatile
. This is simply an string that is included in the variable declaration, without error checking.
Real-Time Workshop generates a variable or struct
storage declaration for each tunable parameter. Your choice of storage class controls whether the parameter is declared as a member of rtP
or as a separate global variable.
You can use the generated storage declaration to make the variable visible to your code. You can also make variables declared in your code visible to the generated code. You are responsible for properly linking your code to generated code modules.
You can use tunable parameters or expressions in your root model and in masked or unmasked subsystems, subject to certain restrictions (See Tunable Expressions.)
To declare tunable parameters, you must first enable the Inline parameters option. You then use the Model Parameter Configuration dialog to remove individual parameters from inlining and declare them to be tunable. This allows you to improve overall efficiency by inlining most parameters, while at the same time retaining the flexibility of run-time tuning for selected parameters.
The mechanics of declaring tunable parameters is discussed in Using the Model Parameter Configuration Dialog.
![]() | Storage of Nontunable Parameters | Storage Classes of Tunable Parameters | ![]() |