# Active power factor correction

Discussion in 'Electronic Design' started by Scott Ronald, Mar 25, 2008.

1. ### Scott RonaldGuest

Hi

I am simulating an active power factor correction switching regulator.
I am having a bit of trouble getting a good algorithm going for it though.

Here is my circuit. The input is rectified AC, 60Hz, ~160V
vin = 160*|sin(2*pi*60*t)|

|------[inductor]--[L_ESR]---|---[diode->|]---|-------|
| | | |
| | | |
| | | |
| | [C_ESR] |
| | | |
|--------------------|-------|----------------|-------|
|
[gnd]

This is the code I am using to simulate the circuit: (StepSize is 1E-9)

if (SwitchOn)
{
//left half
inductorCurrent += (vin - inductorESRVoltage) * StepSize /
inductance;

inductorESRVoltage = inductorCurrent * inductorESR;

//right half
capacitorVoltage += loadCurrent * StepSize / capacitance;
vout = capacitorVoltage + loadCurrent * capacitorESR;
}
else
{
inductorCurrent += (vin - inductorESRVoltage) *
StepSize / inductance;
if (inductorCurrent < 0)
{
inductorCurrent = 0;//diode
}
inductorESRVoltage = inductorCurrent * inductorESR + vout;
capacitorVoltage += (inductorCurrent - loadCurrent) * StepSize /

capacitance;
vout = capacitorVoltage + loadCurrent * capacitorESR;
}

The PWM controlling the proportion of time on/off for the Switch in the
above code is here:

Microloop()//called at 100kHz
{
duty = (desiredVout - vout)*(k * vin - inductorCurrent);
//the (desiredVout - vout) sets the error for the output voltage
//(k * vin - inductorCurrent) sets an error current for the input, to
//make sure the input current is proportional to input voltage. I have
//been using a k of 0.25
if (duty >= 95)
{
duty = 95;
}
else if (duty < 0)
{
duty = 0;
}
}

The problem with my simulated controller as it stands is that the
inductor current has a lot of ripple in it, but the magnitude of the
inductor ripple is proportional to the input voltage. The output
voltage regulates well though. Do I need to make changes to my circuit
or algorithm to make this work better?

Scott

2. ### MooseFETGuest

Note the lack of an input side EMI filter and that the input side
bridge circuit is modeled.
This is basically right as a straight line modeling of the switching.
You can do a bit better if you do one of the summing actions twice per
loop and divide the amount by two. This helps if you have one short
time constant and one longer one.

A lossless diode is hard to find in real life.
I haven't looked carefully enough but the above looks incorrect to
me. The servo loop of your PWM circuit needs to be much slower than
the PWM action and a lot faster than the mains frequency. You seem to
have it at the PWM frequency.

The input side ripple at the switching frequency is normal. You can't
get rid of it in the topology you have. The frequency content below
that should be just the mains frequency.