Documentation

setBlockParam

Set parameterization of tuned block in slTuner interface

setBlockParam lets you override the default parameterization for a tuned block in an slTuner interface.

An slTuner interface parameterizes each tuned Simulink® block as a Control Design Block, or a generalized parametric model of type genmat or genss. This parameterization specifies the tuned variables for commands such as systune.

Syntax

  • setBlockParam(st,blk,tunable_mdl)
    example
  • setBlockParam(st,blk)
    example
  • setBlockParam(st)

Description

example

setBlockParam(st,blk,tunable_mdl) assigns a tunable model as the parameterization of the specified block of an slTuner interface. You can specify the parameterization for non-atomic components, such as the Subsystem and S-Function blocks.

example

setBlockParam(st,blk) reverts to the default parameterization for the block referenced by blk and initializes the block with the current block value in Simulink.

setBlockParam(st) reverts all the tuned blocks of st to their default parameterizations.

Examples

collapse all

Create an slTuner interface for the scdcascade model.

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

Both C1 and C2 are PI controllers. Examine the default parameterization of C1.

getBlockParam(st,'C1')
ans = 

  Parametric continuous-time PID controller "C1" with formula:

             1 
  Kp + Ki * ---
             s 

  and tunable parameters Kp, Ki.

Type "pid(ans)" to see the current value and "get(ans)" to see all properties.

The default parameterization is a tunable PI controller (tunablePID).

Parameterize C1 as a proportional controller, with only one tunable parameter, Kp.

G = tunableGain('C1',4.2);

setBlockParam(st,'C1',G);

Tuning commands, such as systune, now use this proportional controller parameterization of the C1 block of st.

This custom parameterization is compatible with the default parameterization of the Simulink® block. Therefore, you can use writeBlockValue to write the tuned values back to the block.

Create an slTuner interface for the scdcascade model.

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

Modify the parameterization of C2 to be a tunable gain and examine the result.

G = tunableGain('C2',5);
setBlockParam(st,'C2',G);
getBlockParam(st,'C2')
ans = 

  Parametric gain "C2" with 1 outputs, 1 inputs, and 1 tunable parameters.

Type "ss(ans)" to see the current value and "get(ans)" to see all properties.

Revert the parameterization of C2 back to the default PI controller and examine the result.

setBlockParam(st,'C2');
getBlockParam(st,'C2')
ans = 

  Parametric continuous-time PID controller "C2" with formula:

             1 
  Kp + Ki * ---
             s 

  and tunable parameters Kp, Ki.

Type "pid(ans)" to see the current value and "get(ans)" to see all properties.

Input Arguments

collapse all

Interface for tuning control systems modeled in Simulink, specified as an slTuner interface.

Block in the list of tuned blocks for st, specified as a character vector. You can specify the full block path or any portion of the block path that uniquely identifies the block among the other tuned blocks of st.

Example: blk = 'scdcascade/C1', blk = 'C1'

When reverting to the default block parameterization using setBlockParam(st,blk), you can specify blk as a cell array of character vectors to revert multiple blocks.

Example: {'C1','C2'}

Block parameterization, specified as one of the following:

More About

collapse all

Tuned Blocks

Tuned blocks, used by the slTuner interface, identify blocks in a Simulink model whose parameters are to be tuned to satisfy tuning goals. You can tune most Simulink blocks that represent linear elements such as gains, transfer functions, or state-space models. (For the complete list of blocks that support tuning, see How Tuned Simulink Blocks Are Parameterized). You can also tune more complex blocks such as SubSystem or S-Function blocks by specifying an equivalent tunable linear model.

Use tuning commands such as systune to tune the parameters of tuned blocks.

You must specify tuned blocks (for example, C1 and C2) when you create an slTuner interface.

st = slTuner('scdcascade',{'C1','C2'})

You can modify the list of tuned blocks using addBlock and removeBlock.

To interact with the tuned blocks use:

Tuned Variables

Within an slTuner interface, tuned variables are any Control Design Blocks involved in the parameterization of a tuned Simulink block, either directly or through a generalized parametric model. Tuned variables are the parameters manipulated by tuning commands such as systune.

For Simulink blocks parameterized by a generalized model or a tunable surface:

  • getBlockValue provides access to the overall value of the block parameterization. To access the values of the tuned variables within the block parameterization, use getTunedValue.

  • setBlockValue cannot be used to modify the block value. To modify the values of tuned variables within the block parameterization, use setTunedValue.

For Simulink blocks parameterized by a Control Design Block, the block itself is the tuned variable. To modify the block value, you can use either setBlockValue or setTunedValue. Similarly, you can retrieve the block value using either getBlockValue or getTunedValue.

Introduced in R2011b

Was this topic helpful?