You can use the Simulink® Control Design™ linearization tools to efficiently batch linearize a model at varying model parameter values. If all the model parameters you vary are tunable, the linearization tools use a single model compilation to compute linearizations for all parameter grid points, resulting in efficiency.
The term tunable parameters refers to parameters whose values you can change during model simulation without recompiling the model. In general, only parameters that represent mathematical variables are tunable. Common tunable parameters include the Gain parameter of the Gain block, PID gains of the PID Controller block, and Numerator and Denominator coefficients of the Transfer Fcn block.
In contrast, when you vary the value of nontunable parameters, the linearization tools compile the model for each parameter grid point. This repeated compilation makes batch linearization slower. Parameters that specify the appearance or structure of a block, such as the number of inputs of a Sum block, are not tunable. Parameters that specify when a block is evaluated, such as a block's sample time or priority, are also not tunable.
To take advantage of the efficiency of single model compilation,
convert nontunable parameters that you want to vary to tunable parameters.
For example, suppose that you set Configuration
Parameters > Optimization > Signals and parameters > Default
parameter behavior to
Inlined (see Default parameter behavior)
to optimize the memory and processing requirements of generated code.
This setting makes all model parameters nontunable. Therefore, before
batch linearizing the model, set Default parameter behavior to
make your model parameters tunable.
By default, the linearization tools compute all linearizations
with a single compilation whenever it is possible to do so, i.e.,
whenever all parameters are tunable. If the software detects non-tunable
parameters specified for variation, it issues a warning and recompiles
the model for each parameter-grid point. You can change this default
behavior at the command line using the
linearizeOptions. In the
Linear Analysis Tool, click
More Options and
use the Recompile the model when parameter values are varied
for linearization option. The following table describes
how these options affect the recompilation behavior.
|All varying parameters are tunable||Some varying parameters are not tunable|
|Linearizations are computed for all parameter-grid points with a single compilation.||Model is recompiled for each parameter-grid point. Software issues a warning.|
|Model is recompiled for each parameter-grid point.||Model is recompiled for each parameter-grid point. Warning is suppressed.|
Suppose that you are performing batch linearization by varying the values of tunable parameters and notice that the software is recompiling the model more than necessary. To ensure that linearizations are computed with a single compilation whenever possible, make sure that:
At the command line, the
is set to
In Linear Analysis Tool, Recompile the model when parameter values are varied for linearization is unchecked.