slTuner

Interface for control system tuning of Simulink models

Syntax

  • st = slTuner(mdl,tuned_blocks)
  • st = slTuner(mdl,tuned_blocks,pt)
  • st = slTuner(mdl,tuned_blocks,param)
  • st = slTuner(mdl,tuned_blocks,op)
  • st = slTuner(mdl,tuned_blocks,blocksub)
  • st = slTuner(mdl,tuned_blocks,opt)
  • st = slTuner(mdl,tuned_blocks,pt,op,param,blocksub,opt)

Description

st = slTuner(mdl,tuned_blocks) creates an slTuner interface, st, for tuning the control system blocks of the Simulink® model, mdl. The interface adds the linear analysis points marked in the model as analysis points of st. The interface additionally adds the linear analysis points that imply an opening as permanent openings. When the interface performs linearization, for example, to tune the blocks, it uses the model initial condition as the operating point.

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

st = slTuner(mdl,tuned_blocks,param) specifies the parameters whose values you want to vary when tuning the model blocks.

st = slTuner(mdl,tuned_blocks,op) specifies the operating points for tuning the model blocks.

st = slTuner(mdl,tuned_blocks,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.

st = slTuner(mdl,tuned_blocks,opt) configures the linearization algorithm options.

st = slTuner(mdl,tuned_blocks,pt,op,param,blocksub,opt) uses any combination of the input arguments pt, op, param, blocksub, and opt to create st. For example, you can use:

  • st = slTuner(mdl,tuned_blocks,pt,param)

  • st = slTuner(mdl,tuned_blocks,op,param).

Object Description

slTuner provides an interface between a Simulink model and the tuning commands systune and looptune. (Using these tuning commands requires Robust Control Toolbox™ software). slTuner allows you to:

  • Specify the control architecture.

  • Designate and parameterize blocks to be tuned.

  • Tune the control system.

  • Validate design by computing (linearized) open-loop and closed-loop responses.

Because tuning commands such as systune operate on linear models, the slTuner interface automatically computes and stores a linearization of your Simulink model. This linearization is automatically updated when you change any properties of the slTuner interface. The update occurs when you call commands that query the linearization stored in the interface. Such commands include systune, looptune, getIOTransfer, and getLoopTransfer. For more information about linearization, see What Is Linearization?

Examples

expand all

Create and Configure slTuner Interface for Control System Tuning

Create an slTuner interface for a Simulink model that specifies which blocks to tune with systune or looptune. Further configure the interface by adding analysis points for specifying design goals and extracting system responses.

For this example, create and configure an slTuner interface for tuning the scdcascade two-loop control system model. Open the model.

mdl = 'scdcascade';
open_system(mdl);

The control system consists of two feedback loops, an inner loop with PI controller C2, and an outer loop with PI controller C1. Suppose you want to tune this model to meet the following control objectives:

  • Track setpoint changes to r at the system output y1m with zero steady-state error and specified rise time.

  • Reject the disturbance represented by d2.

The systune command can jointly tune the controller blocks to meet these design requirements, which you specify using TuningGoal objects. The slTuner interface sets up this tuning task.

Create the slTuner interface.

st = slTuner(mdl,{'C1','C2'});

This command initializes the slTuner interface and designates the two PI controller blocks as tunable. Each tunable block is automatically parameterized according to its type and initialized with its value in the Simulink model. A linearization of the remaining, nontunable portion of the model is computed and stored in the slTuner interface.

To configure the slTuner interface, designate as analysis points any signal locations of relevance to your design requirements. Add the output and reference input for the tracking requirement. Also, add the disturbance-rejection location.

addPoint(st,{'r','y1m','d2'});

These locations in your model are now available for referencing in TuningGoal objects that capture your design goals.

Display a summary of the slTuner interface configuration in the command window.

st
slTuner tuning interface for "scdcascade":

2 Tuned blocks: 
--------------------------
Block 1: scdcascade/C1
Block 2: scdcascade/C2
 
3 Analysis points: 
--------------------------
Point 1: Signal "r", located at port 1 of scdcascade/setpoint
Point 2: Signal "y1m", located at port 1 of scdcascade/Sum
Point 3: Port 1 of scdcascade/d2
 
No permanent openings. Use addOpening to add new permanent openings.
Properties with dot notation get/set access:
      Parameters         : [] 
      OperatingPoints    : [] (model initial condition will be used.)
      BlockSubstitutions : []
      Options            : [1x1 linearize.SlTunerOptions]
      Ts                 : 0

The display lists the designated tunable blocks, analysis points, and other information about the interface. In the command window, click on any highlighted signal to see its location in the Simulink model. Note that specifying the block name 'd2' in the addPoint command is equivalent to designating that block's single output signal as the analysis point.

You can now capture your design goals with TuningGoal objects and use systune or looptune to tune the control system to meet those design goals.

In addition to specifying design goals, you can use analysis points for extracting system responses. For example, extract and plot the step response between the reference signal 'r' and the output 'y1m'.

T = getIOTransfer(st,'r','y1m');
stepplot(T)

Input Arguments

expand all

mdl — Simulink model namestring

Simulink model name, specified as a string.

Example: 'scdcascade'

tuned_blocks — Blocks to be tunedstring | cell array of strings

Blocks to be added to the list of tuned blocks of st, specified as:

  • String — Block path. You can specify the full block path or a partial path. The partial path must match the end of the full block path and unambiguously identify the block to add. For example, you can refer to a block by its name, provided the block name appears only once in the Simulink model.

    For example, blk = 'scdcascade/C1'.

  • Cell array of strings — Multiple block paths.

    For example, blk = {'scdcascade/C1','scdcascade/C2'}.

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

An analysis point to be added to the list of analysis points for st, specified as:

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

    • Signal name, for example pt = 'torque'

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

    • Block path and port originating the signal, for example pt = 'Engine Model/1'

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

    pt = {'torque','Motor/PID','Engine Model/1'}
  • 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 batch linearization of 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 st.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 st.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

slTuner objects properties include:

TunedBlocks

Blocks to be tuned in mdl, specified as a cell array of strings.

When you create an slTuner interface, the TunedBlocks property is automatically populated with the blocks you specify in the tuned_blocks input argument. To specify additional tunable blocks in an existing an existing slTuner interface, use addBlock.

Ts

Sampling time for analyzing and tuning mdl, specified as nonnegative scalar.

Set this property using dot notation (st.Ts = Ts).

Default: 0 (implies continuous-time)

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 (st.Parameters = param). param must be one of the following:

If param specifies tunable parameters only, then the software batch linearizes the model using a single compilation. If you additionally configure st.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 (st.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 st.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 (st.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 (st.Options = opt).

Model

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

More About

expand 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 Managing Signals in 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

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

Was this topic helpful?