summaryrefslogtreecommitdiff
path: root/Optical_Communication_by_Anasuya_Kalavar/chapter4.ipynb
blob: 408746a49497c847654d34322aa798b153bfab56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
{
 "metadata": {
  "name": "",
  "signature": "sha256:c80be9ee73d5adb979ad6bf2343ea3cff1243505e35fc82560bd445f960931b7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter4 - Signal Degradation in fibers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3.1, page 4-4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import sqrt, pi, log10\n",
      "L=10        #fiber length in km\n",
      "Pin=150*10**-6      #input power\n",
      "Pout=5*10**-6       #output power\n",
      "ln=20        #length of optical link\n",
      "interval=1      #splices after interval of 1 km\n",
      "l=1.2       #loss due to 1 splice\n",
      "attenuation=10*log10(Pin/Pout) \n",
      "alpha=attenuation/L \n",
      "attenuation_loss=alpha*20 \n",
      "splices_loss=(ln-interval)*l \n",
      "total_loss=attenuation_loss+splices_loss \n",
      "power_ratio=10**(total_loss/10) \n",
      "print \"Signal attenuation is %.2f dBs.\\nSignal attenuation is %.3f dB/Km.\\nTotal loss in 20 Km fiber is %.2f dbs.\\nTotal attenuation is %.2f dBs.\\ninput/output ratio is %0.e.\" %(attenuation,alpha,attenuation_loss,total_loss,power_ratio) \n",
      "# Answer wrong for last part."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Signal attenuation is 14.77 dBs.\n",
        "Signal attenuation is 1.477 dB/Km.\n",
        "Total loss in 20 Km fiber is 29.54 dbs.\n",
        "Total attenuation is 52.34 dBs.\n",
        "input/output ratio is 2e+05.\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6.1, page 4-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import exp\n",
      "beta_c=8*10**-11      #isothermal compressibility\n",
      "n=1.46      #refractive index\n",
      "P=0.286     #photoelastic constat\n",
      "k=1.38*10**-23  #Boltzmnn constant\n",
      "T=1500      #temperature\n",
      "L=1000      #length\n",
      "lamda=1000*10**-9   #wavelength\n",
      "gamma_r = 8*(3.14**3)*(P**2)*(n**8)*beta_c*k*T/(3*(lamda**4))       #computing coefficient\n",
      "attenuation=exp(-gamma_r*L)         #computing attenuation\n",
      "print \"Attenuation due to Rayleigh scattering is %.3f.\" %(attenuation) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Attenuation due to Rayleigh scattering is 0.794.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6.2, page 4-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "beta_c=7*10**-11         #isothermal compressibility\n",
      "n=1.46      #refractive index\n",
      "P=0.29     #photoelastic constat\n",
      "k=1.38*10**-23  #Boltzmnn constant\n",
      "T=1400      #temperature\n",
      "L=1000      #length\n",
      "lamda=0.7*10**-6   #wavelength\n",
      "gamma_r = 8*(3.14**3)*(P**2)*(n**8)*beta_c*k*T/(3*(lamda**4))       #computing coefficient\n",
      "attenuation=exp(-gamma_r*L)         #computing attenuation\n",
      "gamma_r=gamma_r\n",
      "print \"Raleigh Scattering corfficient is %.3e per meter\" %(gamma_r) \n",
      "#Attenuation is not calcualted in textbook\"\n",
      "print \"Attenuation due to Rayleigh scattering is %.3f\" %(attenuation) \n",
      "#answer for Raleigh Scattering corfficient in the book is given as 0.804d-3, deviation of 0.003d-3"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Raleigh Scattering corfficient is 8.074e-04 per meter\n",
        "Attenuation due to Rayleigh scattering is 0.446\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7.1, page 4-17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "d=5      #core diameter\n",
      "alpha=0.4   #attenuation\n",
      "B=0.5     #Bandwidth\n",
      "lamda=1.4    #wavelength\n",
      "PB=4.4*10**-3*d**2*lamda**2*alpha*B       #computing threshold power for SBS\n",
      "PR=5.9*10**-2*d**2*lamda*alpha       #computing threshold power for SRS\n",
      "PB=PB*10**3 \n",
      "PR=PR*10**3 \n",
      "print \"Threshold power for SBS is %.1f mW.\\nThreshold power for SRS is %.3f mW.\" %(PB,PR) \n",
      "#NOTE - Calculation error in the book while calculating threshold for SBS.\n",
      "#Also, while calculating SRS, formula is taken incorrectly, \n",
      "#Bandwidth is multiplied in second step, which is not in the formula.\") "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Threshold power for SBS is 43.1 mW.\n",
        "Threshold power for SRS is 826.000 mW.\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8.1, page 4-18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "n1=1.5      #refractive index of core\n",
      "delta=0.03/100      #relative refractive index\n",
      "lamda=0.82*10**-6       #wavelength\n",
      "n2=sqrt(n1**2-2*delta*n1**2)       #computing cladding refractive index\n",
      "Rc=(3*n1**2*lamda)/(4*3.14*(n1**2-n2**2)**1.5)      #computing critical radius\n",
      "Rc=Rc*10**3 \n",
      "print \"Critical radius is %.f micrometer.\" %(Rc)  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Critical radius is 9 micrometer.\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8.2, page 4-20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "n1=1.45      #refractive index of core\n",
      "delta=3.0/100      #relative refractive index\n",
      "lamda=1.5*10**-6       #wavelength\n",
      "a=5*10**-6      #core radius\n",
      "n2=sqrt(n1**2-2*delta*n1**2)       #computing cladding refractive index\n",
      "Rc=(3*n1**2*lamda)/(4*3.14*(n1**2-n2**2)**0.5)      #computing critical radius for single mode\n",
      "Rc=Rc*10**6 \n",
      "print \"Critical radius is %.2f micrometer\" %(Rc) \n",
      "lamda_cut_off= 2*3.14*a*n1*sqrt(2*delta)/2.405 \n",
      "RcSM= (20*lamda/(n1-n2)**1.5)*(2.748-0.996*lamda/lamda_cut_off)**-3       #computing critical radius for single mode\n",
      "RcSM=RcSM*10**6 \n",
      "print \"Critical radius for single mode fiber is %.2f micrometer.\" %(RcSM) \n",
      "#Calculation error in the book.(2.748-0.996*lamda/lamda_cut_off)**-3  in this term raised to -3 is not taken in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Critical radius is 2.12 micrometer\n",
        "Critical radius for single mode fiber is 226.37 micrometer.\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13.1, page 4-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "lamda=1550*10**-9 \n",
      "lamda0=1.3*10**-6 \n",
      "s0=0.095 \n",
      "Dt=lamda*s0/4*(1-(lamda0/lamda)**4)      #computing material dispersion\n",
      "Dt=Dt*10**9 \n",
      "print \"Material dispersion at 1550 nm is %.1f ps/nm/km\" %Dt\n",
      "#answer in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Material dispersion at 1550 nm is 18.6 ps/nm/km\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14.1, page 4-33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "tau=0.1*10**-6      #pulse broadning\n",
      "dist=20*10**3       #distance\n",
      "Bopt=1/(2*tau)      #computing optical bandwidth\n",
      "Bopt=Bopt*10**-6 \n",
      "dispertion=tau/dist         #computing dispersion\n",
      "dispertion=dispertion*10**12 \n",
      "BLP=Bopt*dist       #computing Bandwidth length product\n",
      "BLP=BLP*10**-3 \n",
      "print \"optical bandwidth is %d MHz.\\nDispersion per unit length is %d ns/km.\\nBandwidth length product is %d MHz.km.\" %(Bopt,dispertion,BLP) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "optical bandwidth is 5 MHz.\n",
        "Dispersion per unit length is 5 ns/km.\n",
        "Bandwidth length product is 100 MHz.km.\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15.1, page 4-34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "RSW=0.0012      #relative spectral width\n",
      "lamda=0.90*10**-6   #wavelength\n",
      "L=1         #distance in km (assumed)\n",
      "P=0.025     #material dispersion parameter\n",
      "c=3*10**5       #speed of light in km/s\n",
      "M=10**3*P/(c*lamda)      #computing material dispersion\n",
      "sigma_lamda=RSW*lamda \n",
      "sigmaM=sigma_lamda*L*M*10**7         #computing RMS pulse broadning\n",
      "sigmaB=25*L*M*10**-3 \n",
      "print \"Material dispersion parameter is %.2f ps/nm/km.\\nRMS pulsr broadning when sigma_lamda is 25 is %.1f ns/km.\\nRMS pulse broadning is %.2f ns/km.\" %(M,sigmaB,sigmaM) \n",
      "#answer in the book for RMS pulse broadning is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Material dispersion parameter is 92.59 ps/nm/km.\n",
        "RMS pulsr broadning when sigma_lamda is 25 is 2.3 ns/km.\n",
        "RMS pulse broadning is 1.00 ns/km.\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17.1, page 4-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "L=10         #length of optical link\n",
      "n1=1.49      #refractive index\n",
      "c=3*10**8       #speed of light\n",
      "delta=1.0/100         #relative refractive index\n",
      "delTS=L*n1*delta/c      #computing delay difference\n",
      "delTS=delTS*10**12 \n",
      "sigmaS=L*n1*delta/(2*sqrt(3)*c)     #computing rms pulse broadning\n",
      "sigmaS=sigmaS*10**12 \n",
      "B=1/(2*delTS)         #computing maximum bit rate\n",
      "B=B*10**3 \n",
      "B_acc=0.2/(sigmaS)      #computing accurate bit rate\n",
      "B_acc=B_acc*10**3 \n",
      "BLP=B_acc*L       #computing Bandwidth length product\n",
      "print \"Delay difference is %d ns.\\nRMS pulse broadning is %.1f ns.\\nBit rate is %.1f Mbit/s.\\nAccurate bit rate is %.3f Mbits/s.\\nBandwidth length product is %.1f MHz.km\" %(delTS,sigmaS,B,B_acc,BLP) \n",
      "#answer for maximum bit rate is given as 1.008 Mb/s, deviation of 0.008 Mb/s."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Delay difference is 496 ns.\n",
        "RMS pulse broadning is 143.4 ns.\n",
        "Bit rate is 1.0 Mbit/s.\n",
        "Accurate bit rate is 1.395 Mbits/s.\n",
        "Bandwidth length product is 13.9 MHz.km\n"
       ]
      }
     ],
     "prompt_number": 31
    }
   ],
   "metadata": {}
  }
 ]
}