I am trying to tune the PI control but nothing works out. The PI control seems to be working in the sense that I am able to control the voltage, but the current doesn't get fixed no matter what. Any inputs are greatly appreciated.
You need to do several things to make the PFC feedback loop shape your input current to follow the input voltage:
- Slow enough output voltage feedback, about 7 Hz (your outer loop). If it's too fast, it will just try it's best to regulate the output voltage to your setting. This is opposite of what you want. If it's slow enough, the 100/120 Hz ripple will be too fast for your feedback loop and the boost will keep the duty cycle throughout the half-wave.
- If you operate in CCM, the converter will consume current according to Vin^2*D, and with D being constant, pull a lot of peak current on the top of the input voltage waveform. You need to implement a 1/Vin^2 function to operate on a much faster response time, perhaps even cycle by cycle. Please take a look at a commercial CCM PFC circuit and this is built into the IC. For DCM or BCM, this isn't needed. Also, you can make the same thing happen if you have a fast inner current control loop with Vin as reference. The effect is the same but you need to sense current on the high side.
Here is an example from ST L4984D datasheet for the 1/Vin^2 function. ST datasheet link