Battery knowledge · Charging and discharging

Charger

The power electronics that convert mains or DC supply into the controlled current and voltage a battery needs. For lithium-ion it runs the CC-CV profile within the limits the BMS communicates, and stops rather than floats when the cell is full. [1]

Example

Compare charging profiles

Current holds at 5 A until the example 4.15 V threshold; voltage then holds while current tapers. The stop marker is a separate low-current termination condition.

Positive current charges the cell. Time is normalized; selected thresholds are not cell-specific recommendations. The voltage trace ends at termination; post-stop relaxation is excluded.

Explore the graph

See which quantity is held constant, when the phase changes and how charging ends.

Current profile
Current profileRelative elapsed time versus Current (A). Charge current. Interpretation follows the graphs.CCCVStop001.440.252.880.54.310.755.751Relative elapsed timeCurrent (A)
Charge current
Voltage profile
Voltage profileRelative elapsed time versus Cell voltage (V). Cell voltage. Interpretation follows the graphs.CCCVStop303.350.253.70.54.050.754.41Relative elapsed timeCell voltage (V)
Cell voltage

Current holds at 5 A until the example 4.15 V threshold; voltage then holds while current tapers. The stop marker is a separate low-current termination condition.

CC: I = I_set · CV: V = V_limit

Illustrative model. Positive current charges the cell. Time is normalized; selected thresholds are not cell-specific recommendations. The voltage trace ends at termination; post-stop relaxation is excluded.

Use in Lemonergy

Lemonergy Studio blocks

Build CC–CV charging

Native current and voltage regulation act against an explicit battery.

Blocks to use

  1. Charging schedule and target policy

    Permits charging

    Inputs & settings
    • strategy
    • targetSoc
    • departureS
    • soc, available, chargerDone → permit
  2. Regulated CC/CV charger

    Regulates current and voltage

    Inputs & settings
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
  3. Battery with SOC-dependent OCV

    Stores charge and supplies terminal voltage

    Inputs & settings
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
  4. Electrical reference

    Sets zero potential

    Inputs & settings
    • Connect p to reference net

This overview identifies the components to use. Follow the example in Lemonergy for their connections and settings.

  1. Open home charging and inspect settings.
  2. Choose immediate charging; inspect mode and completion.

Example. An illustrative 100 Ah battery with a 420 V ceiling can use a 32 A cap. At the ceiling, current falls as OCV rises.

Observe. Completion needs current below cutoff at the CV ceiling for the configured dwell. Site-limited low current is different.

The battery uses linear OCV and fixed resistance. It does not automatically add aging, thermal dynamics or balancing.

Open the Studio example →

Lemonergy Studio blocks

CC-CV current controller worked example

PI voltage regulation with an external current envelope and anti-windup.

Blocks to use

  1. CC-CV current controller

    Uses a PI voltage loop and an external current magnitude envelope to request charge current. Conditional integration limits windup while the request is saturated. Charging is negative in the discharge-positive current convention; disabling resets control memory.

    Inputs & settings
    • Use the parameter values in the block reference.
    • Bundled example verified on the production release of 28 October 2026.

This overview identifies the components to use. Follow the example in Lemonergy for their connections and settings.

  1. Review the block inputs, units and model limits.
  2. Open the Studio example and run its bundled model.
  3. Compare the output channels with the numerical checks; change one input and run again.

Example. Use the defaults below with Highest cell voltage = 3.9 V, Charge-current magnitude limit = 2 A, Enable = 1 true / false. At 0 s, Signed current request (charge negative) is -1 A. Additional checks are listed below.

Observe. Inspect the outputs and numerical checks on the block reference page.

This block generates a current request. The plant, actuator limits and loop stability must be modeled separately. The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks.

Open Studio example →

Lemonergy Studio blocks

Incremental CC-CV controller worked example

Updates a bounded charge request from voltage error each sample.

Blocks to use

  1. Incremental CC-CV controller

    Adds a proportional voltage-error correction to the previous charging magnitude at each sample, clamps it to the external envelope and emits the negative signed request. Disabling resets the request.

    Inputs & settings
    • Use the parameter values in the block reference.
    • Bundled example verified on the production release of 28 October 2026.

This overview identifies the components to use. Follow the example in Lemonergy for their connections and settings.

  1. Review the block inputs, units and model limits.
  2. Open the Studio example and run its bundled model.
  3. Compare the output channels with the numerical checks; change one input and run again.

Example. Use the defaults below with Highest cell voltage = 3.9 V, Charge-current magnitude limit = 2 A, Enable = 1 true / false. At 0 s, Signed current request (charge negative) is -0.5 A. Additional checks are listed below.

Observe. Inspect the outputs and numerical checks on the block reference page.

The gain acts per update. Changing sample interval changes the response; this is an incremental controller, not the PI variant. The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks.

Open Studio example →

References & further reading

Technical references

  1. Lithium-ion battery fast charging: A review

    Anna Tomaszewska et al. · eTransportation · 2019

    Technical reference · CC-CV and alternative charging protocols, transport limitations, degradation and thermal implications; results depend on cell and test conditions. Software behavior is documented separately in Lemonergy block references.