{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 15 : Radio Wave Propagation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 : pg 517"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The charasteristic impedance of polyethylene is 248.586 ohm\n"
     ]
    }
   ],
   "source": [
    "#page no 517\n",
    "#calculate the characteristic impedance of polyethylene\n",
    "#prob no. 15.1\n",
    "from math import sqrt\n",
    "#Dielectric constt=2.3\n",
    "#given\n",
    "er=2.3;\n",
    "#calculations\n",
    "#Determination of characteristic impedance\n",
    "Z=377./sqrt(er);\n",
    "#results\n",
    "print 'The charasteristic impedance of polyethylene is',round(Z,3),'ohm'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 : pg 518"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The max power density is 23.873 GW/m2\n"
     ]
    }
   ],
   "source": [
    "#calculate the max power density \n",
    "#page no 518\n",
    "#prob no. 15.2\n",
    "#given\n",
    "#Dielelectric strength of air=3MV/m\n",
    "e=3*10**6;#electric field strength\n",
    "Z=377.;#impedance of air\n",
    "#calculations\n",
    "Pd=(e**2)/Z;#Determination of power density\n",
    "#results\n",
    "print 'The max power density is',round(Pd/10**9,3),'GW/m2'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 : pg 520"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power density at a point 10km 79.5774715459 nW/m2\n"
     ]
    }
   ],
   "source": [
    "#calculate the power density \n",
    "#page no 520\n",
    "#prob no. 15.3\n",
    "from  math import pi\n",
    "#given\n",
    "#An isotropic radiator with power 100W & dist given is 10km\n",
    "Pt=100;r=10*10**3;\n",
    "#calculations\n",
    "#Determination of power density at r=10km\n",
    "Pd=Pt/(4*pi*(r**2));\n",
    "#results\n",
    "print 'Power density at a point 10km',Pd*10**9,'nW/m2'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 : pg 521"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The electric field strength is 5.47722557505 mW/m\n"
     ]
    }
   ],
   "source": [
    "#calculate the electric field strength \n",
    "#page no 521\n",
    "#prob no. 15.4\n",
    "from math import sqrt\n",
    "#given\n",
    "#An isotropic radiator radiates power=100W at point 10km\n",
    "Pt=100.;r=10.*10**3;\n",
    "#calculations\n",
    "#Determination of electric field strength\n",
    "e=sqrt(30*Pt)/r;\n",
    "#results\n",
    "print 'The electric field strength is',e*1000,'mW/m'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 : pg 525"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The power delivered to receiver is 405.812 nW\n"
     ]
    }
   ],
   "source": [
    "#calculate the power delivered \n",
    "#page no 525\n",
    "#prob no. 15.5\n",
    "from math import log10\n",
    "#A transmitter with power o/p=150W at fc=325MHz.antenna gain=12dBi receiver antenna gain=5dBi at 10km away\n",
    "#given\n",
    "#considering no loss in the system\n",
    "d=10.;Gt_dBi=12.;Gr_dBi=5.;fc=325.;Pt=150.;\n",
    "#calculations\n",
    "#Determination of power delivered\n",
    "Lfs=32.44+(20*log10(d))+(20*log10(fc))-(Gt_dBi)-(Gr_dBi);\n",
    "Pr=Pt/(10**(Lfs/10));\n",
    "#results\n",
    "print 'The power delivered to receiver is',round(Pr*10**9,3),'nW'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 : pg 525"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The power delivered to receiver is 2.04329571558e-09 W\n"
     ]
    }
   ],
   "source": [
    "#calculate the power delivered to receiver \n",
    "#page no 525\n",
    "#prob no. 15.6\n",
    "#given\n",
    "from math import log10\n",
    "#A transmitter with o/p power=10W at fc=250MHz,connected to Tx 10m line with loss=3dB/100m t0 antenna with gain=6dBi.\n",
    "#Rx antenna 20km away with gain=4dBi \n",
    "#Refer fig.15.6,assuming free space propagation\n",
    "d=20;fc=250.;Gt_dBi=6.;Gr_dBi=4.;loss=3./100;Zl=75.;Zo=50.;L=10.;Pt=10.;\n",
    "#calculations\n",
    "Lfs=32.44+(20*log10(d))+(20*log10(fc))-Gt_dBi-Gr_dBi;#path loss\n",
    "\n",
    "L_tx=L*loss;#Determination of loss\n",
    "ref_coe=(Zl-Zo)/(Zl+Zo);#Reflection coefficient\n",
    "L_rx=1-(ref_coe**2);#Proportion of incident power that reaches load\n",
    "L_rx_dB=-10*log10(L_rx);#Converting that proportion in dB\n",
    "#Determination of total loss Lt\n",
    "Lt=(Lfs)+(L_tx)+(L_rx_dB);\n",
    "#Determination of power delivered to receiver\n",
    "Pt_Pr=10**(Lt/10);#Power ratio\n",
    "Pr=Pt/Pt_Pr;\n",
    "#results\n",
    "print 'The power delivered to receiver is',Pr,'W'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7 : pg 530"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The angle of refraction is 10.313 degree\n"
     ]
    }
   ],
   "source": [
    "#calculate the angle of refraction \n",
    "#page no 530\n",
    "#prob no. 15.7\n",
    "#given\n",
    "from math import sqrt, sin, asin,pi\n",
    "#A radio wave moves from air(er=1) to glass(er=7.8).angle of incidence=30 deg\n",
    "theta_i=30.;er1=1;er2=7.8;\n",
    "#calculations\n",
    "#determination of angle of refraction\n",
    "theta_r=asin((sin(theta_i*pi/180.))/(sqrt(er2/er1)));\n",
    "#results\n",
    "print 'The angle of refraction is',round(theta_r*180/pi,3),'degree'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8 : pg 537"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The max usable freq MUF is 33.92 MHz\n"
     ]
    }
   ],
   "source": [
    "#calculate the max usable freq \n",
    "#page no 537\n",
    "#prob no. 15.8\n",
    "#given\n",
    "from math import cos,pi\n",
    "#A Tx statn with fc=11.6MHz & angle of incidence=70 degree\n",
    "theta_i=70.;fc=11.6;#in MHz\n",
    "#calculations\n",
    "#determination of max usable freq(MUF)\n",
    "MUF=fc/(cos(theta_i*pi/180.));\n",
    "#results\n",
    "print 'The max usable freq MUF is',round(MUF,2),'MHz'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9 : pg 539"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a)The max common distance between dispatcher & taxi 21.018 km\n",
      "The max common distance between two taxi is 10.1 km\n"
     ]
    }
   ],
   "source": [
    "#calculate the max common distance in both cases \n",
    "#page no 539\n",
    "#prob no. 15.9\n",
    "#given\n",
    "from math import sqrt\n",
    "#A taxi compony using central dispatcher with antenna height=15m & taxi antenna height=1.5m\n",
    "ht=15.;hr=1.5;\n",
    "#calculations and results\n",
    "#a)Determination of max commn dist betn dispatcher and taxi\n",
    "d1=sqrt(17*ht)+sqrt(17*hr);\n",
    "print 'a)The max common distance between dispatcher & taxi',round(d1,3),'km'\n",
    "#b)Determination of max ommn dist betn 2 taxis\n",
    "d2=sqrt(17*hr)+sqrt(17*hr);#ht=hr=height of antenna of taxi cab\n",
    "print 'The max common distance between two taxi is',round(d2,3),'km'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11 : pg 545"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The fading period is 0.01125 sec\n",
      "The fading period is 0.00474 sec\n"
     ]
    }
   ],
   "source": [
    "#calculate the fading period in both cases \n",
    "# page no 545\n",
    "# prob no 15.11\n",
    "#given\n",
    "# An automobile travels at 60km/hr\n",
    "v=60.*10**3/(60*60);#conversion of car's speedto m/s\n",
    "c=3.*10**8;#speed of light\n",
    "#part a) calculation of time between fades if car uses a cell phone at 800*10**6Hz\n",
    "f=800.*10**6;\n",
    "#calculations and results\n",
    "T=c/(2*f*v);\n",
    "print 'The fading period is',T,'sec'\n",
    "#part b) calculation of time between fades if car uses a PCS phone at 1900*10**6Hz\n",
    "f=1900.*10**6;\n",
    "T=c/(2*f*v);\n",
    "print 'The fading period is',round(T,5),'sec'\n",
    "# Note that the rapidity of the fading increases with both the frequency of the transmissions and the speed of the vehicle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12 : pg 550"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of cell sites are 72.0\n"
     ]
    }
   ],
   "source": [
    "#calculate the no. of cell sites \n",
    "#page no 550\n",
    "#given\n",
    "# problem no 15.12\n",
    "A=1000.;#metropolitian area expressed in sq. km\n",
    "r=2;#radius of cell in km\n",
    "#calculations\n",
    "# Number of cell sites given as\n",
    "N=A/(3.464*r**2);\n",
    "#results\n",
    "print 'Number of cell sites are',round(N)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}