{
 "metadata": {
  "name": "",
  "signature": "sha256:b5958de7401e7c4e703b1505a92fb4e5a51a053e9f715840d2c0c18527cc36e3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 - Transistor Switching"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Determine (a)hfe (b)hfe for changed resistor\n",
      "Ib=0.2#Base current(in mA)\n",
      "Vcc=10.#Collector voltage(in volts)\n",
      "Rc1=1.#Collector resistor(in kilo ohm)\n",
      "Rc2=220.#Changed collector resistor(in ohm)\n",
      "Ic1=Vcc/Rc1\n",
      "h1=Ic1/Ib\n",
      "print '%s %.f' %('(a)hfe=',h1)\n",
      "Ic2=Vcc*1000./Rc2\n",
      "h2=Ic2/Ib\n",
      "print '%s %.f' %('(b)hfe for changed resistor=',h2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)hfe= 50\n",
        "(b)hfe for changed resistor= 227\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate the transistor power dissipation at (a)Cutoff (b)Saturation (c)When Vce is 2V\n",
      "Vcc=10.#Collector voltage(in volts)\n",
      "Ic=50.#Collector current(in nA)\n",
      "Rc=1.#Collector resistor(in kilo ohm)\n",
      "Vs=0.2#Voltage of collector emitter junction at saturation(in volts)\n",
      "Vce=2.#Collector emitter voltage(in volts)\n",
      "P1=Ic*Vcc/1000.\n",
      "print '%s %.1f' %('(a)Power dissipation at cutoff(in micro watt)=',P1)\n",
      "P2=(Vcc/Rc)*Vs\n",
      "print '%s %.f' %('(b)Power dissipation at saturation(in mW)=',P2)\n",
      "I=(Vcc-Vce)/Rc\n",
      "P3=I*Vce\n",
      "print '%s %.f' %('(c)Power dissipation at given Vce(in mW)=',P3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Power dissipation at cutoff(in micro watt)= 0.5\n",
        "(b)Power dissipation at saturation(in mW)= 2\n",
        "(c)Power dissipation at given Vce(in mW)= 16\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Vce (a)Before input pulse is applied (b)at end of delay time (c)at end of turn on time (d)Total time \n",
      "Vcc=12.#Collector voltage(in volts)\n",
      "Rc=3.3#Collector resistor(in Kilo ohm)\n",
      "pw=5.#Pulse width of input voltage(in micro sec)\n",
      "Ix=50.#Collector cutoff current(in nA)\n",
      "t=250.#Switch off time(nA)\n",
      "Vce=Vcc-(Ix*Rc*10.**(-6))\n",
      "print '%s %.4f' %('(a)Collector emitter voltage before input pulse is applied(in volts)=',Vce)\n",
      "Vce2=Vcc-(0.1*Vcc)\n",
      "print '%s %.1f' %('(b)Collector emittter voltage at end of delay time(in volts)=',Vce2)\n",
      "Vce3=Vcc-(0.9*Vcc)\n",
      "print '%s %.1f' %('(c)Collector emitter voltage at end of turn on time(in volts)=',Vce3)\n",
      "T=(t*10.**(-3))+pw\n",
      "print '%s %.2f' %('(d)Total time from commencement of input to transistor switch off(in micro sec)=',T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Collector emitter voltage before input pulse is applied(in volts)= 11.9998\n",
        "(b)Collector emittter voltage at end of delay time(in volts)= 10.8\n",
        "(c)Collector emitter voltage at end of turn on time(in volts)= 1.2\n",
        "(d)Total time from commencement of input to transistor switch off(in micro sec)= 5.25\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Determine (a)Capacitance that can give max turn on time (b)Max frequency\n",
      "Rs=600.#Source resistor(in ohm)\n",
      "Rb=5.6#Base resistor(in kilo ohm)\n",
      "t=70.#Turn on time(in ns)\n",
      "C=t*1000./(0.1*Rs)\n",
      "print '%s %.f' %('(a)Required capacitance(in pF)=',C)\n",
      "tre=2.3*Rb*C*10.**(-3)\n",
      "f=1000./(2.*tre)\n",
      "print '%s %.1f' %('(b)Max Frequency(in Khz)=',f)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Required capacitance(in pF)= 1167\n",
        "(b)Max Frequency(in Khz)= 33.3\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Rc and Rb\n",
      "Vcc=12.#Collector voltage(in volts)\n",
      "V=3.#Input voltage(in volts)\n",
      "Ic=1.#collector current(in mA)\n",
      "Vce=0.2#Saturated collector emitter voltage(in volts)\n",
      "hfe=70.\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Rc=(Vcc-Vce)/Ic\n",
      "Ib=Ic*1000./hfe\n",
      "Rb=(V-Vbe)*1000./Ib\n",
      "print '%s %.1f %s %.f' %('Rc(in kilo ohm)=',Rc,'\\nRb(in kilo ohm)=',Rb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rc(in kilo ohm)= 11.8 \n",
        "Rb(in kilo ohm)= 161\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Determine maximum value of capacitor\n",
      "f=45.#Frequency(in khz)\n",
      "Rb=150.#Base Resistor(in ohms)\n",
      "t=1000./(2.*f)\n",
      "C=t*1000./(2.3*Rb)\n",
      "print '%s %.6f' %('Maxixmumvalue of capacitor(in pF)=',C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maxixmumvalue of capacitor(in pF)= 32.206119\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Design a transistor by determining Rc,Rb and amplitude of output waveform\n",
      "E=10.#Input voltage(in volts)\n",
      "Vcc=15.#Collector voltage(in volts)\n",
      "R=100.#Load resistance(in kilo ohm)\n",
      "Vce=0.2#Saturted collector emitter voltage(in volts)\n",
      "Vd=0.7#Diode forward voltage(in volts)\n",
      "hfe=35.\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Rc=R/10.\n",
      "Ic=(Vcc-Vce-Vd)/Rc\n",
      "Ib=Ic/hfe\n",
      "Rb=(E-Vbe-Vd)/Ib\n",
      "Vmin=Vd+Vce\n",
      "Vmax=(Vcc*R)/(R+Rc)\n",
      "Vo=Vmax-Vmin\n",
      "print '%s %.f %s %.f %s %.1f' %('Rc(in kilo ohm)=',Rc,'\\nRb(in kilo ohm)=',Rb,'\\namplitude of output waveform(in volts)=',Vo)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rc(in kilo ohm)= 10 \n",
        "Rb(in kilo ohm)= 213 \n",
        "amplitude of output waveform(in volts)= 12.7\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Rc,Rb,and Cc\n",
      "Vcc=10.#Collector voltage(in volts)\n",
      "Vce=0.2#Saturated collector emitter voltage(in volts)\n",
      "Ic=10.#Collector current(in mA)\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "hfe=100.\n",
      "Pw=1.#Pulse width(in ms)\n",
      "Vi=4.#Input voltage(in volts)\n",
      "Rc=(Vcc-Vce)*1000./Ic\n",
      "Ib=Ic*1000./hfe\n",
      "Rb=(Vcc-Vbe)*1000./Ib\n",
      "Vb=Vi-Vbe-0.5\n",
      "I=(Vcc+Vi)/Rb\n",
      "Cc=I*Pw/Vb\n",
      "print '%s %.f %s %.f %s %.2f' %('Rc(in ohm)=',Rc,'\\nRb(in kilo ohm)=',Rb,'\\nCc(in micro farad)=',Cc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rc(in ohm)= 980 \n",
        "Rb(in kilo ohm)= 93 \n",
        "Cc(in micro farad)= 0.05\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9 - Pg 132"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Determine required capacitance\n",
      "import math\n",
      "E=4.#Input voltage(in volts)\n",
      "Pw=1.#Pulse width(in ms)\n",
      "Rs=1.#Source resistance(in kilo ohm)\n",
      "Vce=0.2#Saturated Collector emitter voltage(in volts)\n",
      "Rc=1.#Collector resistance(in kilo ohm)\n",
      "Vcc=10.#Collector voltage(in volts)\n",
      "hfe=100.\n",
      "Vbe=0.7#Base emitter voltage(in volts)\n",
      "Rb=10.#Base resistance(in kilo ohm)\n",
      "Ic=(Vcc-Vce)/Rc\n",
      "Ib=Ic*1000./hfe\n",
      "Irb=Vbe*1000./Rb\n",
      "ic=Ib+Irb\n",
      "I=(E-Vbe)/Rs\n",
      "C=Pw/(Rs*(math.log(I*1000./ic)))\n",
      "print '%s %.2f' %('Required capacitance(in micro farad)=',C)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required capacitance(in micro farad)= 0.34\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 - Pg 136"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Determine output voltage when (a)Device is cutoff (b)Device is switched on\n",
      "Idf=0.25#Drain current at cutoff(in ns)\n",
      "rd=40.#Drain resistance at switched on(in ohm)\n",
      "Vdd=15.#Drain voltage(in volts)\n",
      "Rd=6.8#Drain resistance(in kilo ohm)\n",
      "Vo=Vdd-(Idf*Rd*10.**(-6))\n",
      "print '%s %.f' %('Output voltage when device is cutoff(in volts)=',Vo)\n",
      "Id=Vdd/Rd\n",
      "Vo2=Id*rd\n",
      "print '%s %.f' %('Output voltage when device is switched on(in milli volts)=',Vo2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage when device is cutoff(in volts)= 15\n",
        "Output voltage when device is switched on(in milli volts)= 88\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}