Battery dispatch and grid decisions
Grid batteries store surplus electricity when it is abundant and release it when it is scarce, and deciding exactly when to do each is an optimisation problem built on the forecasts covered earlier in this section.
- 9 min read
- 3 reading levels
- Published
Read these first
On this page 6
One lesson, three depths. Pick the one that fits you today — you can switch any time.
Beginner — No maths. Plain English.
Battery dispatch decides when a grid-scale battery should store electricity, and when it should release it.
Many Indian households fill an overhead water tank during the hours municipal supply is running. They draw from that tank through the rest of the day, once supply is off. Nobody decides this fresh every day. It is a routine, built around a predictable pattern of when water is available, and when it is needed. A grid battery does exactly the same thing with electricity. It fills up when power is abundant, and gets drawn down when power is needed most.
Why it exists
Solar power peaks around midday. Electricity demand often peaks in the evening, once the sun has set and people are home, with lights and appliances running. Subtract one curve from the other, and the resulting shape is low around midday, spiking in the evening. It has a well-known nickname in the industry: the duck curve. Grid operators in California first named it, for its rough resemblance to a duck's outline.
A battery smooths this out. Charge it with the midday solar surplus that would otherwise go unused. Discharge it into the evening peak instead. That reduces how much other generation is needed at exactly the moment demand is highest — generation that is often more expensive, or more polluting.
How it works
midday: lots of solar, moderate demand --> surplus power CHARGES the battery
evening: little solar, high demand --> battery DISCHARGES to cover the gap
|
[ decide the exact charge/discharge schedule, using forecasts of
demand, solar and wind, and the battery's own physical limits ]This decision — exactly when to charge, when to discharge, and how much — is called dispatch. It depends directly on the forecasts covered in the previous two lessons. Get the demand or solar forecast wrong, and the battery can end up charged at the wrong moment. Or it can sit empty exactly when it was needed most.
Where you have already seen it
Australia's Hornsdale Power Reserve, a large grid-scale battery project, became widely known for a specific skill. It stabilises the local grid within fractions of a second during sudden power plant failures — far faster than a traditional power plant can respond. India's own solar parks are increasingly paired with battery storage for exactly the same reason: to catch midday surplus and release it later.
An honest note
A battery is a physical device with real limits. It has a maximum capacity, a maximum charge and discharge rate, and it degrades gradually with heavy use. A dispatch algorithm is not free to schedule whatever it likes. It operates inside those hard physical constraints, and inside safety limits set to prevent overheating or damage. Getting dispatch wrong at grid scale is not a minor bug. It directly affects supply reliability and real financial cost. That is why production dispatch systems are built and reviewed by power systems engineers, not deployed from an untested model alone.
Remember this
- Batteries store surplus power when it is abundant, and release it when demand is high — smoothing the mismatch between solar output and evening demand.
- Good dispatch decisions depend directly on accurate demand and generation forecasts.
- Batteries have real physical limits — capacity, rate, and degradation — that any dispatch decision has to respect.
What to learn next
- Modelling wildfire and flood risk — another climate-driven risk grid operators plan around.
- Electricity load forecasting — the demand forecast this lesson's dispatch decisions depend on.
- Optimization — the general mathematics behind scheduling decisions like this one.
Developer — Code and libraries.
Setup
pip install numpyMinimal runnable code
A simplified duck curve — demand minus solar generation — and a battery that charges during the cheapest, lowest-net-load hours and discharges during the highest.
import numpy as np
hours = np.arange(24)
demand = 60 + 30 * np.exp(-((hours - 9) ** 2) / 8) + 40 * np.exp(-((hours - 19) ** 2) / 10)
solar = np.clip(80 * np.sin(np.pi * (hours - 6) / 12), 0, None)
net_load = demand - solar # what the rest of the grid must supply, without a battery
CAPACITY_MWH = 150.0
MAX_RATE_MW = 40.0
def dispatch_battery(net_load, capacity, max_rate):
soc = capacity * 0.2 # state of charge, starting at 20%
grid_draw = np.zeros_like(net_load)
charge_threshold = np.percentile(net_load, 30)
discharge_threshold = np.percentile(net_load, 70)
for i, nl in enumerate(net_load):
if nl < charge_threshold and soc < capacity:
charge = min(max_rate, capacity - soc, charge_threshold - nl)
soc += charge
grid_draw[i] = nl + charge # charging itself still draws power from the grid
elif nl > discharge_threshold and soc > 0:
discharge = min(max_rate, soc, nl - discharge_threshold)
soc -= discharge
grid_draw[i] = nl - discharge
else:
grid_draw[i] = nl
return grid_draw
grid_draw = dispatch_battery(net_load, CAPACITY_MWH, MAX_RATE_MW)
print(f"peak grid draw WITHOUT battery: {net_load.max():.1f} MW, at hour {net_load.argmax()}:00")
print(f"peak grid draw WITH battery: {grid_draw.max():.1f} MW, at hour {grid_draw.argmax()}:00")
reduction = 100 * (net_load.max() - grid_draw.max()) / net_load.max()
print(f"peak reduced by: {net_load.max() - grid_draw.max():.1f} MW ({reduction:.0f}%)")peak grid draw WITHOUT battery: 100.0 MW, at hour 19:00 peak grid draw WITH battery: 66.3 MW, at hour 6:00 peak reduced by: 33.7 MW (34%)
What actually happened
Without a battery, the grid's hardest moment is 7pm — the evening demand peak, right as solar output has dropped away. With the battery discharging into that peak, the worst moment of the whole day shrinks by about a third, and drops to 34MW below where it was.
Notice the new peak moved to 6am, not the old evening slot. Charging the battery during a low-demand window still adds real load to the grid, at that moment. Peak shaving does not make demand disappear. It moves and flattens it. A badly timed charging schedule can create a new, smaller peak somewhere else — exactly what happened here.
Common mistakes
Forgetting that charging still draws power. grid_draw[i] = nl + charge in this example is easy to overlook. A battery does not charge for free. A dispatch schedule that ignores this can create a surprising new peak, as shown above.
Using fixed time-of-day rules instead of forecasts. "Always charge at noon" works on a sunny day, and fails badly on a cloudy one when there was no midday solar surplus to catch. Real dispatch systems react to forecasted and actual conditions, not a fixed clock.
Ignoring round-trip efficiency. Real batteries lose some energy in the charge-discharge cycle — commonly 10 to 20 percent, depending on the technology. This example assumes a perfect, lossless battery, which no real battery is.
Try it yourself
Add a round-trip efficiency: multiply charge by 0.85 before adding it to soc (so only 85% of what is drawn from the grid actually ends up stored). Rerun, and see how much smaller the achievable peak reduction becomes once that realistic loss is included.
What to learn next
- Electricity load forecasting — the demand forecast a real dispatch schedule would be built on.
- Optimization — the mathematics behind scheduling problems like this one, done properly.
- Modelling wildfire and flood risk — another area where forecasts feed directly into real operational decisions.
Researcher — Mathematics and papers.
Formal dispatch as optimisation
Battery dispatch is properly formulated as a constrained optimisation problem, typically solved as a linear or mixed-integer program over a rolling horizon:
minimize SUM_t cost(grid_draw_t)
subject to grid_draw_t = net_load_t + charge_t - discharge_t for all t
soc_t = soc_{t-1} + eta_c * charge_t - discharge_t / eta_d
0 <= soc_t <= capacity
0 <= charge_t <= max_rate, 0 <= discharge_t <= max_rateeta_c and eta_d are charge and discharge efficiencies (round-trip efficiency is eta_c * eta_d, commonly 0.80 to 0.90 for lithium-ion grid storage). cost() can be a simple peak-demand penalty (as in the developer example, implicitly), a real electricity price signal for arbitrage, or a weighted combination including a grid stability or emissions term.
Model Predictive Control for dispatch
Because forecasts of net_load_t are uncertain and improve as the horizon shortens, production dispatch systems commonly use Model Predictive Control: solve the optimisation over a forecast horizon (e.g. 24 to 48 hours), execute only the first step's decision, then re-solve at the next timestep with updated forecasts. This is the same rolling re-optimisation principle covered for robot control in PID control, and when to use it instead and, more directly, its Model Predictive Control extension.
Multiple revenue and service streams
Real grid batteries are dispatched against several objectives simultaneously, not peak shaving alone:
- Energy arbitrage. Charge when wholesale prices are low, discharge when high.
- Frequency regulation. Very fast (sub-second to few-second) charge/discharge adjustments to keep grid frequency within a tight band — the primary service Hornsdale Power Reserve was built for, and a service that rewards fast response over large capacity.
- Capacity/reserve markets. Being available as backup capacity, paid for availability whether or not it is called upon.
Co-optimising across these streams, given uncertain future prices and demand, is a genuinely harder stochastic optimisation problem than peak shaving alone, and is an active area of applied operations research.
Battery degradation modelling
Lithium-ion battery capacity fades with cycling, and fades faster under deep discharge, high charge/discharge rates, and elevated temperature. Realistic dispatch optimisation includes a degradation cost term, trading a small amount of immediate arbitrage or peak-shaving value against reduced battery lifespan. The developer example skips this, and treats the battery as an ideal, non-degrading resource, for simplicity.
Current state
Grid-scale battery deployment has grown rapidly worldwide over the past decade, and co-optimised, forecast-driven dispatch is increasingly standard practice at utilities and independent system operators with significant storage assets. Genuinely optimal dispatch under full uncertainty — imperfect forecasts, multiple competing revenue streams, degradation — remains computationally and practically difficult at scale. Most deployed systems use principled approximations instead, rolling MPC being the dominant one, rather than solving the fully stochastic problem exactly.
Key references
- Fares, R. L., Webber, M. E. (2017). A Flexible Model for Economic Operational Management of Grid Battery Energy Storage. Energy.
- California ISO. What the Duck Curve Tells Us About Managing a Green Grid. (2016, the original popularisation of the term.)
- Neubauer, J., Wood, E. (2014). The Impact of Range Anxiety and Home, Workplace, and Public Charging Infrastructure on Simulated Battery Electric Vehicle Lifetime Utility — representative of the degradation-modelling literature this field draws on.
What to learn next
- Optimization — the mathematical foundation for the constrained problem formulated above.
- Electricity load forecasting — the forecast layer this optimisation is built on top of.
- Modelling wildfire and flood risk — a related risk-management problem in the same operational environment.