Difference between revisions of "PowerLight"

From RevSpace
Jump to navigation Jump to search
(Backend)
(T-Display)
(46 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
  |Picture=PowerLight.jpg
 
  |Picture=PowerLight.jpg
 
  |Omschrijving=Show energy mix of dutch power generation as a pie chart on a LED ring
 
  |Omschrijving=Show energy mix of dutch power generation as a pie chart on a LED ring
  |Status=In progress
+
  |Status=Completed
 
  |Contact=bertrik
 
  |Contact=bertrik
 
}}
 
}}
  
 
== The concept ==
 
== The concept ==
Draw the current power generation-mix as a kind of pie chart on a LED ring light, with colors representing a fraction of a specific power generation source.
+
Draw the current dutch electrical power generation-mix as pie chart on a LED ring light, with colors representing fractions of a specific power generation source.
  
 
For example:
 
For example:
* blue: wind power
+
* yellow: solar
* yellow: solar power
+
* blue: wind
* green: power from biomass
+
* red: fossil
* purple: power from nuclear
+
* green: nuclear
* red: fossil + other
+
* grey: other/waste
  
 
== Power generation data ==
 
== Power generation data ==
This is a bit of a problem. There is no open data available with reasonably complete power generation fractions!
+
Information about energy in Europe is collected at the european organisation https://www.entsoe.eu/ .
 +
The section about electrical energy is collected in ENTSO-E.
 +
Data is available from this platform at a 15-minute interval.
 +
 
 +
TenneT is the organisation that supplies ENTSO-E with data from the Netherlands.
 +
 
 +
Information about ENTSO-E generation domain API:
 +
https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html#_generation_domain
 +
 
 +
Also possibly interesting (requires an API key), but might actually just use the entso-e data:
 +
https://static.electricitymap.org/api/docs/index.html#introduction
 +
 
 +
==== Power generation categories ====
 +
The backend uses the following categories
 +
 
 +
ENTSO-E numbers the production types from B01 to B20 ("PsrType"), how these are filled for the netherlands:
 +
* B01 (biomass): always 0, not useful
 +
* B02: not available
 +
* B03: not available
 +
* <b>B04 (fossil hard coal): useful</b>
 +
* <b>B05 (fossil gas): useful</b>
 +
* B06: not available
 +
* B07: not available
 +
* B08: not available
 +
* B09 (geothermal): not available
 +
* B10 (hydro): not available
 +
* B11 (hydro): always 0
 +
* B12 (hydro): not available
 +
* B13 (marine): not available
 +
* <b>B14 (nuclear): useful</b>
 +
* B15 (other renewable): not available
 +
* B16 (solar): hugely underreported, *not* useful
 +
* <b>B17 (waste): useful</b>
 +
* <b>B18 (wind offshore): useful</b>
 +
* <b>B19 (wind onshore): useful</b>
 +
* <b>B20 (other): useful</b>
  
 
==== The solar power problem ====
 
==== The solar power problem ====
In particular the solar power fraction is incomplete, see also:
+
In particular the solar power fraction is incomplete, but also the biomass figures are missing. See:
* https://berthub.eu/articles/posts/dutch-electrical-power-figures-2/ (text)
+
* https://berthub.eu/articles/posts/dutch-electrical-power-figures-2/ provides a nice overview of the current situation about dutch electrical power generation data
* https://energy-charts.info/charts/energy_pie/chart.htm?l=en&c=NL note how the solar part is tiny
+
* https://energy-charts.info/charts/energy_pie/chart.htm?l=en&c=NL note how the solar part is tiny, even during the day
 +
 
 +
There is a model that estimates the solar fraction, also at a regional level, at https://api.netanders.io/, however use of this model requires a paid subscription.
  
There is a model to estimate this fraction at https://api.netanders.io/, however you cannot use this API without a key (and you can't just get a key).
+
What I'm currently doing for the solar fraction, is to use the ENTSO-E <b>forecast</b> instead of the actual solar numbers reported to them, see
 +
[https://transparency.entsoe.eu/generation/r2/dayAheadGenerationForecastWindAndSolar/show?name=&defaultValue=false&viewType=GRAPH&areaType=CTY&atch=false&dateTime.dateTime=11.07.2022+00:00|CET|DAYTIMERANGE&dateTime.endDateTime=11.07.2022+00:00|CET|DAYTIMERANGE&area.values=CTY|10YNL----------L!CTY|10YNL----------L&productionType.values=B16&processType.values=A18&processType.values=A01&processType.values=A40&dateTime.timezone=CET_CEST&dateTime.timezone_input=CET+(UTC+1)+/+CEST+(UTC+2) yesterday's wind/solar forecast].
 +
Perhaps this can also be done for the wind fraction.
 +
 
 +
==== Data schedule ====
 +
Entso-E provides data with a resolution of 15 minutes.
 +
It appears to become available about 5m20s after the start of each 15 minute period (:00, :15, :30, :45).
 +
At that point, the most recent data is from an interval that ended 30 minutes ago.
 +
So, including the 5m20s minute processing delay, the most recent data available is about 35 minutes old.
  
 
== Hardware ==
 
== Hardware ==
Line 35: Line 80:
 
== Software ==
 
== Software ==
 
The software consists of two parts:
 
The software consists of two parts:
* backend part that collects the power generation data
+
* The backend part that collects the power generation data, written in Java, running on a VPS
* light part that visualizes the power generation as fractions on a LED ring
+
* The light part that visualizes the power generation as fractions on a LED ring, running on an Arduino
  
 
=== Backend ===
 
=== Backend ===
To be implemented, this will probably run on my web page stofradar.nl.
+
Source code: https://github.com/bertrik/energymix-server
Some REST-like resource like http://stofradar.nl:9001/power/latest
+
 
 +
Runs as a REST-like resource at:
 +
* http://stofradar.nl:9001/electricity/generation with details about the current (35-50 minute ago) energy generation mix
 +
* http://stofradar.nl:9001/electricity/price with day-ahead hourly price-per-MWh for today
 +
(1-minute rate limit)
  
 
Returns a JSON-structure like:
 
Returns a JSON-structure like:
 
<pre>
 
<pre>
 
{
 
{
   "time": 1656490664,
+
   "time": 1657057500,
   "total": 1600,
+
   "total": 9122,
   "energymix": [
+
   "mix": [
     { "id": "solar", "name": "Solar power", "percent": 40, "color": "#FFFF00"},
+
     { "id": "solar", "power": 0, "color": "#FFFF00"},
     { "id": "wind", "name": "Wind power", "percent": 25, "color": "#0000FF"},
+
     { "id": "wind", "power": 4, "color": "#0000FF"},
     { "id": "fossil", "name": "Fossil (gas+coal)", "percent": 25, "color": "#FF0000"},
+
     { "id": "fossil", "power": 86, "color": "#FF0000"},
     { "id": "biomass", "name": "Biomass", "percent": 5, "color": "#00FF00"},
+
     { "id": "nuclear", "power": 5, "color": "#FF00FF"},
     { "id": "nuclear", "name": "Nuclear power", "percent": 5, "color": "#FF00FF"}
+
    { "id": "other", "power": 4, "color": "#444444"},
 +
     { "id": "waste", "power": 1, "color": "#444444"}
 
   ]
 
   ]
 
}
 
}
 
</pre>
 
</pre>
  
* time is a unix time stamp in seconds, representing the end of the period that the power figures refer to
+
* time is a unix time stamp in seconds, representing the end of the 15-minute period that the power figures refer to
* total is the total current electrical power usage, suitable for display (inside the ring for example), unit yet to be determined
+
* total is the total most recent electrical power (megawatt), suitable for display (on a numeric display inside the ring for example)
* energymix is an array of percentages along with their colors, to be displayed clockwise on the led ring, mandatory fields
+
* energymix is an array of power sources, each with:
** percent
+
** a short unique id
** color
+
** most recent known power (megawatt)
 +
** hex color, for display on the led ring
 +
 
 +
Energy generation sources are calculated from sources as follows, mostly from document A75:
 +
* solar = B16 (from the forecast document A69)
 +
* wind = B18 + B19
 +
* fossil = B04 + B05
 +
* nuclear = B14
 +
* waste = B17
 +
* other = B20
 +
 
 +
=== Arduino ===
 +
 
 +
==== Powerlight ====
 +
Shows the dutch energy generation mix by source. 
 +
Source code: https://github.com/bertrik/PowerLight
 +
 
 +
The Arduino sketch polls the REST API using HTTP every minute.
 +
 
 +
WiFi is managed by WifiManager. LEDs are controlled using FastLED. JSON content is parsed using ArduinoJSON.
 +
 
 +
==== ElectricityPrice ====
 +
Shows the current dutch electricity price, based on the day-ahead prices from yesterday.
 +
Source code: https://github.com/bertrik/ElectricityPrice
 +
 
 +
The Arduino sketch polls the REST price API using HTTP every 5 minutes.
 +
WiFi is managed by WifiManager. JSON content is parsed using ArduinoJSON.
 +
 
 +
Hardware is an ESP8266 controlling a 7-segment display based on a TM1637, on pins D3 and D4.
 +
 
 +
===== T-Display =====
 +
[[File:Nlecprice_mockup.png|right]]
 +
 
 +
Alternative: use a TTGO ESP32 T-Display.
 +
 
 +
It has a 240x135 pixel display.
 +
Plan is to show a kind of bar graph with 24 bars (one bar for each hour), each bar's height indicates the price of that hour.
 +
The background color shows green/black/red, to indicate cheap/moderate/expensive.
 +
Current price is shown as a big number.
  
=== Light ===
+
Each bar is therefore 10 pixels wide, 9 pixels for the bar + 1 pixel separation.
Sources: https://github.com/bertrik/PowerLight
 

Revision as of 17:18, 14 August 2022

Project PowerLight
PowerLight.jpg
Show energy mix of dutch power generation as a pie chart on a LED ring
Status Completed
Contact bertrik
Last Update 2022-08-14

The concept

Draw the current dutch electrical power generation-mix as pie chart on a LED ring light, with colors representing fractions of a specific power generation source.

For example:

  • yellow: solar
  • blue: wind
  • red: fossil
  • green: nuclear
  • grey: other/waste

Power generation data

Information about energy in Europe is collected at the european organisation https://www.entsoe.eu/ . The section about electrical energy is collected in ENTSO-E. Data is available from this platform at a 15-minute interval.

TenneT is the organisation that supplies ENTSO-E with data from the Netherlands.

Information about ENTSO-E generation domain API: https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html#_generation_domain

Also possibly interesting (requires an API key), but might actually just use the entso-e data: https://static.electricitymap.org/api/docs/index.html#introduction

Power generation categories

The backend uses the following categories

ENTSO-E numbers the production types from B01 to B20 ("PsrType"), how these are filled for the netherlands:

  • B01 (biomass): always 0, not useful
  • B02: not available
  • B03: not available
  • B04 (fossil hard coal): useful
  • B05 (fossil gas): useful
  • B06: not available
  • B07: not available
  • B08: not available
  • B09 (geothermal): not available
  • B10 (hydro): not available
  • B11 (hydro): always 0
  • B12 (hydro): not available
  • B13 (marine): not available
  • B14 (nuclear): useful
  • B15 (other renewable): not available
  • B16 (solar): hugely underreported, *not* useful
  • B17 (waste): useful
  • B18 (wind offshore): useful
  • B19 (wind onshore): useful
  • B20 (other): useful

The solar power problem

In particular the solar power fraction is incomplete, but also the biomass figures are missing. See:

There is a model that estimates the solar fraction, also at a regional level, at https://api.netanders.io/, however use of this model requires a paid subscription.

What I'm currently doing for the solar fraction, is to use the ENTSO-E forecast instead of the actual solar numbers reported to them, see yesterday's wind/solar forecast. Perhaps this can also be done for the wind fraction.

Data schedule

Entso-E provides data with a resolution of 15 minutes. It appears to become available about 5m20s after the start of each 15 minute period (:00, :15, :30, :45). At that point, the most recent data is from an interval that ended 30 minutes ago. So, including the 5m20s minute processing delay, the most recent data available is about 35 minutes old.

Hardware

Parts:

Software

The software consists of two parts:

  • The backend part that collects the power generation data, written in Java, running on a VPS
  • The light part that visualizes the power generation as fractions on a LED ring, running on an Arduino

Backend

Source code: https://github.com/bertrik/energymix-server

Runs as a REST-like resource at:

(1-minute rate limit)

Returns a JSON-structure like:

{
  "time": 1657057500,
  "total": 9122,
  "mix": [
    { "id": "solar", "power": 0, "color": "#FFFF00"},
    { "id": "wind", "power": 4, "color": "#0000FF"},
    { "id": "fossil", "power": 86, "color": "#FF0000"},
    { "id": "nuclear", "power": 5, "color": "#FF00FF"},
    { "id": "other", "power": 4, "color": "#444444"},
    { "id": "waste", "power": 1, "color": "#444444"}
  ]
}
  • time is a unix time stamp in seconds, representing the end of the 15-minute period that the power figures refer to
  • total is the total most recent electrical power (megawatt), suitable for display (on a numeric display inside the ring for example)
  • energymix is an array of power sources, each with:
    • a short unique id
    • most recent known power (megawatt)
    • hex color, for display on the led ring

Energy generation sources are calculated from sources as follows, mostly from document A75:

  • solar = B16 (from the forecast document A69)
  • wind = B18 + B19
  • fossil = B04 + B05
  • nuclear = B14
  • waste = B17
  • other = B20

Arduino

Powerlight

Shows the dutch energy generation mix by source. Source code: https://github.com/bertrik/PowerLight

The Arduino sketch polls the REST API using HTTP every minute.

WiFi is managed by WifiManager. LEDs are controlled using FastLED. JSON content is parsed using ArduinoJSON.

ElectricityPrice

Shows the current dutch electricity price, based on the day-ahead prices from yesterday. Source code: https://github.com/bertrik/ElectricityPrice

The Arduino sketch polls the REST price API using HTTP every 5 minutes. WiFi is managed by WifiManager. JSON content is parsed using ArduinoJSON.

Hardware is an ESP8266 controlling a 7-segment display based on a TM1637, on pins D3 and D4.

T-Display
Nlecprice mockup.png

Alternative: use a TTGO ESP32 T-Display.

It has a 240x135 pixel display. Plan is to show a kind of bar graph with 24 bars (one bar for each hour), each bar's height indicates the price of that hour. The background color shows green/black/red, to indicate cheap/moderate/expensive. Current price is shown as a big number.

Each bar is therefore 10 pixels wide, 9 pixels for the bar + 1 pixel separation.