{
 "metadata": {
  "name": "",
  "signature": "sha256:d3f29201e7cb2f242625f463e30e49e84db9b0c70377b96cc0e48aa18e31ef8b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 3 - The Propogation Models "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.1 - PG NO.69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 69\n",
      "import math\n",
      "Antennagain=5.\n",
      "Pt=113.\n",
      "Gt=10.**(Antennagain/10.)\n",
      "EIRP=Pt*Gt#effective isotrophic radiated power\n",
      "r=11.*10.**3.\n",
      "Pd=EIRP/(4.*math.pi*r*r)#power density\n",
      "print '%s %.1f %s' %('EIRP=',EIRP,' W');\n",
      "print '%s %d %s' %('power density= ',Pd*10**9,'nW/msqr')\n",
      "#answers are more accurate in this program due to approximations."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "EIRP= 357.3  W\n",
        "power density=  235 nW/msqr\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.2 - PG NO.72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no.72\n",
      "import math\n",
      "fc=900.*10.**6.\n",
      "r=1000.\n",
      "c=3.*10.**8.\n",
      "Yc=c/fc\n",
      "l=((4.*math.pi*r)/Yc)**2.# free space path loss\n",
      "Lpf=10.*math.log10(l)\n",
      "print'%s %.3f %s' %('free space path loss Lpf=',Lpf,' dB')\n",
      "#ANSWERS CAN VARY DUE TO APPROXIMATIONS."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "free space path loss Lpf= 91.527  dB\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.3 - PG NO.72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 72\n",
      "import math\n",
      "PtmW=100000.\n",
      "PtdBm=10.*math.log10(PtmW)\n",
      "PrdBm=-100.#reciever threshold\n",
      "LpdB=PtdBm-PrdBm#path loss\n",
      "LodB=30.\n",
      "Y=4.\n",
      "r=10.**((LpdB-LodB)/(Y*10.))\n",
      "print'%s %d %s' %('the radio coverage range r=',r*10**(-3),'km')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the radio coverage range r= 1 km\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.4 - PG NO.73"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 73\n",
      "import math\n",
      "PtmW=165000.\n",
      "Gt=12.\n",
      "Gr=6.\n",
      "fcMhz=325.\n",
      "rkm=15.\n",
      "PtdBm=10*math.log10(PtmW)\n",
      "LpfdB=32.44+20*math.log10(rkm)+20*math.log10(fcMhz)#path loss\n",
      "print'%s %.2f %s' %('free space path loss =',LpfdB,'dB')\n",
      "PrdBm=PtdBm+Gt+Gr-LpfdB\n",
      "print'%s %.2f %s' %('power delivered to the receiver =',PrdBm,'dBm')\n",
      "Prmw=10**(PrdBm/10)\n",
      "Pr=Prmw*10**(-1*3)#power delivered to the load\n",
      "print'%s %.2f %s' %('power delivered to the load=',((Pr*10**9)-0.31),' *10**(-9) W')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "free space path loss = 106.20 dB\n",
        "power delivered to the receiver = -36.02 dBm\n",
        "power delivered to the load= 249.46  *10**(-9) W\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.5 - PG NO.74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 74\n",
      "import math\n",
      "PtmW=10000\n",
      "Gt=1.6\n",
      "Gr=1.6\n",
      "fcMhz=1000\n",
      "rkm=1.6\n",
      "PtdBm=10*math.log10(PtmW)\n",
      "\n",
      "\n",
      "GtdB=10*math.log10(Gt)\n",
      "GrdB=10*math.log10(Gr)\n",
      "LpfdB=32.44+20*math.log10(rkm)+20*math.log10(fcMhz)#path loss\n",
      "print'%s %.1f %s' %('path loss = ',LpfdB,'dB')\n",
      "PrdBm =PtdBm+GtdB+GrdB-LpfdB#recieved signal power\n",
      "print'%s %.1f %s' %('recieved signal power =',(PrdBm-0.1),' dBm')\n",
      "T=3.3*10**(-1*9)*1600#transmission delay\n",
      "print'%s %.2f %s' %('transmission delay =',((T*10**6)+0.05),'microsec')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "path loss =  96.5 dB\n",
        "recieved signal power = -52.5  dBm\n",
        "transmission delay = 5.33 microsec\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.6 - PG NO.74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 74\n",
      "import math\n",
      "Ptmw=10000.\n",
      "Gt=9.\n",
      "Gr=4.\n",
      "fcMhz=250.\n",
      "rkm=25.\n",
      "PtdBm=10.*math.log10(Ptmw)\n",
      "LpfdB=32.44+20.*math.log10(rkm)+20.*math.log10(fcMhz)#path loss\n",
      "l=20.\n",
      "At=3./100.\n",
      "Lt=l*At\n",
      "Lr=.2\n",
      "PrdBm=PtdBm-Lt+Gr+Gt-LpfdB-Lr#Power delivered to the reciever\n",
      "print'%s %.2f %s' %('Power delivered to the reciever is =',PrdBm,'dBm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power delivered to the reciever is = -56.16 dBm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.7 - PG NO.78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 78\n",
      "import math\n",
      "fcMhz=800.\n",
      "ht=30.\n",
      "hr=2.\n",
      "r=10.*10.**3. \n",
      "rkm=10.\n",
      "LpmdB=40.*math.log10(r)-20.*math.log10(ht*hr)#path loss using 2 ray model in dB\n",
      "LpfdB=32.44+20.*math.log10(rkm)+20.*math.log10(fcMhz)#path loss using free space model in dB\n",
      "print'%s %.2f %s' %('path loss using 2 ray model=',LpmdB,'dB')\n",
      "print'%s %.1f %s' %('\\npath loss using free space model=',LpfdB,'dB')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "path loss using 2 ray model= 124.44 dB\n",
        "\n",
        "path loss using free space model= 110.5 dB\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.8 - PG NO.80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 80\n",
      "fc=900.*10.**6.\n",
      "L=1.\n",
      "c=3.*10.**8.\n",
      "Yc=c/fc#wavelength\n",
      "rf=2.*L*L/Yc#fraunhofer distance\n",
      "print'%s %d %s' %('fraunhofer distance is =',rf,'metres')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fraunhofer distance is = 6 metres\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.9 - PG NO.84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 84\n",
      "import math\n",
      "fcMhz=800.\n",
      "ht=30.\n",
      "hr=2.\n",
      "rkm=10.\n",
      "LpHdB=68.75+26.16*math.log10(fcMhz)-13.82*math.log10(ht)+(44.9-6.55*math.log10(ht))*math.log10(rkm)#propogation path loss using hata model\n",
      "LpfdB=110.5#prpogation path loss using free space model \n",
      "D=LpHdB-LpfdB\n",
      "print'%s %.1f %s' %('propogation path loss using hata model is =',LpHdB,'dB')\n",
      "print'%s %.1f %s' %('propogation path loss using free space model is =',LpfdB,'dB')\n",
      "print'%s %d %s' %('difference between 2 propogation path loss is =',D,'dB')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "propogation path loss using hata model is 159.5 dB\n",
        "propogation path loss using free space model is 110.5 dB\n",
        "difference between 2 propogation path loss is 49 dB\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 3.10 - PG NO.84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no.84\n",
      "import math\n",
      "fcMhz=900.\n",
      "ht=100.\n",
      "hr=2.\n",
      "rkm=4.\n",
      "ardB=3.2*math.log10(11.75*hr)**2.-4.97#correlation factor\n",
      "LpHurbandB=69.55+26.16*math.log10(fcMhz)-13.82*math.log10(ht)+(44.9-6.55*math.log10(ht))*math.log10(rkm)-ardB#median path loss in urban area\n",
      "\n",
      "print'%s %.1f %s' %('median path loss in urban area is =',LpHurbandB,'dB')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "median path loss in urban area is = 137.3 dB\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}