3.3.22.3 mcPwmI_PulseWidthModulation

C


/* PWM Modulator */
mcPwmI_PulseWidthModulation( const tmcPwm_Parameters_s * const pParameters,
                                                           const float32_t uBus,
                                                           const tmcTypes_AlphaBeta_s * const pUalphaBeta,
                                                           int16_t * const pDuty )	

Summary

This function performs the PWM modulation

Description

This function calculates the PWM duty cycles for a three-phase inverter based on the input voltage and modulation index. It determines the appropriate sector and sets the duty cycles for each phase to achieve the desired output voltage vector.

The following steps summarize the operation of mcPwmI_PulseWidthModulation:
  • Reads the parameter from the PWM module data structure.
  • Checks the module state and calculates the magnitude of the reference voltage vector using αβ frame reference voltages.
  • Defines the modulation index from the bus voltage, bus utilization factor, and reference voltage, then checks it against limits and updates the modulation index.
  • Normalizes the input reference voltages using the updated modulation index and determines the voltage space vector sector location.
  • For each sector, calculates the active vector times and the corresponding PWM timings for the three phases
  • Ensures the calculated duty cycles are within the allowable range using the UTIL_SaturateS16 function.

Precondition

The PWM modulator must be initialized and enabled.

Parameters

ParamDescription
pParametersA pointer to the PWM modulator parameter structure
uBusDC bus voltage value
pUalphaBetaA pointer to the structure containing the alpha and beta components of the voltage vector
pDutyA pointer to a variable where the where the calculated duty cycles for the three phases will be stored.

Returns

None

Example

// Define the pwm modulator data structure
tmcPwm_Parameters_s pwmParameters;
tmcTypes_AlphaBeta_s uAlphaBeta = { .alpha = 0.5f, .beta = 0.5f };
int16_t dutyCycles[3];
float32_t busVoltage = 24.0f;

/* PWM Modulator */
mcPwmI_PulseWidthModulation(&pwmParameters, busVoltage, &uAlphaBeta, dutyCycles);
    

Remarks

None.