ELAI S.r.l.

AI predicts sunshine: why can the battery fail to follow the plan?

An executed energy balance separates forecast, energy, power and efficiency: four hours reveal why a battery plan can be infeasible.

AI predicts sunshine: why can the battery fail to follow the plan?

An accurate forecast is not an executable command

A business wants solar surplus to supply later work. A model predicts production and demand accurately; the plan looks simple: charge when energy is spare and discharge when it is missing. Yet the battery may fill early or fail to deliver requested power. We ask why this can happen even without forecast error. Four synthetic hours expose stored energy, meter-side power, losses and limits, ending with a balance that can be reconstructed by hand.

Abstract. We study a discrete battery model with 5 kWh initially stored, 10 kWh nominal capacity, a 2–9 kWh operating interval and 3 kW charge/discharge limits. Four hourly net-surplus values are 3, 3, −3 and −4 kW, assumed perfectly known. With constant 90% efficiency in each direction, an unconstrained plan exceeds both energy and power limits. A feasible controller ends near 2.333 kWh, curtails 1.556 kWh of surplus and imports 1 kWh. These are teaching calculations, not battery measurements or economic-optimization results.

First distinction: energy and power

Power is the rate of energy transfer. A 3 kW load sustained for an hour uses 3 kWh; for half an hour it uses 1.5 kWh. Capacity in kWh describes how much energy can be stored, not how quickly it can be extracted. A battery with enough energy may fail to serve 4 kW if its electronics or control model allows only 3 kW. Better forecasts cannot fix this confusion: the decision model requests a different capability from the one allowed.

Let Δt be interval duration, one hour here. Powers are constant interval averages; our model cannot see within-interval peaks. Surplus s_t is generation minus demand at the electrical side supplying the load. Positive surplus permits attempted charging; negative surplus is a deficit. There is no photovoltaic or weather model: the four numbers are synthetic. Perfect knowledge isolates physical feasibility, not a claim that real forecasting is certain.

Model boundary and efficiency meaning

E_t is internal stored energy at interval t’s start, in kWh. P_c,t is power drawn for charging; P_d,t is useful power delivered, both nonnegative external-side kW. Efficiencies η_c and η_d are constant dimensionless numbers above zero and at most one. Charging with 1 external kWh adds η_c internal kWh; delivering 1 useful kWh removes 1/η_d internal kWh. Multiplication versus division matters: multiplying both incoming and outgoing energy by 90% would create energy in the balance.

E_(t+1) = E_t + η_c P_c,t Δt − P_d,t Δt / η_d 2 ≤ E_t ≤ 9 kWh; 0 ≤ P_c,t,P_d,t ≤ 3 kW; Δt = 1 h

The relation answers “how much energy remains after an hour?”. Multiplying power by hours gives kWh, matching E_t. Initially, 5 kWh plus 3 kW charging for an hour adds 0.9×3×1=2.7 kWh, reaching 7.7. Delivering 3 useful kWh instead removes 3/0.9≈3.333 internal kWh. Our model avoids simultaneous charging and discharging by selecting direction from surplus sign. It does not model every possible state of bidirectional converters.

Nominal capacity is 10 kWh, but the permitted interval is only 2–9, a 7 kWh usable energy window. These are example assumptions, not recommendations for a battery chemistry. E/10 expressed as a percentage is an energy fraction of nominal capacity, not unconditionally electrochemical state of charge based on electric charge. Voltage, temperature and available capacity can change that relationship. The model conserves energy; it does not describe cells, voltages, currents or degradation.

Two infeasible plans for different reasons

A first naive strategy follows the entire surplus and ignores losses: store 3 kWh, another 3, then deliver 3 and 4. Predicted energy is 5→8→11→8→4 kWh. The final value looks acceptable, but hour two reaches 11, above the 9 maximum. Hour four demands 4 kW, above the 3 limit. Checking only final energy hides both violations. Feasibility must hold at every interval, for power as well as energy.

Adding efficiency is insufficient if commands remain unchanged. The unconstrained but loss-aware plan yields approximately 5→7.7→10.4→7.067→2.622 kWh. Final energy is still within bounds, yet 10.4 exceeds 9 and final power remains 4 kW. We corrected accounting, not control. For AI-guided forecasts, accurately estimated inputs plus a mathematically correct balance do not guarantee the requested action sequence is allowed.

Constructing commands that respect limits

For positive s_t, charging is limited by available surplus, power rating and the amount that exactly fills remaining headroom. For negative s_t, discharge is limited by deficit, power rating and useful energy above minimum reserve. Take the smallest of the three bounds in the active direction. This is locally feasible control for our model, not proof of optimal self-consumption, profit or battery life. It uses no prices and does not anticipate future hours, even though inputs are known.

s_t ≥ 0: P_c,t = min(s_t, 3, (9 − E_t)/(η_c Δt)); P_d,t = 0 s_t < 0: P_d,t = min(−s_t, 3, (E_t − 2)η_d/Δt); P_c,t = 0

Read the third charge bound: 9−E_t is internal headroom in kWh. Dividing by η_c gives external energy needed to fill it; dividing by Δt gives kW. Discharge starts with internal energy above 2 kWh, multiplies by η_d for useful energy and divides by hours. All three minimum arguments therefore share units. Program assertions check energy window, maximum power and absence of simultaneous charging/discharging at each step.

Four hours without skipping steps

Hour one absorbs all available 3 kW from 5 kWh, reaching 7.7. Hour two has only 1.3 internal kWh of headroom. At efficiency0.9, it can absorb1.3/0.9≈1.444 external kWh, or1.444 average kW for an hour. Available3 kW cannot all be absorbed: headroom binds. About1.556 surplus kWh remain, recorded as curtailed rather than sold or redirected. That output’s meaning depends on the chosen system boundary.

Hour three has a3 kW deficit. From9 kWh it can be served within power and reserve limits: remove3/0.9≈3.333 kWh, leaving5.667. Hour four needs4 kW. Energy above reserve could provide about3.3 useful kWh, but the modeled converter can deliver only3 in an hour. Power now binds. Import the missing kWh and finish near2.333 kWh, above minimum. This is not insufficient total energy, but limited delivery rate.

HourSurplus kWCharge kWDischarge kWFinal E kWhImport kWh
13.0003.0000.0007.7000.000
23.0001.4440.0009.0000.000
3-3.0000.0003.0005.6670.000
4-4.0000.0003.0002.3331.000

Read the table with its assumptions, not as commercial performance. Row two reduces charging although surplus is unchanged; row four does not increase discharge although deficit grows. Those differences are the controller’s job. “Follow surplus” cannot produce them without state and limits. Comparison with infeasible plans proves no economic superiority: it separates an arithmetic trajectory from a sequence allowed by this model.

Where the apparently missing energy goes

Check the result by summing losses too. Charge loss is(1−η_c)P_cΔt. Discharge loss is(1/η_d−1)P_dΔt, the difference between internal energy removed and useful energy delivered. Across four hours these are about0.444 and0.667 kWh, totaling1.111. This is an aggregate model term: no distinction between cells, inverter, cables or auxiliaries was measured. Assigning it to a particular component would invent a result.

E_initial + Σ surplus_positive Δt + grid_import = E_final + Σ deficit_positive Δt + curtailed + losses 5 + 6 + 1 = 7/3 + 7 + 14/9 + 10/9 = 12 kWh

The left side collects initial reserve, net energy from positive-surplus hours and imports; the right collects final reserve, deficits supplied by battery or grid, curtailment and losses. Positive net surplus totals6 kWh and net deficits7: these are not total PV generation and consumption, because only their difference is modeled. Both sides equal12 kWh. This checks more than final energy: missing losses or double-counted flows would prevent closure.

With η_c=η_d=0.9 their product is0.81. An external energy packet charged then returned under identical efficiencies and no other effects yields81% useful output, not90%. Our sequence is not a closed cycle: it starts at5 and ends near2.333 kWh. Simply dividing total discharged by charged energy is distorted by spending initial reserve; it does not correctly measure round-trip efficiency.

Sensitivity with an interpretable threshold

Rerun with equal charge/discharge efficiencies, varying η from0.8 to1 at five values while holding surplus, limits and duration fixed. In this range hour two always reaches9 kWh. Delivering3 useful kWh in each final hour spends6/η internal kWh. Reserve above minimum is9−2=7, so6/η≤7 meansη≥6/7≈0.857143. Above this threshold reserve no longer limits the final3 kW discharge.

Atη=0.8, hour three leaves9−3/0.8=5.25 kWh. The final hour can remove only3.25 internal kWh, delivering2.6 useful kWh: imports rise to4−2.6=1.4 and final energy equals minimum2. Atη=0.9 the3 kW power bound is tighter than the energy bound, so imports are1 with reserve remaining. This explains potential model interventions: more power cannot fix insufficient energy, and more energy cannot overcome a fixed power limit.

Higher efficiency surprisingly increases early curtailment. Raising stored energy from5 to9 requires4/η external kWh:5 atη=0.8 but only4 atη=1. Of6 available,1 or2 remain. This does not make the less efficient battery better: it dissipates more and here imports more. One metric such as unabsorbed surplus cannot judge the system alone. Final reserve, losses, imports and delivered service must be read together.

Left: internal energy after each hour including initial state; dashed bounds at2 and9 kWh. Both unconstrained plans violate the maximum. Right: imports and curtailment versus equal efficienciesη on the synthetic case. Not hardware measurements or SAM outputs. Open to enlarge.
Left: internal energy after each hour including initial state; dashed bounds at2 and9 kWh. Both unconstrained plans violate the maximum. Right: imports and curtailment versus equal efficienciesη on the synthetic case. Not hardware measurements or SAM outputs. Open to enlarge.

What the controller proves and what it does not

Feasibility can be explained without trying every sequence. If E_t is within bounds and charging, headroom bound(9−E_t)/(η_cΔt) prevents overflow; energy rises so the lower limit is safe. If discharging, bound(E_t−2)η_d/Δt prevents removing more than available reserve; energy falls so the upper limit is safe. Starting from5, induction keeps all modeled states bounded. The proof depends on positive efficiencies, correct signs and no additional unmodeled dynamics.

This does not prove time-global optimality. Optimization could reserve energy for later, coordinate loads, allow export or use probabilistic forecasts. It would need an objective, all constraints and a terminal-horizon policy; otherwise emptying reserve at the end can create artificial gains. Our controller does not claim to solve that problem. It is a transparent baseline for comparing trajectories and identifying actions at least admissible under stated assumptions.

simulate visits each of four intervals once, updates state and records flows. For T intervals it performs O(T) updates; retaining all rows uses O(T) memory, or O(1) if keeping current state only. These are computational orders, not embedded-controller benchmarks. Assertions check bounds and local balance at every step. Inputs are deterministic, no seed applies, and JSON retains Python version, parameters, unconstrained cases and sensitivity.

Sources, physical limits and implications for AI

SAM’s primary Battery Dispatch FOM documentation distinguishes power targets, state limits and conversion losses, noting actual power may fall below target. It informs the meaning of constraints, not our numbers. We did not run SAM or reproduce its electrochemistry or automated dispatch. Example percentages and powers are our assumptions, not parameters for a commercial battery without specific data, documentation and validation.

A real plant needs allowed powers and voltages, load-dependent efficiencies, temperature, available capacity, battery-management constraints and auxiliary measurements. Hourly averages may hide unacceptable peaks; degradation may shrink usable headroom; forecast uncertainty may require different reserve. These are excluded phenomena, not observations from our experiment. An energy simulation proves neither installation safety, compliance nor economic value.

The opening answer is precise: forecasting sunshine is insufficient because a forecast describes availability, whereas control must choose actions compatible with state, losses and bounds at each modeled instant. Sunshine is perfectly known here, yet two plans fail; constrained control closes the balance and identifies imports and unabsorbed surplus. AI may inform forecasts and decisions but cannot erase these relationships. This exercise demonstrates no EL-AI storage product, installation or operational result.

System Advisor Model — Battery Dispatch FOM: state-of-charge limits, power targets and conversion losses; primary documentation accessed16 October2026.

from experiment import simulate
for eta in [.8,.9,1.]:
    result=simulate(eta=eta)
    print(eta,result['final_kWh'],result['grid_import_kWh'],result['curtailed_kWh'],result['loss_kWh'])

Code, data, and instructions · JSON. Educational calculations executed with Python 3.14.0; figures with Matplotlib 3.11.2. AI-assisted analysis, without claiming peer review or human review. Original illustrative ImageGen cover: it does not document EL-AI people, premises, or installations. Sources accessed 16 October 2026.