summaryrefslogtreecommitdiff
path: root/Optical_fiber_communication_by_gerd_keiser/chapter7_2.ipynb
blob: c47a16e13b0b0f7ff35a8b891ea02c0be095775c (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:52945d2ecbd107493bfdff515b21007d6d8bd600f51e01015bc9fd9a03be50eb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7: Optical receiver operation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.1, Page Number: 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "bon = 1.0                                            #signal on level\n",
      "boff = 0.0                                           #signal off level\n",
      "sigma_on = 1.0                                       #variance sigma-on level\n",
      "sigma_off = 1.0                                      #variance sigma-on level\n",
      "\n",
      "#calculation\n",
      "Q = (bon - boff)/(sigma_on + sigma_off)              #parameter value\n",
      "Vth = bon-Q*sigma_on                                 #optimum decision threshold\n",
      "\n",
      "#result\n",
      "print \"Q parameter value = \" ,Q\n",
      "print \"Optimum decision threshold Vth = \",Vth"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Q parameter value =  0.5\n",
        "Optimum decision threshold Vth =  0.5\n"
       ]
      }
     ],
     "prompt_number": 69
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2, Page Number: 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import matplotlib.pyplot as plt\n",
      "import numpy as np\n",
      "import scipy as sp\n",
      "from scipy import special\n",
      "\n",
      "%matplotlib inline\n",
      "\n",
      "#variable declaration\n",
      "Q = 6.0                                              #parameter value from figure\n",
      "\n",
      "#calculation\n",
      "Pe = (1.0/2.0)*(1-math.erf(Q/math.sqrt(2.0)))        #probability of error \n",
      "S_N_dB = 10*math.log10(2*Q)                          #signal to naoise ratio (dB)\n",
      "\n",
      "#result\n",
      "print \"Probability of error = \" ,round(Pe,10)\n",
      "print \"Signal to naoise ratio =\",round(S_N_dB,1),\"dB\"\n",
      "\n",
      "#plot\n",
      "q1=arange(0.0, 8.0, 0.5)\n",
      "Pe1 = (1.0/2.0)*(1-sp.special.erf(q1/sqrt(2.0))) \n",
      "plot(-q1+8,-Pe1)\n",
      "ylabel('BER (Pe)')\n",
      "xlabel('factor Q')\n",
      "title('Plot of BER (Pe) versus the factor Q')\n",
      "text(6,-0.3,'Q=5.99 for')\n",
      "text(6,-0.35,' Pe=10^-9')    "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Probability of error =  1e-09\n",
        "Signal to naoise ratio = 10.8 dB\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 4,
       "text": [
        "<matplotlib.text.Text at 0xa73bd30>"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEZCAYAAABiu9n+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VOX59/HPRYKgsoRFlgAalF12FKyyBAXc0bYqoLUU\nl1pbl/rzUbFu6GPV1sdaq9VflWrViktREXcpGrVWxQVUkEVUlKAJCrIobsD1/HFOcBhmMlkmOTOT\n7/v1mldm5tznPtdMkrnmXs59zN0RERFJpFHUAYiISOZSkhARkaSUJEREJCklCRERSUpJQkREklKS\nEBGRpJQkREQkKSWJHGVmJWZ2cj0d63QzKzezDWbWqj6OmSKeJma2yMza17KeM8zsmnTFlYnMbJqZ\n3Z2munY2s0fNbJ2Z3Z+OOiV6ShJZzMxWmNkmM9toZmVmdoeZ7Rpu9vCWqo4iM9tqZjX6WzCzxsB1\nwEHu3sLdv0hS/8aYOP9qZvlJXkfF7S/htl+Y2ZbwufVmtsDMDk8R1i+B5929PKzjH2b2bVjHGjN7\nxsx6VuHl3QacYGa7Vec9yVRmVmxmK+OeTufZtMcA7YDW7j6hppWEv/MX0xfWtnr7mNnsMIltMLO5\nZjYs3cfJNUoS2c2BI9y9OTAY2Ae4uIZ1WQ336wA0BRanKNcyjLMf8CPgNzHbtr2OmNtZMdtfCvct\nAG4G7jOzFpUc6zQg9tuxA38I6+gMrAb+keqFufu3wJPAz1OVrS0zy6vrYyQ7dBrr2gNY5u5b01hn\ntSV6L81sL+Al4C2gCOgIzALmmNm+9RpgllGSyBHu/gnwFLB3/DYLXBx+Yy83sztjPmRfCH+uC79p\n7/DNKuy++bOZrQpv15vZTmbWgx+Swzoz+3cV4vwMmAP0qcbLs3BfB/4J7Ap0T1jQbHdgT+DVJMf/\nGrgX6BuWLzSzB81stZl9YGZnxu1SAiRsuZjZLWZ2bdxzj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Qgkv0itQrJQmRyrUguHoXwC9i\nnp8DnBauRltxIReAjeE+EHyojzKzNmG5icDzVTjmtcBfzKxpWPcYoDfBdRRE6pWShMiOYr/h/xG4\n2szeJFiSvmLbdILLP74dDj5PCp+/lWDQe254MZ+pBBdGWgC87u6PJjjG9gd3vxGYF9b9IXAnMNbd\nv0vLqxOpBg1ci2Sw8PoEDwPz3P3iqOORhkdJQkREklJ3k4iIJKUkISIiSSlJiIhIUkoSIiKSlJKE\niIgkpSQhIiJJKUmIiEhS/x8iKeBNY2dz/AAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0xa4e30b8>"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3, Page Number: 259"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.3(a)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "s_n=8.5                            #signal-to-noise ratio\n",
      "s_n_db=18.6                        #signal-to-noise ratio (dB)\n",
      "tele_rate=1.544                    #telephone rate\n",
      "v_by_sig=12.0                      #peak signal-to-rms-noise ratio\n",
      "v_by_sig_db=21.6                   #peak signal-to-rms-noise ratio(dB)\n",
      "\n",
      "#calculation\n",
      "Pe1=(1.0/math.sqrt(2.0*math.pi))*(math.exp(-((s_n**2.0)/8.0))/(s_n/2.0))    #Probability of error 1    \n",
      "q=v_by_sig/2                                                                #parameter value\n",
      "ber=(1.0/2.0)*(1.0-math.erf(q/math.sqrt(2.0)))                              #bit error rate or Probability of error 2\n",
      "\n",
      "#result\n",
      "print \"Probability of error for signal-to-noise ratio 8.5 = \", round(Pe1,5)\n",
      "print \"Probability of error for peak signal-to-rms-noise ratio 12.0 = \", round(ber,10)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Probability of error for signal-to-noise ratio 8.5 =  1e-05\n",
        "Probability of error for peak signal-to-rms-noise ratio 12.0 =  1e-09\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.3(b)"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "v_by_sig=13.0                      #peak signal-to-rms-noise ratio for SONET\n",
      "v_by_sig_db=22.3                   #peak signal-to-rms-noise ratio(dB) for SONET\n",
      "\n",
      "#calculation\n",
      "q=v_by_sig /2                                       #parameter value\n",
      "ber=(1.0/(2.0*4.0))*(1.0-math.erf(q/math.sqrt(2.0)))      #bit error rate or Probability of error \n",
      "\n",
      "#result\n",
      "print \"Probability of error for peak signal-to-rms-noise ratio 13.0 = \", round(ber,11), \"OR\",round(ber/10,12)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Probability of error for peak signal-to-rms-noise ratio 13.0 =  1e-11 OR 1e-12\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.4, Page Number: 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "h = 6.625*10**-34                   #planks constant(J*s)\n",
      "C = 3*10**8                         #freespace velocity(m/s)\n",
      "B = 10**6                           #data rate(Mb/s)\n",
      "Lambda = 850*10**-9                 #Wavelength (m)\n",
      "\n",
      "#calculation\n",
      "tuo = 2.0/B\n",
      "E = 20.7*h*C/Lambda                     #Energy of incident photon\n",
      "Pi = E/tuo                              #Minimum incident optical power(W)\n",
      "Pi_db = 10.0*(math.log10(Pi))-(-40)     #optical power level with reference 1mW = -40dBm\n",
      "\n",
      "#result\n",
      "print \"Minimum incident optical power = \",round(Pi*10**13,2),\"pW\"\n",
      "print \"Optical power level with reference 1mW = \",round(Pi_db,1),\"dBm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum incident optical power =  24.2 pW\n",
        "Optical power level with reference 1mW =  -76.2 dBm\n"
       ]
      }
     ],
     "prompt_number": 75
    }
   ],
   "metadata": {}
  }
 ]
}