Main Content

LinearizationAdvisor

Diagnostic information for troubleshooting linearization results

Description

When you linearize a Simulink® model, you can create a LinearizationAdvisor object that contains diagnostic information about individual block linearizations. You can troubleshoot your linearization results by reviewing this diagnostic information.

To access the diagnostic information, use the getBlockInfo function.

Creation

There are several ways to create a LinearizationAdvisor object when linearizing a Simulink model. When you linearize a model using:

  • The linearize function, first create a linearizeOptions option set, setting the StoreAdvisor option to true. Then, linearize the model using linearize, returning the info argument.

  • An slLinearizer interface, first create a linearizeOptions option set, setting the StoreAdvisor option to true. Then, create the slLinearizer interface. When you obtain a linear model from the interface using a linearization function, such as getIOTransfer, return the info argument.

  • An slTuner interface, first create a slTunerOptions option set, setting the StoreAdvisor option to true. Then, create the slTuner interface. When you obtain a linear model from the interface using a linearization function, such as getIOTransfer, return the info argument.

You can then access the LinearizationAdvisor object using info.Advisor. If you linearize the model at multiple operating points or using parameter variation, info.Advisor is an array of LinearizationAdvisor objects.

Also, the advise and find functions return a LinearizationAdvisor object that contains diagnostic information for blocks that satisfy the relevant search criteria.

Properties

expand all

Simulink model associated with the linearization diagnostic information, returned as a character vector.

Model is a read-only property.

Linear analysis points, including inputs, outputs, and openings, returned as a linearization I/O object or a vector of linearization I/O objects.

AnalysisPoints corresponds to the:

  • io input argument of the linearize command.

  • Analysis points and loop openings of an slLinearizer or slTuner interface.

For more information on analysis points, see Specify Portion of Model to Linearize.

AnalysisPoints is a read-only property.

Operating point at which the model was linearized, specified as an operating point object.

OperatingPoint is a read-only property.

Parameter samples for linearization, specified as one of the following:

  • [] — Linearization result has no associated parameter values.

  • Structure — Value for a single parameter, specified as a structure with the following fields:

    • Name — Parameter name

    • Value — Parameter value

  • Structure array — Values for multiple parameters.

For more information on parameter variation, see Specify Parameter Samples for Batch Linearization.

Parameters is a read-only property.

Linearization algorithm options, specified as a linearizeOptions object.

LinearizationOptions corresponds to the options input argument of linearize, slLinearizer, or slTuner.

LinearizationOptions is a read-only property.

Diagnostic information for each block that matches the search criteria used to create the LinearizationAdvisor object, specified as a BlockDiagnostic object or a vector of BlockDiagnostic objects.

You can access these block diagnostics using the getBlockInfo command. To obtain a list of the blocks, use the getBlockPaths command.

BlockDiagnostics is a read-only property.

Query type used to obtain the linearization diagnostics, specified as one of the following:

  • 'All Blocks' when you initially create a LinearizationAdvisor object using a linearization function such as linearize or getIOTransfer.

  • 'Linearization Advice' when you create a LinearizationAdvisor object using the advise command.

  • A character vector matching the QueryType property of the corresponding custom query object when you create a LinearizationAdvisor object using the find command.

QueryType is a read-only property.

Description of the query used to obtain the linearization diagnostics, specified as one of the following:

  • 'All Linearized Blocks' when you initially create a LinearizationAdvisor object using a linearization function such as linearize or getIOTransfer.

  • 'Blocks that are Potentially Problematic for Linearization' when you create a LinearizationAdvisor object using the advise command.

  • A character vector matching the Description property of the corresponding custom query object when you create a LinearizationAdvisor object using the find command.

Description is a read-only property.

Object Functions

adviseFind blocks that are potentially problematic for linearization
highlightHighlight linearization path in Simulink model
findFind blocks in linearization results that match specific criteria
getBlockInfoObtain diagnostic information for block linearizations
getBlockPathsObtain list of blocks in LinearizationAdvisor object

Examples

collapse all

Load Simulink model.

mdl = 'scdpendulum';
load_system(mdl)

Create a linearization option set, enabling the StoreAdvisor option.

opt = linearizeOptions('StoreAdvisor',true);

Linearize the model using this option set, returning the info argument.

io = getlinio(mdl);
[linsys,~,info] = linearize(mdl,io,opt);

Extract the LinearizationAdvisor object from info.

advisor = info.Advisor
advisor = 
  LinearizationAdvisor with properties:

               Model: 'scdpendulum'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x11 linearize.advisor.BlockDiagnostic]
           QueryType: 'All Blocks'

Load Simulink model.

mdl = 'scdspeed';
load_system(mdl)

Create a linearization option set, enabling the StoreAdvisor option.

opt = linearizeOptions('StoreAdvisor',true);

Define input and output analysis points, and create an slLinearizer interface using this option set.

io(1) = linio('scdspeed/throttle (degrees)',1,'input');
io(2) = linio('scdspeed/rad//s to rpm',1,'output');
SL = slLinearizer(mdl,io,opt);

Find the transfer function from the input to the output, returning the info argument.

[linsys,info] = getIOTransfer(SL,'scdspeed/throttle (degrees)','scdspeed/rad//s to rpm');

Extract the LinearizationAdvisor object from info.

advisor = info.Advisor
advisor = 
  LinearizationAdvisor with properties:

               Model: 'scdspeed'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x27 linearize.advisor.BlockDiagnostic]
           QueryType: 'All Blocks'

Load Simulink model.

mdl = 'scdspeed';
load_system(mdl)

Create a slTunerOptions option set, enabling the StoreAdvisor option.

opt = slTunerOptions('StoreAdvisor',true);

Define input and output analysis points, and create an slTuner interface using this option set.

io(1) = linio('scdspeed/throttle (degrees)',1,'input');
io(2) = linio('scdspeed/rad//s to rpm',1,'output');
ST = slTuner(mdl,io,opt);

Typically, you would tune your control system using the systune function. Then, you can find the transfer function from the input to the output, returning the info argument.

[linsys,info] = getIOTransfer(ST,'scdspeed/throttle (degrees)','scdspeed/rad//s to rpm');

Extract the LinearizationAdvisor object from info.

advisor = info.Advisor
advisor = 
  LinearizationAdvisor with properties:

               Model: 'scdspeed'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x27 linearize.advisor.BlockDiagnostic]
           QueryType: 'All Blocks'

Load Simulink model.

mdl = 'scdpendulum';
load_system(mdl)

Linearize model and obtain LinearizationAdvisor object.

io = getlinio(mdl);
opt = linearizeOptions('StoreAdvisor',true);
[linsys,~,info] = linearize(mdl,io,opt);
advisor = info.Advisor;

Find potentially problematic blocks for linearization.

result = advise(advisor)
result = 
  LinearizationAdvisor with properties:

               Model: 'scdpendulum'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x3 linearize.advisor.BlockDiagnostic]
           QueryType: 'Linearization Advice'

Load the Simulink model.

mdl = 'scdspeed';
load_system(mdl)

Linearize the model and obtain the LinearizationAdvisor object.

opts = linearizeOptions('StoreAdvisor',true);
io(1) = linio('scdspeed/throttle (degrees)',1,'input');
io(2) = linio('scdspeed/rad//s to rpm',1,'output');
[sys,op,info] = linearize(mdl,io,opts);
advisor = info.Advisor;

Create compound query object for finding all blocks with one input and one output.

qSISO = linqueryHasInputs(1) & linqueryHasOutputs(1);

Find all SISO blocks using compound query object.

advSISO = find(advisor,qSISO)
advSISO = 
  LinearizationAdvisor with properties:

               Model: 'scdspeed'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x10 linearize.advisor.BlockDiagnostic]
           QueryType: '(Has 1 Inputs & Has 1 Outputs)'

Load Simulink model.

mdl = 'scdpendulum';
load_system(mdl)

Linearize the model and obtain LinearizationAdvisor object.

io = getlinio(mdl);
opt = linearizeOptions('StoreAdvisor',true);
[linsys,~,info] = linearize(mdl,io,opt);
advisor = info.Advisor;

Find blocks that are potentially problematic for linearization.

blocks = advise(advisor);

Obtain diagnostics for these blocks.

diags = getBlockInfo(blocks)
diags = 
Linearization Diagnostics for the Blocks:

Block Info:
-----------
Index   BlockPath                                           Is On Path   Contributes To Linearization   Linearization Method   
1.      scdpendulum/pendulum/Saturation                     Yes          No                             Exact                  
2.      scdpendulum/angle_wrap/Trigonometric Function1      Yes          No                             Perturbation           
3.      scdpendulum/pendulum/Trigonometric Function         Yes          No                             Perturbation           

Alternative Functionality

App

You can interactively troubleshoot linearization results using the Linearization Advisor in the Model Linearizer. For an example, see Troubleshoot Linearization Results in Model Linearizer.

Version History

Introduced in R2017b