import math
#variable declaration
p=75#kW
f=50#Hz
v=440#V
pf=0.8
loss=0.95
xs=2.5#ohm
#calculations
ns=120*f/4
pm=p*1000/loss
ia=pm/(math.sqrt(3)*v*pf)
vol_phase=v/math.sqrt(3)
#calculations
print "mechanical power=",pm,"W"
print "armature current=",ia,"A"
import cmath
#variable declaration
p=20
vl=693#V
r=10#ohm
lag=0.5#degrees
#calculations
#lag=0.5
alpha=p*lag/2
eb=vp=vl/math.sqrt(3)
er=complex(vp-eb*math.cos(math.radians(alpha)),eb*math.sin(math.radians(alpha)))
zs=complex(0,10)
ia=er/zs
power_input=3*vp*abs(ia)*math.cos(math.radians(cmath.phase(ia)))
print "displacement:0.5%"
print "alpha=",alpha,"degrees"
print "armature emf/phase=",eb,"V"
print "armature current/phase=",ia,"A"
print "power drawn=",power_input,"W"
print ""
#lag=5
lag=5
alpha=p*lag/2
eb=vp=vl/math.sqrt(3)
er=complex(vp-eb*math.cos(math.radians(alpha)),eb*math.sin(math.radians(alpha)))
zs=complex(0,10)
ia=er/zs
power_input=3*vp*abs(ia)*math.cos(math.radians(cmath.phase(ia)))
print "displacement:5%"
print "alpha=",alpha,"degrees"
print "armature emf/phase=",eb,"V"
print "armature current/phase=",ia,"A"
print "power drawn=",power_input,"W"
import math
#variable declaration
v=400.0#V/ph
i=32.0#A/ph
xs=10.0#ohm
#calculations
e=math.sqrt(v**2+(i*xs)**2)
delta=math.atan((i*xs)/v)
power=3*v*i
power_other=3*(v*e/10)*math.sin(delta)*0.001
#result
print "E=",e,"V"
print "delta=",math.degrees(delta),"degrees"
import math
#variable declaration
w=150#kW
f=50#Hz
v=2300#V
n=1000#rpm
xd=32#ohm
xq=20#ohm
alpha=16#degrees
#calculations
vp=v/math.sqrt(3)
eb=2*vp
ex_power=eb*vp*math.sin(math.radians(alpha))/xd
rel_power=(vp**2*(xd-xq)*math.sin(math.radians(2*alpha)))/(2*xd*xq)
pm=3*(ex_power+rel_power)
tg=9.55*pm/1000
#result
print "torque=",tg,"N-m"
import math
from sympy.solvers import solve
from sympy import Symbol
#variable declaration
x=Symbol('x')
v=3300.0#V
P=1.5#MW
phi=3.0
xd=4.0#ohm per phase
xq=3.0#ohm per phase
sin_phi=0
cos_phi=1
phi=0
#calculations
v1=v/math.sqrt(3)
ia=P*math.pow(10,6)/(math.sqrt(3)*v*cos_phi)
tan_sigma=(v1*sin_phi-ia*xq)/(v1*cos_phi)
sigma=math.atan(tan_sigma)
alpha=phi-sigma
i_d=ia*math.sin(sigma)
iq=ia*math.cos(sigma)
eb=v1*math.cos(alpha)-i_d*xd
#eb=1029sin(alpha)+151sin(2*alpha)
#dPm/d(alpha)=1029sin(alpha)+151sin(2*alpha)=0
ans=solve([(604.0*x**2+1029.0*x-302.0)],[x])
alpha2=math.acos(math.radians(ans[1][0]))
Pm=1029*math.sin(alpha2)+151*math.sin(alpha2)
max_P=Pm*3
#result
print "Maximum mechanical power which the motor would develop=",round(max_P),"kW"
import math
#variable declaration
v=11000#V
ia=60#A
r=1#ohm
x=30#ohm
pf=0.8
#calculations
p2=math.sqrt(3)*v*ia*pf
cu_loss=ia**2*3
pm=p2-cu_loss
vp=v/math.sqrt(3)
phi=math.acos(pf)
theta=math.atan(x/r)
zs=x
z_drop=ia*zs
eb=math.sqrt((vp**2+z_drop**2-(2*vp*z_drop*math.cos(theta+phi))))*math.sqrt(3)
#result
print "power supplied=",p2/1000,"kW"
print "mechanical power=",pm/1000,"KW"
print "induced emf=",eb,"V"
import math
#variable declaration
v=400#V
i=32#A
pf=1
xd=10#ohm
xq=6.5#ohm
#calculations
e=math.sqrt(v**2+(i*xq)**2)+((xd-xq)*14.8)
delta=math.atan((i*xq)/v)
power=3*v*i
power_other=3*(v*e/10)*math.sin(delta)*0.001
#result
print "E=",e,"V"
print "delta=",math.degrees(delta),"degrees"
import math
#variable declaration
v=500#V
output=7.46#kW
pf=0.9
r=0.8#ohm
loss=500#W
ex_loss=800#W
#calculations
pm=output*1000+loss+ex_loss
ia=(v*pf-math.sqrt(v**2*pf**2-4*r*pm))/(2*r)
m_input=loss*ia*pf
efficiency=output*1000/m_input
#result
print "commercial efficiency=",efficiency*100,"%"
import math
#variable declaration
v=2300#V
r=0.2#ohm
x=2.2#ohm
pf=0.5
il=200#A
#calculations
phi=math.acos(pf)
theta=math.atan(x//r)
v=v/math.sqrt(3)
zs=math.sqrt(r**2+x**2)
eb=math.sqrt(v**2+(il*zs)**2-(2*v*il*zs*math.cos(phi+theta)))
#result
print "Eb=",eb,"volt/phase"
import math
#variable declaration
vl=6600#V
f=50#Hz
il=50#A
r=1#ohm
x=20#ohm
pf=0.8
#calculations
#0.8 lagging
power_i=math.sqrt(3)*v*f*pf
v=vl/math.sqrt(3)
phi=math.acos(pf)
theta=math.atan(x/r)
zs=math.sqrt(x**2+r**2)
eb=math.sqrt(v**2+(il*zs)**2-(2*v*il*zs*math.cos(phi-theta)))*math.sqrt(3)
print "0.8 lag: Eb=",eb
#0.8 leading
power_i=math.sqrt(3)*v*f*pf
v=vl/math.sqrt(3)
phi=math.acos(pf)
theta=math.atan(x/r)
zs=math.sqrt(x**2+r**2)
eb=math.sqrt(v**2+(il*zs)**2-(2*v*il*zs*math.cos(phi+theta)))*math.sqrt(3)
print "0.8 leading:Eb=",eb
import math
#variable declaration
x=0.4
pf=0.8
v=100#V
phi=math.acos(pf)
#calculations
#pf=1
eb=math.sqrt(v**2+(x*v)**2)
#pf=0.8 lag
eb2=math.sqrt(v**2+(x*v)**2-(2*v*x*v*math.cos(math.radians(90)-phi)))
#pf=0.8 lead
eb3=math.sqrt(v**2+(x*v)**2-(2*v*x*v*math.cos(math.radians(90)+phi)))
#result
print "pf=1: Eb=",eb,"V"
print "pf=0.8 lag:Eb=",eb2,"V"
print "pf=0.8 lead:Eb=",eb3,"V"
import math
#variable declaraion
load=1000#kVA
v=11000#V
r=3.5#ohm
x=40#ohm
pf=0.8
#calculations
ia=load*1000/(math.sqrt(3)*v)
vp=v/math.sqrt(3)
phi=math.acos(pf)
ra=ia*r
xa=ia*x
za=math.sqrt(ra**2+xa**2)
theta=math.atan(x/r)
#pf=1
eb1=math.sqrt(vp**2+za**2-(2*vp*za*math.cos(theta)))
alpha1=math.asin(xa*math.sin(theta)/eb1)
#pf=0.8 lag
eb2=math.sqrt(vp**2+xa**2-(2*vp*xa*math.cos(theta-phi)))*math.sqrt(3)
alpha2=math.asin(xa*math.sin(theta-phi)/eb2)
#pf=1
eb3=math.sqrt(vp**2+xa**2-(2*vp*xa*math.cos(theta+phi)))*math.sqrt(3)
alpha3=math.asin(xa*math.sin(theta+phi)/eb3)
#result
print "at pf=1"
print "Eb=",eb1*math.sqrt(3),"V"
print "alpha=",math.degrees(alpha1),"degrees"
print "at pf=0.8 lagging"
print "Eb=",eb2,"V"
print "alpha=",math.degrees(alpha2),"degrees"
print "at pf=0.8 leading"
print "Eb=",eb3,"V"
print "alpha=",math.degrees(alpha3),"degrees"
import math
#variable declaration
z=complex(0.5,0.866)
v=200#V
output=6000#W
loss=500#W
i=50#A
#calculations
cu_loss=i**2*z.real
motor_intake=output+loss+cu_loss
phi=math.acos(motor_intake/(v*i))
theta=math.atan(z.imag/z.real)
zs=abs(z)*i
eb1=math.sqrt(v**2+zs**2-(2*v*zs*math.cos(math.radians(60)-phi)))
eb2=math.sqrt(v**2+zs**2-(2*v*zs*math.cos(math.radians(60)+phi)))
#result
print "lag:eb=",eb1,"V"
print "lag:eb=",eb2,"V"
import math
#variable declaration
v=2200#V
f=50#Hz
z=complex(0.4,6)
lag=3#degrees
#calculations
eb=v/math.sqrt(3)
alpha=lag*8/2
er=math.sqrt(eb**2+eb**2-(2*eb*eb*(math.cos(math.radians(alpha)))))
zs=abs(z)
ia=er/zs
theta=math.atan(z.imag/z.real)
phi=theta-(math.asin(eb*math.sin(math.radians(alpha))/er))
pf=math.cos(phi)
total_input=3*eb*ia*pf
cu_loss=3*ia**2*z.real
pm=total_input-cu_loss
pm_max=(eb*eb/zs)-(eb**2*z.real/(zs**2))
#result
print "armature current=",ia,"A"
print "power factor=",pf
print "power of the motor=",pm/1000,"kW"
print "max power of motor=",pm_max/1000,"kW"
import math
#variable declaration
eb=250#V
lead=150#degrees
v=200#V
x=2.5#times resistance
alpha=lead/3
#calculations
er=math.sqrt(v**2+eb**2-(2*v*eb*math.cos(math.radians(alpha))))
theta=math.atan(x)
phi=math.radians(90)-theta
pf=math.cos(phi)
#results
print "pf at which the motor is operating=",pf
import math
#variable declaration
v=6600#V
r=10#ohm
inpt=900#kW
e=8900#V
#calculations
vp=v/math.sqrt(3)
eb=e/math.sqrt(3)
icos=inpt*1000/(math.sqrt(3)*v)
bc=r*icos
ac=math.sqrt(eb**2-bc**2)
oc=ac-vp
phi=math.atan(oc/bc)
i=icos/math.cos(phi)
#result
print "Line current=",i,"A"
import math
#variable declaration
v=6600#V
x=20#ohm
inpt=1000#kW
pf=0.8
inpt2=1500#kW
#variable declaration
va=v/math.sqrt(3)
ia1=inpt*1000/(math.sqrt(3)*v*pf)
zs=x
phi=math.acos(pf)
ia1zs=ia1*zs
eb=math.sqrt(va**2+ia1zs**2-(2*va*ia1zs*math.cos(math.radians(90)+phi)))
ia2cosphi2=inpt2*1000/(math.sqrt(3)*v)
cosphi2=x*ia2cosphi2
ac=math.sqrt(eb**2-cosphi2*2)
phi2=math.atan(ac/cosphi2)
pf=math.cos(phi2)
alpha2=math.atan(cosphi2/ac)
#results
print "new power angle=",math.degrees(alpha2),"degrees"
print "new power factor=",pf
import math
#variable declaration
v=400#V
inpt=5472#W
x=10#ohm
#calculations
va=v/math.sqrt(3)
iacosphi=inpt/(math.sqrt(3)*v)
zs=x
iazs=iacosphi*zs
ac=math.sqrt(va**2-iazs**2)
oc=va-ac
bc=iazs
phi=math.atan(oc/iazs)
pf=math.cos(phi)
ia=iacosphi/pf
alpha=math.atan(bc/ac)
#result
print "load angle=",math.degrees(alpha),"degrees"
print "power factor=",pf
print "armature current=",ia,"A"
import math
import scipy
from sympy.solvers import solve
from sympy import Symbol
#variable declaration
i2=Symbol('i2')
v=2000.0#V
r=0.2#ohm
xs=2.2#ohm
inpt=800.0#kW
e=2500.0#V
#calculations
i1=inpt*1000/(math.sqrt(3)*v)
vp=v/math.sqrt(3)
ep=e/math.sqrt(3)
theta=math.atan(xs/r)
i2=solve(((i1*xs+r*i2)**2+(vp+i1*r-xs*i2)**2)-ep**2,i2)
i=math.sqrt(i1**2+i2[0]**2)
pf=i1/i
#result
print "line currrent=",i,"A"
print "power factor=",pf
import math
#variable declaration
v=440#V
f=50#Hz
inpt=7.46#kW
r=0.5#ohm
pf=0.75
loss=500#W
ex_loss=650#W
#calculations
ia=inpt*1000/(math.sqrt(3)*v*pf)
cu_loss=3*ia**2*r
power=inpt*1000+ex_loss
output=inpt*1000-cu_loss-loss
efficiency=output/power
#result
print "armature current=",ia,"A"
print "power=",power,"W"
print "efficiency=",efficiency*100,"%"
import math
v=3300#V
x=18#ohm
pf=0.707
inpt=800#kW
#calculations
ia=inpt*1000/(math.sqrt(3)*v*pf)
ip=ia/math.sqrt(3)
zs=x
iazs=ip*zs
phi=math.acos(pf)
theta=math.radians(90)
eb=math.sqrt(v**2+iazs**2-(2*v*iazs*(-1)*pf))
alpha=math.asin(iazs*math.sin(theta+phi)/eb)
#result
print "excitation emf=",eb,"V"
print "rotor angle=",math.degrees(alpha),"degrees"
import math
#variable declaration
inpt=75#kW
v=400#V
r=0.04#ohm
x=0.4#ohm
pf=0.8
efficiency=0.925
#calculations
input_m=inpt*1000/efficiency
ia=input_m/(math.sqrt(3)*v)
zs=math.sqrt(r**2+x**2)
iazs=ia*zs
phi=math.atan(x/r)
theta=math.radians(90)-phi
vp=v/math.sqrt(3)
eb=math.sqrt(vp**2+iazs**2-(2*vp*iazs*math.cos(theta+phi)))
cu_loss=3*ia**2*r
ns=120*50/40
pm=input_m-cu_loss
tg=9.55*pm/ns
#result
print "emf=",eb,"eb"
print "mechanical power=",pm,"W"
import math
#variable declaration
v=400#V
f=50#Hz
r=0.5#ohm
zs=x=4#ohm
i=15#A
i2=60#A
#calculations
vp=v/math.sqrt(3)
iazs=i*zs
xs=math.sqrt(x**2-r**2)
theta=math.atan(xs/r)
eb=math.sqrt(vp**2+iazs**2-(2*vp*iazs*math.cos(theta)))
iazs2=i2*zs
phi=theta-math.acos(vp**2-vp**2+iazs2**2/(2*vp*iazs2))
pf=math.cos(phi)
input_m=math.sqrt(3)*v*i2*pf
cu_loss=3*i2**2*r
pm=input_m-cu_loss
ns=120*50/6
tg=9.55*pm/ns
#result
print "gross torque developed=",tg,"N-m"
print "new power factor=",pf
import math
#variable declaration
v=400#V
inpt=7.46#kW
xs=10#W/phase
efficiency=0.85
#calculations
input_m=inpt*1000/efficiency
il=input_m/(math.sqrt(3)*v)
zs=il*xs
vp=v/math.sqrt(3)
eb=math.sqrt(vp**2+zs**2)
#result
print "minimum current=",il,"A"
print "inducedemf=",eb,"V"
import math
#variable declaration
v=400#V
f=50#Hz
inpt=37.5#kW
efficiency=0.88
zs=complex(0.2,1.6)
pf=0.9
#calculations
input_m=inpt/efficiency
ia=input_m*1000/(math.sqrt(3)*v*pf)
vp=v/math.sqrt(3)
er=ia*abs(zs)
phi=math.acos(pf)
theta=math.atan(zs.imag/zs.real)
eb=math.sqrt(vp**2+er**2-(2*vp*er*math.cos(theta+phi)))
alpha=math.asin(math.sin(theta+phi)*er/eb)
pm=3*eb*vp*math.sin(alpha)/abs(zs)
#result
print "excitation emf=",eb*math.sqrt(3),"V"
print "total mechanical power developed=",pm,"W"
import math
import scipy
from sympy.solvers import solve
from sympy import Symbol
#variable declaration
v=6600.0#V
xs=20.0#ohm
inpt=1000.0#kW
pf=0.8
inpt2=1500.0#kW
phi2=Symbol('phi2')
#calculations
vp=v/math.sqrt(3)
ia=inpt*1000/(math.sqrt(3)*v*pf)
theta=math.radians(90)
er=ia*xs
zs=xs
phi=math.acos(pf)
eb=math.sqrt(vp**2+er**2-(2*vp*er*math.cos(theta+phi)))
alpha=math.asin(inpt2*1000*zs/(3*eb*vp))
#vp/eb=cos(alpha+phi2)/cos(phi2)
#solving we get
phi2=math.radians(19.39)
pf=math.cos(phi2)
#result
print "new power factor=",pf
import math
#variable declaration
v=400#V
x=4#ohms/phase
r=0.5#ohms/phase
ia=60#A
pf=0.866
loss=2#kW
#calculations
vp=v/math.sqrt(3)
zs=abs(complex(r,x))
phi=math.acos(pf)
iazs=ia*zs
theta=math.atan(x/r)
eb=math.sqrt(vp**2+iazs**2-(2*vp*iazs*math.cos(theta+phi)))
pm_max=(eb*vp/zs)-(eb**2*r/zs**2)
pm=3*pm_max
output=pm-loss*1000
#result
print "maximum power output=",output/1000,"kW"
import math
#variable declaration
z=10#ohm
x=0.5#ohm
v=2000#V
f=25#Hz
eb=1600#V
#calculations
pf=x/z
pm_max=(eb*v/z)-(eb**2*pf/zs)
ns=120*f/6
tg_max=9.55*pm_max/ns
#result
print "maximum total torque=",tg_max,"N-m"
import math
#variabke declaration
v=2000#V
n=1500#rpm
x=3#ohm/phase
ia=200#A
#calculations
eb=vp=v/math.sqrt(3)
zs=ia*x
sinphi=(eb**2-vp**2-zs**2)/(2*zs*vp)
phi=math.asin(sinphi)
pf=math.cos(phi)
pi=math.sqrt(3)*v*ia*pf/1000
tg=9.55*pi*1000/n
#result
print "power input=",pi,"kW"
print "power factor=",pf
print "torque=",tg,"N-m"
import math
#variable declaration
v=3300#V
r=2#ohm
x=18#ohm
e=3800#V
#calculations
theta=math.atan(x/r)
vp=v/math.sqrt(3)
eb=e/math.sqrt(3)
alpha=theta
er=math.sqrt(vp**2+eb**2-(2*vp*eb*math.cos(theta)))
zs=math.sqrt(r**2+x**2)
ia=er/zs
pm_max=((eb*vp/zs)-(eb**2*r/zs**2))*3
cu_loss=3*ia**2*r
input_m=pm_max+cu_loss
pf=input_m/(math.sqrt(3)*v*ia)
#result
print "maximum total mechanical power=",pm_max,"W"
print "current=",ia,"A"
print "pf=",pf
import math
#variable declaration
v=415#V
e=520#V
z=complex(0.5,4)
loss=1000#W
#calculations
theta=math.atan(z.imag/z.real)
er=math.sqrt(v**2+e**2-(2*v*e*math.cos(theta)))
zs=abs(z)
i=er/zs
il=math.sqrt(3)*i
pm_max=((e*v/zs)-(e**2*z.real/zs**2))*3
output=pm_max-loss
cu_loss=3*i**2*z.real
input_m=pm_max+cu_loss
pf=input_m/(math.sqrt(3)*il*v)
efficiency=output/input_m
#result
print "power output=",output/1000,"kW"
print "line current=",il,"A"
print "power factor=",pf
print "efficiency=",efficiency*100,"%"
import math
#variable declaration
v=400#V
inpt=37.3#kW
efficiency=0.88
z=complex(0.2,1.6)
pf=0.9
#calculations
vp=v/math.sqrt(3)
zs=abs(z)
il=inpt*1000/(math.sqrt(3)*v*efficiency*pf)
izs=zs*il
theta=math.atan(z.imag/z.real)
phi=math.acos(pf)
eb=math.sqrt(vp**2+izs**2-(2*vp*izs*math.cos(theta+phi)))
input_m=inpt*1000/efficiency
cu_loss=3*il**2*z.real
pm=input_m-cu_loss
#result
print "induced emf=",eb*math.sqrt(3),"V"
print "total mechanical power=",pm/1000,"kW"
import math
#variable declaration
inpt=48#kW
v=693#V
pf=0.8
ratio=0.3
x=2#W/phase
#calculations
il=inpt*1000/(math.sqrt(3)*v*pf)
vp=v/math.sqrt(3)
zs=x
izs=zs*il
theta=math.atan(float("inf"))
phi=math.acos(pf)
eb=math.sqrt(vp**2+izs**2-(2*vp*izs*math.cos(theta-phi)))
i_cosphi=pf*il
bc=i_cosphi*x
eb=eb+(ratio*eb)
ac=math.sqrt(eb**2-bc**2)
oc=ac-vp
phi2=math.atan(oc/bc)
pf=math.cos(phi2)
i2=i_cosphi/pf
#result
print "current=",i2,"A"
print "pf=",pf
import math
#variable declaration
load=60.0#kW
inpt=240.0#kW
pf=0.8
pf2=0.9
#calculations
total_load=inpt+load
phi=math.acos(pf2)
kVAR=total_load*math.tan(phi)
#factory load
phil=math.acos(pf)
kVAR=inpt*math.tan(phil)
kVA=inpt/pf
kVAR1=total_load*math.sin(phil)
lead_kVAR=kVAR1-kVAR
#synchronous motor
phim=math.atan(lead_kVAR/load)
motorpf=math.cos(phim)
motorkVA=math.sqrt(load**2+lead_kVAR**2)
#result
print "leading kVAR supplied by the motor=",motorkVA
print "pf=",pf