Documentation

linqueryHasOutputs

Query object for finding blocks with specified number of outputs

Description

linqueryHasOutputs creates a custom query object for finding all the blocks in a linearization result that have a specified number of outputs.

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 Linear Analysis Tool. For more information on finding specific blocks in linearization results, see Find Blocks in Linearization Results Matching Specific Criteria.

Creation

Syntax

query = linqueryHasOutputs(Ny)

Description

example

query = linqueryHasOutputs(Ny) creates a query object for finding all the blocks in a LinearizationAdvisor object that have Ny outputs.

Input Arguments

expand all

Number of block outputs, specified as a nonnegative integer.

Properties

expand all

Number of block outputs, specified as a nonnegative integer equal to Ny.

Query type, specified as a character vector of the form 'Has <N> Outputs', where <N> is equal to NumOutputs.

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

Usage

After creating a linqueryHasOutputs query object, you can:

  • Find all the blocks in a LinearizationAdvisor object that have the specified number of outputs by using the linqueryHasOutputs query directly with the find command.

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

Object Functions

findFind blocks in linearization results that match specific criteria

Examples

expand all

Load the Simulink model.

mdl = 'scdpendulum';
load_system(mdl)

Linearize the model and obtain the LinearizationAdvisor object.

opts = linearizeOptions('StoreAdvisor',true);
io = getlinio(mdl);
[sys,op,info] = linearize(mdl,io,opts);
advisor = info.Advisor;

Create query object, and find all the linearized blocks with two outputs.

qOut = linqueryHasOutputs(2);
advOut = find(advisor,qOut)
advOut = 
  LinearizationAdvisor with properties:

               Model: 'scdpendulum'
      OperatingPoint: [1x1 opcond.OperatingPoint]
    BlockDiagnostics: [1x1 linearize.advisor.BlockDiagnostic]
           QueryType: 'Has 2 Outputs'

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)'

Alternative Functionality

App

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

Introduced in R2017b

Was this topic helpful?