# To find acceptance angle and numerical aperture
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 14-1 in Page 392
# Given data
n_2 = 1.45 #Core index of refraction
n_1 = 1.47 #Cladding index of refraction
#Calculation
theta_c = math.acos(n_2/n_1)
theta_A = 2*math.asin(n_1*math.sin(theta_c))
NA = math.sqrt(n_1**2 -n_2**2)
print "The critical angle of the fiber =",round(theta_c*180/math.pi,2),"degree\n"
print "The acceptance angle of the fiber =",round(theta_A*180/math.pi,2)," degree\n"
print "The numerical aperture of the fiber = ",round(NA,3)
#Result
# The critical angle of the fiber = 9.46 degree
# The acceptance angle of the fiber = 27.97 degree
# The numerical aperture of the fiber = 0.242
# To find loss in the fiber
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 14-2 in Page 393
# Given data
NA_1 = 0.3 # numerical apertures of Source fiber
NA_2 = 0.242 #numerical apertures of receiving fiber
#Calculations
loss = 20*math.log10(NA_1/NA_2)
print "The energy that is lost through the cladding of the receiving fiber = ",round(loss,2)," dB"
#Result
# The energy that is lost through the cladding of the receiving fiber = 1.87 dB
# To find current developed in photodiode
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 14-3 in Page 395
# Given data
h = 6.63*10**-34 #Planck's constant
c = 3*10**8 #Speed of light in m/s
Lambda = 1.3*10**-6 # photon wavelength in m
QE = 0.82 #Quantum efficiency
p = 75*10**-6 #Power in W
q = 1.6*10**-19 #Charge of an electron
#Calculations
e = h*c/Lambda
N = p/e
N_QE= QE*N
I = N_QE*q
print "The current developed in a PIN photodiode = ",round(I,7)," A"
#Result
# The current developed in a PIN photodiode = 6.43e-05 A
# To find elapsed time
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 14-4 in Page 401
# Given data
n = 1.55 #index of refraction
c = 3*10**8 #speed of light in m/s
d = 1.4*10**3 #Distance in m
#Calculations
v = c/n
t = d/v
print "t = ",round(t,7),"s"
print "Since twice the time to reach the break is required for the reflection to arrive at the reflectometer,"
print "Hence the total elapsed time = ",round(2*t,8),"s"
#Result
# t = 7.2e-06 s
# Since twice the time to reach the break is required for the reflection to arrive at the reflectometer,
# Hence the total elapsed time = 1.447e-005 s