Skip to content

Commit 7b983bc

Browse files
authored
Merge branch 'main' into nro/switch_snapshot_CI_to_new_app
2 parents 0d8ecd5 + 84fcc6c commit 7b983bc

32 files changed

+800
-110
lines changed

README.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ GraalVM to compile Java code to a native library.
2020

2121
Latest version of the documentation with API reference and many code samples is [here](https://pypowsybl.readthedocs.io/).
2222

23+
To contribute to the documentation follow the instructions in the [documentation README](https://github.com/powsybl/pypowsybl/blob/main/docs/README.md) page.
24+
2325
## Notebooks
2426

2527
Notebooks demonstrating PyPowSyBl features can be found in this [repository](https://github.com/powsybl/pypowsybl-notebooks).
@@ -92,7 +94,7 @@ That section is intended for developers who wish to build pypowsybl from the sou
9294
Requirements:
9395

9496
- Maven >= 3.1
95-
- Cmake >= 3.14
97+
- Cmake >= 3.20
9698
- C++11 compiler
9799
- Python >= 3.8 for Linux, Windows and MacOS (amd64 and arm64)
98100
- [Oracle GraalVM Java 17](https://www.graalvm.org/downloads/)
@@ -133,25 +135,3 @@ To run linting inspection with `pylint`:
133135
```bash
134136
pylint pypowsybl
135137
```
136-
137-
## Contribute to documentation
138-
139-
To run the tests included in the documentation:
140-
141-
```bash
142-
cd docs/
143-
make doctest
144-
```
145-
146-
And then, to build the documentation:
147-
148-
```bash
149-
make html
150-
```
151-
152-
Web pages are generated in repository _build/html/ for preview before opening a pull request.
153-
You can for example open it with firefox browser:
154-
155-
```bash
156-
firefox _build/html/index.html
157-
```

cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
#
7-
cmake_minimum_required(VERSION 3.14)
7+
cmake_minimum_required(VERSION 3.20)
88
project(pypowsybl)
99

1010
set(CMAKE_CXX_STANDARD 17)

cpp/powsybl-cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
#
7-
cmake_minimum_required(VERSION 3.14)
7+
cmake_minimum_required(VERSION 3.20)
88
project(powsybl-cpp)
99

1010
set(CMAKE_CXX_STANDARD 17)

cpp/powsybl-cpp/powsybl-cpp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ std::vector<std::string> getMatrixMultiSubstationSvgAndMetadata(const JavaHandle
722722
return svgAndMetadata.get();
723723
}
724724

725-
void writeNetworkAreaDiagramSvg(const JavaHandle& network, const std::string& svgFile, const std::string& metadataFile, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions) {
725+
void writeNetworkAreaDiagramSvg(const JavaHandle& network, const std::string& svgFile, const std::string& metadataFile, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions, dataframe* branch_labels) {
726726
auto c_parameters = parameters.to_c_struct();
727727
ToCharPtrPtr voltageLevelIdPtr(voltageLevelIds);
728728
PowsyblCaller::get()->callJava(::writeNetworkAreaDiagramSvg, network, (char*) svgFile.data(), (char*) metadataFile.data(),
729-
voltageLevelIdPtr.get(), voltageLevelIds.size(), depth, highNominalVoltageBound, lowNominalVoltageBound, c_parameters.get(), fixed_positions);
729+
voltageLevelIdPtr.get(), voltageLevelIds.size(), depth, highNominalVoltageBound, lowNominalVoltageBound, c_parameters.get(), fixed_positions, branch_labels);
730730
}
731731

732732
std::string getNetworkAreaDiagramSvg(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters) {
@@ -735,10 +735,10 @@ std::string getNetworkAreaDiagramSvg(const JavaHandle& network, const std::vecto
735735
return toString(PowsyblCaller::get()->callJava<char*>(::getNetworkAreaDiagramSvg, network, voltageLevelIdPtr.get(), voltageLevelIds.size(), depth, highNominalVoltageBound, lowNominalVoltageBound, c_parameters.get()));
736736
}
737737

738-
std::vector<std::string> getNetworkAreaDiagramSvgAndMetadata(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions) {
738+
std::vector<std::string> getNetworkAreaDiagramSvgAndMetadata(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions, dataframe* branch_labels) {
739739
auto c_parameters = parameters.to_c_struct();
740740
ToCharPtrPtr voltageLevelIdPtr(voltageLevelIds);
741-
auto svgAndMetadataArrayPtr = PowsyblCaller::get()->callJava<array*>(::getNetworkAreaDiagramSvgAndMetadata, network, voltageLevelIdPtr.get(), voltageLevelIds.size(), depth, highNominalVoltageBound, lowNominalVoltageBound, c_parameters.get(), fixed_positions);
741+
auto svgAndMetadataArrayPtr = PowsyblCaller::get()->callJava<array*>(::getNetworkAreaDiagramSvgAndMetadata, network, voltageLevelIdPtr.get(), voltageLevelIds.size(), depth, highNominalVoltageBound, lowNominalVoltageBound, c_parameters.get(), fixed_positions, branch_labels);
742742
ToStringVector svgAndMetadata(svgAndMetadataArrayPtr);
743743
return svgAndMetadata.get();
744744
}
@@ -1680,8 +1680,8 @@ JavaHandle createDefaultRaoParameters() {
16801680
return pypowsybl::PowsyblCaller::get()->callJava<JavaHandle>(::createDefaultRaoParameters);
16811681
}
16821682

1683-
JavaHandle createGrid2opBackend(const JavaHandle& networkHandle, bool considerOpenBranchReactiveFlow, int busesPerVoltageLevel, bool connectAllElementsToFirstBus) {
1684-
return pypowsybl::PowsyblCaller::get()->callJava<JavaHandle>(::createGrid2opBackend, networkHandle, considerOpenBranchReactiveFlow, busesPerVoltageLevel, connectAllElementsToFirstBus);
1683+
JavaHandle createGrid2opBackend(const JavaHandle& networkHandle, bool considerOpenBranchReactiveFlow, bool checkIsolatedAndDisconnectedInjections, int busesPerVoltageLevel, bool connectAllElementsToFirstBus) {
1684+
return pypowsybl::PowsyblCaller::get()->callJava<JavaHandle>(::createGrid2opBackend, networkHandle, considerOpenBranchReactiveFlow, checkIsolatedAndDisconnectedInjections, busesPerVoltageLevel, connectAllElementsToFirstBus);
16851685
}
16861686

16871687
void freeGrid2opBackend(const JavaHandle& backendHandle) {

cpp/powsybl-cpp/powsybl-cpp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,11 @@ std::vector<std::string> getMatrixMultiSubstationSvgAndMetadata(const JavaHandle
579579

580580
std::vector<std::string> getSingleLineDiagramComponentLibraryNames();
581581

582-
void writeNetworkAreaDiagramSvg(const JavaHandle& network, const std::string& svgFile, const std::string& metadataFile, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions);
582+
void writeNetworkAreaDiagramSvg(const JavaHandle& network, const std::string& svgFile, const std::string& metadataFile, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions, dataframe* branch_labels);
583583

584584
std::string getNetworkAreaDiagramSvg(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters);
585585

586-
std::vector<std::string> getNetworkAreaDiagramSvgAndMetadata(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions);
586+
std::vector<std::string> getNetworkAreaDiagramSvgAndMetadata(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth, double highNominalVoltageBound, double lowNominalVoltageBound, const NadParameters& parameters, dataframe* fixed_positions, dataframe* branch_labels);
587587

588588
std::vector<std::string> getNetworkAreaDiagramDisplayedVoltageLevels(const JavaHandle& network, const std::vector<std::string>& voltageLevelIds, int depth);
589589

@@ -855,7 +855,7 @@ JavaHandle getRaoResult(const JavaHandle& raoContext);
855855
RaoComputationStatus getRaoResultStatus(const JavaHandle& raoResult);
856856
JavaHandle createDefaultRaoParameters();
857857

858-
JavaHandle createGrid2opBackend(const JavaHandle& networkHandle, bool considerOpenBranchReactiveFlow, int busesPerVoltageLevel, bool connectAllElementsToFirstBus);
858+
JavaHandle createGrid2opBackend(const JavaHandle& networkHandle, bool considerOpenBranchReactiveFlow, bool checkIsolatedAndDisconnectedInjections, int busesPerVoltageLevel, bool connectAllElementsToFirstBus);
859859
void freeGrid2opBackend(const JavaHandle& backendHandle);
860860
std::vector<std::string> getGrid2opStringValue(const JavaHandle& backendHandle, Grid2opStringValueType valueType);
861861
array* getGrid2opIntegerValue(const JavaHandle& backendHandle, Grid2opIntegerValueType valueType);

cpp/pypowsybl-cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
#
7-
cmake_minimum_required(VERSION 3.14)
7+
cmake_minimum_required(VERSION 3.20)
88
project(pypowsybl-cpp)
99

1010
# Enable static linkage to prevent any future runtime binary compatibility issue

cpp/pypowsybl-cpp/bindings.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,13 +685,15 @@ PYBIND11_MODULE(_pypowsybl, m) {
685685

686686
m.def("write_network_area_diagram_svg", &pypowsybl::writeNetworkAreaDiagramSvg, "Write network area diagram SVG",
687687
py::arg("network"), py::arg("svg_file"), py::arg("metadata_file"), py::arg("voltage_level_ids"),
688-
py::arg("depth"), py::arg("high_nominal_voltage_bound"), py::arg("low_nominal_voltage_bound"), py::arg("nad_parameters"), py::arg("fixed_positions"));
688+
py::arg("depth"), py::arg("high_nominal_voltage_bound"), py::arg("low_nominal_voltage_bound"), py::arg("nad_parameters"), py::arg("fixed_positions"),
689+
py::arg("branch_labels"));
689690

690691
m.def("get_network_area_diagram_svg", &pypowsybl::getNetworkAreaDiagramSvg, "Get network area diagram SVG as a string",
691692
py::arg("network"), py::arg("voltage_level_ids"), py::arg("depth"), py::arg("high_nominal_voltage_bound"), py::arg("low_nominal_voltage_bound"), py::arg("nad_parameters"));
692693

693694
m.def("get_network_area_diagram_svg_and_metadata", &pypowsybl::getNetworkAreaDiagramSvgAndMetadata, "Get network area diagram SVG and its metadata as a list of strings",
694-
py::arg("network"), py::arg("voltage_level_ids"), py::arg("depth"), py::arg("high_nominal_voltage_bound"), py::arg("low_nominal_voltage_bound"), py::arg("nad_parameters"), py::arg("fixed_positions"));
695+
py::arg("network"), py::arg("voltage_level_ids"), py::arg("depth"), py::arg("high_nominal_voltage_bound"), py::arg("low_nominal_voltage_bound"), py::arg("nad_parameters"), py::arg("fixed_positions"),
696+
py::arg("branch_labels"));
695697

696698
m.def("get_network_area_diagram_displayed_voltage_levels", &pypowsybl::getNetworkAreaDiagramDisplayedVoltageLevels, "Get network area diagram displayed voltage level",
697699
py::arg("network"), py::arg("voltage_level_ids"), py::arg("depth"));
@@ -1179,18 +1181,23 @@ PYBIND11_MODULE(_pypowsybl, m) {
11791181
.value("LOAD_P", Grid2opDoubleValueType::LOAD_P)
11801182
.value("LOAD_Q", Grid2opDoubleValueType::LOAD_Q)
11811183
.value("LOAD_V", Grid2opDoubleValueType::LOAD_V)
1184+
.value("LOAD_ANGLE", Grid2opDoubleValueType::LOAD_ANGLE)
11821185
.value("GENERATOR_P", Grid2opDoubleValueType::GENERATOR_P)
11831186
.value("GENERATOR_Q", Grid2opDoubleValueType::GENERATOR_Q)
11841187
.value("GENERATOR_V", Grid2opDoubleValueType::GENERATOR_V)
1188+
.value("GENERATOR_ANGLE", Grid2opDoubleValueType::GENERATOR_ANGLE)
11851189
.value("SHUNT_P", Grid2opDoubleValueType::SHUNT_P)
11861190
.value("SHUNT_Q", Grid2opDoubleValueType::SHUNT_Q)
11871191
.value("SHUNT_V", Grid2opDoubleValueType::SHUNT_V)
1192+
.value("SHUNT_ANGLE", Grid2opDoubleValueType::SHUNT_ANGLE)
11881193
.value("BRANCH_P1", Grid2opDoubleValueType::BRANCH_P1)
11891194
.value("BRANCH_P2", Grid2opDoubleValueType::BRANCH_P2)
11901195
.value("BRANCH_Q1", Grid2opDoubleValueType::BRANCH_Q1)
11911196
.value("BRANCH_Q2", Grid2opDoubleValueType::BRANCH_Q2)
11921197
.value("BRANCH_V1", Grid2opDoubleValueType::BRANCH_V1)
11931198
.value("BRANCH_V2", Grid2opDoubleValueType::BRANCH_V2)
1199+
.value("BRANCH_ANGLE1", Grid2opDoubleValueType::BRANCH_ANGLE1)
1200+
.value("BRANCH_ANGLE2", Grid2opDoubleValueType::BRANCH_ANGLE2)
11941201
.value("BRANCH_I1", Grid2opDoubleValueType::BRANCH_I1)
11951202
.value("BRANCH_I2", Grid2opDoubleValueType::BRANCH_I2)
11961203
.value("BRANCH_PERMANENT_LIMIT_A", Grid2opDoubleValueType::BRANCH_PERMANENT_LIMIT_A);
@@ -1209,7 +1216,7 @@ PYBIND11_MODULE(_pypowsybl, m) {
12091216
.value("UPDATE_BRANCH_BUS2", Grid2opUpdateIntegerValueType::UPDATE_BRANCH_BUS2);
12101217

12111218
m.def("create_grid2op_backend", &pypowsybl::createGrid2opBackend, "Create a Grid2op backend", py::arg("network"),
1212-
py::arg("consider_open_branch_reactive_flow"), py::arg("buses_per_voltage_level"), py::arg("connect_all_elements_to_first_bus"));
1219+
py::arg("consider_open_branch_reactive_flow"), py::arg("check_isolated_and_disconnected_injections"), py::arg("buses_per_voltage_level"), py::arg("connect_all_elements_to_first_bus"));
12131220
m.def("free_grid2op_backend", &pypowsybl::freeGrid2opBackend, "Free a Grid2op backend", py::arg("backend"));
12141221
m.def("get_grid2op_string_value", &pypowsybl::getGrid2opStringValue, "From a Grid2op backend get a string value vector", py::arg("backend"), py::arg("value_type"));
12151222
m.def("get_grid2op_integer_value", &::pyGetGrid2opIntegerValue, "From a Grid2op backend get a integer value vector", py::arg("backend"), py::arg("value_type"));

cpp/pypowsybl-java/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
#
7-
cmake_minimum_required(VERSION 3.14)
7+
cmake_minimum_required(VERSION 3.20)
88
project(pypowsybl-java)
99

1010
set(CMAKE_CXX_STANDARD 17)

cpp/pypowsybl-java/powsybl-api.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,18 +494,23 @@ typedef enum {
494494
LOAD_P = 0,
495495
LOAD_Q,
496496
LOAD_V,
497+
LOAD_ANGLE,
497498
GENERATOR_P,
498499
GENERATOR_Q,
499500
GENERATOR_V,
501+
GENERATOR_ANGLE,
500502
SHUNT_P,
501503
SHUNT_Q,
502504
SHUNT_V,
505+
SHUNT_ANGLE,
503506
BRANCH_P1,
504507
BRANCH_P2,
505508
BRANCH_Q1,
506509
BRANCH_Q2,
507510
BRANCH_V1,
508511
BRANCH_V2,
512+
BRANCH_ANGLE1,
513+
BRANCH_ANGLE2,
509514
BRANCH_I1,
510515
BRANCH_I2,
511516
BRANCH_PERMANENT_LIMIT_A,

docs/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# PyPowSyBl documentation
2+
3+
These are the documentation sources for PyPowSyBl features.
4+
5+
Please keep them up to date with your developments.
6+
They are published on pypowsybl.readthedocs.io and pull requests are built and previewed automatically.
7+
8+
## Run
9+
10+
To run the tests included in the documentation:
11+
12+
```bash
13+
make doctest
14+
```
15+
16+
## Build the documentation
17+
18+
When modifying the website content, you can easily preview the result on your PC.
19+
20+
Navigate to the `docs` directory of the project and run the following commands:
21+
~~~bash
22+
cd docs
23+
~~~
24+
Install the requirements the first time:
25+
~~~bash
26+
pip install -r requirements.txt
27+
~~~
28+
Build the documentation:
29+
~~~bash
30+
sphinx-build -a . _build/html
31+
~~~
32+
Or
33+
~~~bash
34+
make html
35+
~~~
36+
Or to build the documentation in latex format:
37+
~~~bash
38+
make latexpdf
39+
~~~
40+
41+
## Preview the result
42+
43+
For html format, web pages are generated in repository `_build/html` and can be previewed opening a pull request.
44+
You can for example open it with firefox browser:
45+
46+
```bash
47+
firefox _build/html/index.html
48+
```
49+

0 commit comments

Comments
 (0)