import math
from math import pi,sqrt
#Given
IMp=500.0 #induction motor load in kVA
Pf=0.8
Pf1=0.6
SMp=300.0 #synchronous motor load in kVA
Pfs=1.0
P1=400.0
P2=4.0
#calculations
Power=IMp*Pf #induction motor power
RecPower=IMp*Pf1 #induction reactance power
SyPower=SMp*Pfs #synchronous motor power
TotalPower=Power+SyPower
ComplesPower=sqrt(TotalPower**2+RecPower**2) #complex power
PowerFactor=(TotalPower/ComplesPower)
Power1=sqrt(Power**2-RecPower**2)
KVAR=RecPower-Power1
NewKVA=sqrt(TotalPower**2+KVAR)
PowerFactor1=(TotalPower/NewKVA)
Ism=P1/(sqrt(3)*P2)
PowerfactorSYS=SyPower/P1
PowerFactor=round(PowerFactor,2)
PowerfactorSYS=round(PowerfactorSYS,3)
Ism=round(Ism,2)
print 'overall power factor=',PowerFactor,'lagging'
print 'synchronous motor current=',Ism,'A'
print 'synchronous motor power factor=',PowerfactorSYS,'lead'
import math
from math import pi,sqrt
#Given
V=14000.0 #supply voltage
Phase=3.0 #phase
Ra=0.07 #armature resistance(ohm/phase)
V1=10.0
Is=490.0 #short-circuit current(A)
Pf=0.8 #power factor
If=200.0
Vl=18000.0
Vb=V/sqrt(Phase) #Base-voltage
Ib=(V1*10**6)/(sqrt(Phase)*V) #Base-current
Zb=Vb/Ib #Base-impedance
Zsun=(Vl/sqrt(3))/Is #synchronous unsaturated impedance
Xsun=sqrt(Zsun**2-Ra**2) #synchronous unsaturated reactance in ohms
Xsun=Xsun/Zb #synchronous unsaturated reactance in pu
Zssa=(V/sqrt(3))/Is #saturated impedance
Xssa=Zssa/Zb #saturated reactance
a=math.cos(0.8)
Deg=a*180/pi
Zs=Zssa/Ra
Zs=math.atan(Zs)
Angle=Zs*180/pi
(a,b)=(1,0)
X1=complex(a,b)
(c,d)=(1,-36.9)
X2=complex(c,d)
(e,f)=(0.85,89.8)
X3=complex(e,f)
X=X1+(X2*X3)
(I,Angle)=(1.66769301731,22.5670091)
Ef=I*V
Zsun=round(Zsun,3)
Xsun=round(Xsun,3)
Zssa=round(Zssa,3)
Xssa=round(Xssa,3)
If=round(I*If,3)
print 'synchronous unsaturated impedance=',Zsun,'ohms'
print 'synchronous unsaturated reactance=',Xsun,'pu'
print 'synchronous saturated impedance=',Zssa,'ohms'
print 'synchronous saturated reactance=',Xssa,'pu'
print 'field-current from modified airgap line=',If,'A'
import math
from math import pi,sqrt
#Given
V=208.0
Poles=4.0
F=60.0 #frequency
Phase=3.0 #phase
Vol=5000.0
Xs=8.0
Vt=V/sqrt(Phase)
Ia=Vol/(sqrt(Phase)*V) #stator-current at rated kVA
(x1,y1)=(Vt,0)
(x2,y2)=(Ia,-36.9)
(x3,y3)=(8,90)
X1=complex(x1,0)
X2=complex(x2,y2)
X3=complex(x3,y3)
X=X1+(X2*X3)
(Ef,Angle)=(206.69925012,25.4120998)
Newvol=1.2*Ef
(x1,y1)=(231.5,88.87)
(x2,y2)=(Vt,0)
(x3,y3)=(0,Xs)
X1=complex(x1,y1)
X1=complex(x2,y2)
X1=complex(x3,y3)
X=(X1-X2)/X3
(Ia,Angle1)=(17.8,-51.4)
Pf=math.cos(pi*51.5/180)
a=math.sin(pi*51.5/180)
ReactiveKva=(Phase*Vt*Ia*a*(10**-3))
Pmax=(Phase*Ef*Vt)/Xs
(x1,y1)=(0,206.9)
(x2,y2)=(120,0)
(x3,y3)=(0,8)
X1=complex(x1,y1)
X2=complex(x2,y2)
X3=complex(x3,y3)
X=(X1-X2)/X3
(Ia,Angle2)=(29.8,30.17)
math.tan=Vt/Ef
Ang=math.tan*180/pi
Pf=math.cos(pi*Ang/180)
Pf=round(Pf,2)
Ef=round(Ef,2)
Angle=round(Angle,2)
R=round(ReactiveKva,2)
print 'Excitation voltage=',Ef,'V/phase'
print 'Power angle=',Angle,'degrees'
print 'Reactive kVA=',R
print 'Power factor at max.power transfer condition=',Pf,'lead'
import math
from math import pi,sqrt
#Given
V=208.0 #voltage
F=60.0 #frequency in Hz
Phase=3.0 #Phase
Power=3000.0 #power
Xs=8.0
Vt=V/sqrt(Phase)
Ia=Power/(Phase*Vt)
(x1,y1)=(120,0)
(x2,y2)=(8.33,0)
(x3,y3)=(-2.39,-7.63)
X=X1-(X2*X3)
(Ef,Angle)=(137.2,-1.54)
Pmax=(Phase*Ef*Vt)/Xs
Ws=(1800/F)*2*pi
Tmax=Pmax/Ws
Tmax=round(Tmax,1)
print 'Excitation voltage=',Ef,'V/phase'
print 'Maximum torque=',Tmax,'N-m'
import math
from math import pi,sqrt
#Given
V=460.0 #supply voltage
Phase=3.0 #phase
N=1200.0 #rpm
Hp=125
Ra=0.078 #resistance of the circuit
Xal=0.15
Xar=1.85
Nre=28.2
Ia=sqrt(Phase)*V
Ia=121.4
Vt=V/sqrt(Phase)
Ea=Vt-(Ia*Ra)
Xs=Xal+Xar
(x1,y1)=(Ea,0)
(x2,y2)=(-0.599,-1.9) #(Xs,90) in rectangular co-ordinate form
X1=complex(x1,y1)
X2=complex(x2,y2)
Im=X1/X2
(Im,Angle1)=(134.74,-90.0)
(x1,y1)=(Im,Angle1)
X1=complex(x1,y1)
X2=complex(x2,y2)
X=X1-X2
a=181.4
n=sqrt(2)/Phase*Nre
If=(a/n)*(Xs/Xar)
If=round(If,3)
print 'Field current=',If,'A'
import math
from math import pi,sqrt
#Given
Vt=1.0
Ia=1.0
Xd=0.8
Xq=0.4 #Synchronous machine reactance
Loss=0.15 #rotational losses
Angle=36.9
a=math.cos(pi*Angle/180)
b=math.sin(pi*Angle/180)
TanDeg=(Vt*Xq*a)/(Vt+(Ia*Xq*b))
z=math.atan(TanDeg)
Deg=(z*pi/180)
Deg=(z*180/pi)
Angl=Angle-Deg
Id=Ia*math.sin(pi*Angl/180)
Iq=Ia*math.cos(pi*Angl/180)
Ef=(Vt*math.cos(pi*Deg/180))-(Id*Xq)
Pf=((Vt*Ef)/Xd)*math.sin(pi*Deg/180) #power due to field excitation
Pr=(Vt**2*(Xd-Xq)/(2*Xd*Xq))*math.sin(pi*45.6/180) #power due to saliency of the machine
Pout=Vt*Ia*a #output power
Prmax=(Vt**2*(Xd-Xq))/(2*Xd*Xq) #maximum power due to saliency of the machine
v=math.asin(Loss/Prmax)/2
Deg1=(v*180/pi)
Id=Vt*math.cos(pi*Deg1/180)/Xd
Iq=Vt*math.sin(pi*Deg1/180)/Xq
Ia=(Id**2+Iq**2)**(1/2)
Ang=math.atan(Id/Iq)
Ang=(Ang*180/pi)
Phi=Ang+Deg1
Pf=math.cos(pi*Phi/180) #power factor
Pf=round(Pf,3)
print 'Power factor=',Pf,'lagging'