#Variable declaration
n=8 #bits in a time slot
t=32 #bits in a frame
f=8*10**3 #frequency
m=16 #bits in a multiframe
#Calculation
nb=n*t #number of bits in a frame
fr=nb*f #transmission rate
tr=fr**-1 #bit duration
ts=tr*n #duration of a time slot
tf=ts*t #duration of a frame
tm=tf*m #duration of a multiframe
#Result
print'(a) Bit rate for the system = %.3f Mbit s^-1'%(fr*10**-6)
print'(b) Duration of the time slot = %.1f μs'%(ts*10**6)
print'(c) Duration of a frame = %d μs' %(tf*10**6)
print'Duration of a multiframe = %d ms' %(tm*10**3)
import math
#Variable declaration
m=4.24 #erfc = 2*10^9
a=2*math.sqrt(2)
#Calculation
sn=m*a #root of S/N = optical
sn1=10*math.log10(sn) #in dB
isq=sn**2 #S/N = electrical
isq1=10*math.log10(isq) #in dB
#Result
print'Optical SNR = %.1f'%sn
print' = %.1f dB'%sn1
print'Electrical SNR = %.1f'%round(isq)
print' = %.1f dB'%isq1
import math
#Variable declaration
m=100 #multiplication factor
k=0.02 #ratio of carrier ionization rates
sn=144 #electrical SNR
n=0.8 #quantum efficiency
B=0.6
#Calculation
fm=(k*m)+(2-(1/m))*(1-k) #avalanche noise factor
zm=2*B*round(fm)*sn/n #average number of photons
#Result
print'Average no of photons = %d photons'%round(zm)
import math
#Variable declaration
zm=864 #average no of photons
h=6.626*10**-34 #plancks constant
c=2.998*10**8 #velocity of light
l1=10**-6 #wavelength
l2=10**-14 #wavelength
bt=10**7
n=14
#Calculation
po1=(zm*h*c*bt)/(2*l1) #At 10 Mbit s^-1
po2=(zm*h*c*n*bt)/(2*l2) #At 140 Mbit s^-1
#Result
print'Incident optical power (10 Mbit s^-l) = %.1f pW'%(po1*10**12)
print'Incident optical power (140 Mbit s^-l) = %.3f W'%po2 #value given in a textbook is incorrect
#Variable declaration
afc=5 #fibre cable attenuation
ai=2 #splice losses
l=4 #length in Km
af=3.5+2.5 #connector losses at source and detector resp
#Calculation
Cl=(afc+ai)*l+af #total channel loss
#Result
print'Total channel loss = %d dB'%Cl
import math
#Variable declaration
s=0.6*10**-9 #rms pulse broadening
L=8 #length in km
bt=25*10**6 #bit rates
bt1=150*10**6 #bit rates
#Calculation
st=s*L #total rms pulse broadening
dl1=2*(2*st*bt*math.sqrt(2))**4 #without mode coupling
st1=s*math.sqrt(L) #total rms pulse broadening
dl2=2*(2*st1*bt*math.sqrt(2))**4 #with mode coupling
dl3=2*(2*st*bt1*math.sqrt(2))**4 #without mode coupling
dl4=2*(2*st1*bt1*math.sqrt(2))**4 #with mode coupling
#Result
print'(a) For 25 Mbit per sec'
print'dispersion–equalization penalty (without mode coupling) = %.2f dB'%dl1
print'dispersion–equalization penalty (with mode coupling) = %.2f x 10^-4 dB\n'%(dl2*10**4)
print'(b) For 150 Mbit per sec'
print'dispersion–equalization penalty (without mode coupling) = %.2f dB'%dl3
print'dispersion–equalization penalty (with mode coupling) = %.2f dB'%dl4
import math
#Variable declaration
ts=8 #rise time for source in ns
tn=5*ts #for fiber intermodal
tc=1*ts #for pulse broadening
td=6 #for detector
#Calculation
tsys=1.1*(ts**2+tn**2+tc**2+td**2)**0.5 #total system rise time
Bt=0.7/(tsys*10**-9) #max bit rate
#Result
print'Bt (Max) = %.1f Mbit per sec'%(Bt/10**6)
import math
#Variable declaration
po=-55 #mean power required at the APD receiver at 35 Mbit s^-1
po1=-44 #mean power required at the APD receiver at 400 Mbit s^-1
pi=-3 #mean power launched from the laser transmitter
l1=0.4 #cable fiber loss
l2=0.1 #splice losses
l3=1 #connector loss
ma=7 #safety margin
a=0.5
acr=2
dl=1.5
#Calculation
L1=(pi-po-acr-ma)/a #for 35 Mbit s^-1
L2=(pi-po1-acr-ma)/a #for 400 Mbit s^-1
L3=(pi-po1-acr-dl-ma)/a #reduction in the maximum possible link
#Result
print'(a) Maximum possible link length (operating at 35 Mbit s^-1) = %d km'%L1
print'(b) Maximum possible link length (operating at 400 Mbit s^-1) = %d km'%L2
print'(c) Reduction in the maximum possible link length = %d km'%L3
import math
#Variable declaration
po=-10 #mean optical power launched into the fiber from the transmitter (100 μm)
rs=-41 #receiver sensitivity at 20 Mbit s^-1
l1=7*2.6 #cabled fiber loss
l2=6*0.5 #splice losses
l3=1*1.5 #connector loss
ms=6 #safety margin
#Calculation
ts=po-rs #Total system margin
tsl=l1+l2+l3+ms #Total system loss
pm=ts-tsl #Excess power margin
#Result
print'Total system margin = %d dB'%ts
print'Total system loss = %.1f dB'%tsl
print'Excess power margin = %.1f dB'%pm
import math
#Variable declaration
v=5 #output voltage
h=6.626*10**-34 #plancks constant
c=2.998*10**8 #velocity of light
k=1.385*10**-23 #boltzman constant
t=290 #tempreture in kelvin
zo=100 #cable impedance
n=0.7 #quantum efficiency
pi=10**-3 #optical power
lam=0.85*10**-6 #wavelength
#Calculation
ratio=(v**2*h*c)/(2*k*t*zo*n*pi*lam) #ratio
ratio1=10*math.log10(ratio) #ration in dB
#Result
print'Ratio = %d dB'%ratio1
import math
#Variable declaration
ma=0.8 #modulation index
R=0.5 #responsivity
b=0.7 #ratio of luminance to composite video
snr=3.162*10**5 #SNR
e=1.602*10**-19 #electron volt
B=5*10**6 #bandwidth
K=1.385*10**-23 #boltzman constant
T=293 #tempreture in kelvin
Fn=1.413
Rl=10**6
#Calculation
a=(2*ma*R*b)**2
c=snr*2*e*B*R
d=snr*4*K*T*B*Fn/Rl
f = (c**2)+(4*a*d)
po=(c+math.sqrt(f))/(2*a) #average incident optical power
po1=10*math.log10(po*1000) #in dB
#Result
print'Average incident optical power = %.2f uW'%(po*10**6)
print' = %.1f dB m'%po1
import math
#Variable declaration
h=6.626*10**-34 #plancks constant
c=2.998*10**8 #velocity of light
e=1.602*10**-19 #1 electron volt
n=0.6 #p–i–n photodiode quantum efficiency
ma=0.5 #modulation index
lam=10**-6 #wavelength
k=1.385*10**-23 #boltzman constant
t=300 #tempreture in kelvin
f=4 #amplifier noise figure
rl=50*10**3 #effective load impedance
sn=3.162*10**4 #signal to noise ratio
B=10**7 #bandwidth
#Calculation
a=h*c/(e*n*ma**2*lam)
b=math.sqrt((8*k*t*f)/rl)
c=math.sqrt(sn*B)
po=a*b*c #optical power
po1=10*math.log10(po*1000) #optical power in dB
#Result
print'Optical power, Po = %.2f uW'%(po*10**6)
print' = %.1f dBm'%po1
import math
#Variable declaration
po=-10 #mean optical power launched into the fiber from the transmitter (100 μm)
rs=-25 #receiver sensitivity
l1=2*3.5 #cable fiber loss
l2=2*0.7 #splice losses
l3=1.6 #connector loss
ms=4.0 #safety margin
afc=3.5
ai=0.7
acr=1.6
ma=7
#Calculation
ts=po-rs #Total system margi
tsl=l1+l2+l3+ms #Total system loss
pm=ts-tsl #Excess power margin
L=((0-rs)-(acr+ma))/(afc+ai)
#Result
print'(a) Total system margin = %d dB'%ts
print' Total system loss = %.1f dB'%tsl
print' Excess power margin = %.1f dB'%pm
print'\n(b) Increase in link length = %.1f Km'%(L)
#Variable declaration
Bop=6*10**6
ts=10 #rise time for source in ns
tn=5*9 #for fiber intermodal
tc=5*2 #for pulse broadening
td=3 #for detector
#Calculation
tsys=0.35/Bop
tsys1=1.1*(ts**2+tn**2+tc**2+td**2)**0.5 #total system rise time
#Result
print'Maximum permitted system rise time = %.1f ns'%(tsys*10**9)
print'Total system rise time = %.1f ns'%(tsys1)
import math
#Variable declaration
fd=400*10**3 #peak frequency deviation
Ba=4*10**3 #bandwidth
#Calculation
Df=fd/Ba #frequency deviation ratio
snr=1.76+(20*math.log10(Df)) #SNR improvement
Bm=2*(Df+1)*Ba #bandwidth of the FM–IM signal
#Result
print'(a) SNR improvement = %.2f dB'%snr
print'(b) Frequency deviation ratio = %d'%Df
print' Bandwidth of FM-IM signal = %d kHz'%(Bm/1000)
import math
#Variable declaration
fm=3 #output FM ratio
pm=1 #output PM ratio
#Calculation
ratio=fm/pm #SNR ratio
ratio1=10*math.log10(ratio) #SNR ratio in dB
#Result
print'Ratio of output SNR = %.2f dB'%(ratio1)
import math
#Variable declaration
to=5*10**-8 #nominal pulse period
fd=5*10**6 #Peak-to-peak frequency deviation
M=60 #A PD multiplication factor
R=0.7 #A PD responsivity
po=10**-7 #peak optical power at receiver
tr=12*10**-9 #Total system 10–90% rise time
B=6*10**6 #baseband noise bandwidth
i=10**-17 #Receiver mean square noise current
#Calculation
snp=(3*(to*fd*M*R*po)**2)/(i*(2*math.pi*tr*B)**2) #peak-to-peak signal to rms noise ratio
snp1=10*math.log10(snp) #in dB
#Result
print'Peak-to-peak signal to rms noise ratio = %.1f dB'%snp1
%matplotlib inline
import math
from pylab import *
from numpy import *
#Variable declaration
acr=1 #connector loss in dB
afc=5 #loss per kilometer in dB
Lbu=0.1 #fiber length between each of the access couplers
Lac=1 #insertion loss
Ltr=10 #loss due to the tap ratio
Lsp=3 #splitting loss
#Calculating, we get two equation in terms of N, no of nodes, i.e C(1,N-1)=(3.5*N)+8.5 and C(star)=4.5+(10*log10(N))
#For Bus distribution system
for N in range(1,13,1):
C=(3.5*N)+8.5;
a=plot(N,C,'.r')
#for Star distribution system
for N in range(1,30,1):
C1=4.5+(10*log10(N));
b=plot(N,C1,'.g')
#To show plot in same graph
#Graphical comparison showing total channel loss against number of nodes
plt.annotate('Linear Bus',xy=(10, 43.5), xytext=(11, 40))
plt.annotate('Star',xy=(16, 15), xytext=(17, 13))
xlabel("Number of nodes $N$")
ylabel("Total channel loss $CL$ (dB)")
title("Characteristics showing the total channel loss against the number of nodes")
grid()
show(a)
show(b)
#Variable declaration
h=6.626*10**-34 #plancks constant
c=2.998*10**8 #velocity of light
lam=1.55*10**-6 #wavelength
L=100*10**3 #length
K=4
B=1.2*10**9 #bandwidth
snr=50 #SNR
a=10**-2.5
pi=10**-3
#Calculation
Lt=(pi*lam*a*L)/(K*h*c*B*snr) #link with a large number of cascaded amplifiers
#Result
print'Maximum system length = %d x 10^4 km'%(Lt/10**7)
import math
#Variable declaration
b=17 #second-order dispersion coefficient for the latter path
L2=20 #path length in km
L1=160.00 #path length in km
s1=-0.075 #dispersion slope
#Calculation
a=-b*L2
G=a/L1 #second-order dispersion coefficient
s2=s1*L1/L2 #chromatic dispersion slope
#Result
print'(a) Second-order dispersion coefficient = %.3f ps nm^-1 km^-1'%G
print'(b) chromatic dispersion slope = %.1f ps nm^-2 km^-1'%s2
import math
#Variable declaration
to=70*10**-12 #bit period
t=6*10**-12 #RZ pulse width
B2=50*10**-12*10**-12*10**-3 #second-order dispersion coefficient
L=50*10**3 #amplifier spacing
#Calculation
qo=0.5*to/t #separation of the soliton pulses
Bt=(2*qo*math.sqrt(B2*L))**-1 #transmission bit rate
#Result
print'(a) Separation = %.1f'%qo
print'(b) Transmission bit rate = %.2f x 10^9'%(Bt*10**-8)
import math
#Variable declaration
to=40*10**-12 #bit period
t=4*10**-12 #RZ pulse width
a=0.2*10**-3 #attenuation coefficient
B2=1.25*10**-12*10**-12*10**-3 #second-order dispersion coefficient
#Calculation
qo=0.5*to/t #separation of the soliton pulses
b=1/(2*qo)
c=math.sqrt(a/B2)
Bt=b*c #transmission bit rate
#Result
print'(a) Separation = %.1f'%qo
print'(b) Transmission bit rate = %.2f x 10^10 bit s^-1'%(Bt*10**-10)