Lemonergy · Studio block

Incremental CC-CV controller

Updates a bounded charge request from voltage error each sample.

Implementation ID
battery-incremental-cccv
Reviewed
2026-10-27

Behavior

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.

Interface

Incremental CC-CV controller interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Incremental CC-CV controllerStudio blockvoltagelimitenablerequestmode
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
voltageinputVHighest cell voltage; scalar.
limitinputACharge-current magnitude limit; scalar.
enableinputtrue / falseEnable; scalar.
requestoutputASigned current request (charge negative); scalar.
modeoutput1Mode (0 disabled, 1 CC, 2 CV); scalar.

Parameters

Defaults are initial model values. Select values for your own model and operating conditions.

Configuration fields
ParameterUnitDefaultMeaning and limits
Sample interval (s)
sampleTimeS
s0.1Positive sample interval. Initialization has zero elapsed time; subsequent accepted samples update memory.
Voltage target (V)
targetV
V4Voltage target (V). This is an editable model input; the default belongs to the synthetic worked example.
Proportional gain (A/V)
kp
A/V5Proportional gain (A/V). This is an editable model input; the default belongs to the synthetic worked example.
Integral gain (A/(V·s))
ki
A/(V·s)0Integral gain (A/(V·s)). This is an editable model input; the default belongs to the synthetic worked example.

Equations and rules

  • magnitude[k] = clamp(magnitude[k-1] + kp * (targetV - voltage[k]), 0, limit[k])
  • request[k] = -magnitude[k]

Worked example

Incremental CC-CV controller worked 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.

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Signed current request (charge negative)
request
0-0.5A1e-08

Explore the recorded outputs

Incremental CC-CV controller recorded example

Incremental CC-CV controller / Signed current request (charge negative)
Incremental CC-CV controller / Signed current request (charge negative) against timeRecorded synthetic simulation values. Time in seconds; output in A.-2.120-1.6850.25-1.250.5-0.8150.75-0.381ATime (s)
Incremental CC-CV controller / Signed current request (charge negative): -0.5 A at 0 s

11 actual recorded samples. Lines are visual guides between samples. Synthetic example, not measured cell data.

Download the recorded samples (JSON) · Open this Studio example after release

Use in a workflow

Incremental CC-CV controller worked example

Updates a bounded charge request from voltage error each sample.

  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.
    • Use the parameter values in the block reference.
    • Implementation tested locally; public release pending.
Open Studio example after release

Connected concepts

Limits and interpretation

  • 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.

Scientific and mathematical references

These sources explain the scientific and mathematical background. The behavior, interface and limits above define the Lemonergy implementation; a citation does not imply every model option in the source is implemented.

  1. Feedback Systems: An Introduction for Scientists and Engineers, second edition

    Karl J. Åström, Richard M. Murray · Princeton University Press; author-maintained FBSwiki · 2021

    Technical reference · State-space modeling, feedback and PID control. These mathematical foundations do not establish a particular software implementation.

  2. 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.

Implementation sources

This reference follows the public interface and locally verified numerical checks for an upcoming release.

Contract: Lemonergy Studio public contract · Verification record: verification-2026-10-27

  • docs/glossary/native-block-verification.json

This implementation and its workflow uses (JSON) · Knowledge graph (JSON-LD)