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 PWM

Library

RT-EVENTS Source

Block

Description

The RTE PWM block generates square wave pulses at regular time intervals. The frequency and duty cycle input signals determine the shape of the output waveform.

The RTE PWM block can output scalar, vector, or matrix signals. To cause the block to output a scalar signal, use scalars input signals. To cause the block to output a vector or matrix signal, use vectors or matrices inputs signals, respectively. Each element of the input signals affects the corresponding element of the output signal. All the input signals must have the same dimensions after scalar expansion. The following figure presents the main characteristics of the generates square wave pulses.

Square Wave Characteristics of the Generated Signals of the RTE PWM Block

The Maximum number of events parameter is used to determine the maximum number of transitions that can occur during one calculation step and the maximum frequency that can be output. The following formula determines the maximum frequency:

Fmax = Num / ( 2 *Ts),

where Num and Ts are the maximum numbers of events and the block sample time.

Shifted transitions

In normal operation, the frequency changes will be updated from the previous value when the active period (cycle) is completed. This gives very precise results without frequency spikes. However, at low frequencies, this slows down the update time as we need to wait for the first (slow) period to finish before moving to the next frequency value.

When shifting is enabled, the output of the RTE PWM block will be similar to real-world sensors in that the transition will happen as soon as possible in order to move to the new frequency value. This might be interpreted as a shift from the old value to the new one with a half period at one intermediate frequency. This is closer to the behavior of real sensors and provides faster updates at low frequency, but can confuse some hardware devices.

As an example, suppose a Simulink model containing a pulse generator with a frequency of 250 Hz running at a sample time of 1ms. When the shifted transition is disabled and the frequency is increased to 1000 Hz, the block waits until the next transition at 250 Hz to update the frequency. The next transition is set as the reference. If the shifted transition is enabled, the blocks use instead of the previous transition as reference.

Effect of the Shifted Transition Parameter of the RTE PWM block

Mask

RTE PWM Mask

Parameters

Shifted transition

The shifted transition for this block: disabled, enabled.

Maximum number of events

The maximum number of events or transitions that can be output during a single step.

Sample time

The time interval between samples in seconds.

Input

Frequency (Double)

The pulse frequency specified in Hz.

Duty Cycle (Double)

The duty cycle specified as the percentage of the pulse period that the signal is on.

Output

Output (RTE Boolean)

RTE Boolean signal generated by the PWM block.

Characteristics

Direct Feedthrough

No

Sample Time

Fixed discrete.

Work Offline

Yes

Dimensionalized

Yes

Examples

The rte_pwm_generation.mdl model demonstrates how to use RT-EVENTS blocks to generate PWM signals of different types. This example also shows how to add dead time to the PWM and also shows how to generate Space Vector PWM using this block. It also compares many methods to generate PWM using RTE Logical Operator block, or RTE SVPWM block.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter