from __future__ import division
from math import sqrt, pi, exp
#Intrinsic carrier
#given data :
m=9.11*10**-31## in kg
k=1.38*10**-23## in JK**-1
h=6.626*10**-34## in Js
ev=1.6*10**-19## in J
T=300## in K
me=0.07*m## in kg
mh=0.56*m## in kg
Eg=1.43*ev## in J
ni=2*((2*pi*k*T)/h**2)**(3/2)*(me*mh)**(3/4)*exp(-Eg/(2*k*T))#
print "Intrinsic carrier concentration ,ni = %0.1e m**-3"%ni
#Diffusion potential
from math import log
#given data :
Na=5*10**23## in m**-3
Nd=5*10**21## in m**-3
T=300## in K
e=1.6*10**-19## in J
k=1.38*10**-23## in JK**-1
V=(k*T)/e#
ni=2.2*10**12## in m**-3
Vd=V*log((Na*Nd)/ni**2)#
print "Diffusion potential, Vd = %0.3f V"%Vd
from __future__ import division
#Injection efficiency
#given data :
Na=10**23## in m**-3
Nd=10**21## in m**-3
T=300## in K
e=1.6*10**-19## in J
k=1.38*10**-23## in JK**-1
mue=0.85## in m**2V**-1s**-1
muh=0.04## in m**2V**-1s**-1
De=(mue*k*T)/e## in m**2s**-1
Dh=(muh*k*T)/e## in m**2s**-1
Le=1#
Lh=Le#
eta_inj=1/(1+((De/Dh)*(Lh/Le)*(Nd/Na)))#
print "Injection efficiency, eta_inj = %0.4f"%eta_inj
from __future__ import division
#Internal and quantum efficiency
#given data :
print "part (a)"
tau_rr=1#
tau_nr=tau_rr#
eta_int=1/(1+(tau_rr/tau_nr))#
print "Internal quantum efficiency = %0.2f"%eta_int
print "part (b)"
ns=3.7#
na=1.5#
As=0#
eta_ext=eta_int*(1-As)*((2*na**3)/(ns*(ns+na)**2))#
print "External quantum efficiency = %0.4f"%eta_ext
#The number of longitudinal modes excited
#given data :
lamda=632.8*10**-9## in m
n=1#
L=20*10**-2## in m
del_lamda=((lamda)**2/(2*n*L))*10**9#
print "The number of longitudinal modes excited = %0.3e nm"%del_lamda
from __future__ import division
from math import sqrt, pi, exp,log
#The reduction and Differential quantum efficiency
#given data :
print "part (a)"
alfa_eff=1.5## in mm**-1
gama=0.8#
L=0.5## in mm
R1=0.35#
R2=R1#
R2a=1.0#
g_th1=(1/gama)*(alfa_eff+(1/(2*L))*log(1/(R1*R2)))#
g_th2=(1/gama)*(alfa_eff+(1/(2*L))*log(1/(R1*R2a)))#
del_gth=g_th1-g_th2#
print "The reduction in threshold gain = %0.2f mm**-1"%del_gth
print "part (b)"
eta_D=(gama*(g_th2-alfa_eff))/(g_th2)#
print "Differential quantum efficiency = %0.2f"%eta_D
from math import log10
#Internal and external power efficiency
#given data :
print "part (a)"
As=0##
ns=3.7## assuming that the example 7.4
eta_int=0.50## internal efficiency
V=1.5## in V
I=120*10**-3## in A
IBYe=120*10**-3##
Eph=1.43## in eV
eta_int=0.50## internal efficiency
fi_int=eta_int*IBYe*Eph#
t_power=I*V#
P_int=fi_int/t_power#
print "The internal power efficiency = %0.2f"%P_int
print "part (b)"
eta_ext=eta_int*(1-As)*2/(ns*(ns+1)**2)#
fi_ext=eta_ext*IBYe*Eph#
t_power=I*V#
P_ext=fi_ext/t_power#
print "The external power efficiency = %0.3f"%P_ext
print "part (c)"
V=1.5## in V
I=120*10**-3## in A
IBYe=120*10**-3##
Eph=1.43## in eV
n1=1.5#
n2=1.48#
na=n1#
eta_ext=0.0337#
eta_T=eta_ext*((n1**2-n2**2)/na**2)#
fi_T=eta_T*IBYe*Eph#
t_power=I*V#
sfpc=fi_T/t_power#
O_loss=-10*log10(sfpc)#
print "The overall source fiber power coupling efficiency = %0.2e"%sfpc
print "The optical loss = %0.2f dB"%O_loss