Skip to content

Commit

Permalink
Features/#261 emob tests (#289)
Browse files Browse the repository at this point in the history
Co-authored-by: Kilian Helfenbein <Kilian.Helfenbein@rl-institut.de>
Co-authored-by: birgits <birgit.schachler@rl-institut.de>
  • Loading branch information
3 people committed Sep 26, 2022
1 parent 3384af9 commit 1d26b82
Show file tree
Hide file tree
Showing 83 changed files with 16,851 additions and 68,865 deletions.
11 changes: 0 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ doc/_html

# exclude egg-info
eDisGo.egg-info/
/examples/Exemplary_PyPSA_bus_results.csv
/examples/Exemplary_PyPSA_line_results.csv

# exclude directories
/examples/edisgo2pypsa_export/*
/examples/data/
/examples/ding0_example_grid/

# exclude check scripts
/examples/compare_graphs.py
/examples/compare_pypsa_network.py

# exclude .json files in opf
/edisgo/opf/edisgo_scenario_data/*.json
Expand Down
2 changes: 1 addition & 1 deletion doc/equipment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The following tables hold all data of cables, lines and transformers used.
:file: ../edisgo/equipment/equipment-parameters_LV_cables.csv
:delim: ,
:header-rows: 2
:widths: 3, 1, 1, 1, 1
:widths: 3, 1, 1, 1, 1, 1
:stub-columns: 0

.. _mv_cables_table:
Expand Down
57 changes: 57 additions & 0 deletions doc/features_in_detail.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,63 @@ It is also possible to curtail specific generators internally, though a user fri
where :math:`c_{target,t}` is the given curtailment target (power) for timestep :math:`t` to be allocated
to the generators.

.. _electromobility-integration-label:

Electromobility integration
----------------------------

The import and integration of electromobility data is implemented in :py:func:`~edisgo.io.electromobility_import`.

Allocation of charging demand
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The allocation of charging processes to charging stations is implemented in
:py:func:`~edisgo.io.electromobility_import.distribute_charging_demand`.
After electromobility data is loaded, the charging demand from SimBEV is allocated to potential charging parks
from TracBEV. The allocation of the charging processes to the charging infrastructure is carried out with the
help of the weighting factor of the potential charging parks determined by TracBEV. This involves a random and
weighted selection of one charging park per charging process. In the case of private charging infrastructure, a
separate charging point is set up for each electric vehicle (EV). All charging processes of the respective EV and charging use case
are assigned to this charging point. The allocation of private charging processes to charging stations is
implemented in :py:func:`~edisgo.io.electromobility_import.distribute_private_charging_demand`.

For public charging infrastructure, the allocation is made explicitly per charging process. For each charging
process it is determined whether a suitable charging point is already available. For this purpose it is checked
whether the charging point is occupied by another EV in the corresponding period and whether it can provide the
corresponding charging capacity. If no suitable charging point is available, a charging point is determined
randomly and weighted in the same way as for private charging. The allocation of public charging processes to
charging stations is implemented in :py:func:`~edisgo.io.electromobility_import.distribute_public_charging_demand`.

.. _charging_strategies-label:

Charging strategies
^^^^^^^^^^^^^^^^^^^^^^^^

eDisGo right now provides three charging strategy methodologies called 'dumb', 'reduced' and 'residual', that
are implemented in :py:mod:`~edisgo.flex_opt.charging_strategies`.
The aim of the charging strategies 'reduced' and 'residual' is to generate the most grid-friendly charging behavior possible without
restricting the convenience for end users. Therefore, the boundary condition of all charging strategies is that
the charging requirement of each charging process must be fully covered. This means that charging processes can
only be flexibilised if the EV can be fully charged while it is stationary. Furthermore, only private
charging processes can be used as a flexibility, since the fulfillment of the service is the priority for public
charging processes.

'dumb'
""""""""""""""""""
In this charging strategy the cars are charged directly after arrival with the maximum possible charging capacity.

'reduced'
""""""""""""""""""
This is a preventive charging strategy. The cars are charged directly after arrival with the minimum possible
charging power. The minimum possible charging power is determined by the parking time and the parameter
minimum_charging_capacity_factor.

'residual'
""""""""""""""""""
This is an active charging strategy. The cars are charged when the residual load in the MV grid is lowest
(high generation and low consumption). Charging processes with a low flexibility are given priority.


.. _storage-integration-label:

Storage integration
Expand Down
18 changes: 2 additions & 16 deletions doc/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Getting started
Installation using Linux
-------------------------

.. warning:: Make sure to use python 3.7 or higher!
.. warning:: Make sure to use python 3.8 or higher!

Install latest eDisGo version through pip. Therefore, we highly recommend using
a virtual environment and its pip.
Expand All @@ -15,25 +15,13 @@ a virtual environment and its pip.
python -m pip install edisgo
The above will install all packages for the basic usage of eDisGo. To install
additional packages e.g. needed to create plots with background maps or to run
the jupyter notebook examples, we provide installation with extra packages:

.. code-block:: bash
python -m pip install edisgo[geoplot] # for plotting with background maps
python -m pip install edisgo[examples] # to run examples
python -m pip install edisgo[dev] # developer packages
python -m pip install edisgo[full] # combines all of the extras above
You may also consider installing a developer version as detailed in
:ref:`dev-notes`.

Installation using Windows
--------------------------

.. warning:: Make sure to use python 3.7 or higher!
.. warning:: Make sure to use python 3.8 or higher!

For Windows users we recommend using Anaconda and to install the geo stack
using the conda-forge channel prior to installing eDisGo. You may use the provided
Expand All @@ -50,8 +38,6 @@ Activate the newly created environment with:
conda activate eDisGo_env
This will install eDisGo with all it's dependencies ([full] flag).

Installation using MacOS
--------------------------

Expand Down
84 changes: 82 additions & 2 deletions doc/usage_details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ The charging strategies can be invoked as follows:
edisgo.apply_charging_strategy()
See :attr:`~.edisgo.EDisGo.apply_charging_strategy` for more information.
See function docstring of :attr:`~.edisgo.EDisGo.apply_charging_strategy` or
documentation section :ref:`charging_strategies-label` for more information.

Reactive power time series
^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -349,7 +350,86 @@ Further information on the grid reinforcement methodology can be found in sectio
Electromobility
-----------------

.. todo:: Add
Electromobility data including charging processes as well as information on potential charging sites and
integrated charging parks are stored in the
:class:`~.network.electromobility.Electromobility` object.

You can access these data as follows:

.. code-block:: python
# Access DataFrame with all SimBEV charging processes
edisgo.electromobility.charging_processes_df
# Access GeoDataFrame with all TracBEV potential charging parks
edisgo.electromobility.potential_charging_parks_gdf
# Access DataFrame with all charging parks that got integrated
edisgo.electromobility.integrated_charging_parks_df
The integrated charging points are also stored in the :class:`~.network.topology.Topology`
object and can be accessed as follows:

.. code-block:: python
# Access DataFrame with all integrated charging points.
edisgo.topology.charging_points_df
So far, adding electromobility data to an eDisGo object requires electromobility
data from `SimBEV <https://github.com/rl-institut/simbev>`_ (required version:
`3083c5a <https://github.com/rl-institut/simbev/commit/
86076c936940365587c9fba98a5b774e13083c5a>`_)
and `TracBEV <https://github.com/rl-institut/tracbev>`_ (required version:
`14d864c <https://github.com/rl-institut/tracbev/commit/
03e335655770a377166c05293a966052314d864c>`_) to be stored in the directories
specified through the parameters simbev_directory and tracbev_directory.
SimBEV provides data on standing times, charging demand, etc. per vehicle,
whereas TracBEV provides potential charging point locations.

.. todo:: Add information on how to retrieve SimBEV and TracBEV data

Here is a small example on how to import electromobility data and apply a
charging strategy. A more extensive example can be found in
the example jupyter notebook
`electromobility_example <https://github.com/openego/eDisGo/blob/dev/examples/electromobility_example.ipynb>`_.

.. code-block:: python
import pandas as pd
from edisgo import EDisGo
# Set up the EDisGo object
timeindex = pd.date_range("1/1/2011", periods=24*7, freq="H")
edisgo = EDisGo(
ding0_grid=dingo_grid_path,
timeindex=timeindex
)
edisgo.set_time_series_active_power_predefined(
fluctuating_generators_ts="oedb",
dispatchable_generators_ts=pd.DataFrame(
data=1, columns=["other"], index=timeindex),
conventional_loads_ts="demandlib",
)
edisgo.set_time_series_reactive_power_control()
# Resample edisgo timeseries to 15-minute resolution to match with SimBEV and
# TracBEV data
edisgo.resample_timeseries()
# Import electromobility data
edisgo.import_electromobility(
simbev_directory=simbev_path,
tracbev_directory=tracbev_path,
)
# Apply charging strategy
edisgo.apply_charging_strategy(strategy="dumb")
Further information on the electromobility integration methodology and the charging
strategies can be found in section :ref:`electromobility-integration-label`.


Battery storage systems
------------------------
Expand Down
2 changes: 2 additions & 0 deletions doc/whatsnew/v0-2-0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Changes
* added pre-commit hooks (flake8, black, isort, pyupgrade) `#229 <https://github.com/openego/eDisGo/pull/229>`_
* added issue and pull request templates `#220 <https://github.com/openego/eDisGo/issues/220>`_
* added Windows installation yml and documentation
* added automatic testing for Windows `#317 <https://github.com/openego/eDisGo/pull/317>`_
* dropped support for python 3.7
* added functionality to set up different loggers with individual logging levels and where to write output `#295 <https://github.com/openego/eDisGo/issues/295>`_
* added integrity checks of eDisGo object `#231 <https://github.com/openego/eDisGo/issues/231>`_
* added functionality to save to and load from zip archive `#216 <https://github.com/openego/eDisGo/pull/216>`_
Expand Down
79 changes: 52 additions & 27 deletions edisgo/edisgo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import copy
import logging
import os
import pickle
Expand Down Expand Up @@ -854,6 +855,7 @@ def reinforce(
max_while_iterations: int = 20,
combined_analysis: bool = False,
mode: str | None = None,
without_generator_import: bool = False,
**kwargs,
) -> Results:
"""
Expand All @@ -876,44 +878,67 @@ def reinforce(
"""
if kwargs.get("is_worst_case", self.timeseries.is_worst_case):

logger.info(
"Running reinforcement in worst-case mode by differentiating between mv"
" and lv load and feed-in cases."
logger.debug(
"Running reinforcement in worst-case mode by differentiating between "
"MV and LV load and feed-in cases."
)

if copy_grid:
edisgo_obj = copy.deepcopy(self)
else:
edisgo_obj = self

timeindex_worst_cases = self.timeseries.timeindex_worst_cases
timesteps_pfa = pd.DatetimeIndex(
timeindex_worst_cases.loc[
timeindex_worst_cases.index.str.contains("mv")
]
)
mode = "mv"

reinforce_grid(
if mode != "lv":

timesteps_pfa = pd.DatetimeIndex(
timeindex_worst_cases.loc[
timeindex_worst_cases.index.str.contains("mv")
]
)
reinforce_grid(
edisgo_obj,
max_while_iterations=max_while_iterations,
copy_grid=False,
timesteps_pfa=timesteps_pfa,
combined_analysis=combined_analysis,
mode="mv",
without_generator_import=without_generator_import,
)

if mode != "mv":
timesteps_pfa = pd.DatetimeIndex(
timeindex_worst_cases.loc[
timeindex_worst_cases.index.str.contains("lv")
]
)
reinforce_mode = mode if mode == "mvlv" else "lv"
reinforce_grid(
edisgo_obj,
max_while_iterations=max_while_iterations,
copy_grid=False,
timesteps_pfa=timesteps_pfa,
combined_analysis=combined_analysis,
mode=reinforce_mode,
without_generator_import=without_generator_import,
)

if mode not in ["mv", "lv"]:
edisgo_obj.analyze(mode=mode)
results = edisgo_obj.results

else:
results = reinforce_grid(
self,
max_while_iterations=max_while_iterations,
copy_grid=copy_grid,
timesteps_pfa=timesteps_pfa,
combined_analysis=combined_analysis,
mode=mode,
without_generator_import=without_generator_import,
)

timesteps_pfa = pd.DatetimeIndex(
timeindex_worst_cases.loc[
timeindex_worst_cases.index.str.contains("lv")
]
)
mode = "lv"

results = reinforce_grid(
self,
max_while_iterations=max_while_iterations,
copy_grid=copy_grid,
timesteps_pfa=timesteps_pfa,
combined_analysis=combined_analysis,
mode=mode,
)

# add measure to Results object
if not copy_grid:
self.results.measures = "grid_expansion"
Expand Down Expand Up @@ -1442,7 +1467,7 @@ def import_electromobility(
with any charging demand are imported. Any other input will lead
to all parking and driving events being imported. Default "frugal".
charging_processes_dir : str
Charging processes sub-directory. Default "simbev_run".
Charging processes sub-directory. Default None.
simbev_config_file : str
Name of the simbev config file. Default "metadata_simbev_run.json".
Expand Down

0 comments on commit 1d26b82

Please sign in to comment.