Main Content

linqueryIsBlockType

Query object for finding blocks of the specified type

Description

linqueryIsBlockType creates a custom query object for finding all the blocks of a specified type in a linearization result.

When you linearize a Simulink® model, you can create a LinearizationAdvisor object that contains diagnostic information about individual block linearizations. To find block linearizations that satisfy specific criteria, you can use the find function with custom query objects. Alternatively, you can analyze linearization diagnostics using the Linearization Advisor in the Model Linearizer. For more information on finding specific blocks in linearization results, see Find Blocks in Linearization Results Matching Specific Criteria.

Creation

Description

query = linqueryIsBlockType(Type) creates a query object for finding all the blocks in a LinearizationAdvisor object that are of type Type.

example

Input Arguments

expand all

Block type, specified as a character vector or string. To specify a block type, use the corresponding blocktype parameter of the block. To get the blocktype parameter for the currently selected block in the Simulink model, at the MATLAB® command line, type:

get_param(gcb,'blocktype')

Also, to find:

  • MATLAB Function blocks, specify Type as 'matlab function'.

  • Stateflow charts, specify Type as 'chart'.

  • Simscape networks, specify Type as 'simscape'. A LinearizationAdvisor object does not provide diagnostic information on a component-level basis for Simscape™ networks. Instead, it groups diagnostic information together for multiple Simscape components connected to a single Solver Configuration block.

Properties

expand all

Query type, specified as a character vector of the form '<type> Blocks', where <type> is equal the block type specified in Type.

Query description, specified as a character vector of the form 'Blocks with <type> Block types', where <type> is equal to Type. You can add your own description to the query object using this property.

Usage

After creating a linqueryIsBlockType query object, you can:

  • Find all the blocks of a specified type in a LinearizationAdvisor object by using the linqueryIsBlockType query directly with the find command.

  • Create a CompoundQuery object by logically combining the linqueryIsBlockType query with other query objects.

Object Functions

findFind blocks in linearization results that match specific criteria

Examples

collapse all

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 query object, and find all the integrator blocks.

qInteg = linqueryIsBlockType('Integrator');
advInteg = find(advisor,qInteg)
advInteg = 
  LinearizationAdvisor with properties:

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

Alternative Functionality

App

You can also create custom queries for finding specific blocks in linearization results using the Linearization Advisor in the Model Linearizer. For more information, see Find Blocks in Linearization Results Matching Specific Criteria.

Version History

Introduced in R2017b