Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pandapower_case():
#more complicated examples like
#net = pandapower.networks.example_simple()
#can be used once the import of e.g. switches is perfected
#create empty net
net = pp.create_empty_network()
#create buses
b1 = pp.create_bus(net, vn_kv=20., name="Bus 1")
b2 = pp.create_bus(net, vn_kv=0.4, name="Bus 2")
b3 = pp.create_bus(net, vn_kv=0.4, name="Bus 3")
#create bus elements
pp.create_ext_grid(net, bus=b1, vm_pu=1.02, name="Grid Connection")
pp.create_load(net, bus=b3, p_mw=0.1, q_mvar=0.05, name="Load")
#create branch elements
tid = pp.create_transformer(net, hv_bus=b1, lv_bus=b2, std_type="0.4 MVA 20/0.4 kV",
name="Trafo")
pp.create_line(net, from_bus=b2, to_bus=b3, length_km=0.1, name="Line",
std_type="NAYY 4x50 SE")
#because of phase angles, need to init with DC
pp.runpp(net,calculate_voltage_angles=True, init="dc")
"""
This function creates a simple ten bus system with four radial low voltage nodes connected to \
a medium voltage slack bus. At every of the four radial low voltage nodes another low voltage \
node with a load is connected via cable.
OUTPUT:
**net** - Returns the required four load system with branches
EXAMPLE:
import pandapower.networks as pn
net_four_load_with_branches = pn.four_loads_with_branches_out()
"""
pd_net = pp.create_empty_network()
busnr1 = pp.create_bus(pd_net, name="bus1ref", vn_kv=10.)
pp.create_ext_grid(pd_net, busnr1)
busnr2 = pp.create_bus(pd_net, name="bus2", vn_kv=.4)
pp.create_transformer(pd_net, busnr1, busnr2, std_type="0.25 MVA 10/0.4 kV")
busnr3 = pp.create_bus(pd_net, name="bus3", vn_kv=.4)
pp.create_line(pd_net, busnr2, busnr3, name="line1", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr4 = pp.create_bus(pd_net, name="bus4", vn_kv=.4)
pp.create_line(pd_net, busnr3, busnr4, name="line2", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr5 = pp.create_bus(pd_net, name="bus5", vn_kv=.4)
pp.create_line(pd_net, busnr4, busnr5, name="line3", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr6 = pp.create_bus(pd_net, name="bus6", vn_kv=.4)
pp.create_line(pd_net, busnr5, busnr6, name="line4", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr7 = pp.create_bus(pd_net, name="bus7", vn_kv=.4)
pp.create_transformer(pd_net, busnr1, busnr2, std_type="0.25 MVA 10/0.4 kV")
pp.create_line(pd_net, busnr2, busnr3, name="line1", length_km=0.05,
std_type="NAYY 4x120 SE")
pp.create_line(pd_net, busnr3, busnr4, name="line2", length_km=0.05,
std_type="NAYY 4x120 SE")
pp.create_line(pd_net, busnr4, busnr5, name="line3", length_km=0.05,
std_type="NAYY 4x120 SE")
pp.create_line(pd_net, busnr5, busnr6, name="line4", length_km=0.05,
std_type="NAYY 4x120 SE")
pp.create_load(pd_net, busnr3, 0.030, 0.010)
pp.create_load(pd_net, busnr4, 0.030, 0.010)
pp.create_load(pd_net, busnr5, 0.030, 0.010)
pp.create_load(pd_net, busnr6, 0.030, 0.010)
n = busnr6 + 1
pd_net.bus_geodata = DataFrame(array([[0]*n, range(0, -n, -1)]).T, columns=['x', 'y'])
return pd_net
pp.create_line(pd_net, busnr3, busnr7, name="line5", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr8 = pp.create_bus(pd_net, name="bus8", vn_kv=.4)
pp.create_line(pd_net, busnr4, busnr8, name="line6", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr9 = pp.create_bus(pd_net, name="bus9", vn_kv=.4)
pp.create_line(pd_net, busnr5, busnr9, name="line7", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr10 = pp.create_bus(pd_net, name="bus10", vn_kv=.4)
pp.create_line(pd_net, busnr6, busnr10, name="line8", length_km=0.05,
std_type="NAYY 4x120 SE")
pp.create_load(pd_net, busnr7, p_mw=0.030, q_mvar=0.010)
pp.create_load(pd_net, busnr8, p_mw=0.030, q_mvar=0.010)
pp.create_load(pd_net, busnr9, p_mw=0.030, q_mvar=0.010)
pp.create_load(pd_net, busnr10, p_mw=0.030, q_mvar=0.010)
n1 = 6
n2 = 10
pd_net.bus_geodata = DataFrame(array([[0]*n1, range(0, -n1, -1)]).T, columns=['x', 'y'])
pd_net.bus_geodata = pd_net.bus_geodata.append(DataFrame(
array([[1]*(n2-n1), range(-3, -n2+n1-3, -1)]).T, columns=['x', 'y']), ignore_index=True)
return pd_net
EXAMPLE:
import pandapower.networks as pn
net_simple_four_bus = pn.simple_four_bus_system()
"""
net = pp.create_empty_network()
busnr1 = pp.create_bus(net, name="bus1ref", vn_kv=10)
pp.create_ext_grid(net, busnr1)
busnr2 = pp.create_bus(net, name="bus2", vn_kv=.4)
pp.create_transformer(net, busnr1, busnr2, name="transformer", std_type="0.25 MVA 10/0.4 kV")
busnr3 = pp.create_bus(net, name="bus3", vn_kv=.4)
pp.create_line(net, busnr2, busnr3, name="line1", length_km=0.50000, std_type="NAYY 4x50 SE")
busnr4 = pp.create_bus(net, name="bus4", vn_kv=.4)
pp.create_line(net, busnr3, busnr4, name="line2", length_km=0.50000, std_type="NAYY 4x50 SE")
pp.create_load(net, busnr3, 0.030, 0.010, name="load1")
pp.create_load(net, busnr4, 0.030, 0.010, name="load2")
pp.create_sgen(net, busnr3, p_mw=0.020, q_mvar=0.005, name="pv1", sn_mva=0.03)
pp.create_sgen(net, busnr4, p_mw=0.015, q_mvar=0.002, name="pv2", sn_mva=0.02)
n = busnr4 + 1
net.bus_geodata.loc[:, ['x', 'y']] = array([[0]*n, range(0, -n, -1)]).T
return net
def simple_mv_open_ring_net():
"""
This function creates a simple medium voltage open ring network with loads at every medium \
voltage node.
As an example this function is used in the topology and diagnostic docu.
OUTPUT:
**net** - Returns the required simple medium voltage open ring network
EXAMPLE:
import pandapower.networks as pn
net_simple_open_ring = pn.simple_mv_open_ring_net()
"""
net = pp.create_empty_network()
pp.create_bus(net, name="110 kV bar", vn_kv=110, type='b')
pp.create_bus(net, name="20 kV bar", vn_kv=20, type='b')
pp.create_bus(net, name="bus 2", vn_kv=20, type='b')
pp.create_bus(net, name="bus 3", vn_kv=20, type='b')
pp.create_bus(net, name="bus 4", vn_kv=20, type='b')
pp.create_bus(net, name="bus 5", vn_kv=20, type='b')
pp.create_bus(net, name="bus 6", vn_kv=20, type='b')
pp.create_ext_grid(net, 0, vm_pu=1)
pp.create_line(net, name="line 0", from_bus=1, to_bus=2, length_km=1,
std_type="NA2XS2Y 1x185 RM/25 12/20 kV")
pp.create_line(net, name="line 1", from_bus=2, to_bus=3, length_km=1,
std_type="NA2XS2Y 1x185 RM/25 12/20 kV")
pp.create_line(net, name="line 2", from_bus=3, to_bus=4, length_km=1,
def test_pandapower_case():
#more complicated examples like
#net = pandapower.networks.example_simple()
#can be used once the import of e.g. switches is perfected
#create empty net
net = pp.create_empty_network()
#create buses
b1 = pp.create_bus(net, vn_kv=20., name="Bus 1")
b2 = pp.create_bus(net, vn_kv=0.4, name="Bus 2")
b3 = pp.create_bus(net, vn_kv=0.4, name="Bus 3")
#create bus elements
pp.create_ext_grid(net, bus=b1, vm_pu=1.02, name="Grid Connection")
pp.create_load(net, bus=b3, p_mw=0.1, q_mvar=0.05, name="Load")
#create branch elements
tid = pp.create_transformer(net, hv_bus=b1, lv_bus=b2, std_type="0.4 MVA 20/0.4 kV",
name="Trafo")
pp.create_line(net, from_bus=b2, to_bus=b3, length_km=0.1, name="Line",
std_type="NAYY 4x50 SE")
def panda_four_load_branch():
"""
This function creates a simple six bus system with four radial low voltage nodes connected to \
a medium voltage slack bus. At every low voltage node the same load is connected.
OUTPUT:
**net** - Returns the required four load system
EXAMPLE:
import pandapower.networks as pn
net_four_load = pn.panda_four_load_branch()
"""
pd_net = pp.create_empty_network()
busnr1 = pp.create_bus(pd_net, name="bus1", vn_kv=10.)
busnr2 = pp.create_bus(pd_net, name="bus2", vn_kv=.4)
busnr3 = pp.create_bus(pd_net, name="bus3", vn_kv=.4)
busnr4 = pp.create_bus(pd_net, name="bus4", vn_kv=.4)
busnr5 = pp.create_bus(pd_net, name="bus5", vn_kv=.4)
busnr6 = pp.create_bus(pd_net, name="bus6", vn_kv=.4)
pp.create_ext_grid(pd_net, busnr1)
pp.create_transformer(pd_net, busnr1, busnr2, std_type="0.25 MVA 10/0.4 kV")
pp.create_line(pd_net, busnr2, busnr3, name="line1", length_km=0.05,
std_type="NAYY 4x120 SE")
pp.create_line(pd_net, busnr3, busnr4, name="line2", length_km=0.05,
std_type="NAYY 4x120 SE")
This function creates a simple ten bus system with four radial low voltage nodes connected to \
a medium voltage slack bus. At every of the four radial low voltage nodes another low voltage \
node with a load is connected via cable.
OUTPUT:
**net** - Returns the required four load system with branches
EXAMPLE:
import pandapower.networks as pn
net_four_load_with_branches = pn.four_loads_with_branches_out()
"""
pd_net = pp.create_empty_network()
busnr1 = pp.create_bus(pd_net, name="bus1ref", vn_kv=10.)
pp.create_ext_grid(pd_net, busnr1)
busnr2 = pp.create_bus(pd_net, name="bus2", vn_kv=.4)
pp.create_transformer(pd_net, busnr1, busnr2, std_type="0.25 MVA 10/0.4 kV")
busnr3 = pp.create_bus(pd_net, name="bus3", vn_kv=.4)
pp.create_line(pd_net, busnr2, busnr3, name="line1", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr4 = pp.create_bus(pd_net, name="bus4", vn_kv=.4)
pp.create_line(pd_net, busnr3, busnr4, name="line2", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr5 = pp.create_bus(pd_net, name="bus5", vn_kv=.4)
pp.create_line(pd_net, busnr4, busnr5, name="line3", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr6 = pp.create_bus(pd_net, name="bus6", vn_kv=.4)
pp.create_line(pd_net, busnr5, busnr6, name="line4", length_km=0.05,
std_type="NAYY 4x120 SE")
busnr7 = pp.create_bus(pd_net, name="bus7", vn_kv=.4)
pp.create_line(pd_net, busnr3, busnr7, name="line5", length_km=0.05,
# old ext_grid -> gen
j = 0
for i in ext_grid_idx:
ext_grid_data = net.ext_grid.loc[i]
net.ext_grid.drop(i, inplace=True)
pp.create_gen(net, ext_grid_data.bus, ext_grid_p[j],
vm_pu=ext_grid_data.vm_pu, controllable=True,
min_q_kvar=ext_grid_data.min_q_kvar, max_q_kvar=ext_grid_data.max_q_kvar,
min_p_kw=ext_grid_data.min_p_kw, max_p_kw=ext_grid_data.max_p_kw)
j += 1
# old gen at ref_bus -> ext_grid (and sgen)
for i in gen_idx:
gen_data = net.gen.loc[i]
net.gen.drop(i, inplace=True)
if gen_data.bus not in net.ext_grid.bus.values:
pp.create_ext_grid(net, gen_data.bus, vm_pu=gen_data.vm_pu, va_degree=0.,
min_q_kvar=gen_data.min_q_kvar, max_q_kvar=gen_data.max_q_kvar,
min_p_kw=gen_data.min_p_kw, max_p_kw=gen_data.max_p_kw)
else:
pp.create_sgen(net, gen_data.bus, p_kw=gen_data.p_kw,
min_q_kvar=gen_data.min_q_kvar, max_q_kvar=gen_data.max_q_kvar,
min_p_kw=gen_data.min_p_kw, max_p_kw=gen_data.max_p_kw)