#Given
B= 15*10**-6
L= 4
BER= 1*10**-9
Ls= 0.5
Lc= 1.5
alpha= 6
Pm= 8
Pt= 2*Lc +(alpha*L)+(Pm)
print " The actual loss in fibre in dB =",int(Pt)
Pmax = -10-(-50)
print " \nThe maximum allowable system loss in dBm = ",Pmax
#Given
import math
Ps= 0.1
alpha = 6
L= 0.5
Ps = 10*math.log10(Ps)
NA= 0.25
Lcoupling= -10*math.log10(NA**2)
Lf= alpha*L
lc= 2*2
Pm= 4
Pout = Ps-(Lcoupling+Lf+lc+Pm)
print " The actual power output in dBm = ",int(Pout)
Pmin = -35
print " Minimum input power required in dBm= ",Pmin
print " As Pmin > Pout, system will perform adequately over the system operating life."
#Given
Ps= 5
Lcoupling = 3
Lc= 2
L_splicing = 50*0.1
F_atten = 25
L_total = Lcoupling+Lc+L_splicing+F_atten
P_avail = Ps-L_total
sensitivity = -40
loss_margin = -sensitivity-(-P_avail)
print " The loss margin of the system in dBm= -",loss_margin
sensitivity_fet = -32
loss_margin_fet=-sensitivity_fet-(-P_avail)
print "The loss marging for the FET receiver in dBm= -",loss_margin_fet
#Given
LED_output = 3
PIN_sensitivity = -54
allowed_loss= LED_output -(-PIN_sensitivity)
Lcoupling = 17.5
cable_atten = 30
power_margin_coupling= 39.5
power_margin_splice=6.2
power_margin_cable=9.5
final_margin= power_margin_coupling+power_margin_splice+power_margin_cable
print " The safety margin in dB =",final_margin
# Answer in book is wrong...
print " \n***NOTE- Answer wrong in book..."
#Given
optical_power=-10
receiver_sensitivity=-41
total_margin= optical_power-receiver_sensitivity
cable_loss= 7*2.6
splice_loss= 6*0.5
connector_loss= 1*1.5
safety_margin= 6
total_loss= cable_loss+splice_loss+connector_loss+safety_margin
excess_power_margin= total_margin-total_loss
print " The system is viable and provides excess power margin in dB=",excess_power_margin
#Given
import math
Ttx= 15
Tmat=21
Tmod= 3.9
BW= 25.0
Trx= 350.0/BW
Tsys = math.sqrt(Ttx**2+Tmat**2+Tmod**2+Trx**2)
print " The system rise time in ns.= ",round(Tsys,2)
#Given
import math
Ttrans = 1.75*10**-9
Tled = 3.50*10**-9
Tcable=3.89*10**-9
Tpin= 1*10**-9
Trec= 1.94*10**-9
Tsys= math.sqrt(Ttrans**2+Tled**2+Tcable**2+Tpin**2+Trec**2)
Tsys=Tsys*10**9 # converting in ns for dislaying...
print " The system rise time in ns= ",round(Tsys,2)
Tsys=Tsys*10**-9
BW= 0.35/Tsys
BW=BW/1000000.0 # converting in MHz for dislaying...
print " \nThe system bandwidth in MHz =",round(BW,2)
#Given
import math
Ttx= 8*10**-9
Tintra= 1*10**-9
Tmodal=5*10**-9
Trr= 6*10**-9
Tsys= math.sqrt(Ttx**2+(8*Tintra)**2+(8*Tmodal)**2+Trr**2)
BWnrz= 0.7/Tsys
BWnrz=BWnrz/1000000 # converting in ns for dislaying...
BWrz=0.35/Tsys
BWrz=BWrz/1000000 # converting in ns for dislaying...
print " Maximum bit rate for NRZ format in Mb/sec= ",round(BWnrz,2)
print " \nMaximum bit rate for RZ format in Mb/sec= ",round(BWrz,2)
#Given
import math
Ts= 10*10**-9
Tn=9*10**-9
Tc=2*10**-9
Td=3*10**-9
BW= 6*10**6
Tsyst= 1.1*math.sqrt(Ts**2+(5*Tn)**2+(5*Tc)**2+Td**2)
Tsyst=Tsyst*10**9 # converting in ns for displying...
Tsyst_max = 0.35/BW
Tsyst_max=Tsyst_max*10**9 # converting in ns for displying...
print " Rise system of the system in ns= ",round(Tsyst,2)
print " \nMaximum Rise system of the system in ns= ",round(Tsyst_max,2)
print " \nSpecified components give a system rise time which is adequate for the bandwidth and distance requirements of the optical fibre link."
#Given
del_t_1 = 10*100*10**-9
Bt_nrz_1 = 0.7/(del_t_1*1000000)
Bt_rz_1 = 0.35/(del_t_1*1000000)
print "First case."
print " \nBit rate for nrz in Mb/sec= ",Bt_nrz_1
print " \nBit rate for rz in Mb/sec= ",Bt_rz_1
del_t_2 = 20*1000*10**-9
Bt_nrz_2 = 0.7/(del_t_2*1000000)
Bt_rz_2 = 0.35/(del_t_2*1000000)
print " \n\nSecond case"
print " \nBit rate for nrz in Mb/sec= ",Bt_nrz_2
print " \nBit rate for rz in Mb/sec= ",Bt_rz_2
del_t_3 = 2*2000*10**-9
Bt_nrz_3 = 0.7/(del_t_3*1000)
Bt_rz_3 = 0.35/(del_t_3*1000)
print " \n\nThird case"
print " \nBit rate for nrz in BITS/sec= ",int(Bt_nrz_3)
print " \nBit rate for rz in BITS/sec= ",Bt_rz_3