Skip to content

Commit

Permalink
clip i0
Browse files Browse the repository at this point in the history
Signed-off-by: Nitish Bharambe <nitish.bharambe@alliander.com>
  • Loading branch information
nitbharambe committed Aug 21, 2024
1 parent ccc6089 commit 98535e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/power_grid_model_io/converters/pandapower_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,13 @@ def _create_pgm_input_transformers(self): # pylint: disable=too-many-statements
pgm_transformers["sn"] = sn_mva * parallel * 1e6
pgm_transformers["uk"] = vk_percent * 1e-2
pgm_transformers["pk"] = vkr_percent * sn_mva * parallel * (1e6 * 1e-2)
pgm_transformers["i0"] = i_no_load * 1e-2
pgm_transformers["p0"] = pfe * parallel * 1e3
pgm_transformers["i0"] = i_no_load * 1e-2
if any(np.less(pgm_transformers["i0"], pgm_transformers["p0"] / pgm_transformers["sn"])):
logger.warning("Minimum value of i0 is clipped to p0/sn")
pgm_transformers["i0"] = np.clip(
pgm_transformers["i0"], a_min=pgm_transformers["p0"] / pgm_transformers["sn"], a_max=None
)
pgm_transformers["clock"] = clocks
pgm_transformers["winding_from"] = winding_types["winding_from"]
pgm_transformers["winding_to"] = winding_types["winding_to"]
Expand Down
1 change: 1 addition & 0 deletions tests/unit/converters/test_pandapower_converter_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ def test_create_pgm_input_shunts(mock_init_array: MagicMock, two_pp_objs, conver

@patch("power_grid_model_io.converters.pandapower_converter.initialize_array")
@patch("power_grid_model_io.converters.pandapower_converter.np.round", new=lambda x: x)
@patch("power_grid_model_io.converters.pandapower_converter.np.less", new=lambda x, _, **kwargs: x)
@patch("power_grid_model_io.converters.pandapower_converter.np.divide", new=lambda x, _, **kwargs: x)
@patch("power_grid_model_io.converters.pandapower_converter.np.bitwise_and", new=lambda x, _: x)
@patch("power_grid_model_io.converters.pandapower_converter.np.logical_and", new=lambda x, _: x)
Expand Down

0 comments on commit 98535e3

Please sign in to comment.