Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

RTE Rate Transition

Library

RT-EVENTS Signal Attribute

Block

Description

The RTE Rate Transition block handles the transfer of data between blocks operating at different rates. It transfers data from the output of a block operating at one rate to the input of another block operating at a different rate. This block is used to exchange data between two real-time subsystems working at different rates in RT-LAB simulator. See the first two examples in the example section.

The behavior of the Rate Transition block depends on the sample times of the ports between which it is connected. The block acts as a zero-order hold block or acts as a unit delay block. In the zero-order hold block mode, the block transfers data from a fast rate to a slow rate. In the unit delay mode, the block transfers data from a slow rate to a fast rate. The following figure illustrates the two general cases.

RTE Rate Transition - Sample Time Color

The color scheme in Figure 44 comes from Simulink® software's sample-time colors feature (select Sample Time Colors from the Format menu). When the option is activated, the blocks and lines in the model are colored according to the sample rates at which the blocks operate. The table below lists this color code:

Color

Use

Black

Continuous blocks

Magenta

Constant blocks

Yellow

Hybrid (subsystems grouping blocks, Mux or Demux blocks grouping signals with varying sample times, Data Store Memory blocks updated and read by different tasks)

Red

Fastest discrete sample time

Green

Second fastest discrete sample time

Blue

Third fastest discrete sample time

Light Blue

Fourth fastest discrete sample time

Dark Green

Fifth fastest discrete sample time

Orange

Sixth fastest discrete sample time

Cyan

Blocks in triggered subsystems

Grey

Fixed in minor step

Compensation for skipped event

The RTE Rate Transition block supports compensation for skipped events.

When the number of events int the input RTE signal is greater than the maximum number of events specified (MaxEvent), the extra events stored in memory are ignored, and it can occur that the last output state is different from the output state that would be output if all events were taken into account. By enabling the ‘Skipped events compensation’ parameter, the block can compensate for these events and add a new event (rising or falling) to toggle the output state so that the last state provided by the block matches the state that would be reached if all events were taken into account.

Suppose for example a "Fast to Slow" transition with the MaxEvent parameter set to 5. The fast rate is set to 1 second and the slow rate is set to 2 seconds. The following figure illustrates the effect of compensation. When the compensation is enabled, the fourth event (falling edge) of the second fast step is compensated at the beginning of the second slow step. When the compensation is disabled, the block skips the first event to be output since the output is already in that state.

Effect of the Skipped Events Compensation on the RTE Delay Block

Suppose now a "Slow to Fast" transition with the MaxEvent parameter set to 3. The fast rate is set to 1 second and the slow rate is set to 2 seconds. The following figure illustrates the effect of the compensation. When the compensation is enabled, the sixth event (falling edge) of the input (corresponding to fourth event of the of the second step of the output) is compensated at the beginning of the third "fast" time step. When the compensation is disabled, note also that the block skips the first event to be output in the third step since the output is already in this state.

In Slow-to-Fast transition, data transfers occur as soon as new data is available from the source block and the receiving block is ready to receive the data. Data are available at the next fast step.

Mask

RTE Rate Transition Mask

Parameters

Skipped events compensation

When enabled, the block compensates for the skipped event. It is useful when the maximum number of events is reached. By default, this parameter is set to Disable. (See Compensation of skipped event section)

Maximum number of events

The maximum number of events or transitions that can be output during a single step. Over this number, events are ignored and not output. This parameter must be an integer. By default, it is set to 4.

Output sample time

Specifies the output rate to which the input rate is converted. It must be a multiple of the model sample time (or real-time subsystem sample time). By default, this parameter is set to Ts.

Input

Input (RTE Boolean)

RTE Boolean signal

Size of input: Dynamical

Input Rate: Inherit

Output

Output (RTE Boolean)

RTE Boolean signal

Size of input: Same as Input

Input Rate: Multiple of model sample time

Characteristics

Direct Feedthrough

No for slow-to-fast transitions. Yes, for fast to slow transitions.

Sample time

Fixed discrete

Work offline

Yes

Dimensionalized

Yes

Examples

The next two examples show how to exchange RT-EVENTS signals between two real-time subsystems running with RT-LAB. The example illustrates data exchange from fast-to-slow rate and slow-to-fast rate respectively.

Fast to Slow transition

The following example illustrates Fast-to-Slow transition between 2 subsystems (Also available on MatLab demos). Consider the model below:

RTE Rate Transition - Example Fast-to-Slow transition

In this figure, the Master sample time is set to 1 second and the Slave sample time is set to 2 seconds.

RTE Rate Transition - Fast to slow in nominal case

Slow to Fast transition

The following example illustrates Slow-to-Fast transition between 2 subsystems (Also available on MatLab demos). Consider the model below:

RTE Rate Transition - Example Slow-to-Fast transition

In the first figure, the Master sample time is set to 2 seconds and the Slave sample time is set to do 1 second.

In the second figure, the Master sample time is set to 3 seconds and the Slave sample time is set to do 1 second.




OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323