Documentation Center

  • Trial Software
  • Product Updates

setBlockParam

Set parameterization of tuned block in slTuner interface

Syntax

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

Description

example

setBlockParam(st,blk,tunable_mdl) assigns a tunable model as the parameterization of the specified block of the slTuner interface, st.

The parameterization of a block specifies which parameters are tuned by tuning commands such as systune. Use setBlockParam to override the default parameterization for a tuned block. You can specify the parameterization for non-atomic components, such as the Subsystem and S-Function blocks.

After tuning a block, you generally update the value of its corresponding block in the Simulink® model using writeBlockValue. writeBlockValue skips blocks that cannot represent their tuned value in a straightforward and lossless manner. For example, suppose you tune an user defined Subsystem or S-Function block. writeBlockValue will skip this block because there is no clear way to map the tuned value to a Subsystem or S-Function block. Similarly, if you parameterize a Gain block as a second-order transfer function, writeBlockValue will skip this block, unless the transfer function value is a static gain.

setBlockParam(st,blk) reverts to the default parameterization for the block referenced by blk. The block parameterizations are initialized with the current block values in Simulink.

For this syntax, you can specify blk as a string or cell array of strings.

setBlockParam(st) reverts to the default parameterization and current block value for all the tuned blocks of st.

For this syntax, you can specify blk as a string or cell array of strings.

Examples

expand all

Set Parameterization of Tuned Block

Create an slTuner interface for the scdcascade model, and override the default parameterization for one of the tuned blocks.

Create an slTuner interface.

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

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

getBlockParam(st,'C1')
  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 (ltiblock.pid).

Suppose you want to parameterize C1 as a proportional controller, with only one tunable parameter, Kp.

G = ltiblock.gain('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.

Input Arguments

expand all

st — Interface for tuning control systems modeled in SimulinkslTuner interface

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

blk — Blockstring

Block in the list of tuned blocks for st, specified as a string.

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.

For example, blk = 'scdcascade/C1' or blk = 'C1'.

tunable_mdl — Block parameterizationcontrol design block | generalized state-space model

Block parameterization, specified as either a tunable Control Design Block or genss model.

More About

expand 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 commands such as systune and looptune 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. Use commands such as setBlockParam, getBlockValue, and writeBlockValue to interact with and manipulate tuned blocks.

See Also

| | | | |

Was this topic helpful?