summaryrefslogtreecommitdiff
path: root/Wireless_Communications_and_Networking_by_V._Garg/ch21.ipynb
blob: 8bbb0588239ca7493ba04b3e13ff3ffbbc49b734 (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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
{
 "metadata": {
  "name": "",
  "signature": "sha256:0dee4e43707ceeefa5dfd2c385df6788c5d4953bcdfe972a22a90a0c7cd8abc7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 21: Wireless Local Area Networks"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.1, Page 727"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import sympy\n",
      "from sympy import * \n",
      "\n",
      "#Variable declaration\n",
      "Fl=902; #lower limit frequency MHz\n",
      "Fh=928; #higher limit frequency in MHz\n",
      "Rt=0.5; #symbol transmission rate in Mega symbols per sec\n",
      "S=16; #No of symbols\n",
      "BER=10**-5;#Bir error rate\n",
      "SG=2.6;#sector gain\n",
      "B=0.5; #Interference factor\n",
      "a=0.9; #power control efficiency\n",
      "\n",
      "#Calculations&Results\n",
      "BW=Fh-Fl;\n",
      "Rb=Rt*math.log(S,2);\n",
      "Gp=BW/Rb;\n",
      "x = symbols('x')\n",
      "y = solve(0.5*(1-erf(sqrt(x)))-10**-5,x)\n",
      "M=Gp/y[0] * 1/(1+B) * SG * a;\n",
      "print 'Number of users that can be supported by the WLAN are %d'%M\n",
      "eff=Rb*int(M)/BW;\n",
      "print 'The bandwidth efficiency is %.2f bps/Hz'%eff"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of users that can be supported by the WLAN are 2\n",
        "The bandwidth efficiency is 0.15 bps/Hz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.2, Page 733"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Stepsize=200.; #in Hz\n",
      "Chipsmin=20.;#length of linear feedback shift register \n",
      "Datarate=1.2*10**3;  #bps\n",
      "\n",
      "#Calculations\n",
      "No_of_tones=2**Chipsmin;\n",
      "Bss=No_of_tones*Stepsize;\n",
      "Chiprate=Datarate*Chipsmin;\n",
      "Gp=Bss/Datarate;#processing gain\n",
      "Symbolrate=Datarate/3;  #8-ary FSK is used\n",
      "Chips_symbol=Chiprate/Symbolrate;\n",
      "\n",
      "#Results\n",
      "print 'The Hopping Bandwidth is %.3f MHz'%(Bss/10**6);\n",
      "print 'The chiprate is %d kchip/sec'%(Chiprate/10**3);\n",
      "print 'Chips per symbol are %d'%(Chips_symbol);\n",
      "print 'The processing gain is %.1f'%Gp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Hopping Bandwidth is 209.715 MHz\n",
        "The chiprate is 24 kchip/sec\n",
        "Chips per symbol are 60\n",
        "The processing gain is 174762.7\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.3, Page 734"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "InfoSc=48.;#Information subcarriers\n",
      "SyncSc=4.;#synchronization subcarriers\n",
      "ReservedSc=12.;#Reserved subcarriers\n",
      "Symrate=250.;  #ksps(kilosymbols per second)\n",
      "BW=20.;  #/in MHz\n",
      "Grdt=800.; #Guard time in nsec\n",
      "\n",
      "#Calculations\n",
      "TotalSc=InfoSc+SyncSc+ReservedSc;#Total subcarriers\n",
      "BW_Sch=BW*10**6/TotalSc;#BW of subchannel\n",
      "Mod_eff=Symrate*10**3/(BW_Sch);#Modulation efficiency\n",
      "User_txrate=InfoSc*Symrate*10**3;\n",
      "User_bitsymbol=4;  #16-QPSK is used\n",
      "User_DR=36; #Mbps\n",
      "Sym_Dur=1./(Symrate*10**3);\n",
      "TimeUti=Sym_Dur/(Sym_Dur+(Grdt/10**9));\n",
      "\n",
      "#Results\n",
      "print 'The bandwidth of subchannel is %.1f kHz'%(BW_Sch/10**3);\n",
      "print 'Modulation efficiency is %.1f symbols/sec/Hz'%Mod_eff\n",
      "print 'User symbol rate is %d Msps'%(User_txrate/10**6);\n",
      "print 'Time Utilization efficiency is %.2f'%TimeUti"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The bandwidth of subchannel is 312.5 kHz\n",
        "Modulation efficiency is 0.8 symbols/sec/Hz\n",
        "User symbol rate is 12 Msps\n",
        "Time Utilization efficiency is 0.83\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.4, Page 735"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Eb_No=10;  #in dB\n",
      "Noise=-120; #in dBm\n",
      "Pt=20; #in mwatt\n",
      "R=1; #Data rate in Mbps\n",
      "CHBW=0.5; #BW in MHz\n",
      "A=37.7;  #path loss at the \ufb01rst meter in dB\n",
      "Y=3.3; #path loss exponent\n",
      "Lf=19; #function relating power loss with number of \ufb02oors n        (in dB)\n",
      "Ls=10;  # lognormally distributed random variable representing the shadow effect in dB \n",
      "\n",
      "#Calculations\n",
      "S2Nreqd=Eb_No*R/CHBW;\n",
      "Rx_sensi=Noise+S2Nreqd;\n",
      "Lp=10*math.log10(20)-Rx_sensi;\n",
      "#Lp=A+10Ylod(d)+Lf+Ls;therefore\n",
      "d=10**((Lp-A-Lf-Ls)/(10*Y));\n",
      "\n",
      "#Result\n",
      "print 'The coverage of AP is %.1f metres'%d;"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The coverage of AP is 25.3 metres\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.5, Page 758"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R=3./4;#code rate of convolution encoder\n",
      "M1=9.; #payload transmission rate in Mbps for mode 1\n",
      "M2=36.; #payload transmission rate in Mbps for mode 2\n",
      "\n",
      "#Calculations&Results\n",
      "D1=M1*10**6/48;#user data  rate in kbps for mode 1 \n",
      "D2=M2*10**6/48;#user data rate in kbps for mode 2 \n",
      "#Refering to Table 21.11\n",
      "print 'Data transmission rate per carrier with 3/4 convolution encoder are %.1f Kbps and %d Kbps'%(D1/10**3,D2/10**3);\n",
      "C1=D1/R;\n",
      "C2=D2/R;\n",
      "print 'Carrier transmission rate with R=3/4 convolutional encoder are %d Kbps and %d Kbps'%(C1/10**3,C2/10**3);\n",
      "print 'Carrier symbol rate with R=3/4 convolutional encoder are %d ksps and %d Ksps'%(C1/10**3,C2/4/10**3);  #Mode1 as BPSK and MOde2 as 16-QAM"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Data transmission rate per carrier with 3/4 convolution encoder are 187.5 Kbps and 750 Kbps\n",
        "Carrier transmission rate with R=3/4 convolutional encoder are 250 Kbps and 1000 Kbps\n",
        "Carrier symbol rate with R=3/4 convolutional encoder are 250 ksps and 250 Ksps\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.6, Page 759"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R=3./4; #code rate for convolution encoder\n",
      "\n",
      "#Calculations\n",
      "#64-QAM modulation is used\n",
      "Sc=250; #Carrier symbol rate(ksps) from Exa 21.5\n",
      "Bits_sym=math.log(64,2); #64-QAM is used\n",
      "User_R=Bits_sym*Sc*10**3*R*48;\n",
      "\n",
      "#Result\n",
      "print 'The user data rate is %d Mbps'%(User_R/10**6);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The user data rate is 54 Mbps\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.7, Page 762"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "D=1000.*8;  #packet size in bits\n",
      "R=2.*10**6;  #transmission rate in bps\n",
      "L=3.; #msec(Dwell time)\n",
      "H=0.625; #msec(Duration of BT packet)\n",
      "\n",
      "#Calculations\n",
      "Tw=10**3*D/R;   #the packet duration of IEEE 802.11 in msec\n",
      "H_L=1.;\n",
      "G=(H_L)*L-Tw-H;\n",
      "Gm=abs(G);\n",
      "PER_FH=1-((1-Gm/L)*(78./79)**(H_L)+Gm/L*(78./79)**((H_L)-G/Gm));\n",
      "PER_DS=1-((1-Gm/L)*(57./79)**(H_L)+Gm/L*(57./79)**((H_L)-G/Gm));\n",
      "\n",
      "#Results\n",
      "print 'The PER for FH packet and PER for DS packet are %d percent & %.2f percent respectively'%(round(PER_FH*100),PER_DS*100);\n",
      "print \"The collision probability with 802.11 DS is much higher than with 802.11 FH.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The PER for FH packet and PER for DS packet are 2 percent & 38.73 percent respectively\n",
        "The collision probability with 802.11 DS is much higher than with 802.11 FH.\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.8, Page 765"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "d=10; # distance between AP and IEEE 802.11 device in metres\n",
      "Y=4; #path loss exponent\n",
      "PBt=20;  #the transmitted power by the BT in dBm\n",
      "PAp=40;  #the transmitted power by the AP in dBm\n",
      "Pe=10**-5;#acceptable error probability\n",
      "\n",
      "#Calculations\n",
      "#Pe=0.5*e**(-0.5*Eb/No)\n",
      "SIR=math.log(Pe/0.5)/(-0.5);# signal-to-interference ratio \n",
      "rmax=d*(SIR*PBt/PAp)**(1./Y);# range of interference between Bluetooth and 802.11 device \n",
      "\n",
      "#Results\n",
      "print 'Minimum SIR is %.2f dB = %.1f'%(10*math.log10(SIR),SIR);\n",
      "print 'Maximum coverage range is  %.2f metres'%rmax;"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum SIR is 13.35 dB = 21.6\n",
        "Maximum coverage range is  18.14 metres\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.9, Page 765"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "SIRmin=21.6; #From eg 21.8 i.e(13.36 dB)\n",
      "d=10; #distance between AP and IEEE 802.11 device in m\n",
      "PMs=40; # transmitted power of the IEEE 802.11 device in dBm\n",
      "PBt=20; #the transmitted power by the BT in dBm\n",
      "Y=4 ; #path loss exponent\n",
      "\n",
      "#Calculations\n",
      "rmax=d*(SIRmin*PMs/PBt)**(1./Y);\n",
      "\n",
      "#Result\n",
      "print 'Maximum coverage range is %.1f metres'%rmax"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum coverage range is 25.6 metres\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21.10, Page 765"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Gp=11;#processing gain(given)\n",
      "#Defining variables from Exa 21.8 & 21.9\n",
      "PBt=20; #  transmitted power by the BT in dBm\n",
      "PMs=40;  # transmitted power of the IEEE 802.11 device in dBm\n",
      "PAp=40;  # transmitted power by the AP in dBm\n",
      "d=10;  # distance between AP and IEEE 802.11 device in m\n",
      "Y=4;  #path loss exponent\n",
      "Pe=10**-5;#Error probability\n",
      "\n",
      "#Calculations&Results\n",
      "#Pe=0.5*e**(-0.5*Eb/No)\n",
      "SIR=math.log(Pe/0.5)/(-0.5);\n",
      "r1max=d*(SIR*PBt/(PAp*Gp))**(1./Y);# range of interference between Bluetooth and 802.11 device \n",
      "print 'Maximum coverage range for IEEE 802.11 DS is  %.2f metres'%r1max\n",
      "r2max=d*(SIR*PMs/(PBt*Gp))**(1./Y);\n",
      "print 'Maximum coverage range for IEEE 802.11 FH is %.2f metres'%r2max;\n",
      "print \"Thus, the interference ranges are smaller for the IEEE 802.11 DS device than the IEEE 802.11 FH device.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum coverage range for IEEE 802.11 DS is  9.96 metres\n",
        "Maximum coverage range for IEEE 802.11 FH is 14.08 metres\n",
        "Thus, the interference ranges are smaller for the IEEE 802.11 DS device than the IEEE 802.11 FH device.\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}