Battery knowledge · State estimation

Coulomb counting

Estimating state of charge by integrating the measured current over time. Simple and fast, but sensor offset accumulates, so it is corrected against the OCV–SOC curve at rest or fused with it in a Kalman filter. [1]

Also called
ampere-hour counting
Relationship
SOC(t) = SOC₀ − ∫ I dt / Q

Example

Integrate a discharge step

Starting at 80% SOC with a 5 Ah available capacity, an ideal 2 A discharge for 30 min removes 1 Ah and lowers SOC to 60%. This example takes discharge current as positive and ignores efficiency and sensor error.

Explore the graph

SOC rises with accumulated charge; depth of discharge falls by the same amount.

Complementary charge fractions
Complementary charge fractionsTime (h) versus Capacity fraction (%). SOC; DOD. Interpretation follows the graphs.002515027531004Time (h)Capacity fraction (%)
SOCDOD (dashed)

From 20% SOC, ideal full charge takes 48 min. Integration stops at 100%.

SOC = SOC₀ + ∫ I_charge dt / Q; DOD = 1 − SOC

Illustrative model. Current is positive into the cell. Constant capacity and 100% charge efficiency; no CC-CV taper.

Use in Lemonergy

Lemonergy Studio blocks

Capacity fit worked example

Fits charge capacity through the origin from aligned SOC-change and integrated-charge windows.

Blocks to use

  1. Capacity fit

    Fits a positive ampere-hour capacity through the origin from aligned SOC-decrease and removed-charge windows. The weighted version accepts nonnegative window weights; zero excludes a window. A validity flag reports sufficient identifying information.

    Inputs & settings
    • Use the parameter values in the block reference.
    • Bundled example verified on the production release of 28 October 2026.

This overview identifies the components to use. Follow the example in Lemonergy for their connections and settings.

  1. Review the block inputs, units and model limits.
  2. Open the Studio example and run its bundled model.
  3. Compare the output channels with the numerical checks; change one input and run again.

Example. Use the defaults below with SOC decrease per window = [0.1, 0.2, 0.3] 1 (fraction), Removed charge per window (Ah) = [0.2, 0.4, 0.6] Ah. At 0 s, Fitted capacity (Ah) is 2 Ah. Additional checks are listed below.

Observe. Inspect the outputs and numerical checks on the block reference page.

SOC and integrated charge must describe the same windows. Biased SOC or current measurements bias the fit; this operation does not collect or qualify those measurements. The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks.

Open Studio example →

Lemonergy Studio blocks

Charge counter worked example

Integrates signed throughput. Changing capacity preserves fraction and reports revaluation separately.

Blocks to use

  1. Charge counter

    Integrates signed discharge current or power over elapsed sample time. Charge efficiency applies during charging. The initial sample has zero elapsed time. Variable-capacity variants preserve the current fraction when capacity changes and report the resulting amount revaluation separately. Reset restores the initial fraction without integrating that event.

    Inputs & settings
    • Use the parameter values in the block reference.
    • Bundled example verified on the production release of 28 October 2026.

This overview identifies the components to use. Follow the example in Lemonergy for their connections and settings.

  1. Review the block inputs, units and model limits.
  2. Open the Studio example and run its bundled model.
  3. Compare the output channels with the numerical checks; change one input and run again.

Example. Use the defaults below with Signed battery current = 2 A, Reset = 0 true / false. At 0 s, State of charge is 0.8 1 (fraction). Additional checks are listed below.

Observe. Inspect the outputs and numerical checks on the block reference page.

Current or power bias accumulates. Fraction clipping is reported as a boundary amount; it does not make the connected plant respect that boundary. Energy variants need capacity in joules. The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks.

Open Studio example →

Lemonergy Studio blocks

Energy counter worked example

Integrates signed throughput. Changing capacity preserves fraction and reports revaluation separately.

Blocks to use

  1. Energy counter

    Integrates signed discharge current or power over elapsed sample time. Charge efficiency applies during charging. The initial sample has zero elapsed time. Variable-capacity variants preserve the current fraction when capacity changes and report the resulting amount revaluation separately. Reset restores the initial fraction without integrating that event.

    Inputs & settings
    • Use the parameter values in the block reference.
    • Bundled example verified on the production release of 28 October 2026.

This overview identifies the components to use. Follow the example in Lemonergy for their connections and settings.

  1. Review the block inputs, units and model limits.
  2. Open the Studio example and run its bundled model.
  3. Compare the output channels with the numerical checks; change one input and run again.

Example. Use the defaults below with Signed battery power = 2 W, Reset = 0 true / false. At 0 s, State of energy is 0.8 1 (fraction). Additional checks are listed below.

Observe. Inspect the outputs and numerical checks on the block reference page.

Current or power bias accumulates. Fraction clipping is reported as a boundary amount; it does not make the connected plant respect that boundary. Energy variants need capacity in joules. The example verifies numerical behavior for synthetic parameters. Cell characterization and validation for an intended use are separate tasks.

Open Studio example →
All connected Lemonergy block references

References & further reading

Technical references

  1. Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs: Part 2. Modeling and identification

    Gregory L. Plett · Journal of Power Sources · 2004

    Technical reference · Battery charge balance, open-circuit voltage, ohmic loss, polarization dynamics and model identification; parameters require cell-specific data.

Further reading on this topic

These sources provide broader context; they are not presented as citations for every statement in this entry.

  1. Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs: Part 3. State and parameter estimation

    Gregory L. Plett · Journal of Power Sources · 2004

    Topic background · Model-based battery state-of-charge and parameter estimation with extended Kalman filtering, including uncertainty and model dependence.