GithubHelp home page GithubHelp logo

tfranssen / dynamic-ess Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 2.0 163 KB

Functional prototype for dynamically control Victron Energy ESS systems based on current energy tariffs and other external sources.

Python 100.00%
ess victronenergy day-ahead-pricing

dynamic-ess's Introduction

dynamic ess - Tariff based ESS controller

Disclaimer

Work in progres.

Purpose

The goal of this project is to develop a feature for Victron Energy to take into account the dynamic tariff prices in the decision to store energy or to return energy to the grid. These dynamic tariff prices are nowadays offered by various energy providers (Easy Energy, ANWB, TIBR, and others) and are always announced a day in advance (also known as the day-ahead pricing model). The feature will control the grid setpoint as its main output. The goal is to implement this feature in VRM, the controller should run externally on PC, Raspberry Pi, or VPS.

To do

  • Retrieve prices from multiple energy providers:
    • ANWB (done)
    • ENTSOE API (done)
    • Easy Energy
    • TIBR
  • Plot chart (done)
  • ADD MQTT functionality through VRM (done)
  • Implement multiple charge scenarios
    • Simple charge when prices are X% lower then average (done)
    • Simple charge when prices are X% lower then average, discharge when prices are X% higher then average (done)
    • Always charge in X lowest tariff hours. (In this cases prices will be sorted in ascending order, first X hours will be used for charging) (done)
    • Above scenarios including PV forecast. SoC will be lower in the morning so there is capacity left for PV charging.
  • Rewrite script as service
  • Add SoC limits for charge and discharge
  • Implement logging (done)
  • Implement scheduler (done)
  • Implement PV forecast (done)

PV Features

  • Import forecast (done)
  • Include forecast in plot (done)
  • Determine max SoC so there is capacity for PV energy

Install

  1. Clone GIT project on a machine with Python 3 installed git clone https://github.com/tfranssen/dynamic-ess/
  2. Move in directory cd dynamic-ess/

Install in virtual environment (recommended)

  1. Clone GIT project on a machine with Python 3 installed git clone https://github.com/tfranssen/dynamic-ess/
  2. Move in directory cd dynamic-ess/
  3. Make new virtual environment python3 -m venv .venvDESS
  4. Activate the virtual environment source .venvDESS/bin/activate
  5. Install dependencies pip3 install -r requirements.txt

I run the script at a Digital Ocean VPS on Ubuntu 22.04

Config

  1. Configure secret.py (for examply by using nano secret.py)
  2. Configure settings in script as described below

Run

  • Run script: python3 ESSController.py
  • Run in background: nohup python3 -u ./ESSController.py >> output.log &

Kill process

  • Run ps -fA | grep python and search for your proces
  • Kill proces with kill <<<PROCES NR>>>

Logging

  • Follow the log file by using tail log.log -f -n 50
  • -n 50 is the number of visible rows
  • -f is to follow the log file

Settings

  • lowChargeLimit this is the threshold used to start charging. Default = 0.8, charging starts in this case 20% below daily average
  • highThreshold = Constant to set the high threshold for selling. Default =1.2. Only used in Mode 2
  • chargeHours = Number of hours to charge during the cheapest hours. Only used in Mode 3
  • dateToday If 1, date is today, if 0 date is tomorrow, for testing only. Default is 1
  • tz Time zone, default is: "Europe/Amsterdam"
  • plotImage If 1 an image is plotted to show when charging will start
  • defaultGridSetpoint Default grid point (Watt). Default setting is 30
  • chargingGridSetpoint Charging grid point (Watt). Default setting is 3000
  • provider This selects the energy provider. 0 = ANWB, 1 = ENTSOE
  • PV enables PV features. If PV = 1, PV Aware charging is enabled. PV = 0 is off
  • locLat Latitude of PV installation
  • locLong Longitude of PV installation
  • angle Angle of your panels 0 (horizontal) … 90 (vertical)
  • direction Plane azimuth, -180 … 180 (-180 = north, -90 = east, 0 = south, 90 = west, 180 = north)
  • totPower Installed modules power in kilo watt

Modes

  • 1 = Charge when current price < X average price
  • 2 = Charge when current price < X average price, discharge when price > X average price
  • 3 = Charge during cheapest x hours

ENTSO-e API Access

You need an ENTSO-e Restful API key if you want to collect the data from ENTSO-e. To request this API key, register on the Transparency Platform https://transparency.entsoe.eu/ and send an email to [email protected] with Restful API access in the subject line. Indicate the email address you entered during registration in the email body.

Schedule

  • Get prices is scheduled every day at 00:00:05.
  • The ESS controller is scheduled every 5 minutes. If the charge requirement did change an MQTT message will be published. Otherwise nothing will happen.

Typical log file

In the log below you can see in this case charging started just after 22:00. At 00:00:05 new prices were retrieved and charging stopped just after 06:00

[I 221214 22:04:09 chargeWithoutPV:50] Broker connected.
[I 221214 22:04:10 chargeWithoutPV:167] Current price is €0.38. The average price today is €0.48. This is lower then 0.8* daily average so the battery is now charging.
[I 221214 22:04:10 chargeWithoutPV:56] Message Published.
[...]
[I 221215 00:00:06 chargeWithoutPV:121] Now prices retrieved for today
[I 221215 00:00:06 chargeWithoutPV:122] Average price is: €0.42
[I 221215 00:00:06 chargeWithoutPV:141] New plot created and saved. Filename: plot-20221215.png
[...]
[I 221215 06:04:40 chargeWithoutPV:153] Requirement has changed, sending MQTT message to change setpoint.
[I 221215 06:04:40 chargeWithoutPV:173] Current price is €0.35. The average price today is €0.42. This is not low enough to start charging. 
[I 221215 06:04:40 chargeWithoutPV:56] Message Published.

dynamic-ess's People

Contributors

tfranssen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dynamic-ess's Issues

Solar Forecast calculation to high

In the today system overview screen on vrm solar forecasting is recently added. To values: forecasted and Total. Forecasted is changed hourly. Solar value changes every view seconds. Adding Forecasted to Solar Value results in Total. And this to high after a few minutes, because solar value has grown, and forecasted is not decreased.
Venus version is 3.01. victron-dynamic-ess has version 0.0.43

Handle EDF Tempo tarif

In france we have a special tarif scheme: EDF tempo.
Each days have 2 tarifs : HP (day time), HC (night time). HC is pretty cheap (cheaper than day).
We have 3 colors, from cheapest to highest:

  • Blue : 300 day a year
  • White : 43 day a year
  • Rad : 22 day a year
    We can have the color of next day (starting usually a 6:00 am) at 11:00am on the website. Dynamic ESS should take care of that to :
  • Charge battery on night (HC)
  • Use ESS Mode battery life on Blues days (or if needed on white days)
  • Use Battery the whole day on Red days (on these day the kWh is around 0,73€/kWh).

Calendar is : https://particulier.edf.fr/fr/accueil/gestion-contrat/options/tempo.html#/
You can see the current days and past days...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.