diff options
Diffstat (limited to 'Wireless_Communications_and_Networking_by_V._Garg/ch21.ipynb')
-rwxr-xr-x | Wireless_Communications_and_Networking_by_V._Garg/ch21.ipynb | 476 |
1 files changed, 476 insertions, 0 deletions
diff --git a/Wireless_Communications_and_Networking_by_V._Garg/ch21.ipynb b/Wireless_Communications_and_Networking_by_V._Garg/ch21.ipynb new file mode 100755 index 00000000..8bbb0588 --- /dev/null +++ b/Wireless_Communications_and_Networking_by_V._Garg/ch21.ipynb @@ -0,0 +1,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": {} + } + ] +}
\ No newline at end of file |