import math
from math import sqrt
n1=1.55 #RI of glass
n2=1.51 #RI of clad
#NA of the fibe is given as
NA=n1*sqrt(2*(n1-n2)/n1)
NA=round(NA,2)
print 'The numerical aperture is',NA
#Acceptance angle is given as
acc_angle=math.asin(NA)
acc_angle=round(acc_angle,2)
print 'The acceptance angle is',acc_angle
import math
from math import pi
d=50*10**-6
wav=0.8*10**-6
NA=0.352
#Determination of V number
V=(pi)*d*NA/wav
V=round(V,2)
print 'The V number is',V
#Determination of approximate number of modes
N=(V**2)/2
N=round(N,1)
print 'the approximate no . of modes are',N
import math
from math import pi
d=5*10**-6
wave=1.3*10**-6
NA=0.35
#Determination of V number
V=(pi)*d*NA/wave
V=round(V,4)
print 'The v number is',V
print 'From the table it is seen that 6 modes have cut off v less than 4.23'
import math
a=2 #gradding profile index
V=69.1 #normalized cutoff frequency
N=2390 #number of modes supported as a step index fiber
#Determination of no . of modes supported by graded index fiber
N_a=(N*a)/(a+2)
print 'No . of modes supported by graded index fiber=',N_a
import math
from math import pi
d=10*10**-6
wav=1.3*10**-6
n1=1.55
V_max=2.405
NA=(V_max*wav)/(pi*d)
#a) Determination of maximum normailized index difference
del1=(0.5)*((NA/n1)**2)
del1=round(del1,3)
print 'a) the normilized index difference is',del1
#b) Determination of r effective index of claddin glass
n2=n1*(1-del1)
n2=round(n2,2)
print 'b) cladding index required is',n2
#Determination of the fiber acceptance angle
theta_max=math.asin(NA)
theta_max=round(theta_max,3)
print'The max acceptance angle is',theta_max
import math
A_max=25
A1=2
A2=0.3
#a) Determination of repeater dist at 0.9um wavelength
z1=A_max/A1
print 'a)The repeater dist for 0.9um wavelength is',z1,'km'
#b) Determination of repeater dist at 1.5um wavelength
z2=A_max/A2
z2=round(z2,2)
print 'b)The repeater dist for 1.5um wavelength is',z2,'km'
import math
#given
n1=1.55
del1=0.0258
l=12.5
z=1000
c=3*10**8 #velocity of light
#a) Determination of intermodal dispersion
del_per_km=(n1*z*del1)/((1-del1)*c)*10**7
del_per_km=round(del_per_km,2)*10**-7
print 'The intermodal dispersion is',del_per_km ,'s/km'
#b) Determination of intermodal dispersion for l =12.5
del_l=del_per_km*l/1000*10**9
del_l=round(del_l,2)*10**-9
print 'The intermodal dispertion for l=12.5 is',del_l,'s'
import math
n1=1.55
del1=(258.0)*(10**-2)
z=1000
c=3*10**8
z_disp=12.5
del_graded=(n1*z*del1**2)/(8*c)
#Determination of intermodal dispersion
del_total=del_graded*z_disp*10**5
del_total=round(del_total,2)*10**-5
print 'The intermodal dispersion is',del_total,'sec'
import math
#given
wav_0=0.8*10**-6
Dm=-0.15
wav_3=1.5
z=12.5
del_t=Dm*wav_3
#Determination of total material dispersion
del_md=del_t*z
print 'The total material dispersion is',del_md,'ns'
import math
#given
Dm=6.6
z=12.5
del_3=6
del_wg=Dm*z*del_3
print'Expected waveguide dispersion is',del_wg,'ps'
import math
#given
del_imd=0
del_md=2.81
del_wgd=0.495
t_w=2.5
del_tot=((del_imd**2)+(del_md**2)+(del_wgd**2))**(1/2)
print 'The total dispersion is',del_tot,'ns'
t_r=((t_w**2)+(del_tot**2))**(1/2)
#Determination of max allowed bit rate
B=(1000/(2*t_r))
print 'The max allowed bit rate is',B,'Mbps'
import math
#given
del_t=4.0
B=10.0
#a) Determination of BW distance product
BDP=1/(2*del_t)
print'a)The BW distance product for fiber is',BDP,'Mbps−km'
#b) Determiation of dispersion limited length
z_max_disp=BDP/(B*10**-3)
print'b)The disp limited length for a fiber is',z_max_disp,'km'
import math
E1=1.9
E2=1.46
E3=0.954
eV=1.9 #All in eV
c=3*10**8 #speed of light
#a) Determination of wavelength and freq for E1=1.9
wav1=1.241/E1
f1=c/(wav1)
wav1=round(wav1,1)
f1=round(f1,1)
print 'a) i) the wavelength is',wav1,'um'
print 'a) ii) the freq is',f1,'MHz'
#b) Determination of wavelength and freq for E2=1.46
wav2=1.241/E2
f2=c/(wav2)
print 'b) i) the wavelength is',wav2,'um'
print 'b) ii) the freq is',f2,'MHz'
#c ) Determination of wavelength and freq for E3=0.945
wav3=1.241/E3
f3=c/(wav3)
wav3=round(wav3,1)
f3=round(f3,1)
print'c)i) the wavelength is',wav3,'um'
print'c)ii) the freq is',f3,'MHz'
import math
#given
pt=0
pr=-57
Nc=2
BER=10**-9
N=5
Lpt=6
Lpr=6
Lc=1
Ls =0.5
Lf=2
M=5
del_t=0.505
B=35
Ns=5
#a) Determination of loss−limited fiber length
z=(pt-pr-M-(Nc*Lc)-(Ns*Ls)-Lpt-Lpr)/Lf
print 'a) the loss−limited fiber is',z,'km'
#b) Determination of max BW for loss−limited fiber length
B_max=1/(5*del_t*z)
B_max=round(B_max,3)
print 'b) the max BW for loss−limited length is',B_max,'Gbps'
#c ) Determination of dispersion−limited length
z_disp=1000/(5*del_t*B)
z_disp=round(z_disp,2)
print 'the dispertion limited length is',z_disp,'km'