from __future__ import division
from math import pi
# Given
t1=2# # mm
t2=5# # mm
t3=7# # mm
eps1=3 # dielectric constant
eps2=4 # dielectric constant
eps3=6# # dielectric constant
eps0=1/36/pi*10**-9# # dielectric constant
d=10/100 # m
V=1500 # V
#E1*t1+E2*t2+E3*t3=V
#Voltage Gradients :
# using eps1*E1=eps2*E2=eps3*E3
E1=V/(t1+(eps1/eps2)*t2+(eps1/eps3)*t3)# V/mm
E1=E1*10 # V/cm
E2=eps1*E1/eps2 # V/cm
E3=eps1*E1/eps3 # V/cm
print "Voltage Gradients :\n for A : %.f V/cm\n for B : %.f V/cm\n for C : %.f V/cm"%(E1,E2,E3)
A = pi*d**2
W1=1/2*eps0*eps1*E1**2*10**4*A*t1*10**-3# # J
W2=1/2*eps0*eps2*E2**2*10**4*A*t2*10**-3# # J
W3=1/2*eps0*eps3*E3**2*10**4*A*t3*10**-3# # J
W1=W1*10**6 # # uJ
W2=W2*10**6 # # uJ
W3=W3*10**6 # # uJ
print "\nEnergy stored :\n for A : %.1f uJ\n for B : %.1f uJ\n for C : %.1f uJ"%(W1,W2,W3)
# Answer in the textbook are not accurate
from __future__ import division
from math import pi
# Given
N=680# # turns
fi=1.6*10**3 # Wb
d1=4/100 # m
d2=24/100 # m
l=0.6 # m
mu0=4*pi/10**7 # constant
# For air gap :
A=d1**2 # m**2
Bg=fi/A # weber/m**2
Hg=Bg/mu0 # AT/m
mmf1=0.001/mu0 # AT
# For central limb :
A=d1**2 # m**2
Bc=fi/A # weber/m**2
Hc=900 # AT/m (from magnetization curve)
mmf2=Hc*d2 # AT
# For side limb :
fi=1/2*fi # Wb
A=d1**2 # m**2
Bc=fi/A # weber/m**2
Hc=520 # AT/m (from magnetization curve)
mmf3=Hc*l # AT
mmf_total = mmf1+mmf2+mmf3 # AT
i=mmf_total/N # A
print "Current required = %0.2f A"%(i)
# Answer in the textbook are not accurate
from __future__ import division
from math import pi
# Given
D=15/100 # m
A=10/10**-4 # m**2
N=200# # turns
fi=1.6*10**3 # Wb
B=1 # weber/m**2
mu0=4*pi/10**7 # constant
mur=500 # constant
lg=2/1000 # m
# without air gap
l=pi*D # m
R=l/mu0/mur/A # A/Wb
fi=B*A # Wb
mmf=fi*R # AT
I=mmf/N # A
L=N**2/R/10**6 # mH
E=1/2*L*I**2/100 # J
# with air gap
Rg=lg/mu0/A # A/Wb
Rt=R+Rg # A/Wb
fi=B*A # Wb
mmf=fi*Rt # AT
I2=mmf/N # A
L2=N**2/Rt/10**6 # mH
E2=1/2*L2*I2**2/100 # J
print "\t\t\tWithout air gap With air gap"
print "\nExciting current %.2f A %.1f A"%(I,I2)
print "\nInductance %.1f mH %.1f mH"%(L,L2)
print "\nStored Energy %.3f J %.2f J"%(E,E2)
# Answer in the textbook are not accurate
from __future__ import division
from numpy import array
# Given
VA=60 # V
I=0.6 # A
# (VB-VA)/20+(VB-VC)/20+VB/20-I=0
#3*VB-VC=72 for node B eqn(1)
#(VC-VA)/50+(VC-VB)/30+(VC-12)/50+VC/100=0
#-5*VB+10*VC=144 eqn(2)
A=array([[3, -1],[-5 ,10]])
B=array([[72],[144]])
X=A**-1*B#
VB=X[0,0] # V
VC=X[0,1] # V
print "Voltage acroos 100 ohm = %.1f V"%(VC)
VC=24 # V
VB=(72+VC)/3 # from eqn(1)
# Node C
# (VC-VA)/50+(VC-VB)/20+(VC-12)/50+VC/100+VC/R=0 eqn(3)
R=100*VC/(144+5*VB-10*VC) # ohm
print "\nR=%.1f ohm"%(R)
from __future__ import division
from math import pi,cosh
# Given
Ro=600 # ohm
fc=2*1000 # Hz
alfa=10 # dB
L=Ro/pi/fc*1000 # mH
C=1/(pi*Ro*fc)*10**6 # uF
alfa=alfa/8.686 # nepers
f=fc*cosh(alfa/2)/1000 # kHz
print "\nat f = %.2f kHz, the above filter will have required attenuation."%(f)
from __future__ import division
from math import pi,atan,sqrt,asin,sin
# Given
#v=100*sin(314*t)
R=25 # ohm
C=80 # uF
omega=314 # radian
Vm=100 # V
Xc=1/omega/(C*10**-6) # ohm
Z=sqrt(R**2+Xc**2) # ohm
Im=Vm/Z # A
theta=atan(Xc/R) # radian
print "equation for instant current:"
print "i=%.2f*sin(%d*t+%.2f)"%(Im,omega,theta)
P=(Im/sqrt(2))**2*R # W
print "Power consumed = %.1f W"%(P)
Vcm=Im*Xc # V
#(when i=Im/2)
i=0.5*Im # A
#vc=Vcm*sin(314*t+theta-pi/2)
#i=Im*sin(314*t+theta)
tt=asin(i/Im) # radian tt=314*t+theta
vcm=Vcm*sin(tt-pi/2)
print "Voltage across capacitor = %.1f V(+ve & -ve)"%(abs(vcm))
from __future__ import division
from numpy import pi,roots
# Given
Z1=(6.25+1J*1.25) # ohm
Z2=(5+1J*0) # ohm
#Z3=(5-1J*XC) # ohm
V=100 # V
f=50 # Hz
#Z23=(250+5*Xc**2)/(100+Xc**2)-1J*(25*Xc)/(100+Xc**2)
#for in phase condition imag part must be zero
#5*Xc**2-100*Xc+5*100=0
A=[5 ,-100, 500] # polynomal
XC=roots(A)#
XC=XC[0] # ohm
C=1/(2*pi*f*XC)*10**6 # uF
print "Capacitance of XC = %.f uF"%(C)
Z=XC # ohm
I=V/Z # A
P=I**2*Z/1000 # kW
print "Circuit current = %.f A and power = %.f kW"%(I,P)
from __future__ import division
from math import pi
# Given
omega_o=600 # rad/s
omega=400 # rad/s
R=3 # ohm
IBYIo=1/2 # ratio
fo=omega_o/2/pi # Hz
f=omega/2/pi # Hz
#I/Io=1/(sqrt(1+Q**2*(f/fo-fo/f)**2))
Q=sqrt(1/IBYIo**2-1)/(fo/f-f/fo)
#Q=1/omega_0/R/C
C=1/omega_o/R/Q*10**6 # uF
#Q=omega_0*L/R
L=Q*R/omega_o*1000 # mH
print "L = %.1f mH\n C=%.f uF"%(L,C)
from __future__ import division
from math import pi,sqrt
# Given
V=400 # V
f=50 # Hz
n=3 # no of phase
R=100 # ohm
#Star connection
Vph=V/sqrt(n) # V
Iph=Vph/R # A
IL=Iph # A
cos_fi=1 # for only resitor load
P=sqrt(3)*V*IL*cos_fi/1000 # kW
print "Star Connection : P=%.1f kW"%(P)
#Delta Connection
Vph=V # V
Iph=Vph/R # A
IL=sqrt(3)*Iph # A
VL=Vph # V
P=sqrt(3)*VL*IL*cos_fi/1000 # kW
print "Delta Connection : P=%.1f kW"%(P)
from __future__ import division
from numpy import exp,pi
import cmath as cm
# Given
Rab=6;Rbc=8;Rca=4 # ohm
Vab=100*exp(1J*0) # V
Vbc=100*exp(1J*-120*pi/180) # V
Vca=100*exp(1J*120*pi/180) # V
Zab=6+1J*8 # ohm
Zbc=8+1J*6 # ohm
Zca=4-1J*3 # ohm
#Phase current
Iab=Vab/Zab # A
Ibc=Vbc/Zbc # A
Ica=Vca/Zca # A
print "Phase Current:"
print "Iab=%.f angle=%.2f degree "%(abs(Iab),cm.phase(Iab)*180/pi)
print "Ibc=%.f angle=%.2f degree "%(abs(Ibc),cm.phase(Ibc)*180/pi)
print "Ica=%.f angle=%.2f degree "%(abs(Ica),cm.phase(Ica)*180/pi)
#Line current
Iaa=Iab-Ica # A
Ibb=Ibc-Iab # A
Icc=Ica-Ibc # A
print "\n\n Line Current:"
print "Iaa=%.f angle=%.2f degree "%(abs(Iaa),cm.phase(Iaa)*180/pi)
print "Ibb=%.f angle=%.2f degree "%(abs(Iab),cm.phase(Ibb)*180/pi)
print "Icc=%.f angle=%.2f degree "%(abs(Icc),cm.phase(Icc)*180/pi)
#Power Consumed
Wab=abs(Iab)**2*Rab # W
Wbc=abs(Ibc)**2*Rbc # W
Wca=abs(Ica)**2*Rca # W
W=Wab+Wbc+Wca # W
W=W/1000 # kW
print "\n\n Total Power, W=%.f kW"%(W)
#Answer wrong for line current in the textbook.
from __future__ import division
from numpy import exp,pi
import cmath as cm
# Given
VRY=200*exp(1J*0) # V
VYB=200*exp(1J*-120*pi/180) # V
VBR=200*exp(1J*120*pi/180) # V
ZA=10*exp(1J*60*pi/180) # ohm
ZB=10*exp(1J*0*pi/180) # ohm
ZC=10*exp(1J*60*pi/180) # ohm
#Phase current
IRY=VRY/ZA # A
IYB=VYB/ZB # A
IBR=VBR/ZC # A
IR=IRY-IBR # A
PVA=(VRY).conjugate()*IR # W
print "Wattmeter W1 reading=%.f W"%((PVA.real))
IB=IBR-IYB # A
PVB=(-VYB).conjugate()*IB # W
print "Wattmeter W2 reading=%.f W or %.f kW"%((PVB.real),(PVB.real)/1000)
from __future__ import division
from numpy import exp,pi,sqrt
import cmath as cm
# Given
#v=250*sin(omega*t)+50*sin(3*omega*t+pi/3)+20*sin(5*omega*t+5*pi/6)
V1=250;V3=50;V5=20 # V
fi1=0;fi3=60;fi5=150 # degree
R=20 # omh
L=0.05 # H
omega=314 # rad/s
X1=omega*L # ohm
Z1=R+1J*X1 # ohm
X3=3*omega*L # ohm
Z3=R+1J*X3 # ohm
X5=5*omega*L # ohm
Z5=R+1J*X5 # ohm
r1=abs(Z1);t1=cm.phase(Z1)
r3=abs(Z3);t3=cm.phase(Z3)
r5=abs(Z5);t5=cm.phase(Z5)
print "expression for current:"
print "i = %.2f*sin(omega*t-%.1f)+%.1f*sin(3*omega*t%.1f)+%.2f*sin(5*omega*t-%.1f)"%(V1/r1,fi1-t1*180/pi,V3/r3,fi3-t3*180/pi,V5/r5,fi5-t5*180/pi)
I1m=V1/r1 # A
I3m=V3/r3 # A
I5m=V5/r5 # A
Irms=sqrt(I1m**2/2+I3m**2/2+I5m**2/2) # A
Vrms=sqrt(V1**2/2+V3**2/2+V5**2/2) # A
print "Irms=%.f A\n Vrms=%.f V"%(Irms,Vrms)
P=Irms**2*R # W
print "Total Power, P=%.f W"%(P)
cosfi=P/Vrms/Irms # Power factor
print "Power factor = %.2f"%(cosfi)
from __future__ import division
from math import pi,exp,sin,atan
# Given
f=50 # Hz
Vm=400 # V
R=10 # ohm
L=0.1 # H
t=0.02 # sec
XL=2*pi*f*L # ohm
Z=R+1J*XL # ohm
Im=Vm/abs(Z) # A
fi=atan(XL/R) # degree
lamda=L/R # sec
print "expression for current:"
print "i = %.1f*sin(314*t-%.3f)+0.95*e**(-100*t)"%(Im,fi)
i = Im*sin(314*t-fi)+0.95*exp(-100*t) # A
print "current after 0.02 sec is : %0.1f A"%(i)
i2=Im*(0.95*exp(-100*t)) # A
print "transient component is : %0.2f A"%(i2)
from __future__ import division
from math import pi,sqrt,asin,exp,sin
from sympy import Symbol,solve
from scipy.misc import derivative
# Given
C=5*10**-6 # F
L=2 # H
R=200 # ohm
if R<2*sqrt(L/C):
print "Since R<2sqrt(L/C), the circuit is originally oscillatory."
a=R/2/L
omega = sqrt(1/L/C-R**2/4/L**2) # rad/s
#i=Im*exp(-a*t)*sin(omega*t+fi)
#at t=0 sec
i0=0 # A
vc=10 # V
fi=asin(i0) # degree
#L*di/dt=vc at t=0
Im=Symbol('Im')
def current(t):
i=Im*exp(-a*t)*sin(omega*t+fi)
return i
#i=Im*expm(-a*t)*sin(omega*t+fi)
LdiBYdt=L*derivative(current,0)
#temp = coeff(LdiBYdt)
Im=solve(LdiBYdt,Im)[0]
#vc/temp(2)
print "Expression for current :\n i = %.3f*exp(-%dt)*sin(%.1ft)"%(Im,a,omega)
Rn=2*sqrt(L/C) # ohm
Rad=Rn-R # ohm
print "\n\n Additional resistance required = %d ohm"%(Rad)
from __future__ import division
from math import pi,sqrt
# Given
#i=0.5+0.3*sin(omega*t)-0.2*sin(2*omega*t)
I0=0.5;I1m=0.3;I2m=-0.2 # from above expression
Iav=I0 # A
R=1000 # ohm
L=1/1000 # H
Irms=sqrt(I0**2+(I1m/sqrt(2)**2+(I2m/sqrt(2)**2))) # A
print "Reading of hot wire instrument = %.3f A"%(Irms)
VR=Irms*R # V
print "Reading of electrostatic voltmeter acroos 1000 ohm = %d V"%(VR)
#vl_dash=L*di/dt=300*cos(w*t)-400*cos(2*w*t)
vl1=300;vl2=4 # V
vl=sqrt((300/sqrt(2))**2+(400/sqrt(2))**2)
print "Reading of electrostatic voltmeter acroos 1 mH inductor = %d V"%(vl)
from __future__ import division
# Given
R=80 # ohm
V=2 # V
l=50 # cm
vd=.1 # V
emf=1.43 # V
Rc=850 # ohm
sg=17.5 # mm/uA
df=1 # mm
I=R/V # A
Rw=vd/I # ohm (Resistance of side wire)
Id=df/sg*10**-6 # A (current for 1mm deflection)
el=1/sg*Rc # uV
print "The limit of error = %.1f uV"%(el)
Rw1=0.2/l*Rw # ohm (for 2cm slide wire)
dV=I*Rw1*1000 # mV (Change in voltage from null point)
r1=emf/I # ohm (tapped portion)
r2=r1*22.8/R # ohm
Ig=dV/1000/(Rc+r2) # A
d=dV/1000/(Rc+r2)/Id # mm
print "Deflection = %.1f mm"%(d)
from __future__ import division
from math import pi,sqrt
from sympy.mpmath import quad
# Given
R=50 # ohm
Vrms=100 # V
Rd1=50 # ohm
Rd2=100 # ohm
Vm=Vrms/sqrt(2) # V
#v=Vm*sin(theta)
Rf=R+Rd1 # ohm
Rb=R+Rd2 # ohm
#i_f=v/Rf # A
#i_b=v/Rb # A
Irms=1/2/pi*(quad(lambda theta:(sqrt(2)*sin(theta))**2,[0,pi])+quad(lambda theta:(sqrt(2)/3*sin(theta))**2,[pi,2*pi]))
Iav=1/2/pi*(quad(lambda theta:sqrt(2)*sin(theta),[0,pi])+quad(lambda theta:sqrt(2)/3*sin(theta),[pi,2*pi]))
print "reading of hot wire ammeter = %.2f A"%(Irms)
print "reading of moving coil ammeter = %.2f A"%(Iav)
P=1/2*(Vrms**2/Rf+Vrms**2/Rb) # W
print "\n\n Power taken from the mains = %.1f W"%(P)
Pc=Irms**2*R # W
Pd=P-Pc # W
print "Power dissipated in rectifying device = %d W"%(Pd)
#Answer wrong in the textbook.
from __future__ import division
from math import pi,sqrt,sin
# Given
d=1/100 # m
S=-1/100 # m
Ve=2 # kV
theta=30 # degree
e=1.6*10**-19 # C
m=9.67*10**-31 # kg
u=sqrt(2*e*Ve*1000/m) # m/s
uy=u*sin(pi/180*theta) # m/s
vy=0 # since final velocity =0
#vy**2-uy**2=2*ay*S
ay=(vy**2-uy**2)/2/S # m**2/s
#ay=e/m*V/d
V=ay*m*d/e # V
print "Required potential difference = %.f V"%(V)
from __future__ import division
# Given
#Ia=0.0004*(Va+40*Vg)**(3/2) # mA --eqn(1)
Va=250 # V
Vg=-3 # V
#mu=delVa/delVg
#differenciation wrt Vg eqn(1)
#(4*10**-6*3/2*(Va+40*Vg))**(1/2)*(mu+40)=0
mu=-40 # constant
print "Amplification factor, mu = %.f"%(mu)
#differenciation wrt Va eqn(1)
#delIa/delVa=(4*10**-6*3/2*(Va+40*Vg))**(1/2)*(0+40)
gm=(4*10**-6*3/2)*(Va+40*Vg)**(1/2)*(0+40)*1000 # mA/V or S
print "Mutual conductance, gm = %.2f S"%(gm)
#differenciation wrt Ia eqn(1) keeping Vg constant
#1=(4*10**-6)*3/2*(Va+40*Vg)**(1/2)*(delVa/delIa+0)
#ra=delVa/delIa
ra=1/((4*10**-6)*3/2*(Va+40*Vg)**(1/2))
print "Plate resistance, ra = %.1f kohm"%(ra/1000)
from __future__ import division
from math import pi
# Given
fc=25*10**6 # Hz
fm=400 # Hz
Vm=4 # V
Del=10*10**3 # Hz
wc=2*pi*fc # rad/s
wm=2*pi*fm # rad/s
m=Del/fm # modulation index
mf=m;mp=m # modulation index
print "General equation of FM wave is:"
print "v=%d*sin(%.2e*t+%d*sin(%d*t)"%(Vm,wc,mf,wm)
print "\n\n General equation of PM wave is:"
print "v=%d*sin(%.2e*t+%d*sin(%d*t)"%(Vm,wc,mp,wm)
# Changing modulating frequency
fm_new=2*10**3 # Hz
a=fm_new/fm # increase in angular frequency
print "\n\n Now equation of FM wave is:"
print "v=%d*sin(%.2e*t+%d*sin(%d*t)"%(Vm,wc,mf,a*wm)
print "\n\n Now equation of PM wave is:"
print "v=%d*sin(%.2e*t+%d*sin(%d*t)"%(Vm,wc,mp,a*wm)
from __future__ import division
# Given
Ebb=300 # V
Ibb=20 # A
Emm=150 # V
Po=4.5*10**3 # W
m=Emm/Ebb # modulation index
Pbb=Ebb*Ibb
eta=Po/Pbb*100 # %
P=Po*(1+m**2/2) # W
Pdo=Pbb-Po # W
Pd=Pdo*(1+m**2/2) # W
print "modulation index = %.1f"%(m)
print "carrier power under modulated condition = %0.2f kW"%(P/1000)
print "plate circuit efficiency = %.f percent"%(eta)
print "plate dissipation under unmodulated condition = %.1f kW"%(Pdo/1000)
print "plate dissipation under modulated condition = %.2f kW"%(Pd/1000)
from __future__ import division
from math import cos,pi,sin
# Given
Zo=50 # ohm
VSWR=2 # ratio
#lm=0.2*lamda
lmBYlamda=0.2
betaINTOlamda=2*pi
rho=(VSWR-1)/(VSWR+1) # reflection coefficient
theta=2*betaINTOlamda*lmBYlamda # radian
#exp(j*theta)=cos(theta)+1J*sin(theta)
ZL=Zo*(1-rho*(cos(theta)+1J*sin(theta)))/(1+rho*(cos(theta)+1J*sin(theta))) # ohm
Rs=(ZL.real) # ohm
Xs=abs((ZL.imag)) # ohm(capacitive)
print "Series equivalent circuit:"
print "Rs = %0.1f ohm"%(Rs)
print "Xs = %0.1f ohm"%(Xs)
YL=(1/ZL)*1000 # mS
Rp=1000/(YL.real) # ohm
Xp=1000/(YL.imag) # ohm
print "\n\n Parallel equivalent circuit:"
print "Rp = %0.1f ohm"%(Rp)
print "Xp = %0.f ohm"%(Xp)
from __future__ import division
from math import pi,sqrt
# Given
b=3 # cm
a=4.5 # cm
f=9*10**9 # Hz
v=3*10**10 # cm/s
lamda=v/f # cm
print "For TE10 mode:"
m=1 # for TE10 mode
lamda_c = 2*a/m # cm
rho=sqrt(1-(lamda/lamda_c)**2)
lamda_g=lamda/rho # cm
vg=rho*v # cm/s
vp=v/rho # cm/s
ZTE=120*pi/rho # ohm
print "cutoff wavelength = %.f cm"%(lamda_c)
print "guide wavelength = %.2f cm"%(lamda_g)
print "Group velocity = %.1e m/s"%(vg/100)
print "Phase velocity = %.1e m/s"%(vp/100)
print "Characteristic wave impedence = %.f ohm"%(ZTE)
print "\n\n For TM11 mode:"
m=1;n=1# for TE10 mode
lamda_c = 2/sqrt((m/a)**2+(n/b)**2) # cm
rho=sqrt(1-(lamda/lamda_c)**2)
lamda_g=lamda/rho # cm
vg=rho*v # cm/s
vp=v/rho # cm/s
ZTM=120*pi*rho # ohm
print "cutoff wavelength = %.f cm"%(lamda_c)
print "guide wavelength = %.2f cm"%(lamda_g)
print "Group velocity = %.1e m/s"%(vg/100)
print "Phase velocity = %.1e m/s"%(vp/100)
print "Characteristic wave impedence = %.f ohm"%(ZTM)
from __future__ import division
# Given
fs_max=1600 # kHz
fs_min=500 # kHz
IF=465 # kHz
fr=fs_max/fs_min # ratio
C_ratio = fr**2 # Cs_max/Cs_min
#Part (a)
fo_min=IF+fs_min # kHz
fo_max=IF+fs_max # kHz
fr_o=fo_max/fo_min # frequency ratio for oscillator
C_ratio_o = fr_o**2 # Cs_max/Cs_min
print "part(a):"
print "For fo>fs, the range of fo : %.f to %.f kHz"%(fo_min,fo_max)
print "frequency ratio = %.2f"%(fr_o)
print "capacitance ratio = %.2f"%(C_ratio_o)
#Part (b)
fo_min=-IF+fs_min # kHz
fo_max=-IF+fs_max # kHz
fr_o=fo_max/fo_min # frequency ratio for oscillator
C_ratio_o = fr_o**2 # Cs_max/Cs_min
print "\n\n part(b):"
print "For fo>fs, the range of fo : %.f to %.f kHz"%(fo_min,fo_max)
print "frequency ratio = %.1f"%(fr_o)
print "capacitance ratio = %.1f"%(C_ratio_o)
#ans wrong for part b in the book.
from __future__ import division
# Given
Ic=3 # mA
hfe=45 # unitless
Vcc=12 # V
VBE=0.5 # V
S=0.05 # stability factor
Beta=45 # unitless
RR=Vcc/2/(Ic*10**-3) # ohm (let RL+Re=RR)
#Re=20% of (Re+Rl)
Re=RR*20/100 # ohm
RL=RR-Re # ohm
Ve=(Ic+Ic/Beta)*10**-3*Re # V
Vb=Ve+VBE # V
#S=Re/Rb=0.5 => Rb=Re/S
R1=Vcc*Re/S/Vb/1000 # kohm
# Vb/Vcc = R2/(R2+R1)
R2=Vb*R1/(Vcc-Vb) # kohm
print "Resistor values are : "
print "RL=%.2f kohm"%(RL/1000)
print "Re=%.2f kohm"%(Re/1000)
print "R1=%.2f kohm"%(R1)
print "R2=%.2f kohm"%(R2)
from __future__ import division
from math import pi
# Given
Vcc=50 # V
Vmin=10 # V
Pd=40 # W
Vo=Vcc-Vmin # V
K=Vo/Vcc # constant
Rdash=2*Vcc**2/pi/Pd*(K-pi*K**2/4) # ohm
Po=K**2*Vcc**2/2/Rdash # W
eta=pi*K/4*100 # %
print "load presented by transformer = %.1f ohm"%(Rdash)
print "load power output = %.1f W"%(Po)
print "conversion efficiency = %.1f percent"%(eta)
from __future__ import division
# Given
Rs=1000 # ohm
Rc1=2*1000 # ohm
Re2=2*1000 # ohm
#CE configuration
hie=1100 # ohm
hre=2.5*10**-4#
hfe=50#
hoe=25*10**-6 # s
#CC configuration
hic=1.1 # kohm
hrc=1#
hfc=-51#
hoc=25*10**-6 # s
print "for 2nd stage(CC stage)"
AI2=-hfc/(1+hoe*Re2) # current gain
Ri2=hic+hrc*AI2*Re2 # kohm
Av2=AI2*Re2/Ri2 # Voltage Gain
print "current gain = %0.2f"%(AI2)
print "Input impedence = %0.2f kohm"%(Ri2/1000)
print "Voltage gain = %0.2f"%(Av2)
print "\n\n for 1st stage(CE stage)"
RL1=Rc1*Ri2/(Rc1+Ri2) # kohm
AI1=-hfe/(1+hoe*RL1) # current gain
print "current gain = %.2f"%(AI1)
Ri1=hie+hre*AI1*RL1 # kohm
print "Input impedence = %0.2f kohm"%(Ri1/1000)
Av1=AI1*RL1/Ri1 # Voltage gain
print "Voltage gain = %0.2f"%(Av1)
Ro1=1/(hoe-hfe*hre/(hie+100)) # ohm
print "Output impedence = %.2f kohm"%(Ro1/1000)
Ro1dash=Ro1*Rc1/(Ro1+Rc1) # /ohm
print "Output impedence taking Rc1 into account = %.2f kohm"%(Ro1dash/1000)
print "\n\n for overall amplifier"
Ro=1/(hoc*100-hfc*hrc/(hic+Ro1dash)) # ohm
print "Output impedence = %.2f ohm"%(Ro)
Rodash=Ro*Re2*1000/(Ro1+Re2*1000) # /ohm
print "Output impedence taking Re2 into account = %.2f ohm"%(Rodash)
AI=AI1*AI2*Rc1/(Ri2+Rc1) # current gain
print "current gain = %.2f"%(AI)
Av=Av1*Av2 # voltage gain
print "Voltage gain = %.2f"%(Av)
#answer is wrong for overall amplifier in the book.
from __future__ import division
from math import pi
# Given
fT=6*10**6 # Hz
hfe=50#
Rs=500 # ohm
gm=0.04 # S
rbb_dash=100 # ohm
Cc=10*10**-12 # F
RL=1 # kohm
rbe=hfe/gm # ohm
Ce=gm/2/pi/fT # F
C=Ce+Cc*(1+gm*RL) # F
hie=rbb_dash+rbe # ohm
R=(Rs+rbb_dash)*rbe/((Rs+rbb_dash)+rbe) # ohm
f2=1/2/pi/R/C # Hz
print "Voltage gain upper BW frequency = %.2f MHz"%(f2/10**6)
AIS=-hfe*Rs/(Rs+hie) # current gain
print "Current gain = %.2f"%(AIS)
AVS=-hfe*RL*1000/(Rs+hie) # voltage gain
print "Voltage gain = %.2f"%(AVS)
AVSf2=AVS*f2 # Hz
print "Voltage gain BW product = %.2f MHz"%(abs(AVSf2/10**6))
AISf2=AIS*f2 # Hz
print "Current gain BW product = %.2f MHz"%(abs(AISf2/10**6))
#answer in the textbook are wrong.
from __future__ import division
from math import pi,sqrt
# Given
VP=-2 # V
IDSS=1.75/1000 # A
VDD=24 # V
ID=1/1000 # A
VP=0.2 # V (pinch off voltage)
VGS=(1-sqrt(ID/IDSS))*VP # V
gmo=-2*IDSS/VP # S
gm=gmo*(1-VGS/VP) # S
Rs=-VGS/ID # ohm
print "VGS=%.2f V"%(VGS)
print "gm = %.2f mS"%(gm*1000)
print "Rs = %.f ohm"%(Rs)
#Ans are wrong in the book.
from math import sqrt
from __future__ import division
# Given
G=37 # dB
f1=50 # Hz
f2=18.7*1000 # Hz
BW1=f2 # Hz (f2-f1~=f2)
A1=10**(G/20) # Gain
A3=sqrt(A1) # Gain
RL1BYRL2=A1/A3 # ratio
RL2BYRL1=A3/A1 # ratio
#BW=2*pi*Cd*RL
BW1BYBW2=RL2BYRL1#
BW2BYBW1=RL1BYRL2#
f2dash=f2*sqrt(sqrt(2)-1)#
BW2=BW2BYBW1*f2dash # Hz
print "Bandwidth of redesigned aplifier, BW=%.f kHz"%(BW2/1000)
from math import sqrt
from __future__ import division
# Given
L=30 # H
C=10*10**-6 # F
RL=8*10**3 # ohm
f=50 # Hz
r=sqrt(2)/12/(2*pi*f)**2/L/C*100 # %
Lc=2*RL/6/(2*pi*f) # H
print "ripple factor = %.1f percent"%(r)
print "Critical inductance, Lc=%.1f H"%(Lc)
from __future__ import division
# Given
V=500 # V
Pp=1500*10**3 # W (+ve side)
Pn=2000*10**3 # W (-ve side)
P=Pp+Pn # W
I=P/V # A
Ip=Pp/(V/2) # A
In=Pn/(V/2) # A
Iob=In-Ip # A
Ia=Iob/2 # A
print "Current supplied by the main generator = %.f A"%(I)
print "Current supplied on +ve side = %.f A"%(Ip)
print "Current supplied on -ve side = %.f A"%(In)
print "out-off balance Current = %.f A"%(Iob)
print "Current in each armature = %.f A"%(Ia)
from __future__ import division
from math import sqrt
# Given
l=20 # km
P=10000 # kW
V=11 # kV
pf=0.707 # lagging
R=0.02 # ohm/km/phase
X=0.07 # ohm/km/phase
#for pf = 0.707
IL=P*10**3/sqrt(3)/(V*1000)/pf # A
VRphase=V*1000/sqrt(3) # V
R_phase=l*R # ohm
X_phase=l*X # ohm
Z_phase=R_phase+1J*X_phase # ohm
Vd_phase=IL*(pf-1J*pf)*Z_phase # V
VS=(Vd_phase+VRphase) # V
regulation=(VS-VRphase)/VRphase*100 # %
print "regulation = %.f percent"%abs(regulation)
PL=3*IL**2*R_phase/1000 # kW
Po=P+PL # kW
eta=P/Po*100 # %
print "Efficiency = %.f percent"%(eta)
#for pf2=0.9 # lagging
pf=0.9 # lagging
IL=P*10**3/sqrt(3)/(V*1000)/pf # A
VRphase=V*1000/sqrt(3) # V
R_phase=l*R # ohm
X_phase=l*X # ohm
Z_phase=R_phase+1J*X_phase # ohm
Vd_phase=IL*(pf-1J*.435)*Z_phase # V
VS=(Vd_phase+VRphase) # V
regulation=(VS-VRphase)/VRphase*100 # %
print "\n\n regulation = %.1f percent"%abs(regulation)
PL=3*IL**2*R_phase/1000 # kW
Po=P+PL # kW
eta=P/Po*100 # %
print "Efficiency = %.f percent"%(eta)
#ans wrong for 2nd part in the book.
from __future__ import division
# Given
C1=1.2 # Rs
C2=5 # Rs
P1=100 # W
P2=30 # W
t=1000 # hours
Ce=60 # Rs/kW/annum for max demand
Cee=3 # paise/unit for extra
#first lamp
Cl1=C1*100/t # paise / hour
dmax1=P1/1000 # kW/hour
Cmax1=Ce*100*dmax1/(24*365) # paise/hour
CE1=Cee*dmax1 # /paise / hour
CT1=Cl1+Cmax1+CE1 # paise (total cost per hour)
print "lamp1 : Total cost/hour = %.3f paise"%(CT1)
#second lamp
Cl2=C2*100/t # paise / hour
dmax2=P2/1000 # kW/hour
Cmax2=Ce*100*dmax2/(24*365) # paise/hour
CE2=Cee*dmax2 # /paise / hour
CT2=Cl2+Cmax2+CE2 # paise (total cost per hour)
print "lamp2 : Total cost/hour = %.2f paise"%(CT2)
print "on comparing cost it is clear lamp1 will be more economical. "
#let load factor = x
#Cl1+Cmax1/x+CE1=Cl2+Cmax2/x+CE2
x=(Cmax1-Cmax2)/(Cl2+CE2-Cl1-CE1)*100 # % load factor
print "\n\n load factor = %.f percent"%(x)
from __future__ import division
# Given
p=4 # pole
I1=143 # A
Z=492 # armature conductors
theta=10 # degree
I2=10 # A
Ia=I1+I2 # A
Iw=Ia/2 # A for wave sound
Il=Ia/4 # for lap sound
#part(a)
ATw=Z*Iw*theta/360 # AT
nw=ATw/theta # turns
print "(a) extra shunt field turns required = %d"%(nw)
#part(b)
ATl=Z*Il*theta/360 # AT
nl=ATl/theta # turns
print "(b) extra shunt field turns required = %d"%(nl)
#answer wrong for part(a) in the boko.
from __future__ import division
from numpy import roots
# Given
Wh=250 # W
We=100 # W
N=1000/60 # rps
A=Wh/N # constant
B=We/N**2 # constant
Wnew=1/2*(Wh+We) # W
#Wnew=A*N1+B*N1**2
p=[B,A,-Wnew] # polynomial for N1
N1=roots(p) # rps
N1=N1[1]*60 # rpm#discarding -ve vealue
print "New speed will be %.f rpm"%(N1)
from __future__ import division
# Given
P=50 # kW
V=250#V
N1=400 # rpm
Ra=0.02 # ohm
Rf=50 # ohm
Pi=50 # kW
Vin=250 # V
Vd=1 # V per Brush
I=P*10**3/V#A
Ish=V/Rf # A
Ia=I+Ish # A
Va=Ia*Ra # V
Vbd=2*Vd # V
Eb1=V+Va+Vbd # V
#as motor
I=P*10**3/V#A
Ish=V/Rf # A
Ia=I-Ish # A
Va=Ia*Ra # V
Vbd=2*Vd # V
Eb2=V-Va-Vbd # V
N2=(Eb2/Eb1)*N1 # rpm
print "Speed of the machine running as shunt motor = %.f rpm"%(N2)
from __future__ import division
# Given
VL=250 # V
Is=50 # A
Ia=380 # A
If1=5 # A
If2=4.2 # A
ra=0.02 # ohm
#Machine Losses:
ma_cu_loss=Ia**2*ra # W (motor armature cu loss)
ga_cu_loss=(Ia-Is)**2*ra # W (generator armature cu loss)
P=VL*Is # W
stray_loss=P-ma_cu_loss-ga_cu_loss # W
stray_loss_per_machine=stray_loss/2 # W
#Motor efficiency
field_cu_loss=VL*If2 # W
total_loss=ma_cu_loss+field_cu_loss+stray_loss_per_machine # W
Pin_motor=(VL*Ia)+(VL*ra) # W
Pout_motor=Pin_motor-total_loss # W
Eff=Pout_motor/Pin_motor*100 # %
print "Motor efficiency = %.f percent"%(Eff)
#Generator efficiency
field_cu_loss=VL*If1 # W
total_loss=ga_cu_loss+field_cu_loss+stray_loss_per_machine # W
Pout_generator=VL*(Ia-Is) # W
Pin_generator=Pout_generator+total_loss # W
Eff=Pout_motor/Pin_motor*100 # %
print "Generator efficiency = %.f percent"%(Eff)
from __future__ import division
from math import sqrt
# Given
KVA=4 # kVA
V1=200#V
V2=400#V
f=50 # Hz
Io1=0.8 # A
P1=70 # W
Vs2=17.5 # V
Is2=9 # A
P2=50 # W
#full load
I_loss=P1 # W
I2=KVA*1000/V2 # A
Cu_loss=(I2/Is2)**2*P2 # W
Zo2=Vs2/Is2 # ohm
Ro2=P2/Is2**2 # ohm
Xo2=sqrt(Zo2**2-Ro2**2) # ohm
#(a)
print "Full load efficiency : "
#unity pf
pf=1 # power factor
Output=KVA*pf # kW
Losses=Cu_loss+I_loss # W
eta=Output*1000/(Output*1000+Losses)*100 # %
print "at unity power factor = %.1f percent"%(eta)
#0.8 pf
pf=0.8 # power factor
Output=KVA*pf # kW
eta=Output*1000/(Output*1000+Losses)*100 # %
print "at 0.8 power factor = %.1f percent"%(eta)
#(b)
#(i) unity pf
Vd=I2*Ro2 # V
V22=V2-Vd # V
print "\n\n Voltage drop at unity pf = %.1f V"%(V22)
#(i) 0.8 pf lagging
pf=0.8 # power factor
Vd=I2*(Ro2*pf+Xo2*sqrt(1-pf**2)) # V
V22=V2-Vd # V
print "Voltage drop at 0.8 pf lagging = %.1f V"%(V22)
#(i) 0.8 pf leading
pf=0.8 # power factor
Vd=I2*(Ro2*pf-Xo2*sqrt(1-pf**2)) # V
V22=V2-Vd # V
print "Voltage drop at 0.8 pf leading = %.f V"%(V22)
from __future__ import division
# Given
KVA=15 # kVA
pf=1#
eff=98/100 # efficiency
L1=2 # kW
pf1=0.5 # lagging
t1=12 # hours
L2=12 # kW
pf2=0.8 # lagging
t2=6 # hours
L3=18 # kW
pf3=0.9 # lagging
t3=6 # hours
Po=KVA*pf # kW
Pin=Po/eff # kW
Losses=Pin-Po # kW
Cu_loss=Losses/2 # kW
I_loss=Losses/2 # kW
KVA1=L1/pf1 # kVA
KVA2=L2/pf2 # kVA
KVA3=L3/pf3 # kVA
Cu_loss1=Cu_loss*(KVA1/KVA2)**2 # kW
Cu_loss2=Cu_loss*(KVA2/KVA2)**2 # kW
Cu_loss3=Cu_loss*(KVA3/KVA2)**2 # kW
Cu_loss_t1=Cu_loss1*t1 # kW
Cu_loss_t2=Cu_loss2*t2 # kW
Cu_loss_t3=Cu_loss3*t3 # kW
Cu_loss_total=Cu_loss_t1+Cu_loss_t2+Cu_loss_t3 # kW
I_loss24=I_loss*24 # Wh
Po24=L1*t1+L2*t2+L3*t3 # kWh
Pi24=Po24+Cu_loss_total+I_loss24 # kWh
eff_allday=Po24/Pi24*100 # %
print "All day efficiency = %.f percent"%(eff_allday)
from __future__ import division
from math import sqrt
# Given
V1=250 # V
V2=150 # V
Vs1=200 # V
Load1=5 # kW
pf1=0.8 # lagging
Load2=2 # kW
pf2=1 # unity
Vs2=100 # V
I1=Load1*1000/V1/pf1 # A
t1_ratio=V1/Vs1 #
Ip1=I1*t1_ratio # A at 0.8 pf (current drawn by primary)
I2=Load2*1000/Vs2/pf2 # A
t2_ratio=Vs2/V2 #
Ip2=I2*t2_ratio # A at 0.8 pf (current drawn by primary)
Ipx=Ip1*pf1+Ip2 # A
Ipy=Ip1*sqrt(1-pf1**2) # A
I3=sqrt(Ipx**2+Ipy**2) # A
print "Current drawn by the transformer=%.2f A"%(I3)
pf=Ipx/I3 # power factor
print "power factor = %.1f lagging"%(pf)
from __future__ import division
from math import sqrt,atan,cos
# Given
R2=0.03 # ohm
X2=0.18 # ohm
Ns=100 # rpm
s1=3 # %
Nfl=(100-s1) # rpm (full load speed)
N2=Nfl/2 # rpm
s2=(Ns-N2)/Ns*100 # %
V1BYV2=sqrt(s2/s1*(R2**2+(s1/100*X2)**2)/(R2**2+(s2/100*X2)**2)) # from torque equation
#let V1=V12BYV1 V2=1
V1=V1BYV2 # V
V2=1 # V
V12BYV1=(V1-1)/V1*100 # % reduction in the stator (V12=V1-V2)
print "Percentage reduction in stator voltage = %.f percent"%(V12BYV1)
fi=atan(s2/100*X2/R2) # radian
pf=cos(fi) # power factor
print "power factor = %.1f"%(pf)
from __future__ import division
from math import sqrt
# Given
zo=1+1J*1 # ohm
zi=0.2+1J*4 # ohm
Ri=zi.real # ohm
Ro=(zo).real # ohm
#at standstill
s=1 # % at standstill
Zo=sqrt((zo).real**2+(zo).imag**2) # ohm
Zi=sqrt((zi).real**2+(zi).imag**2) # ohm
ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio
print "(a) at standstill, To:Ti = %d:1"%(ToBYTi)
#at s=0.5
s=0.05 # %
Zo=sqrt((zo).real**2/s**2+(zo).imag**2) # ohm
Zi=sqrt((zi).real**2/s**2+(zi).imag**2) # ohm
ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio
print "(b) at s=0.05, To:Ti = %.1f:1"%(ToBYTi)
from __future__ import division
from math import sqrt
# Given
Edc=500 # V
fim=.085 # Wb
f=50 # Hz
E1=11000 # V
P=1500 # kW
p=8 # pole
pf=0.9
V=500 # V
J=3 # A/mm**2
E2=Edc/sqrt(2)#V
N2=E2/4.44/f/fim # no. of turns
N1=E1/E2*N2 # no. of turns
print "no. of turns in primary = %d"%(N1)
print "no. of turns in secondary = %d"%(N2)
Idc=P*10**3/V # A
eta=1 # because of no loss
ISR=0.472*Idc/(eta*pf)
A1=ISR/J*10**-6 # m**2 (cross section area)
I1=N2/N1*ISR # A
A2=I1/J*10**-6 # m**2 (cross section area of primary winding)
print "\ncross section of primary winding=%.2e m**2"%(A1)
print "cross section of secondary winding=%.1e m**2"%(A2)
#ans in the book are not accurate.
from __future__ import division
from math import sqrt
# Given
IscBYIfl=5 # as Isc=5*Ifl
ILByIfl=3 # as IL <= 3*Ifl
sf=5 # %
#IL=K**2*ISC
#dividing by Ifl
K=sqrt(ILByIfl/IscBYIfl)*100 # %
TstBYTf=(K/100)**2*IscBYIfl*sf/100*100 # % #ratio of torque
print "Suitable auto transformation ratio = %.1f"%(K)
print "Starting torque Tst = %.f percent of full-load torque"%(TstBYTf)
#ans wrong in the textbook.
from __future__ import division
from math import log
# Given
V=500 # V
ns=60 # slots
nc=20 # conductor/slot
ra=1.31 # ohm
Tmax=218 # N-m
fi=23*10**-3 # Wb
Tmin=Tmax/1.5#N-m
Z=ns*nc # no of conductors
Ia=Tmax/(.159*fi*Z) # A
Imax=1.5*Ia # A
I1=Imax # A
I2=Ia # A
R1=V/I1 # ohm
n= log(R1/ra)/log(I1/I2)+1 # no of studs
N=n-1 # no of section
print "no of studs = %d and no. of section = %d"%(n,N)
R2=R1*(I2/I1) # ohm
R3=R2*(I2/I1) # ohm
R4=R3*(I2/I1) # ohm
R1s=R1-R2 # ohm
R2s=R2-R3 # ohm
R3s=R3-R4 # ohm
R4s=R4-ra # ohm
print "\nResistance of 1st section = %.2f ohm"%(R1s)
print "Resistance of 2nd section = %.2f ohm"%(R2s)
print "Resistance of 3rd section = %.2f ohm"%(R3s)
print "Resistance of 4th section = %.2f ohm"%(R4s)
from __future__ import division
from math import log,exp
# Given
theta1=20 # degree C
theta2=35 # degree C
t1=0.5 # hour
t2=1 # hour
theta_m_dashBYthetam=80/100 # temperature rise
#theta=theta_m*(1-e**(-t/alfa))
#theta1/theta2=(1-exp(-t1/alfa))/(1-exp(-t2/alfa))
ee1=theta2/theta1-1 # let ee1=exp(-1/2/alfa)
theta_m=theta1/(1-ee1) # degree C
theta_2=theta_m*(1-ee1**4) # degree C (after 2 hours)
print "temperature rise after 2 hours full load = %.f degree C"%(theta_2)
alfa=-1/2/log(ee1) # hour
alfa_dash=theta_m_dashBYthetam*alfa # hour
theta_m_dash=theta_m_dashBYthetam*theta_m
theta_dash=theta_m_dash*(1-exp(-t2/alfa))
print "temperature rise of cold water after 1 hour = %.f degree C"%(theta_dash)
#ans of 2nd part is wrong in the book.
from __future__ import division
from math import sqrt,cos,pi,sin
# Given
u=30 # degree
m=3 # no of phases
#Id=sqrt(2)*Vs*X*(1-cosd(u))*sin(pi/m)
IdBYVs_dash=m/2/pi*(1-cos(pi/180*u))*sin(pi/m)*sqrt(2) # load current/Vs
#where IdBYVs_dash = m/pi*IdX/2
EdoBYVs=sqrt(2)*m/pi*sin(pi/m) # dc output voltage/Vs with no overlap
EduBYVs=EdoBYVs-IdBYVs_dash # dc output voltage/Vs with overlap
#part (a)
Reg1=(EdoBYVs-EduBYVs)/EdoBYVs*100 # % (regulation)
print "Regulation at no load voltage = %.1f percent"%(Reg1)
#part (b)
Reg2=(EdoBYVs-EduBYVs)/EduBYVs*100 # % (regulation)
print "Regulation at full load voltage = %.1f percent"%(Reg2)
from __future__ import division
from numpy import array
# Given
I12=2000 # A (I12=I1+I2)
R1=0.04 # ohm
R2=0.025 # ohm
rf1=25 # ohm
rf2=20 # ohm
E1=440 # V
E2=420 # V
#E-Vad=V where Vad=I1+V/rf1
#V*(1+R1/rf1)+R1*I1=E1#eqn(1)
#V*(1+R2/rf2)-I1*R2=E2-I12*R2# eqn(2)
A=array([[(1+R1/rf1),R1],[(1+R2/rf2),-R2]])# # matrix for solution
B=array([[E1],[E2-I12*R2]]) # matrix for solution
X=A**-1*B # solution
V=X[0,0] # V
I1=X[1,0] # A
I2=I12-I1 # A
print "Current for each machine = %.f A & %.f A "%(I1,I2)
Po1=V*I1 # W
Po2=V*I2 # W
print "Power output for each machine = %.1f kW & %.1f kW"%(Po1/1000,Po2/1000)
#ans in the book are wrong.
from __future__ import division
from math import atan,pi,cos,degrees
# Given
ZA=0.15+0.5*1J # ohm
ZB=0.1+0.6*1J # ohm
EA=207 # V
EB=205 # V
ZL=2+1.5*1J # ohm
IA=(EA*ZB+(EA-EB)*ZL)/(ZA*ZB+ZL*(ZA+ZB)) # A
IB=(EB*ZA-(EA-EB)*ZL)/(ZA*ZB+ZL*(ZA+ZB)) # A
V2=(IA+IB)*ZL # V
fi_A=degrees(atan((V2).imag/(V2).real)-(atan((IA.imag)/(IA.real))))
pf_A=cos(pi/180*fi_A) # lag
print "pf transformer A = %.2f lag"%(pf_A)
fi_B=degrees(atan((V2.imag)/(V2.real))-(atan((IB.imag)/(IB.real))))
pf_B=cos(pi/180*fi_B) # lag
print "pf transformer B = %.2f lag"%(pf_B)
PA=abs(V2*IA*pf_A) # W
print "power output transformer A = %.f W"%(PA)
PB=abs(V2*IB*pf_B) # W
print "power output transformer B = %.f W"%(PB)
#Power output ans are wrong in the book.
from __future__ import division
# Given
d1=0.05*10**-3 # mm
l1=100*10**-2 # m
i2BYi1=1/4 # current ratio
#(d2/d1)**(3/2)=i2BYi1
d2=(i2BYi1)**(2/3)*d1*10**6 # um
l2=1/2*l1*d1/d2*10**6 # m
print "filament length = %.2f m"%(l2)
print "filament diameter = %.f um"%(d2)
from __future__ import division
# Given
d1=0.10*10**-3 # mm
l1=150*10**-2 # m
i2BYi1=1/3 # current ratio
#(d2/d1)**(3/2)=i2BYi1
d2=(i2BYi1)**(2/3)*d1*10**6 # um
l2=1/2*l1*d1/d2*10**6 # m
print "filament length = %.1f m"%(l2)
print "filament diameter = %.f um"%(d2)
from __future__ import division
from math import sqrt
# Given
zo=2+1J*2 # ohm
zi=0.5+1J*4 # ohm
Ri=(zi).real # ohm
Ro=(zo).real # ohm
#at standstill
s=1 # % at standstill
Zo=sqrt((zo.real)**2+(zo.imag)**2) # ohm
Zi=sqrt((zi.real)**2+(zi.imag)**2) # ohm
ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio
print "(a) at standstill, To:Ti = %d:1"%(ToBYTi)
#at s=0.5
s=0.05 # %
Zo=sqrt((zo.real)**2/s**2+(zo.imag)**2) # ohm
Zi=sqrt((zi.real)**2/s**2+(zi.imag)**2) # ohm
ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio
print "(b) at s=0.05, To:Ti = %.f:10"%(ToBYTi*10)
from __future__ import division
from math import sqrt
# Given
Edc=250 # V
fim=.065 # Wb
f=50 # Hz
E1=6000 # V
P=1500 # kW
p=8 # pole
pf=0.9
V=400 # V
J=3 # A/mm**2
E2=Edc/sqrt(2)#V
N2=E2/4.44/f/fim # no. of turns
N1=E1/E2*N2 # no. of turns
print "no. of turns in primary = %d"%(N1)
print "no. of turns in secondary = %d"%(N2)
Idc=P*10**3/V # A
eta=1 # because of no loss
ISR=0.472*Idc/(eta*pf)
A1=ISR/J*10**-6 # m**2 (cross section area)
I1=N2/N1*ISR # A
A2=I1/J*10**-6 # m**2 (cross section area of primary winding)
print "\ncross section of primary winding=%.2e m**2"%(A1)
print "cross section of secondary winding=%.1e m**2"%(A2)
from __future__ import division
from math import sqrt
# Given
IscBYIfl=4 # as Isc=5*Ifl
ILByIfl=3 # as IL <= 3*Ifl
sf=4 # %
#IL=K**2*ISC
#dividing by Ifl
K=sqrt(ILByIfl/IscBYIfl)*100 # %
TstBYTf=(K/100)**2*IscBYIfl*sf/100*100 # % #ratio of torque
print "Suitable auto transformation ratio = %.1f"%(K)
print "Starting torque Tst = %.f percent of full-load torque"%(TstBYTf)
from __future__ import division
from math import log,exp
# Given
theta1=30 # degree C
theta2=45 # degree C
t1=0.5 # hour
t2=1 # hour
theta_m_dashBYthetam=60/100 # temperature rise
#theta=theta_m*(1-e**(-t/alfa))
#theta1/theta2=(1-exp(-t1/alfa))/(1-exp(-t2/alfa))
ee1=theta2/theta1-1 # let ee1=exp(-1/2/alfa)
theta_m=theta1/(1-ee1) # degree C
theta_2=theta_m*(1-ee1**4) # degree C (after 2 hours)
print "temperature rise after 2 hours full load = %.f degree C"%(theta_2)
alfa=-1/2/log(ee1) # hour
alfa_dash=theta_m_dashBYthetam*alfa # hour
theta_m_dash=theta_m_dashBYthetam*theta_m
theta_dash=theta_m_dash*(1-exp(-t2/alfa))
print "temperature rise of cold water after 1 hour = %.f degree C"%(theta_dash)
from __future__ import division
from math import sqrt
# Given
zo=2+1J*3 # ohm
zi=0.5+1J*5 # ohm
Ri=(zi.real) # ohm
Ro=(zo.real) # ohm
#at standstill
s=1 # % at standstill
Zo=sqrt((zo.real)**2+(zo.imag)**2) # ohm
Zi=sqrt((zi.real)**2+(zi.imag)**2) # ohm
ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio
print "at slip=0, To:Ti = %d:1"%(ToBYTi)
#at s=0.5
s=0.05 # %
Zo=sqrt((zo.real)**2/s**2+(zo.imag)**2) # ohm
Zi=sqrt((zi.real)**2/s**2+(zi.imag)**2) # ohm
ToBYTi=Ro/Ri*(Zi/Zo)**2 # torque ratio
print "at s=0.05, To:Ti = %.f:10"%(ToBYTi*10)
from __future__ import division
from math import sqrt,pi,sin,cos
# Given
u=45 # degree
m=3 # no of phases
#Id=sqrt(2)*Vs*X*(1-cosd(u))*sin(pi/m)
IdBYVs_dash=m/2/pi*(1-cos(pi/180*u))*sin(pi/m)*sqrt(2) # load current/Vs
#where IdBYVs_dash = m/pi*IdX/2
EdoBYVs=sqrt(2)*m/pi*sin(pi/m) # dc output voltage/Vs with no overlap
EduBYVs=EdoBYVs-IdBYVs_dash # dc output voltage/Vs with overlap
#part (a)
Reg1=(EdoBYVs-EduBYVs)/EdoBYVs*100 # % (regulation)
print "part(a) Regulation at no load voltage = %.f percent"%(Reg1)
#part (b)
Reg2=(EdoBYVs-EduBYVs)/EduBYVs*100 # % (regulation)
print "part(b) Regulation at full load voltage = %.f percent"%(Reg2)
from __future__ import division
# Given
d1=0.15*10**-3 # mm
l1=150*10**-2 # m
i2BYi1=1/4 # current ratio
#(d2/d1)**(3/2)=i2BYi1
d2=(i2BYi1)**(2/3)*d1*10**6 # um
l2=1/2*l1*d1/d2*10**6 # m
print "length of filament = %.2f m"%(l2)
print "diameter of filament = %.f um"%(d2)
from __future__ import division
from math import sqrt,sin,pi
# Given
d=5/100 # m
S=-4/100 # m
Ve=3 # kV
theta=45 # degree
e=1.6*10**-19 # C
m=9.67*10**-31 # kg
u=sqrt(2*e*Ve*1000/m) # m/s
uy=u*sin(pi/180*theta) # m/s
vy=0 # since final velocity =0
#vy**2-uy**2=2*ay*S
ay=(vy**2-uy**2)/2/S # m**2/s
#ay=e/m*V/d
V=ay*m*d/e # V
print "Potential difference = %.f V"%(V)
from __future__ import division
from math import pi
from sympy.mpmath import quad
# Given
R=150 # ohm
Vrms=200 # V
Rd1=65 # ohm
Rd2=140 # ohm
Vm=Vrms/sqrt(2) # V
#v=Vm*sin(theta)
Rf=R+Rd1 # ohm
Rb=R+Rd2 # ohm
#i_f=v/Rf # A
#i_b=v/Rb # A
Irms=1/2/pi*(quad(lambda theta:(sqrt(2)*sin(theta))**2,[0,pi])+quad(lambda theta:(sqrt(2)/3*sin(theta))**2,[pi,2*pi]))
Iav=1/2/pi*(quad(lambda theta:sqrt(2)*sin(theta),[0,pi])+quad(lambda theta:sqrt(2)/3*sin(theta),[pi,2*pi]))
print "reading of ammeter 1= %.2f A"%(Irms)
print "reading of ammeter 2 = %.2f A"%(Iav)
P=1/2*(Vrms**2/Rf+Vrms**2/Rb) # W
print "\n\nPower taken from the mains = %.1f W"%(P)
Pc=Irms**2*R # W
Pd=P-Pc # W
print "Power dissipated in rectifying device = %d W"%(Pd)
#Answer wrong in the textbook.