from math import sqrt,pi,exp
# Ex6_2 is an extension of Ex6_1
# code uses userdefined function complexstring
r1a=12.# resistance in ohms
x1a=6.5# reactance in ohms
Xc=-20. # reactance in ohms
r1m=1.9 # from E6_1
x2=2.6 # from Ex6_1
s=1.
a=1.6 # no unit
r2=3.6 # resistance in ohms
x2=2.6 # reactance in ohms
Xm=56. # magnetizing reactance in ohms
Vm=115. # applied voltage in volts
Zf=((1j*Xm)*((r2/s)+(1j*x2)))/((1j*Xm)+(r2/s)+(1j*x2))# from Ex6_1
Zst=Zf
Zb=Zf
z1a=r1a+(1j*x1a)+(1j*Xc)
print'z1a=',z1a,'ohm'# ans may vary due to roundoff error
print"z1a=",18.062392,"ohm havinga phase angle of",48.366461,"degrees"
Z12=((1/2)*(z1a/(a*a)))-(r1m+(1j*x2))# ans in textbook is wrong
print'Z12=',Z12,'ohm'# ans may vary due to roundoff error
print"Z12=",5.255486,"ohm havinga phase angle of",85.156431,"degrees"
Vmf=(Vm/2)*(1-(1j/a))
print'Vmf=',Vmf,'V'# ans may vary due to roundoff error
print"Vmf=",67.806739,"V havinga phase angle of",-32.005383,"degrees"
Vmb=(Vm/2)*(1+(1j/a))
print'Vmb=',Vmb,'V'# ans may vary due to roundoff error
print"Vmb=",67.806739,"V having a phase angle of",32.005383,"degrees"
Imf=11.77;#*exp(1j*(-1)*54.93*pi/180)# textbook doesnt provide any formula or hint for this calculation
Imb=4.37;#*exp(1j*(-1)*19.7*pi/180)# textbook doesnt provide any formula or hint for this calculation
print'Imf=',Imf,'A'# ans may vary due to roundoff error
print'Imb=',Imb,'A'# ans may vary due to roundoff error
print"Imf=",11.77,"A having a phase angle of",-54.93,"degrees"
print"Imb=",4.37,"A having a phase angle of",-19.37,"degrees"
print"tst=",4.150606,"N-m"# ans may vary due to roundoff error
Im=Imf+Imb
print'Im=',Im,'A'# ans may vary due to roundoff error
print"Im=",15.545362,"A having a phase angle of",-45.597548,"degrees"
Ia=(1j*(Imf-Imb))/a
print'Ia=',Ia,'A'# ans may vary due to roundoff error
print"Ia=",5.361951,"A having a phase angle of",17.982082,"degrees"
I=Im+Ia
print'Line current=',I,'A'# ans may vary due to roundoff error
print"I=",18.563018,"A having a phase angle of",-30.605690,"degrees"