Question: using this python script could you solve this question in its entirety import sys from pathlib import Path # Add parent directory to Python path

using this python script could you solve this question in its entirety
import sys
from pathlib import Path
# Add parent directory to Python path
sys.path.append(str(Path(__file__).resolve().parent.parent))
import numpy as np
import equations as eq # Import equations module
# Parameters
# Generator G1
G1=[49.0e6,13.8e3,0.01,0.11]# [MVA, kV, Rpu, Xpu]
# Transformer T1
T1=[47.0e6,13.8e3,120e3,0.01,0.053]# [MVA, kVpri, kVsec, Rpu, Xpu]
# Transformer T2
T2=[47.0e6,120e3,14e3,0.011,0.063]# [MVA, kVpri, kVsec, Rpu, Xpu]
# Line L1
Zline =16+75j # Line impedance in ohms
# Load SLoad
Sload =(43+9j)*1e6/3 # Load power in VA
Sbase = G1[0]/3
t1= T1[1]/T1[2]
t2= T2[1]/T2[2]
#pu table
Va, Ia, Za = eq.table(G1[1]/np.sqrt(3), Sbase, 1)
Vb, Ib, Zb = eq.table(Va, Sbase, t1)
Vc, Ic, Zc = eq.table(Vb ,Sbase, t2)
#impedance calcs
#Zone A
Zg1_pu = G1[2]+1j*G1[3]
#Zone B
Zt1_pu = eq.pu_new(T1[3]+1j*T1[4], T1[2]/ np.sqrt(3), Vb, T1[0]/3, Sbase)
Zl1_pu =(Zline.real +1j*Zline.imag)/ Zb
Zt2_pu = eq.pu_new(T2[3]+1j*T2[4], T2[1]/ np.sqrt(3), Vb, T2[0]/3, Sbase)
#Zone C
ZLoad1_pu =(Vc/np.conj(Sload/Vc))/Zc
#matrix
Zline1_pu = Zt1_pu + Zl1_pu + Zt2_pu
#Question 1: Bus admittance matrix
Y11=1/Zg1_pu +1/Zline1_pu
Y12=-1/Zline1_pu
Y21=-1/Zline1_pu
Y22=1/ZLoad1_pu +1/Zline1_pu
Ybus = np.array([[Y11, Y12],[Y21, Y22]])
#Question 2: Bus impedance matrix
Zbus = np.linalg.inv(Ybus)
Ig1_pu =1/ Zg1_pu
Imatrix = np.array([Ig1_pu,0])
Busmatrix = np.linalg.solve(Ybus, Imatrix)
#Question 3: Vb1: Voltage at bus 1[mag, phs][kV]
Vbus1= Busmatrix[0]* Va
Vb1= eq.format_phasor(eq.phasor(Vbus1*np.sqrt(3)/1e3))
#Question 4: IG1: Current from G1[mag, phs][A]
Ig1=(G1[1]/np.sqrt(3)- Vbus1)/(Zg1_pu*Za)
IG1= eq.format_phasor(eq.phasor(Ig1))
#Question 5: Vb2: Voltage at bus 2[mag, phs][kV]
Vbus2= Busmatrix[1]* Vc
Vb2= eq.format_phasor(eq.phasor(Vbus2*np.sqrt(3)/1e3))
#Question 6: IL1: Current through L1[mag, phs][A]
Iline =(Vbus1/t1-(Vbus2*t2))/(Zline +(Zt1_pu+Zt2_pu)*Zb)
IL1= eq.format_phasor(eq.phasor(Iline))
#Question 7: ILoad1: Current to Load1[mag, phs][A]
Iload = Vbus2/(ZLoad1_pu*Zc)
ILoad1= eq.format_phasor(eq.phasor(Iload))
#Question 8: Pline: Power lost on L1[kW]
Sline =3* Iline * np.conj(Iline)* Zline
Pline = Sline.real /1e3
#Question 9: SLoad_actual: Actual power delivered to load [MVA]
Sload_actual =3* Vbus2* np.conj(Iload)/1e6
print("1 Bus admittance matrix: ","["+",".join([f"[{','.join(f'{x:.5}' for x in row)}]" for row in Ybus])+"]")
print("2 Bus impedance matrix: ","["+",".join([f"[{','.join(f'{x:.5}' for x in row)}]" for row in Zbus])+"]")
print(f"3 Vb1: Voltage at Bus 1[kV]: {Vb1}")
print(f"4 IG1: Current from G1[A]: {IG1}")
print(f"5 Vb2: Voltage at Bus 2[kV]: {Vb2}")
print(f"6 IL1: Current through L1[A]: {IL1}")
print(f"7 ILoad1: Current to Load1[A]: {ILoad1}")
print(f"8 Pline: Power lost on L1[kW]: {Pline:.4}")
print(f"9 SLoad_actual: Actual power delivered to load [MVA]: {Sload_actual:.4}")
using this python script could you solve this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Electrical Engineering Questions!