getBlockInfo
Obtain diagnostic information for block linearizations
Syntax
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.
Examples
Obtain Diagnostics for Potentially Problematic Blocks
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
Obtain Diagnostics Using Block Names
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;
Obtain diagnostic information for the saturation block.
satDiag = getBlockInfo(advisor,'scdpendulum/pendulum/Saturation')
satDiag = Linearization Diagnostics for scdpendulum/pendulum/Saturation with properties: IsOnPath: 'Yes' ContributesToLinearization: 'No' LinearizationMethod: 'Exact' Linearization: [1x1 ss] OperatingPoint: [1x1 linearize.advisor.BlockOperatingPoint]
You can also obtain diagnostic information for multiple blocks at once. Obtain diagnostics for the sin blocks in the model.
sinBlocks = {'scdpendulum/pendulum/Trigonometric Function'; 'scdpendulum/angle_wrap/Trigonometric Function1'}; sinDiag = getBlockInfo(advisor,sinBlocks)
sinDiag = Linearization Diagnostics for the Blocks: Block Info: ----------- Index BlockPath Is On Path Contributes To Linearization Linearization Method 1. scdpendulum/angle_wrap/Trigonometric Function1 Yes No Perturbation 2. scdpendulum/pendulum/Trigonometric Function Yes No Perturbation
Obtain Diagnostics Using Indices
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;
Obtain diagnostic information for the first element of advisor.BlockDiagnostics
.
diag = getBlockInfo(advisor,1)
diag = Linearization Diagnostics for scdpendulum/pendulum/Saturation with properties: IsOnPath: 'Yes' ContributesToLinearization: 'No' LinearizationMethod: 'Exact' Linearization: [1x1 ss] OperatingPoint: [1x1 linearize.advisor.BlockOperatingPoint]
You can also obtain diagnostics for multiple blocks. For example, obtain diagnostics for the second and third blocks listed in advisor
.
diags = getBlockInfo(advisor,[2 3])
diags = Linearization Diagnostics for the Blocks: Block Info: ----------- Index BlockPath Is On Path Contributes To Linearization Linearization Method 1. scdpendulum/pendulum/Integrator, Second-Order Yes No Exact 2. scdpendulum/angle_wrap/Trigonometric Function1 Yes No Perturbation
Obtain Diagnostics for Blocks in Subsystem
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;
Obtain block paths of linearized blocks.
paths = getBlockPaths(advisor);
Create logical array indicating which blocks are in the angle_wrap
subsystem.
index = contains(paths,'angle_wrap');
Obtain diagnostic information for these blocks.
diags = getBlockInfo(advisor,index)
diags = Linearization Diagnostics for the Blocks: Block Info: ----------- Index BlockPath Is On Path Contributes To Linearization Linearization Method 1. scdpendulum/angle_wrap/Trigonometric Function1 Yes No Perturbation 2. scdpendulum/angle_wrap/Trigonometric Function2 Yes No Perturbation 3. scdpendulum/angle_wrap/Trigonometric Function Yes No Perturbation
Input Arguments
advisor
— Diagnostic information for block linearizations
LinearizationAdvisor
object | array of LinearizationAdvisor
objects
Diagnostic information for block linearizations, specified as a LinearizationAdvisor
object or an array of
LinearizationAdvisor
objects.
block
— Block paths
character vector | cell array of character vectors
Block paths in Simulink model, specified as one of the following:
Character vector — Obtain diagnostic information for a single block.
Cell array of character vectors — Obtain diagnostic information for multiple blocks.
index
— Block indices
positive integer | array of positive integers | boolean array
Block indices, specified as one of the following:
Positive integer — Obtain diagnostic information for the specified element of
Advisor.BlockDiagnostics
Array of positive integers — Obtain diagnostic information for multiple elements of
Advisor.BlockDiagnostics
.Boolean array — For each element of
index
that istrue
, return the diagnostics for the corresponding element ofAdvisor.BlockDiagnostics
.
Output Arguments
blockInfo
— Diagnostic information for block linearizations
BlockDiagnostic
object | vector of BlockDiagnostic
objects | cell array
Diagnostic information for block linearizations indicated by
index
, returned as a
BlockDiagnostic
object or vector of
BlockDiagnostic
objects if advisor
is a single LinearizationAdvisor
object.
If advisor
is an array of
LinearizationAdvisor
objects, then
blockInfo
is a cell array with the same dimensions
as advisor
in which each element is a vector of
BlockDiagnostic
objects.
Version History
Introduced in R2017b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)