主要内容

PWM Phase Shift for Single Shunt FOC

Add phase shift in three-phase PWM pulses for single-shunt FOC

Since R2026a

Libraries:
Motor Control Blockset / Controls / Math Transforms

Description

The PWM Phase Shift for Single Shunt FOC block adds a phase shift in the three-phase PWM pulses to ensure accurate construction of phase currents during the sector transition region for the Single Shunt Field Oriented Control (FOC) algorithm. You can use the block to widen the measurement window when the motor is operating in a state where the active voltage vectors are too short to allow for a clean ADC sample.

The block accepts the three-phase PWM duty ratios (ranging from 0 to 1) as an input signal and the Threshold (Th) input in seconds, to define the sector transition region, as shown in this figure.

PWM Phase Shift Compensation

During some PWM cycles, any two phases may have identical duty ratios (or duty values that are close to each other). In such scenarios, you can determine only one of the motor phase currents and cannot determine all three phase currents. The following figure shows such a PWM cycle.

To overcome this limitation, you can use the PWM Phase Shift for Single Shunt FOC block so that the current measurement algorithm shifts the PWM pulses. Using this compensation, the algorithm can determine two phase currents using which it eventually determines the third phase current mathematically.

The following figure shows an example of the applied compensation.

Examples

Ports

Input

expand all

Duty ratio of the three phases (a, b, and c) specified as a vector. The values are in the range 0 to 1.

Data Types: single | double | fixed point

Output

expand all

Input to CMPA and CMPB registers of ePWM to apply the shift logic in ISR, consisting of six PU (Per-Unit) signals that represent each phase.

CMPA moves the rising edge of PWM pulse earlier, and CMPB moves the falling edge of PWM pulse later.

For example, if the natural window is1.5µs, but the threshold that you set is 3.0µs, the required phase shift value is 1.5µs. The block then sets the CMPA (Rising Edge) value to Ideal_Duty - 0.75µs, and the CMPB (Falling Edge) value to Ideal_Duty + 0.75µs.

For example, consider this configuration:

  • Rising Edge is selected for current sampling, phase shift is 1.5µs, Threshold is 1.5µs, and PWM period is 50µs

  • Phase A, B, and C duty cycles are 0.8, 0.78 and 0.2 PU respectively

In this case, the difference between pulse duration of phase A and B is 0.8*50µs - 0.78*50µs = 1µs. As this difference is less than Threshold = 1.5µs, Phase B pulse will be shifted with Shift = 1.5µs towards right. Hence, CMPAB for phase B will be:

  • CMPA_b = 0.78 + (1.5µs/50µs) = 0.783 PU

  • CMPB_b = 0.78 - (1.5µs/50µs) = 0.777 PU

Data Types: single | double | fixed point

One of the six sectors, which is a 60° slice of the Space Vector PWM (SVPWM) hexagon that defines which inverter switches are active.

The SVPWM hexagon is divided into six equal sectors (1 through 6). Each sector represents a 60° region of the 360° electrical cycle.

In any given sector, the controller approximates the target voltage vector by blending the two nearest active voltage vectors and one or more null vectors (where all phases are shorted). Because the DC shunt only sees current during active vectors, the sector information indicates which motor phases are currently connected to the DC bus.

Data Types: uint8

Status that indicates if PWM phase shift is applied, based on the specified threshold requirement and the duty ratios.

The phase shift may not happen in these extreme scenarios even though it may be required based on specified threshold values:

  • When the motor is running at very high speeds, the required voltage vector reaches the outer edges of the SVPWM hexagon. In this case, there is no empty space left in the PWM period to move the pulse into. Shifting the pulse further causes it to collide with the start of the next PWM cycle or be clipped by the hardware timer.

  • At very low speeds or zero speed, the voltage vector is located at the very center of the hexagon. In this case, the amount of shift required to create the windows becomes much larger than the original duty cycle difference. This creates a large voltage distortion as well.

Data Types: Boolean

Parameters

expand all

Specific moment (rising or falling edge) of PWM pulse when the PWM signals for the three phases transition between High (1) and Low (0) within a single switching period.

Specifying the correct edge is critical because it defines the window during which the DC shunt resistor is connected to specific motor phases and the corresponding DC link current is flowing through the motor phases in a predictable path.

Absolute minimum amount of time (in seconds) that the DC link current must be stable for the ADC to get a valid reading.

You determine the threshold value by considering the factors like the dead-time, the slew rate of your op-amp, and the sampling time of your ADC. The block applies a phase shift if the current PWM window is smaller than the specified threshold.

Phase shift (in seconds) to be applied by considering the threshold, so that you move the Rising Edge to occur earlier in time and the Falling Edge to occur later in time (or vice versa).

When you apply phase shift, the total ON time (duty cycle) remains the same so the motor sees the correct average voltage, but the specific moment the switch is active is moved in the timeline to create a larger gap relative to the other phases.

PWM time period (in seconds) to be applied throughout the single shunt FOC implementation.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2026a