{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 24: Space Wave Propagation<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-9.1, Page number: 808<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "tx_h = 49.0       #Transmitting antenna height (m)\n",
      "rx_h = 25.0       #Receiving antenna height (m)\n",
      "f = 100e6       #Frequency (Hz)\n",
      "tx_p = 100.0      #Transmitted power (W)\n",
      "c = 3e8         #Speed of light (m/s)\n",
      "a = 6370        #Earth's radius (km)\n",
      "\n",
      "#Calculations\n",
      "wave_lt = c/f   #Wavelength (m)\n",
      "d0 = sqrt(2*(4.0/3.0)*(a/1000.0))*(sqrt(tx_h)+sqrt(rx_h))\n",
      "                #Line of Sight (LOS) distance (km)\n",
      "d = d0*1000     #LOS (m)\n",
      "Er = (88*sqrt(tx_p)/(wave_lt*(d**2)))*tx_h*rx_h\n",
      "                #Received signal strength (W)\n",
      "\n",
      "#Result\n",
      "print \"The Line of Sight distance is\", round(d0,2), \"km\"\n",
      "print \"The received signal strength is\", round(Er,6), \"W\"\n",
      "\n",
      "#The mistake is in the calculation of (88*sqrt(tx_p)/(wave_lt*(d**2))) where four orders of\n",
      "#magnitude are ignored in the resulting calculation."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Line of Sight distance is 49.46 km\n",
        "The received signal strength is 0.000147 W\n"
       ]
      },
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 1,
       "text": [
        "'The mistake is in the calculation of (88*sqrt(tx_p)/(wave_lt*(d**2))) where four orders of\\nmagnitude are ignored in the resulting calculation.'"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-9.2, Page number: 809<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "tx_h = 144      #Transmitting antenna height (m)\n",
      "rx_h = 25       #Receiving antenna height (m)\n",
      "k = 4.0/3.0         #Equivalent earth radius/Actual earth radius (unitless)\n",
      "a = 6370        #Radius of earth (km)\n",
      "\n",
      "#Calculations\n",
      "los = 4.12*(sqrt(tx_h) + sqrt(rx_h))    #Line of sight distance (km)\n",
      "\n",
      "horz = sqrt(2*k*a*(tx_h/1000.0))  #Surface range to radio horizon from radar (km)\n",
      "\n",
      "#Result\n",
      "print \"The Radio horizon distance from radar is\", round(horz,2),\"km\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Radio horizon distance from radar is 49.46 km\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-9.3, Page number: 809<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "tx_h = 100      #Transmitting antenna height (m)\n",
      "rx_h = 16       #Receiving antenna height (m)\n",
      "tx_p = 40e3     #Transmitting antenna power radiation (W)\n",
      "f = 100e6       #Frequency (Hz)\n",
      "d = 10e3        #Distance (m)\n",
      "c = 3e8         #Speed of light (m/s)\n",
      "E = 1e-3        #Signal strength (V/m)\n",
      "\n",
      "#Calculations\n",
      "los = 4.12*(sqrt(tx_h) + sqrt(rx_h))    #LOS distance (km)\n",
      "wave_lt = c/f       #Wavelength (m)\n",
      "\n",
      "Es = (88*sqrt(tx_p)/(wave_lt*(d**2)))*tx_h*rx_h\n",
      "                    #Field strength at distance d (V/m)\n",
      "\n",
      "dsig = sqrt(88*sqrt(tx_p)*tx_h*rx_h/(wave_lt*E))\n",
      "                    #Distance at which field strength reduces to 1mV/m\n",
      "\n",
      "#Result\n",
      "print \"The LOS distance is\", los, \"km\"\n",
      "print \"The field strength at 10km is\", round(Es,5),\"V/m\"\n",
      "print \"The distance at which field strength is 1mV/m is\", round(dsig,-1), \"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The LOS distance is 57.68 km\n",
        "The field strength at 10km is 0.09387 V/m\n",
        "The distance at which field strength is 1mV/m is 96880.0 m\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-9.4, Page number: 809<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "\n",
      "#Variable declaration\n",
      "gain = 10       #Antenna gain (dB)\n",
      "Wt = 500         #Power radiation (W)\n",
      "d = 15e3        #Distance (m)\n",
      "Wr = 2e-6       #Received power (W)\n",
      "\n",
      "#Calculations\n",
      "Ae = Wr*(4*pi*(d**2))/(Wt*gain)  #Effective area (m^2)\n",
      "\n",
      "#Result\n",
      "print \"The effective area of the receiving antenna is\", round(Ae,2), \"m^2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The effective area of the receiving antenna is 1.13 m^2\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-9.5, Page number: 809<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "h = 1000        #Height of duct (m)\n",
      "delM = 0.036    #Change in refractive modulus (unitless)\n",
      "c = 3e8         #Speed of light (m/s)\n",
      "\n",
      "#Calculations\n",
      "wl_max = 2.5*h*sqrt(delM*1e-6)  #Maximum wavelength (m)\n",
      "fmax = c/wl_max     #Maximum frequency (Hz)\n",
      "\n",
      "#Result\n",
      "print \"The maximum frequency that can be transmitted is\", round(fmax/1e6,1),\"MHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum frequency that can be transmitted is 632.5 MHz\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-12.1, Page number: 812<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi,sqrt\n",
      "\n",
      "#Variable declaration\n",
      "gain = 10       #Gain of transmitting antenna (dB)\n",
      "P = 100         #Radiating power (W)\n",
      "f = 1e6        #Frequency (Hz)\n",
      "rx_gain = 15    #Gain of receiving antenna (dB)\n",
      "d = 20e3        #Distance (m)\n",
      "c = 3e8         #Speed of light (m/s)\n",
      "v = 1000        #scattering volume (m^3)\n",
      "sigma = 0.1     #Effective scattering cross-section (m^2)\n",
      "\n",
      "#Calculations\n",
      "wl = c/f        #Wavelength (m)\n",
      "Pr_a = P*gain*rx_gain*(wl**2)/(4*pi*(4*pi*(d**2)))\n",
      "                #Received power in case (a) (W)\n",
      "F = (2*sqrt(sigma*v))/(d*sqrt(pi))    #Attenuation Factor (unitless)\n",
      "Pr_b = Pr_a*F   #Received power in case (b) (W)\n",
      "\n",
      "\n",
      "#Result\n",
      "print \"The received power in case (a) is\", round(Pr_a,5), \"W\"\n",
      "print \"The received power in case (b) is\", round(Pr_b,10), \"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The received power in case (a) is 0.02137 W\n",
        "The received power in case (b) is 1.20581e-05 W\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 24-14.1, Page number: 813<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "\n",
      "#Variable declaration\n",
      "d = 3000      #Distance (km)\n",
      "f = 3e3         #Frequency (MHz)\n",
      "\n",
      "#Calculations\n",
      "path_l = 32.45 + 20*log10(f) + 20*log10(d)\n",
      "\n",
      "#Result\n",
      "print \"The path loss between the two points is\", round(path_l,3), \"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The path loss between the two points is 171.535 dB\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}