Lemonergy · Studio block

Battery with SOC-dependent OCV

Lumped battery with a linear SOC-dependent open-circuit voltage and series resistance.

Implementation ID
battery-ocv
Reviewed
2026-10-27

Behavior

The network solves terminal current and integrates charge into SOC. Positive current into the positive terminal charges the battery. Coulombic efficiency applies during charging; discharge uses unity.

Interface

Battery with SOC-dependent OCV interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Battery with SOC-dependent OCVStudio blockocvsocSignallossvoltagecurrentpowerpn
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.
ocvoutputVObserved result from the solved component or sampled controller.
socSignaloutputfractionObserved 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
Empty Voltage V
emptyVoltageV
V300Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.01; Maximum 1000000
Full Voltage V
fullVoltageV
V420Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.01; Maximum 1000000
Resistance Ohm
resistanceOhm
ohm0.08Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 1e-06; Maximum 1000000
Capacity Ah
capacityAh
Ah100Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 1e-06; Maximum 1000000000
Initial Soc
initialSoc
fraction0.2Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0; Maximum 1
Coulombic Efficiency
coulombicEfficiency
fraction1Configured model parameter; the default is an initial editor value, not an operating recommendation.
Minimum 0.01; Maximum 1

Equations and rules

  • OCV = V_empty + (V_full - V_empty) * SOC
  • I = (V_terminal - OCV) / R
  • dSOC/dt = I * eta_charge / (3600 * Q_Ah), for I >= 0; I / (3600 * Q_Ah) otherwise
  • P_loss = I^2 * R

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. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Share a site supply

Multiple branches share one power cap.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Compare charging policies

Compare authored schedules on the same hardware.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Compare grid and battery energy

Separate energy and loss signals make efficiency visible.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Separate low current from float

Bounded lithium charging and lead-acid maintenance are distinct.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Connect SOC and voltage

The battery integrates charge and combines OCV with resistance.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Charge during available stops

Availability is an independent signal.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Supply an outage load

V2H illustrates outage-triggered dispatch and reserve.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Model signed grid exchange

Explicit battery and converter exchange average power.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
Open the Studio example

Transfer between two batteries

Conserving conversion couples donor and recipient.

  1. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • Electrical ports p and n
  2. Battery with SOC-dependent OCV: Stores charge and supplies terminal voltage
    • capacityAh
    • initialSoc
    • emptyVoltageV / fullVoltageV
    • resistanceOhm
    • 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.
  • This excludes AC waveforms, synchronization, communications and certification.
  • No islanding switches, smart-panel circuits or protection coordination are simulated.
  • The example assumes hardware compatibility; it does not establish connector or communication compatibility.

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)