from __future__ import division
from sympy import symbols, simplify
from math import pi, sin, cos, sqrt
#form factor,ripple factor ,transformation utilization factor and peak inverse voltage
Vm=1 #assume
R=1 #assume
alfa = pi/3 # radian
Vm = symbols('Vm', real = True)
Vldc = Vm/2/pi*(1+cos(alfa))
Vlrms = Vm*sqrt(1/4/pi*(pi-pi/3)+1/4/pi*sin(2*pi/3))
ff=Vlrms/Vldc
print "part (a):"
print "form factor is",round(ff,3),"or",round(ff*100,1),"%"
#form factor is calculated wrong in the textbook
print "part (b)"
rf=sqrt(ff**2-1) #
print "ripple factor is",round(rf,2),"or",round(rf*100),"%"
#ripple factor is calculated wrong in the textbook
Vs=Vm/(sqrt(2)) #rms secondary voltage
Is=Vlrms/R #
TUF=((Vldc**2)/R)/(Vs*Is) #
print "part (c)"
print "transformation utilization factor is",round(TUF,3),"or",round(TUF*100,1),"%"
#transformation utilization factor is calculated wrong in the textbook
R=1 #assume
Vm=1 #assume
print "part (d)"
print "PIV=Vm"
from __future__ import division
from numpy import array, sqrt, pi, nditer, cos, sin
#plot the variation
vsrms=230 #volts
vm=sqrt(2)*vsrms #volts
alpha=array([0,30, 60, 90, 120, 150, 180]) #degree
x=array([0,(30*(pi/180)),(60*(pi/180)),(90*(pi/180)),(120*(pi/180)),(150*(pi/180)),(180*(pi/180))])
def cur(alpha,x):
it = nditer([alpha,x,None, None])
for a,b,c,d in it:
c[...]=(vm/pi)*(1+cos(a*pi/180)) #
d[...]=vsrms*((1/pi)*(pi-b+(sin(2*b))/2))**(1/2)
return it.operands
vldc = cur(alpha,x)[2]
vlms = cur(alpha,x)[3]
from matplotlib.pyplot import subplot, xlabel, ylabel, title, plot, ylim, show
%matplotlib inline
subplot(1,3,1)
xlabel("alpha") #
ylabel("Vldc") #
title('(a) Variation of average load voltage')
plot(alpha,vldc) #
subplot(1,3,3)
xlabel("alpha") #
xlabel("Vlrms") #
title('(b) Variation of RMS load voltage')
plot(alpha,vlms) #
ylim(40,250)
show()
from __future__ import division
from math import pi, sqrt, degrees, acos
from numpy import arange
#delay angle,rms , averae output current ,average and rms thyristor current
Vrms=120 #RMS VOLTAGE
R=10 #in ohms
Vldc= (0.25*(2*sqrt(2)*Vrms))/pi #in volts
csd= (Vldc*pi)/(sqrt(2)*Vrms) #
alpha= degrees(acos(csd-1)) #
print "part (a)"
print "delay angle = %0.2f degree" %alpha
Vrms=120 #RMS VOLTAGE
Vm=sqrt(2)*Vrms #assume
t=arange(2*pi/3,pi,0.1)
Vlms=((Vm/(sqrt(2)))*(((1/pi)*((pi-(2*pi)/3)+sin(4*pi/6*pi/180))))**(1/2))
Vldc= (0.25*(2*sqrt(2)*Vrms))/pi #in volts
Ildc=Vldc/R #average load current in ampere
Ilms=Vlms/R # rms load current in ampere
print "part (b)"
print "rms load current = %0.2f A" %Ilms
print "average load current = %0.2f A" %Ildc
#rms load current is calculated wrong in the textbook
Im=Vm/R #
from sympy.mpmath import quad, sin
f1 = lambda omega_t : Im*sin(omega_t)
Ith = (1/(2*pi)*(quad(f1,[alpha*pi/180,pi]))) # A (calculating integration)
f2 = lambda omega_t : (Im*sin(omega_t))**2
Ithrms = sqrt(1/(2*pi)*(quad(f2,[alpha*pi/180,pi]))) # A (calculating integration)
print "part (c)"
print "average thyristor current = %0.2f A" %Ith
print "rms thyristor current = %0.2f A" %Ithrms
#average load voltage,rms load voltage,average and rms load currents ,form factor and ripple factor
R=10 #IN OHMS
r=10 #IN OHMS
Vi=230 #in volts
alpha=60 #fiirng angle in degree
Vm=Vi*sqrt(2) #in voltas
Vldc=((Vm)/pi)*(1+cos(alpha*pi/180)) #average load voltgae
print "part (a)"
print "average load voltage = %0.2f Volts" %Vldc
print "part (b)"
r=10 #IN OHMS
Vi=230 #in volts
alpha=60 #fiirng angle in degree
Vm=Vi*sqrt(2) #in voltas
Vlms=((Vm/(sqrt(2)))*(((pi-pi/3)+(sin(2*pi/3*pi/180))/2)/pi)**(1/2)) #
print "rms load voltage = %0.2f V" %Vlms
#rms voltage is calculated wrong in the textbook
print "part (c)"
Ildc=Vldc/R # in amperes
Irms=Vlms/R # in amperes
print "rms load current = %0.2f A" %Irms
print "average load current = %0.2f A" %Ildc
#rms load current is wrong in the textbook
print "part (d)"
ff=Vlms/Vldc
print "form factor is =",round(ff,2),"or",round(ff*100,2),"%"
rf=sqrt(ff**2-1) #
print "ripple factor =",round(rf,2),"or",round(rf*100,2),"%"
#form factor and ripple factor is calculated wrong in the textbook
from numpy import array, nditer, sqrt, pi, cos
from __future__ import division
#device ratings
Io=25 #in amperes
Vsrms=120 # in colts
Vm=sqrt(2)*Vsrms # in volts
alpha=array([0,60,90,135,180])
def volt(alpha):
it = nditer([alpha, None])
for a,b in it:
b[...]=Vm/pi*(1+cos(a*pi/180))
return it.operands[1]
vldc = volt(alpha)
print "alpha : ",
for a in nditer([alpha]):
print a,'\t',
print ""
print "VLdc(V) : ",
for a in nditer([vldc]):
print a,'\t',
print ""
PIV=Vm #peak inverse voltage
Iascr=Io/2 #scr average currentin ampere
Iadod=Io #average diode current in amperes
Ipscr=Iascr #peak current rating for SCR in amperes
Ipdod=Iadod #peak current rating for diode in amperes
print "scr average current = %0.2f A" %Iascr
print "Average diode current = %0.2f A" %Iadod
print "Peak current rating for SCR = %0.2f A" %Ipscr
print "Peak current rating for diode = %0.2f A" %Ipdod
from math import sin
#Vldc,Vn,Vlrms,HF,DF and PF
Vsrms=120 #in volts
alpha=pi/2 #
vm=sqrt(2)*Vsrms #
vldc=((sqrt(2)*Vsrms)/(pi))*(1+cos(alpha)) #in volts
vldcm=(2*vm)/(pi) #in volts
vn=vldc/vldcm #normalised average output voltage in volts
x=((1/pi)*((pi-alpha)+(sin((2*alpha)))/2))**(1/2) #
vlrms=((vm/sqrt(2))*x) #RMS load voltage in volts
Io=1 #assume
Isrms=Io*(1-(alpha/pi))**(1/2) #in amperes
Is1rms=((2*sqrt(2))*Io*cos(alpha/2))/(pi) #in amperes
HF=((Isrms/Is1rms)**2-1)**(1/2) #Harmonic Fator is
DF=cos(alpha/2) #Displacement factor
PF=(Is1rms/Isrms)*(DF) #power factor
print "average output voltage, Vldc = %0.2f V" %round(vldc)
print "Normalised average output voltage, Vn = %0.2f V" %vn
print "RMS load voltage, Vlrms = %0.2f V" %vlrms
print "Harmonic factor, HF = %0.2f %%" %(HF*100)
print "Displacement factor, DF = %0.2f %%" %(DF*100)
print "Power factor, PF = %0.4f lagging" %PF
from math import degrees, acos
#alpha
print "part (a)"
vc=135 #in volts
vs=220 #in vlts
rl=0.5 #in ohms
io=10 #in ampeeres
vm=sqrt(2)*vs #
vldc=io*rl+vc #
alpha=degrees(acos((vldc*pi)/(2*vm))) #
print "alpha = %0.f degree "%alpha
print "part (b)"
vc=145 #in volts
vs=220 #in vlts
rl=0.5 #in ohms
io=10 #in ampeeres
vm=sqrt(2)*vs #
vldc=io*rl-vc #
alpha=degrees(acos((vldc*pi)/(2*vm))) #
print "alpha = %0.f degree "%(alpha)
#average output voltage,supply rms current ,
#supply fundamental current current,displacement factor,supply factor and supply harmonic factor
Vsrms=220 #in volts
alpha=pi/3 #
vm=sqrt(2)*Vsrms #
vldc=((2*vm)/(pi))*(cos(alpha)) #in volts
vldcm=(2*vm)/(pi) #in volts
vn=vldc/vldcm #normalised average output voltage in volts
x=((1/pi)*((pi-alpha)+(sin((2*alpha)))/2))**(1/2) #
vlrms=((vm/sqrt(2))*x) #RMS load voltage in volts
Io=1 #assume
Isrms=Io*(1-(alpha/pi))**(1/2) #in amperes
Is1rms=((2*sqrt(2))*Io*cos(alpha/2))/(pi) #in amperes
HF=((Isrms/Is1rms)**2-1)**(1/2) #Harmonic Fator is
DF=cos(alpha/2) #Displacement factor
PF=(Is1rms/Isrms)*(DF) #power factor
print "part (a)"
print "average output voltage, Vldc = %0.2f V" %round(vldc)
print "part (b)"
print "due to exact 50% duty cycle the rms value of supply current Isrms=Io"
Io=1 #assume
Isrms=Io #in amperes
Is1rms=((2*sqrt(2))*Io)/(pi) #in amperes
print "part (c)"
print "supply fundamental current =",Is1rms,"Io "
print "part (d)"
DF=cos(alpha) #
print "displacement factor =",DF
print "part (e)"
SPF=Is1rms*DF #
print "supply power factor = %0.2f lagging " %SPF
print "part (f)"
HF=(((Isrms/Is1rms)**2)-1)**(1/2) #
print "supply harmonic factor = %0.2f %%" %(HF*100)