L=0.25 # length of stator stack in metre
r=0.15 # radius of stator stack in metres
BImax=0.96 # peak value of air gap flux density in tesla
P=6. # no of machine poles
phi=(4.*L*r*BImax)/P # flux per pole in webers
print"phi=",phi,"Wb"
# the example below is an extension of Ex2_1
from math import sqrt, sin
L=0.25 # length of stator stack in metres
r=0.15 # radius of stator stack in metres
BImax=0.96 # peak value of air gap flux density in tesla
P=6. # no of machine poles
phi=(4.*L*r*BImax)/P # flux per pole in webers
# above comes from Ex2_1
span=5. # span of each coil given by no of slots
edps=30. # electrical degrees per slot in degrees
p=span*edps# coil pitch in degrees
print"p=",span*edps
Nc=2# turns of coil
Kp=sin(((p/2)*phi)/180) # pitch factor # degree being converted to radians before calculation
print"Kp=sin(p/2)=",Kp # the ans may vary due to roundoff error
print"xcmax=Nc*Kp*phi=",Nc*Kp*phi,"Wb turns"# max flux linkage # ans may vary due to roundoff error
ns=1000 # machine speed in rev/min
p=6 # no of poles
f=(p*ns)/120 # frequency at given speed in Hertz
print"f=Hz",f
print"Ec=sqrt(2)*phi*f*Nc*kp*phi=",sqrt(2)*phi*f*Nc*Kp*phi,"V"# ans may vary due to roundoff error # voltage induced at above frequency
# the example below is an extension of Ex2_1 and Ex2_2
from math import sin, sqrt,pi
S1=36. # no of slots
q1=3. # no of phases
p=6. # no of poles
Nc=2. # no of turns per coil
L=0.25 # length of stator stack in metres
r=0.15 # radius of stator stack in metres
BImax=0.96 # peak value of air gap flux density in tesla
P=6. # no of machine poles
phi=(4.*L*r*BImax)/P # flux per pole in webers
span=5. # span of each coil given by no of slots
edps=30. # electrical degrees per slot in degrees
p=span*edps# coil pitch in degrees
Nc=2.# turns of coil
kp=sin(((p/2.)*pi)/180.) # pitch factor # degree being converted to radians before calculation
ns=1000. # machine speed in rev/min
p=6. # no of poles
f=(p*ns)/120. # frequency at given speed in Hertz
Ec=sqrt(2.)*pi*f*Nc*kp*phi# voltage induced at above frequency
n=S1/(q1*p)
print"n=S1/(q1*p)=",n,"n" # coils per group
edps=30. # electrical degrees per slot # equal to y as per textbook
kd=(sin((n*edps*pi)/(180.*2.)))/(n*sin((edps/2.)*pi/180.)) # distribution factor of the machine # degree converted to radian for calculation
print"kd=sin(n*y/2)/n*sin(y/2)=",kd# ans may vary due to roundoff error
print"|Egroup|=n*Ec*kd=",n*Ec*kd,"V"# ans may vary due to roundoff error
print"|Eo|=p*|Egroup|=",p*n*Ec*kd,"V"# ans may vary due to roundoff error
print"sqrt(3)*Eo=",sqrt(3.)*n*Ec*kd*p,"V"# ans may vary due to roundoff error
stp=n*Nc*p # series turns per phase # equal to No in textbook
print"No=n*Nc*p=",stp,"turns"
print"|Eo|=sqrt(2)*pi*No*f*o*kp*kd=",sqrt(2.)*pi*stp*f*kp*kd*phi,"V" # ans may vary due to round off error # induced phase winding
from math import sqrt, sin, acos
Vl=2300. # terminal voltage of synchronous motor in volts
Il=8.8 # minimum line current in ampere
P=sqrt(3.)*Vl*Il
print"P=",P/1000.,"KW"# power drawn from the line # ans may vary due to round off error
pf=0.8 # operating power factor
print"HP=P/746=",P/746.,"hp"# ans may vary due to round off error # conversion of power to hp requires division by 746
S=P/(pf*1000.) # total volt amperes of motor in kVA
print"Q=|S|sin0om=|S|sin cos-1(pf)=",S*sin(acos(pf)),"kVAR"# kVAR supplied by motor to the system # ans may vary due to roundoff error
from math import sqrt, sin, cos
# the following code contains userdefined fucntion complexstring
Load=5000. # load of the plant in kW
pf1=0.8 # power factor of load(lagging)
pf2=0.9 # power factor of induction motor
pf3=0.8 # power factor of synchronous motor
Hp=500. # rating of induction motor to be replaced in hp
Pout=0.746*Hp # output power of induction motor in kW
Eta=0.96 # efficiency of the induction motor equal to n in textbook
Sp=5000+3750j;#Load+(Load*tan(acos(pf1)))*%i # original complex power of load in kVA
print'Sp=',Sp,"kVA"
Pin=Pout/Eta # input power in kW
print"Pin=",Pin,"kW"# complex power of induction motor # the ans may vary due to round off error
Sm=388.542+188.179j;#Pin+(Pin*tan(acos(pf2)))*%i
print'Sm=',Sm,'kVA'# the ans may vary due to round off error # complex power of induction motor
Ss=388.542-291.406;#Pin-(Pin*tan(acos(pf3)))*%i
print'Ss=',Ss,'kVA'# complex power of synchronous machine # the ans may vary due to round off error
Qm=0 + 188j;#(Pin*tan(acos(pf2)))*%i# reactive power of induction motor in kVAR
Qs=-0 + -291j;#(-1*(Pin*tan(acos(pf3)))*%i)# reactive power of synchronous motor in kVAR
Sp1=Sp-Qm+Qs
print'Sp1=',Sp1,'kVA'# new plant requirement,equal to Sp` in textbook
pha=0.579;#acos(real(Sp1)/abs(Sp1)) # phase angle of Sp1 in radians
print"New power factor=",cos(pha)# new power factor # the ans may vary due to round off error
invl=abs(Sp)# initial value of complex power in kVA
fnvl=abs(Sp1) # final value of complex power in kVA
print"Percent reduction=",(((invl-fnvl)/invl)*100.)# the ans may vary due to round off error
from math import sqrt, sin, cos, pi
Load=5000. # load of the plant in kW
pf1=0.8 # power factor of load(lagging)
Sp=5000+3750j;#Load+(Load*tan(acos(pf1)))*%i # original complex power of load in kVA
print'Sp=',Sp,'kVA'
pf2=0.9 # new power factor
Qp1=2.42e+03;#real(Sp)*tan(acos(0.9)) # reactive power,equal to Qp` in textbook
print"Qp=",Qp1,"kVAR"# the ans vary due to roundoff error
Qp=3.75e+03;#imag(Sp)
print"Qs=",Qp1-Qp,"kVAR"# KVAR to be supplied by synchronous condenser
from math import sqrt,pi,sin,cos
VLB=2400. # line to base voltage in volts
V1=VLB/sqrt(3.) # reference phasor in volts # ans may vary due to roundoff error
print"V1=",V1,"V"
kVAB=9375. # rated kVA
I1B=(kVAB*1000.)/(sqrt(3.)*VLB)
pf=0.8 # power factor
print"I1B=",I1B,"A" # ans may vary due to roundoff error
I1=1804.22-1353.16j;#I1B*exp((-1)*%i*(acos(pf)))
print'I1=',I1,'A'# ans may vary due to roundoff error
x1=0.1# in ohms
print'Eo=V1+jI1x1=',1520.96+180.422j,"V";# +complexstring(V1+%i*I1*x1)+'V')# ans may vary due to roundoff error
print'sqrt3*|Eo|=',2652.85+0j,"V";#+complexstring((abs(V1+%i*I1*x1))*sqrt(3))+'V')
Ifu=110. # value in ampere,dc
Ifs=149. # value in ampere,dc
ks=Ifs/Ifu
print"ks=",ks # ans may vary due to roundoff error
m1=10.3;#(abs((V1+%i*I1*x1)))/Ifs # equal to m in textbook
print"m=|Eo|/Ifs=",m1,"omega"# ans may vary due to roundoff error
xdu=0.8 # in ohms
xd=x1+((xdu-x1)/ks)
print"xd=x1+(xdu-x1)/ks=",xd,"omega"# ans may vary due to roundoff error
Ef=2220.24+1112.8j;#V1+(%i*I1*xd)
print'Ef=',Ef,'V'# ans may vary due to roundoff error
print"If=",abs(Ef)/m1,"A"# ans may vary due to roundoff error
from math import sqrt,pi,sin,cos,exp
VLB=2400. # line to base voltage in volts
Ix=2005. # current in amperes
xda=VLB/(sqrt(3.)*Ix)
print"xda=",xda,"omega"# ans may vary due to roundoff error
Ifv=116. # current in amperes
ma1=VLB/(sqrt(3.)*Ifv)# equal to ma` in textbook
print"ma=V1B/Ifv=",ma1,"omega"# ans may vary due to roundoff error
# from ex 2_7
V1=VLB/sqrt(3.) # reference phasor in volts
kVAB=9375. # rated kVA
I1B=(kVAB*1000.)/(sqrt(3.)*VLB)# current in amperes
pf=0.8 # power factor
I1=1.8e+03 + -1.35e+03j;#I1B*exp((-1)*%i*(acos(pf)))# current in amperes
Ef=2.32e+03 + 1.25e+03j;#V1+%i*I1*xda
print'Ef=',Ef,'V'# ans may vary due to roundoff error
print"If=|Ef|/ma=",abs(Ef)/ma1,"A"# ans may vary due to roundoff error
Voc=2960. # line to line volatge in Volts
print"V1oc=",Voc/sqrt(3.),"V"# ans may vary due to roundoff error
If=240. # current in amperes
Efmax=ma1*If
print"Efmax=",Efmax,"V"# ans in textbook is wrong
I1max=(Efmax-V1)/xda # ans in textbook is wrong
print"I1max=",I1max,"A"# ans may vary due to roundoff error
print"Qmax=",sqrt(3)*VLB*I1max*(10**-6),"MVAR"# ans may vary due to roundoff error
import math
xd=1. # in ohms per unit
xd1=0.3 # in ohms per unit
xd2=0.2 # in ohms per unit
Td2=0.03 # time in seconds
Td1=1. # time in seconds
MVA=100. # rating in mega volt ampere
V=16000. # voltage in volts
I2pu=1./xd2
print "Ipu=",I2pu,"per unit"
Ib=(MVA*(10.**6.))/(math.sqrt(3.)*V)
print"Ib=",Ib,"A"# ans may vary due to roundoff error
print"I=",I2pu*Ib,"A"# ans in textbook is wrong
I1=1./xd1 # current in per unit
print"I=Efo/xd=",I1,"per unit"# ans may vary due to roundoff error
Iss=1/xd# current in per unit
print"Iss=Efo/xd=1 per unit"
t=2./60. # time in seconds
print"I=",(I2pu-I1)*math.exp(-t/Td2)+(I1-Iss)*math.exp(-t/Td1)+1.,"per unit"# ans may vary due to roundoff error
t=10. # time in seconds
print"I=",(I2pu-I1)*math.exp(-t/Td2)+(I1-Iss)*math.exp(-t/Td1)+1.,"per unit"# ans may vary due to roundoff error