Skip to content

Commit

Permalink
Merge pull request #18 from e2nIEE/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
SteffenMeinecke authored Nov 26, 2021
2 parents 15c9760 + 393fe80 commit eca679b
Show file tree
Hide file tree
Showing 33 changed files with 265 additions and 199 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/github_test_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: simbench

on:
push:
branches: '*'
paths-ignore:
- 'CHANGELOG.rst'
pull_request:
branches: '*'
paths-ignore:
- 'CHANGELOG.rst'

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']

steps:
- uses: actions/checkout@v2
#- uses: julia-actions/setup-julia@v1.5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if ${{ matrix.python-version == '3.7' }}; then python -m pip install pypower; fi
if ${{ matrix.python-version == '3.6' || matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' }}; then python -m pip install matplotlib; fi
pip install .["all"]
- name: List of installed packages
run: |
pip list
- name: Test with pytest
if: ${{ matrix.python-version != '3.8' }}
run: |
pytest
- name: Test with pytest and Codecov
if: ${{ matrix.python-version == '3.8' }}
run: |
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: ${{ matrix.python-version == '3.8' }}
uses: codecov/codecov-action@v1
with:
verbose: true
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 by University of Kassel, TU Dortmund, RWTH Aachen University and Fraunhofer Institute for Energy Economics and Energy System Technology (IEE) Kassel and the following individual contributors list.
Copyright (c) 2019-2021 by University of Kassel, TU Dortmund, RWTH Aachen University and Fraunhofer Institute for Energy Economics and Energy System Technology (IEE) Kassel and the following individual contributors list.
All rights reserved.

Lead Developer:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
Change Log
=============

[1.3.0] - 2021-11-25
----------------------

- [CHANGED] use GitHub-Ci instead of Travis-CI and update CI to python 3.8 and 3.9
- [CHANGED] adapt to pandas changes of version 1.2.0: deprecate |&^ as set operations for Index
- [CHANGED] generalize (elm, col) recognizing in profiles dicts
- [CHANGED] output type of get_applied_profiles() and get_available_profiles() from list to set
- [ADDED] filter_unapplied_profiles_pp(), get_unused_profiles()
[1.2.0] - 2020-09-29
----------------------

- [CHANGED] Storage profiles with curtailment and self-consumption; ChargeLevel and EStore of storages
- [FIXED] PowerPlantProfiles: add missing hour at time change
- [FIXED] adapt to pandapower changes: import unsupplied_buses()

[1.1.0] - 2020-05-07
----------------------
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 by University of Kassel, TU Dortmund, RWTH Aachen University and Fraunhofer Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual contributors (see AUTHORS file for details).
Copyright (c) 2019-2021 by University of Kassel, TU Dortmund, RWTH Aachen University and Fraunhofer Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual contributors (see AUTHORS file for details).
All rights reserved.


Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include LICENSE AUTHORS README.rst requirements.txt CHANGELOG.rst .travis.yml
include LICENSE AUTHORS README.rst CHANGELOG.rst .github/**/*.yml
global-include *.csv
global-include *.json
global-include *.json
global-include *.txt
10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
:target: http://simbench.readthedocs.io/?badge=stable
:alt: Documentation Status

.. image:: https://travis-ci.org/e2nIEE/simbench.svg?branch=master
:target: https://travis-ci.org/e2nIEE/simbench/branches
:alt: travis
.. image:: https://github.com/e2nIEE/simbench/actions/workflows/github_test_action.yml/badge.svg
:target: https://github.com/e2nIEE/simbench/actions/
:alt: GitHub Actions

.. image:: https://codecov.io/gh/e2nIEE/simbench/branch/master/graph/badge.svg
:target: https://codecov.io/github/e2nIEE/simbench?branch=master
:alt: codecov

.. image:: https://pepy.tech/badge/simbench
:target: https://pepy.tech/project/simbench
:alt: pepy

.. image:: https://img.shields.io/badge/License-ODbL-brightgreen.svg
:target: https://opendatacommons.org/licenses/odbl
:alt: ODbL
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
# built documents.
#
# The short X.Y version.
version = "1.2.0"
version = "1.3.0"
# The full version, including alpha/beta/rc tags.
release = "1.2.0"
release = "1.3.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
32 changes: 22 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Copyright (c) 2015-2019 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

from setuptools import setup, find_packages
import re

with open('README.rst', 'rb') as f:
install = f.read().decode('utf-8')

with open('CHANGELOG.rst', 'rb') as f:
changelog = f.read().decode('utf-8')

with open('README.rst', 'rb') as f:
readme = f.read().decode('utf-8')

classifiers=[
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
Expand All @@ -17,23 +24,28 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3']
with open('.travis.yml', 'rb') as f:
with open('.github/workflows/github_test_action.yml', 'rb') as f:
lines = f.read().decode('utf-8')
for version in re.findall('python: 3.[0-9]', lines):
classifiers.append('Programming Language :: Python :: 3.%s'%version[-1])
versions = set(re.findall('3.[0-9]', lines))
for version in versions:
classifiers.append('Programming Language :: Python :: 3.%s' % version[-1])

long_description = '\n\n'.join((install, changelog))

setup(
name='simbench',
version='1.2.0',
version='1.3.0',
author='Steffen Meinecke',
author_email='steffen.meinecke@uni-kassel.de',
description='Electrical Power System Benchmark Models',
long_description=readme,
long_description_content_type="text/x-rst",
url='http://www.simbench.de/en',
license='odbl',
install_requires=["pandapower>=2.2"],
extras_require = {"docs": ["numpydoc", "sphinx", "sphinx_rtd_theme"]},
install_requires=["pandapower>=2.5"],
extras_require={"docs": ["numpydoc", "sphinx", "sphinx_rtd_theme"],
"all": ["numpydoc", "sphinx", "sphinx_rtd_theme"]},
packages=find_packages(),
include_package_data=True,
classifiers = classifiers
classifiers=classifiers
)
6 changes: 2 additions & 4 deletions simbench/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

__version__ = "1.2.0"
__version__ = "1.3.0"
__author__ = "smeinecke"

import os
Expand Down
4 changes: 1 addition & 3 deletions simbench/converter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

Expand Down
15 changes: 4 additions & 11 deletions simbench/converter/auxiliary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

Expand Down Expand Up @@ -190,16 +188,11 @@ def _get_unique_duplicated_dict(df, subset=None):
dupl = df.index[df.duplicated(subset=subset)]
uniq = df.index[~df.duplicated(subset=subset)]
uniq_dupl_dict = {}
# nan_str only needed since compare_arrays() using old numpy versions connected to python 3.4
# don't detect reliably nans as equal
nan_str = "nan"
while nan_str in df.values:
nan_str += "n"

for uni in uniq:
do_dupl_fit = compare_arrays(
np.repeat(df.loc[uni, subset].fillna(nan_str).values.reshape(1, -1), len(dupl), axis=0),
df.loc[dupl, subset].fillna(nan_str).values).all(axis=1)
np.repeat(df.loc[uni, subset].values.reshape(1, -1), len(dupl), axis=0),
df.loc[dupl, subset].values).all(axis=1)
uniq_dupl_dict[uni] = list(dupl[do_dupl_fit])
return uniq_dupl_dict

Expand Down Expand Up @@ -261,7 +254,7 @@ def append_str_by_underline_count(str_series, append_only_duplicates=False, coun
# --- initalizations
# ensure only unique values in reserved_strings:
reserved_strings = pd.Series(sorted(set(reserved_strings))) if reserved_strings is not None \
else pd.Series()
else pd.Series(dtype=object)
count = counting_start

# --- do first append
Expand Down
4 changes: 1 addition & 3 deletions simbench/converter/csv_data_manipulation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

Expand Down
18 changes: 8 additions & 10 deletions simbench/converter/csv_pp_converter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

Expand Down Expand Up @@ -387,7 +385,7 @@ def _convert_measurement(data):
"Transformer"]["id"])].astype(int)
idx_line = data["Measurement"].index[data["Measurement"]["element"].isin(data[
"Line"]["id"])].astype(int)
idx_bus = data["Measurement"].index.difference(idx_line | idx_trafo).astype(int)
idx_bus = data["Measurement"].index.difference(idx_line.union(idx_trafo)).astype(int)
n_no_element2_info = data["Measurement"]["element"].isnull().sum()
if n_no_element2_info != len(idx_bus):
logger.warning("%i Measurement have no element2 info, but " % n_no_element2_info +
Expand Down Expand Up @@ -465,13 +463,13 @@ def _csv_types_to_pp1(net, csv_data):
# --- splitting Line table into a table with dcline data and line data
idx_lines = csv_data["Line"].index[csv_data["Line"].type.isin(csv_data["LineType"].id)]
idx_dclines = csv_data["Line"].index[csv_data["Line"].type.isin(csv_data["DCLineType"].id)]
missing = csv_data["Line"].index.difference(idx_lines | idx_dclines)
missing = csv_data["Line"].index.difference(idx_lines.union(idx_dclines))
if len(missing):
raise ValueError("In Line table, the types of these line indices misses in LineType and " +
"DCLineType table: " + str(list(missing)))
if len(idx_lines & idx_dclines):
if len(idx_lines.intersection(idx_dclines)):
raise ValueError("In Line table, the types of these line indices occur in LineType and " +
"DCLineType table: " + str(list(idx_lines & idx_dclines)))
"DCLineType table: " + str(list(idx_lines.intersection(idx_dclines))))
csv_data["Line*line"] = csv_data["Line"].loc[idx_lines]
csv_data["Line*dcline"] = csv_data["Line"].loc[idx_dclines]

Expand Down Expand Up @@ -637,7 +635,7 @@ def _multi_parameter_determination(data):
# trafo3w type
table = "Transformer3WType"
for vkr, sR, pCu in zip(vkr_3w, sR_3w, pCu_3w):
data[table][vkr] = 100 * data[table][pCu] / (data[table][sR] * sb2pp_base())
data[table][vkr] = 100 * data[table][pCu] / (data[table][sR]*1e3)


def _convert_elements_and_types(input_data, output_data):
Expand Down Expand Up @@ -826,10 +824,10 @@ def _merge_dcline_and_storage_type_and_element_data(input_data):
Type_col_except_std_type = input_data[corr_str_type].columns.difference(["std_type"])
if version.parse(pd.__version__) >= version.parse("0.21.0"):
input_data[corr_str] = input_data[corr_str].reindex(
columns=input_data[corr_str].columns | Type_col_except_std_type)
columns=input_data[corr_str].columns.union(Type_col_except_std_type))
else:
input_data[corr_str] = input_data[corr_str].reindex_axis(
input_data[corr_str].columns | Type_col_except_std_type, axis=1)
input_data[corr_str].columns.union(Type_col_except_std_type), axis=1)
input_data[corr_str].loc[:, Type_col_except_std_type] = input_data[corr_str_type].loc[
idx_type, Type_col_except_std_type].values
input_data[corr_str_type].drop(input_data[corr_str_type].index, inplace=True)
Expand Down
10 changes: 5 additions & 5 deletions simbench/converter/format_information.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Copyright (c) 2019-2021 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.

Expand All @@ -19,7 +17,7 @@

def sb2pp_base(variable="power"):
""" converting factor from simbench data structure to pandapower:
power: simbench in MVA - pandapower in kVA
power: simbench in MVA - pandapower in MVA (former in kVA)
current: simbench in A, pandapower in kA
"""
if variable == "power":
Expand Down Expand Up @@ -248,11 +246,13 @@ def _csv_pp_column_correspondings(tablename):
# ("dVaHV", "xxxxxxxx", None), ("dVaMV", "xxxxxxxx", None),
# ("dVaLV", "xxxxxxxx", None),
# ("tapNeutrMV", "xxxxxxxx", None), ("tapNeutrLV", "xxxxxxxx", None),
("tapMinHV", "tap_min", None), ("tapMaxHV", "tap_max", None)
("tapMinHV", "tap_min", None), ("tapMaxHV", "tap_max", None),
# ("tapMinMV", "xxxxxxxx", None), ("tapMinLV", "xxxxxxxx", None),
# ("tapMaxMV", "xxxxxxxx", None), ("tapMaxLV", "xxxxxxxx", None)
# cosidered by _add_vm_va_setpoints_to_buses() and _add_phys_type_and_vm_va_setpoints_to_generation_element_tables():
# ("vmSetp", "vm_pu", None), ("vaSetp", "va:degree", None),
# slack_weight
("dspf", "slack_weight", None)
]

# --- add "pLoad", "qLoad" respectively "pPP", "qPP" or others, according to tablename
Expand Down
Loading

0 comments on commit eca679b

Please sign in to comment.