diff --git a/VERSION b/VERSION index d3bdbdf1f..625934097 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7 +1.8 diff --git a/docs/examples/Transformer Examples.ipynb b/docs/examples/Transformer Examples.ipynb index 220ce3fa3..2b232e285 100644 --- a/docs/examples/Transformer Examples.ipynb +++ b/docs/examples/Transformer Examples.ipynb @@ -553,26 +553,6 @@ "```" ] }, - { - "cell_type": "code", - "execution_count": 9, - "id": "2d786f12", - "metadata": {}, - "outputs": [], - "source": [ - "from power_grid_model.enum import _ExperimentalFeatures\n", - "\n", - "\n", - "# Power flow with automatic tap changing is still experimental at the time of writing.\n", - "# Create a derived PowerGridModel that has experimental features enabled.\n", - "class PowerGridModelWithExperimentalFeatures(PowerGridModel):\n", - " def __init__(self, *args, **kwargs):\n", - " super().__init__(*args, **kwargs)\n", - "\n", - " def calculate_power_flow(self, **kwargs):\n", - " return super()._calculate_power_flow(experimental_features=_ExperimentalFeatures.enabled, **kwargs)" - ] - }, { "cell_type": "markdown", "id": "5ab5adba", @@ -587,7 +567,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "0c89a335", "metadata": {}, "outputs": [], @@ -684,7 +664,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "2ff01266", "metadata": {}, "outputs": [ @@ -753,7 +733,7 @@ ], "source": [ "# construction\n", - "model5 = PowerGridModelWithExperimentalFeatures(input_data5)\n", + "model5 = PowerGridModel(input_data5)\n", "\n", "# one-time power flow calculation without automatic tap changing\n", "output_data5 = model5.calculate_power_flow()\n", @@ -777,7 +757,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "7ad86bf0", "metadata": {}, "outputs": [ @@ -919,7 +899,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "be276930", "metadata": {}, "outputs": [ @@ -1136,7 +1116,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "id": "21b01a77", "metadata": {}, "outputs": [ @@ -1279,7 +1259,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "id": "c0314199", "metadata": {}, "outputs": [ @@ -1432,7 +1412,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 15, "id": "ac091392", "metadata": {}, "outputs": [], @@ -1444,7 +1424,7 @@ "input_data6[\"transformer_tap_regulator\"][\"line_drop_compensation_r\"] = [10.0]\n", "\n", "# construction\n", - "model6 = PowerGridModelWithExperimentalFeatures(input_data=input_data6)" + "model6 = PowerGridModel(input_data=input_data6)" ] }, { @@ -1457,7 +1437,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 16, "id": "9b66d16e", "metadata": {}, "outputs": [ diff --git a/docs/user_manual/calculations.md b/docs/user_manual/calculations.md index 5fc408310..428d8ef69 100644 --- a/docs/user_manual/calculations.md +++ b/docs/user_manual/calculations.md @@ -572,10 +572,6 @@ There are {py:class}`4 types ` of fault situati ### Regulated power flow calculations -```{warning} -At the time of writing, this feature is still experimental and is not yet publicly available. -``` - Regulated power flow calculations are disabled by default. At the time of writing, the following regulated power flow calculation types are implemented. @@ -587,10 +583,6 @@ Please refer to their respective sections for detailed documentation. #### Power flow with automatic tap changing -```{warning} -At the time of writing, this feature is still experimental and is not yet publicly available. -``` - Some of the most important regulators in the grid affect the tap position of transformers. These {hoverxreftooltip}`user_manual/components:Transformer Tap Regulator`s try to regulate a control voltage $U_{\text{control}}$ such that it is within a specified voltage band. The $U_{\text{control}}$ may be compensated for the voltage drop during transport. diff --git a/power_grid_model_c/power_grid_model_c/src/model.cpp b/power_grid_model_c/power_grid_model_c/src/model.cpp index 8b9645a5f..03edfeb41 100644 --- a/power_grid_model_c/power_grid_model_c/src/model.cpp +++ b/power_grid_model_c/power_grid_model_c/src/model.cpp @@ -56,26 +56,8 @@ void PGM_get_indexer(PGM_Handle* handle, PGM_PowerGridModel const* model, char c } namespace { -void check_calculate_experimental_features(PGM_Options const& opt) { - using namespace std::string_literals; - - if (opt.calculation_type == PGM_power_flow) { - switch (opt.tap_changing_strategy) { - case PGM_tap_changing_strategy_any_valid_tap: - case PGM_tap_changing_strategy_max_voltage_tap: - case PGM_tap_changing_strategy_min_voltage_tap: { - // this option is experimental and should not be exposed to the user - throw ExperimentalFeature{ - "PGM_calculate", - ExperimentalFeature::TypeValuePair{.name = "PGM_CalculationType", - .value = std::to_string(opt.calculation_type)}, - ExperimentalFeature::TypeValuePair{.name = "PGM_TapChangingStrategy", - .value = std::to_string(opt.tap_changing_strategy)}}; - } - default: - break; - } - } +void check_calculate_experimental_features(PGM_Options const& /* opt */) { + // optionally add experimental feature checks here } void check_calculate_valid_options(PGM_Options const& opt) { diff --git a/src/power_grid_model/core/power_grid_model.py b/src/power_grid_model/core/power_grid_model.py index 84fa3b619..e7c1ecda2 100644 --- a/src/power_grid_model/core/power_grid_model.py +++ b/src/power_grid_model/core/power_grid_model.py @@ -390,6 +390,7 @@ def calculate_power_flow( output_component_types: Optional[Union[Set[str], List[str]]] = None, continue_on_batch_error: bool = False, decode_error: bool = True, + tap_changing_strategy: Union[TapChangingStrategy, str] = TapChangingStrategy.disabled, ) -> Dict[str, np.ndarray]: """ Calculate power flow once with the current model attributes. @@ -463,6 +464,7 @@ def calculate_power_flow( output_component_types=output_component_types, continue_on_batch_error=continue_on_batch_error, decode_error=decode_error, + tap_changing_strategy=tap_changing_strategy, ) def calculate_state_estimation( diff --git a/tests/c_api_tests/test_c_api_model.cpp b/tests/c_api_tests/test_c_api_model.cpp index 86180e3fd..9e9cf3879 100644 --- a/tests/c_api_tests/test_c_api_model.cpp +++ b/tests/c_api_tests/test_c_api_model.cpp @@ -217,16 +217,9 @@ TEST_CASE("C API Model") { PGM_calculate(hl, model, opt, single_output_dataset, nullptr); } - SUBCASE("Tap changing strategy is experimental") { - SUBCASE("experimental features disabled") { - expected_error = "PGM_calculate is not implemented for the following combination of options!\n"s; - } - SUBCASE("experimental features enabled") { - // normal calculation - PGM_set_experimental_features(hl, opt, PGM_experimental_features_enabled); - } + SUBCASE("Tap changing strategy") { PGM_set_tap_changing_strategy(hl, opt, PGM_tap_changing_strategy_any_valid_tap); - PGM_calculate(hl, model, opt, single_output_dataset, nullptr); + CHECK_NOTHROW(PGM_calculate(hl, model, opt, single_output_dataset, nullptr)); } if (expected_error.empty()) { diff --git a/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-max/params.json b/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-max/params.json index 53effeba4..d22393c9e 100644 --- a/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-max/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-max/params.json @@ -2,10 +2,5 @@ "calculation_method": "newton_raphson", "tap_changing_strategy": "max_voltage_tap", "rtol": 1e-05, - "atol": 1e-05, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } - } + "atol": 1e-05 } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-min/params.json b/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-min/params.json index 6763af42e..a8c656c79 100644 --- a/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-min/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/auto-tap-changer-minimal-min/params.json @@ -2,10 +2,5 @@ "calculation_method": "newton_raphson", "tap_changing_strategy": "min_voltage_tap", "rtol": 1e-05, - "atol": 1e-05, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } - } + "atol": 1e-05 } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-any/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-any/params.json index 00c0e0ea4..0b942c604 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-any/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-any/params.json @@ -5,10 +5,5 @@ "atol": { "default": 1e-05, "u": 100.0 - }, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } } } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-any/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-any/params.json index 00c0e0ea4..0b942c604 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-any/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-any/params.json @@ -5,10 +5,5 @@ "atol": { "default": 1e-05, "u": 100.0 - }, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } } } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-max/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-max/params.json index 58e880668..48441767b 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-max/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-max/params.json @@ -5,10 +5,5 @@ "atol": { "default": 1e-05, "u": 100.0 - }, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } } } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-min/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-min/params.json index 112e02d7f..4e4204b1b 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-min/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-line-drop-min/params.json @@ -5,10 +5,5 @@ "atol": { "default": 1e-05, "u": 100.0 - }, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } } } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-max/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-max/params.json index 58e880668..48441767b 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-max/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-max/params.json @@ -5,10 +5,5 @@ "atol": { "default": 1e-05, "u": 100.0 - }, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } } } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-min/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-min/params.json index 112e02d7f..4e4204b1b 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-min/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-min/params.json @@ -5,10 +5,5 @@ "atol": { "default": 1e-05, "u": 100.0 - }, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } } } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-tight-bands/params.json b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-tight-bands/params.json index 2d3e82bde..b3ba7e88f 100644 --- a/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-tight-bands/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/pgm-automatic-tap-tight-bands/params.json @@ -2,10 +2,5 @@ "calculation_method": "newton_raphson", "tap_changing_strategy": "any_valid_tap", "rtol": 1e-5, - "atol": 1e-5, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } - } + "atol": 1e-5 } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/single-trafo-any-valid-tap/params.json b/tests/data/power_flow/automatic-tap-regulator/single-trafo-any-valid-tap/params.json index 2d3e82bde..b3ba7e88f 100644 --- a/tests/data/power_flow/automatic-tap-regulator/single-trafo-any-valid-tap/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/single-trafo-any-valid-tap/params.json @@ -2,10 +2,5 @@ "calculation_method": "newton_raphson", "tap_changing_strategy": "any_valid_tap", "rtol": 1e-5, - "atol": 1e-5, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } - } + "atol": 1e-5 } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/single-trafo-max-voltage-tap/params.json b/tests/data/power_flow/automatic-tap-regulator/single-trafo-max-voltage-tap/params.json index 499337888..dcc54262f 100644 --- a/tests/data/power_flow/automatic-tap-regulator/single-trafo-max-voltage-tap/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/single-trafo-max-voltage-tap/params.json @@ -2,10 +2,5 @@ "calculation_method": "newton_raphson", "tap_changing_strategy": "max_voltage_tap", "rtol": 1e-5, - "atol": 1e-5, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } - } + "atol": 1e-5 } \ No newline at end of file diff --git a/tests/data/power_flow/automatic-tap-regulator/single-trafo-min-voltage-tap/params.json b/tests/data/power_flow/automatic-tap-regulator/single-trafo-min-voltage-tap/params.json index 0e014667a..b756959e5 100644 --- a/tests/data/power_flow/automatic-tap-regulator/single-trafo-min-voltage-tap/params.json +++ b/tests/data/power_flow/automatic-tap-regulator/single-trafo-min-voltage-tap/params.json @@ -2,10 +2,5 @@ "calculation_method": "newton_raphson", "tap_changing_strategy": "min_voltage_tap", "rtol": 1e-5, - "atol": 1e-5, - "extra_params": { - "newton_raphson": { - "experimental_features": "enabled" - } - } + "atol": 1e-5 } \ No newline at end of file diff --git a/tests/unit/test_error_handling.py b/tests/unit/test_error_handling.py index ead054e47..c6760ead7 100644 --- a/tests/unit/test_error_handling.py +++ b/tests/unit/test_error_handling.py @@ -310,15 +310,9 @@ def test_transformer_tap_regulator_at_lv_tap_side(): ) -def test_automatic_tap_changing_is_experimental(): - model = PowerGridModelWithExt(input_data={}) - - with pytest.raises(InvalidArguments): - model.calculate_power_flow_with_ext(tap_changing_strategy=TapChangingStrategy.any_valid_tap) - - model.calculate_power_flow_with_ext( - tap_changing_strategy=TapChangingStrategy.any_valid_tap, experimental_features=_ExperimentalFeatures.enabled - ) +def test_automatic_tap_changing(): + model = PowerGridModel(input_data={}) + model.calculate_power_flow(tap_changing_strategy=TapChangingStrategy.any_valid_tap) @pytest.mark.skip(reason="TODO")