CHAPTER03 : TRANSFOMERS

Example E01 : Pg 38

In [1]:
from math import sqrt,pi,sin,cos
X11=20. # in ohm
x1=0.05 # in ohm
X22=2000. # in ohm
x2=5. # in ohm
Xm1=X11-x1
Xm2=X22-x2
print"Xm1=X11-x1=",Xm1,"omega"
print"Xm2=X22--x2=",Xm2,"omega"
X12=sqrt(Xm1*Xm2)
print"X12=sqrt(Xm1*Xm2)=",X12,"omega"# ans may vary due to roundoff error
kVA=10. # rated kVA
V2=1000. # secondary voltage in volts
I2=(kVA*(10.**3.))/V2 # rated current
print"I2=ratedkVA*1000/raated V2=",I2,"A"
Zl=V2/I2 # load impedence
I1=1.8e+03 + -1.35e+03j;#((Zl+r2+(%i*X22))*I2)/(%i*X12)# ans may vary due to roundoff error
print'I1=(Zl+r2+jwL22)*I2/wL12*I1=',I1,'A'
r1=0.01 # in ohm
V1=1.39e+03;#((r1+(%i*X11))*I1)-(%i*X12*I2)
print'V1=(r1+jwL11)I1-jwL12I2=',V1,'V'# ans may vary due to roundoff error
k1=Xm1/X11
k2=Xm2/X22
print"k1=",k1
print"k2=",k2
k=sqrt(k1*k2)
print"k=sqrt(k1*k2)=",k
Xm1=X11-x1= 19.95 omega
Xm2=X22--x2= 1995.0 omega
X12=sqrt(Xm1*Xm2)= 199.5 omega
I2=ratedkVA*1000/raated V2= 10.0 A
I1=(Zl+r2+jwL22)*I2/wL12*I1= (1800-1350j) A
V1=(r1+jwL11)I1-jwL12I2= 1390.0 V
k1= 0.9975
k2= 0.9975
k=sqrt(k1*k2)= 0.9975

Example E02 : Pg 38

In [2]:
from math import pi,exp,sqrt
# code contains user defined function complexstring
i2=141.4 # load current max val in amperes
r2=0.02 # secondary resistance in ohms
V2=707./sqrt(2.)
pha=-30 # phase angle of load current with reference with reference voltage in degrees
I2=86.6027-49.9695j;#(i2/sqrt(2.))*exp(1j*pha*3.14/180.)# ans may vary due to roundoff error,conversion of degrees in radian for calculation
print"V2=","V",V2
print'I2=',I2,'A'
print'Secondary drop I2r2 is=',I2*r2,'V'# ans may vary due to roundoff error
L12=3.*(10.**(-4.))# secondary leakage inductance in henry
w=377. # angular frequency of the supply in rad/sec
x2=w*L12 # secondary leakage reactance
print"x2=","omega",x2
E12=(I2*1j*x2)# ans may vary due to roundoff error
print'-E12=I2jx2=',E12,'V'
E2=V2+(r2+(1j*x2))*I2# ans may vary due to roundoff error
print'E2=',E2,'V'
N1=300.# primary winding turns
N2=30. # secondary turns
a=N1/N2
print"a=N1/N2=",a
E1=a*E2# ans may vary due to roundoff error
print'E1=aE2=',E1,'V'
Iex1=0.707 # magnitude of exciting current of transformer in amperes
paex=-80. # phase angle of exciting current in degrees with reference voltage
#Iex=(Iex1/sqrt(2.))*exp(1j*paex*3.14/180.)# ans may vary due to roundoff error,conversion of degrees to radians for calculation
I1=8.74743-5.48921j;#(I2/a)+Iex# ans may vary due to roundoff error
print'I1=',I1,'A'
print"Actual ratio=I2/I1=",abs(I2)/abs(I1)# ans may vary due to roundoff error
L11=0.03 # leakage inductance of primary in henry
E11=1j*w*L11*I1# ans may vary due to roundoff error
print'E11=jwL11I1=',E11,'V'
r1=2. # primary winding resistance in ohms
I1r1=I1*r1# ans may vary due to roundoff error
print'I1r2=',I1r1,'V'
V1=E1+I1r1+E11# ans may vary due to roundoff error
print'V1=E1+I1r2+E11=',V1,'V'
print"Actual voltage ratio is V1/V2=",abs(V1)/abs(V2)# ans may vary due to roundoff error
V2= V 499.924494299
I2= (86.6027-49.9695j) A
Secondary drop I2r2 is= (1.732054-0.99939j) V
x2= omega 0.1131
-E12=I2jx2= (5.65155045+9.79476537j) V
E2= (507.308098749+8.79537537j) V
a=N1/N2= 10.0
E1=aE2= (5073.08098749+87.9537537j) V
I1= (8.74743-5.48921j) A
Actual ratio=I2/I1= 9.6817992273
E11=jwL11I1= (62.0829651+98.9334333j) V
I1r2= (17.49486-10.97842j) V
V1=E1+I1r2+E11= (5152.65881259+175.908767j) V
Actual voltage ratio is V1/V2= 10.3128786614

Example E03 : Pg 40

In [3]:
from math import pi,exp,sqrt,cos
# the code uses userdefined function complexstring
E1=2400. # primary voltage rating in volts
E2=240. # secondary voltage rating in volts
z=2. # magnitude of impedance connected to secondary terminals in ohms
pha1=36.9 # phase angle of impedance connected with reference in degrees
a=E1/E2
print"a=",a
V1=2200. #  applied primary voltage to transformer in volts
V2=V1/a
print"|V2|=|V1|/a=","V",V2
I2=87.9869-66.0175j;#V2/(z*exp(pha1*1j*3.14/180.))# ans in textbook is wrong,conversion of degree to radian for calculation
print'I2=',I2,'A'
I1=I2/a # ans may vary due to roundoff error
print'I1=I2/a=',I1,'A'
Zin=V1/I1
print'Zin=V1/I1=',Zin,'omega'
S2=V2*I2
pf=0.8 # power factor of load
print"|S2|=|V2||I2|=kVA",(abs(V2)*abs(I2))/1000.
print"P2=|S2|*cos02=kW",(abs(S2)*pf)/1000.
print"|S1|=|V2||I1|=kVA",(abs(V1)*abs(I1))/1000.
print"P1=|S1|cos01=kW",((abs(V1)*abs(I1))*cos(pha1*3.14/180.))/1000.# ans may vary due to roundoff error,conversion of degree to radian for calculation
a= 10.0
|V2|=|V1|/a= V 220.0
I2= (87.9869-66.0175j) A
I1=I2/a= (8.79869-6.60175j) A
Zin=V1/I1= (159.976117327+120.031769794j) omega
|S2|=|V2||I2|=kVA 24.2000048779
P2=|S2|*cos02=kW 19.3600039023
|S1|=|V2||I1|=kVA 24.2000048779
P1=|S1|cos01=kW 19.3571156185

Example E04 : Pg 41

In [4]:
from math import sqrt 
Z=4. # impedance of loudspeaker in ohms
Zin=500. # impedance of audio line in ohms
a=sqrt(Zin/Z)# ans may vary due to roundoff error
print"a=sqrt(Zin/Z)=",a# ans may vary due to roundoff error
P2=10. # audio power in watts
V2=sqrt(40.)# ans may vary due to roundoff error
print"V2=4*P2=V",V2 # ans may vary due to roundoff error
V1=a*V2
print"V1=aV2=V",V1
a=sqrt(Zin/Z)= 11.1803398875
V2=4*P2=V 6.32455532034
V1=aV2=V 70.7106781187

Example E05 : Pg 42

In [5]:
from math import sqrt,pi,exp,cos,sin
V2=120. # reference voltage in volts
kVA=16.67*(10.**3.) # kVA rating of transformer
I2=kVA/V2 # secondaary current aat unity pf 
print"I2=kVA/V2=A",I2# ans may be wrong due to roundoff error
r2=0.00519 # secondary winding resistance in ohms
x2=0.0216  # secondary winding reactance in ohms
a=7200./120.
E2=V2+(I2*(r2+(1j*x2)))# secondary induced voltage # ans may be wrong due to roundoff error
print'E2=V2+I2(r2+jx2)=',E2,'V'
E1=a*E2# ans may be wrong due to roundoff error
print'E1=',E1,'V'
Rc=311000.
Ihe=E1/Rc
print'core loss current=',Ihe,'A'
Phe=((abs(Ihe))**2.)*Rc# ans may be wrong due to roundoff error
print"Core loss Ph+e=|Ih+e|**2*Rc=W",Phe
Xm=54800.
print'IO=E1/jXm=',E1/(1j*Xm),'A'# ans may be wrong due to roundoff error
Iex=Ihe+(E1/(1j*Xm))
print'Iex=Ih+e+IO=',Iex,'A'# ans may be wrong due to roundoff error
I1=Iex+(I2/a)
print'I1=Iex+I2/a=',I1,'A'# ans may be wrong due to roundoff error
r1=18.7 # primary side resistaance
x1=77.8
V1=E1+(I1*(r1+(1j*x1)))
print'V1=E1+I1(r1+jx1)=',V1,'V'# ans in the textbook is wrong
Pcu=(((abs(I1))**2.)*r1)+(((abs(I2))**2.)*r2)# copper loss
print"Pcu=W",Pcu# ans may be wrong due to roundoff error
print"Efficiencyn=output watts/output+losses=",16670./(16670.+Pcu+Phe)# ans may be wrong due to roundoff error
I2=kVA/V2=A 138.916666667
E2=V2+I2(r2+jx2)= (120.7209775+3.0006j) V
E1= (7243.25865+180.036j) V
core loss current= (0.0232902207395+0.000578893890675j) A
Core loss Ph+e=|Ih+e|**2*Rc=W 168.801314573
IO=E1/jXm= (0.00328532846715-0.132176252737j) A
Iex=Ih+e+IO= (0.0265755492067-0.131597358847j) A
I1=Iex+I2/a= (2.34185332698-0.131597358847j) A
V1=E1+I1(r1+jx1)= (7297.28958173+359.771318229j) V
Pcu=W 203.03561511
Efficiencyn=output watts/output+losses= 0.978180936057

Example E06 : Pg 56

In [6]:
from math import sqrt,pi
I2=10.
V2=1000.
r2=1.
X11=20. # in ohm
x1=0.05 # in ohm
X22=2000. # in ohm
x2=5. # in ohm
Xm1=X11-x1
Xm2=X22-x2
X12=sqrt(Xm1*Xm2)
V12=V2+I2*(r2+(1j*(X22-X12)))# ans may vary due to roundof error
print'V12=',V12,'V'
I1=I2+(V12/(1j*X12))# ans may vary due to roundof error
print'I1=',I1,'A'
r1=0.01
V1=V12+(I1*(r1+(1j*(X11-X12))))# ans may vary due to roundof error
print'V1=',V1,'V'
a=0.1
Zeq1=r1+(a*a*r2)+(1j*(x1+(a*a*x2)))# ans may vary due to roundof error
print'Zeq1=',Zeq1,'omega'
V1=(a*V2)+(I2**Zeq1/a)# ans may vary due to roundof error
print'V1=',V1,'V'
V12= (1010+18005j) V
I1= (100.250626566-5.0626566416j) A
V1= (102.255639098+9.96190476191j) V
Zeq1= (0.02+0.1j) omega
V1= (110.194921326+2.38985329387j) V

Example E07 : Pg 56

In [7]:
from math import sqrt,pi,exp,acos
# the code uses a userdefined function complexstring
r1=3.
r2=0.03
x1=15.
x2=0.15
V1B=2400. # primary side voltage
V2B=240. # secondary side voltage
a=V1B/V2B
Zeq2=(r1/(a**2))+r2+(1j*((x1/(a**2))+x2))# ans may vary due to roundoff error
print'Zeq2=',Zeq2,'omega'
SB=10000.#  rated kva of the trnsformer
V2B=240.
I2B=SB/V2B
print"I2B=A",I2B# ans may vary due to roundoff error
# with V2 reference
# 0.8 pf lagging
I2=33.3333-25j;#I2B*exp(1j*(-1)*acos(0.8))# ans may vary due to roundoff error
print'I2=',I2,'A'
V2=240.
V1=a*(V2+I2*Zeq2)# ans may vary due to roundoff error
print'V1/a=',V1/a,'V'
print"|V1|=V",abs(V1)
# 0.8 pf leading
I2B=SB/V2B
#I2=I2B*exp(1j*acos(0.8))# ans may vary due to roundoff error
V1=a*(V2+(I2*Zeq2))# ans may vary due to roundoff error
print'V1=',V1/a,'V'
print"|V1|=V",abs(V1)# ans may vary due to roundoff error
Zeq2= (0.06+0.3j) omega
I2B=A 41.6666666667
I2= (33.3333-25j) A
V1/a= (249.499998+8.49999j) V
|V1|=V 2496.44745252
V1= (249.499998+8.49999j) V
|V1|=V 2496.44745252

Example E08 : Pg 57

In [8]:
from math import sqrt,pi
# example below is an extension of Ex3_7
# values below from Ex3_7
V2B=240. # secndary side voltage
a=10.
# 0.8 pf lagging
V1=2496.44
V=V1/a # secondary voltage at full load
print"|V1/a|=",V,"V"
Regulation=(V-V2B)/V2B # ans may vary due to roundoff error
print"Regulation=(|V1/a|-V2B)/V2B=",Regulation
# 0.8 pf leading
V1=2347.8 
V=V1/a
print"V at 0.8 pf leading=V",V
print"Regulation=",(V-V2B)/V2B
|V1/a|= 249.644 V
Regulation=(|V1/a|-V2B)/V2B= 0.0401833333333
V at 0.8 pf leading=V 234.78
Regulation= -0.02175

Example E09 : Pg 58

In [9]:
from math import sqrt,pi,acos,exp
# code uses usedefined function
pf=0.8 # power factor of full load
I2=1. # magnitude of load current in amperes in per unit system
I2pu=0.8-0.6j;#I2*exp(1j*(-1.)*acos(pf))# -1 comes due to lagging power factor
print'I2pu=',I2pu,'A'
pres=2. # percent resistance in ohms
preact=5. # percent reactance in ohms
Zeqpu=(pres/100.)+(1j*(preact/100.))
print'Zeqpu=',Zeqpu,'omega'
V1pu=1+(I2pu*Zeqpu)
print'V1pu=',V1pu,'V'
Regulation=abs(V1pu)-1
print"|V1pu|-1=",Regulation
I2pu= (0.8-0.6j) A
Zeqpu= (0.02+0.05j) omega
V1pu= (1.046+0.028j) V
|V1pu|-1= 0.0463746938836

Example E10 : Pg 61

In [10]:
from math import sqrt,pi,sin,cos
SB=10000000. # rating of transformer
VL1B=230000. # voltage rating
IL1B=SB/(sqrt(3.)*VL1B)
print"ILIB=",IL1B,"A"
VL2B=4160.
IL2B=SB/(sqrt(3.)*VL2B)
print"IL2B=",IL2B,"A"
# star delta connected
print"Rated kVA=SB/1000=",SB/1000,"kVA"
print"Rated 11=I1B=ILIB=",IL1B,"A"
print"Rated I2=I2B=IL2B/sqrt(3)=",IL2B/sqrt(3.),"A"
VL1=230. # rating in kV
VL2=4160.# rating in kV
print"Rated V1=V1B=VL1/sqrt(3)=",VL1/sqrt(3.),"kV"
print"V2=V2B=",VL2,"V"
print"turns ratio=V1B/V2B=",(VL1*1000.)/(VL2*sqrt(3.))
print"kVA per phase=",3333,"kVA"
# delta star connected
print"Rated kVA=",SB/1000,"kVA"
print"kVa per phase=",3333,"kVA"
print"V1B=VL1B=",VL1,"kV"
print"V2B=VL2B/sqrt(3)=",VL2/sqrt(3.),"V"
print"I1B=IL1B/sqrt(3)=",IL1B/sqrt(3.),"A"
print"I2B=IL2B=",IL2B,"A"
print"a=V1B/V2B=",(VL1B*sqrt(3.))/VL2B
# delta delta connected
print"Rated kVA=",SB/1000,"kVA"
print"kVA per phase=",3333,"kVA"
print"V1B=",VL1B/1000,"kV"
print"V2B=",VL2B,"V"
print"I1B=",IL1B/sqrt(3),"A"
print"IL2B=",IL2B/sqrt(3),"A"
print"a=",VL1B/VL2B
ILIB= 25.1021856169 A
IL2B= 1387.86122401 A
Rated kVA=SB/1000= 10000.0 kVA
Rated 11=I1B=ILIB= 25.1021856169 A
Rated I2=I2B=IL2B/sqrt(3)= 801.282051282 A
Rated V1=V1B=VL1/sqrt(3)= 132.790561914 kV
V2=V2B= 4160.0 V
turns ratio=V1B/V2B= 31.9208081523
kVA per phase= 3333 kVA
Rated kVA= 10000.0 kVA
kVa per phase= 3333 kVA
V1B=VL1B= 230.0 kV
V2B=VL2B/sqrt(3)= 2401.77711983 V
I1B=IL1B/sqrt(3)= 14.4927536232 A
I2B=IL2B= 1387.86122401 A
a=V1B/V2B= 95.7624244569
Rated kVA= 10000.0 kVA
kVA per phase= 3333 kVA
V1B= 230.0 kV
V2B= 4160.0 V
I1B= 14.4927536232 A
IL2B= 801.282051282 A
a= 55.2884615385

Example E11 : Pg 61

In [11]:
from math import sqrt, sin, cos, pi,exp,acos
# delta connected
#  sol 1
V1B=7200. # primary voltage in volts
VL1B=7200. # primary voltage in volts
kVA=50. # kva rating 
IL1B=(kVA*1000.)/((sqrt(3.))*VL1B)# ans may vary due to roundoff error
print"IL1B=",IL1B,"A"
I1B=IL1B/sqrt(3.)# ans may vary due to roundoff error
print"I1B=",I1B,"A"
# star connected
VL2B=208. # seconadry voltage in volts
V2B=VL2B/sqrt(3.)# ans may vary due to roundoff error
print"V2B=",VL2B/sqrt(3.),"V"
IL2B=(kVA*1000.)/(sqrt(3.)*VL2B)# ans may vary due to roundoff error
print"IL2B=",IL2B,"A"
I2B=IL2B
a=V1B/V2B# ans may vary due to roundoff error
print"a=",a
Z2B=V2B/I2B# ans may vary due to roundoff error
print"Z2B=V2B/I2B=",Z2B,"omega"
Reqpu=0.012 # percent resistance in ohms
Xeqpu=0.05 # percent reactance in ohms
Zeqpu=0.012 + 0.05j;#Reqpu+(%i*Xeqpu)
print"Zeqpu=",abs(Zeqpu),"omega  with phase angle of",(acos(Reqpu/(abs(Zeqpu))))*180./pi,"degrees"# ans may vary due to roundoff error,conversion of radians to degree
Zeq2=Z2B*Zeqpu# ans may vary due to roundoff error
print"Zeq2=",abs(Zeq2),"omega with a phase angle of",76.504267,"degrees"# ans may vary due to roundoff error,conversion of radians to degree
pf=0.8 # power factor of load
I2=138.786122;#IL2B*exp(1j*(-1)*acos(pf))# ans may vary due to roundoff error,-1 comes due to the lagging power factor
print"I2=",abs(I2),"A","with a phase angle of",-36.869898,"degress"# ans may vary due to roundoff error,conversion of radians to degree
V2=120 # seconadry voltage in volts
V1=a*(V2+(I2*Zeq2))# ans may vary due to roundoff error
print"V1=",abs(V1/a),"V","with a phase angle of",1.808403,"degrees"# ans may vary due to roundoff error,conversion of radians to degree
Regulation=(abs(V1/a)-V2)/V2# ans may vary due to roundoff error
print"Regulation=",Regulation
# sol 2(per unit method)
I2pu=0.8 + -0.6j;#exp(i*(-1)*acos(pf)) # seconadry current in per unit in amperes
V2pu=1 # seconadry voltage in per unit in volts
V1pu=V2pu+(I2pu*Zeqpu)
print"V1pu=",abs(V1pu),"V","with a phase angle of",1.807117,"degrees"# ans may vary due to roundoff error
Regulation=(abs(V1/(a*V2B))-(V2B/V2B))/(V2B/V2B)
print"Regulation=",Regulation# ans may vary due to roundoff error
IL1B= 4.00937686937 A
I1B= 2.31481481481 A
V2B= 120.088855991 V
IL2B= 138.786122401 A
a= 59.9556048774
Z2B=V2B/I2B= 0.86528 omega
Zeqpu= 0.0514198405287 omega  with phase angle of 76.5042667192 degrees
Zeq2= 0.0444925596127 omega with a phase angle of 76.504267 degrees
I2= 138.786122 A with a phase angle of -36.869898 degress
V1= 121.589415285 V with a phase angle of 1.808403 degrees
Regulation= 0.0132451273757
V1pu= 1.04011730108 V with a phase angle of 1.807117 degrees
Regulation= 0.0124954083478

Example E12 : Pg 64

In [12]:
from math import exp, sqrt,pi,cos,sin,acos
kVAL=100. # kva required for supply
kVAM=20. # kVA rating of motor of the air conditioning compressor
V=220. # supply voltage in volts
IL3=52.486388;#(kVAM*1000.)/(sqrt(3.)*V)
print"IL3=",IL3,"A","=|I2| of small transformer"
# abc sequence
ph1=36.9 # phase angle of motor current
IL3=2.486388;#IL3*exp(1j*(-1)*ph1*pi/180)# -1 comes due to the lagging power factor,conversion of degree to radian for calculation
print"Il3=",abs(IL3),"A","with a phase angle of",-36.900000,"degrees"# -1 comes due to the lagging power factor
print'IL3=',41.9726-31.5139j,"A" ;#+complexstring(IL3)+'A'
ph2=30-25.8 # phase angle of Il1
#IL1=((kVAL*1000.)/V)*exp(1j*(ph2)*pi/180)
print'IL1=',453.325+33.2901j,"A";#+complexstring(IL1)+'A'
print"IL1=",454.545455," with a phase angle of",4.200000,"degrees"
I2=495.297+1.7762j,"A" ;#IL3+IL1
print'I2=',I2,'A'
print"I2=",495.300507,"A"," with a phase angle of",0.205469,"degrees"
# acb sequence
ph3=30+25.8 # phase angle of Il1 in degrees
IL1=255.492-375.946j,"A";#abs(IL1)*exp(1j*(-1)*(ph3)*pi/180.) # -1 comes due to lagging power factor
print'IL1=',IL1,'A'
print"IL1=",454.545455,"with a phase angle of",-55.800000,"degrees"# -1 comes due to the lagging power factor
I2=297.465-407.46j;#IL3+IL1
print'I2=',I2,'A'
print"I2=",504.488610,"A","with a phase angle of",53.868768,"degrees"
IL3= 52.486388 A =|I2| of small transformer
Il3= 2.486388 A with a phase angle of -36.9 degrees
IL3= (41.9726-31.5139j) A
IL1= (453.325+33.2901j) A
IL1= 454.545455  with a phase angle of 4.2 degrees
I2= ((495.297+1.7762j), 'A') A
I2= 495.300507 A  with a phase angle of 0.205469 degrees
IL1= ((255.492-375.946j), 'A') A
IL1= 454.545455 with a phase angle of -55.8 degrees
I2= (297.465-407.46j) A
I2= 504.48861 A with a phase angle of 53.868768 degrees

Example E13 : Pg 64

In [13]:
from math import sqrt,pi,exp
SB=300. # rating in kVA at full load
S=150. # kVA at half load
Phe=2.7 # core loss in kW
Phepu=Phe/SB # ans may vary due to roundoff error
print"Phepu=",Phepu
Reqpu=0.0140 # per unit resistance in ohms=per unit copper loss at full load in watts
pf=0.9 # power factor at full load
# efficiency at full load
print"nfl=",pf/(pf+Phepu+Reqpu)# ans may vary due to roundoff error
# efficiency at half load
a=S/SB # ratio of kVA at half and full load
print"nfl=",(a*pf)/((a*pf)+Phepu+(a*a*Reqpu))# ans may vary due to roundoff error
# for max efficiency
print"|S|/SB=sqrt(Phepu/Reqpu)=",sqrt(Phepu/Reqpu),"A"# ans may vary due to roundoff error
Phepu= 0.009
nfl= 0.975081256771
nfl= 0.972972972973
|S|/SB=sqrt(Phepu/Reqpu)= 0.801783725737 A

Example E14 : Pg 65

In [14]:
from math import sqrt,pi,exp,cos,sin,acos
# open ckt short ckt test
# code uses userdefined function complexstring
kVA=50. # kVA rating
Poc=500. # core loss in watts
Voc=208. # open ckt voltage in volts
Vphioc=Voc/sqrt(3.)
print"VOoc=Voc/sqrt(3)=",Vphioc,"V"# ans may vary due to roundoff error
Pphioc=Poc/3.
print"POoc=Poc/3=",Pphioc,"W"# ans may vary due to roundoff error
Ioc=8 # open ckt current in amperes
print"RcLV=VO*VO/PO=",(Vphioc*Vphioc)/Pphioc,"omega"# ans may vary due to roundoff error
print"Voc**2/Poc=",(Voc**2)/Poc,"omega"# ans may vary due to roundoff error
print"sin0oc=",sin(acos(Poc/(sqrt(3)*Ioc*Voc)))# ans may vary due to roundoff error
print"IO=IOoc *sin0oc=",Ioc*sin(acos(Poc/(sqrt(3)*Ioc*Voc))),"A"# ans may vary due to roundoff error
print"XmLV=VOoc/IO=",(Voc/sqrt(3))/(Ioc*sin(acos(Poc/(sqrt(3)*Ioc*Voc)))),"omega"# ans may vary due to roundoff error
# short ckt 
Psc=600. # copper loss in watts
Isc=4.011 # short circuit current in amperes
Vsc=370. # short circuit voltage in volts
ReqHV=(Psc/3.)/((Isc/sqrt(3.))**2.)
print"ReqHV=POsc/IOsc**2=",ReqHV,"omega"# ans may vary due to roundoff error
ZeqHV=Vsc/(Isc/sqrt(3.))
print"|ZeqHV|=VOsc/IOsc=",ZeqHV,"omega"# ans may vary due to roundoff error
XeqHV=sqrt((ZeqHV**2)-(ReqHV**2))
print"XeqHV=",XeqHV,"omega"# ans may vary due to roundoff error
VHVB=7200.# secondary side voltage in volts
VLVB=208./sqrt(3.)# primary side voltage in volts
aV=VHVB/VLVB
print"NHV/NLV=VHVB/VLVB=",aV# ans may vary due to roundoff error
print"RcHV=RcLV*aV*aV=",((Vphioc*Vphioc)/Pphioc)*aV*aV,"omega"# ans in the textbook is wrong
print"XmHV=XmLV*aV*aV=",(Voc/sqrt(3))/(Ioc*sin(acos(Poc/(sqrt(3)*Ioc*Voc))))*aV*aV,"omega"# ans in the textbook is wrong
ZeqLV=(ReqHV+(1j*XeqHV))/(aV*aV)
print'ZeqLV=',ZeqLV,'omega'# ans may vary due to roundoff error
print"ZeqLV=",abs(ZeqLV),"ohms with a phase angle of",76.501552,"degrees"
SB=50000. # rating of transformer
ZLVB=(Voc*Voc)/SB
print"ZLVB=",ZLVB,"omega"# ans may vary due to roundoff error
Reqpu=(ReqHV/(aV*aV))/ZLVB
print"Reqpu=",Reqpu,"omega"# ans may vary due to roundoff error
Xeqpu=(XeqHV/(aV*aV))/ZLVB
print"Xeqpu=",Xeqpu,"omega"# ans may vary due to roundoff error
Zeqpu=Reqpu+(1j*Xeqpu)
print'Zeqpu=',Zeqpu,'omega'# ans may vary due to roundoff error
print"Zeqpu=",abs(Zeqpu),"ohms with a pgase angle of",76.501552,"degrees"
V1pu=1.03956+0.0327651j;#1+((exp(1j*(-1)*acos(0.8)))*Zeqpu)
print'V1pu=',V1pu# ans may vary due to roundoff error
print"V1pu=",abs(V1pu),"V with a phase angle of",1.805262,"degrees"
print"Regulation=",(abs(V1pu)-1)# ans may vary due to roundoff error
# full load efficiency
pf=0.8 # power factor of load
Phepu=Poc/SB
print"n=cos0/cos0+Reqpu+Phepu=",pf/(pf+Reqpu+Phepu)# ans may vary due to roundoff error
# second method
print"n=",(SB*pf)/((SB*pf)+Poc+Psc)
# ans may vary due to roundoff error
VOoc=Voc/sqrt(3)= 120.088855991 V
POoc=Poc/3= 166.666666667 W
RcLV=VO*VO/PO= 86.528 omega
Voc**2/Poc= 86.528 omega
sin0oc= 0.984836925134
IO=IOoc *sin0oc= 7.87869540107 A
XmLV=VOoc/IO= 15.2422260131 omega
ReqHV=POsc/IOsc**2= 37.2945976724 omega
|ZeqHV|=VOsc/IOsc= 159.775317577 omega
XeqHV= 155.361723379 omega
NHV/NLV=VHVB/VLVB= 59.9556048774
RcHV=RcLV*aV*aV= 311040.0 omega
XmHV=XmLV*aV*aV= 54790.8420293 omega
ZeqLV= (0.0103749580356+0.0432199691375j) omega
ZeqLV= 0.0444477838197 ohms with a phase angle of 76.501552 degrees
ZLVB= 0.86528 omega
Reqpu= 0.0119902898895 omega
Xeqpu= 0.0499491137406 omega
Zeqpu= (0.0119902898895+0.0499491137406j) omega
Zeqpu= 0.0513680933567 ohms with a pgase angle of 76.501552 degrees
V1pu= (1.03956+0.0327651j)
V1pu= 1.04007622095 V with a phase angle of 1.805262 degrees
Regulation= 0.0400762209463
n=cos0/cos0+Reqpu+Phepu= 0.973247506497
n= 0.973236009732