Lemonergy · Studio block

Regulated CC/CV charger

Original sampled CC/CV controller coupled to an ideal electrical converter.

Implementation ID
regulated-charger
Reviewed
2026-10-27

Behavior

A trigger rising edge starts or rearms charging. The controller can enter precharge, constant current, constant voltage, completion, inhibition, or lead-acid float. Completion requires current below the cutoff while at the voltage ceiling for the cutoff dwell. A held trigger does not restart a completed charge.

Interface

Regulated CC/CV charger interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Regulated CC/CV chargerStudio blocktriggerenablecurrentLimitpowerLimitbmsPermittemperaturepricesocconnectedstatereasoncompletechargeCurrentgridPowerlossvoltagecurrentpowerpn
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
pconservingV, AElectrical terminal: potential and charge-conserving current.
nconservingV, AElectrical terminal: potential and charge-conserving current.
triggerinputdimensionlessTyped signal input; its quantity must match the connected output.
enableinputdimensionlessTyped signal input; its quantity must match the connected output.
currentLimitinputATyped signal input; its quantity must match the connected output.
powerLimitinputWTyped signal input; its quantity must match the connected output.
bmsPermitinputdimensionlessTyped signal input; its quantity must match the connected output.
temperatureinputKTyped signal input; its quantity must match the connected output.
priceinputcurrency/kWhTyped signal input; its quantity must match the connected output.
socinputfractionTyped signal input; its quantity must match the connected output.
connectedinputdimensionlessTyped signal input; its quantity must match the connected output.
stateoutputcodeObserved result from the solved component or sampled controller.
reasonoutputcodeObserved result from the solved component or sampled controller.
completeoutput0 or 1Observed result from the solved component or sampled controller.
chargeCurrentoutputAObserved result from the solved component or sampled controller.
gridPoweroutputWObserved result from the solved component or sampled controller.
lossoutputWObserved result from the solved component or sampled controller.
voltageoutputVObserved result from the solved component or sampled controller.
currentoutputAObserved result from the solved component or sampled controller.
poweroutputWObserved result from the solved component or sampled controller.

Parameters

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

Configuration fields
ParameterUnitDefaultMeaning and limits
Sample Time S
sampleTimeS
s1Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.001; Maximum 3600
Current A
currentA
A32Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.001; Maximum 1000000
Voltage V
voltageV
V420Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.01; Maximum 1000000
Cutoff Current A
cutoffCurrentA
A2Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0; Maximum 1000000
Cutoff Hold S
cutoffHoldS
s30Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0; Maximum 86400
Precharge Voltage V
prechargeVoltageV
V300Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0; Maximum 1000000
Precharge Current A
prechargeCurrentA
A3Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.001; Maximum 1000000
Minimum Voltage V
minimumVoltageV
V250Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0; Maximum 1000000
Float Voltage V
floatVoltageV
V405Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.01; Maximum 1000000
Efficiency
efficiency
fraction0.95Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.01; Maximum 1
Chemistry
chemistry
0 Li-ion, 1 lead-acid0Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0; Maximum 1
Min Temperature K
minTemperatureK
K273.15Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 1; Maximum 1000
Max Temperature K
maxTemperatureK
K318.15Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 1; Maximum 1000
Capacity Ah
capacityAh
Ah for SOC barrier100Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 1e-06; Maximum 1000000000
Boundary Time S
boundaryTimeS
s for SOC boundary barrier1Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.001; Maximum 3600

Equations and rules

  • P_grid = P_delivered / eta
  • P_loss = P_grid - P_delivered
  • I_SOC_cap = max(0, 1 - SOC) * 3600 * Q_Ah / boundaryTimeS

Worked example

Build CC–CV charging

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

Open the Studio example →

Use in a workflow

Build CC–CV charging

Native current and voltage regulation act against an explicit battery.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Share a site supply

Multiple branches share one power cap.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Compare charging policies

Compare authored schedules on the same hardware.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Compare grid and battery energy

Separate energy and loss signals make efficiency visible.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Separate low current from float

Bounded lithium charging and lead-acid maintenance are distinct.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Connect SOC and voltage

The battery integrates charge and combines OCV with resistance.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Charge during available stops

Availability is an independent signal.

  1. Regulated CC/CV charger: Regulates current and voltage
    • currentA
    • voltageV
    • cutoffCurrentA / cutoffHoldS
    • Electrical ports p and n
Open the Studio example

Connected concepts

Limits and interpretation

  • The battery uses linear OCV and fixed resistance. It does not automatically add aging, thermal dynamics or balancing.
  • Internal model SOC is not an estimate of an unknown physical battery. OCV is linear and resistance fixed.
  • A loss signal is not a predicted temperature. This network takes external temperature.
  • This is deterministic policy comparison, not a forecast or economic optimum.
  • Downstream unused capacity is not silently redistributed.
  • All battery and converter limits still apply. A schedule is not an electrochemical law.
  • These effective parameters are not a recipe. Lithium-ion does not use indefinite trickle or lead-acid float.

Implementation sources

This reference follows Lemonergy implementation sources. Scientific articles support the linked concepts separately.

Repository: battery-design · Revision: ef9802329b75bc15bb96885f8ed5d49425106696

  • js/charging-control.js
  • js/charging-scenarios.js
  • docs/CHARGING_BLOCKS_SPEC.md
  • js/physical-network.js
  • rust-core/src/charging_control.rs

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