{
 "metadata": {
  "name": "",
  "signature": "sha256:948be1cc9ed00129c705ab5eed5191c57dcf55220270f926d97c4b4918eda1ba"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ch-10 : Striplines & Microstrip lines"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 554 Example 10.1"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import exp, log10, pi, sqrt, log\n",
      "#Given,\n",
      "\n",
      "z0=50  #ohm\n",
      "t=0.001  #mm\n",
      "b=0.32  #cm\n",
      "er=2.20  \n",
      "tandel= 0.0005 \n",
      "rs=0.026  #ohm\n",
      "f=10e9  #Hz\n",
      "c=3e8 #m/sec\n",
      "\n",
      "p=sqrt(er)*z0 \n",
      "#As p<120\n",
      "w=b*(((30*pi)/p)-0.441)\n",
      "print 'Width %0.3f'%w,'cm'\n",
      "\n",
      "#Attenuation\n",
      "k=((2*pi*f*sqrt(er))/c) \n",
      "ad=(k*tandel)/2 \n",
      "\n",
      "#and\n",
      "A=1+((2*w)/(b-t))+(((b+t)/((b-t)*pi))*log(((2*b)-t)/t)) \n",
      "#Hence \n",
      "ac=(2.7e-3*rs*er*z0*A)/(30*pi*(b-t)*1e-2)\n",
      "#Total attenution\n",
      "a=ad+ac \n",
      "\n",
      "#Total attenution in db\n",
      "x=exp(a) \n",
      "alp=20*log10(x)  #db/m\n",
      "\n",
      "#Total attenution in db/lambda:\n",
      "lam=c/(sqrt(er)*f) \n",
      "lamm=lam*1e2 \n",
      "alph=alp/lamm \n",
      "print 'Total attenution in db/lambda: %0.3f'%alph, 'db/lambda'\n",
      "\n",
      "\n",
      "#Answer in book for alph is given as 0.856 but it should be 0.0856 as value of f is taken as 10e10 but it should be 10e9"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Width 0.266 cm\n",
        "Total attenution in db/lambda: 0.856 db/lambda\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 555 Example 10.2"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given,\n",
      "er=9.7 \n",
      "h=0.25  #mm\n",
      "w=0.25  #mm\n",
      "f=5e9  #Hz\n",
      "c=3e8  #m/s\n",
      "\n",
      "#(i) Dielectric constant\n",
      "dc=((er+1)/2)+(((er-1)/2)*(1/sqrt(1+12*h/w))) \n",
      "print 'Dielectric constant: %0.3f'%dc\n",
      "\n",
      "#(ii) Phase constant\n",
      "lam0=c/f \n",
      "pc=sqrt(dc)*(2*pi/lam0) \n",
      "print 'Phase constant: %0.3f'%(pc/100),'rad/m'\n",
      "\n",
      "#(iii) Microstrip wavelength\n",
      "lams=lam0/sqrt(dc) \n",
      "print 'Microstrip wavelength: %0.3f'%(lams*100),'cm'\n",
      "\n",
      "#(iv) Capacitance per unit length\n",
      "e0=8.854e-12 \n",
      "cap=(2*pi*e0)/log((8*h/w)-(w/(4*h))) \n",
      "print 'Capacitance per unit length: %0.3e'%cap, 'F/cm'\n",
      "\n",
      "#(v) Characterstic Impedance\n",
      "ci=(60/sqrt(dc))*log((8*h/w)+(w/(4*h))) \n",
      "print 'Characterstic impedance: %0.3f'%ci, 'ohm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Dielectric constant: 6.556\n",
        "Phase constant: 2.681 rad/m\n",
        "Microstrip wavelength: 2.343 cm\n",
        "Capacitance per unit length: 2.717e-11 F/cm\n",
        "Characterstic impedance: 49.447 ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 556 Example 10.3"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given,\n",
      "er=5.23 \n",
      "w=10  #mils\n",
      "t=2.8  #mils\n",
      "h=7  #mils\n",
      "\n",
      "dc=((er+1)/2)+(((er-1)/2)*(1/sqrt(1+12*h/w))) \n",
      "print 'Dielectric constant: %0.3f'%dc\n",
      "\n",
      "#As w/h>1\n",
      "ci=(120*pi)/(sqrt(dc)*((w/h)+1.393+0.667*log((w/h)+1.444))) \n",
      "print 'Characterstic impedance: %0.3f'%ci, 'ohm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Dielectric constant: 3.805\n",
        "Characterstic impedance: 54.822 ohm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 556 Example 10.4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given,\n",
      "\n",
      "q=2.5 \n",
      "dh=1.58 \n",
      "er=9 \n",
      "f=10 \n",
      "c=3e8 \n",
      "\n",
      "erff=((er+1)/2)+(((er-1)/2)*((1+(12/q))**(-1/2))) \n",
      "vp=(c/sqrt(erff))*erff \n",
      "fe1=c/(sqrt(vp)*2*dh*q) \n",
      "if f<fe1:\n",
      "    print 'Strip supports TEM mode only' \n",
      "else:\n",
      "    print 'Strip does not support TEM mode only' \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Strip supports TEM mode only\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 557 Example 10.5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given,\n",
      "\n",
      "er=9.7 \n",
      "h=0.5  #mm\n",
      "w=0.5  #mm\n",
      "lt=2e-4  \n",
      "t=0.02  #mm\n",
      "f=5e9  #Hz\n",
      "fg=5  #HZ\n",
      "c=3e8 \n",
      "rs=8.22e-3*sqrt(fg) \n",
      "\n",
      "#(i) Dielectric constant\n",
      "dc=((er+1)/2)+(((er-1)/2)*(1/sqrt(1+12*h/w))) \n",
      "print 'Dielectric constant: %0.3f'%dc\n",
      "\n",
      "#(ii) Characterstic Impedance\n",
      "ci=(60/sqrt(dc))*log((8*h/w)+(w/(4*h))) \n",
      "print 'Characterstic impedance: %0.3f'%ci,'ohm'\n",
      "\n",
      "#(iii) Dielectric attenuation\n",
      "lam0=c/f \n",
      "alphd=(pi/lam0)*(er/sqrt(dc))*((dc-1)/(er-1))*lt \n",
      "print 'Dielectric attenuation: %0.3f'%alphd,'Np/m'\n",
      "\n",
      "#Conductor attenuation\n",
      "r1=(0.94+(0.132*(w/h))-(0.0062*((w/h)**2)))*((1/pi)+(1/(pi**2))*log((4*pi*w)/t))*(rs/(w*1e-3))\n",
      "r1m=r1*1e-2 \n",
      "r2=(w/h)/(((w/h)+5.8+(0.03*(h/w))))*(rs/(w*1e-3)) \n",
      "r2m=r2*1e-2 \n",
      "alphc=(r1+r2)/(2*ci) \n",
      "print 'Conductor attenuation: %0.3f'%alphc,'Np/m'\n",
      "\n",
      "#(iv) Total attenuation\n",
      "A=alphc+alphd \n",
      "Adb=A*8.686*1e-2 \n",
      "print 'Total attenuation: %0.3f'%Adb,'db/cm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Dielectric constant: 6.556\n",
        "Characterstic impedance: 49.447 ohm\n",
        "Dielectric attenuation: 0.025 Np/m\n",
        "Conductor attenuation: 0.411 Np/m\n",
        "Total attenuation: 0.038 db/cm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 558 Example 10.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "\n",
      "sig=5.8e7 \n",
      "f=10  #GHz\n",
      "h=0.12e-2  #m\n",
      "\n",
      "q=62.8*h*sqrt(f*sig) \n",
      "print 'conductor Q of the stripline:' ,round(q)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "conductor Q of the stripline: 1815.0\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 558 Example 10.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Er=6 \n",
      "h=4e-3  #m\n",
      "\n",
      "#(i) W for Z0=50W\n",
      "Z0=50  #W\n",
      "W=(120*pi*h)/(sqrt(Er)*Z0) \n",
      "print 'Required Width: %0.3f'%(W*1000), 'mm'\n",
      "\n",
      "#(ii)Stripline capacitance\n",
      "E0=8.854e-12 \n",
      "C=(E0*Er*W)/h \n",
      "print 'Stripline capacitance: %0.3f'%(C*10**12),'pF/m'\n",
      "\n",
      "#(iii)Stripline inductance\n",
      "Mu0=4*pi*10e-7 \n",
      "L=(Mu0*h)/W \n",
      "print 'Stripline inductance: %0.3f'%(L*10**5),' muH/m'\n",
      "\n",
      "#(iv)Phase velocity\n",
      "c=3e8 \n",
      "vp=c/sqrt(Er) \n",
      "print 'Phase velocity',vp, 'm/s'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required Width: 12.312 mm\n",
        "Stripline capacitance: 163.522 pF/m\n",
        "Stripline inductance: 0.408  muH/m\n",
        "Phase velocity 122474487.139 m/s\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 559 Example 10.8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "cl=3e8  #m/s\n",
      "f=5e9  #Hz\n",
      "Er=9 \n",
      "C=-10  #db\n",
      "Z0=50  #ohm\n",
      "#Length\n",
      "L=(cl/f)/(4*sqrt(Er)) \n",
      "print 'Length:' ,L*100,'cm'\n",
      "\n",
      "#Coupling coefficient\n",
      "C0=10**(C/20) \n",
      "print 'Coupling coefficient: %0.3f'%C0\n",
      "\n",
      "#Even and odd mode impedance\n",
      "Z0e=(Z0*sqrt(1+C0))/sqrt(1-C0) \n",
      "print 'Even mode impedance: %0.3f'%Z0e,'ohm'\n",
      "\n",
      "\n",
      "Z0o=(Z0*sqrt(1-C0))/sqrt(1+C0) \n",
      "print 'Odd mode impedance: %0.3f'%Z0o,'ohm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length: 0.5 cm\n",
        "Coupling coefficient: 0.316\n",
        "Even mode impedance: 69.371 ohm\n",
        "Odd mode impedance: 36.038 ohm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 560 Example 10.9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Z0=50  #ohm\n",
      "C=3  #db\n",
      "\n",
      "#Line impedance\n",
      "Z01sqr=(1-(10**(C/-10))) \n",
      "Z01=sqrt(Z0*Z0*Z01sqr) \n",
      "print 'Z01: %0.3f'%Z01, 'ohm'\n",
      "\n",
      "Z02=Z01/(sqrt(1-(1/sqrt(2))**2)) \n",
      "print 'Z02:' ,round(Z02),'ohm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Z01: 35.313 ohm\n",
        "Z02: 50.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 560 Example 10.10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "W=6  #m\n",
      "s=2.2  #m\n",
      "b=4.8  #m\n",
      "Er=2.2 \n",
      "\n",
      "#Even and odd mode impedance\n",
      "Z0e=((120*pi)*(b-s))/(2*sqrt(Er)*W) \n",
      "print 'Even mode impedance: %0.3f'%Z0e,'ohm'\n",
      "\n",
      "\n",
      "Z0o=(Z0e*s)/b \n",
      "print 'Odd mode impedance: %0.3f'%Z0o,'ohm'\n",
      "\n",
      "#Mid band coupling\n",
      "x=(Z0e-Z0o)/(Z0e+Z0o) \n",
      "C=-20*log10(x) \n",
      "print 'Mid band coupling: %0.3f'%C,'db'\n",
      "\n",
      "#Answer in book for C is given as 54.2 but it should be 8.60"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Even mode impedance: 55.070 ohm\n",
        "Odd mode impedance: 25.240 ohm\n",
        "Mid band coupling: 8.602 db\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 562 Example 10.11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Er=6 \n",
      "d=3e-3  #m\n",
      "Z0=50  #ohm\n",
      "E0=8.854e-12  #F/m\n",
      "Mu0=4*pi*10e-7  #H/m\n",
      "\n",
      "#(i) W \n",
      "W=(377*d)/(sqrt(Er)*Z0) \n",
      "print 'Required Width: %0.3f'%(W*1000),'mm'\n",
      "\n",
      "#(ii)Stripline capacitance\n",
      "C=(E0*Er*W)/d \n",
      "print 'Stripline capacitance: %0.3f'%(C*10**12),'pF/m'\n",
      "\n",
      "#(iii)Stripline inductance\n",
      "L=(Mu0*d)/W \n",
      "print 'Stripline inductance: %0.3f'%(L*10**6), 'muH/m'\n",
      "\n",
      "#(iv)Phase velocity\n",
      "c=3e8 \n",
      "vp=c/sqrt(Er) \n",
      "print 'Phase velocity' ,vp,'m/s'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required Width: 9.235 mm\n",
        "Stripline capacitance: 163.526 pF/m\n",
        "Stripline inductance: 4.082 muH/m\n",
        "Phase velocity 122474487.139 m/s\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 562 Example 10.12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Er=2.56 \n",
      "w=25  #mils\n",
      "t=14  #mils\n",
      "d=70  #mils\n",
      "E0=8.854e-12  #F/m\n",
      "\n",
      "#(i) K factor\n",
      "K=1/(1-(t/d)) \n",
      "print 'K factor:' ,K\n",
      "\n",
      "#(ii) Fringe capacitance\n",
      "C=((E0*Er)*(2*K*log(K+1)-(K-1)*log(K**2-1)))/pi \n",
      "print 'Fringe capacitance: %0.3f'%(C*10**12), 'pF/m'\n",
      "\n",
      "#(iii) Charecteristic Impedance\n",
      "X=1/(((w*K)/d)+(C/(E0*Er)))\n",
      "Z0=(94.15*X)/sqrt(Er) \n",
      "print 'Charecteristic Impedance: %0.3f'%Z0,'ohm'\n",
      "\n",
      "\n",
      "#Answer in book for Z0 is given as 50.29 but it should be 51.7"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "K factor: 1.25\n",
        "Fringe capacitance: 15.665 pF/m\n",
        "Charecteristic Impedance: 51.729 ohm\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 563 Example 10.13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Z0=50  #ohm\n",
      "#Sincr ratio of power is 2:3\n",
      "x1=5/2 \n",
      "y1=5/3 \n",
      "#Output Impedance\n",
      "Z1=x1*Z0 \n",
      "Z2=y1*Z0 \n",
      "print 'Output Impedance 1:',Z1,'ohm'\n",
      "print 'Output Impedance 2: %0.3f'%Z2,'ohm'\n",
      "\n",
      "#Input Impedance\n",
      "Zin=[((Z2*2*Z2)/3)/((Z2+(2*Z2)/3))] \n",
      "\n",
      "#Looking into Z1, Z2 is || to Z0\n",
      "A1=(Z2*Z0)/(Z2+Z0) \n",
      "\n",
      "#Looking into Z, Z2 is || to Z0\n",
      "A2=(Z1*Z0)/(Z1+Z0) \n",
      "\n",
      "#Reflection Coeffcients\n",
      "R1=(A1-Z1)/(A1+Z1) \n",
      "R2=(A2-Z2)/(A2+Z2) \n",
      "\n",
      "print 'Reflection Coeffcients:\\n', R1,'\\n',R2, "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output Impedance 1: 125.0 ohm\n",
        "Output Impedance 2: 83.333 ohm\n",
        "Reflection Coeffcients:\n",
        "-0.6 \n",
        "-0.4\n"
       ]
      }
     ],
     "prompt_number": 21
    }
   ],
   "metadata": {}
  }
 ]
}