PWM Generation

Overview

Following shows a commonly used 3-phase 2 level inverter for electric motor drive:

3-phase inverter for motor control.

To start with, a PWM control signal for phase A can be generated using a sinusoidal waveform as reference:

SPWM waveform

The peak value of the reference sinusoidal signal is set to 1. This is Per Unit (PU) value, with Vdc as base. The PWM signal is generated by comparing reference value to a sawtooth waveform. When reference waveform is larger than sawtooth value, output is set to 1, otherwise, it will be set to 0. The sawtooth signal is also called carrier signal. Notice that this is for simulation only. When implementing this with microcontroller, we just need to set the reference value, microcontroller will then generate sawtooth and eventually the PWM signal accordingly.

For phase B and C, same PWM signal can be generated by sinusoidal waveforms with different phase shift values. Thanks to the Park/Clark transformation, we don’t need to worry how the reference signals are generated. Once the ud and uq commands are given, three-phase voltage commands will be calculated automatically. This is called sinusoidal PWM (SPWM). From the results, following factors can be obtained:

  • If duty cycle is 100%, then S1 will be turned on the whole time during each PWM cycle. If duty cycle is 0%, then S2 will be turned on.
  • When S1 is turned on, Vdc is applied to phase A terminal, while turning on of S2 will apply 0 to the terminal.
  • For applications that motor doesn’t have the neutral point, the phase current is driven by line voltage instead of phase voltage. If means that if the same line voltage is applied to all 3 phases, there will be no voltage.
  • When output voltage command is between Vdc and 0, the output is linear. However, once the command goes beyond Vdc and 0, the output get saturated, since we cannot command duty cycle larger than 100% or smaller than 0%. This operation is called overmodulation, extra step needs to be taken to guarantee the linearity between command and actual output.

While SPWM can do the work, there are some other PWM techniques that can do things such as increasing the linear range, decreasing the switching loss, etc.

SVPWM

One of the ways to extend the linear operation is by adding the 3rd order harmonics voltage to the reference voltage, since it can decrease the peak value of the reference voltage without introduce any phase current. It is possible to inject different 3rd order harmonics, with different pros and cons. The one that is been discussed here is called carrier based implementation:

SVPWM waveform with 3rd order harmonic

where 3rd order harmonics is calculated by following:

SVPWM 3rd order harmonic calculation

From the result, it can be seen that new PWM reference signal has lower peak value than the original PWM reference signal. So the linear operation can be achieved even if original PWM reference signal peak value is higher than Vdc which requests 100% duty cycle by SPWM.

It is worth to notice that the exactly same waveform can be achieved by a very different implementation called space vector based implementation. And that is why this method is also called space vector PWM (SVPWM). For details about these two different approaches, check the further information section for reference.

Although SVPWM could extend the linear operation range, it eventually will still enter the nonlinear range. It is called overmodulation operation. One of the easiest way to handled the overmodulation is adding a gain to the reference voltage. Let us define following:

Modulation index define

where V1st is the peak value of the fundamental frequency. 0.5Vdc is selected as the base for the MI. However, other values such as 2/3*Vdc or 2/pi*Vdc can also be used. We can write a script to perform the FFT on final output voltage, and compare it with command value. The result is as following:

Command modulation index vs achieved modulation index, SPWM and SVPWM

As expected, the SPWM linear operation ends when MI command reaches 1. But SVPWM extended that range (to 1.155). The gain is following:

SVPWM overmodulation gain

Notice that the gain becomes infinity when command MI approaches the maximum value 1.273. In order to achieve that, there will be only one switch for each phase per fundamental cycle. The fundamental output voltage is 2/pi * Vdc. It is also called six-step operation, and is the max output voltage with given Vdc. Following shows what waveforms look like:

Six step operation

The simulation file and FFT script for SVPWM overmodulation analysis can be downloaded here. The files are based on Scilab 5.5.2.

DPWM

While SVPWM can greatly extend the linear operation range, it is also possible to decrease the switching times to reduce the loss. To achieve this, discontinuous PWM (DPWM) can be used. As explained in this paper, there are several different DPWM approaches. Only one DPWM implementation is explained here.

DPWM waveform with 3rd order harmonic

As shown in this result, there are two PWM periods where duty cycle commands are fixed to 100% or 0%. Thus, switching loss is avoided for these two cycles. With higher switching frequency, DPWM could save more energies. For this method, the 3rd order harmonic is given by following:

DPWM 3rd order harmonic calculation

where max(vabc) returns phase voltage either va, vb, or vc whichever has the biggest magnitude.

Similar to SVPWM, DPWM overmodulation output and the gain can be obtained as following:

Command modulation index vs achieved modulation index, SPWM and DPWM
DPWM overmodulation gain

Simulation and FFT script can be found here.

Further Reference

For more information about the PWM Pulse Width Modulation for Power Converters: Principles and Practice is great reference book for whom want to get into more details about the PWM topic.

A.M. Hava, etc., “A high-performance generalized discontinuous PWM algorithm“, IEEE Transition on Industry Application, vol. 34, pp. 1059 – 1071, Sep. – Oct. 1998. gives a detailed comparison between different DPWM implementation methods.