import math
#initialisation of variables
# To determine no load power factor,core loss current and magnetising current
# and no load ckt parameters of transformer
Pi=50.0
V1=230.0
Io=2
#Calculations
pf=Pi/(V1*Io)
print("No load power factor %.2f v " %pf)
Im=Io*math.sin(math.radians(math.degrees(math.acos(pf))))
print("Magnetising current(A) %.2f v " %Im)
Ii=Io*pf
print("core loss current(A) %.2f v " %Ii)
Gi=Pi/V1**2
print("Gi(mho) %.2f v " %Gi)
Bm=Im/V1
#Results
print("Bm(mho) %.2f v " %Bm)
import math
#initialisation of variables
# To calculate no load current and its pf and no load power drawn from mains
E=200
f=50
N1=150 # no of turns
b1=.1
b2=.05
phi_max=E/(4.44*f*N1)
print("flux(Wb)%.2f v " %phi_max)
B_max=phi_max/(b1*b2)
print("B_max(T) = %.2f v " %B_max)
H_max=250 #According to B_max, H_max is 250AT/m
l_c=.2*(3.0+3.5) #length of core
AT_max=H_max*l_c
print("AT_max = %.2f v " %AT_max)
T_max=N1
I_mmax=AT_max/T_max
I_mrms=I_mmax/2**.5
print("I_mrms(A) = %.2f v " %I_mrms)
v=2*(20*10*5)+2*(45*10*5)
d=.0079 #density of core material
w=v*d
cl=3 #core loss/kg
closs=w*cl
print("core loss(W) = %.2f v " %closs)
I_i=closs/E
print("I_i(A) = %.2f v " %I_i)
def rect2polar(x,y):
r=math.sqrt(x**2+y**2)
return r
def rect2polar2(x,y):
pff=math.cos(math.radians(math.degrees(math.acos(y/x))))
return pff
I_o=rect2polar(I_i,-I_mmax)
pf=rect2polar(I_i,-I_mmax)
print("no load current(A) = %.2f v " %I_o)
print("no load power factor = %.2f v " %pf)
import math
#initialisation of variables
# To calculate primary and scondary side impedences,current and their pf and real power
# and calculate terminal voltage
N_1=150.0
N_2=75.0
a=N_1/N_2
Z_2=[5,30] #polar(magnitude,phase diff)
I_2=[0,0]
I_1=[0,0]
print(Z_2,'secondary impedence(ohm)')
Z_1=[a**2*Z_2[0],Z_2[1]]
print(Z_1,'primary impedence(ohm)')
V_1=[200,0] #polar(magnitde,phase diff)
V_2=[V_1[0]/a,V_1[1]]
print(V_2,'secondary terminal voltage(V)')
I_2[0]=V_2[0]/Z_2[0]
I_2[1]=V_2[1]-Z_2[1]
print(I_2,'I_2=')
pf=math.cos(math.radians(I_2[1]))
print(pf,'pf lagging=')
I_1[0]=I_2[0]/a
I_1[1]=I_2[1]
print(I_1,'I_1(A)')
pf=math.cos(math.radians(I_1[1]))
print(pf,'pf lagging=')
P_2=V_2[0]*I_2[0]*math.cos(math.radians(I_2[1]))
print(P_2,'secondary power output(W)=')
#P_1=primary power output
P_1=P_2 #as the transormer is lossless
print(P_1,'primary power output(W)=')
# To calculate primary current and its pf
def polar2rect(r,theta):
x=r*math.cos(math.radians(theta))
return x
def polar2rect2(r,theta):
y=r*math.sin(math.radians(theta))
return y
def rect2polar(x,y):
r=math.sqrt(x**2+y**2)
return r
def rect2polar2(x,y):
theta=math.degrees(math.atan(y/x))
return theta
#Calculations
I_2=[10,-30]
I_2r=[0,0]
I_2r[0]=polar2rect(I_2[0],I_2[1])
I_2r[1]=polar2rect2(I_2[0],I_2[1])
I_0=[1.62,-71.5]
I_0r=[0,0]
I_0r[0]=polar2rect(I_0[0],I_0[1])
I_0r[1]=polar2rect2(I_0[0],I_0[1])
I_1r=I_0r+I_2r
I_1[0]=rect2polar(I_1r[0],I_1r[1])
I_1[1]=rect2polar2(I_1r[0],I_1r[1])
print(I_1[0],'primary current(A)=')
pf=math.cos(math.radians(I_1[1]))
print(pf,'power factor=')
import math
# Equivalent circuit referred to(i)HV side (ii)LV side
N_1=2000
N_2=200
a=N_1/N_2
#Calculations
Z_2=p=complex(0.004,0.005) #low voltage impedence
Z_2hv=a**2*Z_2
print(Z_2hv,'Z_2 referred to hv side(ohm)') #when referred to hv side
Y_0=complex(0.002,-0.015) #shunt branch admittance
Y_0hv=Y_0/a**2
print(Y_0hv,'Y_0 referred to hv side(mho)')
Z_1=complex(0.42,-0.52) #low voltage impedence
Z_1lv=Z_1/a**2
print(Z_1lv,'Z_1 referred to lv side(ohm)')
import math
# To find the voltage at the load end of the transformer when load is drawing transformer current
I=20/2 #rated load current(hv side)
Z1=[.25,1.4] #impedence of feeder (REAL,IMAGINERY)
Z2=[.82,1.02] #impedence of transformer (REAL,IMAGINERY)
Z=Z1+Z2
print(Z,'Z(ohm)')
pf=.8
phi=math.degrees(math.acos(pf))
#from phasor diagram
#Calculations
R=Z[0]
X=Z[0]
AF=I*X*math.cos(math.radians(phi))
FE=I*R*math.sin(math.radians(phi))
AE=AF-FE
OA=2000
OE=math.sqrt(OA**2-AE**2)
BD=I*R*math.cos(math.radians(phi))
DE=I*X*math.sin(math.radians(phi))
BE=BD+DE
V1=OE
print(V1,'V1(V)')
V2=V1-BE
print(V2,'V2(V)')
loadvol=V2/10 #referred to LV side
print(loadvol,'load voltage(V)')
import math
#initialisation of variables
# Approx equivalent ckt referred to hv and lv sides resp,
#open ckt test data with HV side open
ocv=200.0
oci=4.0
ocp=120.0
#short ckt test data with LV side open
scv=60.0
sci=10.0
scp=300.0
#OC test(LV side)
#Calculations
Y_o=oci/ocv
print("Y_o %.4f v " %Y_o)
G_i=ocp/ocv**2
print("G_i %.4f v " %G_i)
B_m=math.sqrt(Y_o**2-G_i**2)
print("B_m %.4f v " %B_m)
#SC test(HV side)
Z=scv/sci
print("Z(ohm) %.4f v " %Z)
R=scp/sci**2
print("R(ohm) %.4f v " %R)
X=math.sqrt(Z**2-R**2)
print("X(ohm) %.4f v " %X)
N_H=2000
N_L=200
a=N_H/N_L #transformation ratio
#Equivalent ckt referred to HV side
G_iHV=G_i/a**2
print("G_i(HV)mho %.4f v " %G_iHV)
B_mHV=B_m/a**2
print("B_m(HV)mho %.4f v " %B_mHV)
#Equivalent ckt referred to LV side
RLV=R/a**2
print("R(LV)ohm %.4f v " %RLV)
XLV=X/a**2
print("X(LV)ohm %.4f v " %XLV)
import math
#initialisation of variables
# to calculate (a)open ckt current,power and pf when LV excited at rated voltage
# (b) voltage at which HV side is excited, ip power and its pf
r=150000 #rating(VA)
V1=2400.0
V2=240.0
a=V1/V2
R_1=.2
X_1=.45
R_i=10000
R_2=2*10**-3
X_2=4.5*10**-3
X_m=1600
#Referring the shunt parameters to LV side
#Calculations
R_iLV=R_i/a**2
X_mLV=X_m/a**2
I_oLV=[V2/100.0,V2/16.0]
I_o=math.sqrt(I_oLV[0]**2+I_oLV[1]**2)
print(I_o,'I_o(A)')
pf=math.cos(math.radians(math.degrees(math.atan(I_oLV[1]/I_oLV[0]))))
print("pf = %.2f v " %pf)
import math
#initialisation of variables
#To find exciting current and expess impedence in pu in both HV and LV sides
V_BHV=2000.0
I_BHV=10.0
Z_BHV=V_BHV/I_BHV
V_BLV=200.0
I_BLV=100.0
Z_BLV=V_BLV/I_BLV
I_o=3.0
a=V_BHV/V_BLV
#Calculations
I_oLV=I_o/100
print(I_oLV,'I_o(LV)pu=')
I_oHV=I_o/(a*10)
print(I_oHV,'I_o(HV)pu=')
Z=complex(8.2,10.2)
ZHV=Z/Z_BHV
print(ZHV,'Z(HV)pu=')
z=Z/a**2
ZLV=z/Z_BLV
print(ZLV,'Z(LV)pu=')
import math
#initialisation of variables
V_2=200
I_2=100
pf=.8
P_o=V_2*I_2*pf #power output
P_i=120.0
P_c=300.0
k=1
#Calculations
P_L=P_i+k**2*P_c #total losses
n=1-(P_L/(P_o+P_L))
print("n percent = %.2f v " %(n*100))
K=math.sqrt(P_i/P_c) #max efficiency
n_max=1-(2*P_i/(P_o*K+2*P_i)) #pf=.8
#Results
print("n_max percent = %.2f v " %(n_max*100))
import math
#initialisation of variables
# Comparing all-day efficiencies for diff given load cycles
r=15.0 # kva rating
n_max=.98
pf=1.0
P_o=20.0
P_i=r*(1-n_max)/2
k=r*pf/P_o
P_c=P_i/(k**2)
def power(P_o,h):
k=P_o/20
P_c=P_i*P_o/r
W_o=P_o*h
W_in=(P_o+P_i+(k**2)*P_c)*h
return W_o,W_in
#(a)full load of 20kva 12hrs/day and no load rest of the day
#Calculations
a=[20,12]
W_oa=[0,0]
W_ina=[0,0]
[W_oa[0],W_ina[0]]=power(a[0],a[1])
aa=[0,12]
[W_oa[1],W_ina[1]]=power(aa[0],aa[1])
print(W_oa,'W_o(kWh) for a')
print(W_ina,'W_in(kWh) for a')
n_ada=sum(W_oa)/sum(W_ina)
print(n_ada*100,'n_allday(a) in %age')
#(b)full load of 20kva 4hrs/day and .4 of full load rest of the day
b=[20,4]
W_ob=[0,0]
W_inb=[0,0]
[W_ob[0],W_inb[0]]=power(b[0],b[1])
bb=[8,20]
[W_ob[1],W_inb[1]]=power(bb[0],bb[1])
print(W_ob,'W_o(kWh) for b')
print(W_inb,'W_in(kWh) for b')
n_adb=sum(W_ob)/sum(W_inb)
#Results
print(n_adb*100,'n_allday(b) in %age')
import math
#initialisation of variables
# To calculate volatage regulation, volatage at load terminals and operating efficiency
S=20*1000
V1=200
V2=2000
I1=S/V1
I2=S/V2
Rh=3
Xh=5.2
pf=0.8
#Calculations
phi=math.degrees(math.acos(pf))
Vha=V2+I2*(Rh*math.cos(math.radians(phi))+Xh*math.sin(math.radians(phi))) #lagging
Vrega=(Vha-V2)*100/V2
print(Vrega,'vol-reg lagging(%)')
Vhb=V2+I2*(Rh*math.cos(math.radians(phi))-Xh*math.sin(math.radians(phi))) #leading
Vregb=(Vhb-V2)*100/V2
print(Vregb,'vol-reg leading(%)')
V11=V2-I2*(Rh*math.cos(math.radians(phi))+Xh*math.sin(math.radians(phi)))
v1=V11/I2
print(v1,'V_L(V)')
ploss=120+10*10*3
pop=v1*I1*math.cos(math.radians(phi))
eff=(1-(ploss/(ploss+pop)))*100.0
#Results
print(eff,'eff(%)')
import math
#initialisation of variables
# To determine voltage regulation and efficiency
r=150*1000.0 #rating in va
v1=2400.0
v2=240.0
a=v2/v1
R_hv=.2+.002/a**2
X_hv=.45+.0045/a**2
I_2fl=r/v2
pf=0.8 #lagging
#Calculations
phi=math.degrees(math.acos(pf))
I_2=I_2fl*a
vd=I_2*(R_hv*math.cos(math.radians(phi))+X_hv*math.sin(math.radians(phi)))
V2=v1
vr=(vd/V2)*100
print(vr,'vol reg(%)')
V1=v1+vd
P_out=r*pf
P_c=(I_2**2)*R_hv #copper loss
P_i=(V1**2)/10000
P_L=P_c+P_i
n=P_out/(P_out+P_L)
print(n*100,'eff(%)')
I_o=[0,0]
I2=[0,0]
I_o[0]=V1/(10*1000)
I_o[1]=-V1/(1.6*1000) #inductive effect
I2[0]=I_2*(math.cos(math.radians(phi)))
I2[1]=I_2*(-math.sin(math.radians(phi)))
I_1=I_o+I2
b=math.sqrt(I_1[0]**2+I_1[1]**2)
print(b,'I_1(A)')
pff=math.cos(math.radians(math.degrees(math.atan(I_1[1]/I_1[0]))))
#Results
print(pff,'pf')
import math
#initialisation of variables
# to calculate voltage ratings,kva ratings and efficieny of autotransformer
AB=200.0
BC=2000.0
V_1=BC
print(V_1,'V_1(V)')
V_2=AB+BC
print(V_2,'V_2(V)')
r=20000 #rating of transformer
I_2=r/AB
I_1=I_2+10
#Calculations
rr=V_2*I_2/1000 #kva rating of autotransformer
print(rr,'kva rating')
ri=V_1*(I_1-I_2)/1000 #kva inductive
rc=rr-ri
print(ri,'kva transferred inductively')
print(rc,'kva transferred conductively')
W_c=120 #core loss
W_cu=300 #cu loss
W_t=W_c+W_cu #total loss
pf=0.8
W=V_2*I_2*pf #full load output
n=1-(W_t/W)
#Results
print(n*100,'eff(%)')
import math
#initialisation of variables
# To determine the rating and full load efficiency of autotransformer
#when used as transformer
v1=240.0
v2=120.0
r=12000.0
I1=r/v1
I2=r/v2
#Calculations
#when connected as autotransformer
V1=240.0
V2=v1+v2
rr=I2*V2
print(rr,'rating of autotransformer(va)')
pf=1
P_o=r*pf #output power
n=.962 #efficiency at upf
P_L=P_o*(1-n)/n
pff=.85 #if pf=.85
Po=rr*pff
nn=1/(1+P_L/Po)
#Results
print(nn*100,'efficiency(%) at .85 pf is')
import math
#initialisation of variables
# To calculate sec. line voltage, line current and output va
print('(a)Y/D conn')
V_LY=6600
V_PY=V_LY/math.sqrt(3)
a=12
V_PD=V_PY/a
V_LD=V_PD
print(V_LD,'sec line voltage(V)')
I_PY=10
I_PD=I_PY*a
I_LD=I_PD*math.sqrt(3)
print(I_LD,'sec. line current(A)')
r=math.sqrt(3)*V_LD*I_LD
print(r,'output rating(va)')
#Calculations
print('(b)D/Y conn')
I_LD=10
I_PD=I_LD/math.sqrt(3)
I_LY=I_PD*a
print(I_LY,'sec. line current(A)')
V_PD=6600
V_PY=V_PD/a
V_LY=V_PY*math.sqrt(3.0)
#Results
print(V_LY,'sec line voltage(V)')
r=math.sqrt(3)*V_LY*I_LY
print(r,'output rating(va)')
import math
#initialisation of variables
# To compute all the currents and voltages in all windings of Y/D transformer
S=complex(500,100) #load is 500MW and 100MVar
s=abs(S)
r=s/3 #MVA rating of each single ph transformer
V1=22 #D side
V2=345 #Y side
a=V2/(math.sqrt(3)*V1) #voltage rating of each single phase
print('Y side')
V_A=(V2/math.sqrt(3))*complex(math.cos(math.radians(0)),math.sin(math.radians(0)))
V_B=(V2/math.sqrt(3))*complex(math.cos(math.radians(-120)),math.sin(math.radians(-120)))
V_C=(V2/math.sqrt(3))*complex(math.cos(math.radians(-240)),math.sin(math.radians(-240)))
#Calculations
V_AB=V_A-V_B
print(V_AB,'V_AB(V)')
V_BC=V_B-V_C
print(V_BC,'V_BC(V)')
V_CA=V_C-V_A
print(V_CA,'V_CA(V)')
IA=S/(3*V_A)
print(IA,'IA(A)')
IB=S/(3*V_B)
print(IB,'IB(A)')
IC=S/(3*V_C)
print(IC,'IC(A)')
print('D side')
V_ab=V_A/a
print(V_ab,'V_ab(V)')
V_bc=V_B/a
print(V_bc,'V_bc(V)')
V_ca=V_C/a
print(V_ca,'V_ca(V)')
I_ab=a*IA
I_bc=a*IB
I_ca=a*IC
Ia=I_ab-I_bc
print(Ia,'Ia(A)')
Ib=I_bc-I_ca
#Results
print(Ib,'Ib(A)')
Ic=I_ca-I_ab
print(Ic,'Ic(A)')
import math
#initialisation of variables
# to find the load voltage when it draws rated current from transformer
# here pu method is used
r=20 #kva rating of three 1-ph transformer
MVA_B=r*3/1000.0
v2=2*math.sqrt(3.0) #in kv voltage base on hv side
v1=.2 #in kv voltage base on lv side
#Calculations
z1=complex(.0004,.0015) #feeder impedence
Z1=z1*MVA_B/v1**2 # lv line(pu)
z2=complex(.13,.95) #load impedence
Z2=z2*MVA_B/v2**2 # hv line(pu)
z_T=complex(.82,1.02)
ZTY=z_T*MVA_B/v2**2 # star side(pu)
Ztot=Z1+Z2+ZTY
V1=1 #sending end voltage [pu]
I1=1 #rated current(pu)
pf=.8
V2=V1-I1*((Ztot.real)*pf+(Ztot.imag)*.6) #load voltage(pu)
V2v=V2*v1
#Results
print(V2v,'load voltage(kv)')
import math
#initialisation of variables
# to calculate fault currentin feeder lines,primary and secondary lines of receiving end transformers
r=60.0 #kva rating of 3-ph common base
s=200.0 #kva rating of 3ph transformer
#sending end
X_Tse=.06*r/s #.06= reactance of transformer based on its own rating
#in 2 kv feeder
V_B=2000.0/math.sqrt(3) #line to neutral
I_B=r*1000.0/(math.sqrt(3)*2000)
Z_B=V_B/I_B
X_feeder=0.7/Z_B #feeder reactance=0.7
#Calculations
#receiving end
X_Tre=0.0051
X_tot=X_Tse+X_feeder+X_Tre
V_se=20/20
I_fc=V_se/X_tot #feeder current
I_f=I_fc*I_B
#Results
print(I_f,'current in 2kv feeder(A)')
I_t1=I_f/math.sqrt(3)
print(I_t1,'current in 2kv winding of transformer(A)')
I_t2=I_t1*10
print(I_t2,'current in 200kv winding of transformer(A)')
I_l=I_t2*math.sqrt(3)
print(I_l,'current at load terminals(A)')
# To calculate voltage and kva rating of 1-ph transformer
V_p=33.0 #primary side voltage(V)
V_s=11.0 #secondary side voltage(V)
#Calculations
V_p1=V_p/math.sqrt(3) #per ph primary side voltage(V)
V_p2=V_s/math.sqrt(3) #per ph secondary side voltage(V)
r=6000.0 #kva rating 3-ph
s=r/3.0 #per phase
#Results
print('Y/Y conn')
print(V_p1,'primary side ph voltage(V)')
print(V_p2,'secondary side ph voltage(V)')
print(s,'kva rating of transformer')
print('Y/D conn')
print(V_p1,'primary side ph voltage(V)')
print(V_s,'secondary side ph voltage(V)')
print(s,'kva rating of transformer')
print('D/Y conn')
print(V_p,'primary side ph voltage(V)')
print(V_p2,'secondary side ph voltage(V)')
print(s,'kva rating of transformer')
print('D/D conn')
print(V_p,'primary side ph voltage(V)')
print(V_s,'secondary side ph voltage(V)')
print(s,'kva rating of transformer')
import math
#initialisation of variables
# to calculate (a)reactance in ohms(b)line voltage,kva rating,series reactance for Y/Y and Y/D conn
Xpu=0.12 # of 1-ph transformer
def Xohm(kv,MVA):
X=(Xpu*kv**2)/MVA
return X
print('(a)')
MVAa=75*10**-3
Vhv=6.6
Vlv=.4
#Calculations
Xhv=Xohm(Vhv,MVAa)
print(Xhv,'X(ohm)of hv side')
Xlv=Xohm(Vlv,MVAa)
print(Xlv,'X(ohm)of lv side')
print('(b)')
print('Y/Y')
MVAb=MVAa*3
Vhv=6.6*math.sqrt(3)
print(Vhv,'V_hv(kV)')
Vlv=.4*math.sqrt(3)
print(Vlv,'V_lv(kV)')
Xhv=Xohm(Vhv,MVAb)
print(Xhv,'X(ohm)of hv side')
Xlv=Xohm(Vlv,MVAb)
print(Xlv,'X(ohm)of lv side')
print('Y/D')
MVAb=MVAa*3
Vhv=6.6*math.sqrt(3)
print(Vhv,'V_hv(kV)')
Vlv=.4
print(Vlv,'V_lv(kV)')
Xhv=Xohm(Vhv,MVAb)
#Results
print(Xhv,'X(ohm)of hv side')
Xlv=Xohm(Vlv,MVAb)
print(Xlv,'X(ohm)of lv side')
import math
#initialisation of variables
#find how 2 transformers connected in parallel share the load
Z1=complex(.012,.06)
Z2=2*complex(.014,.045)
Z=Z1+Z2
r=800 #kva rating
pf=.8
#Calculations
S_L=r*(complex(pf,-1*math.cos(math.radians(math.degrees(math.acos(pf))))))
S_1=S_L*Z2/Z
print(S_1,'load by first transformer(kVA)')
S_2=S_L*Z1/Z
print(S_2,'load by second transformer(kVA)')
S_2rated=300
S_Lmax=S_2rated*abs(Z)/abs(Z1)
print(S_Lmax,'max load by both transformer(kVA)')
r1=600 #kva
V=440
Z1actual=Z1*V/(r1*1000/V)
Z2actual=Z2*V/(r1*1000/V)
Zactual=Z1actual+Z2actual
Z_Lact=V**2/(S_L*1000)
V1=445
I1=(V1*Z2actual-10*Z_Lact)/(Z1actual*Z2actual+Z_Lact*Zactual)
I2=(V1*-1*Z1actual-10*Z_Lact)/(Z1actual*Z2actual+Z_Lact*Zactual)
S1=V*I1/1000
print(S1,'kVA of first transformer')
S2=V*I2/1000.0
#Results
print(S2,'kVA of second transformer')
Pout=abs(S1)*math.cos(math.radians(math.degrees(math.atan((S1.imag)/(S1.real)))))+abs(S2)*math.cos(math.radians(math.degrees(math.atan((S2.imag)/(S2.real)))))
print(Pout,'total output power(kW)')
import math
#initialisation of variables
#find pu value of the equivalent ckt,steady state short ckt current and voltages
r=5.0 #MVA rating
V_Bp=6.35 #for primary
I_Bp=r*1000/V_Bp
V_Bs=1.91 #for secondary
I_Bs=r*1000/V_Bs
#from resp tests
V1=.0787
I1=.5
V2=.1417
I2=.5
V3=.1212
I3=.5
#Calculations
X12=V1/I1
X13=V2/I2
X23=V3/I3
X1=I1*(X12+X13-X23)
X2=I2*(X23+X12-X13)
X3=I3*(X13+X23-X12)
print(X1,'X1(pu)')
print(X2,'X2(pu)')
print(X3,'X3(pu)')
V1=1
I_sc=V1/X13
I_scp=I_sc*I_Bp
print(I_scp,'sc current primary side(A)')
I_sct=I_sc*r*1000.0*1000/(400/math.sqrt(3.0))
#Results
print(I_sct,'sc current tertiary side(A)')
V_A=I_sc*X3
V_Aact=V_A*1.91*math.sqrt(3)
print(V_Aact,'V_A(actual) line to line(kV)')
import math
#initialisation of variables
# to calculate line currents of 3 ph side
N1=6600.0
N2=100.0
a=N1/N2
b=(math.sqrt(3)/2)*a
P=400.0 #kW
pfa=.707
pfb=1
V=100
#Calculations
Ia=P*1000/(V*pfa)
Ib=P*2*1000/(V*pfb)
I_A=Ia/b
print(I_A,'I_A(A)')
I_BC=Ib/a
I_B=I_BC-49.5*complex(pfa,pfa)
#Results
print(abs(I_B),'I_B(A)')
I_C=I_BC+49.5*complex(pfa,-1*pfa)
print(abs(I_C),'I_C(A)')
import math
#initialisation of variables
#to calculate magnitude and phase of secondary current
X1=505.0 #uohm
X2=551.0 #uohm
R1=109.0 #uohm
R2=102.0 #uohm
Xm=256.0 #mohm
I1=250.0 #A
#Calculations
I22=complex(0,Xm*1000)*I1/(complex(R1,X2+Xm*1000))
N1=250.0
N2=5.0
I2=I22*(N2/N1)
print(abs(I2),'current magnitude(A)')
print(math.degrees(math.atan((I2.imag)/(I2.real))),'phase(degree)')
print('now Rb is introduced in series')
Rbb=200 #uohm
Rb=(N2/N1)**2*Rbb
I22=complex(0,Xm*1000)*I1/(complex((R1+Rb),X2+Xm*1000))
I2=I22*(N2/N1)
#Results
print(abs(I2),'current magnitude(A)')
print(math.degrees(math.atan((I2.imag)/(I2.real))),'phase(degree)')
print('no chnage as Rb is negligible')
import math
#initialisation of variables
#to calculate sec voltage magnitude and ph
a=6000.0/100 #turn ratio
R1=780.0
R2=907.0
X1=975.0
X2=1075.0
Xm=443.0*1000
print('sec open')
#Zb=inf
V1=6500.0
#Calculations
V22=complex(0,Xm)*V1/complex(R1,Xm)
V2=V22/a
print(abs(V2),'voltage magnitude(V)')
print(math.degrees(math.atan((V2.imag)/(V2.real))),'phase(deg)')
print('when Zb=Rb')
Rb=1
Rbb=Rb*a**2
Zm=complex(0,Xm/1000)*Rbb/complex(0,Xm/1000)+Rbb
R=complex(R1/1000,X1/1000)+Zm
Vm=Zm*V1/R
V2=Vm/a
print(abs(V2),'voltage magnitude(V)')
print(math.degrees(math.atan((V2.imag)/(V2.real))),'phase(deg)')
print('when Zb=jXb')
Rb=complex(0,1)
Rbb=Rb*a**2
Zm=complex(0,Xm/1000)*Rbb/complex(0,Xm/1000)+Rbb
R=complex(R1/1000,X1/1000)+Zm
Vm=Zm*V1/R
V2=Vm/a
#Results
print(abs(V2),'voltage magnitude(V)')
print(math.degrees(math.atan((V2.imag)/(V2.real))),'phase(deg)')
import math
#initialisation of variables
#to calculate L1 and L2 and coupling cofficient
a=10.0
V_p=200.0
I_p=4.0
Xm=V_p/I_p
f=50
#Calculations
L1=Xm/(2*math.pi*f)
print(L1,'L1(H)')
V_s=1950.0
w_max=V_s/(math.sqrt(2)*math.pi*f)
M=w_max/(math.sqrt(2)*I_p)
v_s=2000
i_s=.41
w_max=math.sqrt(2)*i_s*M
E1=math.sqrt(2)*math.pi*f*w_max
L2=v_s/(math.sqrt(2)*math.pi*f*math.sqrt(2)*i_s)
#Results
print(L2,'L2(H)')
k=M/(math.sqrt(L1)*math.sqrt(L2))
print(k,'coupling coeff')
import math
#initialisation of variables
# to calculate leakage inductance, magnetisisng inductance,mutual inductance and self-inductance
V1=2400.0
V2=240.0
a=V1/V2
R1=.2
X1=.45
Rl=10000.0
R2=2*10**-3
X2=4.5*10**-3
Xm=1600.0
f=50.0
#Calculations
l1=X1/(2*math.pi*f)
print(l1,'leakage inductance ie l1(H)')
l2=X2/(2*math.pi*f)
print(l2,'l2(H)')
Lm1=Xm/(2*math.pi*f)
print(Lm1,'magnetising inductance(H)')
L1=Lm1+l1
print(L1,'self-inductance ie L1(H)')
M=Lm1/a
L2=l2+M/a
print(L2,'L2(H)')
k=M/math.sqrt(L1*L2)
#Results
print(k,'coupling factor')
import math
#initialisation of variables
#to calculate %voltage reg and efficiency
P=500000.0
V1=2200.0
V2=1100.0
V0=110.0
I0=10.0
P0=400.0
#Calculations
Y0=I0/V0
Gi=P0/(V0**2)
Bm=math.sqrt(Y0**2-Gi**2)
Vsc=90
Isc=20.5
Psc=808
Z=Vsc/Isc
R=Psc/Isc**2
X=math.sqrt(Z**2-R**2)
TR=V1/V2
Gi_HV=Gi/TR**2
Bm_HV=Bm/TR**2
R_LV=R/TR**2
X_LV=X/TR**2
I2=P/V2
pf=.8
Th=math.acos(pf)
dV=I2*(R_LV*math.cos(Th)+X_LV*math.sin(Th))
VR=(dV/V2)*100
print(VR,'voltage regulation(%)')
Pi=P0
Pc=Psc
n=P*100/(P+Pi+Pc)
#Results
print(n,'eff(%)')