setBlockRateConversion

Set rate conversion settings for tuned block in slTuner interface

Syntax

  • setBlockRateConversion(st,blk,method) example
  • setBlockRateConversion(st,blk,'tustin',pwf)

Description

example

setBlockRateConversion(st,blk,method) sets the rate conversion method of a tuned block in the slTuner interface, st.

Tuning is performed at the sampling rate specified by the Ts property of the slTuner interface. When you use writeBlockValue to write tuned parameters back to the Simulink® model, each tuned block value is automatically converted from the sample, Ts, to the sample time of the Simulink block. The rate conversion method associated with each tuned block specifies how this resampling operation is performed.

setBlockRateConversion(st,blk,'tustin',pwf) sets the Tustin method as the rate conversion method for blk, with pwf as the prewarp frequency.

Examples

expand all

Set Rate Conversion Settings of Tuned Block

Create an slTuner interface for the Simulink model, scdcascade, and set the block rate conversion settings of one of the tuned blocks.

Create an slTuner interface, and examine the block rate conversion settings for the C1 block.

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

[method,pwf] = getBlockRateConversion(st,'C1')
method =

tustin


pwf =

     0

Set the block rate conversion method for C1 to zero-order hold.

setBlockRateConversion(st,'C1','zoh');

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'.

method — Rate conversion method'zoh' | 'foh' | 'tustin' | 'matched'

Rate conversion method associated with blk, specified as one of the following strings:

  • 'zoh' — Zero-order hold on the inputs.

  • 'foh' — Linear interpolation of inputs.

  • 'tustin' — Bilinear (Tustin) approximation. Optionally, specify a prewarp frequency with the pwf argument for better frequency-domain matching between the original and rate-converted dynamics near the prewarp frequency.

  • 'matched' — Matched pole-zero method. This method is available for SISO blocks only.

pwf — Prewarp frequency for Tustin methodpositive scalar

Prewarp frequency for the Tustin method, specified as a positive scalar.

More About

expand all

Tuned Block

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.

Was this topic helpful?