{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter No. 3 : Microwave Vaccum Tube Devices"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.1 Page 3-39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Plasma frequency = 9.95e+08 rad/s\n",
      "Reduced plasma frequency = 5.97e+08 rad/s\n",
      "The induced current in the output cavity = 3.44e+07 A \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi\n",
    "\n",
    "#Given : \n",
    "V0=10##kV\n",
    "I0=0.7##A\n",
    "f=4##GHz\n",
    "Beta0=1##unitless\n",
    "Beta1=1##unitless\n",
    "rho_0=5*10**-5##per cm**3\n",
    "V1=2##V\n",
    "Rsh=10##kohm\n",
    "Rsh1=5##kohm\n",
    "K=1.759*10**11##constant\n",
    "epsilon_0=8.884*10**-12##constant\n",
    "omega_p=sqrt(K*rho_0/epsilon_0)##rad/s\n",
    "print \"Plasma frequency = %.2e rad/s\"%omega_p\n",
    "R=0.6##ohm\n",
    "omega_q=R*omega_p##rad/s\n",
    "print \"Reduced plasma frequency = %.2e rad/s\"%omega_q\n",
    "omega=2*pi*f*10**9##rad/s\n",
    "Ih=1/8*(I0/104*omega/omega_q)**3*121*(Rsh*1000)**2\n",
    "print \"The induced current in the output cavity = %.2e A \"%Ih"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.2 Page 3-40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Input power = 6.00 W\n",
      "Output power = 1.36 W\n",
      "Efficiency = 22.74 %\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi\n",
    "\n",
    "#Given : \n",
    "n=2##mode\n",
    "V=300##Volt\n",
    "I0=20##mA\n",
    "V1=40##Volt\n",
    "Pdc=V*I0*10**-3##W\n",
    "print \"Input power = %.2f W\"%Pdc\n",
    "J1Xdash=1.25#\n",
    "Pac=2*V*I0*10**-3*J1Xdash/(2*n*pi-pi/2)##W\n",
    "print \"Output power = %.2f W\"%Pac\n",
    "Eta=Pac/Pdc*100##%\n",
    "print \"Efficiency = %.2f %%\"%Eta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.3 Page 3-40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Electron velocity = 1.78e+07 m/s\n",
      "dc transit time of electrons = 113.02 sec\n",
      "Plasma frequency = 9.95e+08 rad/s\n",
      "Reduced plasma frequency = 5.97e+08 rad/s\n",
      "The induced current in the output cavity = 5.20e+08 A\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi\n",
    "\n",
    "#Given : \n",
    "V=900##V\n",
    "I0=30##mA\n",
    "f=8##GHz\n",
    "l=1##mm\n",
    "d=4##cm\n",
    "Rsh=49##ohm\n",
    "V0=0.593*10**6*sqrt(V)##m/s\n",
    "print \"Electron velocity = %.2e m/s\"%V0\n",
    "omega=2*pi*f*10**9##rad/s\n",
    "theta0=omega*d*10**-2/V0##sec\n",
    "print \"dc transit time of electrons = %.2f sec\"%theta0\n",
    "\n",
    "Beta0=1##unitless\n",
    "Beta1=1##unitless\n",
    "rho_0=5*10**-5##per cm**3\n",
    "V1=2##V\n",
    "\n",
    "Rsh1=5##Kohm\n",
    "K=1.759*10**11##constant\n",
    "epsilon_0=8.884*10**-12##constant\n",
    "omega_p=sqrt(K*rho_0/epsilon_0)##rad/s\n",
    "print \"Plasma frequency = %.2e rad/s\"%omega_p\n",
    "R=0.6##ohm\n",
    "omega_q=R*omega_p##rad/s\n",
    "print \"Reduced plasma frequency = %.2e rad/s\"%omega_q\n",
    "omega=2*pi*f*10**9##rad/s\n",
    "Ih=1/8*(I0/104*omega/omega_q)**3*121*Rsh**2\n",
    "print \"The induced current in the output cavity = %.2e A\"%Ih"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.4 Page 3-41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Plasma frequency = 9.95e+08 rad/s\n",
      "Reduced plasma frequency = 5.97e+08 rad/s\n",
      "The induced current in the output cavity = 1101.20 A\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi\n",
    "\n",
    "#Given : \n",
    "V=500##V\n",
    "Rsh=20##Kohm\n",
    "fr=8##GHz\n",
    "d=1##mm\n",
    "n=2##mode\n",
    "e=1.759*10**11##constant\n",
    "VR=1/8*1/(2*pi*fr*10**9*d*10**-3)**2*(2*n*pi-pi/2)**2\n",
    "\n",
    "\n",
    "I0=0.7##A\n",
    "\n",
    "Beta0=1##unitless\n",
    "Beta1=1##unitless\n",
    "rho_0=5*10**-5##per cm**3\n",
    "V1=2##V\n",
    "\n",
    "Rsh1=5##Kohm\n",
    "K=1.759*10**11##constant\n",
    "epsilon_0=8.884*10**-12##constant\n",
    "omega_p=sqrt(K*rho_0/epsilon_0)##rad/s\n",
    "print \"Plasma frequency = %.2e rad/s\"%omega_p\n",
    "R=0.6##ohm\n",
    "omega_q=R*omega_p##rad/s\n",
    "print \"Reduced plasma frequency = %.2e rad/s\"%omega_q\n",
    "omega=2*pi*f*10**9##rad/s\n",
    "Ih=1/8*(I0/104*omega/omega_q)**3*121*Rsh**2\n",
    "print \"The induced current in the output cavity = %.2f A\"%Ih"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.5 Page 3-42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cut-off voltage = 5.07 KV\n",
      "Plasma frequency = 9.95e+08 rad/s\n",
      "Reduced plasma frequency = 5.97e+08 rad/s\n",
      "The induced current in the output cavity = 34.41 A\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi\n",
    "\n",
    "#Given : \n",
    "a=0.15##m\n",
    "b=0.45##m\n",
    "B0_bar=1.2##mWb/m**2\n",
    "V=600##V\n",
    "e=1.759*10**11##constant\n",
    "Vc=e*(B0_bar*10**-3)**2*b**2/8*(1-a**2/b**2)**2##V\n",
    "print \"Cut-off voltage = %.2f KV\"%(Vc/1000)\n",
    "Bc=sqrt(8*600)/e**2/45/(1-a**2/b**2)##mWb/m**2\n",
    "\n",
    "I0=0.7##A\n",
    "f=4##GHz\n",
    "Beta0=1##unitless\n",
    "Beta1=1##unitless\n",
    "rho_0=5*10**-5##per cm**3\n",
    "V1=2##V\n",
    "Rsh=10##Kohm\n",
    "Rsh1=5##Kohm\n",
    "K=1.759*10**11##constant\n",
    "epsilon_0=8.884*10**-12##constant\n",
    "omega_p=sqrt(K*rho_0/epsilon_0)##rad/s\n",
    "print \"Plasma frequency = %.2e rad/s\"%omega_p\n",
    "R=0.6##ohm\n",
    "omega_q=R*omega_p##rad/s\n",
    "print \"Reduced plasma frequency = %.2e rad/s\"%omega_q\n",
    "omega=2*pi*f*10**9##rad/s\n",
    "Ih=1/8*(I0/104*omega/omega_q)**3*121*Rsh**2\n",
    "print \"The induced current in the output cavity = %.2f A\"%Ih"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.14 Page 3-48"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Beam coupling coefficient, Beta1=Beta2= 0.93\n",
      "DC transit angle in drift space = 40.21 radian\n",
      "Input cavity voltage = 98.75 V\n",
      "Voltage Gain = 12.81 dB\n",
      "Power Efficiency = 23.28 %\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi,sin,log10\n",
    "\n",
    "#Given : \n",
    "f=4##GHz\n",
    "Vo=1##kV\n",
    "Io=22##mA\n",
    "d=1##mm\n",
    "L=3##cm\n",
    "Gsh=0.55*10**-4##mho\n",
    "Gt=0.3*10**-4##mho\n",
    "mu_o=0.593*10**6*sqrt(Vo*10**3)##m/sec\n",
    "theta_g=2*pi*f*10**9*(d*10**-3)/mu_o##rad\n",
    "Beta1=sin(theta_g/2)/(theta_g/2)#\n",
    "Beta2=Beta1#\n",
    "print \"Beam coupling coefficient, Beta1=Beta2= %.2f\"%Beta1\n",
    "theta_o=2*pi*f*10**9*(L*10**-2)/mu_o##rad\n",
    "print \"DC transit angle in drift space = %.2f radian\"%theta_o\n",
    "X=1.84;J1X=0.582##for max output\n",
    "V1=2*(Vo*10**3)*X/Beta1/theta_o##V\n",
    "print \"Input cavity voltage = %.2f V\"%V1\n",
    "Av=Beta1**2*theta_o*J1X*Io*10**-3/X/(Vo*10**3)/Gsh#\n",
    "AvdB=20*log10(Av)##dB\n",
    "print \"Voltage Gain = %.2f dB\"%AvdB\n",
    "V2=Av*V1##V\n",
    "Eta=Beta2*(Io*10**-3)*J1X*V2/(Io*10**-3)/(Vo*10**3)*100# %\n",
    "print \"Power Efficiency = %.2f %%\"%Eta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5.15 Page 3-49"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power gain = 33.76 dB\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt,pi\n",
    "\n",
    "#Given : \n",
    "Vo=10##kV\n",
    "Io=500##mA\n",
    "Zo=25##ohm\n",
    "f=4##GHz\n",
    "l=20##cm\n",
    "mu_o=0.593*10**6*sqrt(Vo*10**3)##m/sec\n",
    "omega=2*pi*f*10**9##rad/s\n",
    "N=(l/100)*omega/(2*pi*mu_o)#\n",
    "C=(Io*10**-3*Zo/(4*Vo*10**3))**(1/3)#\n",
    "Ap=-9.54+47.3*N*C##dB\n",
    "print \"Power gain = %.2f dB\"%Ap"
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}