{
 "metadata": {
  "name": "",
  "signature": "sha256:9e826c15d23aa6f60ab9f31679ea83e194639cce3ac1ef9438682b8d5dace862"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ch-6 : Microwave Travelling Wave Tubes O Type"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 330 Example 6.1"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division \n",
      "from math import sqrt, pi\n",
      "#Given\n",
      " \n",
      "#Given\n",
      "I0=30e-3  #A\n",
      "V0=3e3  #V\n",
      "Z0=10  #ohm\n",
      "l=0.1624  #m\n",
      "f=10e9  #Hz\n",
      "\n",
      "#(i) Gain parameter\n",
      "C=((I0*Z0)/(4*V0))**(1/3) \n",
      "print 'Gain parameter: %0.3f'%C\n",
      "\n",
      "N=(l*f)/(0.593e6*sqrt(V0)) \n",
      "\n",
      "#(ii) Power Gain\n",
      "Ap=-9.54+(47.3*C*N) \n",
      "print 'Power gain: %0.3f'%Ap,'dB'\n",
      "\n",
      "ve=0.593e6*sqrt(V0) \n",
      "be=(2*pi*f)/ve \n",
      "\n",
      "#Four propogation constants\n",
      "gam1=((-sqrt(3)*be*C)/2)+(1J*be*(2+C))/2 \n",
      "gam2=((sqrt(3)*be*C)/2)+(1J*be*(2+C))/2 \n",
      "gam3=1J*be*(1-C) \n",
      "gam4=-1J*be*(1-((C*C*C)/4)) \n",
      "\n",
      "print 'Four propogation constants:\\n {:.3f}\\n{:.3f}\\n{:.3f}\\n{:.3f}\\n'.format(gam1,gam2,gam3,gam4)\n",
      "\n",
      "#Calculations for propogation constants are wrong in book for gam 3 and 4, hence answers dont match"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain parameter: 0.029\n",
        "Power gain: 59.613 dB\n",
        "Four propogation constants:\n",
        " -48.986+1962.764j\n",
        "48.986+1962.764j\n",
        "0.000+1877.917j\n",
        "0.000-1934.469j\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 332 Example 6.2"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "I0=20e-3  #A\n",
      "V0=4e3  #V\n",
      "Z0=100  #ohm\n",
      "N=30 \n",
      "\n",
      "C=((I0*Z0)/(4*V0))**(1/3) \n",
      "#Gain\n",
      "Ap=-9.54+(47.3*C*N) \n",
      "print 'Gain:' ,Ap,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain: 61.41 dB\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 332 Example 6.3"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "c=3e8  #m/s\n",
      "d=2e-3  #m\n",
      "p=50e2  #turns per m\n",
      "e=1.6e-19  #J\n",
      "m=9.1e-31 \n",
      "\n",
      "# Axial phase velocity\n",
      "vp=c/(pi*p*d) \n",
      "print 'Axial phase velocity: %0.3f'%vp,'m/s'\n",
      "\n",
      "#Anode voltage\n",
      "V0=(m*vp*vp)/(2*e) \n",
      "print 'Anode voltage: %0.3f'%V0, 'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Axial phase velocity: 9549296.586 m/s\n",
        "Anode voltage: 259.319 V\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 332 Example 6.4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sin \n",
      "#Given\n",
      "a=(4.4*pi)/180  #radians\n",
      "c=3e8 #m/s\n",
      "f=8e9  #Hz\n",
      "al=2  #Np/m\n",
      "\n",
      "#Phase velocity\n",
      "vp=c*sin(a) \n",
      "\n",
      "#Propogation constant\n",
      "be=(2*pi*f)/vp \n",
      "\n",
      "gam=al+(1J*be) \n",
      "print 'Propogation constant: {:.3f}'.format(gam)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Propogation constant: 2.000+2183.964j\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 333 Example 6.5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Vc=11e3  #V\n",
      "Ir=0.85  #A\n",
      "V0=31e3  #V\n",
      "Pout=50e3  #W\n",
      "I=7  #A\n",
      "\n",
      "#Electronic efficiency\n",
      "ne=Pout/(V0*I) \n",
      "print 'Electronic efficiency: %0.3f'%(ne*100), '%'\n",
      "\n",
      "#Overall efficiency\n",
      "no=Pout/(Vc*(I-Ir)) \n",
      "print 'Overall efficiency: %0.3f'%(no*100), '%'\n",
      "\n",
      "#Answer for elecytronic efficiency should be 23.04% but it is given as 36.4 in book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electronic efficiency: 23.041 %\n",
        "Overall efficiency: 73.910 %\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 333 Example 6.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "I0=0.95  #A\n",
      "V0=7e3  #V\n",
      "Z0=20  #ohm\n",
      "N=20 \n",
      "\n",
      "C=((I0*Z0)/(4*V0))**(1/3) \n",
      "#Gain\n",
      "Ap=-9.54+(47.3*C*N) \n",
      "print 'Gain: %0.3f'%Ap,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain: 73.590 dB\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 334 Example 6.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Vc=12e3  #V\n",
      "V0=30e3  #V\n",
      "Pout=60e3  #W\n",
      "I=7.5  #A\n",
      "\n",
      "#Electronic efficiency\n",
      "ne=Pout/(V0*I) \n",
      "print 'Electronic efficiency: %0.3f'%(ne*100), '%'\n",
      "\n",
      "#Overall efficiency\n",
      "no=Pout/(Vc*I) \n",
      "print 'Overall efficiency: %0.3f'%(no*100),'%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electronic efficiency: 26.667 %\n",
        "Overall efficiency: 66.667 %\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 334 Example 6.8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Vc=20e3  #V\n",
      "V0=32e3  #V\n",
      "Pout=75e3  #W\n",
      "I=7  #A\n",
      "\n",
      "#Electronic efficiency\n",
      "ne=Pout/(V0*I) \n",
      "print 'Electronic efficiency: %0.3f'%(ne*100),'%'\n",
      "\n",
      "#Overall efficiency\n",
      "no=Pout/(Vc*I) \n",
      "print 'Overall efficiency: %0.3f'%(no*100), '%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electronic efficiency: 33.482 %\n",
        "Overall efficiency: 53.571 %\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 335 Example 6.9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "I0=500e-3  #A\n",
      "V0=10e3  #V\n",
      "Z0=25  #ohm\n",
      "l=.20  #m\n",
      "f=5.93e9  #Hz\n",
      "\n",
      "#Gain parameter\n",
      "C=((I0*Z0)/(4*V0))**(1/3) \n",
      "print 'Gain parameter: %0.3f'%C\n",
      "\n",
      "N=(l*f)/(0.593e6*sqrt(V0)) \n",
      "#Gain\n",
      "Ap=-9.54+(47.3*C*N) \n",
      "print 'Gain of TWT: %0.3f'%Ap,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain parameter: 0.068\n",
        "Gain of TWT: 54.656 dB\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 335 Example 6.10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "Pout=250  #W\n",
      "n=0.15 \n",
      "V0=7.5e3  #V\n",
      "f=6.15e9  #Hz\n",
      "c=3e8  #m/s\n",
      "\n",
      "#(i) Input Power\n",
      "Pi=Pout/n \n",
      "print 'Input Power: %0.3f'%Pi,'W'\n",
      "\n",
      "#(ii) Beam current\n",
      "I0=Pi/V0 \n",
      "print 'Beam current: %0.3f'%I0,'A'\n",
      "\n",
      "#(iii) Beam velocity\n",
      "vb=0.593e6*sqrt(V0) \n",
      "print 'Beam velocity: %0.3f'%vb, 'm/s'\n",
      "\n",
      "#(iv) Radius of helix\n",
      "a=(2*vb)/(2*pi*f) \n",
      "print 'Radius of helix: %0.3f'%a,'m'\n",
      "\n",
      "#(v) Electron beam radius\n",
      "r=(3*a)/4 \n",
      "print 'Electron beam radius: %0.3f'%r, 'm'\n",
      "\n",
      "#(vi) Pitch of helix\n",
      "p=(2*pi*a*vb)/c \n",
      "print 'Pitch of helix: %0.3f'%p,'m'\n",
      "\n",
      "#(vii) Current density\n",
      "J0=I0/(pi*r*r) \n",
      "print 'Current density: %0.3f'%(J0/1000),'kA/msqr'\n",
      "\n",
      "#(viii) Magnetic field for beam confinement\n",
      "B=(4*8.3e-4*sqrt(I0/(r*r*sqrt(V0)))) \n",
      "print 'Magnetic field for beam confinement:' ,round(B*1000),'mT'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input Power: 1666.667 W\n",
        "Beam current: 0.222 A\n",
        "Beam velocity: 51355306.444 m/s\n",
        "Radius of helix: 0.003 m\n",
        "Electron beam radius: 0.002 m\n",
        "Pitch of helix: 0.003 m\n",
        "Current density: 17.799 kA/msqr\n",
        "Magnetic field for beam confinement: 84.0 mT\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 336 Example 6.11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "I0=30e-3  #A\n",
      "V0=3e3  #V\n",
      "Z0=10  #ohm\n",
      "l=0.1624  #m\n",
      "f=10e9  #Hz\n",
      "C=((I0*Z0)/(4*V0))**(1/3) \n",
      "N=(l*f)/(0.593e6*sqrt(V0)) \n",
      "\n",
      "#Gain\n",
      "Ap=-9.54+(47.3*C*N) \n",
      "print 'Gain: %0.3f'%Ap,'dB'\n",
      "\n",
      "ve=0.593e6*sqrt(V0) \n",
      "be=(2*pi*f)/ve \n",
      "\n",
      "#Four propogation constants\n",
      "gam1=((-sqrt(3)*be*C)/2)+(1J*be*(2+C))/2 \n",
      "gam2=((sqrt(3)*be*C)/2)+(1J*be*(2+C))/2 \n",
      "gam3=1J*be*(1-C) \n",
      "gam4=-1J*be*(1-((C*C*C)/4)) \n",
      "\n",
      "print 'Four propogation constants:\\n {:.3f}\\n{:.3f}\\n{:.3f}\\n{:.3f}\\n'.format(gam1,gam2,gam3,gam4)\n",
      "\n",
      "#Calculations for propogation constants are wrong for gam 3 and 4 hence answers dont match"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain: 59.613 dB\n",
        "Four propogation constants:\n",
        " -48.986+1962.764j\n",
        "48.986+1962.764j\n",
        "0.000+1877.917j\n",
        "0.000-1934.469j\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Page Number: 337 Example 6.12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#Given\n",
      "I0=35e-3  #A\n",
      "V0=4e3  #V\n",
      "Z0=20  #ohm\n",
      "f=10e9  #Hz\n",
      "\n",
      "#(i) Gain parameter\n",
      "C=((I0*Z0)/(4*V0))**(1/3) \n",
      "print 'Gain parameter:' ,C\n",
      "\n",
      "ve=0.593e6*sqrt(V0) \n",
      "be=(2*pi*f)/ve \n",
      "\n",
      "#Four propogation constants\n",
      "gam1=((-sqrt(3)*be*C)/2)+(1J*be*(2+C))/2 \n",
      "gam2=((sqrt(3)*be*C)/2)+(1J*be*(2+C))/2 \n",
      "gam3=1J*be*(1-C) \n",
      "gam4=-1J*be*(1-((C*C*C)/4)) \n",
      "\n",
      "print 'Four propogation constants:\\n {:.3f}\\n{:.3f}\\n{:.3f}\\n{:.3f}\\n'.format(gam1,gam2,gam3,gam4)\n",
      "\n",
      "#Calculations for propogation constants are wrong hence answers dont match"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain parameter: 0.0352364936603\n",
        "Four propogation constants:\n",
        " -51.123+1704.826j\n",
        "51.123+1704.826j\n",
        "0.000+1616.278j\n",
        "0.000-1675.292j\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 34
    }
   ],
   "metadata": {}
  }
 ]
}