diff --git a/cpp/src/bindings.cpp b/cpp/src/bindings.cpp index 5d03ba0d66..9746d72b8c 100644 --- a/cpp/src/bindings.cpp +++ b/cpp/src/bindings.cpp @@ -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_(m, "VoltageInitializerStatus") .value("OK", VoltageInitializerStatus::OK) .value("NOT_OK", VoltageInitializerStatus::NOT_OK); @@ -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) { @@ -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")); diff --git a/cpp/src/pypowsybl.cpp b/cpp/src/pypowsybl.cpp index 8c99f31422..81a1c9f285 100644 --- a/cpp/src/pypowsybl.cpp +++ b/cpp/src/pypowsybl.cpp @@ -1461,48 +1461,49 @@ JavaHandle createVoltageLimitOverride(double minVoltage, double maxVoltage) { return pypowsybl::callJava(::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(::VoltageInitializerGetStatus, resultHandle); } -const std::map VoltageInitializerGetIndicators(JavaHandle resultHandle) { +std::map voltageInitializerGetIndicators(const JavaHandle& resultHandle) { string_map* indicators = pypowsybl::callJava(::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(::runVoltageInitializer, debug, networkHandle, paramsHandle); } + } diff --git a/cpp/src/pypowsybl.h b/cpp/src/pypowsybl.h index c74be74c94..2c1e5ffae2 100644 --- a/cpp/src/pypowsybl.h +++ b/cpp/src/pypowsybl.h @@ -567,23 +567,23 @@ std::vector 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 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 voltageInitializerGetIndicators(const JavaHandle& resultHandle); +JavaHandle runVoltageInitializer(bool debug, const JavaHandle& networkHandle, const JavaHandle& paramsHandle); + +//=======End of voltage initializer mapping======== std::vector getModificationMetadata(network_modification_type networkModificationType);