Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Long battery runs: a real pack charged in seconds

A real charge takes hours, and a switching run needs steps of a few µs: 1.5 hours of this charger would be about 2.7e9 steps. Here you open a charger with a real pack, charge it for 1.5 hours with Simulation › Long Battery Run in seconds of compute, then open a few milliseconds of switching at 30 minutes with Simulation › Battery Run Switching Window to see the ripple. About 10 minutes.

Pictures: a numbered red box is what you click or read, Run is a button, File › Open Example a menu path.

1. Open the example

Step 1 of 6 · about 1 min

Choose File › Open Example › DC-DC › Battery charger: a 4.5 Ah pack over a 1.5 h run.

The File menu open at Open Example, DC-DC, Battery charger: a 4.5 Ah pack over a 1.5 h run, marked 1 to 4

  1. File.
  2. Open Example.
  3. DC-DC.
  4. Battery charger: a 4.5 Ah pack over a 1.5 h run.

The pack B1 is four Molicel INR-21700-P45B cells in series, with the values of the cell's data sheet (E-One Moli Energy, "Product Data Sheet, Model INR-21700-P45B", version 1.2): 4.5 Ah, charged at 4.5 A to 4.2 V a cell (16.8 V), over its standard charge time of 1.5 hours, 15 mΩ a cell. The sheet gives no rest voltage against charge, so the pack keeps the battery part's default table, which is illustrative. The synchronous buck and its two loops (a voltage PI that sets the current reference, a current PI) charge at constant current, then at constant voltage. The pack starts at 20 %.

The circuit's own run is a 50 ms switching window. Problems notes battery.longRun: the pack is too large for anything to happen in 50 ms, and it suggests the long run.

2. The two menu items

Step 2 of 6 · about 1 min

Open the Simulation menu.

The Simulation menu with Long Battery Run and Battery Run Switching Window, marked 1 to 3

  1. Simulation.
  2. Long Battery Run (simulation.batteryRun): the whole charge, on the converter's averaged model.
  3. Battery Run Switching Window (simulation.batteryZoom): a few milliseconds of the switching circuit, from where the long run left it.

3. Run the whole charge

Step 3 of 6 · about 1 min

Choose Simulation › Long Battery Run and type the end time.

The Long Battery Run form with End time 5.4k and the Run button, marked 1 to 2

  1. Stop time: 5400 (1.5 hours; the field shows 5.4k).
  2. Run.

The other fields can stay empty. Stop current ends the run once the current falls to a charger's termination current, Stop state of charge at a state of charge, and Largest charge step is how far one jump may move the charge (1 %).

How it works: the converter runs on its averaged model in short bursts until the battery's current settles. Between bursts time jumps ahead by seconds to a minute, and only the battery's charge moves, at the settled current. The controller's constant-current and constant-voltage logic is what each burst settles to.

4. Read the charge

Step 4 of 6 · about 1 min

The scope after the long run: vbat rising to 16.8 V and holding, ibat at 4.5 A then falling, marked 1 to 2

  1. vbat: the pack voltage rises from 14.2 V to 16.8 V, then holds there.
  2. ibat: 4.5 A of constant current, until about 2670 s (44 minutes), where the voltage reaches 16.8 V. Then the current falls, to 0.45 A (C/10) at about 3180 s with the charge at 99.4 %, and to under 1 mA at 1.5 hours.

soc, under the two, rises from 20 % to full. The status bar reads simulated 39674 steps, … ; battery B1 at 100.0 % charge after 5.4 ks: 1.5 hours of charge in about 40 000 steps, which takes a fraction of a second. Each signal has samples only where the solver ran, so it is a straight line across each jump, and it never shows the switching ripple.

5. Open a switching window

Step 5 of 6 · about 1 min

Choose Simulation › Battery Run Switching Window.

The Battery Run Switching Window form with Start time 1.8k, Window length 0.005 and Run, marked 1 to 3

  1. Start time: 1800 (30 minutes into the charge).
  2. Window length: 0.005 (5 ms).
  3. Run.

The long run goes to 1800 s first. Then the switching circuit itself runs from the state it reached: the capacitor voltages, the inductor current, the pack's charge and the controllers' states carry over by name.

6. Read the ripple

Step 6 of 6 · about 1 min

The scope of the switching window: vbat with its 10 kHz ripple near 15.9 V, ibat near 4.5 A, marked 1

  1. ibat: the charge current, 4.5 A on average, with the 10 kHz switching ripple.

vbat shows the ripple on the pack, about 20 mV near 15.9 V. The status bar reads simulated 2752 steps, … ; battery B1 at 70.0 % charge after 1.8 ks; switching window from 1.8 ks. The window's time axis starts at 1800 s. Its first samples hold a short current spike while the switching circuit takes over from the averaged state, so read the ripple after it.

To run the same from a script or the console:

simulation.batteryRun {"tEnd": 5400}
simulation.batteryZoom {"at": 1800, "span": 0.005}

Next: the manual describes every field of both commands, the accuracy checks and the limits.