{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 7: Loop, Slot and Horn Antennas<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-8.1, Page number: 256<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt,pi,sin,log10\n",
      "\n",
      "#Variable declaration\n",
      "C_lambda = 0.1*pi       #Circumference (lambda)\n",
      "R_m = 1.6               #Mutual resistance of two loops (ohm)\n",
      "theta1 = 90*pi/180             #Angle of radiation (radians)\n",
      "theta2 = 2*pi/10             #Angle of radiation (radians)\n",
      "\n",
      "#Calculation\n",
      "Rr = 197*(C_lambda)**4      #Self resistance of loop (ohm)\n",
      "D1 = (1.5)*(sin(theta1))**2 #Direcivity of loop alone (unitless)\n",
      "D1_db = 10*log10(D1)        #Directivity of loop alone (dBi)\n",
      "D2 = 1.5*(2*sqrt(Rr/(Rr-R_m))*sin(theta2))**2\n",
      "                        #Directivity of loop with ground plane (unitless)\n",
      "D2_db = 10*log10(D2)    #Direcitivy of loop with ground plane (dBi)\n",
      "\n",
      "#Result\n",
      "print \"The directivity of loop alone is %.2f or %.2f dBi\" % (D1,D1_db)\n",
      "print \"\"\"The direcitivy of loop with ground plane is %.2f or %.0f dBi\n",
      "                \"\"\" %(D2,D2_db)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The directivity of loop alone is 1.50 or 1.76 dBi\n",
        "The direcitivy of loop with ground plane is 12.47 or 11 dBi\n",
        "                \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-8.2, Page number:257<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, sin, pi, log10\n",
      "\n",
      "#Variable declaration\n",
      "Rr = 197.0        #self resistance of loop (ohm)\n",
      "Rm = 157.0       #mutual resistance of two loops (ohm)\n",
      "theta = 2*pi/10 #Angle of radiation (radians)\n",
      "\n",
      "#Calculation\n",
      "D = 1.5*(2*sqrt(Rr/(Rr-Rm))*sin(theta))**2  #Directivity (unitless)\n",
      "D_db = 10*log10(D)      #Directivity (dBi)\n",
      "\n",
      "#Result\n",
      "print \"The direcitivy is %.1f or %.1f dBi\" % (D,D_db)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The direcitivy is 10.2 or 10.1 dBi\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-11.1, Page number: 261<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi, log10\n",
      "\n",
      "#Variable declaration\n",
      "c = pi      #Circumference (m)\n",
      "f1 = 1    #Frequency (MHz)\n",
      "f2 = 10   #Frequency (MHz)\n",
      "d = 10e-3   #Diameter of copper wire (m)\n",
      "\n",
      "#Calcalation\n",
      "RL_Rr1 = 3430/((c**3)*(f1**3.5)*d)  \n",
      "RL_Rr2 = 3430/((c**3)*(f2**3.5)*d)\n",
      "            #Ratio of Loss resistance and radiation resistance (unitless\n",
      "            \n",
      "k1 = 1/(1+RL_Rr1)   #Radiation efficiency (unitless)\n",
      "k_db1 = 10*log10(k1)    #Radiation efficiency (in dB)\n",
      "k2 = 1/(1+RL_Rr2)   #Radiation efficiency (unitless)\n",
      "k_db2 = 10*log10(k2)    #Radiation efficiency (in dB)\n",
      "\n",
      "#Result\n",
      "print \"The radiation effiency for 1 MHz is %.1ef or %.1f dB\" % (k1, k_db1)\n",
      "print \"The radiation effiency for 10 MHz is %.2f or %.1f dB\" % (k2, k_db2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radiation effiency for 1 MHz is 9.0e-05f or -40.4 dB\n",
        "The radiation effiency for 10 MHz is 0.22 or -6.5 dB\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-11.2, Page number: 264</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi,sqrt\n",
      "\n",
      "#Variable declaration\n",
      "n = 10    #Number of turns (unitless)\n",
      "dia = 1e-3   #Diameter of copper wire (m)\n",
      "dia_rod = 1e-2    #Diameter of ferrite rod (m)\n",
      "len_rod = 10e-2    #Length of ferrite rod (m)\n",
      "mu_r = 250 - 2.5j    #Relative permeability (unitless)\n",
      "mu_er = 50    #Efeective relative permeability (unitless)\n",
      "f = 1e6    #Frequency (Hz)\n",
      "c = 3e8    #Speed of light (m/s)\n",
      "mu_0 = pi*4e-7    #Absolute permeability (H/m)\n",
      "\n",
      "#Calculations\n",
      "wave_lt = c/f    #Wavelength (m)\n",
      "radius = dia_rod/2\n",
      "C_l = (2*pi*radius)/(wave_lt)    #Circumference of loop (m)\n",
      "Rr = 197*(mu_er**2)*(n**2)*(C_l**4)    #Radiation resistance (ohm)\n",
      "Rf = 2*pi*f*mu_er*(mu_r.imag/mu_r.real)*mu_0*(n**2)*(pi*radius**2)/len_rod    #Loss resistance(ohm)\n",
      "cond = 1/((7e-5**2)*f*pi*mu_er)    #Conductivity (S/m)\n",
      "delta = 1/(sqrt(f*pi*mu_er*cond))    #Depth of penetration(m)\n",
      "\n",
      "RL = n*(C_l/dia)*sqrt((f*mu_0)/(pi*cond))    #Ohmic resistance (ohm)\n",
      "k = Rr/(RL+abs(Rf))    #Radiation efficiency (unitless)\n",
      "\n",
      "L = mu_er*(n**2)*(radius**2)*mu_0/len_rod    #Inductance (H)\n",
      "Q = 2*pi*f*L/(abs(Rf) + Rr + RL)    #Ratio of energy stored to energy lost per cycle (unitless)\n",
      "\n",
      "fHP = f/Q    #Bandwidth at half power (Hz)\n",
      "\n",
      "\n",
      "#Results\n",
      "print \"The radiation efficiency is \", round(k,11)\n",
      "print \"The value of Q is \", round(Q,3)\n",
      "print \"The half-power bandwidth is\", round(fHP), \"Hz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radiation efficiency is  6.65e-09\n",
        "The value of Q is  11.076\n",
        "The half-power bandwidth is 90289.0 Hz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-17.1, Page number: 280<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "\n",
      "#Variable declaration\n",
      "Z0 = 376.7      #Intrinsic impdence of free space (ohm)\n",
      "Zd = 73 + 42.5j #Impedence of infinitesimally thin lambda/2 antenna (ohm)\n",
      "\n",
      "#Calculation\n",
      "Z1 = (Z0**2)/(4*Zd) #Terminal impedence of the lambda/2 slot antenna (ohm)\n",
      "\n",
      "#Result\n",
      "print \"The terminal impedence of the thin lambda/2 slot antenna is\", np.around(Z1), \"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The terminal impedence of the thin lambda/2 slot antenna is "
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(363-211j) ohm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-17.2, Page number: 280<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Zd = 67     #Terminal impedence of cylindrical antenna (ohm)\n",
      "Z0 = 376.7  #Intrinsic impedence of free space (ohm)\n",
      "L = 0.475   #Length of complementary slot (lambda)\n",
      "\n",
      "#Calculation\n",
      "Z1 = Z0**2/(4*Zd)   #Terminal resistance of complementary slot (ohm)\n",
      "w = 2*L/100         #Width of complementary slot (lambda)\n",
      "\n",
      "#Result\n",
      "print \"The terminal resistance of the complementary slot is\", round(Z1), \"ohm\"\n",
      "print \"The width of the complementary slot is\", w, \"lambda\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The terminal resistance of the complementary slot is 529.0 ohm\n",
        "The width of the complementary slot is 0.0095 lambda\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-17.3, Page number: 281<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Zd = 710    #Terminal impdence of cylindrical dipole\n",
      "Z0 = 376.7  #Intrinsic impedence of free space (ohm)\n",
      "\n",
      "#Calculation\n",
      "Z1 = Z0**2/(4*Zd)   #Terminal resistance of complementary slot (ohm)\n",
      "\n",
      "#Result\n",
      "print \"The terminal resistance of the complementary slot is\", round(Z1),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The terminal resistance of the complementary slot is 50.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7-20.1, Page number 288<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "delta_e = 0.2       #path length difference in E-plane (lambda)\n",
      "delta_h = 0.375     #path length difference in H-plane (lambda)\n",
      "a_e = 10            #E-plane aperture (lambda)\n",
      "\n",
      "\n",
      "#Calculation\n",
      "L = a_e**2/(8*delta_e)    #Horn length(lambda)\n",
      "theta_e = 2*math.atan2(a_e,2*L)*180/math.pi   #Flare angle in E-plane (degrees)\n",
      "theta_h = 2*math.acos(L/(L+delta_h))*180/math.pi\n",
      "                            #Flare angle in the H-plane (degrees)\n",
      "a_h = 2*L*math.tan(theta_h/2*math.pi/180)   #H-plane aperture (lambda)\n",
      "\n",
      "hpbw_e = 56/a_e     #Half power beamwidth in E-plane (degrees)\n",
      "hpbw_h = 67/a_h     #Half power beamwidth in H-plane (degrees)\n",
      "\n",
      "D = 10*math.log10(7.5*a_e*a_h)  #Directivity (dB)\n",
      "\n",
      "#Result\n",
      "print \"The length of the pyramidal horn is\", L,\"lambda\"\n",
      "print \"The flare angles in E-plane and H-plane are\", round(theta_e,1),\"and\", round(theta_h,2), \"degrees\"\n",
      "print \"The H-plane aperture is\", round(a_h,1), \"lambda\"\n",
      "print \"The Half power beamwidths in E-plane and H-plane are\", hpbw_e,\"&\",round(hpbw_h,1),\\\n",
      "\"degrees\"\n",
      "print \"The direcivity is\", round(D,1),\"dBi\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The length of the pyramidal horn is 62.5 lambda\n",
        "The flare angles in E-plane and H-plane are 9.1 and 12.52 degrees\n",
        "The H-plane aperture is 13.7 lambda\n",
        "The Half power beamwidths in E-plane and H-plane are 5 & 4.9 degrees\n",
        "The direcivity is 30.1 dBi\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}