Modeling a PWM-Controlled Buck Converter | How to Design Motor Controllers Using Simscape Electrical, Part 4
From the series: How to Design Motor Controllers Using Simscape Electrical
Melda Ulusoy, MathWorks
You’ll learn how to model a PWM-controlled buck converter for controlling the speed of a BLDC motor. In this video, we refer to a circuit diagram of a buck converter and try to model the same circuit using blocks from Simscape Electrical™. We also discuss how you can use the built-in blocks available in the Simscape Electrical library to model components of the BLDC speed control algorithm such as the three-phase inverter, Hall sensor, and commutation logic.
Download the model used in this video.
Check out this motor control tech talk video to learn how PWM control works.
Published: 8 Jan 2020
Here, we see two different architectures for implementing PWM control for a BLDC motor, which we previously discussed in one of our Tech Talk videos. In this video, we’ll work on the first architecture and show you how to model a buck converter. To implement this first architecture, we’ll start off with this Simulink model, which already includes these subsystems. To learn how to model these components, don’t forget to check out our previous videos in the series.
Here, we will model a PWM-controlled buck converter whose circuit diagram is shown here. We’ll keep this in this corner and refer to it as we’re modeling the same circuit in Simulink.
A buck converter steps down voltage from its input to its output. The amount of voltage drop is determined by the duty cycle of the PWM signal. We’ll start by adding a DC voltage source block, which will provide the input voltage of 500 volts. To model the switches, we insert a MOSFET block and specify its parameters. Now, we connect these MOSFETs as seen in the diagram. Next, we add the inductor, specify its parameters, and then also add a capacitor to complete the circuit.
To control the on and off states of the switches of the buck converter, we use the PWM generator block, which takes the duty cycle as an input and outputs a PWM signal based on this duty cycle. We set the PWM frequency as well as the sample time, which have been predefined in the MATLAB workspace. For proper operation of the buck converter, we connect the generated PWM output to the first switch and feed it through a NOT gate before connecting it to the second switch. Note that both of these signals are Simulink signals, which we converted into physical signals with Simulink-PS converters before inputting them to these Simscape blocks.
This logical operator outputs a Boolean value. We use a data-type conversion block to convert the Boolean output into the data type required by the following blocks. Next, we grab two voltage sensors and connect them at the input and output of the buck converter to respectively measure the DC source voltage and the modulated voltage.
Port V of the voltage sensor outputs the measured voltage, which we can connect to a scope for viewing it after running the simulation. Alternatively, we can use a terminator and log the signal for visualization using the data inspector. Finally, we feed the modulated voltage to the three-phase inverter. Let’s select these blocks and create a subsystem for the buck converter. To give some specific names to the inputs and outputs of the subsystem, we go inside the block and label the input and these two output ports.
Now that we completed modeling the buck converter, we can simulate the model to see if the control algorithm works properly. But before doing so, I want to remind you about something. Although we built everything from scratch in this video series, note that the Simscape library includes built-in blocks corresponding to these subsystems. We’ll now demonstrate how you can use the built-in block for modeling one of these subsystems, the three-phase inverter.
To insert the built-in block for the three-phase inverter, we type “converter” on the canvas and then select this one from the list of suggested blocks. In the block dialog, we specify the inverter parameters. Port G is associated with the gate terminals of the switching devices. So here we need to connect the high and low signals for the six phases. However, as this port expects a single vector of values, we first need to multiplex these signals using a six-pulse gate multiplexer before connecting them to port G. Let’s remove the previously built inverter and then use the multiplexer to provide the vector to port G.
Note that if you’re not sure about the port connections, you can click “help” from the block dialog, which takes you to the documentation where you can find more on the equivalent circuit of the Simscape block as well as ports and port connections. The + and – ports are where we connect the terminals of the voltage source block. And finally, this port outputs the three-phase voltages, which we can measure using the line voltage sensor block. To measure the three-phase currents, we change the ports of the current sensor to composite. Now, to output the three-phase voltages from this subsystem, we use a physical modeling connection port. And to feed the signal to the BLDC motor, we set the three-phase ports of the motor block to composite.
As we’re interested in investigating the modulated voltage and the speed response of the motor, we’ll log the relevant signals before simulating the model. Now, we run the model and use the data inspector to view the logged signals. Here we see how the buck converter takes an input voltage of 500 volts and adjusts it to different voltage levels to be able to run the motor at different speeds as seen in this plot.
In this video, we showed you how you can model a PWM-controlled buck converter to control the speed of a BLDC motor. We also discussed how you use built-in blocks from the Simscape library to model the main components of this control algorithm. In the next video, we’re going to work on an alternative implementation of PWM control.