<jupyter_start><jupyter_text>Three-bus power flow exampleExample 5.4 given at page 89 of Ned Mohan's Book. Based on network shown at page 80 and gradually described in the other examples.Buses:  - Bus 1 is the slack, with voltage at 1 pu - Bus 2 is a PV bus, with voltage at 1.05 pu and drawing 2 pu of active power - Bus 3 is a PQ bus, consumed P = 5 pu and Q = 1 pu.Lines:  - Shunt susceptances are ignored (4.5e-6 S/km) - X = 0.376 Ohm/km (at 6h Hz) - R = 0.037 Ohm/km - 1 to 2: 150 km - 2 to 3: 150 km - 3 to 1: 200 km  Voltage base (3-phase): 345 kVPower base (3-phase): 100 MVATODO:  - base values - line params<jupyter_code>import pandapower as pp
#create empty net
net = pp.create_empty_network() 

# Per unit (3-phase values)
Pbase = 100  # MVA
Vbase = 345 # kV

#create buses
b1 = pp.create_bus(net, vn_kv=Vbase, name="Bus 1")
b2 = pp.create_bus(net, vn_kv=Vbase, name="Bus 2")
b3 = pp.create_bus(net, vn_kv=Vbase, name="Bus 3")

#create bus elements
pp.create_ext_grid(net, bus=b1, vm_pu=1.00, name="Grid Connection")
pp.create_load(net, bus=b3, p_mw=5*Pbase, q_mvar=1*Pbase, name="Load")
pp.create_gen(net, bus=b2, p_mw=2*Pbase, vm_pu=1.05, name="PV")

#create branch elements. Here I use impedances since we do not have accurate info about line types.
Zbase = Vbase**2 / Pbase
X_km = 0.376
R_km = 0.037
l12_km = 150
l23_km = 150
l31_km = 200

pp.create_impedance(net, from_bus=b1, to_bus=b2, rft_pu=l12_km*R_km/Zbase, rtf_pu=l12_km*R_km/Zbase, xft_pu=l12_km*X_km/Zbase, xtf_pu=l12_km*X_km/Zbase, sn_mva=Pbase, in_service=True)
pp.create_impedance(net, from_bus=b2, to_bus=b3, rft_pu=l23_km*R_km/Zbase, rtf_pu=l23_km*R_km/Zbase, xft_pu=l23_km*X_km/Zbase, xtf_pu=l23_km*X_km/Zbase, sn_mva=Pbase, in_service=True)
pp.create_impedance(net, from_bus=b3, to_bus=b1, rft_pu=l31_km*R_km/Zbase, rtf_pu=l31_km*R_km/Zbase, xft_pu=l31_km*X_km/Zbase, xtf_pu=l31_km*X_km/Zbase, sn_mva=Pbase, in_service=True)<jupyter_output><empty_output><jupyter_text>Run the power flow and analyze the results<jupyter_code>pp.runpp(net)
net.res_bus
net.res_impedance<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12259615384615384, 'fraction_numerical': 0.0625, 'mean_word_length': 5.268072289156627, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '653171', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1012, 'n_tokens_neox': 918, 'n_words': 231, 'path': 'notebooks/first_PF_pandapower.ipynb', 'repo_name': 'asutera/ELEC0447-analysis-power-systems', 'size': '2080'}