Skip to content

Commit

Permalink
Add missing BUS_REACTIVE_POWER to sensi function type (#745)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Co-authored-by: HugoKulesza <[email protected]>
  • Loading branch information
geofjamg and HugoKulesza authored May 14, 2024
1 parent aad85d7 commit af85d68
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions cpp/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ PYBIND11_MODULE(_pypowsybl, m) {
.value("BRANCH_ACTIVE_POWER_3",sensitivity_function_type::BRANCH_ACTIVE_POWER_3)
.value("BRANCH_CURRENT_3",sensitivity_function_type::BRANCH_CURRENT_3)
.value("BRANCH_REACTIVE_POWER_3",sensitivity_function_type::BRANCH_REACTIVE_POWER_3)
.value("BUS_REACTIVE_POWER",sensitivity_function_type::BUS_REACTIVE_POWER)
.value("BUS_VOLTAGE",sensitivity_function_type::BUS_VOLTAGE);

py::enum_<sensitivity_variable_type>(m, "SensitivityVariableType")
Expand Down
1 change: 1 addition & 0 deletions cpp/src/pypowsybl-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ typedef enum {
BRANCH_ACTIVE_POWER_3,
BRANCH_CURRENT_3,
BRANCH_REACTIVE_POWER_3,
BUS_REACTIVE_POWER,
BUS_VOLTAGE,
} sensitivity_function_type;

Expand Down
9 changes: 9 additions & 0 deletions docs/user_guide/sensitivity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,15 @@ Here is a table summarizing the possible functions and variables and if it is su
- N/A
- N/A
- N/A
* - BUS_REACTIVE_POWER
- N/A
- AC
- N/A
- AC
- N/A
- N/A
- N/A
- N/A

A special value of `SensitivityVariableType` `AUTO_DETECT` allows to auto detect each of the variable type using its ID.
It is important to notice that in this case, not all type of sensitivity variable are usable. For instance when an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ public enum SensitivityFunctionType {
BRANCH_ACTIVE_POWER_3,
BRANCH_CURRENT_3,
BRANCH_REACTIVE_POWER_3,
BUS_REACTIVE_POWER,
BUS_VOLTAGE;

@CEnumValue
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/powsybl/python/commons/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public static SensitivityFunctionType convert(PyPowsyblApiHeader.SensitivityFunc
case BRANCH_CURRENT_3 -> SensitivityFunctionType.BRANCH_CURRENT_3;
case BRANCH_REACTIVE_POWER_3 -> SensitivityFunctionType.BRANCH_REACTIVE_POWER_3;
case BUS_VOLTAGE -> SensitivityFunctionType.BUS_VOLTAGE;
case BUS_REACTIVE_POWER -> SensitivityFunctionType.BUS_REACTIVE_POWER;
};
}

Expand Down
1 change: 1 addition & 0 deletions pypowsybl/_pypowsybl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class SensitivityFunctionType:
BRANCH_ACTIVE_POWER_3: ClassVar[SensitivityFunctionType] = ...
BRANCH_CURRENT_3: ClassVar[SensitivityFunctionType] = ...
BRANCH_REACTIVE_POWER_3: ClassVar[SensitivityFunctionType] = ...
BUS_REACTIVE_POWER: ClassVar[SensitivityFunctionType] = ...
BUS_VOLTAGE: ClassVar[SensitivityFunctionType] = ...
def __init__(self, arg0: int) -> None: ...
def __eq__(self, arg0: object) -> bool: ...
Expand Down
2 changes: 2 additions & 0 deletions pypowsybl/sensitivity/impl/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ def add_factor_matrix(self, functions_ids: List[str], variables_ids: List[str],
- BRANCH_ACTIVE_POWER_3
- BRANCH_CURRENT_3
- BRANCH_REACTIVE_POWER_3
- BUS_REACTIVE_POWER
- BUS_VOLTAGE
sensitivity_variable_type can be:
- INJECTION_ACTIVE_POWER
Expand Down

0 comments on commit af85d68

Please sign in to comment.