Skip to content

Commit

Permalink
bug fixes: (from_ppc - max_i_ka with sqrt(3)) & (test_case9_conversio…
Browse files Browse the repository at this point in the history
…n max_loading_percent)

-> correct line.max_i_ka in power_system_test_cases
close #1
  • Loading branch information
SteffenMeinecke committed Oct 9, 2017
1 parent ed75168 commit 1cc7f46
Show file tree
Hide file tree
Showing 28 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pandapower/converter/pypower/from_ppc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 " +
Expand Down
Binary file modified pandapower/networks/power_system_test_case_pickles/GBnetwork.p
Binary file not shown.
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case118.p
Binary file not shown.
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case14.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case145.p
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case2848rte.p
Binary file not shown.
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case30.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case300.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case3120sp.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case33bw.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case39.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case4gs.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case57.p
Binary file not shown.
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case6470rte.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case6495rte.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case6515rte.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case6ww.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case89pegase.p
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/case9.p
Binary file not shown.
Binary file not shown.
Binary file modified pandapower/networks/power_system_test_case_pickles/iceland.p
Binary file not shown.
17 changes: 10 additions & 7 deletions pandapower/test/converter/test_from_ppc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import pytest
import os
import pickle
from copy import deepcopy

import pandapower as pp
import pandapower.networks as pn
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1cc7f46

Please sign in to comment.