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 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
- Charging schedule and target policy
Permits charging
Inputs & settings
- strategy
- targetSoc
- departureS
- soc, available, chargerDone → permit
- Regulated CC/CV charger
Regulates current and voltage
Inputs & settings
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
- Battery with SOC-dependent OCV
Stores charge and supplies terminal voltage
Inputs & settings
- capacityAh
- initialSoc
- emptyVoltageV / fullVoltageV
- resistanceOhm
- Electrical ports p and n
- 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.
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
- 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.
- Review the block inputs, units and model limits.
- Open the Studio example and run its bundled model.
- 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
- 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.
- Review the block inputs, units and model limits.
- Open the Studio example and run its bundled model.
- 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
- 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.