Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def setup(sphinx):
),
"ding0": ("https://dingo.readthedocs.io/en/dev/api/ding0.html#%s", "ding0.%s"),
"pypsa": (
"https://pypsa.readthedocs.io/en/latest/user-guide/components.html#%s",
"https://docs.pypsa.org/v0.35.1/user-guide/components.html#%s",
"pypsa.%s",
),
"plotly": (
Expand Down
2 changes: 1 addition & 1 deletion doc/features_in_detail.rst
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ References
*dena-Verteilnetzstudie: Ausbau- und Innovationsbedarf der Stromverteilnetze in Deutschland bis 2030*. 2012.

.. [PyPSA] `PyPSA - Spatial Clustering Documentation
<https://pypsa.readthedocs.io/en/latest/examples/spatial-clustering.html>`_
<https://docs.pypsa.org/v0.35.1/examples/spatial-clustering.html>`_

.. [SCR] `Master Thesis - Malte Jahn - Analysis of the effects of spatial complexity reduction on Distribution
network expansion planning with flexibilities (written in German)
Expand Down
2 changes: 1 addition & 1 deletion doc/whatsnew/v0-1-0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Release date: July 26, 2021
This release comes with some major refactoring. The internal data structure
of the network topologies was changed from a networkx graph structure to
a pandas dataframe structure based on the
`PyPSA <https://pypsa.readthedocs.io/en/latest/>`_ data structure. This comes
`PyPSA <https://docs.pypsa.org/v0.35.1/>`_ data structure. This comes
along with major API changes.
Not all functionality of the previous eDisGo release 0.0.10 is yet refactored
(e.g. the heuristics for grid supportive storage integration and generator
Expand Down
22 changes: 13 additions & 9 deletions edisgo/edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
pypsa_io,
timeseries_import,
)
from edisgo.io.db import engine as toep_engine
from edisgo.io.db import engine as egon_engine
from edisgo.io.ding0_import import import_ding0_grid
from edisgo.io.electromobility_import import (
distribute_charging_demand,
Expand Down Expand Up @@ -556,6 +556,7 @@ def set_time_series_active_power_predefined(
is indexed using a default year and set for the whole year.

"""
engine = kwargs["engine"] if "engine" in kwargs else egon_engine()
if self.timeseries.timeindex.empty:
logger.warning(
"When setting time series using predefined profiles it is better to "
Expand All @@ -569,7 +570,7 @@ def set_time_series_active_power_predefined(
self,
fluctuating_generators_ts,
fluctuating_generators_names,
engine=kwargs.get("engine", toep_engine()),
engine=engine,
timeindex=kwargs.get("timeindex", None),
)
if dispatchable_generators_ts is not None:
Expand All @@ -584,7 +585,7 @@ def set_time_series_active_power_predefined(
loads_ts_df = timeseries_import.electricity_demand_oedb(
edisgo_obj=self,
scenario=kwargs.get("scenario"),
engine=kwargs.get("engine", toep_engine()),
engine=engine,
timeindex=kwargs.get("timeindex", None),
load_names=conventional_loads_names,
)
Expand Down Expand Up @@ -978,14 +979,15 @@ def import_generators(self, generator_scenario=None, **kwargs):
keyword arguments.

"""
engine = kwargs["engine"] if "engine" in kwargs else egon_engine()
if self.legacy_grids is True:
generators_import.oedb_legacy(
edisgo_object=self, generator_scenario=generator_scenario, **kwargs
)
else:
generators_import.oedb(
edisgo_object=self,
engine=kwargs.get("engine", toep_engine()),
engine=engine,
scenario=generator_scenario,
)

Expand All @@ -1004,7 +1006,7 @@ def analyze(
Conducts a static, non-linear power flow analysis.

Conducts a static, non-linear power flow analysis using
`PyPSA <https://pypsa.readthedocs.io/en/latest/user-guide/power-flow.html#\
`PyPSA <https://docs.pypsa.org/v0.35.1/user-guide/power-flow.html#\
non-linear-power-flow>`_
and writes results (active, reactive and apparent power as well as
current on lines and voltages at buses) to :class:`~.network.results.Results`
Expand Down Expand Up @@ -1109,7 +1111,7 @@ def analyze(

References
--------
[1] https://pypsa.readthedocs.io/en/latest/troubleshooting.html
[1] https://docs.pypsa.org/v0.35.1/troubleshooting.html

"""

Expand Down Expand Up @@ -1846,9 +1848,11 @@ def _aggregate_time_series(attribute, groups, naming):
[
pd.DataFrame(
{
naming.format("_".join(k))
if isinstance(k, tuple)
else naming.format(k): getattr(self.timeseries, attribute)
(
naming.format("_".join(k))
if isinstance(k, tuple)
else naming.format(k)
): getattr(self.timeseries, attribute)
.loc[:, v]
.sum(axis=1)
}
Expand Down
24 changes: 12 additions & 12 deletions edisgo/io/pypsa_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def set_seed(edisgo_obj, pypsa_network):
"""
Set initial guess for the Newton-Raphson algorithm.

In `PyPSA <https://pypsa.readthedocs.io/en/latest/>`_ an
In `PyPSA <https://docs.pypsa.org/v0.35.1/>`_ an
initial guess for the Newton-Raphson algorithm used in the power flow
analysis can be provided to speed up calculations.
For PQ buses, which besides the slack bus, is the only bus type in
Expand Down Expand Up @@ -613,9 +613,9 @@ def _append_lv_components(
),
]
)
aggregated_elements[
lv_grid_name + "_fluctuating"
] = comps_fluct.index.values
aggregated_elements[lv_grid_name + "_fluctuating"] = (
comps_fluct.index.values
)

if len(comps_disp) > 0:
comps_aggr = pd.concat(
Expand All @@ -632,21 +632,21 @@ def _append_lv_components(
),
]
)
aggregated_elements[
lv_grid_name + "_dispatchable"
] = comps_disp.index.values
aggregated_elements[lv_grid_name + "_dispatchable"] = (
comps_disp.index.values
)
elif aggregate_generators == "all":
comps_aggr = pd.DataFrame(
{
"bus": [bus],
"control": ["PQ"],
"p_nom": [sum(comps.p_nom)],
"fluctuating": [
True
if (comps.type.isin(flucts)).all()
else False
if ~comps.type.isin(flucts).any()
else "Mixed"
(
True
if (comps.type.isin(flucts)).all()
else False if ~comps.type.isin(flucts).any() else "Mixed"
)
],
},
index=[lv_grid_name + "_generators"],
Expand Down
Loading
Loading