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
| Name | Direction | Unit | Meaning |
|---|---|---|---|
p | conserving | V, A | Electrical terminal: potential and charge-conserving current. |
n | conserving | V, A | Electrical terminal: potential and charge-conserving current. |
trigger | input | dimensionless | Typed signal input; its quantity must match the connected output. |
enable | input | dimensionless | Typed signal input; its quantity must match the connected output. |
currentLimit | input | A | Typed signal input; its quantity must match the connected output. |
powerLimit | input | W | Typed signal input; its quantity must match the connected output. |
bmsPermit | input | dimensionless | Typed signal input; its quantity must match the connected output. |
temperature | input | K | Typed signal input; its quantity must match the connected output. |
price | input | currency/kWh | Typed signal input; its quantity must match the connected output. |
soc | input | fraction | Typed signal input; its quantity must match the connected output. |
connected | input | dimensionless | Typed signal input; its quantity must match the connected output. |
state | output | code | Observed result from the solved component or sampled controller. |
reason | output | code | Observed result from the solved component or sampled controller. |
complete | output | 0 or 1 | Observed result from the solved component or sampled controller. |
chargeCurrent | output | A | Observed result from the solved component or sampled controller. |
gridPower | output | W | Observed result from the solved component or sampled controller. |
loss | output | W | Observed result from the solved component or sampled controller. |
voltage | output | V | Observed result from the solved component or sampled controller. |
current | output | A | Observed result from the solved component or sampled controller. |
power | output | W | Observed result from the solved component or sampled controller. |
Parameters
Defaults are initial model values. Select values for your own model and operating conditions.
| Parameter | Unit | Default | Meaning and limits |
|---|---|---|---|
Sample Time SsampleTimeS | s | 1 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0.001; Maximum 3600 |
Current AcurrentA | A | 32 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0.001; Maximum 1000000 |
Voltage VvoltageV | V | 420 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0.01; Maximum 1000000 |
Cutoff Current AcutoffCurrentA | A | 2 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0; Maximum 1000000 |
Cutoff Hold ScutoffHoldS | s | 30 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0; Maximum 86400 |
Precharge Voltage VprechargeVoltageV | V | 300 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0; Maximum 1000000 |
Precharge Current AprechargeCurrentA | A | 3 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0.001; Maximum 1000000 |
Minimum Voltage VminimumVoltageV | V | 250 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0; Maximum 1000000 |
Float Voltage VfloatVoltageV | V | 405 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0.01; Maximum 1000000 |
Efficiencyefficiency | fraction | 0.95 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0.01; Maximum 1 |
Chemistrychemistry | 0 Li-ion, 1 lead-acid | 0 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 0; Maximum 1 |
Min Temperature KminTemperatureK | K | 273.15 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 1; Maximum 1000 |
Max Temperature KmaxTemperatureK | K | 318.15 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 1; Maximum 1000 |
Capacity AhcapacityAh | Ah for SOC barrier | 100 | Configured model parameter; the default is an initial editor value, not an operating recommendation. Minimum 1e-06; Maximum 1000000000 |
Boundary Time SboundaryTimeS | s for SOC boundary barrier | 1 | Configured 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 / etaP_loss = P_grid - P_deliveredI_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.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Share a site supply
Multiple branches share one power cap.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Compare charging policies
Compare authored schedules on the same hardware.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Compare grid and battery energy
Separate energy and loss signals make efficiency visible.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Separate low current from float
Bounded lithium charging and lead-acid maintenance are distinct.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Connect SOC and voltage
The battery integrates charge and combines OCV with resistance.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Charge during available stops
Availability is an independent signal.
- Regulated CC/CV charger: Regulates current and voltage
- currentA
- voltageV
- cutoffCurrentA / cutoffHoldS
- Electrical ports p and n
Connected concepts
- CC-CV charging
- Charger
- Charging curve
- Constant current
- Constant voltage
- Cutoff voltage
- Taper current
- Depot charging
- Electric bus
- Energy management system
- Energy arbitrage
- AC slow charging
- Smart charging
- Energy efficiency
- Heat generation
- Joule
- Joule heating
- Power
- Watt
- Trickle and float charging
- Closed-circuit voltage
- Coulomb counting
- Coulombic efficiency
- Internal resistance
- IR drop
- OCV–SOC curve
- Open-circuit voltage
- State of charge
- Boost and top-up charging
- Opportunity charging
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.jsjs/charging-scenarios.jsdocs/CHARGING_BLOCKS_SPEC.mdjs/physical-network.jsrust-core/src/charging_control.rs
This implementation and its workflow uses (JSON) · Knowledge graph (JSON-LD)