Controlled PWM Voltage
Pulse-width modulated voltage source
Libraries:
Simscape /
Electrical /
Integrated Circuits
Description
The Controlled PWM Voltage block represents a pulse-width modulated (PWM) voltage source. You can model electrical or physical signal input ports by setting the Modeling option parameter to either:
Electrical input ports
— The block calculates the duty cycle based on the reference voltage across its ref+ and ref- ports. This option is the default.PS input
— Specify the duty cycle value directly by using an input physical signal port.
If you set Modeling option to Electrical input
ports
, the demanded duty cycle is
where:
Vref is the reference voltage across the ref+ and ref- ports.
Vmin is the minimum reference voltage.
Vmax is the maximum reference voltage.
The value of the Output voltage amplitude parameter determines amplitude of the output voltage.
At time zero, the pulse is initialized as high, unless the Pulse delay time parameter is greater than zero, or the demanded duty cycle is zero.
You can use parameters Pulse delay time and Pulse width offset to add a small turn-on delay and a small turn-off advance. This can be useful when fine-tuning switching times so as to minimize switching losses.
In PWM mode, the block has two options for the type of switching event when moving between output high and output low states:
Asynchronous – Best for variable-step solvers
— Asynchronous events are better suited to variable step solvers, because they require fewer simulation steps for the same level of accuracy. In asynchronous mode the PWM switching events generate zero crossings, and therefore switching times are always determined accurately, regardless of the simulation maximum step size.Discrete—time – Best for fixed-step solvers
— Discrete-time events are better suited to fixed-step operation, because then the switching events are always synchronized with the simulation step. Using an asynchronous implementation with fixed-step solvers may sometimes result in events being up to one simulation step late. For more information, see Simulating with Fixed Time Step — Local and Global Fixed-Step Solvers.
If you use a fixed-step or local solver and the discrete-time switching event type, the following restrictions apply to the Sample time parameter value:
The sample time must be a multiple of the simulation step size.
The sample time must be small compared to the PWM period, to ensure sufficient resolution.
Assumptions and Limitations
The model is based on the following assumptions:
The REF output of this block is floating, it is not tied to the Electrical Reference. One consequence of this is that if you connect the PWM and REF electrical ports directly to the PWM and REF electrical ports of an H-bridge or a gate driver, you must attach an Electrical Reference block to the REF connection line.
Do not connect the Controlled PWM block directly to a semiconductor gate, because this omits the gate driver output impedance that determines switching dynamics. Use a Gate Driver or a Half-Bridge Driver block to set the gate-source or the gate-emitter voltage.
Do not use the Controlled PWM block to drive a motor block directly. A PWM motor driver goes open circuit in between pulses. Use the H-Bridge block to drive a motor block.
When driving a motor via the H-Bridge block, set the Simulation mode parameter to
Averaged
to speed up simulations. You must also set the Simulation mode parameter of the H-Bridge block toAveraged
mode. This applies the average of the demanded PWM voltage to the motor. TheAveraged
mode assumes that the impedance of the motor inductive term is small at the PWM frequency. To verify this assumption, run the simulation using thePWM
mode and compare the results to those obtained from using theAveraged
mode.If you are linearizing your model, set the Simulation mode parameter to
Averaged
and ensure that you have specified the operating point of the block correctly. You can only linearize the block for inputs corresponding to a duty cycle greater than zero and less than 100 percent.When you use this block in
PWM
mode with the Use local solver option selected in the Solver Configuration block, set the Switching event type parameter toDiscrete—time – Best for fixed-step solvers
. Using theAsynchronous – Best for variable-step solvers
option in this situation may produce inaccuracies, because simulation with the local solver implies fixed step, and the PWM events will not always coincide precisely with the simulation steps. This results in PWM events sometimes occurring one simulation step late.
Examples
Ports
Input
Conserving
Parameters
Extended Capabilities
Version History
Introduced in R2008b