Skip to content

Commit

Permalink
Merge branch 'develop' into fix/#2234
Browse files Browse the repository at this point in the history
  • Loading branch information
gbanerjeefraunhofer authored Dec 18, 2024
2 parents 1f85bbf + af65ef7 commit 9a5787e
Show file tree
Hide file tree
Showing 58 changed files with 10,770 additions and 1,060 deletions.
166 changes: 74 additions & 92 deletions .github/workflows/github_test_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@ jobs:
steps:
- uses: actions/checkout@v4
#- uses: julia-actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-split
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install .["all"]
if ${{ matrix.python-version == '3.9' }}; then python -m pip install pypower; fi
if ${{ matrix.python-version != '3.9' }}; then python -m pip install numba; fi
if ${{ matrix.python-version == '3.10' }}; then python -m pip install lightsim2grid; fi
uv sync --all-extras
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
uv pip install pytest-split
if ${{ matrix.python-version == '3.9' }}; then uv pip install pypower; fi
if ${{ matrix.python-version != '3.9' }}; then uv pip install numba; fi
if ${{ matrix.python-version == '3.10' }}; then uv pip install lightsim2grid; fi
- name: List of installed packages
run: |
python -m pip list
uv pip list
- name: Test with pytest
if: ${{ matrix.python-version != '3.9' }}
run: |
python -m pytest --splits 2 --group ${{ matrix.group }}
uv run pytest --splits 2 --group ${{ matrix.group }}
- name: Test with pytest, Codecov and Coverage
if: ${{ matrix.python-version == '3.9' }}
run: |
python -m pip install pytest-cov
python -m pytest -n=auto --cov=./ --cov-report=xml --splits 2 --group ${{ matrix.group }}
uv pip install pytest-cov
uv run pytest -n=auto --cov=./ --cov-report=xml --splits 2 --group ${{ matrix.group }}
cp ./coverage.xml ./coverage-${{ matrix.group }}.xml
- name: Upload coverage as artifact
if: ${{ matrix.python-version == '3.9' }}
Expand All @@ -71,29 +71,27 @@ jobs:
steps:
- uses: actions/checkout@v4
#- uses: julia-actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-split
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install .["all"]
python -m pip install pypower
uv sync --all-extras
uv pip install pypower pytest-split
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
- name: Install Julia
run: |
./.install_julia.sh 1.10.4
python -m pip install julia
python ./.install_pycall.py
uv pip install julia
uv run python ./.install_pycall.py
- name: List of installed packages
run: |
python -m pip list
uv pip list
- name: Test with pytest, Codecov and Coverage
run: |
python -m pip install pytest-cov
python -m pytest -n=auto --cov=./ --cov-report=xml --splits 2 --group ${{ matrix.group }}
uv pip install pytest-cov
uv run pytest -n=auto --cov=./ --cov-report=xml --splits 2 --group ${{ matrix.group }}
cp ./coverage.xml ./coverage-${{ matrix.group }}.xml
upload-coverage:
Expand Down Expand Up @@ -137,22 +135,21 @@ jobs:
group: [ 1, 2 ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-split
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install .["all"]
uv sync --all-extras
uv pip install pytest-split
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
- name: List of installed packages
run: |
python -m pip list
uv pip list
- name: Test with pytest
run: |
python -m pytest -W error --splits 2 --group ${{ matrix.group }}
uv run pytest -W error --splits 2 --group ${{ matrix.group }}
relying: # packages that rely on pandapower
runs-on: ubuntu-latest
Expand All @@ -161,31 +158,30 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest setuptools
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install .
python -m pip install matplotlib
if ${{ matrix.python-version != '3.9' }}; then python -m pip install numba; fi
uv sync --extra test
uv pip install setuptools
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
uv pip install matplotlib
if ${{ matrix.python-version != '3.9' }}; then uv pip install numba; fi
- name: Install pandapipes and simbench
run: |
python -m pip install git+https://github.com/e2nIEE/pandapipes@develop#egg=pandapipes
python -m pip install git+https://github.com/e2nIEE/simbench@develop#egg=simbench
uv pip install git+https://github.com/e2nIEE/pandapipes@develop#egg=pandapipes
uv pip install git+https://github.com/e2nIEE/simbench@develop#egg=simbench
- name: List of installed packages
run: |
python -m pip list
uv pip list
- name: Test pandapipes
run: |
python -c 'from pandapipes import pp_dir; import pytest; import sys; ec = pytest.main([pp_dir]); sys.exit(ec)'
uv run python -c 'from pandapipes import pp_dir; import pytest; import sys; ec = pytest.main([pp_dir]); sys.exit(ec)'
- name: Test simbench
run: |
python -c 'from simbench import sb_dir; import pytest; import sys; ec = pytest.main([sb_dir]); sys.exit(ec)'
uv run python -c 'from simbench import sb_dir; import pytest; import sys; ec = pytest.main([sb_dir]); sys.exit(ec)'
linting:
# run flake8 and check for errors
Expand All @@ -197,28 +193,26 @@ jobs:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
python -m pip install .
python -m pip install matplotlib
uv sync
uv pip install flake8 matplotlib
- name: List of installed packages
run: |
python -m pip list
uv pip list
- name: Lint with flake8 (sytax errors and undefined names)
continue-on-error: true
run: |
# stop the build if there are Python syntax errors or undefined names (omitted by exit-zero)
flake8 . --count --exit-zero --select=E9,F63,F7,F82 --show-source --statistics
uv run flake8 . --exclude .venv --count --exit-zero --select=E9,F63,F7,F82 --show-source --statistics
- name: Lint with flake8 (all errors and warnings)
run: |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
uv run flake8 . --exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
postgresql:
# for the one test to cover postgresql
Expand All @@ -228,17 +222,16 @@ jobs:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test,fileio]
uv sync --extra test --extra fileio
- name: List of installed packages
run: |
python -m pip list
uv pip list
- name: Create PostgreSQL database
run: |
sudo systemctl start postgresql.service
Expand All @@ -249,72 +242,61 @@ jobs:
PGPASSWORD=secret psql --username=test_user --host=localhost --list sandbox
- name: Test pandapower File I/O
run: |
python -c "import os; import json; from pandapower import pp_dir; conn_data={'host': 'localhost', 'user': 'test_user', 'database': 'sandbox', 'password': 'secret', 'schema': 'test_schema'}; fp = open(os.path.join(pp_dir, 'test', 'test_files', 'postgresql_connect_data.json'), 'w'); json.dump(conn_data, fp); fp.close()"
python -c 'from pandapower import pp_dir; import pytest; import sys; import os; ec = pytest.main([os.path.join(pp_dir,"test","api","test_sql_io.py")]); sys.exit(ec)'
uv run python -c "import os; import json; from pandapower import pp_dir; conn_data={'host': 'localhost', 'user': 'test_user', 'database': 'sandbox', 'password': 'secret', 'schema': 'test_schema'}; fp = open(os.path.join(pp_dir, 'test', 'test_files', 'postgresql_connect_data.json'), 'w'); json.dump(conn_data, fp); fp.close()"
uv run python -c 'from pandapower import pp_dir; import pytest; import sys; import os; ec = pytest.main([os.path.join(pp_dir,"test","api","test_sql_io.py")]); sys.exit(ec)'
tutorial_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest nbmake pytest-xdist igraph numba seaborn
uv sync --all-extras
uv pip install seaborn
./.install_julia.sh 1.10.4
python -m pip install julia
python ./.install_pycall.py
python -m pip install jupyter
python -m pip install .["all"]
uv pip install julia seaborn jupyter
uv run python ./.install_pycall.py
- name: List all installed packages
run: |
python -m pip list
uv pip list
- name: Test with pytest
# Careful when copying this command. The PYTHONPATH setup is Linux specific syntax.
run: |
python -m pytest --nbmake -n=auto --nbmake-timeout=900 "./tutorials"
uv run pytest --nbmake -n=auto --nbmake-timeout=900 "./tutorials"
tutorial_warnings_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[all]
python -m pip install pytest nbmake pytest-xdist igraph numba seaborn
uv sync --all-extras
./.install_julia.sh 1.10.4
python -m pip install julia
python ./.install_pycall.py
uv pip install julia seaborn
uv run python ./.install_pycall.py
- name: List all installed packages
run: |
python -m pip list
uv pip list
- name: Test with pytest
run: |
python -m pytest -W error --nbmake -n=auto --nbmake-timeout=900 "./tutorials"
uv run pytest -W error --nbmake -n=auto --nbmake-timeout=900 "./tutorials"
docs_check:
name: Sphinx docs check
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9' ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check docs for Python ${{ matrix.python-version }}
uses: e2nIEE/sphinx-action@master
- name: Check sphinx build
uses: ammaraskar/[email protected]
with:
pre-build-command: "python -m pip install --upgrade pip;
python -m pip install .[docs];"
pre-build-command: "python -m pip install uv && uv pip install .[docs] --system --link-mode=copy"
build-command: "sphinx-build -b html . _build -W"
docs-folder: "doc/"
3 changes: 1 addition & 2 deletions .install_julia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ case $(uname) in
curl -L "$BASEURL/linux/$ARCH/$JULIANAME-$SUFFIX.tar.gz" | tar -xz
sudo ln -s $PWD/julia-*/bin/julia /usr/local/bin/julia
julia -e 'import Pkg; Pkg.add("PyCall");'
julia -e 'import Pkg; Pkg.add("PowerModels"); Pkg.add("Ipopt");'
julia -e 'import Pkg; Pkg.add("JSON"); Pkg.add("JuMP"); Pkg.add("Cbc"); Pkg.add("Juniper");'
julia -e 'import Pkg; Pkg.Registry.update(); Pkg.add("PandaModels"); Pkg.build(); Pkg.resolve();'
;;
Darwin)
if [ -e /usr/local/bin/julia ]; then
Expand Down
41 changes: 29 additions & 12 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
Change Log
=============

[2.14.11] - 2024-07-08
-------------------------------
- [FIXED] Lightsim2grid version

[2.14.10] - 2024-07-08
-------------------------------
- [FIXED] geopandas version

[2.14.9] - 2024-06-25
-------------------------------
- [FIXED] scipy version

[upcoming release] - 2024-..-..
-------------------------------
- [FIXED] cim2pp add missing description to dcline
- [ADDED] pandas series accessor for geo column
- [FIXED] Increasing geojson precision as the default precision might cause problems with pandahub
- [ADDED] converter for European EHV grid data from JAO, the "Single Allocation Platform (SAP) for all European Transmission System Operators (TSOs) that operate in accordance to EU legislation"
- [ADDED] Add GeographicalRegion and SubGeographicalRegion names and ids to bus df in cim converter
- [CHANGED] Capitalize first letter of columns busbar_id, busbar_name and substation_id in bus df for cim converter
- [FIXED] Do not modify pandas options when importing pandapower
- [FIXED] fixed copy-paste error in contingency results "max_limit_nminus1" and "min_limit_nminus1"
- [ADDED] improved lightsim2grid documentation including compatibitliy issues
- [FIXED] cim2pp: set default xml encoding to None to avoid error after changing to lxml
- [FIXED] PandaModels OPF with 'bus_dc' key errors
- [FIXED] julia tests
- [FIXED] copy array element to standard python scalar
- [FIXED] passing literal json to 'read_json' is deprecated
- [FIXED] replacing deprecated in1d with isin
- [ADDED] A switch to disable updating the vk and vkr values for trafo3w
- [FIXED] cast the column to the correct type before assigning values
Expand Down Expand Up @@ -81,9 +83,24 @@ Change Log
- [ADDED] Add VSC element, dc buses, dc lines, and hybrid AC/DC power flow calculation
- [CHANGED] accelerate _integrate_power_elements_connected_with_switch_buses() in get_equivalent()
- [CHANGED] accelerate distributed slack power flow calculation by using sparse-aware operations in _subnetworks()
- [CHANGED] Trafo Controllers can now be added to elements that are out of service, changed self.nothing_to_do()
- [ADDED] Discrete shunt controller for local voltage regulation with shunt steps
- [ADDED] fix lengths missmatch of output if ignore_zero_length is False in plotting utility function coords_from_node_geodata() and rename ignore_zero_length by ignore_no_geo_diff
- [ADDED] converter for European EHV grid data from JAO, the "Single Allocation Platform (SAP) for all European Transmission System Operators (TSOs) that operate in accordance to EU legislation"
- [ADDED] cim2pp converter: Using lxml to parse XML files (better performance)

[2.14.11] - 2024-07-08
-------------------------------
- [FIXED] Lightsim2grid version

[2.14.10] - 2024-07-08
-------------------------------
- [FIXED] geopandas version

[2.14.9] - 2024-06-25
-------------------------------
- [FIXED] scipy version

[2.14.7] - 2024-06-14
-------------------------------
- [ADDED] added PathPatch TextPatch and Affine2D imports needed for ward and xward patches
Expand Down
1 change: 1 addition & 0 deletions doc/converter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ These tools are:
converter/matpower
converter/powerfactory
converter/cgmes
converter/jao

9 changes: 9 additions & 0 deletions doc/converter/jao.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Documentation for the JAO Static Grid Model Converter Function
==============================================================

The ``from_jao`` function allows users to convert the Static Grid Model provided by JAO (Joint Allocation Office) into a pandapower network by reading and processing the provided Excel and HTML files.

Function Overview
-----------------

.. autofunction:: pandapower.converter.from_jao
Loading

0 comments on commit 9a5787e

Please sign in to comment.