Rate Transition

Handle transfer of data between blocks operating at different rates

Library

Signal Attributes

Description

The Rate Transition block transfers data from the output of a block operating at one rate to the input of another block operating at a different rate. The Rate Transition block's parameters allow you to specify options that trade data integrity and deterministic transfer for faster response and/or lower memory requirements.

In particular, the block supports the following options:

The behavior of the Rate Transition block depends on the sample times of the ports between which it is connected, the priorities of the tasks corresponding to the source and destination sample times (see Sample time properties), and whether the model specifies a fixed- or variable-step solver. Updating the diagram causes a label to appear on the block that indicates its behavior during simulation as follows:

LabelBlock Behavior
ZOHActs as a zero-order hold
1/zActs as a unit delay
BufCopies input to output under semaphore control
Db_bufCopies input to output, using double buffers
CopyUnprotected copy of input to output
NoOpDoes nothing

The behavior label lets you see at a glance the method that the Rate Transition block uses to ensure safe transfer of data between tasks operating at different rates. You can use Simulink® software's sample-time colors feature (see Displaying Sample Time Colors) to display the relative rates that the block bridges. Consider, for example, the following diagram.

Sample-time colors and the block behavior label allow you to see at a glance that the Rate Transition block at the top of the diagram acts as a zero-order hold in a fast-to-slow transition and the bottom Rate Transition block acts as a unit delay in a slow-to-fast transition.

See Sample Rate Transitions in the online Real-Time Workshop documentation for more information.

Data Type Support

The Rate Transition block accepts signals of any data type supported by Simulink software, including fixed-point data types.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink® in the Simulink documentation.

Parameters and Dialog Box

Ensure data integrity during data transfer

Selecting this option results in generation of code that ensures the integrity of data transferred by the Rate Transition block. If you select this option and the transfer is nondeterministic (see Ensure deterministic data transfer option below), the generated code uses double-buffering to prevent the fast block from interrupting the data transfer. Otherwise the generated code uses a copy operation to effect the data transfer. The copy operation consumes less memory than double-buffering but is also interruptible and hence can lead to loss of data during nondeterministic data transfers. Thus, you should select this option if you want the generated code to operate both with maximum responsiveness (i.e., nondeterministically) and assured data integrity. See Rate Transition Block Options in the online Real-Time Workshop documentation for more information.

Ensure deterministic data transfer (maximum delay)

Selecting this option causes code generation to generate code that transfers data at the sample rate of the slower block, i.e., deterministically. If this option is not selected, data transfers occur as soon as new data is available from the source block and the receiving block is ready to receive the data. This avoids the need to delay transfers, thus ensuring that the system operates with maximum responsiveness. However, it also means that transfers can occur unpredictably, which is undesirable in some applications. See Rate Transition Block Options in the online Real-Time Workshop documentation for more information.

Initial conditions

This parameter applies only to slow-to-fast transitions. It specifies the Rate Transition's initial output at the beginning of a transition when there is not yet any output from the slow block connected to the Rate Transition block's input. Simulink software does not allow the initial output of this block to be inf or NaN.

Output port sample time options

Specifies a mode for setting the output port sample time. The options are:

Output port sample time

This parameter is visible only if the Output port sample time options parameter is set to Specify. Enter a value that specifies the output rate to which the block converts its input rate. The default value (-1) specifies that the output rate is inherited from the block to which the Rate Transition block's output port is connected. See Specifying Sample Time in the Simulink documentation for information on how to specify the output rate.

Sample time multiple (>0)

This parameter is visible only if the Output port sample time options parameter specifies Multiple of input port sample time. Enter a positive value that specifies the output rate as a multiple of the input port sample time. The default value (1) specifies that the output rate is the same as the input rate. A value of 0.5 specifies that the output rate is half of the input rate, while a value of 2 specifies that the output rate is twice the input rate.

Bus Support

The Rate Transition block is a bus-capable block. The input can be a virtual or nonvirtual bus signal, with the restriction that Initial conditions must be zero or a nonzero scalar.

Characteristics

Bus-capableYes, with restrictions as noted above

Direct Feedthrough

No for slow-to-fast transitions that are protected, i.e., for which you have checked the Ensure data integrity during data transfer option. Otherwise, Yes.

Sample Time

This block supports discrete-to-discrete transitions.

Scalar Expansion

Yes, of input.

Dimensionalized

Yes

Multidimensionalized

Yes

Zero Crossing

No

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS