Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
tp_pos=0.0, name='Trafo I0-I1')
pp.create_transformer_from_parameters(net_cigre_lv, busC0, busC1, sn_mva=0.3, vn_hv_kv=20.0,
vn_lv_kv=0.4, vscr_percent=0.993750, vsc_percent=4.115529,
pfe_mw=0.0, i0_percent=0.0, shift_degree=30.0,
tp_pos=0.0, name='Trafo C0-C1')
# External grid
pp.create_ext_grid(net_cigre_lv, bus0, vm_pu=1.0, va_degree=0.0, s_sc_max_mva=100.0,
s_sc_min_mva=100.0, rx_max=1.0, rx_min=1.0)
# Loads
pp.create_load(net_cigre_lv, busR1, p_mw=0.19, q_mvar=0.062449980, name='Load R1')
pp.create_load(net_cigre_lv, busR11, p_mw=0.01425, q_mvar=0.004683748, name='Load R11')
pp.create_load(net_cigre_lv, busR15, p_mw=0.0494, q_mvar=0.016236995, name='Load R15')
pp.create_load(net_cigre_lv, busR16, p_mw=0.05225, q_mvar=0.017173744, name='Load R16')
pp.create_load(net_cigre_lv, busR17, p_mw=0.03325, q_mvar=0.010928746, name='Load R17')
pp.create_load(net_cigre_lv, busR18, p_mw=0.04465, q_mvar=0.014675745, name='Load R18')
pp.create_load(net_cigre_lv, busI2, p_mw=0.0850, q_mvar=0.052678269, name='Load I2')
pp.create_load(net_cigre_lv, busC1, p_mw=0.1080, q_mvar=0.052306787, name='Load C1')
pp.create_load(net_cigre_lv, busC12, p_mw=0.018, q_mvar=0.008717798, name='Load C12')
pp.create_load(net_cigre_lv, busC13, p_mw=0.018, q_mvar=0.008717798, name='Load C13')
pp.create_load(net_cigre_lv, busC14, p_mw=0.0225, q_mvar=0.010897247, name='Load C14')
pp.create_load(net_cigre_lv, busC17, p_mw=0.0225, q_mvar=0.010897247, name='Load C17')
pp.create_load(net_cigre_lv, busC18, p_mw=0.0072, q_mvar=0.003487119, name='Load C18')
pp.create_load(net_cigre_lv, busC19, p_mw=0.0144, q_mvar=0.006974238, name='Load C19')
pp.create_load(net_cigre_lv, busC20, p_mw=0.0072, q_mvar=0.003487119, name='Load C20')
# Switches
pp.create_switch(net_cigre_lv, bus0, busR0, et='b', closed=True, type='CB', name='S1')
pp.create_switch(net_cigre_lv, bus0, busI0, et='b', closed=True, type='CB', name='S2')
pp.create_switch(net_cigre_lv, bus0, busC0, et='b', closed=True, type='CB', name='S3')
for _, load in hv_loads.iterrows():
bus_idx = pp.get_element_index(net, "bus", load.bus)
pp.create_load(net, bus_idx, p_mw=load.p, q_mvar=load.q, name=load.load_name)
# MV
mv_loads = pd.DataFrame()
mv_loads['load_name'] = ['Further MV-Rings', 'Industry Load'] + ['LV Net %s' % i for i in
[1, 2, 3, 5, 6, 7]]
mv_loads['bus'] = ['Bus MV0', 'Bus MV0 20kV'] + ['Bus MV%s' % i for i in [1, 2, 3, 5, 6, 7]]
mv_loads['p'] = [6, 18, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]
mv_loads['q'] = [2, 4, 0.1, 0.06, 0.06, 0.06, 0.06, 0.06]
for _, load in mv_loads.iterrows():
bus_idx = pp.get_element_index(net, "bus", load.bus)
pp.create_load(net, bus_idx, p_mw=load.p, q_mvar=load.q, name=load.load_name)
# LV
lv_loads = pd.DataFrame()
idx = ['', '(1)', '(2)', '(3)', '(4)', '(5)']
lv_loads['load_name'] = ['Further LV-Feeders Load'] + [
'Residential Load%s' % i for i in idx[0:5]] + ['Rural Load%s' % i for i in idx[0:6]]
lv_loads['bus'] = ['Bus LV%s' % i for i in ['0', '1.1', '1.2', '1.3', '1.4', '1.5', '2.1',
'2.2', '2.3', '2.4', '2.2.1', '2.2.2']]
lv_loads['p'] = [0.1] + [0.01]*11
lv_loads['q'] = [0.01] + [0.03]*11
for _, load in lv_loads.iterrows():
bus_idx = pp.get_element_index(net, "bus", load.bus)
pp.create_load(net, bus_idx, p_mw=load.p, q_mvar=load.q, name=load.load_name)
# --- Other
the name ti keep track on the node position
"""
startpoint_bus = 1
startpoint_line = 1
bus_before = startbusnr
for i in list(range(n_lines)):
buscounter = startpoint_bus + i
linecounter = startpoint_line + i
created_bus_nr = pp.create_bus(pd_net, name="bus_%d_%d" % (branchnr, buscounter), vn_kv=.4)
pp.create_line(pd_net, bus_before, created_bus_nr, length_km=length_per_line,
name="line_%d_%d" % (branchnr, linecounter), std_type=std_type)
if p_load_mw or q_load_mvar:
pp.create_load(pd_net, created_bus_nr, p_mw=p_load_mw, q_mvar=q_load_mvar)
bus_before = created_bus_nr # rueckgefuehrter Wert in der Schleife
return pd_net
pd.set_option('display.width', 1500)
pd.set_option('display.precision', 4)
#initialize datastructure
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 slack
pp.create_ext_grid(net, bus=b1, vm_pu=1.02, name="Grid Connection")
#create_load
pp.create_load(net, bus=b3, p_kw=100, q_kvar=50, name="Load")
tid = pp.create_transformer(net, hv_bus=b1, lv_bus=b2, std_type="0.4 MVA 20/0.4 kV")
#tid = pp.create_transformer_from_parameters(net,
# hv_bus=b1,
# lv_bus=b2,
# sn_kva=400.,
# vn_hv_kv=20.,
# vn_lv_kv=0.4,
# vsc_percent=6.,
# vscr_percent=1.425,
# i0_percent=0.3375,
# pfe_kw=1.35)
#create line by standard type
lid = pp.create_line(net, from_bus=b2, to_bus=b3, length_km=0.1,
std_type="NAYY 4x50 SE", name="Line")
import pandapower.networks as pn
net = pn.networks.setup_grid(5, p=0.3, num_loads=7)
"""
if not num_loads and not deviation:
raise UserWarning("specify either num_loads or deviation!")
random.seed(seed)
net = random_empty_grid(num_buses, p)
if num_loads:
for _ in range(num_loads):
pp.create_load(net, random.randrange(1, num_buses), p_kw=200)
return net
else:
pp.runpp(net)
while net.res_bus.vm_pu.min() > 0.985 - deviation:
pp.create_load(net, random.randrange(1, num_buses), p_kw=200)
pp.runpp(net)
return net
vn_lv_kv=0.4, vscr_percent=1.003125, vsc_percent=4.126896,
pfe_mw=0.0, i0_percent=0.0, shift_degree=30.0,
tp_pos=0.0, name='Trafo I0-I1')
pp.create_transformer_from_parameters(net_cigre_lv, busC0, busC1, sn_mva=0.3, vn_hv_kv=20.0,
vn_lv_kv=0.4, vscr_percent=0.993750, vsc_percent=4.115529,
pfe_mw=0.0, i0_percent=0.0, shift_degree=30.0,
tp_pos=0.0, name='Trafo C0-C1')
# External grid
pp.create_ext_grid(net_cigre_lv, bus0, vm_pu=1.0, va_degree=0.0, s_sc_max_mva=100.0,
s_sc_min_mva=100.0, rx_max=1.0, rx_min=1.0)
# Loads
pp.create_load(net_cigre_lv, busR1, p_mw=0.19, q_mvar=0.062449980, name='Load R1')
pp.create_load(net_cigre_lv, busR11, p_mw=0.01425, q_mvar=0.004683748, name='Load R11')
pp.create_load(net_cigre_lv, busR15, p_mw=0.0494, q_mvar=0.016236995, name='Load R15')
pp.create_load(net_cigre_lv, busR16, p_mw=0.05225, q_mvar=0.017173744, name='Load R16')
pp.create_load(net_cigre_lv, busR17, p_mw=0.03325, q_mvar=0.010928746, name='Load R17')
pp.create_load(net_cigre_lv, busR18, p_mw=0.04465, q_mvar=0.014675745, name='Load R18')
pp.create_load(net_cigre_lv, busI2, p_mw=0.0850, q_mvar=0.052678269, name='Load I2')
pp.create_load(net_cigre_lv, busC1, p_mw=0.1080, q_mvar=0.052306787, name='Load C1')
pp.create_load(net_cigre_lv, busC12, p_mw=0.018, q_mvar=0.008717798, name='Load C12')
pp.create_load(net_cigre_lv, busC13, p_mw=0.018, q_mvar=0.008717798, name='Load C13')
pp.create_load(net_cigre_lv, busC14, p_mw=0.0225, q_mvar=0.010897247, name='Load C14')
pp.create_load(net_cigre_lv, busC17, p_mw=0.0225, q_mvar=0.010897247, name='Load C17')
pp.create_load(net_cigre_lv, busC18, p_mw=0.0072, q_mvar=0.003487119, name='Load C18')
pp.create_load(net_cigre_lv, busC19, p_mw=0.0144, q_mvar=0.006974238, name='Load C19')
pp.create_load(net_cigre_lv, busC20, p_mw=0.0072, q_mvar=0.003487119, name='Load C20')
# Switches
pp.create_switch(net_cigre_lv, bus0, busR0, et='b', closed=True, type='CB', name='S1')
[house_connection_type[network_class]]*n_feeder[network_class][i]
else:
lines['std_type'] = \
[line_types[network_class][i][0]]*line_type_change_at[network_class][i] + \
[line_types[network_class][i][1]]*(n_feeder[network_class][i] -
line_type_change_at[network_class][i]) + \
[house_connection_type[network_class]]*n_feeder[network_class][i]
lines['length'] = [l_lines[network_class][i]]*n_feeder[network_class][i] + \
[house_connection_length[network_class]]*n_feeder[network_class][i]
for _, lines in lines.iterrows():
pp.create_line(net, lines.from_bus, lines.to_bus, length_km=lines.length,
std_type=lines.std_type)
# load
for i in house_buses[i]:
pp.create_load(net, i, p_mw=5.1e-3)
# direct loads and DEA
if network_class == "rural_1":
special_load = [(2, 4), (3, 2)]
DER = [(2, 1, 6.9), (2, 2, 15.3), (2, 4, 29.6), (3, 4, 15.8), (3, 5, 25.3)]
elif network_class == "rural_2":
special_load = [(1, 1), (2, 3), (3, 2)]
DER = [(1, 1, 29.6), (2, 3, 25.4), (3, 2, 25), (3, 3, 10)]
elif network_class == "village_1":
special_load = [(2, 9), (2, 12), (2, 14), (2, 16), (3, 5), (4, 3), (4, 6), (4, 8)]
DER = [(1, 6, 29.8), (1, 8, 22.8), (2, 3, 7.9), (2, 5, 4.2), (2, 11, 16.7), (2, 15, 7.3),
(3, 1, 31.9), (3, 3, 17.4), (3, 5, 15), (4, 1, 8.8), (4, 3, 19.6), (4, 5, 9.3),
(4, 6, 13)]
elif network_class == "village_2":
special_load = []
DER = [(1, 6, 29.8), (1, 2, 16), (1, 3, 4.6), (1, 6, 19), (1, 8, 29), (2, 1, 16),