Solar and battery backtest on day-ahead prices

Backtest solar panels and a battery on real day-ahead prices.

  • Household: what solar, a battery, or both take off your bill on a dynamic or a fixed tariff, each with its payback. The battery charges from the grid or your panels and discharges only into your own consumption, never to the grid. Part of your load can also move to cheap hours.
  • Wholesale: buy and sell at spot, optionally next to a solar plant whose output the battery can store instead of selling.
  • Plans compared, in both modes: a daily rolling plan made at the decision time (13:00 by default; covers the rest of today plus tomorrow, with leftover energy valued from past prices), a 24-hour plan made at midnight, and perfect foresight.

Every plan is a linear program solved with HiGHS in your browser.

Use case

Period

Prices

Day-ahead prices download when you run the backtest.

Consumption

Monthly pattern

Consumption per month, kWh: drag a bar up or down (row under the months = kWh a day vs. the yearly average)

3500 kWh a year, 9.6 kWh a day on average. Highest: Dec, 12.0 kWh a day (1.25× the average). Lowest: Jun, 7.6 kWh a day (0.80×). Dec uses 1.57× as much per day as Jun.

Daily pattern

Relative power per hour: drag a point of the selected season and day up or down

Shifted consumption moves like a device run: the same kW leave the day's dearest stretch and run in its cheapest one, e.g. a dishwasher, washing machine or car charging you can time.

Tariff

Retail price per quarter-hour = (spot + fees) × (1 + VAT).

Details

Default 13.67 = grid fee 7.0 (a typical value; it differs by network operator) + 2026 levies and electricity tax 6.67; take the exact grid fee from your network operator. It hardly moves the savings, because you pay it on charging and save it on discharging; only the losses carry it.

Prices paid and received

Grid fees, levies and supplier margin go into the buy adder. Zero for both is the pure wholesale case.

Solar

Enter kWp and find your address to add solar.

Details

The address goes to OpenStreetMap Nominatim; only the coordinates rounded to 0.1° go to PVGIS and Open-Meteo. PVGIS gives the long-run yield (south-facing, optimal tilt, 14 % losses); Open-Meteo's hourly sun on the panel for each past day decides which days and hours are sunny, scaled so the period yields what PVGIS expects. Weather is model data on a grid of a few tens of km: it gets sunny and cloudy days right, not each passing cloud. Surplus PV is exported at the feed-in tariff, also at negative prices. A battery charges from PV or the grid and discharges only into your own consumption. PV data: PVGIS © European Union; weather: Open-Meteo.com (CC BY 4.0); geocoding © OpenStreetMap contributors.

Battery

Wear cost 0.088 € per kWh out (price ÷ cycles ÷ capacity delivered per cycle). Clear the capacity to see the bill without a battery.

Plan

Min SoC 0 is cheapest: usable capacity already leaves out the cell reserve. Set 10–20 % only to keep backup power for outages.

Method

  • Rolling plan: day 1 is planned at 00:00 for day 1 only. After that, each day at the decision time the plan covers the rest of that day plus all of the next day, using the prices known by then, and runs until the next decision. The 24-hour plan re-solves at 00:00 for that day only. Perfect foresight is one LP over the whole period, the upper bound.
  • Value of leftover energy: for each month, the extra savings over the next two days from ending a plan with more energy stored, averaged over historical days of that month. It is scaled down by the factor α that earns most on that history, because the fit sees two days ahead.
  • The assumed profile scales the weekday, Saturday and Sunday shapes so that each month adds up to its kWh (on the 2026 calendar). Public holidays count as weekdays. The default shapes are an approximation in the spirit of the BDEW H0 standard profile, not the official table.
  • Load shifting (optional): the chosen share of each day's consumption moves like a device run, from that day's dearest stretch to its cheapest, with the same kW (at most the given device power), before the battery plans. Shifted load already sits in cheap hours, so it leaves the battery less to gain.
  • Times are Europe/Berlin. Partial first and last days are dropped.

Methodology: full model, equations and limitations.