__copyright__ = "Zentrum für nachhaltige Energiesysteme Flensburg"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://github.com/openego/eGo/blob/master/LICENSE"
__author__ = "wolfbunke"
eGo ist ein Anwendungs-Tool, das in der Programmiersprache Python 3 entwickelt ist. Daher ist es wichtig vorab Python 3 zu installieren. Wenn eine Python Umgebung vorhanden ist, installiere eGo einfach über pypi mit >>> pip3 install eGo. Wir empfehlen eine virtuelle Umgebung für deine Installation zu verwenden. Erfahre mehr auf der README Datei oder auf der Dokumentationsseite openego.readthedocs.io.
Damit wir das Tool eGo verwenden können, wurden innerhalb des Projektes open_eGo verschiedene Tools, Datenbanken, Schnittstellen und Datenaufbereitungs-Skripte als Open Source und Open Daten entwickelt. Die Grafik zeigt den Aufbau und den Prozess von der Rohdatengewinnung, Verarbeitung der Daten und Daten Modellerstellung (Data processing und Ding0) über die modulare Anwendung zur Mittel- und Niederspannungsberechnung (eDisGo), Höchst- und Hochspannungsberechnung (eTraGo) und deren Integration zur Berechnung der Gesamtergebnisse (eGo).
Eine detaillierte Installationsanleitung ist unter README.md zu finden.
Die weiteren Schritte werden hier im Tutorial beschrieben.
In dem Jupyter Notebook Tutorial möchten wie folgende Inhalte und Fragen bearbeiten:
scenario_setting.json
NEP 2035
sowie eGo 100
Szenario?¶Wir starten mit dem Import der eGo() class.
# enable jupyter interactiv plotting
%matplotlib notebook
from ipywidgets import *
import matplotlib.pyplot as plt
from ego.tools.io import eGo
from ego.tools.utilities import define_logging
import pandas as pd
# define logger file
logger = define_logging(name='ego')
/lib/python3.5/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>. """) INFO:keyring.backend:Loading KWallet INFO:keyring.backend:Loading SecretService INFO:keyring.backend:Loading Windows INFO:keyring.backend:Loading macOS INFO:keyring.backend:Loading Gnome INFO:keyring.backend:Loading Google INFO:keyring.backend:Loading Windows (alt) INFO:keyring.backend:Loading file INFO:keyring.backend:Loading keyczar INFO:keyring.backend:Loading multi INFO:keyring.backend:Loading pyfs INFO:root:Generating grammar tables from /usr/lib/python3.5/lib2to3/Grammar.txt INFO:root:Generating grammar tables from /usr/lib/python3.5/lib2to3/PatternGrammar.txt /lib/python3.5/site-packages/sqlalchemy/ext/declarative/base.py:338: SAWarning: Ignoring declarative-like tuple value of attribute segment: possibly a copy-and-paste error with a comma left at the end of the line? /lib/python3.5/site-packages/sqlalchemy/ext/declarative/base.py:338: SAWarning: Ignoring declarative-like tuple value of attribute cable: possibly a copy-and-paste error with a comma left at the end of the line? INFO:root:Initialisation of eGo Results
Erhalte einen Überblick über die möglichen Einstellungen zur Berechnung. Eine detaillierte Dokumentation ist unter openego.readthedocs.io/../..#scenario-settings-json zu finden.
# lets have a look at our settings
import urllib.request, json
url ="https://raw.githubusercontent.com/openego/eGo/dev/ego/scenario_setting.json"
with urllib.request.urlopen(url) as url:
data = json.loads(url.read().decode())
print(json.dumps(data, indent=4, sort_keys=False))
{ "eDisGo": { "results": "results/another_result", "parallelization": true, "cluster_attributes": [ "farthest_node", "wind_cap", "solar_cap", "extended_storage" ], "apply_curtailment": true, "initial_reinforcement": true, "manual_grids": [], "ding0_files": "/path/to_your/.dingo/grids", "max_workers": 2, "max_cos_phi_renewable": 0.9, "choice_mode": "cluster", "max_calc_time": 0.5, "no_grids": 2, "gridversion": "v0.4.5", "db": "oedb", "timesteps_pfa": "snapshot_analysis", "curtailment_voltage_threshold": 0, "only_cluster": false, "solver": "gurobi", "storage_distribution": true }, "eTraGo": { "load_shedding": false, "network_clustering_kmeans": 10, "comments": "", "scn_extension": null, "extendable": [ "storage", "network" ], "db": "oedb", "skip_snapshots": false, "parallelisation": false, "solver_options": {}, "disaggregation": "uniform", "db_export": false, "generator_noise": 789456, "scn_decommissioning": null, "line_grouping": false, "snapshot_clustering": false, "ramp_limits": false, "solver": "gurobi", "end_snapshot": 1005, "csv_export": "results/your_results", "gridversion": "v0.4.5", "branch_capacity_factor": { "HV": 0.5, "eHV": 0.7 }, "minimize_loading": false, "load_cluster": false, "method": "lopf", "foreign_lines": { "capacity": "osmTGmod", "carrier": "AC" }, "lpfile": false, "pf_post_lopf": true, "extra_functionality": null, "scn_name": "eGo 100", "network_clustering_ehv": false, "start_snapshot": 1000 }, "eGo": { "csv_import_eDisGo": false, "eDisGo": true, "eTraGo": true, "csv_import_eTraGo": false } }
Für dieses Tutorial rechnen wir zwei Szenarien die innerhalb des Projektes entwickelt worden. Als erstes rechnen wir das NEP 2035 Szenario, welches auf dem Netzentwicklungsplan Version 2015 der vier Übertragungsnetzbetreiber beruht. Danach rechnen wir das Szenario eGo100 welches eine 100%ig regenerative Versorgung des elektrischen Verbrauchs innerhalb von Deutschland annimmt. Dieses basiert auf dem 2050 Szenario der E-Highway Studie (X-13: 13: 100% RES electricity).
# Starte die Berechnung
ego = eGo(jsonpath='scenario_setting_nep2035.json')
INFO:ego:Using scenario setting: scenario_setting_nep2035.json INFO:ego.tools.utilities:Your path is: /tutorial INFO:ego.tools.utilities:eDisGo and eTraGo results will be imported from csv INFO:ego.tools.utilities:Using and importing eTraGo settings INFO:ego.tools.utilities:Using and importing eDisGo settings INFO:ego:Connected to Database INFO:ego:eTraGo section started INFO:ego:Caution, import disaggregation data of former Cluster INFO:pypsa.io:Imported network etrago_k300_StoNet_nep35_workshop has buses, carriers, generators, lines, links, loads, storage_units INFO:ego:Create eTraGo network from CSV result INFO:pypsa.io:Imported network disaggregated has buses, carriers, generators, lines, links, loads, storage_units INFO:ego:Create eTraGo disaggregated network from CSV result INFO:ego:Using argument file INFO:ego:Changed naming of storages to storage of args INFO:ego:['network', 'storage'] INFO:ego:No Transform and Line losses are calcualted! Use eTraGo pf_post_lopf method INFO:ego:Create eDisGo network INFO:ego.tools.edisgo_integration:eTraGo Dataset used extendable storage INFO:ego.tools.edisgo_integration:All eDisGo settings are taken from CSV folder(scenario settings are ignored) INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2390 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 1078 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 1298 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2008 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2687 WARNING:ego.tools.edisgo_integration:MV grid 1107 could not be loaded INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2046 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 444 INFO:ego:For all components T=40 and p=0.05 is used WARNING:ego:No results available for grid 1107 WARNING:ego:Only 92.49 % of the grids were calculated. Costs are extrapolated...
# Übersicht der Netzausbaukosten von eTraGo
ego.etrago.grid_investment_costs
differentiation | voltage_level | capital_cost | component | |
---|---|---|---|---|
0 | cross-border | ehv | 2.660334e+06 | grid |
1 | domestic | ehv | 5.084579e+06 | grid |
2 | foreign | ehv | 2.993799e+06 | grid |
# Übersicht der Ausbaukosten von eDisGo
ego.edisgo.grid_investment_costs
voltage_level | capital_cost | overnight_costs | component | differentiation | |
---|---|---|---|---|---|
0 | lv | 5216.046090 | 7.840426e+08 | grid | domestic |
1 | mv | 35352.934531 | 5.314027e+09 | grid | domestic |
2 | mv/lv | 382.216385 | 5.745232e+07 | grid | domestic |
# Übersicht der gesamten Ausbaukosten
# Annuisiert pro Zeitschritt als capital_cost
ego.total_investment_costs
capital_cost | component | differentiation | overnight_costs | voltage_level | |
---|---|---|---|---|---|
0 | 2.660334e+06 | grid | cross-border | 3.998843e+11 | ehv |
1 | 5.084579e+06 | grid | domestic | 7.642814e+11 | ehv |
2 | 2.993799e+06 | grid | foreign | 4.500087e+11 | ehv |
3 | 3.375557e+00 | storage | domestic | 5.073922e+05 | ehv |
5 | 3.535293e+04 | grid | domestic | 5.314027e+09 | mv |
4 | 5.216046e+03 | grid | domestic | 7.840426e+08 | lv |
6 | 3.822164e+02 | grid | domestic | 5.745232e+07 | mv/lv |
Funktionsdokumentation unter: plot_total_investment_costs()
Wir schauen uns die Gesamtkosten der zeitliche definierten Berechnung und deren Netzzuständen an. Eine Beschreibung der Kostenmethoden ist unter Theoretical Background zu finden.
# Gesamtkosten
ego.plot_total_investment_costs(var = 'overnight_cost')
# Annuisierte Kosten der Zeitschritte
ego.plot_total_investment_costs()
ego.etrago.plot_line_loading()
# Erzeugung DE und Nachbarn
ego.etrago.plot_stacked_gen()
Für die Clusterbildung wurden die Parameter:
"wind_cap"
"solar_cap"
"farthest_node"
"extended_storage"
Auf Grund des Nicht-Ausbaus von Speicher in dem gewählten Zeitraum entniehmt eGo diesen Parameter
ego.edisgo.grid_choice
no_of_points_per_cluster | the_selected_network_id | represented_grids | |
---|---|---|---|
cluster_id | |||
3 | 917 | 2390 | [2048, 2731, 4, 2053, 2058, 2062, 18, 22, 2077... |
1 | 712 | 1078 | [3072, 2051, 2052, 5, 6, 8, 11, 12, 15, 16, 17... |
6 | 703 | 1298 | [3, 2059, 21, 23, 2075, 2080, 688, 2082, 2083,... |
5 | 358 | 2008 | [1, 2054, 1032, 3082, 3083, 1036, 14, 3088, 20... |
0 | 338 | 2687 | [512, 2560, 2, 86, 3478, 3329, 2056, 1034, 154... |
4 | 254 | 1107 | [1025, 1027, 7, 9, 10, 2060, 2061, 2574, 2063,... |
2 | 59 | 2046 | [2692, 1413, 1414, 1415, 2057, 1420, 2445, 329... |
7 | 43 | 444 | [2177, 3153, 3139, 3076, 3142, 3143, 1097, 339... |
ego.plot_edisgo_cluster()
Mit der ego.iplot Funktion erstellen wir den interaktiven Plot der uns als HTML Datei lokal abgespeichert wird.
#ego.iplot
from IPython.display import IFrame
src= "iplot_map_nep.html"
display(IFrame(src, width=900, height=750))
ego_2 = eGo(jsonpath='scenario_setting_ego100.json')
INFO:ego:Using scenario setting: scenario_setting_ego100.json INFO:ego.tools.utilities:Your path is: /tutorial INFO:ego.tools.utilities:eDisGo and eTraGo results will be imported from csv INFO:ego.tools.utilities:Using and importing eTraGo settings INFO:ego.tools.utilities:Using and importing eDisGo settings INFO:ego:Connected to Database INFO:ego:eTraGo section started INFO:ego:Caution, import disaggregation data of former Cluster INFO:pypsa.io:Imported network etrago_k300_StoNet_ego100_workshop has buses, carriers, generators, lines, links, loads, storage_units INFO:ego:Create eTraGo network from CSV result INFO:pypsa.io:Imported network disaggregated has buses, carriers, generators, lines, links, loads, storage_units INFO:ego:Create eTraGo disaggregated network from CSV result INFO:ego:Using argument file INFO:ego:Changed naming of storages to storage of args INFO:ego:['network', 'storage'] INFO:ego:No Transform and Line losses are calcualted! Use eTraGo pf_post_lopf method INFO:ego:Create eDisGo network INFO:ego.tools.edisgo_integration:eTraGo Dataset used extendable storage INFO:ego.tools.edisgo_integration:All eDisGo settings are taken from CSV folder(scenario settings are ignored) INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2390 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 1078 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 1298 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2008 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2687 WARNING:ego.tools.edisgo_integration:MV grid 1107 could not be loaded INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 2046 INFO:pypsa.io:Imported network pypsa_network has buses, generators, lines, loads, transformers INFO:ego.tools.edisgo_integration:Imported MV grid 444 INFO:ego:For all components T=40 and p=0.05 is used WARNING:ego:No results available for grid 1107 WARNING:ego:Only 92.49 % of the grids were calculated. Costs are extrapolated...
# Gesamtkosten der eGo 100 Berechnung
ego_2.total_investment_costs
capital_cost | component | differentiation | overnight_costs | voltage_level | |
---|---|---|---|---|---|
0 | 2.636699e+06 | grid | cross-border | 3.963317e+11 | ehv |
1 | 5.433234e+06 | grid | domestic | 8.166890e+11 | ehv |
2 | 2.993663e+06 | grid | foreign | 4.499882e+11 | ehv |
3 | 4.893296e+02 | storage | domestic | 7.355289e+07 | ehv |
5 | 2.580932e+04 | grid | domestic | 3.879492e+09 | mv |
4 | 3.201519e+03 | grid | domestic | 4.812319e+08 | lv |
6 | 3.864600e+02 | grid | domestic | 5.809020e+07 | mv/lv |
# Darstellung der Ergebnisse
ego_2.plot_total_investment_costs(var = 'overnight_cost')
# Gesamtkosten übertragen
nep = ego.total_investment_costs
ego100 = ego_2.total_investment_costs
nep['scenario'] ='NEP 2035'
ego100['scenario'] ='eGo 100'
# Zusammenfügen der Kosten
total = nep[nep.differentiation=='domestic'].append(ego100, ignore_index=True)
res = total.groupby(['scenario','voltage_level'])['overnight_costs'].sum()
res/1e+9 # Kosten in Milliarden €
scenario voltage_level NEP 2035 ehv 764.281923 mv 5.314027 lv 0.784043 mv/lv 0.057452 eGo 100 ehv 1663.082485 mv 3.879492 lv 0.481232 mv/lv 0.058090 Name: overnight_costs, dtype: float64
[1] Europe’s future secure and sustainable electricity infrastructure e-Highway2050 project results, November 2015, url: http://www.e-highway2050.eu/e-highway2050/
[2] Netzentwicklungsplan (NEP) 2025, Version 2015, url:https://www.netzentwicklungsplan.de/sites/default/files/paragraphs-files/NEP_2025_1_Entwurf_Teil1_0.pdf