Need help creating a CCCV charging curve in PLECS (Boost converter + cascaded PI voltage/current control + battery model)

Hi everyone,
I’m currently building a battery charger simulation in PLECS and I’m stuck with the battery modeling / CCCV charging curve part.

What I want to achieve

I want to simulate a CCCV charging process (Constant Current → Constant Voltage) for a LiFePO4 battery pack using a boost converter. The goal is to reproduce the typical charging curve:

  • CC phase: battery current stays constant while battery voltage rises

  • CV phase: battery voltage stays constant while current tapers down

My setup so far

  • Boost converter (switch + diode + inductor + output capacitor)

  • Cascaded control structure:

    • Outer loop: Voltage PI controller → generates current reference

    • Inner loop: Current PI controller → controls PWM duty (triangle comparator)

I currently regulate the inductor current​ in the inner loop (because that’s what I tuned the current loop with). Battery voltage is measured at the output.

The problem

Even though the converter + PI loops “work” in the sense that the circuit runs, I cannot get a proper CCCV behavior:

  • Sometimes the battery voltage starts too high or behaves strangely

  • The current reference from the voltage controller sometimes seems wrong / too small

  • I get oscillations or unrealistic voltage spikes at startup

  • The simulated “SOC increase” is extremely slow (charging would take hours in real time), so I tried time-scaling (capacity scaling), but then the battery model throws parameter errors or becomes unstable

I’m using the PLECS Li-ion R-only model (resistor-only battery model) because I want to keep it simple, generating a CCCV curve for LiFePO4.

Thanks a lot!

Boost_Converter_Regelung_Bat_neu.plecs (99.9 KB)

Hi Jsoliman,

Thanks for sending in your question

Unfortunately the loop design appears to have stability issues (or lack of phase/gain margin). So you are seeing overshoots and undershoots. Additionally, while you are getting overshoots and have saturated your output, your integrator is winding up and this causes the large oscillations you are seeing. To prevent this you will need to either use one of the inbuilt anti-windup strategies in the PI controller component or develop your own. I would recommend starting with the back-calculation option and setting the gain (Kb) equal to Ki.

NOTE: this is just a starting point and not an optimal solution. You will need to do some research in seeing what is the best strategy for your system.

To stabilize your dc/dc controller I would recommend using the built in analysis tools in PLECS to ensure your are getting the desired control loop performance.

That is the right strategy but unfortunately your CV voltage reference of ~28V appears to be right at the open circuit voltage of the battery model and so you are never operating int he CC region (i.e. charging at the maximum allowed charge current). Thus your battery is charging at a suboptimal rate. You will need to optimize your voltage reference setpoint but that will only work once your have stabilized your power electronics controllers.

Have a look at Electrical Equivalent Implementation of Lithium-Ion Batteries | Plexim for an example on CV/CC charging. Hopefully this gives you some insight and helps you optimize your model further.

Hope this helps!