A simulator for dynamic electricity contracts (with some surprising results)

June 15, 2023

We have solar panels for over a decade now, producing more than we consume, so our current fixed price energy contract is most cost effective. But as our electric camper van will (hopefully) soon arrive, I wondered whether it would make sense to switch to a dynamic contract where the price for electricity varies per hour. To figure that out, I wrote a small energy simulator, to compute the expected electricity cost while varying certain parameters. The results were at times surprising!

Under a dynamic energy contract the price you pay for electricity varies per hour: it is high when electricity is scarce, low (and even negative) when electricity is abundant. In the Netherlands, several energy suppliers are starting to offer dynamic energy contracts. At 15:00, the hourly tariffs for the next day are published. For some you pay a surcharge for every kWh consumed or returned; for others you only pay the surcharge for net consumption in a year (like governmental energy taxes). As a result, it is hard to tell whether in a given situation it is beneficial to switch to a dynamic energy contract.

In particular if you have a home battery, or an electric vehicle with a battery that can also return power back to the grid. In theory such a battery could be used to make profit from daily price fluctuations. It is almost like trading on the stock market with insider knowledge: you know the energy prices for the next couple of hours in advance.

I wrote a energy small simulator to experiment with this. It computes the annual cost using information about the hourly tariffs of the last few years. It allows you to specify annual solar production, household consumption, electric vehicle usage and battery capacity. It also allows you to specify surcharges and taxes, as well as the tariff-year to simulate. During the simulation it takes average monthly/hourly fluctuations in solar production and energy consumption into account. Details on the options and how it works can be found on the repository.

Some sanity checks

First some sanity checks (using a ‘phoney’ flat rate table containing an hourly rate of 10 cent per kWh, that can be selected by specifying the year 1984):

  • ./ecsim -c 1000 -y 1984 -s 0 returns € 0.99 (before taxes and VAT) as expected (1000 × 0.01 = 10, and surcharges are 0).

  • ./ecsim -z 1000 -c 1000 -y 1984 -s 0 returns € 0 as expected (production and consumption cancel each other out using a flat tariff, when surcharges are 0). As we will see later, if surcharges are not 0, there is a cost even if production and consumption cancel each other.

  • ./ecsim -b 45 -y 1984 returns € 0 as expected (using battery when the fee is completely flat gains you nothing).

Initial results without battery

Some (perhaps surprising) results. (All using a look ahead of 33 hours, average hourly tariffs, a surcharge of 2 cents, 15 cent energy tax and 21% VAT and solar panels oriented south, unless otherwise specified.)

A household consuming 2500 kWh electricity per year, would have paid - € 656,16 in 2019 (./ecsim -c 2500 -y 2019) - € 876,23 in 2021 (./ecsim -c 2500 -y 2021) - € 1302,18 in 2022 (./ecsim -c 2500 -y 2022) without any solar panels. We clearly see the stark energy price hike in 2021 and 2022.

With solar panels producing 2000 kWH, the household would have paid € 183,41 in 2019, € 281,97 in 2021 and € 336,85 in 2022 (./ecsim -z 2000 -c 2500 -y YEAR) .

What if the solar production equals household consumption, e.g. both equal to 2500 kHW. First (small) surprise, it is not actually 0:

  • € 73,18 for 2019 (./ecsim -z 2500 -c 2500 -y 2019)
  • € 103,48 for 2022 (./ecsim -z 2500 -c 2500 -y 2022)

Why? Easy! If you pay dynamically, you consume more energy than your solar panels produce when electricity is more expensive than when your solar panels produce more than you need. Also, in the standard settings for the simulator, a small 2 cents surcharge is levied for every kWh consumed or produced.

But even if this surcharge is 0 the cost is still € 37,50 for 2022 (./ecsim -s 0 -z 2500 -c 2500 -y 2022)

In other words, as long as the Dutch ‘salderingsregeling’ (the rule that the full annual production of solar energy is subtracted from the full annual household consumption, before the cost is computed over the difference), dynamic pricing is not cost effective if the solar production is smaller than or equal to the household power consumption.

However, if the solar production exceeds the household consumption significantly, dynamic pricing becomes interesting again for the simple reason that energy suppliers offer only a marginal amount (as low as 5 cents per kWh) for solar energy produced under a fixed contract. For example, when returning an additional 2500 kWh in 2022, one could expect to receive € 495,07 (./ecsim -z 5000 -c 2500 -y 2022) compared to € 125 under a fixed 5 cents tariff (./ecsim -z 5000 -c 2500 -y 2022 -f)

This is in line with observations from others.

Results with battery

The results become much more interesting when using a battery.

Suppose you only attach a battery to the grid, without producing or consuming anything?

  • A 20 kWh battery would have earned you € 7,27 in 2019 (./ecsim -b 20 -y 2019). Meh.
  • A 20 kWh battery would have earned you € 1545,95 in 2022 (./ecsim -b 20 -y 2022). Wow!

Why is this? Well, in 2019 there wasn’t a lot of price fluctuation, but in 2022 there sure was!

What if we increase the battery size?

  • A 45 kWh battery would have earned you € 2668,79 in 2022 (./ecsim -b 45 -y 2022). Even better.

The profit does not double compared to the 20 kWh battery, partially because the maximum charge per hour (the -m option, default 11 kWh) limits possibilities.

The surcharge (that is always levied for every kWh consumed or produced) also has a significant impact. The figures above are based on a surcharge of 2 cents. What if the surcharge is 0?

  • A 45 kWh battery would have earned you € 3800,34 in 2022 in that case (./ecsim -b 45 -y 2022 -s 0).
  • But a 0 cent surcharge is even more significant in years with less volatile pricing. Even in 2019, a 45 kWh would have earned you € 488,30 in that case (./ecsim -b 45 -y 2019 -s 0)

Electric vehicle

Suppose you have an electric vehicle with a battery. Does it pay to install more solar panels to cover the increased electricity consumption?

Let us assume an electric vehicle with a 77 kWh battery running 5,5 km per kWh. Driving an average of 25000 km a year means roughly 4550 kWh additional electricity use per year.

According to the simulator, if we have 3000 kWh solar production and consume 2500 kWh in the house, it would have ‘cost’ us € -532,07 (./ecsim -c 2500 -z 3000 -v 4550 -b 77 -y 2022) in 2022 to drive the vehicle.

Without a car and its battery (./ecsim -c 2500 -z 3000 -y 2022) the same house plus solar production would have ‘cost’ us € -31,48.

Yet under a fixed electricity pricing scheme (at 20 cents per kWh without taxes), driving the same car for the same distance would have really cost € 1715,17 in 2020 (i.e. almost € 2250 more!)


What can we conclude from all this?

  1. If you have solar panels, dynamic pricing only makes sense if you have a significant over-production.
  2. Otherwise, if you do not have a battery, dynamic pricing doesn’t make much sense.
  3. The larger the battery and the larger the price volatility, the larger your profit. This uses the fact that you can trade with advance knowledge of the future prices up to tomorrow. Profits are significant.
  4. When driving an electric vehicle, especially one where the car has a battery that can return electricity to the grid, dynamic pricing makes sense.
  5. The surcharge matters! Shop for supplier with lowest surcharge.
In case you spot any errors on this page, please notify me!
Or, leave a comment.