Main Content

getBlockInfo

Obtain diagnostic information for block linearizations

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.

blockInfo = getBlockInfo(advisor) returns the diagnostic information for all blocks listed in the LinearizationAdvisor object, advisor.

example

blockInfo = getBlockInfo(advisor,block) returns diagnostic information for blocks with block paths specified in block.

example

blockInfo = getBlockInfo(advisor,index) returns diagnostic information for blocks with indices specified in index.

example

Examples

collapse all

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           

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           

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           

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

collapse all

Diagnostic information for block linearizations, specified as a LinearizationAdvisor object or an array of LinearizationAdvisor objects.

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.

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 is true, return the diagnostics for the corresponding element of Advisor.BlockDiagnostics.

Output Arguments

collapse all

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