diff --git a/pandapower/converter/pypower/from_ppc.py b/pandapower/converter/pypower/from_ppc.py index 72dd9f5b5..1fc3b902d 100644 --- a/pandapower/converter/pypower/from_ppc.py +++ b/pandapower/converter/pypower/from_ppc.py @@ -5,7 +5,7 @@ # by a BSD-style license that can be found in the LICENSE file. from math import pi -from numpy import sign, nan, append, zeros, max, array, power +from numpy import sign, nan, append, zeros, max, array, power, sqrt from pandas import Series, DataFrame, concat import pandapower as pp @@ -170,7 +170,7 @@ def from_ppc(ppc, f_hz=50, validate_conversion=False): if (from_vn_kv == to_vn_kv) & ((ppc['branch'][i, 8] == 0) | (ppc['branch'][i, 8] == 1)) & \ (ppc['branch'][i, 9] == 0): Zni = ppc['bus'][to_bus, 9]**2/baseMVA # ohm - max_i_ka = ppc['branch'][i, 5]/ppc['bus'][to_bus, 9] + max_i_ka = ppc['branch'][i, 5]/ppc['bus'][to_bus, 9]/sqrt(3) if max_i_ka == 0.0: max_i_ka = MAX_VAL logger.debug("ppc branch rateA is zero -> Using MAX_VAL instead to calculate " + diff --git a/pandapower/networks/power_system_test_case_pickles/GBnetwork.p b/pandapower/networks/power_system_test_case_pickles/GBnetwork.p index 19a91f3b9..b7f569ff8 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/GBnetwork.p and b/pandapower/networks/power_system_test_case_pickles/GBnetwork.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/GBreducednetwork.p b/pandapower/networks/power_system_test_case_pickles/GBreducednetwork.p index 7fe62e5b1..9d614bd97 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/GBreducednetwork.p and b/pandapower/networks/power_system_test_case_pickles/GBreducednetwork.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case118.p b/pandapower/networks/power_system_test_case_pickles/case118.p index fb7981687..423ae7622 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case118.p and b/pandapower/networks/power_system_test_case_pickles/case118.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case1354pegase.p b/pandapower/networks/power_system_test_case_pickles/case1354pegase.p index e1a6e37ec..c38ef5c84 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case1354pegase.p and b/pandapower/networks/power_system_test_case_pickles/case1354pegase.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case14.p b/pandapower/networks/power_system_test_case_pickles/case14.p index 6c9f3cdae..786de543c 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case14.p and b/pandapower/networks/power_system_test_case_pickles/case14.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case145.p b/pandapower/networks/power_system_test_case_pickles/case145.p index cd40f55cf..ae3e48e19 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case145.p and b/pandapower/networks/power_system_test_case_pickles/case145.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case1888rte.p b/pandapower/networks/power_system_test_case_pickles/case1888rte.p index 32d240d33..0e8cd20c7 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case1888rte.p and b/pandapower/networks/power_system_test_case_pickles/case1888rte.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case24_ieee_rts.p b/pandapower/networks/power_system_test_case_pickles/case24_ieee_rts.p index d663b5929..b85abd305 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case24_ieee_rts.p and b/pandapower/networks/power_system_test_case_pickles/case24_ieee_rts.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case2848rte.p b/pandapower/networks/power_system_test_case_pickles/case2848rte.p index ea745ff89..57e7c0c13 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case2848rte.p and b/pandapower/networks/power_system_test_case_pickles/case2848rte.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case2869pegase.p b/pandapower/networks/power_system_test_case_pickles/case2869pegase.p index 5b5aea94e..2861c3df2 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case2869pegase.p and b/pandapower/networks/power_system_test_case_pickles/case2869pegase.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case30.p b/pandapower/networks/power_system_test_case_pickles/case30.p index ea268ef99..6e579a10c 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case30.p and b/pandapower/networks/power_system_test_case_pickles/case30.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case300.p b/pandapower/networks/power_system_test_case_pickles/case300.p index 1033a98dc..25a5e7415 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case300.p and b/pandapower/networks/power_system_test_case_pickles/case300.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case3120sp.p b/pandapower/networks/power_system_test_case_pickles/case3120sp.p index 2603aef81..eaaa1983f 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case3120sp.p and b/pandapower/networks/power_system_test_case_pickles/case3120sp.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case33bw.p b/pandapower/networks/power_system_test_case_pickles/case33bw.p index ccf413a77..e244165c0 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case33bw.p and b/pandapower/networks/power_system_test_case_pickles/case33bw.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case39.p b/pandapower/networks/power_system_test_case_pickles/case39.p index 46972f913..1e92c6764 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case39.p and b/pandapower/networks/power_system_test_case_pickles/case39.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case4gs.p b/pandapower/networks/power_system_test_case_pickles/case4gs.p index f43678ca4..bfb27afde 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case4gs.p and b/pandapower/networks/power_system_test_case_pickles/case4gs.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case57.p b/pandapower/networks/power_system_test_case_pickles/case57.p index cf4646a2b..98cbf073c 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case57.p and b/pandapower/networks/power_system_test_case_pickles/case57.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case5_demo_gridcal.p b/pandapower/networks/power_system_test_case_pickles/case5_demo_gridcal.p index 6fa2d78c7..0b16cf45a 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case5_demo_gridcal.p and b/pandapower/networks/power_system_test_case_pickles/case5_demo_gridcal.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case6470rte.p b/pandapower/networks/power_system_test_case_pickles/case6470rte.p index dd5c3e900..62051ad25 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case6470rte.p and b/pandapower/networks/power_system_test_case_pickles/case6470rte.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case6495rte.p b/pandapower/networks/power_system_test_case_pickles/case6495rte.p index feab77a5a..4710d2b91 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case6495rte.p and b/pandapower/networks/power_system_test_case_pickles/case6495rte.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case6515rte.p b/pandapower/networks/power_system_test_case_pickles/case6515rte.p index 54cb5284e..fef66c0ae 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case6515rte.p and b/pandapower/networks/power_system_test_case_pickles/case6515rte.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case6ww.p b/pandapower/networks/power_system_test_case_pickles/case6ww.p index fef60188f..1ba40b564 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case6ww.p and b/pandapower/networks/power_system_test_case_pickles/case6ww.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case89pegase.p b/pandapower/networks/power_system_test_case_pickles/case89pegase.p index b52b8093b..5f8586fd6 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case89pegase.p and b/pandapower/networks/power_system_test_case_pickles/case89pegase.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case9.p b/pandapower/networks/power_system_test_case_pickles/case9.p index 44e451642..382c6656e 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case9.p and b/pandapower/networks/power_system_test_case_pickles/case9.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/case9241pegase.p b/pandapower/networks/power_system_test_case_pickles/case9241pegase.p index 27db3a14b..7f3eb066e 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/case9241pegase.p and b/pandapower/networks/power_system_test_case_pickles/case9241pegase.p differ diff --git a/pandapower/networks/power_system_test_case_pickles/iceland.p b/pandapower/networks/power_system_test_case_pickles/iceland.p index d027f50bd..fc7b70543 100644 Binary files a/pandapower/networks/power_system_test_case_pickles/iceland.p and b/pandapower/networks/power_system_test_case_pickles/iceland.p differ diff --git a/pandapower/test/converter/test_from_ppc.py b/pandapower/test/converter/test_from_ppc.py index 66bebf5d8..ddaed780e 100644 --- a/pandapower/test/converter/test_from_ppc.py +++ b/pandapower/test/converter/test_from_ppc.py @@ -7,7 +7,6 @@ import pytest import os import pickle -from copy import deepcopy import pandapower as pp import pandapower.networks as pn @@ -91,19 +90,23 @@ def test_pypower_cases(): def test_case9_conversion(): net = pn.case9() - ppc = to_ppc(net) - # correction because to_ppc do net export max_loading_percent: - ppc["branch"][:, 5] = [250, 250, 150, 300, 150] + [250]*4 + # set max_loading_percent to enable line limit conversion + net.line["max_loading_percent"] = 100 + ppc = to_ppc(net, mode="opf") # correction because voltage limits are set to 1.0 at slack buses - ppc["bus"][0, 11] = 0.9 - ppc["bus"][0, 12] = 1.1 + ppc["bus"][0, 12] = 0.9 + ppc["bus"][0, 11] = 1.1 - net2 = from_ppc(ppc) + net2 = from_ppc(ppc, f_hz=net.f_hz) + # again add max_loading_percent to enable valid comparison + net2.line["max_loading_percent"] = 100 + # compare loadflow results pp.runpp(net) pp.runpp(net2) assert pp.nets_equal(net, net2, check_only_results=True, tol=1e-10) + # compare optimal powerflow results pp.runopp(net) pp.runopp(net2) assert pp.nets_equal(net, net2, check_only_results=True, tol=1e-10)