Documentation

PWM Generator

Generate pulse width modulated signal

  • Library:
  • Simscape / Power Systems / Simscape Components / Control / Pulse Width Modulation

Description

The PWM Generator block implements a PWM generator. The pulse width modulation technique controls power transfer from one electrical component to another by quickly switching between full power transfer and no power transfer.

Working Principle

The PWM generator block outputs either 1 when the duty cycle is greater than the carrier counter value, or 0 otherwise. You can set the period of each cycle by specifying the timer period Tper. You can change the initial output, or phase, of the PWM output by specifying one of three types of carrier counters:

  • Up counter — The PWM output signal initializes at the start of the on cycle. This graphic shows the carrier counter signal and the corresponding PWM output.

  • Down counter — The PWM output signal initializes at the start of the off cycle. This graphic shows the carrier counter signal and the corresponding PWM output.

  • Up-down counter — The PWM output signal initializes halfway through the on cycle. This graphic shows the carrier counter signal and the corresponding PWM output.

Ports

Input

expand all

Duty cycle in the range [0,1].

Data Types: single | double

Output

expand all

Pulse width modulation signal.

Data Types: single | double

Parameters

expand all

Use the carrier counter strategy to change the initial behaviour of the PWM output:

  • Up counter — PWM output begins at the start of the on state.

  • Down counter — PWM output begins at the start of the off state.

  • Up-down counter — PWM output begins in the middle of the on state.

PWM timer period.

Sample time for the block. If this block is used in a continuous variable-step model, then the sample time can be explicitly specified.

Model Examples

Introduced in R2017b

Was this topic helpful?