Battery Storage Optimization

LP · Arbitrage · Peak-shaving

Short-term · State-of-charge dynamics · Round-trip efficiency

When should a grid-scale battery charge, and when should it discharge? The answer is simple in the abstract — charge when electricity is cheap, discharge when it is expensive — and precise in practice: the operator solves a linear program over 24 hours subject to energy capacity, power rating, and round-trip efficiency. This is the central OR problem behind every battery dispatch system in the world, from the PJM Interconnection's frequency-regulation fleet to Australian household Tesla Powerwalls. Sioshansi, Denholm, Jenkin & Weiss (2009) showed that LP-based schedules capture 85–95% of theoretical arbitrage value even with imperfect price forecasts.

The problem

Temporal arbitrage under capacity and efficiency constraints

A 20-MW / 80-MWh lithium-ion battery (a typical utility-scale system as of 2024) looks like a pipe in two dimensions: it has a power rating ($P^{\max}$, how much charge or discharge per hour) and an energy capacity ($E^{\max}$, how much stored energy total). The ratio $E^{\max} / P^{\max}$ is the duration: 4 hours for the example above. A 30-minute duration battery is a power battery (frequency regulation); a 8-hour battery is an energy battery (peak shaving, diurnal arbitrage).

The state-of-charge (SOC) dynamics impose temporal coupling that is the core mathematical feature. Hourly charging $c_t$ adds $\eta^c c_t$ to stored energy (where $\eta^c$ is charging efficiency, typically 0.95); discharging $d_t$ removes $d_t / \eta^d$ from stored energy (discharge efficiency also $\sim 0.95$). Combined round-trip efficiency is about 0.85–0.92 for lithium-ion, 0.70–0.80 for flow batteries, and 0.75–0.85 for pumped hydro. This efficiency gap is the fundamental economic constraint: arbitrage is profitable only when the buy/sell price spread exceeds the efficiency loss plus marginal degradation cost.

Revenue streams are diverse. Energy arbitrage (charge off-peak, discharge on-peak) is the simplest; typical daily spread in California CAISO is $20–40/MWh. Ancillary services — frequency regulation, spinning reserve, reactive power — can pay two to five times more per MWh of capacity offered but require the battery to stay available for fast response. Behind-the-meter applications (peak-shaving of demand charges, solar self-consumption, time-of-use rate optimization) yield additional stacked revenues. Full value stacking optimization runs a co-optimized LP across all revenue streams.

Historical note
Sioshansi, Denholm, Jenkin & Weiss (2009) gave the canonical formulation of battery arbitrage in Energy Economics, showing the LP structure and the 85–95% value capture with imperfect forecasts. Hesse, Schimpe, Kucevic & Jossen (2017) reviewed lithium-ion grid storage specifically. Pozo, Contreras & Sauma (2014) and Das et al. (2018) extended to market-clearing and bi-level strategic bidding. Battery storage has gone from 1.5 GW deployed globally in 2014 to over 200 GW in 2024 (BloombergNEF), driven by falling lithium-ion costs (from $1,000/kWh in 2010 to $140/kWh in 2023, BNEF, 2023).

Beyond pure arbitrage, batteries increasingly sit alongside solar and wind to firm variable renewable output. Combined with renewable-integration stochastic dispatch, storage becomes one of the main degrees of freedom for handling forecast uncertainty — see renewable integration.

Mathematical formulation

Linear program with SOC dynamics

Notation

Parameters, decision variables
SymbolMeaningUnits
$T$Number of time periods (e.g., 24 hours)
$\pi_t$Electricity price in period $t$$/MWh
$L_t$Load in period $t$ (for peak-shaving)MW
$E^{\min}, E^{\max}$SOC boundsMWh
$P^{\max}$Power ratingMW
$\eta^c, \eta^d$Charging and discharging efficienciespu
$e_t$State of charge at end of period $t$MWh
$c_t$Charging powerMW
$d_t$Discharging powerMW

Objective · arbitrage revenue

Maximize net revenue over the horizon (discharge minus charge, at market price):

$$\max \; \sum_{t=1}^{T} \pi_t \, (d_t - c_t) \qquad \text{(1)}$$

The dual formulation minimizes net procurement cost. Peak-shaving variants replace the objective with a demand-charge minimization (highest observed net load over the billing month).

Constraints

SOC evolution: the heart of the problem, linking $e_t$ to $e_{t-1}$:

$$e_t = e_{t-1} + \eta^c \, c_t - \frac{d_t}{\eta^d} \qquad \forall t \qquad \text{(2)}$$

Energy capacity:

$$E^{\min} \le e_t \le E^{\max} \qquad \forall t \qquad \text{(3)}$$

Power rating:

$$0 \le c_t \le P^{\max}, \quad 0 \le d_t \le P^{\max} \qquad \forall t \qquad \text{(4)}$$

Initial / terminal conditions: fix $e_0$ and optionally $e_T = e_0$ for cyclic operation:

$$e_0 \text{ given}, \quad e_T \ge e_0 \; (\text{optional cyclic constraint}) \qquad \text{(5)}$$

The simultaneous charge-discharge exclusion — preventing $c_t > 0$ and $d_t > 0$ in the same period — is technically redundant when efficiencies are strictly less than 1: any simultaneous pair incurs loss for zero gain, so the LP optimum naturally sets the smaller to zero. If $\eta^c \eta^d = 1$ exactly, a binary variable is needed. Most literature ignores this and solves the pure LP.

Value stackingarbitrage + ancillary services

Modern commercial operation co-optimizes multiple revenue streams: arbitrage $r_t^{\mathrm{arb}}$, regulation $r_t^{\mathrm{reg}}$, spinning reserve $r_t^{\mathrm{res}}$. The constraint total power allocated across services does not exceed capacity becomes:

$$c_t + d_t + q_t^{\mathrm{reg}} + q_t^{\mathrm{res}} \le P^{\max} \qquad \forall t$$

and a related SOC-availability constraint for each reserve product. The full LP has ~5–10 variables per period and remains fast to solve.

Degradation as cost

Cycling degrades lithium-ion battery capacity; an extra $/MWh term $c_{\mathrm{deg}}$ can be added to objective (1) to penalize throughput: $-c_{\mathrm{deg}} (c_t + d_t)$. Mobile asset management considers the marginal cycle life lost. Typical $c_{\mathrm{deg}}$ is $10–$30/MWh throughput for 2024 lithium-ion systems.

Complexity & practical solve times

Deterministic battery LP is polynomial-time. A 24-hour horizon has 72 variables (charge + discharge + SOC per hour) and ~100 constraints. Commercial LP solvers (Gurobi, CPLEX, HiGHS) solve in $<$10 ms. Rolling-horizon deployment re-solves every few minutes with updated price forecasts.

Stochastic extensions (uncertain prices, uncertain ancillary activation) become scenario-based LPs with thousands of variables and still solve in seconds. Multi-year degradation-aware optimization becomes a large LP or convex QP over 365 × 24 = 8760 periods but remains tractable.

Real-world data

CAISO day-ahead / real-time prices

CAISO OASIS publishes 5-minute real-time and hourly day-ahead LMPs that drive most California battery arbitrage studies. The "duck curve" and frequent negative-price hours make California one of the most battery-friendly markets.

NREL Annual Technology Baseline · Battery

NREL ATB provides projected lithium-ion battery capital cost, O&M, lifetime, and efficiency trajectories through 2050. Standard source for investment analysis.

PJM ancillary services prices

PJM ancillary services publishes hourly regulation and reserve market prices. Frequency regulation pays highest for fast-responding assets; batteries dominate this product category in PJM.

Illustrative 24-hour case (this page)

The interactive solver below uses a synthetic but realistic day-ahead price profile (low overnight, peak evening) with user-configurable battery parameters (capacity, power, efficiency). Prices scale roughly like US-northeast summer days: $20–$150/MWh range.

Interactive solver

24-hour LP arbitrage · SOC trajectory

Battery parameters

80
20
85%
50%
0.8
10
Adjust parameters and press Solve.

Price signal & battery operation

24-hour price ($/MWh) · blue bars = charge, red bars = discharge
Signature viz: SOC trajectory over 24 hours (% of capacity)

Solution interpretation

The SOC trajectory reveals the optimal policy: the battery typically fills (charges) during overnight hours when prices are low, discharges during evening peaks when prices are high, and reaches its minimum storage during the highest-price window. A full cycle uses the entire energy capacity exactly once per day if the morning-to-evening price spread justifies it; two partial cycles appear when there are two distinct price peaks (morning + evening).

The efficiency gap is the key economic margin. A 20% round-trip loss means the operator needs at least a 20% price spread to break even. In CAISO peak summer days, the spread routinely exceeds 300%; even 70%-efficient legacy batteries make money. In flat markets (typical winter Sundays), a 90%-efficient battery may still lose money to degradation cost and will sit idle.

Degradation cost is the most-commonly-ignored but commercially critical parameter. At $30/MWh degradation cost, many marginal cycles become unprofitable; realistic dispatch shows fewer cycles and longer idle periods than the naive "any price spread > efficiency loss" rule would suggest. Real battery operators tune this parameter carefully against warranty terms and capacity-fade curves.

Extending to value stacking (ancillary services + arbitrage) often more than doubles revenue: the same capacity is partially reserved for frequency regulation, yielding $60–$100/MW-hour revenue during idle arbitrage periods. Real-world commercial batteries in PJM earn 60%+ of revenue from ancillary services, not arbitrage.

Extensions & variants

Value-stacking LP

Co-optimizes arbitrage, regulation, spinning reserve, and capacity payments. Adds variables for reserve bids and constraints tying energy to reserve availability. Commercial operators earn 50–70% of revenue from ancillary services.

Refs: Byrne & Silva-Monroy (2014); PJM manual 28 ancillary services.

Stochastic price LP

When day-ahead prices are uncertain, the scheduling becomes a two-stage stochastic LP with scenarios on the price vector. First-stage (morning) decisions must be made before realized prices; second-stage recourse adjusts within the day. Capture most of the deterministic-optimum value with practical computational cost.

Refs: Morales et al. (2014); Kazempour & Zareipour (2014).

Peak-shaving and demand charges

Commercial and industrial customers often pay a demand charge ($/kW) on their highest 15-min monthly net load. Battery dispatch minimizes the peak, not energy cost. Objective becomes $\min \max_t (L_t - d_t + c_t)$, which linearizes with a single auxiliary variable.

Refs: Oudalov, Cherkaoui & Beguin (2007); Wang et al. (2016).

Solar self-consumption

Behind-the-meter battery optimizes solar self-consumption: charge from excess PV, discharge during morning/evening load peaks. Objective accounts for net-metering tariff structure and often time-of-use energy prices.

Refs: Weniger, Tjaden & Quaschning (2014); Luthander et al. (2015).

Battery investment & sizing

Upstream question: how much $E^{\max}$ and $P^{\max}$ should be built? Becomes an MILP where sizing variables are upper-level and operational LP is lower-level. Couples to GEP.

Refs: Hesse et al. (2017); Schill & Kemfert (2011).

Degradation-aware optimization

Explicit cycle-counting and state-of-health tracking over multi-year horizons. Nonlinear (capacity fades with time and cycle depth) but tractable via piecewise linearization or SOC-averaging approximations. Critical for warranty-bounded commercial dispatch.

Refs: Xu et al. (2018); Kazhamiaka et al. (2019).

Key references

[1]
Sioshansi, R., Denholm, P., Jenkin, T., & Weiss, J. (2009).
“Estimating the value of electricity storage in PJM: Arbitrage and some welfare effects.”
Energy Economics, 31(2), 269–277. doi:10.1016/j.eneco.2008.10.005
[2]
Hesse, H. C., Schimpe, M., Kucevic, D., & Jossen, A. (2017).
“Lithium-ion battery storage for the grid — a review of stationary battery storage system design tailored for applications in modern power grids.”
Energies, 10(12), 2107. doi:10.3390/en10122107
[3]
Pozo, D., Contreras, J., & Sauma, E. E. (2014).
“Unit commitment with ideal and generic energy storage units.”
IEEE Transactions on Power Systems, 29(6), 2974–2984. doi:10.1109/TPWRS.2014.2313513
[4]
Byrne, R. H., & Silva-Monroy, C. A. (2014).
“Estimating the maximum potential revenue for grid connected electricity storage: Arbitrage and the regulation market.”
Sandia National Laboratory technical report SAND2014-8835. osti.gov/1163840
[5]
Oudalov, A., Cherkaoui, R., & Beguin, A. (2007).
“Sizing and optimal operation of battery energy storage system for peak shaving application.”
2007 IEEE PowerTech, 621–625. doi:10.1109/PCT.2007.4538388
[6]
Xu, B., Oudalov, A., Ulbig, A., Andersson, G., & Kirschen, D. S. (2018).
“Modeling of lithium-ion battery degradation for cell life assessment.”
IEEE Transactions on Smart Grid, 9(2), 1131–1140. doi:10.1109/TSG.2016.2578950
[7]
Kazempour, S. J., & Zareipour, H. (2014).
“Equilibria in an oligopolistic market with wind power production.”
IEEE Transactions on Power Systems, 29(2), 686–697. doi:10.1109/TPWRS.2013.2286094
[8]
Schill, W.-P., & Kemfert, C. (2011).
“Modeling strategic electricity storage.”
The Energy Journal, 32(3), 59–87. doi:10.5547/ISSN0195-6574-EJ-Vol32-No3-3
[9]
Kazhamiaka, F., Rosenberg, C., & Keshav, S. (2019).
“Tractable lithium-ion storage models for optimizing energy systems.”
Energy Informatics, 2(1), 4. doi:10.1186/s42162-019-0070-6
[10]
BloombergNEF. (2023).
“Lithium-ion battery pack prices hit record low of $139/kWh.”
BloombergNEF annual survey. about.bnef.com
In-browser solver runs a 24-period LP via greedy buy-low/sell-high with forward-backward balance correction. Production battery dispatch uses commercial LP solvers with value-stacking across services.