Open nuriapastorcal opened 3 years ago
Hi @nuriapastorcal ,
Can you narrow the error down with a more minimalistic example?
Roman
Close this issue due to inactivity.
I had the same problem when I tried to run a 3 phase power flow, if someone could help me, this is my code: (when I don't put the Controlled Voltage Generator, it's works).
import pandapower as pp
net = pp.create_empty_network()
bus1 = pp.create_bus(net, name="Birch", vn_kv=138) bus2 = pp.create_bus(net, name="Maple", vn_kv=138)
pp.create_ext_grid(net, bus1, vm_pu=1.00, va_degree=0, s_sc_max_mva=1000, rx_max=0.1, x0x_max=1.0, r0x0_max=0.1)
line1 = pp.create_line_from_parameters(net, bus1, bus2, length_km=1, r_ohm_per_km=1.777, x_ohm_per_km=8.887, c_nf_per_km=0, g_us_per_km=0.002, g0_us_per_km=0.002, r0_ohm_per_km=1.777, x0_ohm_per_km=8.887, c0_nf_per_km=0, max_i_ka=None, name="Line 1")
load1 = pp.create_load(net, bus1, p_mw=50, q_mvar=30.99, name="load 1") load2 = pp.create_load(net, bus2, p_mw=80, q_mvar=49.58, name="load 2")
pp.create_gen(net, bus2, p_mw=318, vm_pu=1.02, name="generator")
pp.runpp_3ph(net)
Hello everyone,
I am Nuria Pastor, I’m a student at Polytechnic University of Valencia. I am doing my end of degree project with pandapower. I am writing this post to see if someone can help me with an error that is appearing to me when I try to run a 3 phase asymmestric power flow. I leave you the code right under this message and the error that pops up to see is you can help me understand what is wrong with the power flow.
Thank you so much in advanced.
Nuria.
The code:
import numpy as np import pandapower as pp import pandas as pd
from pandapower.pf.runpp_3ph import runpp_3ph
net=pp.create_empty_network()
b1=pp.create_bus(net, 0.4) #E1 b2=pp.create_bus(net, 0.4) #EmbarradoA b3=pp.create_bus(net, 0.4) #EmbarradoB b4=pp.create_bus(net, 0.4) #EmbarradoC b5=pp.create_bus(net, 20.0) #RedMT b6=pp.create_bus(net, 0.4) #Terminal b7=pp.create_bus(net, 0.4) #Terminal1 b8=pp.create_bus(net, 0.4) #Terminal10 b9=pp.create_bus(net, 0.4) #Terminal11 b10=pp.create_bus(net, 0.4) #Terminal12 b11=pp.create_bus(net, 0.4) #Terminal13 b12=pp.create_bus(net, 0.4) #Terminal14 b13=pp.create_bus(net, 0.4) #Terminal15 b14=pp.create_bus(net, 0.4) #Terminal16 b15=pp.create_bus(net, 0.4) #Terminal17 b16=pp.create_bus(net, 0.4) #Terminal18 b17=pp.create_bus(net, 0.4) #Terminal19 b18=pp.create_bus(net, 0.4) #Terminal2 b19=pp.create_bus(net, 0.4) #Terminal20 b20=pp.create_bus(net, 0.4) #Terminal21 b21=pp.create_bus(net, 0.4) #Terminal22 b22=pp.create_bus(net, 0.4) #Terminal23 b24=pp.create_bus(net, 0.4) #Terminal25 b26=pp.create_bus(net, 0.4) #Terminal27 b28=pp.create_bus(net, 0.4) #Terminal29 b29=pp.create_bus(net, 0.4) #Terminal3
pp.create_ext_grid(net, bus=b5)
pp.create_load(net, b28, p_mw=2, q_mvar=0.0, type='wye')
pp.create_asymmetric_load(net, b28, p_a_mw=0.0, p_b_mw=0.0, p_c_mw=2, q_a_mvar=0.0, q_b_mvar=0.0, q_c_mvar=0.0)
pp.create_gen(net, b4, p_mw=0.5, name='PV1') pp.create_gen(net, b4, p_mw=0.5, name='PV2') pp.create_gen(net, b5, p_mw=0.5, name='Eólica')
pp.create_asymmetric_sgen(net, b4, name='PV1', p_a_mw=0.5, p_b_mw=0, p_c_mw=0, q_a_mvar=0, q_b_mvar=0, q_c_mvar=0) pp.create_asymmetric_sgen(net, b4, name='PV2', p_a_mw=0, p_b_mw=0.5, p_c_mw=0, q_a_mvar=0, q_b_mvar=0, q_c_mvar=0) pp.create_asymmetric_sgen(net, b5, name='Eólica', p_a_mw=0, p_b_mw=0, p_c_mw=0.5, q_a_mvar=0, q_b_mvar=0, q_c_mvar=0)
pp.create_transformer_from_parameters(net, hv_bus=b5, lv_bus=b18, sn_mva=0.25, vn_hv_kv=20.0, vn_lv_kv=0.4, vkr_percent=4.2, vk_percent=4.2, pfe_kw=0, i0_percent=0.1, vk0_percent=4.2, vkr0_percent=4.2, si0_hv_partial=0.1) pp.create_transformer_from_parameters(net, hv_bus=b5, lv_bus=b6, sn_mva=0.25, vn_hv_kv=20.0, vn_lv_kv=0.4, vkr_percent=4.2, vk_percent=4.2, pfe_kw=0, i0_percent=0.1, vk0_percent=4.2, vkr0_percent=4.2, si0_hv_partial=0.1)
pp.create_line_from_parameters(net, from_bus=b1, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b1, to_bus=b29, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b2, to_bus=b6, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b2, to_bus=b21, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b2, to_bus=b22, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b2, to_bus=b24, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b3, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b3, to_bus=b21, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b3, to_bus=b22, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b3, to_bus=b24, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b3, to_bus=b26, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b3, to_bus=b28, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b4, to_bus=b7, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b4, to_bus=b21, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b4, to_bus=b22, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b4, to_bus=b24, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b7, to_bus=b8, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b7, to_bus=b10, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b7, to_bus=b12, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b8, to_bus=b9, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b8, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b8, to_bus=b29, length_km=1, r_ohm_per_km=5.03277E+1, x_ohm_per_km=1.16828E+1, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=5.03277E+1,x0_ohm_per_km=1.16828E+1,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b9, to_bus=b10, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b9, to_bus=b10, length_km=1, r_ohm_per_km=1.00655E+2, x_ohm_per_km=2.33656E+01, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.00655E+2,x0_ohm_per_km=2.33656E+01,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b10, to_bus=b11, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b10, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b11, to_bus=b12, length_km=1, r_ohm_per_km=5.03277E+1, x_ohm_per_km=1.16828E+1, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=5.03277E+1,x0_ohm_per_km=1.16828E+1,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b12, to_bus=b13, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b12, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b13, to_bus=b15, length_km=1, r_ohm_per_km=5.03277E+1, x_ohm_per_km=1.16828E+1, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=5.03277E+1,x0_ohm_per_km=1.16828E+1,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b13, to_bus=b15, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b13, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b14, to_bus=b19, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b14, to_bus=b20, length_km=1, r_ohm_per_km=5.03277E+1, x_ohm_per_km=1.16828E+1, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=5.03277E+1,x0_ohm_per_km=1.16828E+1,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b15, to_bus=b16, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b15, to_bus=b17, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b16, to_bus=b19, length_km=1, r_ohm_per_km=1.00655E+2, x_ohm_per_km=2.33656E+01, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.00655E+2,x0_ohm_per_km=2.33656E+01,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b17, to_bus=b19, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0) pp.create_line_from_parameters(net, from_bus=b17, to_bus=b20, length_km=1, r_ohm_per_km=1.0E-6, x_ohm_per_km=1.0E-4, c_nf_per_km=0, max_i_ka=100.0, r0_ohm_per_km=1.0E-6,x0_ohm_per_km=1.0E-4,c0_nf_per_km=0)
net.ext_grid['s_sc_max_mva'] = 1000 net.ext_grid['rx_max'] = 0.1 net.ext_grid['x0x_max']=0.1 net.ext_grid['r0x0_max']=0.1
pp.add_zero_impedance_parameters(net)
runpp_3ph(net)
The error:
C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:80: RuntimeWarning: divide by zero encountered in true_divide Ysf = stat / (branch[:, BR_R] + 1j branch[:, BR_X]) ## series admittance C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:80: RuntimeWarning: invalid value encountered in true_divide Ysf = stat / (branch[:, BR_R] + 1j branch[:, BR_X]) ## series admittance C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:93: RuntimeWarning: invalid value encountered in true_divide Yff = (Ysf + 1j Bc / 2) / (tap conj(tap)) C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:94: RuntimeWarning: invalid value encountered in true_divide Yft = - Ysf / conj(tap) C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:95: RuntimeWarning: invalid value encountered in true_divide Ytf = - Yst / tap C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\dsolve\linsolve.py:206: MatrixRankWarning: Matrix is exactly singular warn("Matrix is exactly singular", MatrixRankWarning) C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pf\runpp_3ph.py:499: RuntimeWarning: invalid value encountered in true_divide i_abc_it_wye = (np.divide(s_abc_pu, v_abc_it)).conjugate() C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pf\runpp_3ph.py:500: RuntimeWarning: invalid value encountered in true_divide i_abc_it_delta = np.matmul(i_del_xfmn, (np.divide(s_abc_delta_pu, np.matmul C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pf\create_jacobian.py:18: RuntimeWarning: invalid value encountered in true_divide dVm_x, dVa_x = dSbus_dV_numba_sparse(Ybus.data, Ybus.indptr, Ybus.indices, V, V / abs(V), Ibus) C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:80: RuntimeWarning: divide by zero encountered in true_divide Ysf = stat / (branch[:, BR_R] + 1j branch[:, BR_X]) ## series admittance C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:80: RuntimeWarning: invalid value encountered in true_divide Ysf = stat / (branch[:, BR_R] + 1j branch[:, BR_X]) ## series admittance C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:93: RuntimeWarning: invalid value encountered in true_divide Yff = (Ysf + 1j Bc / 2) / (tap conj(tap)) C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:94: RuntimeWarning: invalid value encountered in true_divide Yft = - Ysf / conj(tap) C:\ProgramData\Anaconda3\lib\site-packages\pandapower\pypower\makeYbus.py:95: RuntimeWarning: invalid value encountered in true_divide Ytf = - Yst / tap C:\ProgramData\Anaconda3\lib\site-packages\pandapower\results_bus.py:54: RuntimeWarning: invalid value encountered in true_divide net["res_bus_3ph"]["unbalance_percent"] = np.abs(V012_pu[2, :]/V012_pu[1, :])*100 C:\ProgramData\Anaconda3\lib\site-packages\pandapower\auxiliary.py:837: RuntimeWarning: invalid value encountered in true_divide return np.conjugate(np.divide(S, V, out=np.zeros_like(S), where=V != 0)) # Return zero if div by zero C:\ProgramData\Anaconda3\lib\site-packages\pandapower\results_gen.py:190: ComplexWarning: Casting complex values to real discards the imaginary part V012[:, gen_is_idx] = np.array([ppc["bus"][gen_bus_idx_ppc, VM] C:\ProgramData\Anaconda3\lib\site-packages\pandapower\results_gen.py:195: ComplexWarning: Casting complex values to real discards the imaginary part S012[:, gen_is_idx] = np.array(
KeyError Traceback (most recent call last)