# Design and Simulate a Digital Control Algorithm for Active Power Factor Correction

Power factor correction (PFC) is a way of increasing a power supply’s ability to deliver real power. In this video, you’ll learn how to use Simulink^{®} to perform power factor correction by modeling a PFC boost converter and tuning controller gains to achieve a power factor near unity. The passive components like the diode bridge rectifier and the boost converter are modeled in Simscape Electrical™. The cascaded controller setup is modeled in Simulink and controls the inner inductor current loop and the outer voltage loop. You’ll see how to use the PID Tuner from Simulink Control Design to tune the controller using outputs from a linearized plant model. Plant linearization is achieved by injecting perturbations into the plant to estimate frequency response models for the inner and outer loops. Simulink Control Design computes the PI gains using these response models and the controller performance is verified by running the closed-loop simulation.

Hello. In this video, we will show how to design and simulate a digital control algorithm for power factor correction.

Here, we have modeled a typical active power factor correction setup using blocks from Simscape Electrical and Simulink. Let’s look at the different elements of the model. We have an AC source of 120V rms connected to a diode bridge rectifier. This rectifier is connected to a digitally controlled boost converter and a resistive load rated at 400V.

We have modeled the digital control algorithm in this subsystem named Controls. We can see the algorithm is a cascaded control loop architecture. The outer loop controls the load voltage and the inner loop controls the inductor current.

Our control algorithm computes a PWM signal that drives the MOSFET of the boost converter. In this video we will not discuss how the passive components were sized. We will work with the parameter values for inductance and capacitance already in our model, but it is important to note that we can easily change those values, run the simulation, and observe changes. We can therefore use this simulation model to choose optimal parameter values for passive components, but our focus here is on the digital control algorithm.

In this model, the PI gains for the controllers were set as initial guesses. These gain values do not provide the best power factor correction. We can see that by running the model. In this plot we see the line voltage in yellow and the line current in blue. The current waveform shows the presence of harmonics, which results in a poor power factor. We will therefore need to retune the controllers for a better power factor correction.

Our workflow will be the following: We will first tune the inner loop to obtain the optimal PID gains for the current loop. With the inner loop tuned, we will tune the outer voltage loop to compute gains for voltage loop PI controller.

To do the tuning, we need to obtain a linear plant dynamics model. For the inner loop, we need to obtain dynamics from PWM duty cycle to inductor current. We will use Linear Analysis tool from Simulink Control design to do this. With this tool we can estimate the frequency response of the model by doing an AC sweep. We need to do this AC sweep around the appropriate operating point or bias point. To do the AC sweep we have to replace the AC voltage source with a DC source.

This model has been set up to operate at its DC operating point with a DC voltage source of 120V and a steady state duty cycle of 0.72 [AT1] to maintain a constant DC output of 400V.

We can specify that we are interested in the dynamics from the PWM duty cycle to the inductor current by marking those signals as input and output linearization points respectively. The simulation reaches steady state at about ~0.15 seconds, so we will the start frequency response estimation at that time when the steady state has been reached. Next, we specify that we will inject the fixed step sine stream input with a sample time of 0.2 microseconds to the model. We set the frequency sweep range from 10Hz to 15kHz and the amplitude of the signal to 0.036 to ensure sufficient excitation within the operating range. We choose this signal amplitude to be small enough to not take us away from our operating point.

We then start the frequency response estimation. The model is simulated and the plant frequency response is computed. We will export it to the MATLAB workspace to use for the PI controller tuning.

In this next step we set up the current PI controller in the controls subsystem with the reference and the measured inductor current to operate in closed loop.

Next, we tune the gains of PI controller block by pressing the tune button in the block dialog. This launches the PID Tuner that tries to automatically linearize the plant. Because in this model we have discontinuities such as MOSFETs and PWM switching, the model cannot be linearized analytically. However, this is okay because this is exactly why we ran the frequency response estimation before. We can now simply point the PID Tuner to the estimated frequency response.

The PID Tuner uses this frequency response to compute PI gains to provide fast and stable closed-loop operation of the system. We can use the sliders to adjust the bandwidth and the phase margin. We will tune for the bandwidth of around 3.760 kHz and phase margin of 60 degrees to maintain a robust current reference tracking.

We can now take the computed PI gains and update them in the PI block of our model.

With the inner current loop tuned, we will repeat the process to tune the outer voltage loop. In the Controls subsystem, the constant block of 1 here represents the inductor current request. In our final model this signal will be computed by the outer voltage loop. So for tuning the outer loop, our input linearization point is this signal, and the output linearization point is the output voltage signal.

The simulation reaches steady state at around 0.4 seconds, so we will tell the Linear Analysis tool to start the frequency response estimation at around that time. We set the fixed step sine stream signal sample time to 0.2 microseconds with an AC frequency sweep range from 10Hz to 5kHz. The amplitude of the perturbation is set to be 0.1 to ensure sufficient excitation. We can now run the tool and compute the frequency response for tuning the outer loop.

Next, just like we did for the inner loop, we will set up the outer loop Controls subsystem with the Voltage PI controller, and start the tuning by launching the PID Tuner. Again, similar to how we did it for the inner loop, we import the previously estimated frequency response to compute the PI gains. The voltage loop is slower than the inner current loop, so we set the bandwidth to be around 55 Hz and keep phase margin at 60 degrees. With this chosen bandwidth, the controller will follow the reference voltage while rejecting the 120Hz oscillations of the rectified AC source.

We then update the voltage PI Controller with the computed gains. To verify the performance in the nonlinear model, let’s run a step change in the reference voltage. The simulation results show a robust controller performance.

Now let’s switch the voltage source back to the original AC grid and run the simulation.

We can see that the inductor current and output voltage profiles show good reference tracking. The line current drawn from the AC grid resembles a perfect sinusoid and is much better than the current profile we had before the controller tuning. We see a reduction of harmonics, thus providing a better power factor.

To summarize, in this video we showed how to simulate, design, and tune a digital control algorithm for power factor correction in Simulink. With the design complete, a good next step would be to generate code from the Controls subsystem to deploy on an embedded controller to be tested with a physical plant. This concludes the video.

#### Download Code and Files

#### Related Products

#### Learn More

Seleziona un sito web

Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .

Puoi anche selezionare un sito web dal seguente elenco:

Come ottenere le migliori prestazioni del sito

Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.

Americhe

- América Latina (Español)
- Canada (English)
- United States (English)

Europa

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

Asia-Pacifico

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)