Documentation

slLinearizer

Interface for batch linearization of Simulink models

Syntax

  • sllin = slLinearizer(mdl) example
  • sllin = slLinearizer(mdl,pt)
  • sllin = slLinearizer(mdl,param)
  • sllin = slLinearizer(mdl,op)
  • sllin = slLinearizer(mdl,blocksub)
  • sllin = slLinearizer(mdl,opt)
  • sllin = slLinearizer(mdl,pt,op,param,blocksub,opt)

Description

example

sllin = slLinearizer(mdl) creates an slLinearizer interface, sllin, for linearizing the Simulink® model, mdl. The interface adds the linear analysis points marked in the model as analysis points of sllin. The interface additionally adds the linear analysis points that imply an opening as permanent openings.

sllin = slLinearizer(mdl,pt) adds the specified point to the list of analysis points for sllin, ignoring linear analysis points marked in the model.

sllin = slLinearizer(mdl,param) specifies the parameters whose values you want to vary when linearizing the model.

sllin = slLinearizer(mdl,op) specifies the operating points for linearizing the model.

sllin = slLinearizer(mdl,blocksub) specifies substitute linearizations of blocks and subsystems. Use this syntax, for example, to specify a custom linearization for a block. You can also use this syntax for blocks that do not linearize successfully, such as blocks with discontinuities or triggered subsystems.

sllin = slLinearizer(mdl,opt) configures the linearization algorithm options.

sllin = slLinearizer(mdl,pt,op,param,blocksub,opt) uses any combination of the input arguments pt, op, param, blocksub, and opt to create sllin.

For example, use any of the following:

  • sllin = slLinearizer(mdl,pt,param)

  • sllin = slLinearizer(mdl,op,param).

If you do not specify pt, the interface adds the linear analysis points marked in the model as analysis points. The interface additionally adds linear analysis points that imply an opening as permanent openings.

Object Description

slLinearizer provides an interface between a Simulink model and the linearization commands getIOTransfer, getLoopTransfer, getSensitivity, and getCompSensitivity. Use slLinearizer to efficiently batch linearize a model. You can configure the slLinearizer interface to linearize a model at a range of operating points and specify variations for model parameter values. Use interface analysis points and permanent openings to obtain linearizations for any open-loop or closed-loop transfer function from a model. Analyze the stability, or time-domain or frequency-domain characteristics of the linearized models.

Commands that extract linearizations from the slLinearizer interface recompile the Simulink model if you changed any interface properties since the last linearization. The commands also recompile the Simulink model if you made calls to specific functions since the last linearization. These functions include addPoint, addOpening, removePoint, removeOpening, removeAllPoints, and removeAllOpenings.

Examples

collapse all

Create and Configure slLinearizer Interface for Batch Linear Analysis

Create an slLinearizer interface for the scdcascade model. Add analysis points to the interface to extract open- or closed-loop transfer functions from the model. Configure the interface to vary parameters and operating points.

Open the scdcascade model.

mdl = 'scdcascade';
open_system(mdl);

Create an slLinearizer interface for the model. Add the signals r, u1,u2, y1,y2, y1m, and y2m to the interface.

sllin = slLinearizer(mdl,{'r','u1','u2','y1','y2','y1m','y2m'});

scdcascade contains two PID Controller blocks, C1 and C2. Suppose you want to vary the proportional and integral gains of C2, Kp2 and Ki2, in the 10% range. Create a structure to specify the parameter variations.

Kp2_range = linspace(0.9*Kp2,1.1*Kp2,3);
Ki2_range = linspace(0.9*Ki2,1.1*Ki2,5);

[Kp2_grid,Ki2_grid]=ndgrid(Kp2_range,Ki2_range);

params(1).Name = 'Kp2';
params(1).Value = Kp2_grid;

params(2).Name = 'Ki2';
params(2).Value = Ki2_grid;

params specifies a 3x5 parameter grid. Each point in this grid corresponds to a combination of the Kp2 and Ki2 parameter values.

Specify params as the Parameters property of sllin.

sllin.Parameters = params;

Now, when you use commands such as getIOTransfer, getLoopTransfer, getSensitivity, and getCompSensitivity, the software returns a linearization for each parameter grid point specified by sllin.Parameters.

Suppose you want to linearize the model at multiple snapshot times, for example at t = {0,1,2}. To do so, configure the OperatingPoints property of sllin.

sllin.OperatingPoints = [0 1 2];

You can optionally configure the linearization options and specify substitute linearizations for blocks and subsystems in your model. After fully configuring sllin, use the getIOTransfer, getLoopTransfer, getSensitivity, and getCompSensitivity commands to linearize the model as required.

Related Examples

Input Arguments

collapse all

mdl — Name of Simulink model to be linearizedstring

Name of Simulink model to be linearized, specified as a string.

Example: 'scdcascade'

pt — Analysis pointstring | cell array of strings | vector of linearization I/O objects

Analysis point to be added to the list of analysis points for sllin, specified as:

  • String — Analysis point identifier that can be any of the following:

    • Analysis point signal name, for example pt = 'torque'

    • Block path for a block with a single output port, for example pt = 'Motor/PID'

    • Path to block and port originating the analysis point, for example pt = 'Engine Model/1' or pt = 'Engine Model/torque'

  • Cell array of strings — Specifies multiple analysis point identifiers. For example:

    pt = {'torque','Motor/PID'}
  • Vector of linearization I/O objects — Use linio to create pt. For example:

    pt(1) = linio('scdcascade/setpoint',1,'input');
    pt(2) = linio('scdcascade/Sum',1,'output');

    Here, pt(1) specifies an input, and pt(2) specifies an output.

    The interface adds all the points specified by pt and ignores their I/O types. The interface additionally adds all 'loopbreak' type signals as permanent openings.

param — Parameter samples for linearizing mdlstructure | structure array

Parameter samples for linearizing mdl, specified as:

  • Structure — For a single parameter, param must be a structure with the following fields:

    • Name — Parameter name, specified as a string or MATLAB® expression

    • Value — Parameter sample values, specified as a double array

    For example:

    param.Name = 'A';
    param.Value = linspace(0.9*A,1.1*A,3);
  • Structure array — Vary the value of multiple parameters. For example, suppose you want to vary the value of the A and b model parameters in the 10% range:

    [A_grid,b_grid] = ndgrid(linspace(0.9*A,1.1*A,3),...
                               linspace(0.9*b,1.1*b,3));
    params(1).Name = 'A';
    params(1).Value = A_grid;
    params(2).Name = 'b';
    params(2).Value = b_grid;

If param specifies tunable parameters only, then the software batch linearizes the model using a single compilation. If you additionally configure sllin.OperatingPoints with operating point objects only, the software uses single model compilation.

op — Operating point for linearizing mdloperating point object | array of operating point objects | array of positive scalars

Operating point for linearizing mdl, specified as:

  • Operating point object, created using findop.

    For example:

    op = findop('magball',operspec('magball'));
  • Array of operating point objects, specifying multiple operating points.

    For example:

    op = findop('magball',[10 20]);
  • Array of positive scalars, specifying simulation snapshot times.

    For example:

    op = [1 4.2];

If you configure sllin.Parameters, then specify op as one of the following:

  • Single operating point.

  • Array of operating point objects whose size matches that of the parameter grid specified by the Parameters property. When you batch linearize mdl, the software uses only one model compilation.

  • Multiple snapshot times. When you batch linearize mdl, the software simulates the model for each snapshot time and parameter grid point combination. This operation can be computationally expensive.

blocksub — Substitute linearizations for blocks and model subsystemsstructure | structure array

Substitute linearizations for blocks and model subsystems. Use blocksub to specify a custom linearization for a block or subsystem. You also can use blocksub for blocks that do not have analytic linearizations, such as blocks with discontinuities or triggered subsystems. Specify multiple substitute linearizations for a block to obtain a linearization for each substitution (batch linearization). Use this functionality, for example, to study the effects of varying the linearization of a Saturation block on the model dynamics.

blocksub is an n-by-1 structure, where n is the number of blocks for which you specify the linearization. blocksub has these fields:

  • Name — Block path corresponding to the block for which you want to specify the linearization.

    blocksub.Name is a string of the form model/subsystem/block that uniquely identifies a block in the model.

  • Value — Desired linearization of the block, specified as one of the following:

    • Double, for example 1. Use for SISO models only. For models having either multiple inputs or multiple outputs, or both, use an array of doubles. For example, [0 1]. Each array entry specifies a linearization for the corresponding I/O combination.

    • LTI model, uncertain state-space model (requires Robust Control Toolbox™ software), or uncertain real object (requires Robust Control Toolbox software). Model I/Os must match the I/Os of the block specified by Name. For example, zpk([],[-10 -20],1).

    • Array of LTI models, uncertain state-space models, or uncertain real objects. For example, [zpk([],[-10 -20],1); zpk([],[-10 -50],1)].

      If you vary model parameter values, then the LTI model array size must match the grid size.

    • Structure, with the following fields (for information about each field, click the field name)

      •  Specification

      •  Type

      •  ParameterNames

      •  ParameterValues

opt — Linearization algorithm optionsoptions set created using linearizeOptions

Linearization algorithm options, specified as an options set created using linearizeOptions.

Example: opt = linearizeOptions('LinearizationAlgorithm','numericalpert')

Properties

slLinearizer objects properties include:

Parameters

Parameter samples for linearizing mdl, specified as a structure or a structure array.

Set this property using the param input argument or dot notation (sllin.Parameters = param). param must be one of the following:

  • Structure — For a single parameter, param must be a structure with the following fields:

    • Name — Parameter name, specified as a string or MATLAB expression

    • Value — Parameter sample values, specified as a double array

    For example:

    param.Name = 'A';
    param.Value = linspace(0.9*A,1.1*A,3);
  • Structure array — Vary the value of multiple parameters. For example, suppose you want to vary the value of the A and b model parameters in the 10% range:

    [A_grid,b_grid] = ndgrid(linspace(0.9*A,1.1*A,3),...
                               linspace(0.9*b,1.1*b,3));
    params(1).Name = 'A';
    params(1).Value = A_grid;
    params(2).Name = 'b';
    params(2).Value = b_grid;

If param specifies tunable parameters only, then the software batch linearizes the model using a single compilation. If you additionally configure sllin.OperatingPoints with operating point objects only, the software uses single model compilation.

OperatingPoints

Operating points for linearizing mdl, specified as an operating point object, array of operating point objects, or array of positive scalars.

Set this property using the op input argument or dot notation (sllin.OperatingPoints = op). op must be one of the following:

  • Operating point object, created using findop.

    For example:

    op = findop('magball',operspec('magball'));
  • Array of operating point objects, specifying multiple operating points.

    For example:

    op = findop('magball',[10 20]);
  • Array of positive scalars, specifying simulation snapshot times.

    For example:

    op = [1 4.2];

If you configure sllin.Parameters, then specify op as one of the following:

  • Single operating point.

  • Array of operating point objects whose size matches that of the parameter grid specified by the Parameters property. When you batch linearize mdl, the software uses only one model compilation.

  • Multiple snapshot times. When you batch linearize mdl, the software simulates the model for each snapshot time and parameter grid point combination. This operation can be computationally expensive.

BlockSubstitutions

Substitute linearizations for blocks and model subsystems, specified as a structure or structure array.

Use this property to specify a custom linearization for a block or subsystem. You also can use this syntax for blocks that do not have analytic linearizations, such as blocks with discontinuities or triggered subsystems.

Set this property using the blocksub input argument or dot notation (sllin.BlockSubstitutions = blocksubs). For information about the required structure, see blocksub.

Options

Linearization algorithm options, specified as an options set created using linearizeOptions.

Set this property using the opt input argument or dot notation (sllin.Options = opt).

Model

Name of the Simulink model to be linearized, specified as a string by the input argument mdl.

More About

collapse all

Analysis Points

Analysis points, used by the slLinearizer and slTuner interfaces, identify locations within a model that are relevant for linear analysis and control system tuning. You use analysis points as inputs to the linearization commands, such as getIOTransfer, getLoopTransfer, getSensitivity, and getCompSensitivity. As inputs to the linearization commands, analysis points can specify any open- or closed-loop transfer function in a model. You can also use analysis points to specify design requirements when tuning control systems using commands such as systune (requires a Robust Control Toolbox license).

Location refers to a specific block output port within a model. For convenience, you can use the name of the signal that originates from this port to refer to an analysis point.

You can add analysis points to an slLinearizer or slTuner interface, s, when you create the interface. For example:

s = slLinearizer('scdcascade',{'u1','y1'});

Alternatively, you can use the addPoint command.

To view all the analysis points of s, type s at the command prompt to display the interface contents. For each analysis point of s, the display includes the block name and port number and the name of the signal that originates at this point. You can also use getPoints to programmatically obtain a list of all the analysis points.

For more information about how you can use analysis points, see Marking Signals of Interest for Control System Analysis and Design.

Permanent Openings

Permanent openings, used by the slLinearizer and slTuner interfaces, identify locations within a model where the software breaks the signal flow. The software enforces these openings for linearization and tuning. Use permanent openings to isolate a specific model component. Suppose you have a large-scale model capturing aircraft dynamics and you want to perform linear analysis on the airframe only. You can use permanent openings to exclude all other components of the model. Another example is when you have cascaded loops within your model and you want to analyze a specific loop.

Location refers to a specific block output port within a model. For convenience, you can use the name of the signal that originates from this port to refer to an opening.

You can add permanent openings to an slLinearizer or slTuner interface, s, when you create the interface or by using the addOpening command. To remove a location from the list of permanent openings, use the removeOpening command.

To view all the openings of s, type s at the command prompt to display the interface contents. For each permanent opening of s, the display includes the block name and port number and the name of the signal that originates at this location. You can also use getOpenings to programmatically obtain a list of all the permanent openings.

Algorithms

slLinearizer linearizes your Simulink model using the algorithms described in Exact Linearization Algorithm.

Was this topic helpful?