# Example no.5.1
# To calculate (a) the photon incidence rate, (b) the photon absorption rate, and, (c) the quantum efficiency.
# Page no.196
import math
# Given data
lambdaa=550*10**(-9); # The wavelength of electromagnetic wave in m
c=3*10**8; # Speed of ligth in air
h=6.626*10**(-34); # Planck's constant
alpha=10**4; # absorption coefficient
W=3*10**-4; # width of the active region
Pi=1*10**-9; # optical power
eta=0.9; # the fraction of photocarriers that contribute to the photocurrent
Rp=0; # the power transmission coefficient at the air–semiconductor interface
# (a) the photon incidence rate
Eph=(h*c)/lambdaa; # The energy of a photon
Rincident=Pi/Eph; # The photon incidence rate
# Display result on command window
print "\n The photon incidence rate = ",round(Rincident*10**-9,2)," X 10**9 photon/s"
# (b) the photon absorption rate
Rabs=(Rincident*(1-math.exp(-alpha*W))); # The photon absorption rate
# Display result on command window
print "\n The photon absorption rate = ",round(Rabs*10**-9,2)," X 10**9 photon/s"
#c) the quantum efficiency
neta=(1-Rp)*eta*(1-math.exp(-alpha*W)); # The quantum efficiency
# Display result on command window
print "\n The quantum efficiency = ",round(neta,3)
# Example no.5.2
# To calculate (a) the responsivity R and (b) the cutoff wavelength
# Page no.198
import math
# Given data
neta=0.9; # The quantum efficiency
Eg=1.42; # The band-gap energy in eV
lambdaa=1.1; # The operating (free-space) wavelength in micrometer
# (a) The responsivity
R=(neta*lambdaa)/1.24; # The responsivity in A/W
# Display result on command window
print "\n The responsivity = ",round(R,1)," A/W" #Wrong answer in book
# (b) The cutoff wavelength
lambdac=1.2/Eg; #The cutoff wavelength in micrometer
# Display result on command window
print "\n The cutoff wavelength = ",round(lambdac,3)," micrometer" #Wrong answer in book
# Example no.5.3
# To find quantum efficiency at different wavelength and same responsivity
# Page no.199
import math
# Given data
lambda1=0.7; # The radiation wavelength in micrometer
R=0.4; # The responsivity in A/W
lambda2=0.5; # The reduced wavelength in micrometer
neta1=(R*1.24)/lambda1; # The quantum efficiency for 0.7micrometer wavelength
neta2=neta1*(lambda2/lambda1); # The quantum efficiency for reduced wavelength 0.5micrometer
# Display result on command window
print "\n The quantum efficiency for 0.7 micrometer wavelength = ",round(neta1,4)
print "\n The quantum efficiency for reduced wavelength of 0.5 micrometer = ",round(neta2,3)
# Example no.5.4
# To determine the refractive index and thickness of the antireflection coating
# Page no.199
import math
# Given data
lambdaa=680*10**-9; # Wavelength of red ligth in meter
nair=1; # Refractive index of air
nsilicon=3.6; # Refractive index of silicon
nAR=math.sqrt(nair*nsilicon); # Refractive index of antireflection coating
tAR=lambdaa/(4*nAR); # Thickness of antireflection coating
# Display result on command window
print "\n Refractive index of antireflection coating = ",round(nAR,1)
print "\n Thickness of antireflection coating = ",round(tAR*10**9)," nm"
# Example 5.5
# To calculate the inaccuracy with which resonator should be fabricated
# Page no.216
import math
# Given data
R1=0.9; # Reflectivity at point A
integer=4;
n=3.5; # Reflection index of silicon
F=math.pi/(1-math.sqrt(R1)); # The finesse of the resonator and also called as the ratio of the free spectral range
lambda0=850; # Wavelength in nanometer
L=integer*lambda0/(2*n); # Resonator length in nanometer
# The inaccuracy with which resonator should be fabricated
deltaL=L*0.5/F;
# Display result on command window
print "\n Resonator length = ",round(L),"nm"
print "\n The inaccuracy in length with which resonator should be fabricated = ",round(deltaL)," nm"
# Example no.5.6
# To find the peak current if (a) LO power = 10 dBm, (b) LO power = −10 dBm for the single-branch receiver
# Page no.229
import math
# Given data
L=100; # Length of fiber
loss=0.2*L; # Total fiber loss
PtdBm=12; # The peak power of the signal at the transmitter
R=0.9; # Responsivity in A/W
PrdBm=PtdBm-loss; # The power at the receiver
# (a) the peak current LO power = 10 dBm
PLO1dBm=10; # Power at local oscillator in dBm
PLO1=10**(0.1*PLO1dBm); # Power at local oscillator in mW
Pr=10**(0.1*PrdBm); # Power at receiver in mW
Id1=R*math.sqrt(Pr*PLO1); # The peak current at LO power = 10dBm
I1=R*Pr/2+R*math.sqrt(Pr*PLO1); # The peak current after ignoring the d.c. term
# Display result on command window
print "\n The peak current at LO power 10dBm = ",round(Id1,4)," mA"
print "\n The peak current after ignoring the d.c. term = ",round(I1,3)," mA"
# (b) the peak current LO power = -10 dBm
PLO2dBm=-10; # Power at local oscillator in dBm
PLO2=10**(0.1*PLO2dBm); # Power at local oscillator in mW
Id2=R*math.sqrt(Pr*PLO2); # The peak current at LO power = -10dBm
I2=R*Pr/2+R*math.sqrt(Pr*PLO2); # The peak current after ignoring the d.c. term
# Display result on command window
print "\n The peak current at LO power -10dBm = ",round(Id2,4)," mA"
print "\n The peak current after ignoring the d.c. term = ",round(I2,4)," mA"
# Example no.5.7
# To find the peak current if (a) LO power = 10 dBm, (b) LO power = −10 dBm for the balanced receiver
# Page no.234
import math
# Given data
L=100; # Length of fiber
loss=0.2*L; # Total fiber loss
PtdBm=12; # The peak power of the signal at the transmitter
R=0.9; # Responsivity in A/W
PrdBm=PtdBm-loss; # The power at the receiver
# (a) the peak current LO power = 10 dBm
PLO1dBm=10; # Power at local oscillator in dBm
PLO1=10**(0.1*PLO1dBm); # Power at local oscillator in mW
Pr=10**(0.1*PrdBm); # Power at receiver in mW
Id1=2*R*math.sqrt(Pr*PLO1); # The peak current LO power = 10 dBm
# Display result on command window
print "\n The peak current for LO power 10 dBm = ",round(Id1,4)," mA"
# (b) the peak current LO power = -10 dBm
PLO2dBm=-10; # Power at local oscillator in dBm
PLO2=10**(0.1*PLO2dBm); # Power at local oscillator in mW
Id2=2*R*math.sqrt(Pr*PLO2); # The peak current LO power = -10 dBm
# Display result on command window
print "\n The peak current for LO power -10 dBm = ",round(Id2,4)," mA"
# comment on the intermodulation cross-talk in a single-branch receiver and the balanced receiver
print "\n A single-branch receiver would have a significant amount of cross-talk. In contrast, for a balanced receiver, intermodulation \n cross-talk is canceled out due to the balanced detection."
# Example no.5.8
# To find the in-phase and quadrature components of the current of a balanced IQ receiver.
# Page no.238
import math
import numpy
# Given data
PLO=10; # Local oscillator power in mW from Example 5.7a
Pr=0.1585; # Power at receiver in mW
R=0.9; # Responsivity in A/W
st=complex((-1/math.sqrt(2)),(1/math.sqrt(2))); # The QPSK transmitted signal
Ii=R*math.sqrt(Pr*PLO)*numpy.real(st); # The in-phase component of the current in mA
Iq=-R*math.sqrt(Pr*PLO)*numpy.imag(st); # The quadrature component of the current in mA
# Display result on command window
print "\n The in-phase component of the current = ",round(Ii,4)," mA"
print "\n The quadrature component of the current = ",round(Iq,4)," mA"
# Example 5.9
# To find the in-phase and quadrature components of the current of a polarization modulated (PM) QPSK signal
# Page no. 241
import math
import numpy
# Given data
theta1=math.pi/4.0;
Sx=math.exp(theta1); # Signal data in x-polarization
theta2=(5*math.pi)/4;
Sy=math.exp(1*theta2); # Signal data in y-polarization
PLO=10; # Local oscillator power in mW from Example 5.8
Pr=0.1585; # Power at receiver in mW from Example 5.8
R=0.9; # Reflectivity
# The complex photocurrent corresponding to x-polarization
Ix= (R*math.sqrt(Pr*PLO))*Sx/2; # The complex photocurrent corresponding to x-polarization
Iix=numpy.real(Ix); # In-phase component of phtocurrent corresponding to x-polarization
Iqx=-numpy.imag(Ix); # Quadrature component of phtocurrent corresponding to x-polarization
# The complex photocurrent corresponding to y-polarization
Iy= (R*math.sqrt(Pr*PLO))*Sy/2; # The complex photocurrent corresponding to y-polarization
Iiy=numpy.real(Iy); # In-phase component of phtocurrent corresponding to y-polarization
Iqy=-numpy.imag(Iy); # Quadrature component of phtocurrent corresponding to y-polarization
# Display result on command window
print "\n In-phase component of phtocurrent corresponding to x-polarization = ",round(Iix,4)," mA"
print "\n Quadrature component of phtocurrent corresponding to x-polarization = ",round(Iqx,4)," mA"
print "\n In-phase component of phtocurrent corresponding to y-polarization = ",round(Iiy,4)," mA"
print "\n Quadrature component of phtocurrent corresponding to y-polarization = ",round(Iqy,4)," mA"