Using this minimal_example the pandapower devs made slightly modified as an example, here is the ac power flow:
import pandapower as pp
import pandas as pd
#create empty net
net = pp.create_empty_network()
#create buses
bus1 = pp.create_bus(net, vn_kv=20., name="Bus 1")
bus2 = pp.create_bus(net, vn_kv=0.4, name="Bus 2")
bus3 = pp.create_bus(net, vn_kv=0.4, name="Bus 3")
#create bus elements
pp.create_ext_grid(net, bus=bus1, vm_pu=1.02, name="Grid Connection")
pp.create_load(net, bus=bus3, p_mw=0.100, q_mvar=0.05, name="Load")
#create branch elements
trafo = pp.create_transformer(net, hv_bus=bus1, lv_bus=bus2, std_type="0.4 MVA 20/0.4 kV", name="Trafo")
line = pp.create_line(net, from_bus=bus2, to_bus=bus3, length_km=0.1, std_type="NAYY 4x50 SE", name="Line")
pp.runpp(net, max_iteration=500)
#pp.rundcpp(net, numba = False)
net.res_line
net.res_trafo
bus_results = pd.merge(net.bus[['name']], net.res_bus, left_index=True, right_index=True)
print(bus_results)
The printed bus results would be this:
name vm_pu va_degree p_mw q_mvar
0 Bus 1 1.020000 0.000000 -0.107265 -0.052675
1 Bus 2 1.008843 -0.760126 0.000000 0.000000
2 Bus 3 0.964431 0.115859 0.100000 0.050000
And res_line would be this:
p_from_mw q_from_mvar p_to_mw q_to_mvar pl_mw ql_mvar i_from_ka \
0 0.105392 0.050696 -0.1 -0.05 0.005392 0.000696 0.167325
i_to_ka i_ka vm_from_pu va_from_degree vm_to_pu va_to_degree \
0 0.167326 0.167326 1.008843 -0.760126 0.964431 0.115859
loading_percent
0 117.835208
Now if i remove the # from pp.rundcpp and comment pp.runpp, the DC power flow bus results would be:
name vm_pu va_degree p_mw q_mvar
0 Bus 1 NaN 0.000000 -0.1 NaN
1 Bus 2 NaN -150.834866 0.0 NaN
2 Bus 3 NaN -151.132088 0.1 NaN
And res_line would be:
p_from_mw q_from_mvar p_to_mw q_to_mvar pl_mw ql_mvar i_from_ka \
0 0.1 0.0 -0.1 0.0 0.0 0.0 0.144338
i_to_ka i_ka vm_from_pu va_from_degree vm_to_pu va_to_degree \
0 0.144338 0.144338 1.0 -150.834866 1.0 -151.132088
loading_percent
0 101.646174
I know that in DC power flow the voltage is always 1 V p.u for every bus but it says "nan", is this normal? Also, there's a big difference between the voltage angle in DC and AC simulations (-0.76 in AC and -150 in DC for bus 2).
The line loading is also a bit different