summaryrefslogtreecommitdiff
path: root/Wireless_Communications_and_Networking_by_V._Garg/ch6.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-09-07 17:46:06 +0530
committerThomas Stephen Lee2015-09-07 17:46:06 +0530
commit78784b374b2d1a9be66eb4ad41470409e2bd4dfa (patch)
tree7b0144248a9d5c9b6c66065697177ee04a30f93e /Wireless_Communications_and_Networking_by_V._Garg/ch6.ipynb
parent41f1f72e9502f5c3de6ca16b303803dfcf1df594 (diff)
downloadPython-Textbook-Companions-78784b374b2d1a9be66eb4ad41470409e2bd4dfa.tar.gz
Python-Textbook-Companions-78784b374b2d1a9be66eb4ad41470409e2bd4dfa.tar.bz2
Python-Textbook-Companions-78784b374b2d1a9be66eb4ad41470409e2bd4dfa.zip
add/update books
Diffstat (limited to 'Wireless_Communications_and_Networking_by_V._Garg/ch6.ipynb')
-rwxr-xr-xWireless_Communications_and_Networking_by_V._Garg/ch6.ipynb466
1 files changed, 466 insertions, 0 deletions
diff --git a/Wireless_Communications_and_Networking_by_V._Garg/ch6.ipynb b/Wireless_Communications_and_Networking_by_V._Garg/ch6.ipynb
new file mode 100755
index 00000000..7c64b872
--- /dev/null
+++ b/Wireless_Communications_and_Networking_by_V._Garg/ch6.ipynb
@@ -0,0 +1,466 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:0b8e52617510df277ef1e48e119f37ff192613df767b6d3b9de6242855aa9cf9"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: Multiple Access Techniques"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.1, Page 158"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Area=8; #in km^2\n",
+ "Cover=4000.;# in km^2\n",
+ "CallBH=1.2; #Avg calls during BH\n",
+ "HT=100; # Avg holding time in sec\n",
+ "Block=0.02; #Blocking=2%\n",
+ "N=4.;#Frequency reuse factor\n",
+ "Spectrum=12.5;# in MHz\n",
+ "CHBW=200;# in kHz\n",
+ "User_CH=8;#No of users per RF channel\n",
+ "\n",
+ "#Calculations&Results\n",
+ "RFCH=Spectrum*1000/CHBW;\n",
+ "TCH=int(RFCH)*User_CH;\n",
+ "SigCH=3;#No of signalling channels per cell\n",
+ "TCH_cell=TCH/N-SigCH;\n",
+ "Cells=Cover/Area;\n",
+ "OffLoad=108.4; # in Erlangs\n",
+ "print 'Using Erlang-B Tables, Total traffic offered by %d channels at 0.02 blocking = %.1f Erlangs/cell'%(TCH_cell,OffLoad*(1-Block));\n",
+ "CarLoad=OffLoad*(1-Block);\n",
+ "Calls_hr_cell=CarLoad*3600/HT;\n",
+ "MaxUser_hr_cell=Calls_hr_cell/CallBH;\n",
+ "Seff=CarLoad*Cells/(Spectrum*Cover);\n",
+ "print 'Spectral Efficiency is %.2f Erlangs/MHz/km^2'%Seff;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Using Erlang-B Tables, Total traffic offered by 121 channels at 0.02 blocking = 106.2 Erlangs/cell\n",
+ "Spectral Efficiency is 1.06 Erlangs/MHz/km^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2, Page 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "TCH=395; # Traffic Channels\n",
+ "SysBW=12.5; #in MHz\n",
+ "CHspace=30.; # in kHz\n",
+ "\n",
+ "#Calculations\n",
+ "Eff=TCH*CHspace/(SysBW*1000);\n",
+ "\n",
+ "#Result\n",
+ "print 'Multiple access spectral efficiency of FDMA System is %.3f'%Eff"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Multiple access spectral efficiency of FDMA System is 0.948\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3, Page 160"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Tf=40; #Frame duration in msec\n",
+ "Mt=6; # Frames per slot\n",
+ "Bu=30; #bandwidth(KHz) of an individual user during his or her time slot\n",
+ "Nu=395.;# number of users sharing the same time slot in the system, but having access to different frequency sub-bands\n",
+ "Bw=12.5; # in MHz\n",
+ "DR=16.2;#Data rate in kbps\n",
+ "FDur=40.; # Frame duration in msec\n",
+ "slots=6; #No of slots per time frame\n",
+ "IndiRate=16.2; #Individual data rate in kbps\n",
+ "Srate=13.; #Speech rate in kbps\n",
+ "\n",
+ "#Calculations\n",
+ "TimeSlot=(Srate/IndiRate)*(FDur/slots);\n",
+ "Seff=TimeSlot*slots*Bu*Nu/(FDur*Bw*1000);\n",
+ "\n",
+ "#Results\n",
+ "print 'Multiple access spectral efficiency of TDMA is %.2f'%Seff;\n",
+ "print 'The overhead portion of the frame is %d percent'%((1-Seff)*100);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Multiple access spectral efficiency of TDMA is 0.76\n",
+ "The overhead portion of the frame is 23 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4, Page 161"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "nb=0.9; #BW efficiency factor\n",
+ "u=2; # Bit Efficiency with QPSK\n",
+ "Vf=1; # Voice activity factor\n",
+ "BW=12.5; #in MHz\n",
+ "IR=16.2; # in kbps\n",
+ "N=19; #frequency reuse factor\n",
+ "\n",
+ "#Calculations\n",
+ "Nu=nb*u*BW*1000/(Vf*IR*N);# number of channels (mobile users) per cell\n",
+ "Seff=int(Nu)*IR/(BW*1000);\n",
+ "\n",
+ "#Results\n",
+ "print 'Capacity of system is %d mobile users per cell'%Nu;\n",
+ "print 'Spectral efficiency of TDMA system is %.3f bit/sec/Hz'%Seff"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacity of system is 73 mobile users per cell\n",
+ "Spectral efficiency of TDMA system is 0.095 bit/sec/Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5, Page 163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Nr=2.;# number of reference bursts per frame\n",
+ "Nt=24; # number of traf\ufb01c bursts (slots) per frame(120msec)\n",
+ "FL=120; #Frame length in msec\n",
+ "Br=148; # number of overhead bits per reference burst\n",
+ "Bp=34; # number of overhead bits per preamble per slot \n",
+ "Bg=8.25;#number of equivalent bits in each guard time interval \n",
+ "Tf=120; # frame duration in msec\n",
+ "Rrf=270.83333333; # bit rate of the RF channel in kbps\n",
+ "R=22.8; #bit rate of each channel in kbps\n",
+ "\n",
+ "#Calculations\n",
+ "B0=Nr*(8*Br)+Nt*(8*Bp)+(Nt+Nr)*(8*Bg);#The number of overhead bits per frame\n",
+ "Bt=FL*10**-3*Rrf*10**3;#The total number of bits per frame \n",
+ "Eff=(1-B0/Bt)*100;\n",
+ "CH_Frame=(Eff/100)*Rrf/R;#No of channels/frame\n",
+ "\n",
+ "#Results\n",
+ "print 'The frame efficiency is %.2f percent'%Eff;\n",
+ "print 'Number of channels/frame are %d'%(CH_Frame)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The frame efficiency is 67.35 percent\n",
+ "Number of channels/frame are 7\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.6, Page 170"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "nb=0.9;#bandwidth ef\ufb01ciency\n",
+ "nf=0.45;#frequency reuse ef\ufb01ciency \n",
+ "Cd=0.8; #capacity degradation factor \n",
+ "Vf=0.4;#voice activity factor \n",
+ "Eb_I0=7; # desired energy-to-interference ratio in dB\n",
+ "L=1;# ef\ufb01ciency of sector-antenna in cell \n",
+ "BW=12.5;#One way system BW in MHz\n",
+ "R=16.2;#Information rate in kbps\n",
+ "\n",
+ "#Calculations\n",
+ "Eb_I=10**(Eb_I0*0.1);#To convert from dB to a normal value\n",
+ "Nu=(nf*nb*Cd*L/Vf)*(BW*1000/(Eb_I*R));#Capacity of system\n",
+ "Seff=round(Nu)*R/(12.5*10**3);\n",
+ "\n",
+ "#Results\n",
+ "print 'Capacity of system is %d mobile users per cell'%round(Nu);\n",
+ "print 'Spectral efficiency of TDMA system is %.3f bits/sec/Hz'%Seff;\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacity of system is 125 mobile users per cell\n",
+ "Spectral efficiency of TDMA system is 0.162 bits/sec/Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.7, Page 171"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "#Given Data from Exa 6.4 and Exa 6.6\n",
+ "Cd=0.8; #capacity degradation factor\n",
+ "R=16.2;#Data rate in kbps\n",
+ "Eb_I0=7; #in dB\n",
+ "Eb_I=10**(Eb_I0*0.1);#To convert from dB to a normal value\n",
+ "Vf=0.4;#voice activity factor \n",
+ "u=2; # Bit Efficiency\n",
+ "IR=16.2; # in kbps\n",
+ "N=19; #frequency reuse factor\n",
+ "nf=0.45;#frequency reuse ef\ufb01ciency \n",
+ "\n",
+ "#Calculations\n",
+ "Ncdma_by_Ntdma=Cd*N*nf*IR/(Eb_I*Vf*u*R);\n",
+ "\n",
+ "#Result\n",
+ "print 'The ratio of capacity of DS-CDMA to TDMA is %.3f'%Ncdma_by_Ntdma"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The ratio of capacity of DS-CDMA to TDMA is 1.706\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.8, Page 172"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Bss=600; #Hopping bandwidth in MHz\n",
+ "stepsize=400; # in Hz\n",
+ "\n",
+ "#Calculations\n",
+ "No_of_Tones=Bss*10**6/stepsize;\n",
+ "Min_chips_required=math.log(No_of_Tones,2);\n",
+ "\n",
+ "#Result\n",
+ "print 'Minimum number of chips required are %d chips'%Min_chips_required"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Minimum number of chips required are 20 chips\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.9, Page 179"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "e=2.71828; #Euler's number\n",
+ "Tprop=0.4; #Max propogation delay in sec\n",
+ "R=10; #data rate in Mbps\n",
+ "PackLen=400; #packet length in bits\n",
+ "\n",
+ "#Calculations\n",
+ "Tp=PackLen/R; #packet transmission time in microsec\n",
+ "a=Tprop/Tp;\n",
+ "G=Tp*10**-6*R*10**6/PackLen;#normalized offered traf\ufb01c load \n",
+ "#Slotted nonpersistent\n",
+ "S0=a*G*e**(-a*G)/(1-e**(-a*G)+a);#normalized throughput \n",
+ "#Unslotted nonpersistent\n",
+ "S1=G*e**(-a*G)/(1+(2*a)+e**(-a*G));#normalized throughput \n",
+ "#Slotted 1-persistent\n",
+ "S2=G*e**(-G*(1+a))*(1+a-e**(-a*G))/((1+a)*(1-e**(-a*G))+a*e**(-G*(1+a)));#normalized throughput \n",
+ "\n",
+ "#Results\n",
+ "print 'The Normalized throughput with an unslotted non persistent,a slotted persistent and a slotted 1-persistent CSMA protocol are \\n %.3f,%.3f and %.3f respectively'%(S0,S1,S2);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Normalized throughput with an unslotted non persistent,a slotted persistent and a slotted 1-persistent CSMA protocol are \n",
+ " 0.496,0.493 and 0.531 respectively\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.10, Page 188"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Tprop=4; #maximum propogation delay in sec\n",
+ "R=10; # data rate in Mbps\n",
+ "PackLen=400.; #data packet length in bits\n",
+ "ACK=20; #length of ACK packet in bits\n",
+ "Tproc=1; #processing time(sec)\n",
+ "p=0.01;#probability that a data packet or its ACK can be corrupted during transmission\n",
+ "\n",
+ "#Calculations\n",
+ "Tp=PackLen/R; #packet transmission time in microsec\n",
+ "Ta=ACK/R; # transmission time for an ACK in microsec\n",
+ "T=Tp+2*Tprop+2*Tproc+Ta;# total time for transmission time \n",
+ "# Stop and wait ARQ\n",
+ "Eff0=(1-p)*Tp/((1-p)*T+p*Tp);\n",
+ "#SRP with window size W=8\n",
+ "W=8;\n",
+ "Eff1=(2+p*(W-1))/(2+p*(3*W-1));\n",
+ "#Go-Back-N protocol with window size W=8\n",
+ "Eff2=1./(1+W*(p/(1-p)));\n",
+ "\n",
+ "#Results\n",
+ "print 'The data link protocol efficiency with Stop and Wait protocol, SRP and GBN are \\n %.3f, %.3f abd %.3f respectively'%(Eff0,Eff1,Eff2);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The data link protocol efficiency with Stop and Wait protocol, SRP and GBN are \n",
+ " 0.763, 0.928 abd 0.925 respectively\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file