Documentation

setBlockRateConversion

Set rate conversion settings for tuned block in slTuner interface

When you use systune with Simulink®, 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 time used for tuning, to the sample time of the Simulink block. The rate conversion method associated with each tuned block specifies how this resampling operation should be performed. Use getBlockRateConversion to query the block conversion rate and use setBlockRateConversion to modify it.

Syntax

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

Description

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

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

example

setBlockRateConversion(st,blk,IF,DF) sets the discretization methods for the integrator and derivative filter terms when blk is a continuous-time PID Controller block. For discrete-time PID blocks, these methods are specified in the Simulink block and cannot be modified in the slTuner interface.

Examples

collapse all

Set Rate Conversion Settings of Tuned PID Block

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

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

Examine the default block rate conversion for the PID Controller block C1.

[IF,DF] = getBlockRateConversion(st,'C1')
IF =

Trapezoidal


DF =

Trapezoidal

By default, both the integrator and derivative filter controller methods are Trapezoidal. Set the integrator to BackwardEuler and the derivative to ForwardEuler.

IF = 'BackwardEuler';
DF = 'ForwardEuler';
setBlockRateConversion(st,'C1',IF,DF);

Related Examples

Input Arguments

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

Example: blk = 'scdcascade/C1', 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. This method is the default rate-conversion method for most dynamic blocks.

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

For more detailed information about these rate-conversion methods, see Continuous-Discrete Conversion Methods.

pwf — Prewarp frequency for Tustin methodpositive scalar

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

IF,DF — Integrator and filter methods'ForwardEuler' | 'BackwardEuler' | 'Trapezoidal'

Integrator and filter methods for rate conversion of PID Controller block, each specified as one of the following strings:

  • 'ForwardEuler' — Integrator or derivative-filter state discretized as Ts/(z-1)

  • 'BackwardEuler'Ts*z/(z-1)

  • 'Trapezoidal'(Ts/2)*(z+1)/(z-1)

For continuous-time PID blocks, the default methods are 'Trapezoidal' for both integrator and derivative filter. This method is the same as the Tustin method.

For discrete-time PID blocks, IF and DF are determined by the Integrator method and Filter method settings in the Simulink block and cannot be changed with setBlockRateConversion.

See the PID Controller and pid reference pages for more details about integrator and filter methods.

More About

collapse 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 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:

Tips

  • For Model Discretizer blocks, the rate conversion method is specified in the Simulink block and cannot be modified with setBlockRateConversion.

  • For static blocks such as Gain or Lookup Table blocks, the block rate conversion method is ignored.

Introduced in R2014a

Was this topic helpful?