Skip to content

Instantly share code, notes, and snippets.

@denis-bz
Last active November 17, 2022 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denis-bz/c610a4b67344592a2535f92aabc602f4 to your computer and use it in GitHub Desktop.
Save denis-bz/c610a4b67344592a2535f92aabc602f4 to your computer and use it in GitHub Desktop.
How efficient are wind, sun, biomass in the German provinces in 2019 - 2020 13 Nov 2022

How efficient are wind, sun, biomass in the German provinces in 2019 - 2020 ?

Keywords: Renewable energy, wind energy, electricity, Germany

Purpose: look at the efficiency of electricity produced in the German provinces from sun, wind and biomass, with files from official data:
LAK, real: https://www.lak-energiebilanzen.de 2019, Länderarbeitskreis Energiebilanzen Bruttostromerzeugung nach Erneuerbaren Energieträgern
BMWK, max 31.12.2020, https://www.bmwk.de/Redaktion/DE/Downloads/E/EEG-Kooperationsausschuss/2021/bericht-bund-laender-kooperationsausschuss-2021.pdf

How to run this

Download the files 2019-lak-E.csv 2020-bmwk-MWmax.csv Estrom-real-vs-max.py lakcsv.py
to your computer (click on the green "Code" button, run unzip xx.zip).
First look at the .csv files and, if you like, the code (de gustabus). Then run

python3 Estrom-real-vs-max.py

This should generate a logfile like 13nov-Estrom-real-vs-max.log below, with lines like

-- EStrom % real / max: real von LAK, max von BMWK
     BW    BY    BE    BB    HB    HH    HE    NI   NRW    RP    SN    ST    SH    TH  Gesamt 
Wind: 
[[   20    22    27    20    23    23    21    35    21    21    20    20    33    21    24]
 [  332   570     3  1494    48    28   483  3931  1302   784   257  1071  2253   359 12913]
 [ 1644  2542    12  7464   211   118  2253 11309  6141  3725  1264  5253  6826  1672 54420]] 

Which areas in Germany generate the most electricity, and how ?

Generating electricity efficiently is good; generating lots of electricity efficiently is better. Which areas in Germany generate the most electricity, and how ?

8nov-Strom-Bundeslaender

(The electricity market is really complex, and driven by many factors:

  • how electricity is used: industry, homes, Ecars
  • where: north, south, offshore, import-export
  • storage, pump stations -- wind and sun vary quite a lot
  • costs: capital costs, running costs
  • profits: €€€, politics, "likes".

As much as I wish for "rational" decision-making, transparent and understandable, windfarm owners and politicians have their own agendas

Notes

How can one measure the efficiency of e.g. a wind turbine ? "Installed power" or "rated power" means the maximum power that it can deliver; the ratio real / max is called "capacity factor" or sometimes "efficiency". For example, Wikipedia Wind_power_in_Germany:

39.82 % offshore, 23.97 % on + off, 21.74 % onshore.

(Roughly 20 % of Germany's total windpower is offshore, in Nord- and Ostsee. This may or may not show up in windpower numbers for Niedersachsen and Schleswig-Holstein in other datasets.)

Why LAK 2019 vs. BMWK 2020 ? Because I couldn't find data for both in the same year.

Use iconv to change latin1 in lak .csvs to utf8.

See also

https://en.wikipedia.org/wiki/Wind_power_in_Germany ff.
Geisterstrom in Germany: €761.000.000 citation needed in 2020 for electricity paid for but thrown away; see https://de.wikipedia.org/wiki/Erneürbare-Energien-Gesetz#Entschädigungszahlungen_für_nicht_eingespeiste_Strommengen

Comments welcome

Links to

  1. data on wind -> electricity actually produced
  2. regional planning of wind energy in Bayern or Baden-Württemberg

especially welcome.

cheers
-- denis-bz-py@t-online.de 17 Nov 2022

Theory and practice are closer in theory than they are in practice.

# from: Estrom-real-vs-max.py
# 13 Nov 2022 16:06z wind/de/Erneuerbare Denis 10.14.6
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
Erneuerbare Strom real / max, LAK / BMWK
LAK, real: https://www.lak-energiebilanzen.de 2019
Länderarbeitskreis Energiebilanzen Bruttostromerzeugung nach Erneuerbaren Energieträgern
BMWK, max ("Installiert") 31.12.2020
https://www.bmwk.de/Redaktion/DE/Downloads/E/EEG-Kooperationsausschuss/2021/bericht-bund-laender-kooperationsausschuss-2021.pdf
-- read 2019-lak-E.csv:
GesamtE Wasser Wind Sonne Biomasse ESonst
Land
Baden-Württemberg 17719 4e+03 2909 5282 4822 207
Bayern 38678 1e+04 4995 12064 9200 494
Berlin 370 0e+00 29 78 262 0
Brandenburg 19839 1e+01 13090 3649 3013 74
Bremen 863 3e+01 418 30 354 32
Hamburg 652 4e-01 241 27 289 93
Hessen 8495 2e+02 4227 1801 2131 108
Niedersachsen 47211 2e+02 34434 3413 8968 146
Nordrhein-Westfalen 22442 5e+02 11404 4088 5992 455
Rheinland-Pfalz 10990 9e+02 6865 2055 1097 58
Sachsen 6185 2e+02 2249 1876 1750 82
Sachsen-Anhalt 15078 9e+01 9378 2493 3061 58
Schleswig-Holstein 24049 4e+00 19739 1328 2908 69
Thüringen 6345 1e+02 3142 1367 1657 38
-- read 2020-bmwk-MWmax.csv:
Wind Sonne Biomasse Summe
Land
Baden-Württemberg 1644 6896 927 9467
Bayern 2542 14653 1899 19094
Berlin 12 132 43 188
Brandenburg 7464 4366 461 12291
Bremen 211 51 12 274
Hamburg 118 59 40 217
Hessen 2253 2429 285 4967
Mecklenburg-Vorpommern 3492 2442 383 6317
Niedersachsen 11309 4641 1853 17803
Nordrhein-Westfalen 6141 5961 934 13036
Rheinland-Pfalz 3725 2496 180 6401
Saarland 494 524 13 1031
Sachsen 1264 2378 295 3937
Sachsen-Anhalt 5253 3098 523 8874
Schleswig-Holstein 6826 1901 600 9327
Thüringen 1672 1823 276 3771
Gesamt 54420 53849 8726 116995
--------------------------------------------------------------------------------
-- EStrom % real / max: real von LAK, max von BMWK
BW BY BE BB HB HH HE NI NRW RP SN ST SH TH Gesamt
Wind:
[[ 20 22 27 20 23 23 21 35 21 21 20 20 33 21 24]
[ 332 570 3 1494 48 28 483 3931 1302 784 257 1071 2253 359 12913]
[ 1644 2542 12 7464 211 118 2253 11309 6141 3725 1264 5253 6826 1672 54420]]
Sonne:
[[ 9 9 7 10 7 5 8 8 8 9 9 9 8 9 8]
[ 603 1377 9 417 3 3 206 390 467 235 214 285 152 156 4515]
[ 6896 14653 132 4366 51 59 2429 4641 5961 2496 2378 3098 1901 1823 53849]]
Biomasse:
[[ 59 55 70 75 326 82 85 55 73 69 68 67 55 68 60]
[ 550 1050 30 344 40 33 243 1024 684 125 200 349 332 189 5194]
[ 927 1899 43 461 12 40 285 1853 934 180 295 523 600 276 8726]]
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 6.
"https://www.lak-energiebilanzen.de/eingabe-statisch/?a=e350 /?a=e360"
"Länderarbeitskreis Energiebilanzen"
"Bruttostromerzeugung nach Erneuerbaren Energieträgern *)"
"Einheit: GWh"
" "
Land;Jahr;Anm;Insgesamt;Wasserkraft;Windkraft;Photovoltaik;"Biomasse 1)";"Sonstige erneuerbare Energien 2)";Stand
Baden-Württemberg;2019;BW1);17719.25120189042;4499.55202;2908.74917942543;5281.675;4822.10581446499;207.169188;
Bayern;2019;;38677.59904096875;11925.279308492;4994.73351676348;12063.688;9199.57341771327;494.324798;14.01.2022
Berlin;2019;;369.76700000000005;0;29.213;78.259;262.295;0;10.03.2022
Brandenburg;2019;;19838.813000000002;12.807;13090.433;3649.189;3012.733;73.651;10.03.2022
Bremen;2019;;862.598386569596;29.637;417.627886569596;29.611;353.6565;32.066;08.08.2022
Hamburg;2019;;651.575752009769;0.367;241.430752009769;27.235;289.498;93.045;30.06.2022
Hessen;2019;;8494.7257107776;227.61496866169;4227.36966336633;1800.71;2131.45422974958;107.576849;14.07.2022
Mecklenburg-Vorpommern;2019;;;;;;;;
Niedersachsen;2019;;47210.77613;249.922;34434.43313;3412.518;8967.671;146.232;30.11.2021
Nordrhein-Westfalen;2019;;22441.53763773071;503.637145121159;11403.5861681924;4087.826;5991.88374441715;454.604580000001;14.02.2022
Rheinland-Pfalz;2019;;10990.026591101641;914.765;6864.75599110164;2055.043;1097.285;58.1776000000009;30.06.2022
Saarland;2019;;;;;;;;
Sachsen;2019;;6184.548;227.989;2249.289;1876;1749.539;81.731;14.07.2022
Sachsen-Anhalt;2019;;15078;88;9378;2493;3061;58;
Schleswig-Holstein;2019;;24049.3260690961;4.314806;19739.2731540961;1328.31547;2908.00032;69.422319;30.06.2022
Thüringen;2019;" LAK3)";6345.414999999999;141.593;3142.341;1366.765;1656.561;38.155;27.06.2022
" "
Anmerkungen:
"*) Einschließlich Eigenverbrauch";"1) Feste und flüssige Biomasse, Biogas sowie biogener Anteil des Abfalls";"2) Klär-, Deponiegas und sonstige erneuerbare Energieträger"
"LAK3) Details zur Revision unter <a href=""https://wwwlak-energiebilanzende/methodik-der-energiebilanzen/"">Methodik der Energiebilanzen</a>"
"BW1) Bruttostromerzeugung Sofern ausgewiesen, enthalten sonstige Energieträger auch Braunkohlen"
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 2. in line 2.
# https://www.bmwk.de/Redaktion/DE/Downloads/E/EEG-Kooperationsausschuss/2021/bericht-bund-laender-kooperationsausschuss-2021.pdf
# Tabelle 2 Installierte Leistung der EE-Anlagen zur Stromerzeugung zum 31.12.2020
# cut-paste, no Wasserkraft
Land nBiomasse Biomasse nSolar Sonne nWind Wind nOffshore Offshore
Baden-Württemberg 1.881 927,4 379.313 6.895,8 796 1.644,1 - -
Bayern 4.075 1.899,2 621.859 14.653,2 1.241 2.541,8 - -
Berlin 46 43,0 9.541 132,5 8 12,4 - -
Brandenburg 542 460,7 48.439 4.366,3 3.876 7.463,8 - -
Bremen 11 12,4 2.557 50,9 93 210,8 - -
Hamburg 44 40,2 4.526 58,8 68 118,3 - -
Hessen 490 285,0 133.421 2.428,8 1.110 2.253,1 - -
Mecklenburg-Vorpommern 565 383,3 21.311 2.441,7 1.872 3.491,7 21 48,3
Niedersachsen 3.127 1.852,7 188.556 4.640,9 6.183 11.309,3 147 923,6
Nordrhein-Westfalen 1.769 934,3 316.161 5.961,1 3.495 6.140,9 - -
Rheinland-Pfalz 385 180,5 117.876 2.495,8 1.705 3.725,0 - -
Saarland 41 13,2 26.090 523,6 204 493,9 - -
Sachsen 484 294,8 51.487 2.377,9 937 1.263,9 - -
Sachsen-Anhalt 488 523,3 36.674 3.097,7 2.858 5.252,9 - -
Schleswig-Holstein 976 599,6 54.012 1.901,0 3.299 6.826,2 - -
Thüringen 360 276,5 35.928 1.822,6 896 1.672,0 - -
# Ausschließliche Wirtschaftszone --
Offshore - - - - - - 1.331 6.775,4
Gesamt 15.284 8.726,0 2.047.751 53.848,6 28.641 54.420,1 1.499 7.747,2
#!/usr/bin/env python3
"""Erneuerbare Strom real / max, real LAK /max BMWK
LAK, real: https://www.lak-energiebilanzen.de 2019
Länderarbeitskreis Energiebilanzen Bruttostromerzeugung nach Erneuerbaren Energieträgern
BMWK, max ("Installiert") 31.12.2020
https://www.bmwk.de/Redaktion/DE/Downloads/E/EEG-Kooperationsausschuss/2021/bericht-bund-laender-kooperationsausschuss-2021.pdf
"""
# Schleswig-Holstein und Niedersachsen 2019:
# 46 % des Windstroms kam von Offshore, in Nord- und Ostsee.
import sys
import numpy as np
import pandas as pd
from lakcsv import read_csv_lak, printdf
np.set_printoptions( edgeitems=10, threshold=10, linewidth=120 )
pd.set_option( "display.precision", 0,
"display.max_columns", 10 )
print( 80 * "▄" )
#...............................................................................
lakcsv = "2019-lak-E.csv"
bmwkcsv = "2020-bmwk-MWmax.csv" # cut-paste, no Wasser
# to change these params, run this.py a=1 b=None 'c = expr' ... in sh or ipython --
for arg in sys.argv[1:]:
exec( arg )
print( __doc__ )
#...............................................................................
dfreal = read_csv_lak( lakcsv ) / 8.760 # GWh -> MW
dfreal = dfreal[ "Wind Sonne Wasser Biomasse ".split() ]
dfreal.loc["Gesamt"] = dfreal.sum( axis=0 )
dfmax = pd.read_csv( bmwkcsv, sep=r"\s+", comment="#", index_col=0,
decimal=",", thousands=".", na_values="-" )
dfmax = dfmax[ "Wind Sonne Biomasse ".split() ] .dropna() # no Wasser
dfmax["Summe"] = dfmax.sum( axis=1 )
printdf( bmwkcsv, dfmax )
dfmax = dfmax.drop( index="Mecklenburg-Vorpommern Saarland ".split() ) # not in lak
#...............................................................................
print( "\n" + 80 * "-" )
print( "-- EStrom real / max %: real LAK, max BMWK" )
print( " BW BY BE BB HB HH HE NI NRW RP SN ST SH TH Gesamt " )
for col in "Wind Sonne Biomasse ".split():
real = dfreal[col].values
max = dfmax[col].values
stack = np.vstack(( real / max * 100, real, max )).round().astype(int)
print( f"{col}: \n{stack} \n" )
#!/usr/bin/env python3
""" lakcsv.py: read_csv_lak https://www.lak-energiebilanzen.de/eingabe-statisch/?a=e350 /?a=e360
"""
import numpy as np
import pandas as pd
usecolsAlle = { # 2019-lak.csv
"Land" : "Land",
# "Jahr" : "Jahr",
# "Anm" : "Anm",
"Insgesamt" : "Gesamt",
"Steinkohle" : "Steinkohle",
"Braunkohle" : "Braunkohle",
"Heizöl" : "Heizöl",
"Erdgas, Erdölgas" : "Gas",
"Stromerzeugung brutto, darunter Erneuerbare Energieträger" : "Erneuerbare",
"Kernenergie" : "Atom",
"Andere Energieträger" : "Andere",
# "Stand" : "Stand",
}
usecolsE = { # 2019-lak-E.csv
"Land" : "Land",
# "Jahr" : "Jahr",
# "Anm" : "Anm",
"Insgesamt" : "GesamtE",
"Wasserkraft" : "Wasser",
"Windkraft" : "Wind",
"Photovoltaik" : "Sonne",
"Biomasse 1)" : "Biomasse",
"Sonstige erneuerbare Energien 2)" : "ESonst",
# "Stand" : "Stand",
}
#...............................................................................
def read_csv_lak( csvin="2019-lak-E.csv", usecols=usecolsE, percent="" ) -> "pd.DataFrame GWh":
df = (pd.read_csv( csvin, sep=";", comment='"',
usecols=usecols.keys(),
index_col=0 )
# , encoding="latin1" )
# iconv -f latin1 -t utf-8 2019-lak-E-latin1.csv > 2019-lak-E.csv
.rename( columns=usecols )
.dropna( axis=0, thresh=3 ) # MV Saarland
)
printdf( csvin, df )
return df
def printdf( csv: str, df: pd.DataFrame ):
print( f"\n-- read {csv}: \n{df} \n" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment