import math
# Initialisation of variables
n1=1.46 # core refractive index
n=1 # refractive index due to air
r=math.pow(((n1-n)/(n1+n)),2)
r1=0.03 # r take upto two decimal place
l_s=-10*math.log(1-r1)/math.log(10) # fiber loss in db
l_t=2*l_s # total loss in db
# Results
print ('%s %.2f %s' %(" The fiber loss = ",l_s,"db"))
print ("\n there is a similar loss at the other interface ")
print ('%s %.2f %s' %("\n The total fiber loss = ",l_t,"db"))
import math
# Variable declaration
n1=1.46 # core refractive index
n=1 # refractive index due to air
a=25*math.pow(10,-6) # core radius in m
y=3*math.pow(10,-6) # in m
# calculations
A=(y/a)*math.pow((1-math.pow((y/(2*a)),2)),0.5)
B=math.acos(y/(2*a))
C=n1/n
M=(16*math.pow(C,2))/(math.pi*math.pow((1+C),4))
n_lat=M*(2*B-A) # coupling efficiency for multimode step index fiber
L_lat=-10*math.log(n_lat)/math.log(10) # insertion loss for lateral misalignment
n_lat1=(1/math.pi)*(2*B-A) # coupling efficiency when there is no air gap
L_lat1=-10*math.log(n_lat1)/math.log(10) # insertion loss for lateral misalignment when there is no air gap
# Results
print ('%s %.2f ' %(" The coupling efficiency for multimode step index fiber = ", n_lat))
print ('%s %.2f %s' %("\n The insertion loss for lateral misalignment = ",L_lat,"dB"))
print ('%s %.2f ' %("\n The coupling efficiency when there is no air gap = ", n_lat1))
print ('%s %.2f %s' %("\n The insertion loss for lateral misalignment when there is no air gap = ",L_lat1,"dB"))
import math
# Variable declaration
n1=1.50 # core refractive index
n=1 # refractive index due to air
a=25*math.pow(10,-6) # core radius in m
y=4*math.pow(10,-6) # in m
# calculations
A=(y/a)*math.pow((1-math.pow((y/(2*a)),2)),0.5)
B=math.acos(y/(2*a))
C=n1/n
M=(16*math.pow(C,2))/(math.pi*math.pow((1+C),4))
n_lat=M*(2*B-A) # coupling efficiency for multimode step index fiber
L_lat=-10*math.log(n_lat)/math.log(10) # insertion loss for lateral misalignment
dx=4*(math.pi/180) # angular misalignment in radian
dl=0.02 #relative index difference
NA=n1*math.sqrt(2*dl) # numerical aperture
n_ang=1-(0.069/(math.pi*NA)) # coupling efficiency due to angular misalignment
L_ang=-10*math.log(n_ang)/math.log(10) # loss due to angular misalignment
Lt=L_lat+L_ang # total insertion loss in dB
# Results
print ('%s %.2f %s' %( " The total insertion loss = ",Lt,"dB"))
print ("\n the answer is wrong in the textbook ")
import math
# variable initialisation
n1=1.46 # core refractive index
n=1 #refractive index due to air
a=1 # core radius in m
y=0.12 #lateral offset
# Calculations
A=(y/a)*math.pow((1-math.pow((y/(2*a)),2)),0.5)
B=math.acos(y/(2*a))
C=n1/n
M=(16*math.pow(C,2))/(math.pi*math.pow((1+C),4))
n_lat=M*(2*B-A) #coupling efficiency when there is a smsll air gap
L_lat=-10*math.log(n_lat)/math.log(10) # insertion loss when there is a smsll air gap
n_lat1=(1/math.pi)*(2*B-A) # coupling efficiency when the joint is indexed matched
L_lat1=-10*math.log(n_lat1)/math.log(10) # insertion loss when the joint is indexed matched
# Results
print ('%s %.2f %s' %(" The insertion loss when there is a smsll air gap = ",L_lat,"dB"))
print ('%s %.2f %s' %( "\n The insertion loss when the joint is indexed matched = ",L_lat1,"dB"))
import math
# variable initialisation
d1=60*math.pow(10,-6)# core diameter of fiber 1 in m
d2=50*math.pow(10,-6) # core diameter of fiber 1 in m
NA1=0.25 # numerical aerture of fiber 1
NA2=0.22 # numerical aerture of fiber 2
a1=2.0 # for fiber 1
a2=1.9 # for fiber 2
# calculations
n_cd=math.pow((d2/d1),2)
n_NA=math.pow((NA2/NA1),2);
n_a=(1+(2/a1))/(1+(2/a2))
n_t=n_cd*n_NA*n_a # total coupling efficiency
Lt=-10*math.log(n_t)/math.log(10) #total loss at the joint in dB
# Results
print ('%s %.3f ' %(" The total coupling efficiency in the frw direction = ", n_t))
print ('%s %.2f %s' %("\n The total loss at the joint in the frw direction = ",Lt,"dB"))
print ("\n In the backward direction n_cd & n_a are all unity therefore there will be no loss in the backward direction of transmission of the signal ")
import math
# variable initialisation
d1=80*math.pow(10,-6) #core diameter of fiber 1 in m
d2=60*math.pow(10,-6) #core diameter of fiber 1 in m
NA1=0.25 # numerical aerture of fiber 1
NA2=0.20 # numerical aerture of fiber 2
a1=1.9 # for fiber 1
a2=2.1 # for fiber 2
# Calculations
n_cd=math.pow((d2/d1),2)
n_NA=math.pow((NA2/NA1),2)
n_a=(1+(2/a1))/(1+(2/a2))
n_t=n_cd*n_NA*n_a # total coupling efficiency in the frw direction
Lt=-10*math.log(n_t)/math.log(10) # total loss at the joint in the frw direction in dB
n_cd1=1
n_NA1=1
n_a1=(1+(2/a2))/(1+(2/a1))
n_t1=n_cd1*n_NA1*n_a1 # total coupling efficiency in the backward direction
Lt1=-10*math.log(n_t1)/math.log(10)# total loss at the joint in the backward direction in dB
# Results
print ('%s %.2f %s' %(" The total loss at the joint in the frw direction = ",Lt,"dB"))
print ('%s %.2f %s' %("\n The total loss at the joint in the backward direction = ",Lt1,"dB"))
import math
# variable initialisation
n1=1.5 # core refractive index
n=1.47 # refractive index due to air
a=1 # core radius in m
y=0.12 # lateral offset
# calculations
A=(y/a)*math.pow((1-math.pow((y/(2*a)),2)),0.5)
B=math.acos(y/(2*a))
C=n1/n
M=(16*math.pow(C,2))/(math.pi*math.pow((1+C),4))
n_lat=M*(2*B-A) #coupling efficiency of the splice
L_lat=-10*math.log(n_lat)/math.log(10) #insertion loss of the splice
# Results
print ('%s %.2f %s' %( " The insertion loss of the splice = ",L_lat,"dB"))
import math
# Variable initialisation
L_f=0.036
n_f=math.pow(10,(-0.036))
# here we get a quadratic equation in n1 and on solving we get
n1=(2.17+math.sqrt(math.pow((-2.17),2)-4*1*1))/2 # refractive index of the fiber core
# Results
print ('%s %.3f' %(" The refractive index of the fiber core = ", n1))
import math
# variable declaration
n1=1.46 #core refractive index
n=4 # refractive index due to air
x=math.pi/180
A=(16*math.pow(n1,2))/(math.pow((1+n1),4))
B=n*x
n_ang=math.pow(10,(-0.06)) # angular coupling efficiency
NA=B/((math.pi)*(1-(n_ang/A))) # numerical aperture
# Results
print ('%s %.2f' %(" The numerical aperture = ", NA))
import math
# Variable declaration
y=5*math.pow(10,-6) # lateral misalignment in m
a=25*math.pow(10,-6) # core diameter in m
Lt=0.85*(y/a) # misalignment loss
n_c=1-Lt # coupling efficiency
L_i=-10*math.log(n_c)/math.log(10) # insertion loss in dB
Lt1=0.75*(y/a) # misalignment loss if we have both guided and leaky modes
n_c1=1-Lt1 # coupling efficiency
L_i1=-10*math.log(n_c1)/math.log(10) # insertion loss in dB if we have both guided and leaky modes
# Results
print ('%s %.2f %s' %(" The insertion loss = ",L_i,"dB"))
print ('%s %.2f %s' %("\n The insertion loss,if we have both guided and leaky modes = ",L_i1,"dB"))
import math
# Variable declaration
n1=1.5 # core refractive index
n=1 # refractive index due to air
x=5*math.pi/180
# Calculations
C=n1/n
A=(16*math.pow(C,2))/(math.pow((1+C),4))
B=n*x
NA=0.22 # numerical aperture
n_ang=A*(1-(B/(math.pi*NA))) # angular coupling efficiency
L_ang=-10*math.log(n_ang)/math.log(10) # inserion loss when NA=0.22
NA1=0.32 # numerical aperture
n_ang1=A*(1-(B/(math.pi*NA1))) # angular coupling efficiency
L_ang1=-10*math.log(n_ang1)/math.log(10) # inserion loss when NA=0.32
# Results
print ('%s %.2f %s' %(" The inserion loss when NA=0.22 = ",L_ang,"dB"))
print ('%s %.2f %s' %("\n The inserion loss when NA=0.32 = ",L_ang1,"dB"))
import math
# Variable declaration
V=2.50 # normalised frequency
n1=1.5 # core refractive index
a=4.5*math.pow(10,-6) # core radius in m
NA=0.2 # numerical aperture
y=3*math.pow(10,-6) # lateral misalignment in m
w=a*((0.65+1.62*math.pow((V),-1.5)+2.88*math.pow((V),-6))/math.pow(2,0.5)) # normalised spot size in m
T1=2.17*math.pow((y/w),2) # Loss due to lateral offset in dB
x=(math.pi/180)*w
Ta=2.17*math.pow(((x*n1*V)/(a*NA)),2) # loss due to angular misalignment in dB
T=T1+Ta # total insertion loss in dB
# Results
print ('%s %.3f %s' %(" The total insertion loss = ",T,"dB"))
print ("\n The answer is wrong in the textbook ")
import math
# variable declaration
P1=65 # optical power in uW
P2=0.005 #output power at port 2 in uW
P3=24 # output power at port 3 in uW
P4=26.5 #output power at port 4 in uW
# Calculations
Le=10*math.log(P1/(P3+P4))/math.log(10) # Excess loss in dB
Le1=10*math.log(P1/P3)/math.log(10) # insertion loss port 1 to 3 in dB
Le2=10*math.log(P1/P4)/math.log(10) # insertion loss port 1 to 4 in dB
ct=10*math.log(P2/P1)/math.log(10) # cross talk in dB
sr=(P3/(P3+P4))*100 # split ratio
# Results
print ('%s %.2f %s' %(" The Excess loss = ",Le,"dB"))
print ('%s %.2f %s' %("\n The insertion loss port 1 to 3 = ",Le1,"dB"))
print ('%s %.2f %s' %("\n The insertion loss port 1 to 4 = ",Le2,"dB"))
print ('%s %.2f %s' %("\n The cross talk = ",ct,"dB"))
print ('%s %.2f %s' %("\n The split ratio = ",sr,"%"))
import math
# variable initialisation
n=1.0
n1=1.48
r=math.pow(((n1-n)/(n1+n)),2) # fresnel's reflection
Ls=-10*math.log(1-r)/math.log(10) #optical loss in dB
Lt=2*Ls # total fresnel loss
# Results
print ('%s %.2f %s' %(" The total fresnel loss = ",Lt,"dB"))
import math
#Variable declaration
NA1=0.32 # numerical aperture for fiber1
NA2=0.22 # numerical aperture for fiber2
Lc=20*math.log(NA1/NA2)/math.log(10) #NA mismatch coupling loss
#Results
print ('%s %.2f %s' %(" The NA mismatch coupling loss = ",Lc,"dB"))
import math
# variable initialisation
P0=250.0 # optical power in uW
P1=80.0 # output power at port 1 in uW
P2=70.0 # output power at port 2 in uW
P3=5*math.pow(10,-3) # output power at port 3 in uW
# calculations
cr=(P2/(P1+P2))*100 # coupling ratio
Le=10*math.log(P0/(P1+P2))/math.log(10) # Excess loss in dB
Le1=10*math.log(P0/P1)/math.log(10) # insertion loss port 0 to 1 in dB
Le2=10*math.log(P0/P2)/math.log(10) # insertion loss port 0 to 2 in dB
ct=10*math.log(P3/P0)/math.log(10) #cross talk in dB
# Results
print ('%s %.2f %s' %(" The coupling ratio = ",cr,"%"))
print ('%s %.2f %s' %("\n The Excess loss = ",Le,"dB"))
print ('%s %.2f %s' %("\n The insertion loss port 0 to 1 = ",Le1,"dB"))
print ('%s %.2f %s' %("\n The insertion loss port 0 to 2 = ",Le2,"dB"))
print ('%s %.2f %s' %("\n The cross talk = ",ct,"dB"))
import math
# Variable declaration
P_21=4.0/5.0 # ratio of the input available at port2
P_31=1.0/5.0 # ratio of the input available at port3
Lt=-10*math.log(P_21)/math.log(10) # throughput loss
Lp=-10*math.log(P_31)/math.log(10) # tap loss
Le=-10*math.log(P_21+P_31)/math.log(10) # excess loss
# Results
print ('%s %.2f %s' %(" The throughput loss = ",Lt,"dB"))
print ('%s %.2f %s' %("\n The tap loss = ",Lp,"dB"))
print ("\n Directionality=-10*log(0/Pi=infinity)")
print ('%s %.1f %s' %("\n The excess loss = ",Le,"dB"))
import math
# Variable declaration
Le=4 # excess loss in dB
D=60 # Directionality in dB
P_41=math.pow(10,-6) # the ratio of P4 to P1
P_31=0.670/5 # the ratio of P3 to P1
P_21=P_31*4 # the ratio of P2 to P1
Lt=-10*math.log(P_21)/math.log(10) # throughput loss
Lp=-10*math.log(P_31)/math.log(10) # tap loss
Ls=-10*math.log(0.670)/math.log(10) # loss due to radiation scattering in dB
# Results
print ('%s %.2f %s' %(" The fraction of the input power goes to each of the ports = ",P_21,"dB"))
print ('%s %.2f %s' %("\n The throughput loss = ",Lt,"dB"))
print ('%s %.2f %s' %("\n The tap loss = ",Lp,"dB"))
print ('%s %.2f %s' %("\n The loss due to radiation scattering = ",Ls,"dB"))
import math
# Variable declaration
L1=1.5 # length in km
L2=2/1000 # length in km
Pi=50.1*math.pow(10,-6) # optical power in W
Po=385.4*math.pow(10,-6) # output power in W
a=(10/(L1-L2))*math.log(Po/Pi)/math.log(10) # attenuation per km
# Results
print ('%s %.2f %s' %(" The attenuation per km = ",a,"dB/km"))
import math
# Variable initialisation
Psc=5.31*math.pow(10,-9)
Popt=98.45*math.pow(10,-6)
L=5.99 # length in km
asc=(4.343*math.pow(10,5)/L)*(Psc/Popt) # scattering loss in the fiber in dB
# Results
print ('%s %.2f %s' %(" The scattering loss in the fiber = ",asc,"dB/km"))