#Claculate alpha and No. of electrons emmited
from math import log,e
#Claculate
#(a)alpha
d2 = 0.01
d1 = 0.005
I2 = 2.7*10**-7
I1 = 2.7*10**-8
alpha = 1/(d2-d1)*log(I2/I1)
#(b)number of electrons emmited from cathode per second
I0 = I1*e**(-alpha*d1)
n0 = I0/(1.6*10**-19)
print"Part (a)\n alpha = %.1f m^-1"%alpha
print"Part (b)\n I0 = %.1e "%I0
print"No of electrons emitted = %.3e electrons/s"%n0
#Answer may vary due to round off error
#Chapter 4, Exmaple 2, page 140
#Claculate electrode space
from math import log
#based on the values of example 1
d2 = 0.01
d1 = 0.005
I2 = 2.7*10**-7
I1 = 2.7*10**-8
a = 1/(d2-d1)*log(I2/I1) # alpha
#10**9 = %e**a(a*d)
#multiplying log on bith sides log(10**9) = a*d
ad = log(10**9)
print"a*d = ",ad
d = ad/a
print"electrode space = %.3f m"%d
#Chapter 4, Exmaple 3, page 140
#Claculate size of developed avalanche
from scipy import integrate
a = 4*10**4
b = 15*10**5
#Rewriting equation 4.2
x0=0;x1=0.0005;
def fun1(x):
y=a-b*(x)**0.5
return y
X=integrate.quad(fun1,x0,x1);
expX=6765.964568
As = expX # Avelanche size
print"Avalanche size = %.0f m"%As
#Answers may vary due to round of error
#Claculate distance to produce avalanche
#Rewrite equation 4.2 , using the values of a and b from previous example
from numpy import array,roots
p=array([7.5*10**5, -4*10**4, 59.97])
r=roots(p)
#obtaining the roots
print"\n %f m or %f m away from the cathode"%(round(r[0],4),round(r[1],5))
#Answer may vary due to round of error.
#Claculate minimum distance to produce avalanche of size 10^19
#Rewriting equation 4.2 and converting it into quadratic equation
#x=poly(0,"x");
from numpy import array,roots
p=array([7.5*10**5, 4*10**4, 43.75])
r=roots(p)
#obtaining the roots
print"\n Minimum distance = m",round(-r[1],4)# other root is disregarded
#Answer may vary due to round of error.
#Claculate secondary coefficient
from math import exp
#Using equation 3.15
E = 9*10**3/0.002
T = 11253.7 # m^-7*kPa^-1
B = 273840 # V/mkPa
p = 101.3 # kPa or 1 atm
d = 0.002 # m
alpha = p*T*exp(-B*p/E)
Y = 1/(exp(alpha*d)-1)
print"\n E = %.1e V/m"%E
print"Alpha = %.2f m^-1"%alpha
print"Total secondary coefficient of ionization = %f "%round(Y,5)
#Answer may vary due to round off error
#Claculate first and secondary ionization coefficient
from math import log
from math import exp
#(a)first ionization coefficient
#Using equation 4.7a
d1 = 0.005
a1d1 = log(1.22)
a1 = a1d1/d1
d2 = 0.01504
a2d2 = log(1.82)
a2 = a2d2/d2
d3 = 0.019 # wrong value used in the text
a3d3 = log(2.22)
a3 = a3d3/d3
print"Alpha 1 = %.1f m^-1"%round(a1,1)
print"Alpha 2 = %.1f m^-1"%round(a2,1)
print"Alpha 3 = %.2f m^-1"%round(a3,2)
print"From the above results we can understand that ionization mechanism must be acting at d3 "
#secondary ionization coefficient
I = 2.22
e = exp(a1*d3)
Y = (I-e)/(I*(e-1.))
print"secondary ionization coefficient = ",round(Y,4)
#Answer may vary due to round off error.
#Claculate distance and voltage
from math import log
a = 39.8 # alpha
Y = 0.0354 # corfficient
p = 0.133 # kPa
Ep = 12000 # E/P , unit : V/m*kPa
d = (1/a)*(log(1/Y + 1)) # distance
E = Ep*p
V = E*d
print"Distance = %.3f m"%round(d,3)
print"E = %d V/m"%E
print"Volatge = %.2f V"%round(V,2)
#Answers may vary due to round off error
#Claculate (a)Raether's criterion (b)Meek and Lobe's criterion
from math import log
#(a)Raether's criterion
# as assumed by Raether and based equation 3.3, 3.50, 4.22 and 4.23
d = 0.001 # m
alpha = 10792.2 # m**-1
p = 101.3 #kPa**-1
ap = 106.54 # alpha/p Unit: m**-1*kPa**-1
T = 11253.7 # m**-1*kPa**-1
B = 273840 # V/m*kPa
Ep = 58764.81 # E/p Unit:V/m*kPa
ad = 17.7 + log(d)
E = Ep*p
Vs = E*d*10**-3 #Voltage breakdown
print"E = %.4e V/m"%E
print"Voltage breakdown = %.2f kV"%round(Vs,2)
#(b)Meek and Loeb's criterion
#Using equation 4.11 and based on 4.24 & 4,25
#+ we get Er = 468*10**4 V/m
Er = 468*10**4 # V/m
Vs2 = Er*0.001*10**-3
print"\nVoltage breakdown = %.2f kV"%Vs2
# Answers may vary due to round of error
#Claculate the first Townsend's ionization coefficient
t = 0.2*10**-6 # transit time of electrons in seconds
d = 0.05 # m
ve = d/t
TC = 35*10**-9 # Time constant
a = 1/(ve*TC)
print"Electron drift velocity =%.2e m/s"%ve
print"alpha = %.1f m**-1"%round(a,1)
#Travel time and maximum frequency
from math import pi
from math import asin
#(a)Determine the travel time
Ea = 200*(2)**0.5*10**3/0.1
x = 1.4*10**-4*2828.4*10**3/(2*pi*50)
d = 0.1
print"\nEa = %.4e V/m"%Ea
print"x = %.3f*sin(3.14*t)"%x
#obtaining t from x
t = asin(d/x)/3.14
print"t = %.3f ms"%t# answer mentioned in the text is wrong
#(b)Determine the maximum frequency
k = 1.4*10**-4
fmax = k*Ea/(2*pi*d)
print"fmax = %.1f Hz"%round(fmax,1)