Vsmin=20 #Source voltage minimum(V)
Vsmax=40 #Source voltage maximum(V)
Vbd=10 #Breakdown voltage(V)
R=0.82 #Resistance(KOhm)
Vr1=Vsmin-Vbd #voltage across resistor(V)
Is1=Vr1/R #Minimum current(mA)
Vr2=Vsmax-Vbd #voltage across resistor(V)
Is2=Vr2/R #Maximum current(mA)
print 'Ideally, zener diode acts as a battery(of breakdown voltage = 10V) shown in figure 5-4b'
print 'Minimum current Is1=',round(Is1,2),'mA'
print 'Maximum current Is1=',round(Is2,2),'mA'
Vs=18 #supply voltage(V)
Rs=0.27 #source resistance(KOhm)
RL=1 #Load resistance(KOhm)
Vz=10 #Zener voltage(V)
VTH=(RL/(Rs+RL))*Vs #Thevenin voltage(V)
print 'Thevenin voltage VTH = ',round(VTH,2),'V'
print 'Thevenin voltage is greater than zener voltage, zener diode is operating in breakdown region.'
Vs=18 #supply voltage(V)
Rs=0.27 #source resistance(KOhm)
RL=1 #Load resistance(KOhm)
Vbd=10 #Zener voltage(V)
Vr=Vs-Vbd #voltage across resistor(V)
Is=Vr/Rs #Current(mA)
IL=Vbd/RL #Current(mA)
Iz=Is-IL #Zener current(mA)
print 'Load current IL = ',IL,'mA'
print 'Zener current Iz = ',round(Iz,2),'mA'
Iz=20 #zener current(mA)
Rz=8.5 #zener resistance(Ohm)
Vbd=10 #Zener voltage(V)
DVL=Iz*Rz/1000 #change in load voltage(V)
VL=Vbd+DVL #Load voltage(V)
print 'Change in load voltage DVL =',DVL,'V'
print 'Load voltage with second approx., VL =',VL,'V'
Rs=270 #Source resistance (Ohm)
Rz=8.5 #zener resistance(Ohm)
VRin=2 #Zener voltage(V)
VRout=(Rz/Rs)*VRin*1000 #Load ripple voltage(V)
print 'Load ripple voltage VRout=',round(VRout,2),'mV'
Vil=22 #input voltage range low(V)
Vih=30 #input voltage range high(V)
Vz=12 #regulated output voltage(V)
Rl=140 #Load resistance low(KOhm)
Rh=10 #Load resistance high(KOhm)
RSmax=Rl*(float(Vil)/float(Vz)-1) #Maximum series resistance
print 'Maximum series resistance RSmax =',round(RSmax,2),'V'
Vil=15 #input voltage range low(V)
Vih=20 #input voltage range high(V)
Vz=6.8 #regulated output voltage(V)
Il=5 #Load current low(mA)
Ih=20 #Load current high(mA)
RSmax=(Vil-float(Vz))/Ih*1000 #Maximum series resistance
print 'Maximum series resistance RSmax =',RSmax,'V'
Vi=50 #voatage supply(V)
Rs=2.2 #series resistance(KOhm)
Vf=2 #forward approx. voltage
Is=(Vi-Vf)/Rs
print 'LED current Is =',round(Is,2),'mA'
Vs=9 #voatage supply(V)
Rs=470.0 #series resistance(Ohm)
Vf=2 #forward approx. voltage
Is=(Vs-Vf)/Rs
print 'LED current Is =',round((Is*1000),2),'mA'
import math
Vac=20 #AC voatage supply(V)
Rs=680.0 #series resistance(KOhm)
Vacp=1.414*Vac #peak source voltage(V)
Is1=(Vacp/Rs)*1000 #approx. peak current(mA)
Is2=Is1/math.pi #average of half-wave current through LED(mA)
P=(Vac)**2/Rs #Power dissipation(W)
print 'approx. peak LED current Is1 =',round(Is1,2),'mA'
print 'average of half-wave current through LED Is2 =',round(Is2,2),'mA'
print 'Power dissipation P =',round(P,2),'W'
import math
Vs=120 #AC voatage supply(V)
f=60 #frequency(Hz)
C=0.68 #series resistance(KOhm)
Xc=1/(2*math.pi*f*C)*1000 #capacitive reactance(KOhm)
Vacp=Vs*1.414
Is1=(Vacp/Xc) #approx. peak current(mA)
Is2=Is1/math.pi #average current through LED(mA)
print 'Capacitance reactance Xc = ',round(Xc,2),'KOhm'
print 'approx. peak LED current Is1 =',round(Is1,2),'mA'
print 'average current through LED Is2 =',round(Is2,2),'mA'