Skip to content

Commit 566bd66

Browse files
author
birgits
committed
Update dependencies and scenario_settings
1 parent 34cb190 commit 566bd66

6 files changed

Lines changed: 26 additions & 57 deletions

File tree

doc/api/modules.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,20 @@ The file can be found on
4949
5050
This section of :json:object:`scenario_setting.json` contains all input parameters for the eDisGo tool and the clustering of MV grids.
5151

52-
:property string db: Name of your database (e.g.``''oedb''``). eDisGo queries generator data from this database. Please note that this parameters is automatically overwritten in eDisGo's configuration files.
53-
:property string gridversion: ``null`` or *open_eGo* dataset version (e.g. ``''v0.4.5''``). If ``null``, *open_eGo*'s model_draft is used. Please note that this parameters is automatically overwritten in eDisGo's configuration files.
52+
:property string gridversion: This parameter is currently not used.
5453
:property string grid_path: Path to the MV grid files (created by `ding0 <https://readthedocs.org/projects/dingo/>`_) (e.g. ``''data/MV_grids/20180713110719''``)
5554
:property string choice_mode: Mode that eGo uses to chose MV grids out of the files in **grid_path** (e.g. ``''manual''``, ``''cluster''`` or ``''all''``). If ``''manual''`` is chosen, the parameter **manual_grids** must contain a list of the desired grids. If ``''cluster''`` is chosen, **no_grids** must specify the desired number of clusters and **cluster_attributes** must specify the applied cluster attributes. If ``''all''`` is chosen, all MV grids from **grid_path** are calculated.
56-
:property list cluster_attributes: List of strings containing the desired cluster attributes. Available attributes are: ``''farthest_node''``, ``''wind_cap''``, ``''solar_cap''`` and ``''extended_storage''``, thus an exemplary list looks like ``["farthest_node", "wind_cap", "solar_cap", "extended_storage"]``. ``''farthest_node''`` represents the longest path within each grid, ``''wind_cap''`` the installed wind capacity within each grid, ``''solar_cap''`` the installed solar capacity within each grid and ``''extended_storage''`` the installed storage units (as calculated by eTraGo). Please note that ``''extended_storage''`` is only available in combination with eTraGo datasets that optimized storage extension. Otherwise this attribute is ignored.
55+
:property list cluster_attributes: List of strings containing the desired cluster attributes. Available attributes are all attributes returned from :py:func:`~ego.mv_clustering.mv_clustering.get_cluster_attributes.
5756
:property bool only_cluster: If ``true``, eGo only identifies cluster results, but performs no eDisGo run. Please note that for **only_cluster** an eTraGo run or dataset must be provided.
58-
:property list manual_grids: List of MV grid ID's (*open_eGo* HV/MV substation ID's) is case of **choice_mode** = ``''manual''`` (e.g. ``[1718,1719]``). Ohterwise this parameter is ignored.
59-
:property int no_grids: Number of MV grid clusters (from all grids in **grid_path**, a specified number of representative clusters is calculated) in case of **choice_mode** = ``''cluster''``. Otherwise this parameter is ignored.
57+
:property list manual_grids: List of MV grid ID's in case of **choice_mode** = ``''manual''`` (e.g. ``[1718,1719]``). Ohterwise this parameter is ignored.
58+
:property int n_clusters: Number of MV grid clusters (from all grids in **grid_path**, a specified number of representative clusters is calculated) in case of **choice_mode** = ``''cluster''``. Otherwise this parameter is ignored.
6059
:property bool parallelization: If ``false``, eDisgo is used in a consecutive way (this may take very long time). In order to increase the performance of MV grid simulations, ``true`` allows the parallel calculation of MV grids. If **parallelization** = ``true``, **max_calc_time** and **max_workers** must be specified.
6160
:property float max_calc_time: Maximum calculation time in hours for eDisGo simulations. The calculation is terminated after this time and all costs are extrapolated based on the unfinished simulation. Please note that this parameter is only used if **parallelization** = ``true``.
6261
:property ing max_workers: Number of workers (cpus) that are allocated to the simulation. If the given value exceeds the number of available workers, it is reduced to the number of available workers. Please note that this parameter is only used if **parallelization** = ``true``.
63-
:property bool initial_reinforcement: This parameter must be set ``true``.
6462
:property float max_cos_phi_renewable: Maximum power factor for wind and solar generators in MV grids (e.g. ``0.9``). If the reactive power (as calculated by eTraGo) exceeds this power factor, the reactive power is reduced in order to reach the power factor conditions.
6563
:property string solver: Solver eDisGo uses to optimize the curtailment and storage integration (e.g. ``''gurobi''``).
66-
:property string timesteps_pfa: Method eDisGo uses for the storage integration (e.g. ``''snapshot_analysis''``).
6764
:property string results: Path to folder where eDisGo's results will be saved.
65+
:property list tasks: List of string defining the tasks to run. The eDisGo calculation for each MV grid can be devided into separate tasks which is helpful in case one tasks fails and calculations do not need to started in the beginning. The following tasks exist: ``''1_setup_grid''``, ``''2_specs_overlying_grid''``, ``''3_temporal_complexity_reduction''``, ``''4_optimisation''``, ``''5_grid_reinforcement''``.
6866

6967

7068

doc/conf.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
The documentation is available on RTD: https://openego.readthedocs.io"""
77

88

9-
__copyright__ = "Flensburg University of Applied Sciences, Europa-Universität Flensburg, Centre for Sustainable Energy Systems, DLR-Institute for Networked Energy Systems"
9+
__copyright__ = (
10+
"Flensburg University of Applied Sciences, Europa-Universität "
11+
"Flensburg, Centre for Sustainable Energy Systems, DLR-Institute "
12+
"for Networked Energy Systems"
13+
)
1014
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
1115
__author__ = "wolf_bunke"
1216

@@ -26,11 +30,12 @@
2630
# serve to show the default.
2731

2832
import os
29-
import shlex
3033
import sys
3134

3235
from unittest.mock import MagicMock
3336

37+
import sphinx_rtd_theme
38+
3439
# from mock import Mock as MagicMock
3540

3641
# If extensions (or modules to document with autodoc) are in another directory,
@@ -56,9 +61,7 @@
5661
"sphinx.ext.imgmath",
5762
"sphinx.ext.viewcode",
5863
"sphinx.ext.autosummary",
59-
# 'sphinxcontrib.napoleon',#enable Napoleon interpreter of docstrings Sphinx v<=1.2
6064
"sphinx.ext.napoleon", # enable Napoleon Sphinx v>1.3
61-
# 'sphinx_paramlinks',#to have links to the types of the parameters of the functions
6265
"numpydoc",
6366
"sphinxcontrib.httpdomain", # for restfull API
6467
"sphinxcontrib.autohttp.flask",
@@ -95,6 +98,7 @@
9598
"shapely": ("http://toblerity.org/shapely/manual.html#%s", "Shapely object"),
9699
}
97100

101+
98102
# test oedb implementation
99103
def rstjinja(app, docname, source):
100104
"""
@@ -117,7 +121,6 @@ def setup(app):
117121
# oep_url= 'http://oep.iks.cs.ovgu.de/'
118122

119123
# get data from oedb test
120-
# power_class = requests.get(oep_url+'/api/v0/schema/model_draft/tables/ego_power_class/rows/', ).json()
121124

122125
# import json
123126
# path = os.getcwd()
@@ -173,7 +176,7 @@ def setup(app):
173176
#
174177
# This is also used if you do content translation via gettext catalogs.
175178
# Usually you set "language" from the command line for these cases.
176-
language = None
179+
language = "en"
177180

178181
# There are two options for replacing |today|: either, you set today to some
179182
# non-false value, then it is used:
@@ -213,8 +216,10 @@ def setup(app):
213216
todo_include_todos = True
214217

215218

216-
# Fix import error of modules which depend on C modules (mock out the imports for these modules)
217-
# see http://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
219+
# Fix import error of modules which depend on C modules (mock out the imports for
220+
# these modules)
221+
# see http://read-the-docs.readthedocs.io/en/latest/faq.html#i-get-import-
222+
# errors-on-libraries-that-depend-on-c-modules
218223

219224

220225
if "READTHEDOCS" in os.environ:
@@ -246,8 +251,6 @@ def __getattr__(cls, name):
246251
# a list of builtin themes.
247252
# html_theme = 'alabaster'
248253

249-
import sphinx_rtd_theme
250-
251254
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
252255
html_theme = "sphinx_rtd_theme"
253256

@@ -347,13 +350,13 @@ def __getattr__(cls, name):
347350

348351
latex_elements = {
349352
# The paper size ('letterpaper' or 'a4paper').
350-
#'papersize': 'letterpaper',
353+
# 'papersize': 'letterpaper',
351354
# The font size ('10pt', '11pt' or '12pt').
352-
#'pointsize': '10pt',
355+
# 'pointsize': '10pt',
353356
# Additional stuff for the LaTeX preamble.
354-
#'preamble': '',
357+
# 'preamble': '',
355358
# Latex figure (float) alignment
356-
#'figure_align': 'htbp',
359+
# 'figure_align': 'htbp',
357360
}
358361

359362
# Grouping the document tree into LaTeX files. List of tuples

ego/scenario_setting.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@
126126
"comments": null
127127
},
128128
"eDisGo": {
129-
"db": "oedb",
130-
"gridversion": "v0.4.5",
131129
"grid_path": "/path/to_your/.dingo/grids",
132130
"choice_mode": "cluster",
133131
"cluster_attributes":["pv_capacity_expansion_mw_per_km2", "wind_capacity_expansion_mw_per_km2", "electromobility_max_load_expansion_mw_per_km2", "pth_capacity_expansion_mw_per_km2"],
@@ -140,7 +138,8 @@
140138
"max_cos_phi_renewable": 0.9,
141139
"results": "results/another_result",
142140
"solver": "gurobi",
143-
"tasks": ["1_setup_grid", "2_specs_overlying_grid", "3_temporal_complexity_reduction", "4_optimisation", "5_grid_reinforcement"]
141+
"tasks": ["1_setup_grid", "2_specs_overlying_grid", "3_temporal_complexity_reduction", "4_optimisation", "5_grid_reinforcement"],
142+
"gridversion": "v0.4.5"
144143
},
145144
"database": {
146145
"database_name": "<database_name>",

ego/tools/edisgo_integration.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
import multiprocess as mp2
4747
import pandas as pd
4848

49-
from sqlalchemy.orm import scoped_session, sessionmaker
50-
5149
if "READTHEDOCS" not in os.environ:
5250
from edisgo.edisgo import import_edisgo_from_files
5351
from edisgo.flex_opt.reinforce_grid import enhanced_reinforce_grid
@@ -62,7 +60,6 @@
6260
aggregate_district_heating_components,
6361
reduce_timeseries_data_to_given_timeindex,
6462
)
65-
from egoio.tools import db
6663

6764
from ego.mv_clustering import cluster_workflow, database
6865
from ego.tools.economics import edisgo_grid_investment
@@ -378,21 +375,6 @@ def _update_edisgo_configs(self, edisgo_grid):
378375
self._suppress_log = False # Only in the first run warnings and
379376
# info get thrown
380377

381-
# Database section
382-
ego_db = self._db_section
383-
edisgo_db = edisgo_grid.network.config["db_connection"]["section"]
384-
385-
if not ego_db == edisgo_db:
386-
if not self._suppress_log:
387-
logger.warning(
388-
(
389-
"eDisGo database configuration (db: '{}') "
390-
+ "will be overwritten with database configuration "
391-
+ "from eGo's scenario settings (db: '{}')"
392-
).format(edisgo_db, ego_db)
393-
)
394-
edisgo_grid.network.config["db_connection"]["section"] = ego_db
395-
396378
# Versioned
397379
ego_gridversion = self._grid_version
398380
if ego_gridversion is None:
@@ -477,7 +459,6 @@ def _set_scenario_settings(self):
477459

478460
# Reading all eDisGo settings
479461
# TODO: Integrate into a for-loop
480-
self._db_section = self._edisgo_args["db"]
481462
self._grid_version = self._edisgo_args["gridversion"]
482463
self._solver = self._edisgo_args["solver"]
483464
self._grid_path = self._edisgo_args["grid_path"]
@@ -538,11 +519,6 @@ def _cluster_mv_grids(self):
538519

539520
def _identify_extended_storages(self):
540521

541-
conn = db.connection(section=self._db_section)
542-
session_factory = sessionmaker(bind=conn)
543-
Session = scoped_session(session_factory)
544-
session = Session()
545-
546522
all_mv_grids = self._check_available_mv_grids()
547523

548524
storages = pd.DataFrame(index=all_mv_grids, columns=["storage_p_nom"])
@@ -570,8 +546,6 @@ def _identify_extended_storages(self):
570546

571547
storages.at[mv_grid, "storage_p_nom"] = stor_p_nom
572548

573-
Session.remove()
574-
575549
return storages
576550

577551
def _check_available_mv_grids(self):

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Using single requirments for docs, see:
33
# https://github.com/rtfd/readthedocs.org/issues/2070
44
sphinx_rtd_theme
5-
pandas >=0.20.3, <=0.20.3
6-
pypsa >= 0.11.0, <= 0.11.0
75
numpy
86
numpydoc
97
sphinxcontrib-httpdomain

setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def read(fname):
2929
"flake8",
3030
]
3131

32-
doc_req = []
32+
doc_req = ["numpydoc", "sphinxcontrib.httpdomain", "sphinx-jsondomain"]
3333

3434
full_req = list(set(dev_req + doc_req))
3535

@@ -55,9 +55,6 @@ def read(fname):
5555
install_requires=req,
5656
extras_require=extras,
5757
package_data={
58-
"ego": [os.path.join("tools", "*.csv")]
59-
+ [os.path.join("tools", "*.json")]
60-
+ [os.path.join("", "*.json")],
61-
"ego.data": ["*.csv"],
58+
"ego": [os.path.join("tools", "*.json")] + [os.path.join("", "*.json")],
6259
},
6360
)

0 commit comments

Comments
 (0)