Skip to content

Commit

Permalink
Upgrade powsybl dependencies to v2023.4.0 (#687)
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
Co-authored-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
  • Loading branch information
EtienneLt and geofjamg committed Jan 11, 2024
1 parent 036a5ac commit 6b62348
Show file tree
Hide file tree
Showing 41 changed files with 197 additions and 171 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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
container: quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463
strategy:
matrix:
python:
Expand All @@ -23,7 +23,16 @@ jobs:

steps:
- name: Install Linux packages
run: yum install -y rh-maven33-maven zlib-devel.x86_64
run: |
echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list
apt-get update
apt install -y wget
- name: Install Maven
run: |
wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz -P /tmp
tar xf /tmp/apache-maven-*.tar.gz -C /opt
echo /opt/apache-maven-3.9.6/bin >> $GITHUB_PATH
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
Expand All @@ -45,7 +54,7 @@ jobs:

- name: Build wheel
run: |
scl enable rh-maven33 'python3 setup.py bdist_wheel'
python3 setup.py bdist_wheel
auditwheel repair dist/*.whl
- name: Install wheel
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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
container: quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463
strategy:
matrix:
python:
Expand All @@ -38,7 +38,16 @@ jobs:

steps:
- name: Install Linux packages
run: yum install -y rh-maven33-maven zlib-devel.x86_64
run: |
echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list
apt-get update
apt install -y wget
- name: Install Maven
run: |
wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz -P /tmp
tar xf /tmp/apache-maven-*.tar.gz -C /opt
echo /opt/apache-maven-3.9.6/bin >> $GITHUB_PATH
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
Expand All @@ -60,7 +69,7 @@ jobs:

- name: Build wheel
run: |
scl enable rh-maven33 'python3 setup.py bdist_wheel'
python3 setup.py bdist_wheel
auditwheel repair dist/*.whl
- name: Install wheel
Expand Down
1 change: 0 additions & 1 deletion cpp/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ void voltageInitializerBinding(py::module_& m) {
m.def("voltage_initializer_add_specific_low_voltage_limits", &pypowsybl::voltageInitializerAddSpecificLowVoltageLimits, py::arg("params_handle"), py::arg("voltage_level_id"), py::arg("is_relative"), py::arg("limit"));
m.def("voltage_initializer_add_specific_high_voltage_limits", &pypowsybl::voltageInitializerAddSpecificHighVoltageLimits, py::arg("params_handle"), py::arg("voltage_level_id"), py::arg("is_relative"), py::arg("limit"));

m.def("voltage_initializer_add_algorithm_param", &pypowsybl::voltageInitializerAddAlgorithmParam, py::arg("params_handle"), py::arg("key_ptr"), py::arg("value_ptr"));
m.def("voltage_initializer_set_objective", &pypowsybl::voltageInitializerSetObjective, py::arg("params_handle"), py::arg("c_objective"));
m.def("voltage_initializer_set_objective_distance", &pypowsybl::voltageInitializerSetObjectiveDistance, py::arg("params_handle"), py::arg("dist"));
m.def("run_voltage_initializer", &pypowsybl::runVoltageInitializer, py::arg("debug"), py::arg("network_handle"), py::arg("params_handle"));
Expand Down
4 changes: 0 additions & 4 deletions cpp/src/pypowsybl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,10 +1517,6 @@ void voltageInitializerAddVariableTwoWindingsTransformers(const JavaHandle& para
pypowsybl::callJava(::voltageInitializerAddVariableTwoWindingsTransformers, paramsHandle, (char*) idPtr.c_str());
}

void voltageInitializerAddAlgorithmParam(const JavaHandle& paramsHandle, const std::string& keyPtr, const std::string& valuePtr) {
pypowsybl::callJava(::voltageInitializerAddAlgorithmParam, paramsHandle, (char*) keyPtr.c_str(), (char*) valuePtr.c_str());
}

void voltageInitializerSetObjective(const JavaHandle& paramsHandle, VoltageInitializerObjective cObjective) {
pypowsybl::callJava(::voltageInitializerSetObjective, paramsHandle, cObjective);
}
Expand Down
1 change: 0 additions & 1 deletion cpp/src/pypowsybl.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ void voltageInitializerAddSpecificHighVoltageLimits(const JavaHandle& paramsHand
void voltageInitializerAddVariableShuntCompensators(const JavaHandle& paramsHandle, const std::string& idPtr);
void voltageInitializerAddConstantQGenerators(const JavaHandle& paramsHandle, const std::string& idPtr);
void voltageInitializerAddVariableTwoWindingsTransformers(const JavaHandle& paramsHandle, const std::string& idPtr);
void voltageInitializerAddAlgorithmParam(const JavaHandle& paramsHandle, const std::string& keyPtr, const std::string& valuePtr);
void voltageInitializerSetObjective(const JavaHandle& paramsHandle, VoltageInitializerObjective cObjective);
void voltageInitializerSetObjectiveDistance(const JavaHandle& paramsHandle, double dist);
void voltageInitializerApplyAllModifications(const JavaHandle& resultHandle, const JavaHandle& networkHandle);
Expand Down
1 change: 0 additions & 1 deletion docs/reference/voltage_initializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ VoltageInitializerParameters : How to parameterize the tool
VoltageInitializerParameters.add_variable_two_windings_transformers
VoltageInitializerParameters.add_specific_low_voltage_limits
VoltageInitializerParameters.add_specific_high_voltage_limits
VoltageInitializerParameters.add_algorithm_param
VoltageInitializerParameters.set_objective
VoltageInitializerParameters.set_objective_distance

Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The supported formats are the following:
.. doctest::

>>> pp.network.get_import_formats()
['CGMES', 'MATPOWER', 'IEEE-CDF', 'PSS/E', 'UCTE', 'XIIDM', 'POWER-FACTORY']
['CGMES', 'JIIDM', 'MATPOWER', 'IEEE-CDF', 'PSS/E', 'UCTE', 'XIIDM', 'POWER-FACTORY']

.. Note::

Expand Down Expand Up @@ -87,7 +87,7 @@ The supported formats are:
.. doctest::

>>> pp.network.get_export_formats()
['AMPL', 'CGMES', 'MATPOWER', 'PSS/E', 'UCTE', 'XIIDM']
['AMPL', 'CGMES', 'JIIDM', 'MATPOWER', 'PSS/E', 'UCTE', 'XIIDM']

.. Note::

Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ the violations created by the contingency, they are collected by contingency in
>>> result.limit_violations
subject_name limit_type limit_name limit acceptable_duration limit_reduction value side
contingency_id subject_id
NHV1_NHV2_1 CURRENT 500.0 2147483647 1.0 623.568946 ONE
NHV1_NHV2_2 CURRENT 500.0 2147483647 1.0 655.409876 TWO
NHV1_NHV2_1 CURRENT permanent 500.0 2147483647 1.0 623.568946 ONE
NHV1_NHV2_2 CURRENT permanent 500.0 2147483647 1.0 655.409876 TWO
VLHV1 LOW_VOLTAGE 400.0 2147483647 1.0 398.917401
First contingency NHV1_NHV2_2 CURRENT 20' 1200.0 60 1.0 1438.021676 ONE
NHV1_NHV2_2 CURRENT 500.0 2147483647 1.0 1477.824335 TWO
NHV1_NHV2_2 CURRENT permanent 500.0 2147483647 1.0 1477.824335 TWO
VLHV1 LOW_VOLTAGE 400.0 2147483647 1.0 392.158685


Expand Down
1 change: 0 additions & 1 deletion docs/user_guide/voltage_initializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Here is a simple starting example:
some_2wt_id = n.get_2_windings_transformers().iloc[0].name
params.add_variable_two_windings_transformers([some_2wt_id])
params.add_algorithm_param({"foo": "bar", "bar": "bar2"})
params.set_objective(VoltageInitializerObjective.SPECIFIC_VOLTAGE_PROFILE)
results = v_init.run(n, params)
Expand Down
6 changes: 3 additions & 3 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
<junit-jupiter.version>5.5.2</junit-jupiter.version>
<mapdb.version>3.0.8</mapdb.version>
<maven-dependency-plugin.version>3.6.0</maven-dependency-plugin.version>
<powsybl-dependencies.version>2023.3.2</powsybl-dependencies.version>
<powsybl-open-reac.version>0.3.0</powsybl-open-reac.version>
<powsybl-dependencies.version>2023.4.0</powsybl-dependencies.version>
<powsybl-open-reac.version>0.5.0</powsybl-open-reac.version>
<zstdjni.version>1.5.5-3</zstdjni.version>
</properties>

Expand Down Expand Up @@ -313,7 +313,7 @@
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-xml-converter</artifactId>
<artifactId>powsybl-iidm-serde</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.dataframe.network.adders.SeriesUtils;
import com.powsybl.dataframe.update.StringSeries;
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.python.dynamic.DynamicModelMapper;
import com.powsybl.python.dynamic.PythonDynamicModelsSupplier;

/**
* @author Nicolas Pierre <nicolas.pierre@artelys.com>
Expand Down Expand Up @@ -50,13 +50,13 @@ public StringSeries getParameterSetId() {

@FunctionalInterface
protected interface AddBlackBoxToModelMapping {
void addToModel(DynamicModelMapper modelMapping, String staticId, String parameterSetId);
void addToModel(PythonDynamicModelsSupplier modelMapping, String staticId, String parameterSetId);
}

protected abstract AddBlackBoxToModelMapping getAddBlackBoxToModelMapping();

@Override
public void addElements(DynamicModelMapper modelMapping, UpdatingDataframe dataframe) {
public void addElements(PythonDynamicModelsSupplier modelMapping, UpdatingDataframe dataframe) {
BlackBoxSeries series = new BlackBoxSeries(dataframe);
AddBlackBoxToModelMapping adder = getAddBlackBoxToModelMapping();
for (int row = 0; row < dataframe.getRowCount(); row++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.python.commons.PyPowsyblApiHeader;
import com.powsybl.python.commons.Util;
import com.powsybl.python.dynamic.DynamicModelMapper;
import com.powsybl.python.dynamic.PythonDynamicModelsSupplier;

/**
* @author Nicolas Pierre <nicolas.pierre@artelys.com>
Expand Down Expand Up @@ -59,7 +59,7 @@ public IntSeries getBranchSide() {
}

@Override
public void addElements(DynamicModelMapper modelMapping, UpdatingDataframe dataframe) {
public void addElements(PythonDynamicModelsSupplier modelMapping, UpdatingDataframe dataframe) {
CurrentLimitAutomatonSeries series = new CurrentLimitAutomatonSeries(dataframe);
for (int row = 0; row < dataframe.getRowCount(); row++) {
modelMapping.addCurrentLimitAutomaton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import com.powsybl.dataframe.SeriesMetadata;
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.python.dynamic.DynamicModelMapper;
import com.powsybl.python.dynamic.PythonDynamicModelsSupplier;

import java.util.List;

Expand All @@ -28,6 +28,6 @@ public interface DynamicMappingAdder {
* The first dataframe is considered the "primary" dataframe, other dataframes
* can provide additional data.
*/
void addElements(DynamicModelMapper modelMapping, UpdatingDataframe dataframe);
void addElements(PythonDynamicModelsSupplier modelMapping, UpdatingDataframe dataframe);

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.dataframe.network.adders.SeriesUtils;
import com.powsybl.dataframe.update.StringSeries;
import com.powsybl.dataframe.update.UpdatingDataframe;
import com.powsybl.python.dynamic.DynamicModelMapper;
import com.powsybl.python.dynamic.PythonDynamicModelsSupplier;

/**
* @author Nicolas Pierre <nicolas.pierre@artelys.com>
Expand Down Expand Up @@ -56,7 +56,7 @@ public StringSeries getGeneratorLib() {
}

@Override
public void addElements(DynamicModelMapper modelMapping, UpdatingDataframe dataframe) {
public void addElements(PythonDynamicModelsSupplier modelMapping, UpdatingDataframe dataframe) {
GeneratorSynchronousSeries series = new GeneratorSynchronousSeries(dataframe);
for (int row = 0; row < dataframe.getRowCount(); row++) {
modelMapping.addGeneratorSynchronous(series.getStaticId().get(row),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
package com.powsybl.dataframe.loadflow.validation;

import com.powsybl.iidm.network.Branch;
import com.powsybl.iidm.network.StaticVarCompensator;
import com.powsybl.iidm.network.TwoSides;
import com.powsybl.iidm.network.util.TwtData;
import com.powsybl.loadflow.validation.io.ValidationWriter;

Expand Down Expand Up @@ -82,7 +82,7 @@ public void write(String shuntId, double q, double expectedQ, double p, int curr
}

@Override
public void write(String twtId, double error, double upIncrement, double downIncrement, double rho, double rhoPreviousStep, double rhoNextStep, int tapPosition, int lowTapPosition, int highTapPosition, double targetV, Branch.Side regulatedSide, double v, boolean connected, boolean mainComponent, boolean validated) throws IOException {
public void write(String twtId, double error, double upIncrement, double downIncrement, double rho, double rhoPreviousStep, double rhoNextStep, int tapPosition, int lowTapPosition, int highTapPosition, double targetV, TwoSides regulatedSide, double v, boolean connected, boolean mainComponent, boolean validated) throws IOException {
twtData.add(new TwtValidationData(twtId, error, upIncrement, downIncrement, rho, rhoPreviousStep, rhoNextStep, tapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, v, connected, mainComponent, validated));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.powsybl.dataframe.loadflow.validation;

import com.powsybl.iidm.network.Branch;
import com.powsybl.iidm.network.TwoSides;

/**
* @author Yichen TANG <yichen.tang at rte-france.com>
Expand All @@ -17,13 +17,15 @@ class TwtValidationData {
int lowTapPosition;
int highTapPosition;
double targetV;
Branch.Side regulatedSide;
TwoSides regulatedSide;
double v;
boolean connected;
boolean mainComponent;
boolean validated;

TwtValidationData(String id, double error, double upIncrement, double downIncrement, double rho, double rhoPreviousStep, double rhoNextStep, int tapPosition, int lowTapPosition, int highTapPosition, double targetV, Branch.Side regulatedSide, double v, boolean connected, boolean mainComponent, boolean validated) {
TwtValidationData(String id, double error, double upIncrement, double downIncrement, double rho, double rhoPreviousStep,
double rhoNextStep, int tapPosition, int lowTapPosition, int highTapPosition, double targetV,
TwoSides regulatedSide, double v, boolean connected, boolean mainComponent, boolean validated) {
this.id = id;
this.error = error;
this.upIncrement = upIncrement;
Expand Down Expand Up @@ -86,7 +88,7 @@ int getHighTapPosition() {
return targetV;
}

Branch.Side getRegulatedSide() {
TwoSides getRegulatedSide() {
return regulatedSide;
}

Expand Down

0 comments on commit 6b62348

Please sign in to comment.