from __future__ import division
%matplotlib inline
from pylab import *
import numpy as np
from math import *
#Variable declaration:
w=2*pi*60 #frequency of voltage(Hz)
R=10 #ohm
C=0.01 #F
Vo=120*sqrt(2) #maximum voltage(V)
Nmax=800
tau=R*C #time constant(s)
#Calculations:
# diode = 1 when rectifier bridge is conducting
diode=1
t=[0]*801
vs=[0]*801
vrect=[0]*801
vR=[0]*801
iB=[0]*801
t=[0]*801
for n in range(1,Nmax+2,1):
t[n-1] = (2.5*pi/w)*(n-1)/Nmax
vs[n-1]=Vo*math.cos(w*t[n-1])
vrect[n-1]=abs(vs[n-1])
#if the rectifier bridge is ON:
if diode==1:
vR[n-1]=vrect[n-1]
if (w*t[n-1])<=(pi/2):
iB[n-1]=vR[n-1]-Vo*C*w*math.sin(w*t[n-1])
elif (w*t[n-1])<=3*pi/2:
iB[n-1]=vR[n-1]/R+Vo*C*w*math.sin(w*t[n-1])
else:
iB[n-1]=vR[n-1]/R-Vo*C*w*math.sin(w*t[n-1])
if iB[n-1]<0:
diode=0
toff=t[n-1]
Voff=vrect[n-1]
else:
vR[n-1]=Voff*exp(-(t[n-1]-toff/tau))
iB[n-1]=0
if (vrect[n-1]-vR[n-1])>0:
diode=1
#Results:
iR=(1/R)*np.array(vR)
plot(1000*np.array(t),vR)
xlabel('time [msec]')
ylabel('voltage [V]')
xlim(0,22)
ylim(0,180)
plot(1000*np.array(t),vrect,'--')
grid()
print "The required plots are shown below:"
show()
plot(1000*np.array(t),iR)
xlabel('time [msec]')
ylabel('source current [A]')
xlim(0 ,22)
ylim(-50,250)
plot(1000*np.array(t),1.5*np.array(iB),'--')
grid()
show()
from __future__ import division
%matplotlib inline
from math import *
#Variable declaration:
w=2*pi*60 #Angular freq of voltage(rad/sec)
Vo=230*sqrt(2) #volt
R=5.6 #Resistance(ohm)
#Calculations:
Ls=[0]*101
tc=[0]*101
Idc=[0]*101
for n in range(1,101,1):
Ls[n-1]=n*10**-3
Idc[n-1]=2*Vo/(pi*R+2*w*Ls[n-1])
tc[n-1]=(1/w)*acos(1-(2*Idc[n-1]*w*Ls[n-1])/Vo)
#Results:
plot(1000*np.array(Ls),Idc,'g.')
xlabel('Commutating inductance Ls [mH]')
ylabel('Idc [A]')
title('Load current,Idc vs Commutating inductance,Ls')
show()
plot(1000*np.array(Ls),1000*np.array(tc),'g.')
xlabel('Commutating inductance L [mH]')
ylabel('tc [msec]')
title('Commutating Inductance,Ls vs time,tc')
show()
from __future__ import division
%matplotlib inline
from math import *
#Variable declaration:
R=12.5*10**-3 #ohm
L=1.2 #H
Vo=15 #volt
w=120*pi #angular freq(Hz)
Idc=35 #DC current(A)
#Calculations:
#for part (a):
theta=[0]*1301
t=[0]*1301
vL=[0]*1301
vs=[0]*1301
Vdc_a=R*Idc #Dc voltage(V)
P=Vdc_a*Idc #Power
alpha_da = acos(pi*R*Idc/(2*Vo)) ; #delay angle
for n in range(1,1301,1): #loop for calculating load voltage
theta[n-1]=2*pi*(n-1)/1000
t[n-1]=theta[n-1]/w
vs[n-1]=Vo*sin(theta[n-1])
if theta[n-1]<alpha_da:
vL[n-1]=-vs[n-1]
elif (theta[n-1]<pi+alpha_da):
vL[n-1]=-vs[n-1]
elif theta[n-1]<2*pi+alpha_da:
vL[n-1]=vs[n-1]
elif theta[n-1]<3*pi+alpha_da:
vL[n-1]=vs[n-1]
elif theta[n-1]<4*pi+alpha_da:
vL[n-1]=-vs[n-1]
else:
vL[n-1]=vs[n-1]
figure(1)
plot(1000*np.array(t),vL,'g.')
xlabel('time [msec]')
ylabel('Load voltage [V]')
grid()
show()
#part(b):
alpha_db=0.9*pi #delay angle
Vdc_b=(2*Vo/pi)*cos(alpha_db) #new dc voltage(V)
tau=L/R #time constant(s)
imo=Idc #Initial curent(A)
tzero=-tau*log((-Vdc_b/R)/(imo-Vdc_b/R))
for n in range(1,1301,1):
theta[n-1]=2*pi*(n-1)/1000
t[n-1]=theta[n-1]/w
vs[n-1]=Vo*sin(theta[n-1])
if theta< alpha_db:
vL[n-1]=-vs[n-1]
elif (theta[n-1]<pi+alpha_db):
vL[n-1]=vs[n-1]
elif theta[n-1]<2*pi+alpha_db:
vL[n-1]=-vs[n-1]
elif theta[n-1]<3*pi+alpha_db:
vL[n-1]=vs[n-1]
elif theta[n-1]<4*pi+alpha_db:
vL[n-1]=-vs[n-1]
else:
vL[n-1]=vs[n-1]
#Results:
figure(2)
plot (1000*np.array(t), vL,'g.')
xlabel('time [msec] ')
ylabel('Load voltage [V]')
print "part (a):"
print "\n Vdc_a=",round(1000*Vdc_a,2),"mV"
print "\n Power=",round(P),"W"
print "\n alpha_d=",round((180/pi)*alpha_da,1),"degrees"
print "\n part (b):"
print "\n alpha_d=",round((180/pi)*alpha_db,1),"degrees"
print "\n Vdc_b=",round(Vdc_b,1),"V"
print "\n Current will reach zero at",round(tzero,1),"sec"
grid()
show()
from __future__ import division
from sympy import *
import math
#Variable declaration:
f=60 #Hz
Vrms=35 #rms voltage of waveform
Ra=3.5 #Armature resistance(ohm)
La=0.175 #H
no=8000 #No load speed(r/min)
Va=50 #armature voltage(V)
#Calculations:
Edc,alphad=symbols('Edc alphad')
Vdc=Edc #at no load, Vdc=Edc
Edc=round(float(2*sqrt(2)*(Vrms/math.pi)),2)*cos(alphad)
n=Edc*float(no/50)
#Results:
print "Speed at no-load =",n," r/min (where 0 <= alphad <= pi/2)"
from __future__ import division
from math import *
#Variable declaration:
Vll_rms=460 #rms voltage,line-to-line(V)
R=68 #resistance of load
Im=2.5 #magnet current(A)
#Calculations:
Vdc_max=3*sqrt(2)*Vll_rms/pi
Idc_max=Vdc_max/R
Vdc=Im*R
alpha=acos(pi*Vdc/(3*sqrt(3)*Vll_rms))
#Results:
print "(a) Maximum dc voltage:",round(Vdc_max),"V"
print "\n Maximum dc current:",round(Idc_max,1),"V"
print "\n(b) Delay angle alpha:",round(math.degrees(round(alpha,1)),1),"degrees"
from __future__ import division
from math import *
#Variable declaration:
T=20*10**-3 #Time period(sec)
p=4 #no. of poles
delta=0.44 #ON- time fraction
Vo=125 #DC supply voltage(V)
#Calculation:
fc=1/T
ns=(120*fc/p)
Va_peak=(4*Vo*sin(delta*pi))/pi
Vll_rms=sqrt(3/2)*Va_peak
#Results:
print "(a) Frequency:",fc,"Hz"
print "\n Synchronous speed:",ns,"r/min"
print "\n(b) Rms amplitude of line-to-line voltage:",round(Vll_rms,0),"V"
from __future__ import division
from math import *
#Variable declaration:
Vo=48 #Load voltage(V)
R=3.7 #Resistance of load(ohm)
L=.32 #Inductance of laad(H)
D=0.8 #Duty cycle
f=1000 #Hz
#Calculations:
iL_avg=(2*D-1)*Vo/R
T=1/f
tau=L/R
iL_min=((-Vo/R)*(1-2*exp(-T*(1-D)/tau)+exp(-T/tau)))/(1-exp(-T/tau))
iL_max=(Vo/R)*(1-2*exp(-D*T/tau)+exp(-T/tau))/(1-exp(-T/tau))
#since T/tau << 1, so using 10.32 in e.g. given.
del_iL=(2*Vo)*T*D*(1-D)/(R*tau)
#Results:
print "Avg load current:",round(iL_avg,2),"A"
print "Minimum load current:",round(iL_min,2),"A"
print "Maximum load current",round(iL_max,2),"A"
print "Current ripple:",round(del_iL,2),"A"