# Chapter 2 - The Semiconductor Diode¶

## Example 2_1 Page No. 35¶

In :
from __future__ import division
from math import exp
IR=50*10**(-9)
print "IR = %0.2e "%(IR)," ampere" # value of Reverse saturation current
VT=26*10**(-3)
print " Thermal voltage,VT= %0.2f "%(VT),"volt"
VAK1=(-0.25)# diode junction voltage
print "Junction voltage,VAK1= %0.2f"%(VAK1),"volt"
IA =IR*(exp(VAK1/(2*VT))-1)# formulae for diode current
print "Diode current,IA =IR*(exp(VAK1/(2*VT))-1)= %0.2e "%(IR*(exp(VAK1/(2*VT))-1))," ampere" # calculation
VAK2=(+0.25)
print "Junction voltage,VAK2= %0.2f"%(VAK2),"volt"
IA =IR*(exp(VAK2/(2*VT))-1)
print "Diode current,IA =IR*(exp(VAK2/(2*VT))-1)= %0.2e "%(IA)," ampere" # calculation
VAK3=(+0.5)
print "Junction voltage,VAK3= %0.2f"%(VAK3),"volt"
print "Diode current,IA =IR*(exp(VAK3/(2*VT))-1)= %0.2e "%(IR*(exp(VAK3/(2*VT))-1))," ampere" # calculation
VAK4=(+0.6)
print "Junction voltage,VAK4= %0.2f"%(VAK4),"volt"
print "Diode current,IA =IR*(exp(VAK4/(2*VT))-1)= %0.2f "%(IR*(exp(VAK4/(2*VT))-1))," ampere" # calculation
VAK5=(+0.7)
print "Junction voltage,VAK3= %0.2f"%(VAK5),"volt"
print "Diode current,IA =IR*(exp(VAK5/(2*VT))-1)= %0.2f "%(IR*(exp(VAK5/(2*VT))-1))," ampere" # calculation
VAK6=(+0.8)
print "Junction voltage,VAK3= %0.2f"%(VAK6),"volt"
print "Diode current,IA =IR*(exp(VAK6/(2*VT))-1)= %0.2f "%(IR*(exp(VAK6/(2*VT))-1))," ampere" # calculation

IR = 5.00e-08   ampere
Thermal voltage,VT= 0.03  volt
Junction voltage,VAK1= -0.25 volt
Diode current,IA =IR*(exp(VAK1/(2*VT))-1)= -4.96e-08   ampere
Junction voltage,VAK2= 0.25 volt
Diode current,IA =IR*(exp(VAK2/(2*VT))-1)= 6.07e-06   ampere
Junction voltage,VAK3= 0.50 volt
Diode current,IA =IR*(exp(VAK3/(2*VT))-1)= 7.50e-04   ampere
Junction voltage,VAK4= 0.60 volt
Diode current,IA =IR*(exp(VAK4/(2*VT))-1)= 0.01   ampere
Junction voltage,VAK3= 0.70 volt
Diode current,IA =IR*(exp(VAK5/(2*VT))-1)= 0.04   ampere
Junction voltage,VAK3= 0.80 volt
Diode current,IA =IR*(exp(VAK6/(2*VT))-1)= 0.24   ampere


## Example 2_2 Page No. 36¶

In :
from __future__ import division
VF=5
print "source voltage,VF = %0.2f "%(VF)+ " volts"#initialization
VD=0.7
print "voltage drop,VD = %0.2f "%(VD)+ " volts"#initialization
R=5*10**(3)
print "resistance,R = %0.2f "%(R)+ "ohm"#initialization
RF=100
print "resistance,R = %0.2f "%(RF)+ "ohm"#initialization
VR=0.6
print "VR = %0.2f "%(VR)+ " volts"#initialization
IA=(VF-VD)/R #formulae
print "Diode current ,IA = %0.2f "%(IA)," ampere" # calculation
IA=(VF-VR)/(R+RF)# Formulae
print " using large signal model,IA = %0.2e "%(IA)," ampere" # calculation
VAK=(VR+IA*RF)# Formulae
print "Junction voltage,VAK = %0.2f"%(VAK)," volts"#calculation

source voltage,VF = 5.00  volts
voltage drop,VD = 0.70  volts
resistance,R = 5000.00 ohm
resistance,R = 100.00 ohm
VR = 0.60  volts
Diode current ,IA = 0.00   ampere
using large signal model,IA = 8.63e-04   ampere
Junction voltage,VAK = 0.69  volts


## Example 2_3 Page No. 38¶

In :
from math import exp
from __future__ import division
VT=26*10**(-3)
print " Thermal voltage,VT= %0.2f "%(VT)," volt"#initialization
IR=50*10**(-9)
print "IR = %0.2f "%(IR)," ampere" # value of Reverse saturation current
VAK1=(0.7)# diode junction voltage
print "Junction voltage,VAK1= %0.2f"%(VAK1)," volt"#initialization
gf=(IR/(2*VT))*exp(VAK1/(2*VT))  #Formulae
print "Forward conductance,gf= %0.2f"%(gf)," mho"
rf=1/gf  #Formulae
print "Forward resistance,rf = %0.2f "%(rf)+ " ohm"
VAK2=(-0.7)
gr=(IR/(2*VT))*exp(VAK2/(2*VT))  #Formulae
print "Reverse conductance,gr= %0.2e"%(gr)," mho"
rr=1/gr  #Formulae
print " Reverse resistance,rr = %0.2e "%(rr)+ " ohm"

 Thermal voltage,VT= 0.03   volt
IR = 0.00   ampere
Junction voltage,VAK1= 0.70  volt
Forward conductance,gf= 0.67  mho
Forward resistance,rf = 1.48  ohm
Reverse conductance,gr= 1.37e-12  mho
Reverse resistance,rr = 7.30e+11  ohm


## Example 2_4 Page No. 39¶

In :
from math import sqrt,pi
Vi=10
print "input voltage,Vi = %0.2f "%(Vi)," volts"  #initialization
Rs=0.2
print "resistance,Rs = %0.2f "%(Rs)+ "ohm"  #initialization
RL=10
print "resistance,RL = %0.2f "%(RL)+ "ohm"  #initialization
VD=0.7
print "input voltage,VD = %0.2f "%(VD)," volts"  #initialization
Vim=Vi*sqrt(2)  #Formulae
Iim=(Vim-VD)/(RL+Rs)  #Formulae
print " Peak load current ,Iim =(Vim-VD)/(RL+Rs) = %0.2f"%(Iim)," ampere" # calculation
Ildc=(2*Iim/(pi))  #Formulae
print " D.C load current ,Ildc =(2*Iim/(pi)) = %0.2f"%(Ildc)," ampere" # calculation
print " diode d.c current ,Iadc =(Ildc/2)= %0.2f "%(Iadc)," ampere" # calculation
PIV=2*Vim  #Formulae
print "peak inverse voltage ,PIV = 2*Vim= %0.2f"%(PIV)," volts" # calculation
Vldc=Ildc*RL  #Formulae
print "D.C output voltage,Vldc=Ildc*RL= %0.2f "%(Vldc)," volts" # calculation

input voltage,Vi = 10.00   volts
resistance,Rs = 0.20 ohm
resistance,RL = 10.00 ohm
input voltage,VD = 0.70   volts
Peak load current ,Iim =(Vim-VD)/(RL+Rs) = 1.32  ampere
D.C load current ,Ildc =(2*Iim/(pi)) = 0.84  ampere
diode d.c current ,Iadc =(Ildc/2)= 0.42   ampere
peak inverse voltage ,PIV = 2*Vim= 28.28  volts
D.C output voltage,Vldc=Ildc*RL= 8.39   volts


## Example 2_5 Page No. 40¶

In :
from math import sqrt,pi
Idc=1*10**(-3)
print " D.C load current ,Idc = %0.2e "%(Idc)," ampere" #initialization
Vi=2.5
print "input voltage,Vi = %0.2f "%(Vi)," volts"#initialization
Vim=Vi*sqrt(2)
VD=0.7
print "voltage drop,VD = %0.2f "%(VD)+ " volts" #initialization
Rm=50
print "resistance,Rm = %0.2f "%(Rm)+ " ohm" #initialization
R=((2/pi)*((Vim-2*VD)/Idc)-Rm) #Formulae
print "resistance,R =[(2/pi)*((Vim-2*VD)/Idc)-Rm]= %0.2f "%(R)+ " ohm"

# NOTE: VALUE OF R=1310 ohm as given in book but here calculated ans is 1309.5231ohm

 D.C load current ,Idc = 1.00e-03   ampere
input voltage,Vi = 2.50   volts
voltage drop,VD = 0.70  volts
resistance,Rm = 50.00  ohm
resistance,R =[(2/pi)*((Vim-2*VD)/Idc)-Rm]= 1309.52  ohm


## Example 2_6 Page No. 45¶

In :
from math import sqrt,pi
Vi=10
print "input voltage,Vi = %0.2f "%(Vi)," volts" #initialization
Vim=Vi*sqrt(2)
f1=50
print "frequency,f1= %0.2f"%(f1)," hertz"  #initialization
RL=1100
print "resistance,RL = %0.2f "%(RL)+ " ohm"  #initialization
C=50*10**(-6)
r=1/((4*sqrt(3))*f1*RL*C) # Formulae
print "Ripple factor,r = %0.2f "%(r),""
x=1/(4*f1*RL*C) # Formulae
VLDC=Vim/(1+x) # Formulae
print "output voltage,VLDC = VLDC=Vim/(1+x)= %0.2f"%(VLDC)," volts" #calculation
VR=(Vim-VLDC)/(VLDC) # Formulae
print " voltage Regulation,VR =(Vim-VLDC)/(VLDC)= %0.2f "%(VR)," volts"  #calculation
Vr=VLDC*r # Formulae
print "Ripple output voltage,Vr = Vr=VLDC*r= %0.2f"%(Vr)," volts"#calculation

input voltage,Vi = 10.00   volts
frequency,f1= 50.00  hertz
resistance,RL = 1100.00  ohm
Ripple factor,r = 0.05
output voltage,VLDC = VLDC=Vim/(1+x)= 12.96  volts
voltage Regulation,VR =(Vim-VLDC)/(VLDC)= 0.09   volts
Ripple output voltage,Vr = Vr=VLDC*r= 0.68  volts


## Example 2_7 Page No. 48¶

In :
VI=10
print "input voltage,VI = %0.2f "%(VI)," volts" #initialization
Vz=5
print "diode voltage,Vz = %0.2f "%(Vz)," volts" #initialization
Rz=100
print "resistance,Rz = %0.2f "%(Rz)+ " ohm"  #initialization
RD=500
print "resistance,RD = %0.2f "%(RD)+ " ohm"  #initialization
DVI=25
print "percentage change in VI,DVI= %0.2f "%(DVI)," volts" #initialization
DVL=(DVI)*(Rz/(RD+Rz))  #Formulae
print "percentage change in VL,DVL=(DVI)*(Rz/(RD+Rz))= %0.2f "%(DVL)," %"
R0=(RD*Rz)/(RD+Rz) #Formulae
print "Output resistance,R0 =(RD*Rz)/(RD+Rz)= %0.2f "%(R0)+ " ohm"
VImax=12.5
Izmax=(VImax-Vz)/(RD+Rz) #Formulae
print "resistance,RD = %0.2f "%(RD)+ " ohm"
PZmax=(Izmax*Vz)  #Formulae
print "Power dissipated,PZmax =PZmax=(Izmax*Vz)= %0.2f "%(PZmax)+ " watt"
Prd=(Izmax*Izmax*RD)  #Formulae
print "Power dissipated,Prd=Prd=(Izmax*Izmax*RD)= %0.2f "%(Prd)+ " watt"
PD=(PZmax+Prd)  #Formulae
print "Power dissipated,PD = %0.2f "%(PD)+ " watt"
RL=0.5*(10**3)
print "resistance,RL = %0.2f "%(RL)+ " ohm" #initialization
P_VR=(R0*100)/RL  #Formulae
print " voltage Regulation Percentage,%%VR =(R0/RL)*(100)= %0.2f "%(P_VR),"% "

input voltage,VI = 10.00   volts
diode voltage,Vz = 5.00   volts
resistance,Rz = 100.00  ohm
resistance,RD = 500.00  ohm
percentage change in VI,DVI= 25.00   volts
percentage change in VL,DVL=(DVI)*(Rz/(RD+Rz))= 0.00   %
Output resistance,R0 =(RD*Rz)/(RD+Rz)= 83.00  ohm
resistance,RD = 500.00  ohm
Power dissipated,PZmax =PZmax=(Izmax*Vz)= 0.06  watt
Power dissipated,Prd=Prd=(Izmax*Izmax*RD)= 0.08  watt
Power dissipated,PD = 0.14  watt
resistance,RL = 500.00  ohm
voltage Regulation Percentage,%VR =(R0/RL)*(100)= 16.60  %


## Example 2_8 Page No. 49¶

In :
Vz=10 #initialization
print "diode voltage,Vz = %0.2f "%(Vz)," volts"
TC1=(10*0.02)/(100) #calculation
print " Zener diode TC1 = %0.2e "%(TC1)," V/degree celsius"
VD=0.7
print " voltage drop,VD = %0.2f "%(VD)," volts"
TC2=(-2.5*10**(-3))  #calculation
print "Si diode TC = %0.2f "%(TC2)," V/degree celsius"
Vref1=VD+Vz
print "Combined voltage ,Vref=VD+Vz= %0.2f "%(Vref1)," volts"
TC3=(TC1+TC2) #calculation
print " Combined TC = %0.2f "%(TC3)," V/degree celsius"
TC=(TC1+TC2)*100/(Vref1) #calculation
print "New Combined TC = (TC1+TC2)*100/(Vref1)= %0.2e"%(TC)," percent/degree celsius"
T1=25#temperature
T2=50# new temperature
Vref=Vref1-((-TC3)*(T2-T1))#calculation
print "New Combined reference voltage ,Vref= Vref1-((-TC3)*(T2-T1))= %0.2f"%(Vref)," volts"

diode voltage,Vz = 10.00   volts
Zener diode TC1 = 2.00e-03   V/degree celsius
voltage drop,VD = 0.70   volts
Si diode TC = -0.00   V/degree celsius
Combined voltage ,Vref=VD+Vz= 10.70   volts
Combined TC = -0.00   V/degree celsius
New Combined TC = (TC1+TC2)*100/(Vref1)= -4.67e-03  percent/degree celsius
New Combined reference voltage ,Vref= Vref1-((-TC3)*(T2-T1))= 10.69  volts


## Example 2_9 Page No. 52¶

In :
Vi1=0.2
print "input voltage,Vi1 = %0.2f "%(Vi1)," volts" #initialization
VD=0.7
print " voltage drop,VD = %0.2f "%(VD)," volts" #initialization
RL=5*(10**3)
print "resistance,RL = %0.2f "%(RL)+ " ohm" #initialization
Vcc=5
print "Supply voltage,Vcc = %0.2f "%(Vcc)," volts"
V01=VD+Vi1 #Formulae
print "output voltage ,V01 ==VD+Vi1 = %0.2f "%(V01)," volts"
IL1=(Vcc-V01)/RL #Formulae
print " output current ,IL1=IL1=(Vcc-V01)/RL = %0.2e "%(IL1)," ampere" # calculation
Vi2=5
print "input voltage,Vi2 = %0.2f "%(Vi2)," volts" #initialization
V02=3*VD #Formulae
print "output voltage ,V02 =3*VD= %0.2f "%(V02)," volts"
IL2=(Vcc-V02)/RL #Formulae
print " output current ,IL2= IL2=(Vcc-V02)/RL = %0.2e "%(IL2)," ampere" # calculation
VAK=V02-Vi2 #Formulae
print " Diode voltage ,VAK = V02-Vi2 = %0.2f "%(VAK)," volts"

#NOTE:correct value of IL2=0.58 mA but in book given as 0.592mA

input voltage,Vi1 = 0.20   volts
voltage drop,VD = 0.70   volts
resistance,RL = 5000.00  ohm
Supply voltage,Vcc = 5.00   volts
output voltage ,V01 ==VD+Vi1 = 0.90   volts
output current ,IL1=IL1=(Vcc-V01)/RL = 8.20e-04   ampere
input voltage,Vi2 = 5.00   volts
output voltage ,V02 =3*VD= 2.10   volts
output current ,IL2= IL2=(Vcc-V02)/RL = 5.80e-04   ampere
Diode voltage ,VAK = V02-Vi2 = -2.90   volts