From f9afc06848d247bc3b9e85ff9e074b0fa273c96e Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 12:52:03 +0200 Subject: [PATCH 01/38] Snapshot CI Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/snapshot-ci.yml | 303 ++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 .github/workflows/snapshot-ci.yml diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml new file mode 100644 index 000000000..0c4ee71ec --- /dev/null +++ b/.github/workflows/snapshot-ci.yml @@ -0,0 +1,303 @@ +name: Snapshot CI + +on: + push: + branches: + - '*' + +jobs: + manylinux_build: + name: Build linux ${{ matrix.python.name }} wheel + runs-on: ubuntu-latest + container: quay.io/pypa/manylinux2014_x86_64:2022-11-01-e47a7a6 + strategy: + matrix: + python: + - { + name: cp38, + abi: cp38, + version: '3.8', + } + + steps: + - name: Install Linux packages + run: yum install -y rh-maven33-maven zlib-devel.x86_64 + + - name: Enable Maven + run: source scl_source enable rh-maven33 + + - name: Setup GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: '22.2.0' + java-version: '11' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout core sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-core + ref: main + path: powsybl-core + + - name: Build and install core + run: | + mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install + echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout olf sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-open-loadflow + ref: main + path: powsybl-open-loadflow + + - name: Build and install olf + run: | + mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install + echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout sld sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-single-line-diagram + ref: main + path: powsybl-single-line-diagram + + - name: Build and install sld + run: | + mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install + echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout dynawo sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-dynawo + ref: main + path: powsybl-dynawo + + - name: Build and install dynawo + run: | + mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install + echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout entsoe sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-entsoe + ref: main + path: powsybl-entsoe + + - name: Build and install entsoe + run: | + mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install + echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout dependencies sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-dependencies + path: powsybl-dependencies + + - name: Build and install dependencies + run: | + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-sld.version -DnewVersion=${{ env.SLD_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=${{ env.DYNAWO_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=${{ env.ENTSOE_MAVEN_PROJECT_VERSION }} + mvn --batch-mode -DskipTests=true --file powsybl-dependencies/pom.xml install + echo "DEP_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dependencies/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout sources + uses: actions/checkout@v3 + with: + submodules: true + + - name: Change PowSyBl dependencies version + working-directory: ./java + run: | + mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} + + - name: Setup path + run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH + + - name: Install dependencies + run: pip3 install -r requirements.txt + + - name: Build wheel + run: | + python3 setup.py bdist_wheel + auditwheel repair dist/*.whl + + - name: Install wheel + run: pip3 install wheelhouse/*.whl --user + + - name: Run tests + working-directory: ./tests # Run in subdir to use installed lib, not sources + run: | + pytest + + - name: Type checking + run: mypy -p pypowsybl + + - name: Run doc examples + working-directory: ./docs + run: make doctest + + - name: Upload wheel + uses: actions/upload-artifact@v3 + with: + name: pypowsybl-wheel-linux-${{ matrix.python.name }} + path: wheelhouse/*.whl + + macos_windows_build: + name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel + runs-on: ${{ matrix.config.os }} + strategy: + matrix: + config: + - { + name: darwin, + os: macos-11, + } + - { + name: windows, + os: windows-2019, + } + python: + - { + name: cp38, + version: '3.8', + } + + steps: + - name: Setup GraalVM + uses: graalvm/setup-graalvm@v1 + with: + version: '22.2.0' + java-version: '11' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout core sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-core + ref: main + path: powsybl-core + + - name: Build and install core + run: | + mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install + echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout olf sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-open-loadflow + ref: main + path: powsybl-open-loadflow + + - name: Build and install olf + run: | + mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install + echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout sld sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-single-line-diagram + ref: main + path: powsybl-single-line-diagram + + - name: Build and install sld + run: | + mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install + echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout dynawo sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-dynawo + ref: main + path: powsybl-dynawo + + - name: Build and install dynawo + run: | + mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install + echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout entsoe sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-entsoe + ref: main + path: powsybl-entsoe + + - name: Build and install entsoe + run: | + mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install + echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout dependencies sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-dependencies + path: powsybl-dependencies + + - name: Build and install dependencies + run: | + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-sld.version -DnewVersion=${{ env.SLD_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=${{ env.DYNAWO_MAVEN_PROJECT_VERSION }} + mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=${{ env.ENTSOE_MAVEN_PROJECT_VERSION }} + mvn --batch-mode -DskipTests=true --file powsybl-dependencies/pom.xml install + echo "DEP_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dependencies/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Checkout sources + uses: actions/checkout@v3 + with: + submodules: true + + - name: Change PowSyBl dependencies version + working-directory: ./java + run: | + mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python.version }} + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Build wheel + env: + MACOSX_DEPLOYMENT_TARGET: "10.16" # to ensure pip finds wheel when Big Sur is configured to return 10.16 as version instead of 11.0 + run: python setup.py bdist_wheel + + - name: Install wheel + shell: bash + run: python -m pip install dist/*.whl --user + + - name: Run tests + working-directory: ./tests + run: python3 -m pytest + + - name: Type checking + run: mypy -p pypowsybl + + - name: Run doc examples + working-directory: ./docs + run: make doctest + + - name: Upload wheel + uses: actions/upload-artifact@v3 + with: + name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} + path: dist/*.whl From ededaecbfdedb1fc9f41b502a89d3abde9235b23 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 13:05:45 +0200 Subject: [PATCH 02/38] Fix Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/snapshot-ci.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index 0c4ee71ec..15327dced 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -23,9 +23,6 @@ jobs: - name: Install Linux packages run: yum install -y rh-maven33-maven zlib-devel.x86_64 - - name: Enable Maven - run: source scl_source enable rh-maven33 - - name: Setup GraalVM uses: graalvm/setup-graalvm@v1 with: @@ -42,7 +39,9 @@ jobs: path: powsybl-core - name: Build and install core + shell: bash run: | + source scl_source enable rh-maven33 mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -54,7 +53,9 @@ jobs: path: powsybl-open-loadflow - name: Build and install olf + shell: bash run: | + source scl_source enable rh-maven33 mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -66,7 +67,9 @@ jobs: path: powsybl-single-line-diagram - name: Build and install sld + shell: bash run: | + source scl_source enable rh-maven33 mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -78,7 +81,9 @@ jobs: path: powsybl-dynawo - name: Build and install dynawo + shell: bash run: | + source scl_source enable rh-maven33 mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -90,7 +95,9 @@ jobs: path: powsybl-entsoe - name: Build and install entsoe + shell: bash run: | + source scl_source enable rh-maven33 mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -101,7 +108,9 @@ jobs: path: powsybl-dependencies - name: Build and install dependencies + shell: bash run: | + source scl_source enable rh-maven33 mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-sld.version -DnewVersion=${{ env.SLD_MAVEN_PROJECT_VERSION }} @@ -117,7 +126,9 @@ jobs: - name: Change PowSyBl dependencies version working-directory: ./java + shell: bash run: | + source scl_source enable rh-maven33 mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} - name: Setup path @@ -127,7 +138,9 @@ jobs: run: pip3 install -r requirements.txt - name: Build wheel + shell: bash run: | + source scl_source enable rh-maven33 python3 setup.py bdist_wheel auditwheel repair dist/*.whl @@ -180,6 +193,7 @@ jobs: java-version: '11' components: 'native-image' github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout core sources uses: actions/checkout@v3 with: From e32aa2d70835ca815774cf14d0b1371208baeaf0 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 13:11:20 +0200 Subject: [PATCH 03/38] Fix Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/snapshot-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index 15327dced..eecb02776 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -41,7 +41,7 @@ jobs: - name: Build and install core shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -55,7 +55,7 @@ jobs: - name: Build and install olf shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -69,7 +69,7 @@ jobs: - name: Build and install sld shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -83,7 +83,7 @@ jobs: - name: Build and install dynawo shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -97,7 +97,7 @@ jobs: - name: Build and install entsoe shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -110,7 +110,7 @@ jobs: - name: Build and install dependencies shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-sld.version -DnewVersion=${{ env.SLD_MAVEN_PROJECT_VERSION }} @@ -128,7 +128,7 @@ jobs: working-directory: ./java shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} - name: Setup path @@ -140,7 +140,7 @@ jobs: - name: Build wheel shell: bash run: | - source scl_source enable rh-maven33 + . /opt/rh/rh-maven33/enable python3 setup.py bdist_wheel auditwheel repair dist/*.whl From 9b8dda6e5637625aece2617c38b0413571638062 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 13:23:36 +0200 Subject: [PATCH 04/38] Fix Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/snapshot-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml index eecb02776..3e17ff951 100644 --- a/.github/workflows/snapshot-ci.yml +++ b/.github/workflows/snapshot-ci.yml @@ -202,6 +202,7 @@ jobs: path: powsybl-core - name: Build and install core + shell: bash run: | mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -214,6 +215,7 @@ jobs: path: powsybl-open-loadflow - name: Build and install olf + shell: bash run: | mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -226,6 +228,7 @@ jobs: path: powsybl-single-line-diagram - name: Build and install sld + shell: bash run: | mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -238,6 +241,7 @@ jobs: path: powsybl-dynawo - name: Build and install dynawo + shell: bash run: | mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -250,6 +254,7 @@ jobs: path: powsybl-entsoe - name: Build and install entsoe + shell: bash run: | mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV @@ -261,6 +266,7 @@ jobs: path: powsybl-dependencies - name: Build and install dependencies + shell: bash run: | mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} @@ -276,6 +282,7 @@ jobs: submodules: true - name: Change PowSyBl dependencies version + shell: bash working-directory: ./java run: | mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} From 2fc5666564bcaeda7a7d94fe0f71024416d624a5 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 13:49:43 +0200 Subject: [PATCH 05/38] Fix Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 37 +++- .github/workflows/snapshot-ci.yml | 324 ------------------------------ java/pom.xml | 8 + 3 files changed, 43 insertions(+), 326 deletions(-) delete mode 100644 .github/workflows/snapshot-ci.yml diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 209ca952b..ec5de0638 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -33,6 +33,17 @@ jobs: components: 'native-image' github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout olf sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-open-loadflow + ref: fix_svc_inf + path: powsybl-open-loadflow + + - name: Build and install olf + shell: bash + run: scl enable rh-maven33 'mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install' + - name: Checkout sources uses: actions/checkout@v3 with: @@ -86,6 +97,12 @@ jobs: working-directory: ./docs run: make doctest + - name: Upload wheel + uses: actions/upload-artifact@v3 + with: + name: pypowsybl-wheel-linux-${{ matrix.python.name }} + path: wheelhouse/*.whl + macos_windows_build: name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel runs-on: ${{ matrix.config.os }} @@ -102,8 +119,8 @@ jobs: } python: - { - name: cp38, - version: '3.8', + name: cp39, + version: '3.9', } steps: @@ -115,6 +132,16 @@ jobs: components: 'native-image' github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout olf sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-open-loadflow + ref: fix_svc_inf + path: powsybl-open-loadflow + + - name: Build and install olf + run: mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install + - name: Checkout sources uses: actions/checkout@v3 with: @@ -149,3 +176,9 @@ jobs: - name: Run doc examples working-directory: ./docs run: make doctest + + - name: Upload wheel + uses: actions/upload-artifact@v3 + with: + name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} + path: dist/*.whl diff --git a/.github/workflows/snapshot-ci.yml b/.github/workflows/snapshot-ci.yml deleted file mode 100644 index 3e17ff951..000000000 --- a/.github/workflows/snapshot-ci.yml +++ /dev/null @@ -1,324 +0,0 @@ -name: Snapshot CI - -on: - push: - branches: - - '*' - -jobs: - manylinux_build: - name: Build linux ${{ matrix.python.name }} wheel - runs-on: ubuntu-latest - container: quay.io/pypa/manylinux2014_x86_64:2022-11-01-e47a7a6 - strategy: - matrix: - python: - - { - name: cp38, - abi: cp38, - version: '3.8', - } - - steps: - - name: Install Linux packages - run: yum install -y rh-maven33-maven zlib-devel.x86_64 - - - name: Setup GraalVM - uses: graalvm/setup-graalvm@v1 - with: - version: '22.2.0' - java-version: '11' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Checkout core sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-core - ref: main - path: powsybl-core - - - name: Build and install core - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install - echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout olf sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-open-loadflow - ref: main - path: powsybl-open-loadflow - - - name: Build and install olf - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install - echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout sld sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-single-line-diagram - ref: main - path: powsybl-single-line-diagram - - - name: Build and install sld - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install - echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout dynawo sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-dynawo - ref: main - path: powsybl-dynawo - - - name: Build and install dynawo - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install - echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout entsoe sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-entsoe - ref: main - path: powsybl-entsoe - - - name: Build and install entsoe - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install - echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout dependencies sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-dependencies - path: powsybl-dependencies - - - name: Build and install dependencies - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-sld.version -DnewVersion=${{ env.SLD_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=${{ env.DYNAWO_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=${{ env.ENTSOE_MAVEN_PROJECT_VERSION }} - mvn --batch-mode -DskipTests=true --file powsybl-dependencies/pom.xml install - echo "DEP_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dependencies/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout sources - uses: actions/checkout@v3 - with: - submodules: true - - - name: Change PowSyBl dependencies version - working-directory: ./java - shell: bash - run: | - . /opt/rh/rh-maven33/enable - mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} - - - name: Setup path - run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH - - - name: Install dependencies - run: pip3 install -r requirements.txt - - - name: Build wheel - shell: bash - run: | - . /opt/rh/rh-maven33/enable - python3 setup.py bdist_wheel - auditwheel repair dist/*.whl - - - name: Install wheel - run: pip3 install wheelhouse/*.whl --user - - - name: Run tests - working-directory: ./tests # Run in subdir to use installed lib, not sources - run: | - pytest - - - name: Type checking - run: mypy -p pypowsybl - - - name: Run doc examples - working-directory: ./docs - run: make doctest - - - name: Upload wheel - uses: actions/upload-artifact@v3 - with: - name: pypowsybl-wheel-linux-${{ matrix.python.name }} - path: wheelhouse/*.whl - - macos_windows_build: - name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel - runs-on: ${{ matrix.config.os }} - strategy: - matrix: - config: - - { - name: darwin, - os: macos-11, - } - - { - name: windows, - os: windows-2019, - } - python: - - { - name: cp38, - version: '3.8', - } - - steps: - - name: Setup GraalVM - uses: graalvm/setup-graalvm@v1 - with: - version: '22.2.0' - java-version: '11' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Checkout core sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-core - ref: main - path: powsybl-core - - - name: Build and install core - shell: bash - run: | - mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install - echo "CORE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-core/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout olf sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-open-loadflow - ref: main - path: powsybl-open-loadflow - - - name: Build and install olf - shell: bash - run: | - mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install - echo "OLF_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-open-loadflow/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout sld sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-single-line-diagram - ref: main - path: powsybl-single-line-diagram - - - name: Build and install sld - shell: bash - run: | - mvn --batch-mode -DskipTests=true --file powsybl-single-line-diagram/pom.xml install - echo "SLD_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-single-line-diagram/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout dynawo sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-dynawo - ref: main - path: powsybl-dynawo - - - name: Build and install dynawo - shell: bash - run: | - mvn --batch-mode -DskipTests=true --file powsybl-dynawo/pom.xml install - echo "DYNAWO_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dynawo/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout entsoe sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-entsoe - ref: main - path: powsybl-entsoe - - - name: Build and install entsoe - shell: bash - run: | - mvn --batch-mode -DskipTests=true --file powsybl-entsoe/pom.xml install - echo "ENTSOE_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-entsoe/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout dependencies sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-dependencies - path: powsybl-dependencies - - - name: Build and install dependencies - shell: bash - run: | - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=${{ env.OLF_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-sld.version -DnewVersion=${{ env.SLD_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=${{ env.DYNAWO_MAVEN_PROJECT_VERSION }} - mvn --file powsybl-dependencies/pom.xml --batch-mode versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=${{ env.ENTSOE_MAVEN_PROJECT_VERSION }} - mvn --batch-mode -DskipTests=true --file powsybl-dependencies/pom.xml install - echo "DEP_MAVEN_PROJECT_VERSION=$(mvn help:evaluate --file powsybl-dependencies/pom.xml -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Checkout sources - uses: actions/checkout@v3 - with: - submodules: true - - - name: Change PowSyBl dependencies version - shell: bash - working-directory: ./java - run: | - mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=${{ env.DEP_MAVEN_PROJECT_VERSION }} - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python.version }} - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - - - name: Build wheel - env: - MACOSX_DEPLOYMENT_TARGET: "10.16" # to ensure pip finds wheel when Big Sur is configured to return 10.16 as version instead of 11.0 - run: python setup.py bdist_wheel - - - name: Install wheel - shell: bash - run: python -m pip install dist/*.whl --user - - - name: Run tests - working-directory: ./tests - run: python3 -m pytest - - - name: Type checking - run: mypy -p pypowsybl - - - name: Run doc examples - working-directory: ./docs - run: make doctest - - - name: Upload wheel - uses: actions/upload-artifact@v3 - with: - name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }} - path: dist/*.whl diff --git a/java/pom.xml b/java/pom.xml index b2e8d005e..46f1ecf46 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -75,6 +75,7 @@ 3.10.1 3.2.4 2023.1.1 + 1.2.0-SNAPSHOT @@ -168,6 +169,13 @@ + + + com.powsybl + powsybl-open-loadflow + ${powsybl-open-loadflow.version} + + com.powsybl powsybl-dependencies From c75184eed950fc2b187358ac39c62ad34cc4a12d Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 15:45:18 +0200 Subject: [PATCH 06/38] Fix Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index ec5de0638..1b21f6dfb 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -103,6 +103,7 @@ jobs: name: pypowsybl-wheel-linux-${{ matrix.python.name }} path: wheelhouse/*.whl + macos_windows_build: name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel runs-on: ${{ matrix.config.os }} From f635bc120a09d9a5f736e87f6d27dd072470ca2c Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 16:27:55 +0200 Subject: [PATCH 07/38] Fix Signed-off-by: Geoffroy Jamgotchian --- tests/test_security_analysis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_security_analysis.py b/tests/test_security_analysis.py index 1822d1773..275b21349 100644 --- a/tests/test_security_analysis.py +++ b/tests/test_security_analysis.py @@ -92,13 +92,13 @@ def test_monitored_elements(): assert bus_results.index.to_frame().columns.tolist() == ['contingency_id', 'voltage_level_id', 'bus_id'] assert bus_results.columns.tolist() == ['v_mag', 'v_angle'] - assert len(bus_results) == 2 + assert len(bus_results) == 3 assert bus_results.loc['', 'VLHV2', 'NHV2']['v_mag'] == pytest.approx(389.95, abs=1e-2) assert bus_results.loc['NHV1_NHV2_1', 'VLHV2', 'NHV2']['v_mag'] == pytest.approx(366.58, abs=1e-2) assert branch_results.index.to_frame().columns.tolist() == ['contingency_id', 'branch_id'] assert branch_results.columns.tolist() == ['p1', 'q1', 'i1', 'p2', 'q2', 'i2', 'flow_transfer'] - assert len(branch_results) == 2 + assert len(branch_results) == 4 assert branch_results.loc['', 'NHV1_NHV2_2']['p1'] == pytest.approx(302.44, abs=1e-2) assert branch_results.loc['NHV1_NHV2_1', 'NHV1_NHV2_2']['p1'] == pytest.approx(610.56, abs=1e-2) From 98a8750e724ee14f02549e66cbaca3b7bc65c977 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 9 May 2023 20:33:27 +0200 Subject: [PATCH 08/38] Fix Signed-off-by: Geoffroy Jamgotchian --- docs/user_guide/security.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/user_guide/security.rst b/docs/user_guide/security.rst index 21961981c..5008b45a6 100644 --- a/docs/user_guide/security.rst +++ b/docs/user_guide/security.rst @@ -70,14 +70,17 @@ Information can be obtained on buses, branches and three windings transformers. >>> security_analysis.add_precontingency_monitored_elements(branch_ids=['NHV1_NHV2_2']) >>> results = security_analysis.run_ac(network) >>> results.bus_results - v_mag v_angle + v_mag v_angle contingency_id voltage_level_id bus_id VLHV2 NHV2 389.95 -3.51 + NGEN_NHV1 VLHV2 NHV2 569.04 -1.71 NHV1_NHV2_1 VLHV2 NHV2 366.58 -7.50 >>> results.branch_results p1 q1 i1 p2 q2 i2 flow_transfer contingency_id branch_id NHV1_NHV2_2 302.44 98.74 456.77 -300.43 -137.19 488.99 NaN + NGEN_NHV1 NHV1_NHV2_1 301.06 0.00 302.80 -300.19 -116.60 326.75 NaN + NHV1_NHV2_2 301.06 0.00 302.80 -300.19 -116.60 326.75 NaN NHV1_NHV2_1 NHV1_NHV2_2 610.56 334.06 1,008.93 -601.00 -285.38 1,047.83 NaN From 108d526b0d93363b646b343e563f6f1086c93ce4 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Wed, 7 Jun 2023 22:03:43 +0200 Subject: [PATCH 09/38] Migrate to PowSyBl 2023.2.0 Signed-off-by: Geoffroy Jamgotchian --- java/pom.xml | 2 +- .../extensions/MergedXnodeDataframeAdder.java | 115 ------------------ .../MergedXnodeDataframeProvider.java | 91 -------------- .../extensions/XnodeDataframeAdder.java | 66 ---------- .../extensions/XnodeDataframeProvider.java | 78 ------------ .../python/dynamic/DynamicModelMapper.java | 31 ++--- .../powsybl/python/dynamic/EventSupplier.java | 20 ++- .../network/PyPowsyblNetworksProvider.java | 2 +- .../adders/NetworkElementAddersTest.java | 65 ---------- java/src/test/resources/nad.svg | 2 +- tests/battery.xiidm | 2 +- tests/test_loadflow.py | 6 +- tests/test_network.py | 2 +- tests/test_network_extensions.py | 54 -------- tests/test_security_analysis.py | 7 +- 15 files changed, 34 insertions(+), 509 deletions(-) delete mode 100644 java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeAdder.java delete mode 100644 java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeProvider.java delete mode 100644 java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeAdder.java delete mode 100644 java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeProvider.java diff --git a/java/pom.xml b/java/pom.xml index aa8fcc5b4..a44aee127 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -74,7 +74,7 @@ 3.2.0 3.10.1 3.2.4 - 2023.1.1 + 2023.2.0-SNAPSHOT diff --git a/java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeAdder.java b/java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeAdder.java deleted file mode 100644 index 58cbe32bb..000000000 --- a/java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeAdder.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) 2022, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.dataframe.network.extensions; - -import com.powsybl.commons.PowsyblException; -import com.powsybl.dataframe.SeriesMetadata; -import com.powsybl.dataframe.network.adders.AbstractSimpleAdder; -import com.powsybl.dataframe.network.adders.SeriesUtils; -import com.powsybl.dataframe.update.DoubleSeries; -import com.powsybl.dataframe.update.StringSeries; -import com.powsybl.dataframe.update.UpdatingDataframe; -import com.powsybl.entsoe.util.MergedXnodeAdder; -import com.powsybl.iidm.network.Line; -import com.powsybl.iidm.network.Network; - -import java.util.Collections; -import java.util.List; - -/** - * @author Christian Biasuzzi - */ -public class MergedXnodeDataframeAdder extends AbstractSimpleAdder { - - private static final List METADATA = List.of( - SeriesMetadata.stringIndex("id"), - SeriesMetadata.stringIndex("code"), - SeriesMetadata.stringIndex("line1"), - SeriesMetadata.stringIndex("line2"), - SeriesMetadata.doubles("r_dp"), - SeriesMetadata.doubles("x_dp"), - SeriesMetadata.doubles("g1_dp"), - SeriesMetadata.doubles("b1_dp"), - SeriesMetadata.doubles("g2_dp"), - SeriesMetadata.doubles("b2_dp"), - SeriesMetadata.doubles("p1"), - SeriesMetadata.doubles("q1"), - SeriesMetadata.doubles("p2"), - SeriesMetadata.doubles("q2") - ); - - @Override - public List> getMetadata() { - return Collections.singletonList(METADATA); - } - - private static class MergedXnodeSeries { - - private final StringSeries id; - private final StringSeries code; - private final StringSeries line1; - private final StringSeries line2; - private final DoubleSeries rDp; - private final DoubleSeries xDp; - private final DoubleSeries g1Dp; - private final DoubleSeries b1Dp; - private final DoubleSeries g2Dp; - private final DoubleSeries b2Dp; - private final DoubleSeries p1; - private final DoubleSeries q1; - private final DoubleSeries p2; - private final DoubleSeries q2; - - MergedXnodeSeries(UpdatingDataframe dataframe) { - this.id = dataframe.getStrings("id"); - this.code = dataframe.getStrings("code"); - this.line1 = dataframe.getStrings("line1"); - this.line2 = dataframe.getStrings("line2"); - this.rDp = dataframe.getDoubles("r_dp"); - this.xDp = dataframe.getDoubles("x_dp"); - this.g1Dp = dataframe.getDoubles("g1_dp"); - this.b1Dp = dataframe.getDoubles("b1_dp"); - this.g2Dp = dataframe.getDoubles("g2_dp"); - this.b2Dp = dataframe.getDoubles("b2_dp"); - this.p1 = dataframe.getDoubles("p1"); - this.q1 = dataframe.getDoubles("q1"); - this.p2 = dataframe.getDoubles("p2"); - this.q2 = dataframe.getDoubles("q2"); - } - - void create(Network network, int row) { - String id = this.id.get(row); - Line l = network.getLine(id); - if (l == null) { - throw new PowsyblException("Invalid line id : could not find " + id); - } - var adder = l.newExtension(MergedXnodeAdder.class); - SeriesUtils.applyIfPresent(code, row, adder::withCode); - SeriesUtils.applyIfPresent(line1, row, adder::withLine1Name); - SeriesUtils.applyIfPresent(line2, row, adder::withLine2Name); - SeriesUtils.applyIfPresent(rDp, row, adder::withRdp); - SeriesUtils.applyIfPresent(xDp, row, adder::withXdp); - SeriesUtils.applyIfPresent(g1Dp, row, adder::withG1dp); - SeriesUtils.applyIfPresent(b1Dp, row, adder::withB1dp); - SeriesUtils.applyIfPresent(g2Dp, row, adder::withG2dp); - SeriesUtils.applyIfPresent(b2Dp, row, adder::withB2dp); - SeriesUtils.applyIfPresent(p1, row, adder::withXnodeP1); - SeriesUtils.applyIfPresent(q1, row, adder::withXnodeQ1); - SeriesUtils.applyIfPresent(p2, row, adder::withXnodeP2); - SeriesUtils.applyIfPresent(q2, row, adder::withXnodeQ2); - adder.add(); - } - } - - @Override - public void addElements(Network network, UpdatingDataframe dataframe) { - MergedXnodeSeries series = new MergedXnodeSeries(dataframe); - for (int row = 0; row < dataframe.getRowCount(); row++) { - series.create(network, row); - } - } -} diff --git a/java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeProvider.java b/java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeProvider.java deleted file mode 100644 index cd79f160c..000000000 --- a/java/src/main/java/com/powsybl/dataframe/network/extensions/MergedXnodeDataframeProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) 2021-2022, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.dataframe.network.extensions; - -import com.google.auto.service.AutoService; -import com.powsybl.commons.PowsyblException; -import com.powsybl.dataframe.network.ExtensionInformation; -import com.powsybl.dataframe.network.NetworkDataframeMapper; -import com.powsybl.dataframe.network.NetworkDataframeMapperBuilder; -import com.powsybl.dataframe.network.adders.NetworkElementAdder; -import com.powsybl.entsoe.util.MergedXnode; -import com.powsybl.iidm.network.Line; -import com.powsybl.iidm.network.Network; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Stream; - -/** - * @author Sylvain Leclerc - */ -@AutoService(NetworkExtensionDataframeProvider.class) -public class MergedXnodeDataframeProvider extends AbstractSingleDataframeNetworkExtension { - - @Override - public String getExtensionName() { - return MergedXnode.NAME; - } - - @Override - public ExtensionInformation getExtensionInformation() { - return new ExtensionInformation(MergedXnode.NAME, "Provides information about the border point between 2 TSOs on a merged line", - "index : id (str), code (str), line1 (str), line2 (str), r_dp (float), x_dp (float), g1_dp (float), b1_dp (float), " + - "g2_dp (float), b2_dp (float), p1 (float), q1 (float), p2 (float), q2 (float)"); - } - - private Stream itemsStream(Network network) { - return network.getLineStream() - .map(s -> (MergedXnode) s.getExtension(MergedXnode.class)) - .filter(Objects::nonNull); - } - - private MergedXnode getOrThrow(Network network, String id) { - Line line = network.getLine(id); - if (line == null) { - throw new PowsyblException("Line '" + id + "' not found"); - } - MergedXnode mxn = line.getExtension(MergedXnode.class); - if (mxn == null) { - throw new PowsyblException("Line '" + id + "' has no MergedXnode extension"); - } - return mxn; - } - - @Override - public NetworkDataframeMapper createMapper() { - return NetworkDataframeMapperBuilder.ofStream(this::itemsStream, this::getOrThrow) - .stringsIndex("id", ext -> ext.getExtendable().getId()) - .strings("code", MergedXnode::getCode, MergedXnode::setCode) - .strings("line1", MergedXnode::getLine1Name, MergedXnode::setLine1Name) - .strings("line2", MergedXnode::getLine2Name, MergedXnode::setLine2Name) - .doubles("r_dp", MergedXnode::getRdp, MergedXnode::setRdp) - .doubles("x_dp", MergedXnode::getXdp, MergedXnode::setXdp) - .doubles("g1_dp", MergedXnode::getG1dp, MergedXnode::setG1dp) - .doubles("b1_dp", MergedXnode::getB1dp, MergedXnode::setB1dp) - .doubles("g2_dp", MergedXnode::getG2dp, MergedXnode::setG2dp) - .doubles("b2_dp", MergedXnode::getB2dp, MergedXnode::setB2dp) - .doubles("p1", MergedXnode::getXnodeP1, MergedXnode::setXnodeP1) - .doubles("q1", MergedXnode::getXnodeQ1, MergedXnode::setXnodeQ1) - .doubles("p2", MergedXnode::getXnodeP2, MergedXnode::setXnodeP2) - .doubles("q2", MergedXnode::getXnodeQ2, MergedXnode::setXnodeQ2) - .build(); - } - - @Override - public void removeExtensions(Network network, List ids) { - ids.stream().filter(Objects::nonNull) - .map(id -> network.getLine(id)) - .filter(Objects::nonNull) - .forEach(g -> g.removeExtension(MergedXnode.class)); - } - - @Override - public NetworkElementAdder createAdder() { - return new MergedXnodeDataframeAdder(); - } -} diff --git a/java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeAdder.java b/java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeAdder.java deleted file mode 100644 index fcc7fb3cd..000000000 --- a/java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeAdder.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2022, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.dataframe.network.extensions; - -import com.powsybl.commons.PowsyblException; -import com.powsybl.dataframe.SeriesMetadata; -import com.powsybl.dataframe.network.adders.AbstractSimpleAdder; -import com.powsybl.dataframe.network.adders.SeriesUtils; -import com.powsybl.dataframe.update.StringSeries; -import com.powsybl.dataframe.update.UpdatingDataframe; -import com.powsybl.entsoe.util.XnodeAdder; -import com.powsybl.iidm.network.DanglingLine; -import com.powsybl.iidm.network.Network; - -import java.util.Collections; -import java.util.List; - -/** - * @author Christian Biasuzzi - */ -public class XnodeDataframeAdder extends AbstractSimpleAdder { - - private static final List METADATA = List.of( - SeriesMetadata.stringIndex("id"), - SeriesMetadata.strings("code") - ); - - @Override - public List> getMetadata() { - return Collections.singletonList(METADATA); - } - - private static class XnodeSeries { - - private final StringSeries id; - private final StringSeries code; - - XnodeSeries(UpdatingDataframe dataframe) { - this.id = dataframe.getStrings("id"); - this.code = dataframe.getStrings("code"); - } - - void create(Network network, int row) { - String id = this.id.get(row); - DanglingLine l = network.getDanglingLine(id); - if (l == null) { - throw new PowsyblException("Invalid dangling line id : could not find " + id); - } - var adder = l.newExtension(XnodeAdder.class); - SeriesUtils.applyIfPresent(code, row, adder::withCode); - adder.add(); - } - } - - @Override - public void addElements(Network network, UpdatingDataframe dataframe) { - XnodeSeries series = new XnodeSeries(dataframe); - for (int row = 0; row < dataframe.getRowCount(); row++) { - series.create(network, row); - } - } -} diff --git a/java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeProvider.java b/java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeProvider.java deleted file mode 100644 index 5ad2ed334..000000000 --- a/java/src/main/java/com/powsybl/dataframe/network/extensions/XnodeDataframeProvider.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) 2021-2022, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.dataframe.network.extensions; - -import com.google.auto.service.AutoService; -import com.powsybl.commons.PowsyblException; -import com.powsybl.dataframe.network.ExtensionInformation; -import com.powsybl.dataframe.network.NetworkDataframeMapper; -import com.powsybl.dataframe.network.NetworkDataframeMapperBuilder; -import com.powsybl.dataframe.network.adders.NetworkElementAdder; -import com.powsybl.entsoe.util.Xnode; -import com.powsybl.iidm.network.DanglingLine; -import com.powsybl.iidm.network.Network; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Stream; - -/** - * @author Sylvain Leclerc - */ -@AutoService(NetworkExtensionDataframeProvider.class) -public class XnodeDataframeProvider extends AbstractSingleDataframeNetworkExtension { - - @Override - public String getExtensionName() { - return Xnode.NAME; - } - - @Override - public ExtensionInformation getExtensionInformation() { - return new ExtensionInformation(Xnode.NAME, "Provides information about the border point of a TSO on a dangling line", - "index : id (str), code (str)"); - } - - private Stream itemsStream(Network network) { - return network.getDanglingLineStream() - .map(s -> (Xnode) s.getExtension(Xnode.class)) - .filter(Objects::nonNull); - } - - private Xnode getOrThrow(Network network, String id) { - DanglingLine line = network.getDanglingLine(id); - if (line == null) { - throw new PowsyblException("DanglingLine '" + id + "' not found"); - } - Xnode xn = line.getExtension(Xnode.class); - if (xn == null) { - throw new PowsyblException("DanglingLine '" + id + "' has no Xnode extension"); - } - return xn; - } - - @Override - public NetworkDataframeMapper createMapper() { - return NetworkDataframeMapperBuilder.ofStream(this::itemsStream, this::getOrThrow) - .stringsIndex("id", ext -> ext.getExtendable().getId()) - .strings("code", Xnode::getCode, Xnode::setCode) - .build(); - } - - @Override - public void removeExtensions(Network network, List ids) { - ids.stream().filter(Objects::nonNull) - .map(id -> network.getDanglingLine(id)) - .filter(Objects::nonNull) - .forEach(g -> g.removeExtension(Xnode.class)); - } - - @Override - public NetworkElementAdder createAdder() { - return new XnodeDataframeAdder(); - } -} diff --git a/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java b/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java index 6b2eec7f0..a6e017047 100644 --- a/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java +++ b/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java @@ -7,34 +7,25 @@ */ package com.powsybl.python.dynamic; -import java.util.LinkedList; -import java.util.List; -import java.util.function.Supplier; -import java.util.stream.Collectors; - import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; -import com.powsybl.dynawaltz.models.automatons.CurrentLimitAutomaton; -import com.powsybl.dynawaltz.models.generators.GeneratorSynchronous; -import com.powsybl.dynawaltz.models.loads.LoadAlphaBeta; -import com.powsybl.dynawaltz.models.loads.LoadOneTransformer; -import com.powsybl.dynawaltz.models.utils.SideConverter; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.Network; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; +import java.util.stream.Collectors; + /** * @author Nicolas Pierre */ public class DynamicModelMapper implements DynamicModelsSupplier { - private LinkedList> dynamicModelList; - - public DynamicModelMapper() { - dynamicModelList = new LinkedList<>(); - } + private final List> dynamicModelList = new ArrayList<>(); public List get(Network network) { - return dynamicModelList.stream().map(supplier -> supplier.get()).collect(Collectors.toList()); + return dynamicModelList.stream().map(Supplier::get).collect(Collectors.toList()); } /** @@ -43,7 +34,7 @@ public List get(Network network) { * @param staticId also determines the dynamic id of the element */ public void addAlphaBetaLoad(String staticId, String parametersIds) { - dynamicModelList.add(() -> new LoadAlphaBeta(staticId, staticId, parametersIds)); +// dynamicModelList.add(() -> new LoadAlphaBeta(staticId, staticId, parametersIds)); } /** @@ -52,11 +43,11 @@ public void addAlphaBetaLoad(String staticId, String parametersIds) { * @param staticId also determines the dynamic id of the element */ public void addOneTransformerLoad(String staticId, String parametersIds) { - dynamicModelList.add(() -> new LoadOneTransformer(staticId, staticId, parametersIds)); +// dynamicModelList.add(() -> new LoadOneTransformer(staticId, staticId, parametersIds)); } public void addGeneratorSynchronous(String staticId, String parametersIds, String generatorLib) { - dynamicModelList.add(() -> new GeneratorSynchronous(staticId, staticId, parametersIds, generatorLib)); +// dynamicModelList.add(() -> new GeneratorSynchronous(staticId, staticId, parametersIds, generatorLib)); } public void addGeneratorSynchronousThreeWindings(String staticId, String parametersIds) { @@ -76,7 +67,7 @@ public void addGeneratorSynchronousFourWindingsProportionalRegulations(String st } public void addCurrentLimitAutomaton(String staticId, String parametersIds, Branch.Side side) { - dynamicModelList.add(() -> new CurrentLimitAutomaton(staticId, staticId, parametersIds, SideConverter.convert(side))); +// dynamicModelList.add(() -> new CurrentLimitAutomaton(staticId, staticId, parametersIds, SideConverter.convert(side))); } } diff --git a/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java b/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java index cf8db005e..93550985c 100644 --- a/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java +++ b/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java @@ -7,17 +7,15 @@ */ package com.powsybl.python.dynamic; +import com.powsybl.dynamicsimulation.EventModel; +import com.powsybl.dynamicsimulation.EventModelsSupplier; +import com.powsybl.iidm.network.Network; + import java.util.LinkedList; import java.util.List; import java.util.function.Supplier; import java.util.stream.Collectors; -import com.powsybl.dynamicsimulation.EventModel; -import com.powsybl.dynamicsimulation.EventModelsSupplier; -import com.powsybl.dynawaltz.models.events.EventQuadripoleDisconnection; -import com.powsybl.dynawaltz.models.events.EventSetPointBoolean; -import com.powsybl.iidm.network.Network; - /** * @author Nicolas Pierre */ @@ -36,8 +34,8 @@ public EventSupplier() { */ public void addEventBranchDisconnection(String eventModelId, String staticId, double eventTime, boolean disconnectOrigin, boolean disconnectExtremity) { - this.eventSupplierList.add(() -> new EventQuadripoleDisconnection(eventModelId, staticId, eventTime, - disconnectOrigin, disconnectExtremity)); +// this.eventSupplierList.add(() -> new EventQuadripoleDisconnection(eventModelId, staticId, eventTime, +// disconnectOrigin, disconnectExtremity)); } /** @@ -46,12 +44,12 @@ public void addEventBranchDisconnection(String eventModelId, String staticId, do * The event represent the disconnection of the given generator */ public void addEventSetPointBoolean(String eventModelId, String staticId, double eventTime, boolean stateEvent) { - this.eventSupplierList - .add(() -> new EventSetPointBoolean(eventModelId, staticId, eventTime, stateEvent)); +// this.eventSupplierList +// .add(() -> new EventSetPointBoolean(eventModelId, staticId, eventTime, stateEvent)); } @Override public List get(Network network) { - return eventSupplierList.stream().map(supplier -> supplier.get()).collect(Collectors.toList()); + return eventSupplierList.stream().map(Supplier::get).collect(Collectors.toList()); } } diff --git a/java/src/main/java/com/powsybl/python/network/PyPowsyblNetworksProvider.java b/java/src/main/java/com/powsybl/python/network/PyPowsyblNetworksProvider.java index e914b8924..a37b32ee1 100644 --- a/java/src/main/java/com/powsybl/python/network/PyPowsyblNetworksProvider.java +++ b/java/src/main/java/com/powsybl/python/network/PyPowsyblNetworksProvider.java @@ -6,7 +6,7 @@ import com.powsybl.ieeecdf.converter.IeeeCdfNetworkFactory; import com.powsybl.iidm.network.Importer; import com.powsybl.iidm.network.Network; -import com.powsybl.iidm.network.extensions.FourSubstationsNodeBreakerWithExtensionsFactory; +import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerWithExtensionsFactory; import com.powsybl.iidm.network.impl.NetworkFactoryImpl; import com.powsybl.iidm.network.test.*; diff --git a/java/src/test/java/com/powsybl/dataframe/network/adders/NetworkElementAddersTest.java b/java/src/test/java/com/powsybl/dataframe/network/adders/NetworkElementAddersTest.java index 07f14ae81..097df1ac9 100644 --- a/java/src/test/java/com/powsybl/dataframe/network/adders/NetworkElementAddersTest.java +++ b/java/src/test/java/com/powsybl/dataframe/network/adders/NetworkElementAddersTest.java @@ -10,8 +10,6 @@ import com.powsybl.dataframe.update.*; import com.powsybl.entsoe.util.EntsoeArea; import com.powsybl.entsoe.util.EntsoeGeographicalCode; -import com.powsybl.entsoe.util.MergedXnode; -import com.powsybl.entsoe.util.Xnode; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.extensions.*; import com.powsybl.iidm.network.test.*; @@ -379,26 +377,6 @@ void hvdcOperatorActivePowerRangeExtension() { assertEquals(oprFromCS2toCS1, extension.getOprFromCS2toCS1()); } - @Test - void xnodeExtension() { - var network = DanglingLineNetworkFactory.create(); - String lId = "DL"; - String code = "XXXXXX11"; - - DanglingLine l = network.getDanglingLine(lId); - Xnode extension = l.getExtension(Xnode.class); - assertNull(extension); - - DefaultUpdatingDataframe dataframe = new DefaultUpdatingDataframe(1); - addStringColumn(dataframe, "id", lId); - addStringColumn(dataframe, "code", code); - NetworkElementAdders.addExtensions("xnode", network, singletonList(dataframe)); - - extension = l.getExtension(Xnode.class); - assertNotNull(extension); - assertEquals(code, extension.getCode()); - } - @Test void generatorEntsoeCategoryExtension() { var network = EurostagTutorialExample1Factory.create(); @@ -419,49 +397,6 @@ void generatorEntsoeCategoryExtension() { assertEquals(code, extension.getCode()); } - @Test - void mergedXnodeExtension() { - var network = EurostagTutorialExample1Factory.create(); - String lId = "NHV1_NHV2_1"; - - Line l = network.getLine(lId); - MergedXnode extension = l.getExtension(MergedXnode.class); - assertNull(extension); - - DefaultUpdatingDataframe dataframe = new DefaultUpdatingDataframe(1); - addStringColumn(dataframe, "id", lId); - addStringColumn(dataframe, "code", "XXXXXX11"); - addStringColumn(dataframe, "line1", ""); - addStringColumn(dataframe, "line2", ""); - addDoubleColumn(dataframe, "r_dp", 0.5); - addDoubleColumn(dataframe, "x_dp", 0.75); - addDoubleColumn(dataframe, "g1_dp", 0.46); - addDoubleColumn(dataframe, "b1_dp", 0.27); - addDoubleColumn(dataframe, "g2_dp", 0.47); - addDoubleColumn(dataframe, "b2_dp", 0.44); - addDoubleColumn(dataframe, "p1", 1.0); - addDoubleColumn(dataframe, "q1", 2.0); - addDoubleColumn(dataframe, "p2", 1.5); - addDoubleColumn(dataframe, "q2", 2.5); - NetworkElementAdders.addExtensions("mergedXnode", network, singletonList(dataframe)); - - extension = l.getExtension(MergedXnode.class); - assertNotNull(extension); - assertEquals("XXXXXX11", extension.getCode()); - assertEquals("", extension.getLine1Name()); - assertEquals("", extension.getLine2Name()); - assertEquals(0.5, extension.getRdp()); - assertEquals(0.75, extension.getXdp()); - assertEquals(0.46, extension.getG1dp()); - assertEquals(0.27, extension.getB1dp()); - assertEquals(0.47, extension.getG2dp()); - assertEquals(0.44, extension.getB2dp()); - assertEquals(1.0, extension.getXnodeP1()); - assertEquals(2.0, extension.getXnodeQ1()); - assertEquals(1.5, extension.getXnodeP2()); - assertEquals(2.5, extension.getXnodeQ2()); - } - @Test void entsoeAreaExtension() { var network = EurostagTutorialExample1Factory.create(); diff --git a/java/src/test/resources/nad.svg b/java/src/test/resources/nad.svg index cfcd6aad8..4130ba675 100644 --- a/java/src/test/resources/nad.svg +++ b/java/src/test/resources/nad.svg @@ -8,7 +8,7 @@ .nad-vl-nodes .nad-busnode {fill: var(--nad-vl-color, lightgrey)} .nad-vl-nodes circle.nad-unknown-busnode {stroke: var(--nad-vl-color, #808080); stroke-width: 5; stroke-dasharray: 5,5; fill: none} .nad-hvdc-edge polyline.nad-hvdc {stroke: grey; stroke-width: 40} -.nad-dangling-line-edge {stroke: var(--nad-vl-color, lightgrey); stroke-width: 1; fill: none} +.nad-branch-edges .nad-tie-line-edge .nad-edge-path {stroke-width: 7} .nad-pst-arrow {stroke: #6a6a6a; stroke-width: 4; stroke-linecap: round; fill: none} .nad-state-out .nad-arrow-in {visibility: hidden} .nad-state-in .nad-arrow-out {visibility: hidden} diff --git a/tests/battery.xiidm b/tests/battery.xiidm index d826c3f38..dee87885c 100644 --- a/tests/battery.xiidm +++ b/tests/battery.xiidm @@ -1,5 +1,5 @@ - + diff --git a/tests/test_loadflow.py b/tests/test_loadflow.py index 3ab0b4e76..edfb64bba 100644 --- a/tests/test_loadflow.py +++ b/tests/test_loadflow.py @@ -227,13 +227,15 @@ def test_get_provider_parameters_names(): 'mostMeshedSlackBusSelectorMaxNominalVoltagePercentile', 'reportedFeatures', 'slackBusCountryFilter', - 'actionableSwitchesIds' + 'actionableSwitchesIds', + 'asymmetrical', + 'minNominalVoltageTargetVoltageCheck' ] def test_get_provider_parameters(): specific_parameters = pp.loadflow.get_provider_parameters('OpenLoadFlow') - assert 43 == len(specific_parameters) + assert 45 == len(specific_parameters) assert 'Slack bus selection mode' == specific_parameters['description']['slackBusSelectionMode'] assert 'STRING' == specific_parameters['type']['slackBusSelectionMode'] assert 'MOST_MESHED' == specific_parameters['default']['slackBusSelectionMode'] diff --git a/tests/test_network.py b/tests/test_network.py index 06951f21c..92899ea23 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -135,7 +135,7 @@ def test_get_import_parameters(): def test_get_export_parameters(): parameters = pp.network.get_export_parameters('CGMES') - assert 8 == len(parameters) + assert 9 == len(parameters) name = 'iidm.export.cgmes.cim-version' assert name == parameters.index.tolist()[1] assert 'CIM version to export' == parameters['description'][name] diff --git a/tests/test_network_extensions.py b/tests/test_network_extensions.py index 6b1e2be40..08238fd88 100644 --- a/tests/test_network_extensions.py +++ b/tests/test_network_extensions.py @@ -69,56 +69,6 @@ def test_create_extensions(): assert generators_extensions['droop']['GEN2'] == pytest.approx(1.3, abs=1e-3) -def test_merged_xnode(): - network = pn.load(str(DATA_DIR / 'uxTestGridForMerging.uct')) - merged_x_nodes = network.get_extensions('mergedXnode') - x = merged_x_nodes.loc['BBBBBB11 XXXXXX11 1 + FFFFFF11 XXXXXX11 1'] - assert x.code == 'XXXXXX11' - assert (x.line1, x.line2) == ('BBBBBB11 XXXXXX11 1', 'FFFFFF11 XXXXXX11 1') - assert (x.r_dp, x.x_dp, x.g1_dp, x.g2_dp, x.b1_dp, x.b2_dp) == (0.5, 0.5, 0.5, 0.5, 0.5, 0.5) - - network.update_extensions('mergedXnode', id='BBBBBB11 XXXXXX11 1 + FFFFFF11 XXXXXX11 1', code='XXXXXX15', - line1='BBBBBB11 XXXXXX11 1', line2='FFFFFF11 XXXXXX11 1', - r_dp=0.6, x_dp=0.6, g1_dp=0.6, g2_dp=0.6, b1_dp=0.6, b2_dp=0.6, - p1=0, q1=0, p2=0, q2=0) - x = network.get_extensions('mergedXnode').loc['BBBBBB11 XXXXXX11 1 + FFFFFF11 XXXXXX11 1'] - assert x.code == 'XXXXXX15' - assert (x.line1, x.line2) == ('BBBBBB11 XXXXXX11 1', 'FFFFFF11 XXXXXX11 1') - assert (x.r_dp, x.x_dp, x.g1_dp, x.g2_dp, x.b1_dp, x.b2_dp) == (0.6, 0.6, 0.6, 0.6, 0.6, 0.6) - assert (x.p1, x.q1, x.p2, x.q2) == (0, 0, 0, 0) - - network.remove_extensions('mergedXnode', ['BBBBBB11 XXXXXX11 1 + FFFFFF11 XXXXXX11 1', - 'BBBBBB11 XXXXXX12 1 + FFFFFF11 XXXXXX12 1']) - assert network.get_extensions('mergedXnode').empty - - network.create_extensions('mergedXnode', id='BBBBBB11 XXXXXX11 1 + FFFFFF11 XXXXXX11 1', code='XXXXXX11', - line1='BBBBBB11 XXXXXX11 1', line2='FFFFFF11 XXXXXX11 1', - r_dp=0.4, x_dp=0.4, g1_dp=0.4, g2_dp=0.4, b1_dp=0.4, b2_dp=0.4, - p1=0, q1=0, p2=0, q2=0) - x = network.get_extensions('mergedXnode').loc['BBBBBB11 XXXXXX11 1 + FFFFFF11 XXXXXX11 1'] - assert x.code == 'XXXXXX11' - assert (x.line1, x.line2) == ('BBBBBB11 XXXXXX11 1', 'FFFFFF11 XXXXXX11 1') - assert (x.r_dp, x.x_dp, x.g1_dp, x.g2_dp, x.b1_dp, x.b2_dp) == (0.4, 0.4, 0.4, 0.4, 0.4, 0.4) - assert (x.p1, x.q1, x.p2, x.q2) == (0, 0, 0, 0) - - -def test_xnode(): - network = pn.load(str(DATA_DIR / 'simple-eu-xnode.uct')) - x = network.get_extensions('xnode').loc['NNL2AA1 XXXXXX11 1'] - assert x.code == 'XXXXXX11' - - network.update_extensions('xnode', id='NNL2AA1 XXXXXX11 1', code='XXXXXX12') - e = network.get_extensions('xnode').loc['NNL2AA1 XXXXXX11 1'] - assert e.code == 'XXXXXX12' - - network.remove_extensions('xnode', ['NNL2AA1 XXXXXX11 1']) - assert network.get_extensions('xnode').empty - - network.create_extensions('xnode', id='NNL2AA1 XXXXXX11 1', code='XXXXXX13') - e = network.get_extensions('xnode').loc['NNL2AA1 XXXXXX11 1'] - assert e.code == 'XXXXXX13' - - def test_entsoe_area(): network = pn.load(str(DATA_DIR / 'germanTsos.uct')) area = network.get_extensions('entsoeArea').loc['D4NEUR'] @@ -500,16 +450,12 @@ def test_get_extensions_information(): 'attributes'] == 'index : id (str), fixed_p (float), variable_p (float), fixed_q (float), variable_q (float)' assert extensions_information.loc['hvdcOperatorActivePowerRange']['detail'] == '' assert extensions_information.loc['hvdcOperatorActivePowerRange']['attributes'] == 'index : id (str), opr_from_cs1_to_cs2 (float), opr_from_cs2_to_cs1 (float)' - assert extensions_information.loc['mergedXnode']['detail'] == 'Provides information about the border point between 2 TSOs on a merged line' - assert extensions_information.loc['mergedXnode']['attributes'] == 'index : id (str), code (str), line1 (str), line2 (str), r_dp (float), x_dp (float), g1_dp (float), b1_dp (float), g2_dp (float), b2_dp (float), p1 (float), q1 (float), p2 (float), q2 (float)' assert extensions_information.loc['activePowerControl']['detail'] == 'Provides information about the participation of generators to balancing' assert extensions_information.loc['activePowerControl']['attributes'] == 'index : id (str), participate (bool), droop (float)' assert extensions_information.loc['entsoeCategory']['detail'] == 'Provides Entsoe category code for a generator' assert extensions_information.loc['entsoeCategory']['attributes'] == 'index : id (str), code (int)' assert extensions_information.loc['entsoeArea']['detail'] == 'Provides Entsoe geographical code for a substation' assert extensions_information.loc['entsoeArea']['attributes'] == 'index : id (str), code (str)' - assert extensions_information.loc['xnode']['detail'] == 'Provides information about the border point of a TSO on a dangling line' - assert extensions_information.loc['xnode']['attributes'] == 'index : id (str), code (str)' assert extensions_information.loc['generatorShortCircuit']['detail'] == 'it contains the transitory reactance of a generator needed to compute short circuit. A subtransitory reactance can also be contained' assert extensions_information.loc['generatorShortCircuit']['attributes'] == 'index : id (str), direct_sub_trans_x (float), direct_trans_x (float), step_up_transformer_x (float)' assert extensions_information.loc['identifiableShortCircuit']['detail'] == 'it contains max and min values of current allowed during short circuit on a network element' diff --git a/tests/test_security_analysis.py b/tests/test_security_analysis.py index 1822d1773..29332b9b8 100644 --- a/tests/test_security_analysis.py +++ b/tests/test_security_analysis.py @@ -92,14 +92,17 @@ def test_monitored_elements(): assert bus_results.index.to_frame().columns.tolist() == ['contingency_id', 'voltage_level_id', 'bus_id'] assert bus_results.columns.tolist() == ['v_mag', 'v_angle'] - assert len(bus_results) == 2 + assert len(bus_results) == 3 assert bus_results.loc['', 'VLHV2', 'NHV2']['v_mag'] == pytest.approx(389.95, abs=1e-2) + assert bus_results.loc['NGEN_NHV1', 'VLHV2', 'NHV2']['v_mag'] == pytest.approx(569.038987, abs=1e-2) assert bus_results.loc['NHV1_NHV2_1', 'VLHV2', 'NHV2']['v_mag'] == pytest.approx(366.58, abs=1e-2) assert branch_results.index.to_frame().columns.tolist() == ['contingency_id', 'branch_id'] assert branch_results.columns.tolist() == ['p1', 'q1', 'i1', 'p2', 'q2', 'i2', 'flow_transfer'] - assert len(branch_results) == 2 + assert len(branch_results) == 4 assert branch_results.loc['', 'NHV1_NHV2_2']['p1'] == pytest.approx(302.44, abs=1e-2) + assert branch_results.loc['NGEN_NHV1', 'NHV1_NHV2_1']['p1'] == pytest.approx(301.05, abs=1e-2) + assert branch_results.loc['NGEN_NHV1', 'NHV1_NHV2_2']['p1'] == pytest.approx(301.05, abs=1e-2) assert branch_results.loc['NHV1_NHV2_1', 'NHV1_NHV2_2']['p1'] == pytest.approx(610.56, abs=1e-2) From dcf505f04a6fd21c0786c811588591812671333e Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Wed, 7 Jun 2023 22:27:12 +0200 Subject: [PATCH 10/38] Wip Signed-off-by: Geoffroy Jamgotchian --- .../dataframe/network/NetworkDataframes.java | 1 + .../META-INF/native-image/reflect-config.json | 40 ------------------- .../network/NetworkDataframesTest.java | 4 +- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java b/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java index 52ff53e85..c4e4fd601 100644 --- a/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java +++ b/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java @@ -598,6 +598,7 @@ static NetworkDataframeMapper danglingLines() { .booleans("connected", dl -> dl.getTerminal().isConnected(), connectInjection()) .strings("ucte-x-node-code", dl -> Objects.toString(dl.getUcteXnodeCode(), "")) .booleans("fictitious", Identifiable::isFictitious, Identifiable::setFictitious, false) + .strings("tie_line_id", dl -> dl.getTieLine().map(Identifiable::getId).orElse("")) .addProperties() .build(); } diff --git a/java/src/main/resources/META-INF/native-image/reflect-config.json b/java/src/main/resources/META-INF/native-image/reflect-config.json index 01d23a65c..6d1c2f548 100644 --- a/java/src/main/resources/META-INF/native-image/reflect-config.json +++ b/java/src/main/resources/META-INF/native-image/reflect-config.json @@ -153,46 +153,6 @@ { "name":"javax.management.ObjectName" }, -{ - "name":"javax.xml.bind.annotation.XmlAccessorType" -}, -{ - "name":"javax.xml.bind.annotation.XmlElement", - "methods":[{"name":"type","parameterTypes":[] }] -}, -{ - "name":"javax.xml.bind.annotation.XmlElementDecl", - "methods":[{"name":"scope","parameterTypes":[] }] -}, -{ - "name":"javax.xml.bind.annotation.XmlElementRef", - "methods":[{"name":"type","parameterTypes":[] }] -}, -{ - "name":"javax.xml.bind.annotation.XmlElements" -}, -{ - "name":"javax.xml.bind.annotation.XmlEnum", - "methods":[{"name":"value","parameterTypes":[] }] -}, -{ - "name":"javax.xml.bind.annotation.XmlEnumValue" -}, -{ - "name":"javax.xml.bind.annotation.XmlType", - "methods":[{"name":"factoryClass","parameterTypes":[] }] -}, -{ - "name":"javax.xml.bind.annotation.adapters.CollapsedStringAdapter", - "methods":[{"name":"","parameterTypes":[] }] -}, -{ - "name":"javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter", - "methods":[ - {"name":"type","parameterTypes":[] }, - {"name":"value","parameterTypes":[] } - ] -}, { "name":"sun.security.provider.MD5", "methods":[{"name":"","parameterTypes":[] }] diff --git a/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java b/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java index 44a68efda..6f50dea99 100644 --- a/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java +++ b/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java @@ -249,12 +249,12 @@ void danglingLines() { assertThat(series) .extracting(Series::getName) .containsExactly("id", "name", "r", "x", "g", "b", "p0", "q0", "p", "q", "i", "voltage_level_id", "bus_id", - "connected", "ucte-x-node-code"); + "connected", "ucte-x-node-code", "tie_line_id"); List allAttributeSeries = createDataFrame(DANGLING_LINE, network, new DataframeFilter(ALL_ATTRIBUTES, Collections.emptyList())); assertThat(allAttributeSeries) .extracting(Series::getName) .containsExactly("id", "name", "r", "x", "g", "b", "p0", "q0", "p", "q", "i", - "voltage_level_id", "bus_id", "bus_breaker_bus_id", "node", "connected", "ucte-x-node-code", "fictitious"); + "voltage_level_id", "bus_id", "bus_breaker_bus_id", "node", "connected", "ucte-x-node-code", "fictitious", "tie_line_id"); } @Test From 91b5a05deb3f58c7e0e1a159592209935f1435d8 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Wed, 7 Jun 2023 22:27:54 +0200 Subject: [PATCH 11/38] Wip Signed-off-by: Geoffroy Jamgotchian --- java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index a44aee127..e9b742219 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -74,7 +74,7 @@ 3.2.0 3.10.1 3.2.4 - 2023.2.0-SNAPSHOT + 2023.2.0 From b54dffb0f6833ab165928a97dee41f06006f870c Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Wed, 7 Jun 2023 22:59:52 +0200 Subject: [PATCH 12/38] Wip Signed-off-by: Geoffroy Jamgotchian --- cpp/CMakeLists.txt | 2 +- cpp/src/bindings.cpp | 1 + cpp/src/pypowsybl-api.h | 1 + .../dataframe/DataframeElementType.java | 1 + .../dataframe/network/NetworkDataframes.java | 13 ++++++++++++ .../python/commons/PyPowsyblApiHeader.java | 1 + .../java/com/powsybl/python/commons/Util.java | 4 ++++ .../network/NetworkDataframesTest.java | 21 +++++++++++++++++-- pypowsybl/_pypowsybl.pyi | 1 + pypowsybl/network.py | 4 ++++ 10 files changed, 46 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f30b66a1c..140842354 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -70,7 +70,7 @@ ExternalProject_Add(native-image DEPENDS mvn SOURCE_DIR ${PYPOWSYBL_JAVA_BIN_DIR} DOWNLOAD_COMMAND "" - PATCH_COMMAND $ENV{JAVA_HOME}/bin/native-image ${NATIVE_IMAGE_BUILD_OPTIONS} --class-path ${PYPOWSYBL_JAVA_SRC_DIR}/target/pypowsybl-java.jar${EXTRA_JARS} --no-fallback --allow-incomplete-classpath --shared -H:Name=pypowsybl-java -H:CLibraryPath=${CMAKE_CURRENT_SOURCE_DIR}/src + PATCH_COMMAND $ENV{JAVA_HOME}/bin/native-image ${NATIVE_IMAGE_BUILD_OPTIONS} --class-path ${PYPOWSYBL_JAVA_SRC_DIR}/target/pypowsybl-java.jar${EXTRA_JARS} --no-fallback --shared -H:Name=pypowsybl-java -H:CLibraryPath=${CMAKE_CURRENT_SOURCE_DIR}/src CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${PYPOWSYBL_JAVA_BIN_DIR}/${PYPOWSYBL_JAVA_OLD_LIB} ${PYPOWSYBL_JAVA_BIN_DIR}/${PYPOWSYBL_JAVA_LIB} ${NATIVE_IMAGE_INSTALL_EXTRA_COMMAND} diff --git a/cpp/src/bindings.cpp b/cpp/src/bindings.cpp index a64a833cb..82033ea39 100644 --- a/cpp/src/bindings.cpp +++ b/cpp/src/bindings.cpp @@ -212,6 +212,7 @@ PYBIND11_MODULE(_pypowsybl, m) { .value("NON_LINEAR_SHUNT_COMPENSATOR_SECTION", element_type::NON_LINEAR_SHUNT_COMPENSATOR_SECTION) .value("LINEAR_SHUNT_COMPENSATOR_SECTION", element_type::LINEAR_SHUNT_COMPENSATOR_SECTION) .value("DANGLING_LINE", element_type::DANGLING_LINE) + .value("TIE_LINE", element_type::TIE_LINE) .value("LCC_CONVERTER_STATION", element_type::LCC_CONVERTER_STATION) .value("VSC_CONVERTER_STATION", element_type::VSC_CONVERTER_STATION) .value("STATIC_VAR_COMPENSATOR", element_type::STATIC_VAR_COMPENSATOR) diff --git a/cpp/src/pypowsybl-api.h b/cpp/src/pypowsybl-api.h index 2d45357de..9fb439dfd 100644 --- a/cpp/src/pypowsybl-api.h +++ b/cpp/src/pypowsybl-api.h @@ -126,6 +126,7 @@ typedef enum { NON_LINEAR_SHUNT_COMPENSATOR_SECTION, LINEAR_SHUNT_COMPENSATOR_SECTION, DANGLING_LINE, + TIE_LINE, LCC_CONVERTER_STATION, VSC_CONVERTER_STATION, STATIC_VAR_COMPENSATOR, diff --git a/java/src/main/java/com/powsybl/dataframe/DataframeElementType.java b/java/src/main/java/com/powsybl/dataframe/DataframeElementType.java index cdfae237c..c5704a6d8 100644 --- a/java/src/main/java/com/powsybl/dataframe/DataframeElementType.java +++ b/java/src/main/java/com/powsybl/dataframe/DataframeElementType.java @@ -21,6 +21,7 @@ public enum DataframeElementType { NON_LINEAR_SHUNT_COMPENSATOR_SECTION, LINEAR_SHUNT_COMPENSATOR_SECTION, DANGLING_LINE, + TIE_LINE, LCC_CONVERTER_STATION, VSC_CONVERTER_STATION, STATIC_VAR_COMPENSATOR, diff --git a/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java b/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java index c4e4fd601..ac0eae5eb 100644 --- a/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java +++ b/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java @@ -64,6 +64,7 @@ private static Map createMappers() mappers.put(DataframeElementType.NON_LINEAR_SHUNT_COMPENSATOR_SECTION, shuntsNonLinear()); mappers.put(DataframeElementType.LINEAR_SHUNT_COMPENSATOR_SECTION, linearShuntsSections()); mappers.put(DataframeElementType.DANGLING_LINE, danglingLines()); + mappers.put(DataframeElementType.TIE_LINE, tieLines()); mappers.put(DataframeElementType.LCC_CONVERTER_STATION, lccs()); mappers.put(DataframeElementType.VSC_CONVERTER_STATION, vscs()); mappers.put(DataframeElementType.STATIC_VAR_COMPENSATOR, svcs()); @@ -603,6 +604,18 @@ static NetworkDataframeMapper danglingLines() { .build(); } + static NetworkDataframeMapper tieLines() { + return NetworkDataframeMapperBuilder.ofStream(Network::getTieLineStream, getOrThrow(Network::getTieLine, "Tie line")) + .stringsIndex("id", TieLine::getId) + .strings("name", tl -> tl.getOptionalName().orElse("")) + .strings("dangling_line1_id", tl -> tl.getDanglingLine1().getId()) + .strings("dangling_line2_id", tl -> tl.getDanglingLine2().getId()) + .strings("ucte_xnode_code", tl -> Objects.toString(tl.getUcteXnodeCode(), "")) + .booleans("fictitious", Identifiable::isFictitious, Identifiable::setFictitious, false) + .addProperties() + .build(); + } + static NetworkDataframeMapper lccs() { return NetworkDataframeMapperBuilder.ofStream(Network::getLccConverterStationStream, getOrThrow(Network::getLccConverterStation, "LCC converter station")) .stringsIndex("id", LccConverterStation::getId) diff --git a/java/src/main/java/com/powsybl/python/commons/PyPowsyblApiHeader.java b/java/src/main/java/com/powsybl/python/commons/PyPowsyblApiHeader.java index 422beba54..cfab49d05 100644 --- a/java/src/main/java/com/powsybl/python/commons/PyPowsyblApiHeader.java +++ b/java/src/main/java/com/powsybl/python/commons/PyPowsyblApiHeader.java @@ -534,6 +534,7 @@ public enum ElementType { NON_LINEAR_SHUNT_COMPENSATOR_SECTION, LINEAR_SHUNT_COMPENSATOR_SECTION, DANGLING_LINE, + TIE_LINE, LCC_CONVERTER_STATION, VSC_CONVERTER_STATION, STATIC_VAR_COMPENSATOR, diff --git a/java/src/main/java/com/powsybl/python/commons/Util.java b/java/src/main/java/com/powsybl/python/commons/Util.java index b6e71a340..4a204c623 100644 --- a/java/src/main/java/com/powsybl/python/commons/Util.java +++ b/java/src/main/java/com/powsybl/python/commons/Util.java @@ -163,6 +163,8 @@ public static PyPowsyblApiHeader.ElementType convert(DataframeElementType type) return PyPowsyblApiHeader.ElementType.SHUNT_COMPENSATOR; case DANGLING_LINE: return PyPowsyblApiHeader.ElementType.DANGLING_LINE; + case TIE_LINE: + return PyPowsyblApiHeader.ElementType.TIE_LINE; case LCC_CONVERTER_STATION: return PyPowsyblApiHeader.ElementType.LCC_CONVERTER_STATION; case VSC_CONVERTER_STATION: @@ -232,6 +234,8 @@ public static DataframeElementType convert(PyPowsyblApiHeader.ElementType type) return DataframeElementType.SHUNT_COMPENSATOR; case DANGLING_LINE: return DataframeElementType.DANGLING_LINE; + case TIE_LINE: + return DataframeElementType.TIE_LINE; case LCC_CONVERTER_STATION: return DataframeElementType.LCC_CONVERTER_STATION; case VSC_CONVERTER_STATION: diff --git a/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java b/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java index 6f50dea99..2578d82ea 100644 --- a/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java +++ b/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java @@ -29,9 +29,12 @@ import com.powsybl.python.network.Networks; import org.junit.jupiter.api.Test; -import java.util.*; -import java.util.stream.Collectors; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.function.Function; +import java.util.stream.Collectors; import static com.powsybl.dataframe.DataframeElementType.*; import static com.powsybl.dataframe.DataframeFilter.AttributeFilterType.ALL_ATTRIBUTES; @@ -257,6 +260,20 @@ void danglingLines() { "voltage_level_id", "bus_id", "bus_breaker_bus_id", "node", "connected", "ucte-x-node-code", "fictitious", "tie_line_id"); } + @Test + void tieLines() { + Network network = EurostagTutorialExample1Factory.createWithTieLine(); + List series = createDataFrame(TIE_LINE, network); + + assertThat(series) + .extracting(Series::getName) + .containsExactly("id", "name", "dangling_line1_id", "dangling_line2_id", "ucte_xnode_code"); + List allAttributeSeries = createDataFrame(TIE_LINE, network, new DataframeFilter(ALL_ATTRIBUTES, Collections.emptyList())); + assertThat(allAttributeSeries) + .extracting(Series::getName) + .containsExactly("id", "name", "dangling_line1_id", "dangling_line2_id", "ucte_xnode_code", "fictitious"); + } + @Test void lines() { Network network = EurostagTutorialExample1Factory.create(); diff --git a/pypowsybl/_pypowsybl.pyi b/pypowsybl/_pypowsybl.pyi index 307eb1f08..93972caa2 100644 --- a/pypowsybl/_pypowsybl.pyi +++ b/pypowsybl/_pypowsybl.pyi @@ -81,6 +81,7 @@ class ElementType: BUS: ClassVar[ElementType] = ... BUSBAR_SECTION: ClassVar[ElementType] = ... DANGLING_LINE: ClassVar[ElementType] = ... + TIE_LINE: ClassVar[ElementType] = ... GENERATOR: ClassVar[ElementType] = ... HVDC_LINE: ClassVar[ElementType] = ... IDENTIFIABLE: ClassVar[ElementType] = ... diff --git a/pypowsybl/network.py b/pypowsybl/network.py index d30497811..9bd0fb740 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -1246,6 +1246,10 @@ def get_dangling_lines(self, all_attributes: bool = False, attributes: _List[str """ return self.get_elements(ElementType.DANGLING_LINE, all_attributes, attributes, **kwargs) + def get_tie_lines(self, all_attributes: bool = False, attributes: _List[str] = None, + **kwargs: _ArrayLike) -> _DataFrame: + return self.get_elements(ElementType.TIE_LINE, all_attributes, attributes, **kwargs) + def get_lcc_converter_stations(self, all_attributes: bool = False, attributes: _List[str] = None, **kwargs: _ArrayLike) -> _DataFrame: r""" From 039c1a2e35c283b4effed0ae74c6c18e1959f6cd Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 8 Jun 2023 10:44:02 +0200 Subject: [PATCH 13/38] Dynawaltz integration update Signed-off-by: Geoffroy Jamgotchian --- cpp/src/bindings.cpp | 4 +- cpp/src/pypowsybl.cpp | 8 +- cpp/src/pypowsybl.h | 4 +- .../python/dynamic/DynamicModelMapper.java | 76 ++++++++++++++----- .../dynamic/DynamicSimulationCFunctions.java | 14 +--- .../powsybl/python/dynamic/EventSupplier.java | 58 ++++++++++---- pypowsybl/_pypowsybl.pyi | 4 +- pypowsybl/dynamic.py | 14 ++-- tests/test_dynamic.py | 9 +-- tests/test_network.py | 8 +- tests/test_per_unit.py | 8 +- 11 files changed, 129 insertions(+), 78 deletions(-) diff --git a/cpp/src/bindings.cpp b/cpp/src/bindings.cpp index 82033ea39..a249f2dde 100644 --- a/cpp/src/bindings.cpp +++ b/cpp/src/bindings.cpp @@ -154,8 +154,8 @@ void dynamicSimulationBindings(py::module_& m) { m.def("add_curve", &pypowsybl::addCurve, py::arg("curve_mapping_handle"), py::arg("dynamic_id"), py::arg("variable")); // events mapping - m.def("add_event_branch_disconnection", &pypowsybl::addEventBranchDisconnection, py::arg("event_mapping_handle"), py::arg("event_model_id"), py::arg("static_id"), py::arg("eventTime"), py::arg("disconnectOrigin"), py::arg("disconnectExtremity")); - m.def("add_event_set_point_boolean", &pypowsybl::addEventSetPointBoolean, py::arg("event_mapping_handle"), py::arg("event_model_id"), py::arg("static_id"), py::arg("eventTime"), py::arg("stateEvent")); + m.def("add_event_branch_disconnection", &pypowsybl::addEventBranchDisconnection, py::arg("event_mapping_handle"), py::arg("static_id"), py::arg("eventTime"), py::arg("disconnectOrigin"), py::arg("disconnectExtremity")); + m.def("add_event_injection_disconnection", &pypowsybl::addEventInjectionDisconnection, py::arg("event_mapping_handle"), py::arg("static_id"), py::arg("eventTime"), py::arg("stateEvent")); // Simulation results m.def("get_dynamic_simulation_results_status", &pypowsybl::getDynamicSimulationResultsStatus, py::arg("result_handle")); diff --git a/cpp/src/pypowsybl.cpp b/cpp/src/pypowsybl.cpp index 003feaca9..03a029112 100644 --- a/cpp/src/pypowsybl.cpp +++ b/cpp/src/pypowsybl.cpp @@ -1262,12 +1262,12 @@ void addCurve(JavaHandle curveMappingHandle, std::string dynamicId, std::string callJava<>(::addCurve, curveMappingHandle, (char*) dynamicId.c_str(), (char*) variable.c_str()); } -void addEventBranchDisconnection(JavaHandle eventMappingHandle, std::string eventModelId, std::string staticId, double eventTime, bool disconnectOrigin, bool disconnectExtremity) { - callJava<>(::addEventBranchDisconnection, eventMappingHandle, (char*) eventModelId.c_str(), (char*) staticId.c_str(), eventTime, disconnectOrigin, disconnectExtremity); +void addEventBranchDisconnection(const JavaHandle& eventMappingHandle, const std::string& staticId, double eventTime, bool disconnectOrigin, bool disconnectExtremity) { + callJava<>(::addEventBranchDisconnection, eventMappingHandle, (char*) staticId.c_str(), eventTime, disconnectOrigin, disconnectExtremity); } -void addEventSetPointBoolean(JavaHandle eventMappingHandle, std::string eventModelId, std::string staticId, double eventTime, bool stateEvent) { - callJava<>(::addEventSetPointBoolean, eventMappingHandle, (char*) eventModelId.c_str(), (char*) staticId.c_str(), eventTime, stateEvent); +void addEventInjectionDisconnection(const JavaHandle& eventMappingHandle, const std::string& staticId, double eventTime, bool stateEvent) { + callJava<>(::addEventInjectionDisconnection, eventMappingHandle, (char*) staticId.c_str(), eventTime, stateEvent); } std::string getDynamicSimulationResultsStatus(JavaHandle dynamicSimulationResultsHandle) { diff --git a/cpp/src/pypowsybl.h b/cpp/src/pypowsybl.h index a77bf70b2..e5b4c60e9 100644 --- a/cpp/src/pypowsybl.h +++ b/cpp/src/pypowsybl.h @@ -543,8 +543,8 @@ JavaHandle runDynamicModel(JavaHandle dynamicModelContext, JavaHandle network, J void addCurve(JavaHandle curveMappingHandle, std::string dynamicId, std::string variable); // events mapping -void addEventBranchDisconnection(JavaHandle eventMappingHandle, std::string eventModelId, std::string staticId, double eventTime, bool disconnectOrigin, bool disconnectExtremity); -void addEventSetPointBoolean(JavaHandle eventMappingHandle, std::string eventModelId, std::string staticId, double eventTime, bool stateEvent); +void addEventBranchDisconnection(const JavaHandle& eventMappingHandle, const std::string& staticId, double eventTime, bool disconnectOrigin, bool disconnectExtremity); +void addEventInjectionDisconnection(const JavaHandle& eventMappingHandle, const std::string& staticId, double eventTime, bool stateEvent); // dynamic model mapping void addDynamicMappings(JavaHandle dynamicMappingHandle, DynamicMappingType mappingType, dataframe* mappingDf); diff --git a/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java b/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java index a6e017047..6ddb63da4 100644 --- a/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java +++ b/java/src/main/java/com/powsybl/python/dynamic/DynamicModelMapper.java @@ -7,14 +7,24 @@ */ package com.powsybl.python.dynamic; +import com.powsybl.commons.PowsyblException; import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; +import com.powsybl.dynawaltz.models.automatons.CurrentLimitAutomaton; +import com.powsybl.dynawaltz.models.generators.GeneratorSynchronous; +import com.powsybl.dynawaltz.models.loads.LoadAlphaBeta; +import com.powsybl.dynawaltz.models.loads.LoadOneTransformer; +import com.powsybl.dynawaltz.models.utils.SideConverter; import com.powsybl.iidm.network.Branch; +import com.powsybl.iidm.network.Generator; +import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import java.util.function.Supplier; +import java.util.Objects; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -22,10 +32,19 @@ */ public class DynamicModelMapper implements DynamicModelsSupplier { - private final List> dynamicModelList = new ArrayList<>(); + private final List> dynamicModelList = new ArrayList<>(); public List get(Network network) { - return dynamicModelList.stream().map(Supplier::get).collect(Collectors.toList()); + return dynamicModelList.stream().map(f -> f.apply(network)).filter(Objects::nonNull).collect(Collectors.toList()); + } + + @NotNull + private static Load getLoad(String staticId, Network network) { + Load load = network.getLoad(staticId); + if (load == null) { + throw new PowsyblException("Load '" + staticId + "' not found"); + } + return load; } /** @@ -33,8 +52,11 @@ public List get(Network network) { * * @param staticId also determines the dynamic id of the element */ - public void addAlphaBetaLoad(String staticId, String parametersIds) { -// dynamicModelList.add(() -> new LoadAlphaBeta(staticId, staticId, parametersIds)); + public void addAlphaBetaLoad(String staticId, String parameterSetId) { + dynamicModelList.add(network -> { + Load load = getLoad(staticId, network); + return new LoadAlphaBeta(staticId, load, parameterSetId, "LoadAlphaBeta"); + }); } /** @@ -42,32 +64,46 @@ public void addAlphaBetaLoad(String staticId, String parametersIds) { * * @param staticId also determines the dynamic id of the element */ - public void addOneTransformerLoad(String staticId, String parametersIds) { -// dynamicModelList.add(() -> new LoadOneTransformer(staticId, staticId, parametersIds)); + public void addOneTransformerLoad(String staticId, String parameterSetId) { + dynamicModelList.add(network -> { + Load load = getLoad(staticId, network); + return new LoadOneTransformer(staticId, load, parameterSetId); + }); } - public void addGeneratorSynchronous(String staticId, String parametersIds, String generatorLib) { -// dynamicModelList.add(() -> new GeneratorSynchronous(staticId, staticId, parametersIds, generatorLib)); + public void addGeneratorSynchronous(String staticId, String parameterSetId, String generatorLib) { + dynamicModelList.add(network -> { + Generator gen = network.getGenerator(staticId); + if (gen == null) { + throw new PowsyblException("Generator '" + staticId + "' not found"); + } + return new GeneratorSynchronous(staticId, gen, parameterSetId, generatorLib); + }); } - public void addGeneratorSynchronousThreeWindings(String staticId, String parametersIds) { - addGeneratorSynchronous(staticId, parametersIds, "ThreeWindings"); + public void addGeneratorSynchronousThreeWindings(String staticId, String parameterSetId) { + addGeneratorSynchronous(staticId, parameterSetId, "ThreeWindings"); } - public void addGeneratorSynchronousThreeWindingsProportionalRegulations(String staticId, String parametersIds) { - addGeneratorSynchronous(staticId, parametersIds, "ThreeWindingsProportionalRegulations"); + public void addGeneratorSynchronousThreeWindingsProportionalRegulations(String staticId, String parameterSetId) { + addGeneratorSynchronous(staticId, parameterSetId, "ThreeWindingsProportionalRegulations"); } - public void addGeneratorSynchronousFourWindings(String staticId, String parametersIds) { - addGeneratorSynchronous(staticId, parametersIds, "FourWindings"); + public void addGeneratorSynchronousFourWindings(String staticId, String parameterSetId) { + addGeneratorSynchronous(staticId, parameterSetId, "FourWindings"); } - public void addGeneratorSynchronousFourWindingsProportionalRegulations(String staticId, String parametersIds) { - addGeneratorSynchronous(staticId, parametersIds, "FourWindingsProportionalRegulations"); + public void addGeneratorSynchronousFourWindingsProportionalRegulations(String staticId, String parameterSetId) { + addGeneratorSynchronous(staticId, parameterSetId, "FourWindingsProportionalRegulations"); } - public void addCurrentLimitAutomaton(String staticId, String parametersIds, Branch.Side side) { -// dynamicModelList.add(() -> new CurrentLimitAutomaton(staticId, staticId, parametersIds, SideConverter.convert(side))); + public void addCurrentLimitAutomaton(String staticId, String parameterSetId, Branch.Side side) { + dynamicModelList.add(network -> { + Branch branch = network.getBranch(staticId); + if (branch == null) { + throw new PowsyblException("Branch '" + staticId + "' not found"); + } + return new CurrentLimitAutomaton(staticId, parameterSetId, branch, SideConverter.convert(side), "CurrentLimitAutomaton"); + }); } - } diff --git a/java/src/main/java/com/powsybl/python/dynamic/DynamicSimulationCFunctions.java b/java/src/main/java/com/powsybl/python/dynamic/DynamicSimulationCFunctions.java index b6cfbb0a0..60e169db6 100644 --- a/java/src/main/java/com/powsybl/python/dynamic/DynamicSimulationCFunctions.java +++ b/java/src/main/java/com/powsybl/python/dynamic/DynamicSimulationCFunctions.java @@ -145,35 +145,29 @@ public static void addCurve(IsolateThread thread, @CEntryPoint(name = "addEventBranchDisconnection") public static void addEventBranchDisconnection(IsolateThread thread, ObjectHandle eventSupplierHandle, - CCharPointer eventModelIdPtr, CCharPointer staticIdPtr, double eventTime, boolean disconnectOrigin, boolean disconnectExtremity, PyPowsyblApiHeader.ExceptionHandlerPointer exceptionHandlerPtr) { doCatch(exceptionHandlerPtr, () -> { - String eventModelId = CTypeUtil.toString(eventModelIdPtr); String staticId = CTypeUtil.toString(staticIdPtr); EventSupplier eventSupplier = ObjectHandles.getGlobal().get(eventSupplierHandle); - eventSupplier.addEventBranchDisconnection(eventModelId, - staticId, eventTime, disconnectOrigin, disconnectExtremity); + eventSupplier.addEventBranchDisconnection(staticId, eventTime, disconnectOrigin, disconnectExtremity); }); } - @CEntryPoint(name = "addEventSetPointBoolean") - public static void addEventSetPointBoolean(IsolateThread thread, + @CEntryPoint(name = "addEventInjectionDisconnection") + public static void addEventInjectionDisconnection(IsolateThread thread, ObjectHandle eventSupplierHandle, - CCharPointer eventModelIdPtr, CCharPointer staticIdPtr, double eventTime, boolean stateEvent, PyPowsyblApiHeader.ExceptionHandlerPointer exceptionHandlerPtr) { doCatch(exceptionHandlerPtr, () -> { - String eventModelId = CTypeUtil.toString(eventModelIdPtr); String staticId = CTypeUtil.toString(staticIdPtr); EventSupplier eventSupplier = ObjectHandles.getGlobal().get(eventSupplierHandle); - eventSupplier.addEventSetPointBoolean(eventModelId, staticId, - eventTime, stateEvent); + eventSupplier.addEventInjectionDisconnection(staticId, eventTime, stateEvent); }); } diff --git a/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java b/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java index 93550985c..7743493ea 100644 --- a/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java +++ b/java/src/main/java/com/powsybl/python/dynamic/EventSupplier.java @@ -7,24 +7,25 @@ */ package com.powsybl.python.dynamic; +import com.powsybl.commons.PowsyblException; import com.powsybl.dynamicsimulation.EventModel; import com.powsybl.dynamicsimulation.EventModelsSupplier; -import com.powsybl.iidm.network.Network; +import com.powsybl.dynawaltz.models.events.EventInjectionDisconnection; +import com.powsybl.dynawaltz.models.events.EventQuadripoleDisconnection; +import com.powsybl.iidm.network.*; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; -import java.util.function.Supplier; +import java.util.Objects; +import java.util.function.Function; import java.util.stream.Collectors; /** * @author Nicolas Pierre */ public class EventSupplier implements EventModelsSupplier { - private List> eventSupplierList; - public EventSupplier() { - eventSupplierList = new LinkedList<>(); - } + private final List> eventSupplierList = new ArrayList<>(); /** * According to Dynawaltz staticId must refer to a line or a two winding @@ -32,24 +33,49 @@ public EventSupplier() { *

* The event represent the disconnection the given line/transformer */ - public void addEventBranchDisconnection(String eventModelId, String staticId, double eventTime, - boolean disconnectOrigin, boolean disconnectExtremity) { -// this.eventSupplierList.add(() -> new EventQuadripoleDisconnection(eventModelId, staticId, eventTime, -// disconnectOrigin, disconnectExtremity)); + public void addEventBranchDisconnection(String staticId, double eventTime, boolean disconnectOrigin, boolean disconnectExtremity) { + eventSupplierList.add(network -> { + Branch branch = network.getBranch(staticId); + if (branch == null) { + throw new PowsyblException("Branch '" + staticId + "' not found"); + } + return new EventQuadripoleDisconnection(branch, eventTime, disconnectOrigin, disconnectExtremity); + }); } /** * According to Dynawaltz staticId must refer to a generator *

- * The event represent the disconnection of the given generator + * The event represent the disconnection of the given generator, load, static var compensator or shunt compensator */ - public void addEventSetPointBoolean(String eventModelId, String staticId, double eventTime, boolean stateEvent) { -// this.eventSupplierList -// .add(() -> new EventSetPointBoolean(eventModelId, staticId, eventTime, stateEvent)); + public void addEventInjectionDisconnection(String staticId, double eventTime, boolean stateEvent) { + eventSupplierList.add(network -> { + Generator generator = network.getGenerator(staticId); + if (generator != null) { + return new EventInjectionDisconnection(generator, eventTime, stateEvent); + } else { + Load load = network.getLoad(staticId); + if (load != null) { + return new EventInjectionDisconnection(load, eventTime, stateEvent); + } else { + StaticVarCompensator svc = network.getStaticVarCompensator(staticId); + if (svc != null) { + return new EventInjectionDisconnection(svc, eventTime, stateEvent); + } else { + ShuntCompensator sc = network.getShuntCompensator(staticId); + if (sc != null) { + return new EventInjectionDisconnection(sc, eventTime, stateEvent); + } else { + throw new PowsyblException("Generator, load, static var compensator or shunt compensator '" + staticId + "' not found"); + } + } + } + } + }); } @Override public List get(Network network) { - return eventSupplierList.stream().map(Supplier::get).collect(Collectors.toList()); + return eventSupplierList.stream().map(f -> f.apply(network)).filter(Objects::nonNull).collect(Collectors.toList()); } } diff --git a/pypowsybl/_pypowsybl.pyi b/pypowsybl/_pypowsybl.pyi index 93972caa2..adf1c51ee 100644 --- a/pypowsybl/_pypowsybl.pyi +++ b/pypowsybl/_pypowsybl.pyi @@ -623,8 +623,8 @@ def run_dynamic_model(dynamic_model: JavaHandle, network: JavaHandle, dynamic_ma def add_all_dynamic_mappings(dynamic_mapping_handle: JavaHandle, mapping_type: DynamicMappingType, mapping_df: Dataframe) -> None: ... def get_dynamic_mappings_meta_data(mapping_type: DynamicMappingType) -> List[SeriesMetadata]: ... def add_curve(curve_mapping_handle: JavaHandle, dynamic_id: str, variable: str) -> None: ... -def add_event_branch_disconnection(event_mapping_handle: JavaHandle, event_model_id: str, static_id: str, event_time: float, disconnect_origin: bool, disconnect_extremity: bool) -> None: ... -def add_event_set_point_boolean(event_mapping_handle: JavaHandle, event_model_id: str, static_id: str, event_time: float, state_event: bool) -> None: ... +def add_event_branch_disconnection(event_mapping_handle: JavaHandle, static_id: str, event_time: float, disconnect_origin: bool, disconnect_extremity: bool) -> None: ... +def add_event_injection_disconnection(event_mapping_handle: JavaHandle, static_id: str, event_time: float, state_event: bool) -> None: ... def set_powsybl_config_location(absolute_path_to_config:str, config_file_name: str) -> None: ... def get_dynamic_simulation_results_status(result_handle: JavaHandle) -> str: ... def get_dynamic_curve(report_handle: JavaHandle, curve_name: str) -> SeriesArray: ... diff --git a/pypowsybl/dynamic.py b/pypowsybl/dynamic.py index bff05dac5..4c35eb655 100644 --- a/pypowsybl/dynamic.py +++ b/pypowsybl/dynamic.py @@ -160,30 +160,28 @@ class EventMapping: def __init__(self) -> None: self._handle = _pp.create_event_mapping() - def add_branch_disconnection(self, event_model_id: str, static_id: str, event_time: float, disconnect_origin: bool, disconnect_extremity: bool) -> None: + def add_branch_disconnection(self, static_id: str, event_time: float, disconnect_origin: bool, disconnect_extremity: bool) -> None: """ Creates a branch disconnection event Args: - event_model_id (str): unique id of the event static_id (str): network element to disconnect event_time (float): timestep at which the event happens disconnect_origin (bool) : the disconnection is made at the origin disconnect_extremity (bool) : the disconnection is made at the extremity """ _pp.add_event_branch_disconnection( - self._handle, event_model_id, static_id, event_time, disconnect_origin, disconnect_extremity) + self._handle, static_id, event_time, disconnect_origin, disconnect_extremity) - def add_set_point_boolean(self, event_model_id: str, static_id: str, event_time: float, state_event: bool) -> None: - """ Creates a generator disconnection event + def add_injection_disconnection(self, static_id: str, event_time: float, state_event: bool) -> None: + """ Creates an injection disconnection event Args: - event_model_id (str): unique id of the event static_id (str): network element to disconnect event_time (float): timestep at which the event happens state_event (bool): TODO """ - _pp.add_event_set_point_boolean( - self._handle, event_model_id, static_id, event_time, state_event) + _pp.add_event_injection_disconnection( + self._handle, static_id, event_time, state_event) @staticmethod def get_possible_events() -> _List[EventType]: diff --git a/tests/test_dynamic.py b/tests/test_dynamic.py index ac14f940d..f606eb448 100644 --- a/tests/test_dynamic.py +++ b/tests/test_dynamic.py @@ -52,12 +52,9 @@ def test_dataframe_mapping(): def test_add_event(): events = dyn.EventMapping() - events.add_branch_disconnection( - "event_id_1", "test_quadripole_id", 5, True, False) - events.add_set_point_boolean( - "event_id_2", "test_generator_id", 3.3, True) - events.add_set_point_boolean( - "event_id_3", "test_generator_id", 8.2, False) + events.add_branch_disconnection("test_quadripole_id", 5, True, False) + events.add_injection_disconnection("test_generator_id", 3.3, True) + events.add_injection_disconnection("test_generator_id", 8.2, False) def test_add_curve(): diff --git a/tests/test_network.py b/tests/test_network.py index 92899ea23..75b700dff 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -869,9 +869,9 @@ def test_dangling_lines(): expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']), columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id', 'bus_id', - 'connected', 'ucte-x-node-code'], + 'connected', 'ucte-x-node-code', 'tie_line_id'], data=[['', 10.0, 1.0, 0.0001, 0.00001, 50.0, 30.0, NaN, NaN, NaN, 'VL', 'VL_0', True, - '']]) + '', '']]) pd.testing.assert_frame_equal(expected, n.get_dangling_lines(), check_dtype=False) n.update_dangling_lines( pd.DataFrame(index=['DL'], columns=['r', 'x', 'g', 'b', 'p0', 'q0', 'connected'], @@ -879,8 +879,8 @@ def test_dangling_lines(): updated = pd.DataFrame(index=pd.Series(name='id', data=['DL']), columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id', 'bus_id', - 'connected', 'ucte-x-node-code'], - data=[['', 11.0, 1.1, 0.0002, 0.00002, 40.0, 40.0, NaN, NaN, NaN, 'VL', '', False, '']]) + 'connected', 'ucte-x-node-code', 'tie_line_id'], + data=[['', 11.0, 1.1, 0.0002, 0.00002, 40.0, 40.0, NaN, NaN, NaN, 'VL', '', False, '', '']]) pd.testing.assert_frame_equal(updated, n.get_dangling_lines(), check_dtype=False) n = util.create_dangling_lines_network() dangling_lines = n.get_dangling_lines(attributes=['bus_breaker_bus_id', 'node']) diff --git a/tests/test_per_unit.py b/tests/test_per_unit.py index 3b86d9c43..fa2c35712 100644 --- a/tests/test_per_unit.py +++ b/tests/test_per_unit.py @@ -202,17 +202,17 @@ def test_dangling_lines_per_unit(): expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']), columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id', - 'bus_id', 'connected', 'ucte-x-node-code'], + 'bus_id', 'connected', 'ucte-x-node-code', 'tie_line_id'], data=[['', 0.1, 0.01, 0.01, 0.001, 0.5, 0.3, 0.5482, 0.3029, 0.6263, 'VL', 'VL_0', - True, '']]) + True, '', '']]) dangling_lines = n.get_dangling_lines() pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=10 ** -4) n.update_dangling_lines(pd.DataFrame(index=['DL'], columns=['p0', 'q0'], data=[[0.75, 0.25]])) expected = pd.DataFrame(index=pd.Series(name='id', data=['DL']), columns=['name', 'r', 'x', 'g', 'b', 'p0', 'q0', 'p', 'q', 'i', 'voltage_level_id', - 'bus_id', 'connected', 'ucte-x-node-code'], + 'bus_id', 'connected', 'ucte-x-node-code', 'tie_line_id'], data=[['', 0.1, 0.01, 0.01, 0.001, 0.75, 0.25, 0.5482, 0.3029, 0.6263, 'VL', 'VL_0', - True, '']]) + True, '', '']]) dangling_lines = n.get_dangling_lines() pd.testing.assert_frame_equal(expected, dangling_lines, check_dtype=False, atol=10 ** -4) From a1a6c86974d8d44b2fd27dc085cc132072510fb4 Mon Sep 17 00:00:00 2001 From: Coline PILOQUET Date: Thu, 8 Jun 2023 11:18:04 +0200 Subject: [PATCH 14/38] add creation/removing of tie lines - doc to do Signed-off-by: Coline Piloquet --- .../adders/AbstractFeederBaysSeries.java | 7 ++ .../network/adders/NetworkElementAdders.java | 3 +- .../network/adders/TieLineDataframeAdder.java | 67 +++++++++++++++++++ .../python/network/NetworkCFunctions.java | 2 + pypowsybl/network.py | 32 +++++++++ tests/test_network_elements_creation.py | 37 ++++++++++ 6 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 java/src/main/java/com/powsybl/dataframe/network/adders/TieLineDataframeAdder.java diff --git a/java/src/main/java/com/powsybl/dataframe/network/adders/AbstractFeederBaysSeries.java b/java/src/main/java/com/powsybl/dataframe/network/adders/AbstractFeederBaysSeries.java index c2dfda702..182e3de82 100644 --- a/java/src/main/java/com/powsybl/dataframe/network/adders/AbstractFeederBaysSeries.java +++ b/java/src/main/java/com/powsybl/dataframe/network/adders/AbstractFeederBaysSeries.java @@ -1,3 +1,10 @@ +/** + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * SPDX-License-Identifier: MPL-2.0 + */ package com.powsybl.dataframe.network.adders; import com.powsybl.dataframe.update.UpdatingDataframe; diff --git a/java/src/main/java/com/powsybl/dataframe/network/adders/NetworkElementAdders.java b/java/src/main/java/com/powsybl/dataframe/network/adders/NetworkElementAdders.java index 4b87279d2..d0a90083b 100644 --- a/java/src/main/java/com/powsybl/dataframe/network/adders/NetworkElementAdders.java +++ b/java/src/main/java/com/powsybl/dataframe/network/adders/NetworkElementAdders.java @@ -45,7 +45,8 @@ public final class NetworkElementAdders { Map.entry(OPERATIONAL_LIMITS, new OperationalLimitsDataframeAdder()), Map.entry(MINMAX_REACTIVE_LIMITS, new MinMaxReactiveLimitsDataframeAdder()), Map.entry(REACTIVE_CAPABILITY_CURVE_POINT, new CurveReactiveLimitsDataframeAdder()), - Map.entry(ALIAS, new AliasDataframeAdder()) + Map.entry(ALIAS, new AliasDataframeAdder()), + Map.entry(TIE_LINE, new TieLineDataframeAdder()) ); private static final Map EXTENSIONS_ADDERS = NetworkExtensions.createExtensionsAdders(); diff --git a/java/src/main/java/com/powsybl/dataframe/network/adders/TieLineDataframeAdder.java b/java/src/main/java/com/powsybl/dataframe/network/adders/TieLineDataframeAdder.java new file mode 100644 index 000000000..b9877bc6b --- /dev/null +++ b/java/src/main/java/com/powsybl/dataframe/network/adders/TieLineDataframeAdder.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2023, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * SPDX-License-Identifier: MPL-2.0 + */ +package com.powsybl.dataframe.network.adders; + +import com.powsybl.commons.reporter.Reporter; +import com.powsybl.dataframe.SeriesMetadata; +import com.powsybl.dataframe.update.StringSeries; +import com.powsybl.dataframe.update.UpdatingDataframe; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.TieLineAdder; + +import java.util.Collections; +import java.util.List; + +import static com.powsybl.dataframe.network.adders.SeriesUtils.applyIfPresent; + +/** + * @author Coline Piloquet + */ +public class TieLineDataframeAdder extends AbstractSimpleAdder { + + private static final List METADATA = List.of( + SeriesMetadata.stringIndex("id"), + SeriesMetadata.strings("name"), + SeriesMetadata.strings("dangling_line1_id"), + SeriesMetadata.strings("dangling_line2_id") + ); + + @Override + public List> getMetadata() { + return Collections.singletonList(METADATA); + } + + private static class TieLineSeries extends IdentifiableSeries { + + private final StringSeries danglingLine1Ids; + private final StringSeries danglingLine2Ids; + + TieLineSeries(UpdatingDataframe dataframe) { + super(dataframe); + this.danglingLine1Ids = dataframe.getStrings("dangling_line1_id"); + this.danglingLine2Ids = dataframe.getStrings("dangling_line2_id"); + } + + TieLineAdder create(Network network, int row) { + TieLineAdder adder = network.newTieLine(); + setIdentifiableAttributes(adder, row); + applyIfPresent(danglingLine1Ids, row, adder::setDanglingLine1); + applyIfPresent(danglingLine2Ids, row, adder::setDanglingLine2); + return adder; + } + } + + @Override + public void addElements(Network network, UpdatingDataframe dataframe, AdditionStrategy additionStrategy, boolean throwException, Reporter reporter) { + TieLineSeries series = new TieLineSeries(dataframe); + for (int row = 0; row < dataframe.getRowCount(); row++) { + TieLineAdder adder = series.create(network, row); + adder.add(); + } + } +} diff --git a/java/src/main/java/com/powsybl/python/network/NetworkCFunctions.java b/java/src/main/java/com/powsybl/python/network/NetworkCFunctions.java index c58fbef94..5c5ea331b 100644 --- a/java/src/main/java/com/powsybl/python/network/NetworkCFunctions.java +++ b/java/src/main/java/com/powsybl/python/network/NetworkCFunctions.java @@ -445,6 +445,8 @@ public static void removeNetworkElements(IsolateThread thread, ObjectHandle netw default: throw new PowsyblException("this voltage level does not have a proper topology kind"); } + } else if (identifiable instanceof TieLine) { + ((TieLine) identifiable).remove(); } else { throw new PowsyblException(String.format("identifiable with id : %s can't be removed", identifiable.getId())); } diff --git a/pypowsybl/network.py b/pypowsybl/network.py index 9bd0fb740..8d40ede87 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -4298,6 +4298,38 @@ def create_curve_reactive_limits(self, df: _DataFrame = None, **kwargs: _ArrayLi """ return self._create_elements(ElementType.REACTIVE_CAPABILITY_CURVE_POINT, [df], **kwargs) + def create_tie_lines(self, df: _DataFrame = None, **kwargs: _ArrayLike) -> None: + """ + Creates tie lines. + + Args: + df: Attributes as a dataframe. + kwargs: Attributes as keyword arguments. + + Notes: + + Data may be provided as a dataframe or as keyword arguments. + In the latter case, all arguments must have the same length. + + Valid attributes are: + + - **id**: the identifier of the new tie line + - **name**: an optional human-readable name + - **dangling_line1_id**: the ID of the first dangling line + It must already exist. + - **dangling_line2_id**: the ID of the second dangling line + It must already exist. + + Examples: + Using keyword arguments: + + .. code-block:: python + + network.create_tie_lines(id='tie_line_1', dangling_line1_id='DL-1', dangling_line2_id='DL-2') + + """ + return self._create_elements(ElementType.TIE_LINE, [df], **kwargs) + def add_aliases(self, df: _DataFrame = None, **kwargs: _ArrayLike) -> None: """ Adds aliases to network elements. diff --git a/tests/test_network_elements_creation.py b/tests/test_network_elements_creation.py index 67fee9866..d23c599b0 100644 --- a/tests/test_network_elements_creation.py +++ b/tests/test_network_elements_creation.py @@ -828,3 +828,40 @@ def test_error_messages(): check_unknown_voltage_level_error_message(network.create_dangling_lines) check_unknown_voltage_level_error_message(network.create_lcc_converter_stations) check_unknown_voltage_level_error_message(network.create_vsc_converter_stations) + + +def test_tie_line_creation(): + network = pn.create_empty() + network.create_substations(id=['S1', 'S2'], tso=['TERNA', 'RTE']) + network.create_voltage_levels(id=['VLTEST', 'VLTEST2'], high_voltage_limit=[250, 250], + low_voltage_limit=[200, 200], + nominal_v=[225, 225], + topology_kind=['BUS_BREAKER', 'BUS_BREAKER']) + network.create_buses(id=['BUS_TEST', 'BUS_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2']) + network.create_dangling_lines(id=['DL_TEST', 'DL_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2'], + bus_id=['BUS_TEST', 'BUS_TEST2'], + p0=[100, 100], q0=[101, 101], r=[2, 2], x=[2, 2], g=[1, 1], b=[1, 1]) + df = pd.DataFrame.from_records( + columns=['id', 'dangling_line1_id', 'dangling_line2_id'], + data=[('TIE_LINE_TEST', 'DL_TEST', 'DL_TEST2')], + index='id') + network.create_tie_lines(df) + assert 'TIE_LINE_TEST' in network.get_tie_lines().index + + +def test_tie_line_kwargs(): + network = pn.create_empty() + network.create_substations(id=['S1', 'S2'], tso=['TERNA', 'RTE']) + network.create_voltage_levels(id=['VLTEST', 'VLTEST2'], high_voltage_limit=[250, 250], + low_voltage_limit=[200, 200], + nominal_v=[225, 225], + topology_kind=['BUS_BREAKER', 'BUS_BREAKER']) + network.create_buses(id=['BUS_TEST', 'BUS_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2']) + network.create_dangling_lines(id=['DL_TEST', 'DL_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2'], + bus_id=['BUS_TEST', 'BUS_TEST2'], + p0=[100, 100], q0=[101, 101], r=[2, 2], x=[2, 2], g=[1, 1], b=[1, 1]) + network.create_tie_lines(id='TIE_LINE_TEST', dangling_line1_id='DL_TEST', dangling_line2_id='DL_TEST2') + assert 'TIE_LINE_TEST' in network.get_tie_lines().index + + network.remove_elements('TIE_LINE_TEST') + assert network.get_tie_lines().empty From c4a77f6b5ad1c50838215a9f23e1b4e840720bca Mon Sep 17 00:00:00 2001 From: Coline PILOQUET Date: Thu, 8 Jun 2023 13:10:05 +0200 Subject: [PATCH 15/38] add ucte_xnode_code in dangling line Signed-off-by: Coline Piloquet --- .../adders/DanglingLineDataframeAdder.java | 6 ++++- pypowsybl/network.py | 2 ++ tests/test_network_elements_creation.py | 24 ++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/java/src/main/java/com/powsybl/dataframe/network/adders/DanglingLineDataframeAdder.java b/java/src/main/java/com/powsybl/dataframe/network/adders/DanglingLineDataframeAdder.java index d734c17d0..2f2558745 100644 --- a/java/src/main/java/com/powsybl/dataframe/network/adders/DanglingLineDataframeAdder.java +++ b/java/src/main/java/com/powsybl/dataframe/network/adders/DanglingLineDataframeAdder.java @@ -39,7 +39,8 @@ public class DanglingLineDataframeAdder extends AbstractSimpleAdder { SeriesMetadata.doubles("r"), SeriesMetadata.doubles("x"), SeriesMetadata.doubles("g"), - SeriesMetadata.doubles("b") + SeriesMetadata.doubles("b"), + SeriesMetadata.strings("ucte_xnode_code") ); @Override @@ -57,6 +58,7 @@ private static class DanglingLineSeries extends InjectionSeries { private final DoubleSeries g; private final DoubleSeries b; private final StringSeries busOrBusbarSections; + private final StringSeries ucteXnodeCode; DanglingLineSeries(UpdatingDataframe dataframe) { super(dataframe); @@ -68,6 +70,7 @@ private static class DanglingLineSeries extends InjectionSeries { this.g = dataframe.getDoubles("g"); this.b = dataframe.getDoubles("b"); this.busOrBusbarSections = dataframe.getStrings("bus_or_busbar_section_id"); + this.ucteXnodeCode = dataframe.getStrings("ucte_xnode_code"); } DanglingLineAdder createAdder(Network network, int row) { @@ -80,6 +83,7 @@ DanglingLineAdder createAdder(Network network, int row) { applyIfPresent(x, row, adder::setX); applyIfPresent(g, row, adder::setG); applyIfPresent(b, row, adder::setB); + applyIfPresent(ucteXnodeCode, row, adder::setUcteXnodeCode); return adder; } } diff --git a/pypowsybl/network.py b/pypowsybl/network.py index 8d40ede87..01ca5208c 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -1197,6 +1197,7 @@ def get_dangling_lines(self, all_attributes: bool = False, attributes: _List[str - **node** (optional): node where this line is connected, in node-breaker voltage levels - **connected**: ``True`` if the dangling line is connected to a bus - **fictitious** (optional): ``True`` if the dangling line is part of the model and not of the actual network + - **ucte-xnode-code** (optional): the UCTE Xnode code associated to the dangling line, to be used for creating tie lines. This dataframe is indexed by the id of the dangling lines @@ -3621,6 +3622,7 @@ def create_dangling_lines(self, df: _DataFrame = None, **kwargs: _ArrayLike) -> - **x**: the reactance, in Ohms - **g**: the shunt conductance, in S - **b**: the shunt susceptance, in S + - **ucte-xnode-code**: the optional UCTE Xnode code associated to the dangling line, to be used for creating tie lines. Examples: Using keyword arguments: diff --git a/tests/test_network_elements_creation.py b/tests/test_network_elements_creation.py index d23c599b0..acf84e5d2 100644 --- a/tests/test_network_elements_creation.py +++ b/tests/test_network_elements_creation.py @@ -840,7 +840,8 @@ def test_tie_line_creation(): network.create_buses(id=['BUS_TEST', 'BUS_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2']) network.create_dangling_lines(id=['DL_TEST', 'DL_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2'], bus_id=['BUS_TEST', 'BUS_TEST2'], - p0=[100, 100], q0=[101, 101], r=[2, 2], x=[2, 2], g=[1, 1], b=[1, 1]) + p0=[100, 100], q0=[101, 101], r=[2, 2], x=[2, 2], g=[1, 1], b=[1, 1], + ucte_xnode_code=['XNODE', 'XNODE']) df = pd.DataFrame.from_records( columns=['id', 'dangling_line1_id', 'dangling_line2_id'], data=[('TIE_LINE_TEST', 'DL_TEST', 'DL_TEST2')], @@ -849,6 +850,27 @@ def test_tie_line_creation(): assert 'TIE_LINE_TEST' in network.get_tie_lines().index +def test_tie_line_creation2(): + network = pn.create_empty() + network.create_substations(id=['S1', 'S2'], tso=['TERNA', 'RTE']) + network.create_voltage_levels(id=['VLTEST', 'VLTEST2'], high_voltage_limit=[250, 250], + low_voltage_limit=[200, 200], + nominal_v=[225, 225], + topology_kind=['BUS_BREAKER', 'BUS_BREAKER']) + network.create_buses(id=['BUS_TEST', 'BUS_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2']) + network.create_dangling_lines(id=['DL_TEST', 'DL_TEST2'], voltage_level_id=['VLTEST', 'VLTEST2'], + bus_id=['BUS_TEST', 'BUS_TEST2'], + p0=[100, 100], q0=[101, 101], r=[2, 2], x=[2, 2], g=[1, 1], b=[1, 1], + ucte_xnode_code=['XNODE1', 'XNODE']) + df = pd.DataFrame.from_records( + columns=['id', 'dangling_line1_id', 'dangling_line2_id'], + data=[('TIE_LINE_TEST', 'DL_TEST', 'DL_TEST2')], + index='id') + with pytest.raises(PyPowsyblError) as exc: + network.create_tie_lines(df) + assert exc.match("AC tie Line 'TIE_LINE_TEST': ucteXnodeCode is not consistent") + + def test_tie_line_kwargs(): network = pn.create_empty() network.create_substations(id=['S1', 'S2'], tso=['TERNA', 'RTE']) From d7166a2fff327171da80bb19f8db6d3a447ae04c Mon Sep 17 00:00:00 2001 From: Coline PILOQUET Date: Thu, 8 Jun 2023 14:34:53 +0200 Subject: [PATCH 16/38] fix doc Signed-off-by: Coline Piloquet --- docs/user_guide/loadflow.rst | 2 +- docs/user_guide/security.rst | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/user_guide/loadflow.rst b/docs/user_guide/loadflow.rst index 63ccbe89c..0a924151d 100644 --- a/docs/user_guide/loadflow.rst +++ b/docs/user_guide/loadflow.rst @@ -82,7 +82,7 @@ And get more detailed informations about theses parameters using: description type default possible_values name slackBusSelectionMode Slack bus selection mode STRING MOST_MESHED [FIRST, MOST_MESHED, NAME, LARGEST_GENERATOR] - slackBusesIds Slack bus IDs STRING + slackBusesIds Slack bus IDs STRING_LIST For instance, OLF supports configuration of slack bus from its ID like this: diff --git a/docs/user_guide/security.rst b/docs/user_guide/security.rst index 21961981c..4175b9b95 100644 --- a/docs/user_guide/security.rst +++ b/docs/user_guide/security.rst @@ -73,14 +73,18 @@ Information can be obtained on buses, branches and three windings transformers. v_mag v_angle contingency_id voltage_level_id bus_id VLHV2 NHV2 389.95 -3.51 + NGEN_NHV1 VLHV2 NHV2 569.04 -1.71 NHV1_NHV2_1 VLHV2 NHV2 366.58 -7.50 >>> results.branch_results p1 q1 i1 p2 q2 i2 flow_transfer contingency_id branch_id NHV1_NHV2_2 302.44 98.74 456.77 -300.43 -137.19 488.99 NaN + NGEN_NHV1 NHV1_NHV2_1 301.06 0.00 302.80 -300.19 -116.60 326.75 NaN + NHV1_NHV2_2 301.06 0.00 302.80 -300.19 -116.60 326.75 NaN NHV1_NHV2_1 NHV1_NHV2_2 610.56 334.06 1,008.93 -601.00 -285.38 1,047.83 NaN + .. testcleanup:: security.monitored_elements It also possible to get flow transfer on monitored branches in case of N-1 branch contingencies: From 6b15837d21efa29c8e05c14ddb103b5356e42f7d Mon Sep 17 00:00:00 2001 From: Coline PILOQUET Date: Thu, 8 Jun 2023 14:56:33 +0200 Subject: [PATCH 17/38] add python doc Signed-off-by: Coline Piloquet --- docs/reference/network.rst | 2 ++ pypowsybl/network.py | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/reference/network.rst b/docs/reference/network.rst index a5394b93d..946cb8490 100644 --- a/docs/reference/network.rst +++ b/docs/reference/network.rst @@ -98,6 +98,7 @@ All network elements are accessible as dataframes, using the following getters. Network.get_terminals Network.get_voltage_levels Network.get_vsc_converter_stations + Network.get_tie_lines Network elements update @@ -166,6 +167,7 @@ Network elements can be created or removed using the following methods: Network.create_switches Network.create_voltage_levels Network.create_vsc_converter_stations + Network.create_tie_lines Network.remove_elements diff --git a/pypowsybl/network.py b/pypowsybl/network.py index 01ca5208c..20c8aab83 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -1249,6 +1249,27 @@ def get_dangling_lines(self, all_attributes: bool = False, attributes: _List[str def get_tie_lines(self, all_attributes: bool = False, attributes: _List[str] = None, **kwargs: _ArrayLike) -> _DataFrame: + r""" + Get a dataframe of tie lines. + + Args: + all_attributes: flag for including all attributes in the dataframe, default is false + attributes: attributes to include in the dataframe. The 2 parameters are mutually exclusive. + If no parameter is specified, the dataframe will include the default attributes. + kwargs: the data to be selected, as named arguments. + + Returns: + A dataframe of tie lines. + + Notes: + The resulting dataframe, depending on the parameters, will include the following columns: + + - **dangling_line1_id**: The ID of the first dangling line + - **dangling_line2_id**: The ID of the second dangling line + - **ucte_xnode_code**: The UCTE xnode code of the tie line, obtained from the dangling lines. + + This dataframe is indexed by the id of the dangling lines + """ return self.get_elements(ElementType.TIE_LINE, all_attributes, attributes, **kwargs) def get_lcc_converter_stations(self, all_attributes: bool = False, attributes: _List[str] = None, @@ -4302,7 +4323,8 @@ def create_curve_reactive_limits(self, df: _DataFrame = None, **kwargs: _ArrayLi def create_tie_lines(self, df: _DataFrame = None, **kwargs: _ArrayLike) -> None: """ - Creates tie lines. + Creates tie lines from two dangling lines. + Both dangling lines must have the same UCTE Xnode code. Args: df: Attributes as a dataframe. From c3fe739578fa2590cdbc334bf2cda9e5370e9f29 Mon Sep 17 00:00:00 2001 From: Coline PILOQUET Date: Thu, 8 Jun 2023 15:16:31 +0200 Subject: [PATCH 18/38] Fix dangling line doc Signed-off-by: Coline PILOQUET --- pypowsybl/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pypowsybl/network.py b/pypowsybl/network.py index 20c8aab83..e49924021 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -1197,7 +1197,8 @@ def get_dangling_lines(self, all_attributes: bool = False, attributes: _List[str - **node** (optional): node where this line is connected, in node-breaker voltage levels - **connected**: ``True`` if the dangling line is connected to a bus - **fictitious** (optional): ``True`` if the dangling line is part of the model and not of the actual network - - **ucte-xnode-code** (optional): the UCTE Xnode code associated to the dangling line, to be used for creating tie lines. + - **ucte-xnode-code**: the UCTE Xnode code associated to the dangling line, to be used for creating tie lines. + - **tie_line_id**: the ID of the tie line if the dangling line is paired This dataframe is indexed by the id of the dangling lines From 89d63c3e30bd8d9055e4fd7c075274a3c0dfaedf Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 8 Jun 2023 23:27:15 +0200 Subject: [PATCH 19/38] Wip Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 2 +- docs/user_guide/security.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 1b21f6dfb..e6e52b21f 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -137,7 +137,7 @@ jobs: uses: actions/checkout@v3 with: repository: powsybl/powsybl-open-loadflow - ref: fix_svc_inf + ref: svc_sensi_v_eps path: powsybl-open-loadflow - name: Build and install olf diff --git a/docs/user_guide/security.rst b/docs/user_guide/security.rst index 562fe9c1e..4175b9b95 100644 --- a/docs/user_guide/security.rst +++ b/docs/user_guide/security.rst @@ -70,7 +70,7 @@ Information can be obtained on buses, branches and three windings transformers. >>> security_analysis.add_precontingency_monitored_elements(branch_ids=['NHV1_NHV2_2']) >>> results = security_analysis.run_ac(network) >>> results.bus_results - v_mag v_angle + v_mag v_angle contingency_id voltage_level_id bus_id VLHV2 NHV2 389.95 -3.51 NGEN_NHV1 VLHV2 NHV2 569.04 -1.71 From 669daeb0cb2e1672a1a3819a524af570030b72b0 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 8 Jun 2023 23:39:01 +0200 Subject: [PATCH 20/38] Fix Signed-off-by: Geoffroy Jamgotchian --- tests/test_loadflow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_loadflow.py b/tests/test_loadflow.py index edfb64bba..f659a1a4d 100644 --- a/tests/test_loadflow.py +++ b/tests/test_loadflow.py @@ -214,6 +214,7 @@ def test_get_provider_parameters_names(): 'debugDir', 'incrementalTransformerVoltageControlOuterLoopMaxTapShift', 'secondaryVoltageControl', + 'secondaryVoltageControlPilotPointVoltageSensiEpsilon', 'reactiveLimitsMaxPqPvSwitch', 'newtonRaphsonStoppingCriteriaType', 'maxActivePowerMismatch', From b12a46b362b9521e9669d79ee9b72db9568317bf Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 8 Jun 2023 23:44:23 +0200 Subject: [PATCH 21/38] Fix Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index e6e52b21f..43a152841 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v3 with: repository: powsybl/powsybl-open-loadflow - ref: fix_svc_inf + ref: svc_sensi_v_eps path: powsybl-open-loadflow - name: Build and install olf From db52e72fc08c02e55fd9f26f53a0c1a7b327b920 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 8 Jun 2023 23:50:30 +0200 Subject: [PATCH 22/38] Fix Signed-off-by: Geoffroy Jamgotchian --- tests/test_loadflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_loadflow.py b/tests/test_loadflow.py index f659a1a4d..988124e96 100644 --- a/tests/test_loadflow.py +++ b/tests/test_loadflow.py @@ -236,7 +236,7 @@ def test_get_provider_parameters_names(): def test_get_provider_parameters(): specific_parameters = pp.loadflow.get_provider_parameters('OpenLoadFlow') - assert 45 == len(specific_parameters) + assert 46 == len(specific_parameters) assert 'Slack bus selection mode' == specific_parameters['description']['slackBusSelectionMode'] assert 'STRING' == specific_parameters['type']['slackBusSelectionMode'] assert 'MOST_MESHED' == specific_parameters['default']['slackBusSelectionMode'] From 19e3d5dc9355103696e836d1feabac7848d852f4 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 11 Jul 2023 11:47:37 +0200 Subject: [PATCH 23/38] Test Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 34 +++++++++++++++++----------------- java/pom.xml | 8 -------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index e8ce121a4..5d4fdcd9b 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -16,9 +16,9 @@ jobs: matrix: python: - { - name: cp38, - abi: cp38, - version: '3.8', + name: cp311, + abi: cp311, + version: '3.11', } steps: @@ -32,16 +32,16 @@ jobs: distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout olf sources + - name: Checkout core sources uses: actions/checkout@v3 with: - repository: powsybl/powsybl-open-loadflow - ref: svc_sensi_v_eps - path: powsybl-open-loadflow + repository: powsybl/powsybl-core + ref: release-v5.3.2-and-matpower + path: powsybl-core - - name: Build and install olf + - name: Build and install core shell: bash - run: scl enable rh-maven33 'mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install' + run: scl enable rh-maven33 'mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install' - name: Checkout sources uses: actions/checkout@v3 @@ -119,8 +119,8 @@ jobs: } python: - { - name: cp39, - version: '3.9', + name: cp311, + version: '3.11', } steps: @@ -131,15 +131,15 @@ jobs: distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout olf sources + - name: Checkout core sources uses: actions/checkout@v3 with: - repository: powsybl/powsybl-open-loadflow - ref: svc_sensi_v_eps - path: powsybl-open-loadflow + repository: powsybl/powsybl-core + ref: release-v5.3.2-and-matpower + path: powsybl-core - - name: Build and install olf - run: mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install + - name: Build and install core + run: mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install - name: Checkout sources uses: actions/checkout@v3 diff --git a/java/pom.xml b/java/pom.xml index 0ea4a9dcc..9f45042ff 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -69,7 +69,6 @@ 3.2.0 2023.2.2 1.5.2-5 - 1.3.0-SNAPSHOT @@ -157,13 +156,6 @@ - - - com.powsybl - powsybl-open-loadflow - ${powsybl-open-loadflow.version} - - com.powsybl powsybl-dependencies From 7e5b48c1df105e20dcea9300562e686de9f1d4d3 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Tue, 11 Jul 2023 12:23:48 +0200 Subject: [PATCH 24/38] Test Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 5d4fdcd9b..58d25231e 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -83,15 +83,6 @@ jobs: - name: Linting run: pylint pypowsybl - - name: Sonar analysis - uses: sonarsource/sonarcloud-github-action@v1.6 - env: - GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - with: - args: | - -Dsonar.python.coverage.reportPaths=coverage.xml - - name: Run doc examples working-directory: ./docs run: make doctest From 8f3969a068b071af0b9b7717676539d748bb8ab1 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Sun, 16 Jul 2023 22:50:02 +0200 Subject: [PATCH 25/38] Test with SLD 3.3.2 Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 21 ----------------- java/pom.xml | 44 ++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 58d25231e..615cf72c7 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -32,17 +32,6 @@ jobs: distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout core sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-core - ref: release-v5.3.2-and-matpower - path: powsybl-core - - - name: Build and install core - shell: bash - run: scl enable rh-maven33 'mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install' - - name: Checkout sources uses: actions/checkout@v3 with: @@ -122,16 +111,6 @@ jobs: distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout core sources - uses: actions/checkout@v3 - with: - repository: powsybl/powsybl-core - ref: release-v5.3.2-and-matpower - path: powsybl-core - - - name: Build and install core - run: mvn --batch-mode -DskipTests=true --file powsybl-core/pom.xml install - - name: Checkout sources uses: actions/checkout@v3 with: diff --git a/java/pom.xml b/java/pom.xml index bdf32ec24..ef452f3ce 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -69,6 +69,11 @@ 3.2.0 2023.2.2 1.5.2-5 + 5.3.2 + 1.2.2 + 3.3.2 + 1.14.0 + 2.4.0 @@ -156,10 +161,45 @@ + com.powsybl - powsybl-dependencies - ${powsybl-dependencies.version} + powsybl-core + ${powsybl-core.version} + pom + import + + + + + ${project.groupId} + powsybl-diagram + ${powsybl-diagram.version} + pom + import + + + + + com.powsybl + powsybl-open-loadflow + ${powsybl-open-loadflow.version} + + + + + com.powsybl + powsybl-dynawo + ${powsybl-dynawo.version} + pom + import + + + + + com.powsybl + powsybl-entsoe + ${powsybl-entsoe.version} pom import From 17298cbc3bc02a57c88b511030ee6006bec9675c Mon Sep 17 00:00:00 2001 From: EtienneLt <32468651+EtienneLt@users.noreply.github.com> Date: Fri, 21 Jul 2023 08:23:23 +0200 Subject: [PATCH 26/38] add rated s parameter in generator dataframe (#634) * add rated s parameter in generator dataframe Signed-off-by: Etienne LESOT --- docs/user_guide/flowdecomposition.rst | 8 ++++---- docs/user_guide/network.rst | 6 +++--- .../powsybl/dataframe/network/NetworkDataframes.java | 1 + .../dataframe/network/NetworkDataframesTest.java | 4 ++-- pypowsybl/network.py | 2 ++ tests/test_network.py | 5 ++++- tests/test_per_unit.py | 12 ++++++------ 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/docs/user_guide/flowdecomposition.rst b/docs/user_guide/flowdecomposition.rst index 112061c9b..2ff4e4834 100644 --- a/docs/user_guide/flowdecomposition.rst +++ b/docs/user_guide/flowdecomposition.rst @@ -106,10 +106,10 @@ As we cannot set a PST on an interconnection, we set an equivalent null load cal >>> network = pp.network.load(str(DATA_DIR.joinpath('NETWORK_PST_FLOW_WITH_COUNTRIES.uct'))) >>> network.get_generators() - name energy_source target_p min_p max_p min_q max_q reactive_limits_kind target_v target_q voltage_regulator_on regulated_element_id p q i voltage_level_id bus_id connected - id - FGEN 11_generator OTHER 100.0 -1000.0 1000.0 -1000.0 1000.0 MIN_MAX 400.0 0.0 True NaN NaN NaN FGEN 1 FGEN 1_0 True - BLOAD 12_generator OTHER 100.0 -1000.0 1000.0 -1000.0 1000.0 MIN_MAX 400.0 0.0 True NaN NaN NaN BLOAD 1 BLOAD 1_1 True + name energy_source target_p min_p max_p min_q max_q rated_s reactive_limits_kind target_v target_q voltage_regulator_on regulated_element_id p q i voltage_level_id bus_id connected + id + FGEN 11_generator OTHER 100.0 -1000.0 1000.0 -1000.0 1000.0 NaN MIN_MAX 400.0 0.0 True NaN NaN NaN FGEN 1 FGEN 1_0 True + BLOAD 12_generator OTHER 100.0 -1000.0 1000.0 -1000.0 1000.0 NaN MIN_MAX 400.0 0.0 True NaN NaN NaN BLOAD 1 BLOAD 1_1 True >>> network.get_loads() name type p0 q0 p q i voltage_level_id bus_id connected id diff --git a/docs/user_guide/network.rst b/docs/user_guide/network.rst index 701659c64..05f129ca2 100644 --- a/docs/user_guide/network.rst +++ b/docs/user_guide/network.rst @@ -124,10 +124,10 @@ For example, you can retrieve generators data as follows: >>> network = pp.network.create_eurostag_tutorial_example1_network() >>> network.get_generators() # doctest: +NORMALIZE_WHITESPACE - name energy_source target_p min_p max_p min_q max_q reactive_limits_kind target_v target_q voltage_regulator_on regulated_element_id p q i voltage_level_id bus_id connected + name energy_source target_p min_p max_p min_q max_q rated_s reactive_limits_kind target_v target_q voltage_regulator_on regulated_element_id p q i voltage_level_id bus_id connected id - GEN OTHER 607.0 -9999.99 4999.0 -9.999990e+03 9.999990e+03 MIN_MAX 24.5 301.0 True NaN NaN NaN VLGEN VLGEN_0 True - GEN2 OTHER 607.0 -9999.99 4999.0 -1.797693e+308 1.797693e+308 MIN_MAX 24.5 301.0 True NaN NaN NaN VLGEN VLGEN_0 True + GEN OTHER 607.0 -9999.99 4999.0 -9.999990e+03 9.999990e+03 NaN MIN_MAX 24.5 301.0 True NaN NaN NaN VLGEN VLGEN_0 True + GEN2 OTHER 607.0 -9999.99 4999.0 -1.797693e+308 1.797693e+308 NaN MIN_MAX 24.5 301.0 True NaN NaN NaN VLGEN VLGEN_0 True Most dataframes are indexed on the ID of the elements. However, some more complex dataframes have a multi-index : for example, diff --git a/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java b/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java index ac0eae5eb..ec98025e8 100644 --- a/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java +++ b/java/src/main/java/com/powsybl/dataframe/network/NetworkDataframes.java @@ -255,6 +255,7 @@ static NetworkDataframeMapper generators() { .doubles("max_q_at_target_p", getMaxQ(Generator::getTargetP), false) .doubles("min_q_at_p", getMinQ(getOppositeP()), false) .doubles("max_q_at_p", getMaxQ(getOppositeP()), false) + .doubles("rated_s", Generator::getRatedS, Generator::setRatedS) .strings("reactive_limits_kind", NetworkDataframes::getReactiveLimitsKind) .doubles("target_v", Generator::getTargetV, Generator::setTargetV) .doubles("target_q", Generator::getTargetQ, Generator::setTargetQ) diff --git a/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java b/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java index 2578d82ea..9da7d726e 100644 --- a/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java +++ b/java/src/test/java/com/powsybl/dataframe/network/NetworkDataframesTest.java @@ -121,7 +121,7 @@ void generators() { assertThat(series) .extracting(Series::getName) - .containsExactly("id", "name", "energy_source", "target_p", "min_p", "max_p", "min_q", "max_q", "reactive_limits_kind", + .containsExactly("id", "name", "energy_source", "target_p", "min_p", "max_p", "min_q", "max_q", "rated_s", "reactive_limits_kind", "target_v", "target_q", "voltage_regulator_on", "regulated_element_id", "p", "q", "i", "voltage_level_id", "bus_id", "connected"); @@ -132,7 +132,7 @@ void generators() { assertThat(allAttributeSeries) .extracting(Series::getName) .containsExactly("id", "name", "energy_source", "target_p", "min_p", "max_p", "min_q", "max_q", - "min_q_at_target_p", "max_q_at_target_p", "min_q_at_p", "max_q_at_p", "reactive_limits_kind", + "min_q_at_target_p", "max_q_at_target_p", "min_q_at_p", "max_q_at_p", "rated_s", "reactive_limits_kind", "target_v", "target_q", "voltage_regulator_on", "regulated_element_id", "p", "q", "i", "voltage_level_id", "bus_id", "bus_breaker_bus_id", "node", "connected", "fictitious"); } diff --git a/pypowsybl/network.py b/pypowsybl/network.py index 7ef028621..1873ecba2 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -604,6 +604,7 @@ def get_generators(self, all_attributes: bool = False, attributes: _List[str] = - **min_q_at_target_p** (optional): the minimum reactive value for the generator for the target p specified (MVar) - **max_q_at_p** (optional): the maximum reactive value for the generator at current p (MVar) - **min_q_at_p** (optional): the minimum reactive value for the generator at current p (MVar) + - **rated_s** : The rated nominal power (MVA) - **reactive_limits_kind**: type of the reactive limit of the generator (can be MIN_MAX, CURVE or NONE) - **target_v**: the target voltage magnitude value for the generator (in kV) - **target_q**: the target reactive value for the generator (in MVAr) @@ -2437,6 +2438,7 @@ def update_generators(self, df: _DataFrame = None, **kwargs: _ArrayLike) -> None - `target_p` - `max_p` - `min_p` + - `rated_s` - `target_v` - `target_q` - `voltage_regulator_on` diff --git a/tests/test_network.py b/tests/test_network.py index 347d4cad1..0cd2d3fbe 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -402,7 +402,7 @@ def test_svc_data_frame(): check_dtype=False, atol=1e-2) -def test_create_generators_data_frame(): +def test_generators_data_frame(): n = pp.network.create_eurostag_tutorial_example1_network() generators = n.get_generators(all_attributes=True) assert 'OTHER' == generators['energy_source']['GEN'] @@ -414,6 +414,9 @@ def test_create_generators_data_frame(): assert 9999.99 == generators['max_q_at_p']['GEN'] assert -9999.99 == generators['min_q_at_target_p']['GEN'] assert 9999.99 == generators['max_q_at_target_p']['GEN'] + n.update_generators(id='GEN', rated_s=100) + generators = n.get_generators(all_attributes=True) + assert 100 == generators['rated_s']['GEN'] n = pp.network.create_four_substations_node_breaker_network() generators = n.get_generators(attributes=['bus_breaker_bus_id', 'node']) expected = pd.DataFrame( diff --git a/tests/test_per_unit.py b/tests/test_per_unit.py index 7dc8a19ca..3f8184b5d 100644 --- a/tests/test_per_unit.py +++ b/tests/test_per_unit.py @@ -43,14 +43,14 @@ def test_generator_per_unit(): n = per_unit_view(n, 100) expected = pd.DataFrame.from_records( index='id', - columns=['id', 'name', 'energy_source', 'target_p', 'min_p', 'max_p', 'min_q', 'max_q', 'reactive_limits_kind', + columns=['id', 'name', 'energy_source', 'target_p', 'min_p', 'max_p', 'min_q', 'max_q', 'rated_s', 'reactive_limits_kind', 'target_v', 'target_q', 'voltage_regulator_on', 'regulated_element_id', 'p', 'q', 'i', 'voltage_level_id', 'bus_id', 'connected'], - data=[['GEN', '', 'OTHER', 6.07, -100, 49.99, -100, 100, 'MIN_MAX', 1.02, 3.01, True, '', -3.03, -1.12641, + data=[['GEN', '', 'OTHER', 6.07, -100, 49.99, -100, 100, None, 'MIN_MAX', 1.02, 3.01, True, '', -3.03, -1.12641, 3.16461, 'VLGEN', 'VLGEN_0', True], - ['GEN2', '', 'OTHER', 6.07, -100, 49.99, -1.79769e+306, 1.79769e+306, 'MIN_MAX', 1.02, 3.01, True, '', + ['GEN2', '', 'OTHER', 6.07, -100, 49.99, -1.79769e+306, 1.79769e+306, None, 'MIN_MAX', 1.02, 3.01, True, '', -3.03, -1.13, 3.16, 'VLGEN', 'VLGEN_0', True]]) pd.testing.assert_frame_equal(expected, n.get_generators(), check_dtype=False, atol=1e-2) @@ -60,13 +60,13 @@ def test_generator_per_unit(): n.update_generators(generators2) expected = pd.DataFrame.from_records( index='id', - columns=['id', 'name', 'energy_source', 'target_p', 'min_p', 'max_p', 'min_q', 'max_q', 'reactive_limits_kind', + columns=['id', 'name', 'energy_source', 'target_p', 'min_p', 'max_p', 'min_q', 'max_q', 'rated_s', 'reactive_limits_kind', 'target_v', 'target_q', 'voltage_regulator_on', 'regulated_element_id', 'p', 'q', 'i', 'voltage_level_id', 'bus_id', 'connected'], - data=[['GEN', '', 'OTHER', 6.07, -100, 49.99, -100, 100, 'MIN_MAX', 1.1, 3.02, False, '', -3.03, -1.12641, NaN, + data=[['GEN', '', 'OTHER', 6.07, -100, 49.99, -100, 100, None, 'MIN_MAX', 1.1, 3.02, False, '', -3.03, -1.12641, NaN, 'VLGEN', '', False], - ['GEN2', '', 'OTHER', 6.07, -100, 49.99, -1.79769e+306, 1.79769e+306, 'MIN_MAX', 1.02, 3.01, True, '', + ['GEN2', '', 'OTHER', 6.07, -100, 49.99, -1.79769e+306, 1.79769e+306, None, 'MIN_MAX', 1.02, 3.01, True, '', -3.03, -1.13, 3.16, 'VLGEN', 'VLGEN_0', True]]) pd.testing.assert_frame_equal(expected, n.get_generators(), check_dtype=False, atol=1e-2) From 5f35ce0a6e77d0c5150c55ad76614d48fa49323c Mon Sep 17 00:00:00 2001 From: EtienneLt <32468651+EtienneLt@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:02:15 +0200 Subject: [PATCH 27/38] upgrade powsybl dependencies to v2023.2.3 (#633) Signed-off-by: Etienne LESOT --- java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index ef452f3ce..2f6f3adec 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -67,7 +67,7 @@ 5.5.2 3.0.8 3.2.0 - 2023.2.2 + 2023.2.3 1.5.2-5 5.3.2 1.2.2 From 6654acd444ffcd0c2019ba59ef4033bc48760c34 Mon Sep 17 00:00:00 2001 From: EtienneLt <32468651+EtienneLt@users.noreply.github.com> Date: Mon, 24 Jul 2023 17:11:49 +0200 Subject: [PATCH 28/38] upgrade powsybl dependencies to v2023.2.4 (#636) Signed-off-by: Etienne LESOT --- java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index 2f6f3adec..a5f40a8d3 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -67,7 +67,7 @@ 5.5.2 3.0.8 3.2.0 - 2023.2.3 + 2023.2.4 1.5.2-5 5.3.2 1.2.2 From 82c1edef6082a7855e8b4a70cbe2be598cd7be8b Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Mon, 24 Jul 2023 16:35:44 +0200 Subject: [PATCH 29/38] release v0.24.0 Signed-off-by: Etienne LESOT --- java/pom.xml | 2 +- pypowsybl/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/pom.xml b/java/pom.xml index a5f40a8d3..40fa74956 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -58,7 +58,7 @@ jar - 0.24.0-SNAPSHOT + 0.24.0 4.4 diff --git a/pypowsybl/__init__.py b/pypowsybl/__init__.py index 3de814d0b..785001724 100644 --- a/pypowsybl/__init__.py +++ b/pypowsybl/__init__.py @@ -20,7 +20,7 @@ perunit ) -__version__ = '0.24.0.dev1' +__version__ = '0.24.0' # set JVM java.library.path to pypowsybl module installation directory to be able to load math library _pypowsybl.set_java_library_path(_os.path.dirname(_inspect.getfile(_pypowsybl))) From 1bf04f89a6bf4504a6abb6703d393fb1fa35c024 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Mon, 24 Jul 2023 16:36:20 +0200 Subject: [PATCH 30/38] bump to version 0.25.0.dev1 Signed-off-by: Etienne LESOT --- java/pom.xml | 2 +- pypowsybl/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/pom.xml b/java/pom.xml index 40fa74956..ca4856bb2 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -58,7 +58,7 @@ jar - 0.24.0 + 0.25.0-SNAPSHOT 4.4 diff --git a/pypowsybl/__init__.py b/pypowsybl/__init__.py index 785001724..ca9c423ed 100644 --- a/pypowsybl/__init__.py +++ b/pypowsybl/__init__.py @@ -20,7 +20,7 @@ perunit ) -__version__ = '0.24.0' +__version__ = '0.25.0.dev1' # set JVM java.library.path to pypowsybl module installation directory to be able to load math library _pypowsybl.set_java_library_path(_os.path.dirname(_inspect.getfile(_pypowsybl))) From 0bc7fb05cab143b8e51b3ce38fc6d2171d88fc34 Mon Sep 17 00:00:00 2001 From: Coline Piloquet <55250145+colinepiloquet@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:00:53 +0200 Subject: [PATCH 31/38] Fix attributes name in docstring (#638) Signed-off-by: Coline PILOQUET --- pypowsybl/network.py | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/pypowsybl/network.py b/pypowsybl/network.py index 1873ecba2..4c2b971d9 100644 --- a/pypowsybl/network.py +++ b/pypowsybl/network.py @@ -5301,8 +5301,8 @@ def create_load_bay(network: Network, df: _DataFrame = None, raise_exception: bo - **p0**: active power load, in MW - **q0**: reactive power load, in MVar - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **load_position_order**: in node/breaker, the order of the load, will fill the ConnectablePosition extension - - **load_direction**: optionally, in node/breaker, the direction of the load, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the load, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the load, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.LOAD, raise_exception, reporter, **kwargs) @@ -5336,8 +5336,8 @@ def create_battery_bay(network: Network, df: _DataFrame = None, raise_exception: - **target_p**: active power consumption, in MW - **target_q**: reactive power consumption, in MVar - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **battery_position_order**: in node/breaker, the order of the battery, will fill the ConnectablePosition extension - - **battery_direction**: optionally, in node/breaker, the direction of the battery, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the battery, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the battery, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.BATTERY, raise_exception, reporter, **kwargs) @@ -5375,8 +5375,8 @@ def create_generator_bay(network: Network, df: _DataFrame = None, raise_exceptio - **target_v**: target voltage in kV, when the generator regulates voltage - **voltage_regulator_on**: true if the generator regulates voltage - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **generator_position_order**: in node/breaker, the order of the generator, will fill the ConnectablePosition extension - - **generator_direction**: optionally, in node/breaker, the direction of the generator, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the generator, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the generator, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.GENERATOR, raise_exception, reporter, **kwargs) @@ -5413,8 +5413,8 @@ def create_dangling_line_bay(network: Network, df: _DataFrame = None, raise_exce - **g**: the shunt conductance, in S - **b**: the shunt susceptance, in S - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **dangling_line_position_order**: in node/breaker, the order of the dangling line, will fill the ConnectablePosition extension - - **dangling_line_direction**: optionally, in node/breaker, the direction of the dangling line, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the dangling line, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the dangling line, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.DANGLING_LINE, raise_exception, reporter, **kwargs) @@ -5452,8 +5452,8 @@ def create_shunt_compensator_bay(network: Network, shunt_df: _DataFrame, - **target_v**: an optional target voltage in kV - **target_v**: an optional deadband for the target voltage, in kV - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **shunt_compensator_position_order**: in node/breaker, the order of the shunt compensator, will fill the ConnectablePosition extension - - **shunt_compensator_direction**: optionally, in node/breaker, the direction of the shunt compensator, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the shunt compensator, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the shunt compensator, will fill the ConnectablePosition extension, default is BOTTOM. Valid attributes for the linear sections models are: @@ -5509,8 +5509,8 @@ def create_static_var_compensator_bay(network: Network, df: _DataFrame = None, r - **target_v**: the target voltage, in kV, when the regulation mode is VOLTAGE - **target_q**: the target reactive power, in MVar, when the regulation mode is not VOLTAGE - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **static_var_compensator_position_order**: in node/breaker, the order of the static var compensator, will fill the ConnectablePosition extension - - **static_var_compensator_direction**: optionally, in node/breaker, the direction of the static var compensator, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the static var compensator, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the static var compensator, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.STATIC_VAR_COMPENSATOR, raise_exception, reporter, **kwargs) @@ -5543,8 +5543,8 @@ def create_lcc_converter_station_bay(network: Network, df: _DataFrame = None, ra - **power_factor**: the power factor (ratio of the active power to the apparent power) - **loss_factor**: the loss factor of the station - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **lcc_converter_station_position_order**: in node/breaker, the order of the lcc converter station, will fill the ConnectablePosition extension - - **lcc_converter_station_direction**: optionally, in node/breaker, the direction of the lcc converter station, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the lcc converter station, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the lcc converter station, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.LCC_CONVERTER_STATION, raise_exception, reporter, **kwargs) @@ -5579,8 +5579,8 @@ def create_vsc_converter_station_bay(network: Network, df: _DataFrame = None, ra - **target_v**: the target voltage, in kV, when the station regulates voltage - **target_q**: the target reactive power, in MVar, when the station does not regulate voltage - **bus_or_busbar_section_id**: id of the bus or of the busbar section to which the injection will be connected with a closed disconnector. - - **vsc_converter_station_position_order**: in node/breaker, the order of the vsc converter station, will fill the ConnectablePosition extension - - **vsc_converter_station_direction**: optionally, in node/breaker, the direction of the vsc converter station, will fill the ConnectablePosition extension, default is BOTTOM. + - **position_order**: in node/breaker, the order of the vsc converter station, will fill the ConnectablePosition extension + - **direction**: optionally, in node/breaker, the direction of the vsc converter station, will fill the ConnectablePosition extension, default is BOTTOM. """ return _create_feeder_bay(network, [df], ElementType.VSC_CONVERTER_STATION, raise_exception, reporter, **kwargs) @@ -5655,11 +5655,11 @@ def create_line_bays(network: Network, df: _DataFrame = None, raise_exception: b additional following attributes: - **bus_or_busbar_section_id_1**: the identifier of the bus or of the busbar section on side 1 - - **position_order_1**: in node/breaker, the position of the feeder on side 1 - - **direction_1**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the feeder on side 1 + - **position_order_1**: in node/breaker, the position of the line on side 1 + - **direction_1**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the line on side 1 - **bus_or_busbar_section_id_2**: the identifier of the bus or of the busbar section on side 2 - - **position_order_2**: in node/breaker, the position of the feeder on side 2 - - **direction_2**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the feeder on side 2 + - **position_order_2**: in node/breaker, the position of the line on side 2 + - **direction_2**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the line on side 2 Examples: @@ -5710,11 +5710,11 @@ def create_2_windings_transformer_bays(network: Network, df: _DataFrame = None, additional following attributes: - **bus_or_busbar_section_id_1**: the identifier of the bus or of the busbar section on side 1 - - **position_order_1**: in node/breaker topology, the position of the feeder on side 1 - - **direction_1**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the feeder on side 1 + - **position_order_1**: in node/breaker topology, the position of the transformer on side 1 + - **direction_1**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the transformer on side 1 - **bus_or_busbar_section_id_2**: the identifier of the bus or of the busbar section on side 2 - - **position_order_2**: in node/breaker, the position of the feeder on side 2 - - **direction_2**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the feeder on side 2 + - **position_order_2**: in node/breaker, the position of the transformer on side 2 + - **direction_2**: optionally, in node/breaker, the direction, TOP or BOTTOM, of the transformer on side 2 Examples: From c0df2a031c3dec6c6fbcc1793fb0190fbf24c569 Mon Sep 17 00:00:00 2001 From: EtienneLt <32468651+EtienneLt@users.noreply.github.com> Date: Wed, 26 Jul 2023 10:12:31 +0200 Subject: [PATCH 32/38] fix pom (#639) Signed-off-by: Etienne LESOT --- java/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index ca4856bb2..9dc45a789 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -146,7 +146,6 @@ org.apache.maven.plugins maven-shade-plugin - ${maven-shade-plugin.version} shade From 5916a27a7cd4f5ff15b843e0809f26258318b6a1 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Wed, 16 Aug 2023 22:37:06 +0200 Subject: [PATCH 33/38] Test Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 22 ++++++++++++++++++++++ java/pom.xml | 6 +++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 615cf72c7..27966d087 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -37,6 +37,17 @@ jobs: with: submodules: true + - name: Checkout olf sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-open-loadflow + ref: integration-v1.2.4 + path: powsybl-open-loadflow + + - name: Build and install olf + shell: bash + run: scl enable rh-maven33 'mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install' + - name: Setup path run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH @@ -116,6 +127,17 @@ jobs: with: submodules: true + - name: Checkout olf sources + uses: actions/checkout@v3 + with: + repository: powsybl/powsybl-open-loadflow + ref: integration-v1.2.4 + path: powsybl-open-loadflow + + - name: Build and install olf + shell: bash + run: mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install + - name: Setup Python uses: actions/setup-python@v4 with: diff --git a/java/pom.xml b/java/pom.xml index 9dc45a789..0360685cb 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -70,10 +70,10 @@ 2023.2.4 1.5.2-5 5.3.2 - 1.2.2 + 1.2.4-SNAPSHOT 3.3.2 - 1.14.0 - 2.4.0 + 1.14.1 + 2.5.0 From 1f978e86a140a960386736ace451b07a3e99346f Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Mon, 21 Aug 2023 20:49:33 +0200 Subject: [PATCH 34/38] Test Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 27966d087..f53ff30ac 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -16,9 +16,9 @@ jobs: matrix: python: - { - name: cp311, - abi: cp311, - version: '3.11', + name: cp38, + abi: cp38, + version: '3.8', } steps: @@ -110,8 +110,8 @@ jobs: } python: - { - name: cp311, - version: '3.11', + name: cp38, + version: '3.8', } steps: From 6b5204bd16a71d9d09c6e4ed2083d9d70a0d1eb2 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Wed, 6 Sep 2023 20:39:32 +0200 Subject: [PATCH 35/38] Fix Signed-off-by: Geoffroy Jamgotchian --- tests/test_loadflow.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_loadflow.py b/tests/test_loadflow.py index e0c934eed..edfb64bba 100644 --- a/tests/test_loadflow.py +++ b/tests/test_loadflow.py @@ -214,7 +214,6 @@ def test_get_provider_parameters_names(): 'debugDir', 'incrementalTransformerVoltageControlOuterLoopMaxTapShift', 'secondaryVoltageControl', - 'controllerToPilotPointVoltageSensiEpsilon', 'reactiveLimitsMaxPqPvSwitch', 'newtonRaphsonStoppingCriteriaType', 'maxActivePowerMismatch', @@ -236,7 +235,7 @@ def test_get_provider_parameters_names(): def test_get_provider_parameters(): specific_parameters = pp.loadflow.get_provider_parameters('OpenLoadFlow') - assert 46 == len(specific_parameters) + assert 45 == len(specific_parameters) assert 'Slack bus selection mode' == specific_parameters['description']['slackBusSelectionMode'] assert 'STRING' == specific_parameters['type']['slackBusSelectionMode'] assert 'MOST_MESHED' == specific_parameters['default']['slackBusSelectionMode'] From 74f25c10ac52b5978fe02a9fcbc89bc4ded1f5e4 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Sun, 10 Sep 2023 22:56:03 +0200 Subject: [PATCH 36/38] Test Signed-off-by: Geoffroy Jamgotchian --- tests/test_loadflow.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_loadflow.py b/tests/test_loadflow.py index edfb64bba..254084d8f 100644 --- a/tests/test_loadflow.py +++ b/tests/test_loadflow.py @@ -229,13 +229,14 @@ def test_get_provider_parameters_names(): 'slackBusCountryFilter', 'actionableSwitchesIds', 'asymmetrical', - 'minNominalVoltageTargetVoltageCheck' + 'minNominalVoltageTargetVoltageCheck', + 'reactivePowerDispatchMode' ] def test_get_provider_parameters(): specific_parameters = pp.loadflow.get_provider_parameters('OpenLoadFlow') - assert 45 == len(specific_parameters) + assert 46 == len(specific_parameters) assert 'Slack bus selection mode' == specific_parameters['description']['slackBusSelectionMode'] assert 'STRING' == specific_parameters['type']['slackBusSelectionMode'] assert 'MOST_MESHED' == specific_parameters['default']['slackBusSelectionMode'] From eb65a7db8d627b0a6b94f077fd87c41c974b0f37 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 25 Apr 2024 11:01:33 +0200 Subject: [PATCH 37/38] Wip Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 6 +++--- java/pom.xml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 1fda5277c..5caa354ea 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -47,12 +47,12 @@ jobs: uses: actions/checkout@v3 with: repository: powsybl/powsybl-open-loadflow - ref: integration-v1.2.4 + ref: fix-svc-targetV path: powsybl-open-loadflow - name: Build and install olf shell: bash - run: scl enable rh-maven33 'mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install' + run: mvn --batch-mode -DskipTests=true --file powsybl-open-loadflow/pom.xml install - name: Setup path run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH @@ -137,7 +137,7 @@ jobs: uses: actions/checkout@v3 with: repository: powsybl/powsybl-open-loadflow - ref: integration-v1.2.4 + ref: fix-svc-targetV path: powsybl-open-loadflow - name: Build and install olf diff --git a/java/pom.xml b/java/pom.xml index 24173a6f3..88708dd31 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -71,11 +71,11 @@ 2024.1.0 0.6.0 1.5.5-3 - 5.3.2 - 1.2.4-SNAPSHOT - 3.3.2 - 1.14.1 - 2.5.0 + 6.3.0 + 1.10.0-SNAPSHOT + 4.4.0 + 2.4.0 + 2.9.0 From a412dad440fc5cf0a26040ff54474ea20d4dbd42 Mon Sep 17 00:00:00 2001 From: Geoffroy Jamgotchian Date: Thu, 25 Apr 2024 11:50:48 +0200 Subject: [PATCH 38/38] Wip Signed-off-by: Geoffroy Jamgotchian --- .github/workflows/dev-ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index 5caa354ea..ac3bd84e7 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -16,9 +16,9 @@ jobs: matrix: python: - { - name: cp38, - abi: cp38, - version: '3.8', + name: cp310, + abi: cp310, + version: '3.10', } steps: @@ -116,8 +116,8 @@ jobs: } python: - { - name: cp38, - version: '3.8', + name: cp310, + version: '3.10', } steps: