from __future__ import division
from math import sqrt, pi
# Calculation of core diameter
# Given data
n1=1.5# # Refractive index of core
n2=1.48# # Refractive index of cladding
N=1000# # No of modes
lamda=1.3# # Light wavelength
V=sqrt(2*N)# # Mode parameter
#core diameter
d=(lamda*V)/(2*pi*sqrt(n1**2-n2**2))#
print"Mode parameter = %0.2f "%(V)#
print"Core diameter = %0.0f micrometer "%(d)#
# Answer is wrong in the book.
from math import asin, sin, degrees
# Calculation of (a) critical angle (b) acceptance angle and oblique angle (c) numerical aperature
# (d) percentage of light collected by the fiber and (e) diameter of fiber
# Given data
n1=1.5# # Refractive index of core
n2=1.45# # Refractive index of cladding
V=2.405# # Mode parameter
lamda=1.55 # Wavelength of fiber
# (a) Critical angle of the
theatha=degrees(asin(n2/n1))#
# (b) Oblique angle
oa=90-theatha#
#Acceptance angle
t1=n1*sin(oa*pi/180)#
th1=degrees(asin(t1))#
# (c) Numerical aperature
NA=sqrt(n1**2-n2**2)#
# (d) Percentage of light collected in fiber
P=(NA)**2*100#
#(e) Diameter of fiber
d=V*lamda/pi*(1/sqrt(n1**2-n2**2))#
print"Critical angle = %0.0f degrees "%(theatha)#
print"Oblique angle = %0.0f degrees "%(oa)#
print"Acceptance angle = %0.0f degrees "%(th1)#
print"Numerical aperature = %0.4f "%(NA)#
print"Percentage of light collected in fiber = %0.1f "%(P)#
print"Diameter of fiber = %0.2f micrometer "%(d)#
# Calculation of (a) critical angle (b) numerical aperature and (c) acceptance angle
# Given data
n1=1.5# # Refractive index of core
n2=1.47# # Refractive index of cladding)
# (a) Critical angle
theatha=degrees(asin(n2/n1))#
# (b) Numerical aperature
NA=sqrt(n1**2-n2**2)#
# (c) Acceptance angle
theatha1=degrees(asin(NA))#
print"Critical angle = %0.1f degrees "%(theatha)#
print"Numerical aperature = %0.2f "%(NA)#
print"Acceptance angle = %0.1f degrees "%(theatha1)#
# Calculation of output power
# Given data
Pi=1# # Input power
A=0.5# # Atteuation
L=15# # Fiber link length
# Output Power
Po=Pi*10**((-A*L)/10)#
print"Output Power = %0.3f mW "%(Po)#
from math import log10
# Calculation of maximum transmission distance
# Given data
Pi=1*10**-3# # Input power
A=0.5# # Atteuation
Po=50*10**-6# # Output Power
# Maximum transmission distance
L=(10/A)*log10(Pi/Po)#
print"Maximum transmission distance = %0.0f km "%(L)#
# Calculation of output power
# Given data
Pin=1*10**-3# # Input power
AL1=10# # Attenuation 1
AL2=20# # Attenuation 2
#Output power 1 and 2
Po1=Pin/10#
Po2=Pin/20#
Po1=Po1*10**3#
Po2=Po2*10**6#
print"Output power = %0.1f mW"%(Po1)#
print"Output power = %0.0f uW"%(Po2)#
from math import exp
# Calculation of attenuation and Rayleigh scattering coefficient for fiber
# Given data
n=1.46# # Refractive index
p=0.286# # Average photoelastic coefficient
B=7.25*10**-11# # Isothermal compressibility
k=1.38*10**-23# # Boltzmann's constant
T=1350# # Fictive temperature
l1=1*10**-6# # Wavelength 1
l2=1.3*10**-6# # Wavelength 2
L=10**3# # Length
# Rayleigh scattering coefficient for length 1
y1=8*(pi)**3*(n)**8*(p)**2*B*k*T/(3*(l1)**4)#
# Rayleigh scattering coefficient for length 2
y2=8*(pi)**3*(n)**8*(p)**2*B*k*T/(3*(l2)**4)#
y1=y1#
y2=y2#
#Attenuation 1
T1=exp(-(y1*L))#
#Attenuation 2
T2=exp(-(y2*L))#
print"First Rayleigh scattering coefficient = %0.6f m**-1 "%(y1)#
print"Second Rayleigh scattering coefficient = %0.6f m**-1 "%(y2)#
print"Attenuation (@ Length 1) = %0.2f dB/km"%(T1)#
print"Attenuation (@ Length 2) = %0.2f dB/km"%(T2)#
# Calculation of threshold power of stimulated Brillouin scattering and Raman Scattering
# Given data
A=0.5# # Attenuation
d=5# # Core diameter
lamda=1.3# # Operating wavelength
v=0.7# # Bandwith of laser diode
# Threshold power of stimulated Brillouin scattering
Pb=4.4*10**-3*d**2*lamda**2*A*v#
Pb=Pb*10**3#
#Threshold power stimulated Raman Scattering
Pr=5.9*10**-2*d**2*lamda*A#
print"Threshold power of stimulated Brillouin scattering = %0.2f mW"%(Pb)#
print"Threshold power stimulated Raman Scattering = %0.2f W"%(Pr)#
# Compuatation of mode parameter
#Given data
n1=1.503# # refractive index of core
n2=1.50# # refractive index of cladding
a=4*10**-6# # core radius
lamda=1*10**-6# # light wavelength
# Mode parameter computation
V=(2*pi*a*sqrt(n1**2-n2**2))/(lamda)#
#Displaying the result in command window
print"Mode parameter is = %0.3f "%(V)#
# The answer vary due to round off error
# Calculation of numerical aperature
#Given data
v=2.111# # Mode parameter
a=4.01*10**-6# # Core radius in m
lamda=1.3*10**-6# # Wavelength of laser light m
#Numerical aperture computation
NA=(v*lamda)/(2*pi*a)#
#Displaying the result in command window
print"Numerical aperature = %0.2f"%(NA)#
from math import log
# Calculation of potential difference
# Given data
na=10**24# # Accepter impurity level
nd=10**22# # Donor impurity level
ni=2.4*10**19# # Intrinsic electron
T=290# # Room temperature
e=1.602*10**-19# # Electric charge
K=1.38*10**-23# # Boltzmann constant
#Potential difference
V=(K*T)/e*(log(na*nd/(ni)**2))#
print"Potential difference = %0.2f V "%(V)#
# The potential difference varies with the variation of Na, Nd and ni
# Calculation of (a) Numerical aperature and (b) critical angle
# Given data
n1=1.5# # Refractive index of core
n2=1.47# # Refractive index of cladding
# (a) Numerical aperature
NA= sqrt(n1**2-n2**2)#
# (b) Critical angle
theatha=degrees(asin(n2/n1))#
print"Numerical aperature = %0.2f "%(NA)#
print"Critical angle = %0.1f degrees "%(theatha)#
import math
# Computation of (a) normalized frequency and (b) no. of guided modes
#Given data
lamda=0.85*10**-6# # wavelength of fiber
a=40*10**-6# # core diameter of fiber
delta=0.015# # relative refractive index
n1=1.48# # refractive index of core
# (a) Normalized frequency
v=(2*pi*a*n1*(2*delta)**(1/2))/lamda#
#(b) Number of guided modes
m=v**2/2#
m=math.ceil(m)#
#Displaying results in the command window
print"Normalized frequency is = %0.1f "%(v)#
print"Number of guided modes = %0.0f "%(m)#
# Computation of normalized frequency and no of guided modes
#Given data
lamda=1.30*10**-6# # Wavelength of fiber
a=25*10**-6# # Core diameter of fiber
delta=0.01# # Relative refractive index
n1=1.50# # Refractive index of core
# (a) Normalized frequency
v=((2*pi*a*n1)/(lamda))*((2*delta)**(1/2))#
#(b) Number of guided modes
m=v**2/2#
#m=ceil(m)#
#Displaying results in the command window
print"Normalized frequency = %0.2f "%(v)#
print"Number of guided modes = %0.0f "%(m)#
#Answer varies due to round off error
# Calculation of normalized frequency and no of guided modes
#Given data
lamda=1.55*10**-6# # Wavelength of fiber
a=30*10**-6# # Core diameter of fiber
delta=0.015# # Relative refractive index
n1=1.48# # Refractive index of core
# (a) Normalized frequency
v=(2*pi*a*n1*(2*delta)**(1/2))/lamda#
#(b) Number of guided modes
m=v**2/2#
#Displaying results in the command window
print"Normalized frequency = %0.2f "%(v)#
print"Number of guided modes = %0.0f "%(m)#
# The answers vary due to round off error
# Calculation of normalized frequency and no of guided modes
#Given data
lamda=1.55*10**-6# # Wavelength of fiber
a=4*10**-6# # Core diameter of fiber
delta=0.01# # Relative refractive index
n1=1.48# # Refractive index of core
# (a) Normalized frequency
v=(2*pi*a*n1*(2*delta)**(1/2))/lamda#
#(b) Number of guided modes
m=v**2/2#
#Displaying results in the command window
print"Normalized frequency = %0.3f "%(v)#
print"Number of guided modes = %0.0f "%(m)#
# The answers vary due to round off error
# Calculation of Core radius
#Given data
lamda=0.85*10**-6# # Wavelength of fiber
delta=0.015# # Relative refractive index
n1=1.48# # Refractive index of core
v=2.403# # Normalized frequency for single mode fiber
# Computation of core radius
a=v*lamda/(2*pi*n1*sqrt(2*delta))#
a=a*10**6#
print"Radius of core = %0.1f micrometer "%(a)#
# Calculation of Cut off wavelength
# Given data
V=2.403# # Normalized frequency
delta=0.25# # Refractive index of core
n1=1.46# # Relative refractive index
a=4.5*10**-6# # Radius of core
# Cut off wavelenth
lamda=(2*pi*a*n1*(sqrt(2*delta)))/V#
print"Cut off wavelenth = %0.0f nm "%(lamda*10**8)#
# The answers vary due to round off error
#Calculation of (a) reflection and (b) loss of light signal at joint areas.
# Given data
n1=1.5# # Refractive index of core
n=1# # Refractive index of air
# (a) Reflection at the fiber air interface
R=((n1-n)/(n1+n))**2#
# (b) Light loss due to fiber air interface
l= -10*log10(1-R)#
print"Reflection at the fiber air interface = %0.2f "%(R)#
print"Light loss due to fiber air interface = %0.2f dB "%(l)#
# Computation of (a) numerical aperature and (b) maximum angle of entrance
#Given data
n1=1.48# # Refractive index of core
n2=1.46# # Refractive index of cladding
# (a) Numerical Aperture
NA=sqrt(n1**2-n2**2)#
#(b) Maximum angle of entrance
theata=degrees(asin(NA))
#Displaying result in the command window
print"Numerical Aperture = %0.3f "%(NA)#
print"Maximum angle of entrance = %0.0f degress "%(theata)#
# Final answer in the book is wrong. Please refer example 2.11 of
# Fiber Optic Communication by Gerd Keiser book.
# Calculation of (a) core radius and (b) maximum value of angle of acceptance of the fiber
#Given data
lamda=1320*10**-9# # Wavelength of fiber
delta=0.077# # Relative refractive index
n1=1.48# # Refractive index of core
n2=1.478# # Refractive index of cladding
v=2.403# # Normalized frequency
# (a) Core radius
a=v*lamda/(2*pi*delta)#
a=a*10**6#
#Numerical Aperture
NA=sqrt(n1**2-n2**2)#
# (b) Angle of acceptance
theata = degrees(asin(NA))
print"Radius of core = %0.1f micrometer "%(a)#
print"Numerical aperture = %0.5f "%(NA)#
print"Angle of acceptance = %0.0f degrees "%(theata)#
# The answers vary due to round off error
# Calculation of critical wavelength
#Given data
a=3*10**-6# # Core diameter of fiber
delta=0.15# # Relative refractive index
v=2.405# # Normalized frequency
# Critical wavelength
lamda=(2*pi*a*delta)/v#
lamda*=10**9#
print"Critical wavelength = %0.0f nm "%(lamda)#
# The answers vary due to round off error