victronenergy / dynamic-ess

MIT License
76 stars 5 forks source link

Provide pricing information for more countries #2

Closed idstein closed 1 year ago

idstein commented 1 year ago

I've been closely monitoring this development and we do plan to implement a dynamic ESS for Germany. Currently, I can only call the API using country=NL, but I would really like to use EPEX Spot pricing for Germany to optimise the ESS system.

Is it possible to deploy a local backend service? We already have locally a home assistant solution running, recording all power consumption, pv production and running a PV forecast (via pvlib or solcast).

dirkjanfaber commented 1 year ago

VRM fetches the day ahead pricing from Entso.eu. Which contains data from all (most?) European countries. The dropdown also shows all supported countries (including Germany).

Running the whole setup pure locally is not something that has been looked into yet.

idstein commented 1 year ago

A simple test failed for me. Running the following yields a result only, if country=NL:

curl -vvv -X GET -G \
--url https://vrm-dynamic-ess-api.victronenergy.com \
-d site_id=XXXX \
-d b_max=14.5152 \
-d tb_max=3.36 \
-d fb_max=4.2 \
-d tg_max=15 \
-d fg_max=28.4 \
-d p_offset=0 \
-d b_cost=0.08 \
-d long=8.86429 \
-d lat=49.7205 \
-d country=NL \
--header 'X-Authorization: Token XXXX' \
--header 'Accept: application/json' \
--user-agent 'dynamic-ess'

Using de fails with the error:

{"detail":"Could not get energy prices"}% 
dirkjanfaber commented 1 year ago

On https://transparency.entsoe.eu/transmission-domain/r2/dayAheadPrices/show there is no info on dynamic pricing. If I understand the naming correctly it is only available for the German speaking part of Luxembourg.

I am only familiar with the Dutch market, but do you have the possibility to have hourly tariffs in Germany? Which provider is that? In NL several providers offer an energy contract that has tariffs that change every hour.

image

idstein commented 1 year ago

Luxembourg and Germany share a market region. So there is only a single dynamic price feed for both.

For Germany there are dynamic day-ahead prices commonly used for larger feed-in installations (e.g. PV on farms). But also small PV installations are able to feed-in to the grid by dynamic day-ahead prices. There exist a couple of tariffs for dynamic prices among others Tibber, Awattar and Voltego for small households. For larger business everyone basically has to apply for a dynamic business tariff that is based on the day-ahead prices plus a fixed rate determined by peak power consumption / feed-in in kW.

My use-case for dynamic ESS is based on shifting generated PV into higher priced feed-in times. For consumption I have a fixed tariff, but would also like to switch once the overall logic is working to optimised the cost-profit function.

I'm not familiar with entsoe APIs, but by selecting DE+LU the data is shown. Likely, entsoe has some old market regions that combined DE+AT+LU or CH+DE+SK?

image
dirkjanfaber commented 1 year ago

Entsoe provides the day ahead pricing on which all of the individual energy providers are basing their tariffs. The difference between providers is the amount of cents they add as margin per kWh.

But your case is interesting; currently we only have Dutch testers using the system. I'll see if I can figure out why the German data is not showing.

idstein commented 1 year ago

Entsoe provides the day ahead pricing on which all of the individual energy providers are basing their tariffs. The difference between providers is the amount of cents they add as margin per kWh.

That sounds all about the same as for Germany with regards to the dynamic tariffs offered so far. There's also a policy in place to enforce providing such a tariff by every larger energy providers or DSOs by 2025.

dirkjanfaber commented 1 year ago

After talking to our backend developer, I can confirm that you are correct and that other countries have not been implemented (yet). This has to do with checking and configuring how the tax system works, what the provider fee is and such. Which is likely to be slightly different for each country. If you can help out finding the required info (which I'll ask to be added to this issue), Germany can be the next functional country.

idstein commented 1 year ago

For feed-in energy there are mainly 3 available concepts in Germany (A) fixed tariff per kWh / EEG (B) day ahead spot price EPEX (minus a fixed or profit share percentage) or (C) custom contracts with an energy broker.

For grid consumption a different tariff from the market is chosen. This is often a fixed price tariff (currently 30-40+ act / kWh) with a monthly baseline fee. Consumers with more than 100 MWh per year are often in a dynamic tariff that is often influenced by spot price and a fixed monthly fee relative to the peak power consumption.

Taxation is for feed-in often not relevant (starts with 30+ kWp installations) for prosumers.

In case you require more information write me ;)

An example taken from a dynamic energy provider for a consumption tariff:

(A) fixed monthly fee

(B) per consumed kWh base EPEX Spot DE day-ahead price, e.g. 10 ct / kWh

PoolsideKelbi commented 1 year ago

Hey @idstein thanks for the detailed example of how the dynamic pricing is calculated in Germany. I did have a question about it though: Looking at the simplified formula, which one of those factors are stable for the whole country and which ones would be dependant on the user/installation?

idstein commented 1 year ago

Stale for the whole country would be spot price only, contributions/levy/taxes (except for a few hundred of the most energy hungry companies in Germany, but out of scope here) and VAT. DSO working price depends on your location and who owns the distribution network. As stated this only applies to grid consumption. For feed-in it is either a fixed rate, or spot + a fractional or fixed fee or EPP with custom agreements.

PoolsideKelbi commented 1 year ago

Alrighty, thanks for the timely answer!

If we look back at the formula of: (Spot price (1 + energy provider profit share) + DSO working price + Contributions/Levy/Taxes) (1 + VAT)

It seems to me that the only percentage based additions here are "energy provider profit share" and VAT, the rest are all fixed fees that can be added up before VAT and after the provider fee. Just to double confirm, is this a generalisable formula for most dynamic energy contracts in Germany?

idstein commented 1 year ago

Unfortunately, not true. Some use the formula mentioned (e.g. Awattar), but others (e.g. Voltego) use a fixed add-on fee per kWh.

So (A) e.g. Awattar (Spot price (1 + energy provider profit share) + DSO working price + Contributions/Levy/Taxes) (1 + VAT)

or (B) e.g. Voltego (Spot price + energy provider profit share in ct / kWh + DSO working price + Contributions/Levy/Taxes) * (1 + VAT)

dirkjanfaber commented 1 year ago

After some discussions with the API developer, we agreed that allowing the user to fill out his/her own formula for buy and sell prices will be the quickest way to accomplish adding new countries. At a later stage we might be able to convert all different formula's back to a single one.

dirkjanfaber commented 1 year ago

The updated version supports entering formula's. Also other countries are being downloaded on the VRM side. So I guess this issue can be closed now. Please create a new one when needed.

idstein commented 1 year ago

Quick question for clarification, is it also possible to provide a fixed price formula?

In my case feed-in is dynamic, but buying price is fixed.

dirkjanfaber commented 1 year ago

I suppose you can leave the p out in the formula.

PoolsideKelbi commented 1 year ago

@idstein, you can indeed leave out the p out of the formula and put the fixed price in. That means the price for consumption will be the same throughout the day.

idstein commented 1 year ago

@idstein, you can indeed leave out the p out of the formula and put the fixed price in. That means the price for consumption will be the same throughout the day.

Yes it worked for me finally using p*0+0.405 for a fixed price of 40,5 ct/kWh. Without p the API replied with an error.

dirkjanfaber commented 1 year ago

Since this morning the p is no longer compulsory in the equation. So 0.405 should work too.