DO-PWM - Direct output PWM

The Direct output PWM block sets PWM output(s) directly to ‘0’ or ‘1’.

This technique is typically used for Model Predictive Control (TN162) or Direct Torque Control (AN004).

Like the other PWM blocks, the Direct output PWM block supports dead-time generation and can be activated or deactivated. More information is available on the PWM page.

Simulink block

Signal specification

  • The input in sets the PWM output to ‘1′ (in>0) or to ‘0’ (in<=0)
  • The input A allows the activation (>0) or deactivation (<=0) of the PWM output(s).
  • The output(s) is/are the generated PWM signal(s), according to the selected output mode. The output(s) is/are only used in simulation.

Parameters

  • Device ID selects which B-Box/B-Board to address when used in a multi-device configuration.
  • Output mode selects between a single PWM signal or complementary signals with a deadtime.
  • Addressed PWM selects the PWM outputs to address.
  • Show ”activate” input makes the A signal input visible. If not checked, the block is active by default.
  • Dead-time duration: configures the dead-time duration if the Output mode is set at Dual (PWM_H + PWM_L).

PLECS block

Signal specification

  • The input in sets the PWM output to ‘1′ (in>0) or to ‘0’ (in<=0)
  • The input A allows the activation (A>0) or deactivation (A<=0) of the PWM output(s).
  • The target outport(s) (only visible at the atomic subsystem level) is/are the generated PWM signal(s), according to the selected output mode. The output(s) is/are only used in simulation.

Parameters

  • Device ID selects which B-Box/B-Board to address when used in a multi-device configuration.
  • Output mode selects between a single PWM signal or complementary signals with a deadtime.
  • Output lane(s) or Output channel(s) (vectorizable) selects the PWM outputs to address.
  • PWM activation makes the A signal input visible if the option “Use block input“ is selected. If not, the CB-PWM block is activated by default.
  • Dead-time duration configures the dead-time duration if the Output mode is set at Dual (PWM_H + PWM_L).

C++ functions

Functions specific to the direct-output PWM

void DoPwm_SetOn(tPwmOutput output, unsigned int device=0);
Code language: C++ (cpp)

Sets the PWM output to ‘1′.

Parameters

  • output: the PWM channel or lane to address
  • device: the id of the addressed device (optional, used in multi-device configuration only)
void DoPwm_SetOff(tPwmOutput output, unsigned int device=0);
Code language: C++ (cpp)

Sets the PWM output to ‘0’.

Parameters

  • output: the PWM channel or lane to address
  • device: the id of the addressed device (optional, used in multi-device configuration only)

Functions common to all PWM drivers

These functions are common to all PWM blocks. Further documentation is available on the PWM page.

void DoPwm_ConfigureOutputMode(tPwmOutput output, tPwmOutMode outMode, unsigned int device=0);Code language: C++ (cpp)

Selects the PWM output mode.

If the output mode selected is COMPLEMENTARY, a dead-time must be configured using the CbPwm_ConfigureDeadTime() function.

It has to be called in UserInit().

Parameters

  • output: the PWM channel or lane to address
  • outMode: the output mode to use (COMPLEMENTARYINDEPENDENT or PWMH_ACTIVE)
  • device: the B-Box/B-Board to address when used in a multi-device configuration
void DoPwm_ConfigureDeadTime(tPwmOutput output, float deadTime, unsigned int device=0);Code language: C++ (cpp)

Configures the dead-time duration if the output mode is set as COMPLEMENTARY.

It has to be called in UserInit().

Parameters

  • output: the PWM channel or lane to address
  • outMode: the output mode to use (COMPLEMENTARYINDEPENDENT or PWMH_ACTIVE)
  • device: the B-Box/B-Board to address when used in a multi-device configuration
void DoPwm_Activate(tPwmOutput output, unsigned int device=0);
Code language: C++ (cpp)

Activates the addressed PWM output(s). If the addressed PWM output has been set as COMPLEMENTARY or PWMH_ACTIVE this function acts on both outputs.

It can be called in UserInit() or in the control interrupt routine.

Parameters

  • output: the PWM channel or lane to address
  • device: the B-Box/B-Board to address when used in a multi-device configuration
void DoPwm_Deactivate(tPwmOutput output, unsigned int device=0);Code language: C++ (cpp)

Deactivates the addressed PWM output(s). If the addressed PWM output has been set as COMPLEMENTARY or PWMH_ACTIVE this function acts on both outputs.

It can be called in UserInit() or in the control interrupt routine.

Parameters

  • output: the PWM channel or lane to address
  • device: the B-Box/B-Board to address when used in a multi-device configuration