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
| Name | Direction | Unit | Meaning |
|---|---|---|---|
voltage | input | V | Highest cell voltage; scalar. |
limit | input | A | Charge-current magnitude limit; scalar. |
enable | input | true / false | Enable; scalar. |
request | output | A | Signed current request (charge negative); scalar. |
mode | output | 1 | Mode (0 disabled, 1 CC, 2 CV); scalar. |
Parameters
Defaults are initial model values. Select values for your own model and operating conditions.
| Parameter | Unit | Default | Meaning and limits |
|---|---|---|---|
Sample interval (s)sampleTimeS | s | 0.1 | Positive sample interval. Initialization has zero elapsed time; subsequent accepted samples update memory. |
Voltage target (V)targetV | V | 4 | Voltage target (V). This is an editable model input; the default belongs to the synthetic worked example. |
Proportional gain (A/V)kp | A/V | 5 | Proportional 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) | 0 | Integral 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 →| Output | Time (s) | Expected value | Unit | Absolute tolerance |
|---|---|---|---|---|
Signed current request (charge negative)request | 0 | -0.5 | A | 1e-08 |
Explore the recorded outputs
Incremental CC-CV controller recorded example
Incremental CC-CV controller / Signed current request (charge negative)11 actual recorded samples. Lines are visual guides between samples. Synthetic example, not measured cell data.
Read the selected signal as a table
| Time (s) | Value |
|---|
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.
- 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.
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.
- 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.
- 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)