Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
  • Loading branch information
geofjamg committed Sep 22, 2023
1 parent 8ceaa80 commit 17bcb42
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
24 changes: 12 additions & 12 deletions cpp/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void dynamicSimulationBindings(py::module_& m) {
m.def("get_all_dynamic_curves_ids", &pypowsybl::getAllDynamicCurvesIds, py::arg("report_handle"));
}

void VoltageInitializerBinding(py::module_& m) {
void voltageInitializerBinding(py::module_& m) {
py::enum_<VoltageInitializerStatus>(m, "VoltageInitializerStatus")
.value("OK", VoltageInitializerStatus::OK)
.value("NOT_OK", VoltageInitializerStatus::NOT_OK);
Expand All @@ -176,19 +176,19 @@ void VoltageInitializerBinding(py::module_& m) {
m.def("create_voltage_initializer_params", &pypowsybl::createVoltageInitializerParams);
m.def("create_voltage_limit_override", &pypowsybl::createVoltageLimitOverride, py::arg("min_voltage"), py::arg("max_voltage"));

m.def("voltage_initializer_add_variable_shunt_compensators", &pypowsybl::VoltageInitializerAddVariableShuntCompensators, py::arg("params_handle"), py::arg("id_ptr"));
m.def("voltage_initializer_add_constant_q_generators", &pypowsybl::VoltageInitializerAddConstantQGenerators, py::arg("params_handle"), py::arg("id_ptr"));
m.def("voltage_initializer_add_variable_two_windings_transformers", &pypowsybl::VoltageInitializerAddVariableTwoWindingsTransformers, py::arg("params_handle"), py::arg("id_ptr"));
m.def("voltage_initializer_add_specific_voltage_limits", &pypowsybl::VoltageInitializerAddSpecificVoltageLimits, py::arg("id_ptr"), py::arg("min_voltage"), py::arg("params_handle"), py::arg("max_voltage"));
m.def("voltage_initializer_add_variable_shunt_compensators", &pypowsybl::voltageInitializerAddVariableShuntCompensators, py::arg("params_handle"), py::arg("id_ptr"));
m.def("voltage_initializer_add_constant_q_generators", &pypowsybl::voltageInitializerAddConstantQGenerators, py::arg("params_handle"), py::arg("id_ptr"));
m.def("voltage_initializer_add_variable_two_windings_transformers", &pypowsybl::voltageInitializerAddVariableTwoWindingsTransformers, py::arg("params_handle"), py::arg("id_ptr"));
m.def("voltage_initializer_add_specific_voltage_limits", &pypowsybl::voltageInitializerAddSpecificVoltageLimits, py::arg("id_ptr"), py::arg("min_voltage"), py::arg("params_handle"), py::arg("max_voltage"));

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("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"));

m.def("voltage_initializer_apply_all_modifications", &pypowsybl::VoltageInitializerApplyAllModifications, py::arg("result_handle"), py::arg("network_handle"));
m.def("voltage_initializer_get_status", &pypowsybl::VoltageInitializerGetStatus, py::arg("result_handle"));
m.def("voltage_initializer_get_indicators", &pypowsybl::VoltageInitializerGetIndicators, py::arg("result_handle"));
m.def("voltage_initializer_apply_all_modifications", &pypowsybl::voltageInitializerApplyAllModifications, py::arg("result_handle"), py::arg("network_handle"));
m.def("voltage_initializer_get_status", &pypowsybl::voltageInitializerGetStatus, py::arg("result_handle"));
m.def("voltage_initializer_get_indicators", &pypowsybl::voltageInitializerGetIndicators, py::arg("result_handle"));
}

PYBIND11_MODULE(_pypowsybl, m) {
Expand Down Expand Up @@ -791,7 +791,7 @@ PYBIND11_MODULE(_pypowsybl, m) {
m.def("remove_elements_modification", &pypowsybl::removeElementsModification, "remove a list of feeder bays", py::arg("network"), py::arg("connectable_ids"), py::arg("extraDataDf"), py::arg("remove_modification_type"), py::arg("raise_exception"), py::arg("reporter"));

dynamicSimulationBindings(m);
VoltageInitializerBinding(m);
voltageInitializerBinding(m);

m.def("get_network_modification_metadata", &pypowsybl::getModificationMetadata, "Get network modification metadata", py::arg("network_modification_type"));

Expand Down
23 changes: 12 additions & 11 deletions cpp/src/pypowsybl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,48 +1461,49 @@ JavaHandle createVoltageLimitOverride(double minVoltage, double maxVoltage) {
return pypowsybl::callJava<JavaHandle>(::createVoltageLimitOverride, minVoltage, maxVoltage);
}

void VoltageInitializerAddSpecificVoltageLimits(std::string idPtr, double minVoltage, JavaHandle paramsHandle, double maxVoltage) {
void voltageInitializerAddSpecificVoltageLimits(const std::string& idPtr, double minVoltage, const JavaHandle& paramsHandle, double maxVoltage) {
pypowsybl::callJava(::VoltageInitializerAddSpecificVoltageLimits, (char*) idPtr.c_str(), minVoltage, paramsHandle, maxVoltage);
}

void VoltageInitializerAddVariableShuntCompensators(JavaHandle paramsHandle, std::string idPtr) {
void voltageInitializerAddVariableShuntCompensators(const JavaHandle& paramsHandle, const std::string& idPtr) {
pypowsybl::callJava(::VoltageInitializerAddVariableShuntCompensators, paramsHandle, (char*) idPtr.c_str());
}

void VoltageInitializerAddConstantQGenerators(JavaHandle paramsHandle, std::string idPtr) {
void voltageInitializerAddConstantQGenerators(const JavaHandle& paramsHandle, const std::string& idPtr) {
pypowsybl::callJava(::VoltageInitializerAddConstantQGenerators, paramsHandle, (char*) idPtr.c_str());
}

void VoltageInitializerAddVariableTwoWindingsTransformers(JavaHandle paramsHandle, std::string idPtr) {
void voltageInitializerAddVariableTwoWindingsTransformers(const JavaHandle& paramsHandle, const std::string& idPtr) {
pypowsybl::callJava(::VoltageInitializerAddVariableTwoWindingsTransformers, paramsHandle, (char*) idPtr.c_str());
}

void VoltageInitializerAddAlgorithmParam(JavaHandle paramsHandle, std::string keyPtr, std::string valuePtr) {
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(JavaHandle paramsHandle, VoltageInitializerObjective cObjective) {
void voltageInitializerSetObjective(const JavaHandle& paramsHandle, VoltageInitializerObjective cObjective) {
pypowsybl::callJava(::VoltageInitializerSetObjective, paramsHandle, cObjective);
}

void VoltageInitializerSetObjectiveDistance(JavaHandle paramsHandle, double dist) {
void voltageInitializerSetObjectiveDistance(const JavaHandle& paramsHandle, double dist) {
pypowsybl::callJava(::VoltageInitializerSetObjectiveDistance, paramsHandle, dist);
}

void VoltageInitializerApplyAllModifications(JavaHandle resultHandle, JavaHandle networkHandle) {
void voltageInitializerApplyAllModifications(const JavaHandle& resultHandle, const JavaHandle& networkHandle) {
pypowsybl::callJava(::VoltageInitializerApplyAllModifications, resultHandle, networkHandle);
}

VoltageInitializerStatus VoltageInitializerGetStatus(JavaHandle resultHandle) {
VoltageInitializerStatus voltageInitializerGetStatus(const JavaHandle& resultHandle) {
return pypowsybl::callJava<VoltageInitializerStatus>(::VoltageInitializerGetStatus, resultHandle);
}

const std::map<std::string, std::string> VoltageInitializerGetIndicators(JavaHandle resultHandle) {
std::map<std::string, std::string> voltageInitializerGetIndicators(const JavaHandle& resultHandle) {
string_map* indicators = pypowsybl::callJava<string_map*>(::VoltageInitializerGetIndicators, resultHandle);
return convertMapStructToStdMap(indicators);
}

JavaHandle runVoltageInitializer(bool debug, JavaHandle networkHandle, JavaHandle paramsHandle) {
JavaHandle runVoltageInitializer(bool debug, const JavaHandle& networkHandle, const JavaHandle& paramsHandle) {
return pypowsybl::callJava<JavaHandle>(::runVoltageInitializer, debug, networkHandle, paramsHandle);
}

}
28 changes: 14 additions & 14 deletions cpp/src/pypowsybl.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,23 +567,23 @@ std::vector<std::string> getAllDynamicCurvesIds(JavaHandle resultHandle);

//=======END OF dynamic modeling for dynawaltz package==========

//=======Open Reac Mapping========
//=======Voltage initializer mapping========

JavaHandle createVoltageInitializerParams();
JavaHandle createVoltageLimitOverride(double minVoltage, double maxVoltage);
void VoltageInitializerAddSpecificVoltageLimits(std::string idPtr, double minVoltage, JavaHandle paramsHandle, double maxVoltage);
void VoltageInitializerAddVariableShuntCompensators(JavaHandle paramsHandle, std::string idPtr);
void VoltageInitializerAddConstantQGenerators(JavaHandle paramsHandle, std::string idPtr);
void VoltageInitializerAddVariableTwoWindingsTransformers(JavaHandle paramsHandle, std::string idPtr);
void VoltageInitializerAddAlgorithmParam(JavaHandle paramsHandle, std::string keyPtr, std::string valuePtr);
void VoltageInitializerSetObjective(JavaHandle paramsHandle, VoltageInitializerObjective cObjective);
void VoltageInitializerSetObjectiveDistance(JavaHandle paramsHandle, double dist);
void VoltageInitializerApplyAllModifications(JavaHandle resultHandle, JavaHandle networkHandle);
VoltageInitializerStatus VoltageInitializerGetStatus(JavaHandle resultHandle);
const std::map<std::string, std::string> VoltageInitializerGetIndicators(JavaHandle resultHandle);
JavaHandle runVoltageInitializer(bool debug, JavaHandle networkHandle, JavaHandle paramsHandle);

//=======End of Open Reac Mapping========
void voltageInitializerAddSpecificVoltageLimits(const std::string& idPtr, double minVoltage, const JavaHandle& paramsHandle, double maxVoltage);
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);
VoltageInitializerStatus voltageInitializerGetStatus(const JavaHandle& resultHandle);
std::map<std::string, std::string> voltageInitializerGetIndicators(const JavaHandle& resultHandle);
JavaHandle runVoltageInitializer(bool debug, const JavaHandle& networkHandle, const JavaHandle& paramsHandle);

//=======End of voltage initializer mapping========

std::vector<SeriesMetadata> getModificationMetadata(network_modification_type networkModificationType);

Expand Down

0 comments on commit 17bcb42

Please sign in to comment.