Main Content

Find Blocks in Linearization Results Matching Specific Criteria

When you linearize a Simulink® model, you can find blocks in your linearization result that match specific criteria using the Linearization Advisor. You can specify search criteria to find blocks that can:

  • Potentially cause linearization issues in your model, if your model does not linearize as expected. For more information on identifying and fixing linearization issues using the Linearization Advisor, see Identify and Fix Common Linearization Issues.

  • Help you gain insight into your model linearization, even if the model has linearized as expected.

You can also query the Linearization Advisor at the command line using the find function. For an example, see Troubleshoot Linearization Results at Command Line.

Searching the linearization results requires linearization diagnostic information. To collect this information, you must enable the Linearization Advisor before linearizing your model.

To enable the Linearization Advisor, in the Model Linearizer, on the Linear Analysis tab, select Linearization Advisor.

When you select this option and linearize your model, the software opens an Advisor tab for troubleshooting your linearization results. You can then find blocks of interest in the linearization results by running queries with the Linearization Advisor.

After finding blocks of interest, you can examine the individual block linearizations using the linearization diagnostic information. For more information, see Block Linearization Troubleshooting.

Run Built-In Queries

The Linearization Advisor provides a set of built-in queries for searching your linearization results. These queries are useful for finding blocks that are potentially causing linearization issues. To run one of these queries, on the Advisor tab, in the Queries section, click the query.

Built-In QueryFind Blocks That...
Linearization AdviceAre potentially problematic for linearization. This query is performed by default when the Advisor tab opens.
Diagnostics on PathAre on the linearization path and that have diagnostic messages regarding their linearization. This query is a subset of the Linearization Advice query.
Substitutions on PathAre on the linearization path and have a custom block linearization specified. This query is a subset of the Linearization Advice query.
Zero I/O Pair on PathAre on the linearization path and have at least one input/output pair that linearizes to zero.
All Blocks on PathAre on the linearization path; that is, blocks where at least one linearization input is connected to at least one linearization output through the block.

Create and Run Queries

The linearization advisor also provides a set of simple queries for searching your model. You can run these queries on their own or use them to create compound queries.

Simple QueryFind Blocks That...
All BlocksAre in the linearized model.
Linearized to ZeroLinearize to zero.
Block SubstitutedHave a custom block linearization specified.
On Linearization PathAre on the linearization path.
Contributes to LinearizationNumerically contribute to the model linearization result.
ExactAre linearized using their defined exact linearization.
PerturbationAre linearized using numerical perturbation.
Has DiagnosticsHave diagnostic messages regarding their linearization.
'BlockType' BlocksAre of a specified type.
Has 'Nu' InputsHave a specified number of inputs.
Has 'Nx' StatesHave a specified number of states.
Has 'Ny' OutputsHave a specified number of outputs.
Has 'Ts' Sample TimeHave a specified sample time.
Has Zero I/O PairHave at least one input/output pair that linearizes to zero.

To run a simple query, in the Model Linearizer, on the Advisor tab, click New Query.

In the Query Builder dialog box, configure the query. For example, create a query for finding all blocks that numerically contribute to the linearization result.

  1. In the Query Name field, specify the name for the query as Contributes.

  2. In the drop-down list, select Contributes to Linearization.

  3. If you select any of the following queries, specify the corresponding search parameter.

    QuerySearch Parameter
    'BlockType' BlocksBlock Type — This parameter corresponds to the blocktype property of the block. For more information, see linqueryIsBlockType.
    Has 'Nu' InputsInputs — Specify a positive integer.
    Has 'Nx' StatesStates — Specify a positive integer.
    Has 'Ny' OutputsOutputs — Specify a positive integer.
    Has 'Ts' Sample TimeSample Time — Specify a nonzero scalar. To find continuous-time blocks, specify 0.
  4. To create and run the query, click Run Query. The software runs the query and, on the Advisor tab, displays the list of blocks that contribute to the model linearization.

    The query is added to the Queries section.

You can also create compound queries by logically combining existing queries using And, Or, and Not logical operations. You can create a compound query using simple queries, built-in queries, or other compound queries.

To create a compound query, in the Query Builder dialog box, configure the query using multiple search criteria. For example, create a query to find all discrete-time blocks that are on the linearization path.

  1. In the Query Name field, specify the name for the query as Discrete on Path.

  2. To find blocks on the linearization path, in the drop-down list, select On Linearization Path.

  3. To add another search criteria, click Add to Query. The software adds a second row to the search criteria. By default, the search criteria are combined using an And operation.

  4. To find discrete-time blocks, first add a search criteria to find continuous-time blocks. In the second row, in the drop-down list, select Has 'Ts' Sample Time. Keep the default Sample Time of 0.

  5. To find discrete-time blocks, in the second row, select Not.

  6. Click Run Query.

Each time you create a custom query, the software adds it to the drop-down list of search criteria in the Query Builder dialog box. You can then use your custom queries to create more complex queries. For example, to find discrete-time blocks on the linearization path that are linearized using numerical perturbation, create a query that combines the Discrete on Path custom query with the Perturbed simple query using an And operation.

See Also

Apps

Functions

Related Topics