{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "CHAPTER 12 POWER AMPLIFIERS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-1, Page 384"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "VCC=30                #collector voltage(V)\n",
      "RE=20                 #Emitter resistance(Ohm)\n",
      "R1=490.0              #Base resistance1 (Ohm)\n",
      "R2=68.0               #Base resistance2 (Ohm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=180                #Load Resistance(Ohm)\n",
      "RC=120                #Collector resistance(Ohm)\n",
      "\n",
      "VB=VCC*(R2/(R1+R2))    #Base voltage(V)\n",
      "VE=math.ceil(VB-VBE)   #Emitter voltage(V)\n",
      "IE=VE/RE               #Emitter current(A)\n",
      "ICQ=IE                 #collector current (A)\n",
      "VC=VCC-(ICQ*RC)        #collector voltage(V)\n",
      "VCEQ=VC-VE             #collector-emitter voltage (V) \n",
      "rc=RC*RL/(RC+RL)       #ac collector resistance(Ohm)\n",
      "\n",
      "print 'Collector current ICQ = ',ICQ*1000,'mA'\n",
      "print 'collector-emitter voltage VCEQ = ',VCEQ,'V'\n",
      "print 'ac collector resistance rc = ',rc,'Ohm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector current ICQ =  150.0 mA\n",
        "collector-emitter voltage VCEQ =  9.0 V\n",
        "ac collector resistance rc =  72 Ohm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-2, Page 385"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "VCC=30                #collector voltage(V)\n",
      "RE=20                 #Emitter resistance(Ohm)\n",
      "R1=490.0              #Base resistance1 (Ohm)\n",
      "R2=68.0               #Base resistance2 (Ohm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=180                #Load Resistance(Ohm)\n",
      "RC=120                #Collector resistance(Ohm)\n",
      "\n",
      "ICQ=150                 #collector current (mA)\n",
      "VCEQ=9                  #collector-emitter voltage (V) \n",
      "rc=72.0                 #ac collector resistance(Ohm)\n",
      "\n",
      "ic_sat=ICQ+(VCEQ/rc)*1000      #ic(sarturation) (mA)\n",
      "VCE_cut=VCEQ+((ICQ*rc)/1000)   #VCE(cut-off)  (V)\n",
      "MP1=ICQ*RC\n",
      "MP2=VCEQ\n",
      "MPP=2*(min(MP1,MP2))           #maximum peak-to-peak voltage (V)\n",
      "\n",
      "print 'ic(sarturation) = ',ic_sat,'mA'\n",
      "print 'VCE(cut-off) = ',VCE_cut,'V'\n",
      "print 'maximum peak-to-peak voltage MPP = ',MPP,'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ic(sarturation) =  275.0 mA\n",
        "VCE(cut-off) =  19.8 V\n",
        "maximum peak-to-peak voltage MPP =  18 V\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-3, Page 387"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "VCC=30                #collector voltage(V)\n",
      "RE=20                 #Emitter resistance(Ohm)\n",
      "R1=490.0              #Base resistance1 (Ohm)\n",
      "R2=68.0               #Base resistance2 (Ohm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=180.0              #Load Resistance(Ohm)\n",
      "RC=120                #Collector resistance(Ohm)\n",
      "vin=200               #input voltage(mV)\n",
      "zin=100               #input impedance of base(Ohm)\n",
      "MPP=18                #peak-to-peak voltage (V)\n",
      "\n",
      "Zin_stage=((zin**-1)+(R1**-1)+(R2**-1))**-1      #input impedance of stage(KOhm)\n",
      "Pin=vin**2/(Zin_stage*8)/1000                    #ac input power (mW)\n",
      "Pout=1000*MPP**2/(RL*8)                          #ac output power (mW)\n",
      "Ap=Pout/Pin                                      #power gain\n",
      "\n",
      "print 'Power gain Ap = ',math.ceil(Ap)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power gain Ap =  1683.0\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-4, Page 388"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "VCC=30                #collector voltage(V)\n",
      "RE=20                 #Emitter resistance(Ohm)\n",
      "R1=490.0              #Base resistance1 (Ohm)\n",
      "R2=68.0               #Base resistance2 (Ohm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=180                #Load Resistance(Ohm)\n",
      "RC=120                #Collector resistance(Ohm)\n",
      "\n",
      "VB=VCC*(R2/(R1+R2))    #Base voltage(V)\n",
      "VE=math.ceil(VB-VBE)   #Emitter voltage(V)\n",
      "IE=VE/RE               #Emitter current(A)\n",
      "ICQ=IE                 #collector current (A)\n",
      "VC=VCC-(ICQ*RC)        #collector voltage(V)\n",
      "VCEQ=VC-VE             #collector-emitter voltage (V) \n",
      "PDQ=VCEQ*ICQ           #power dissipation(W)\n",
      "I_bias=VCC/(R1+R2)     #bias current(mA)\n",
      "Idc=I_bias+ICQ         #dc current(mA)\n",
      "Pdc=VCC*Idc            #dc input power to stage(W)\n",
      "Pout=0.225             #Output power as per example 12-3 (W)\n",
      "n=(Pout/Pdc)*100       #efficiency of stage\n",
      "\n",
      "print 'Power dissipation PDQ = ',PDQ,'W'\n",
      "print 'efficiency of stage n = ',round(n,2),'%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power dissipation PDQ =  1.35 W\n",
        "efficiency of stage n =  3.68 %\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-6, Page 391"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "VCC=12               #collector voltage(V)\n",
      "RE=16                #Emitter resistance(Ohm)\n",
      "R1=50.0              #Base resistance1 (Ohm)\n",
      "R2=100.0             #Base resistance2 (Ohm)\n",
      "VBE=0.7              #Base-emitter voltage drop(V)\n",
      "RL=16                #Load Resistance(Ohm)\n",
      "\n",
      "VB=VCC*(R2/(R1+R2))    #Base voltage(V)\n",
      "VE=(VB-VBE)            #Emitter voltage(V)\n",
      "IE=VE/RE               #Emitter current(A)\n",
      "ICQ=IE                 #collector current (A)\n",
      "VCEQ=VCC-VE            #collector-emitter voltage (V) \n",
      "re=RE*RL/(RE+RL)       #ac emitter resistance(Ohm)\n",
      "\n",
      "print 'Collector current ICQ = ',ICQ*1000,'mA'\n",
      "print 'collector-emitter voltage VCEQ = ',VCEQ,'V'\n",
      "print 'ac collector resistance re = ',re,'Ohm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Collector current ICQ =  456.25 mA\n",
        "collector-emitter voltage VCEQ =  4.7 V\n",
        "ac collector resistance re =  8 Ohm\n"
       ]
      }
     ],
     "prompt_number": 89
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-7, Page 393"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "VCC=12               #collector voltage(V)\n",
      "RE=16                #Emitter resistance(Ohm)\n",
      "R1=50.0              #Base resistance1 (Ohm)\n",
      "R2=100.0             #Base resistance2 (Ohm)\n",
      "VBE=0.7              #Base-emitter voltage drop(V)\n",
      "RL=16                #Load Resistance(Ohm)\n",
      "\n",
      "ICQ=456                 #collector current (mA)\n",
      "VCEQ=4.7                #collector-emitter voltage (V) \n",
      "re=8.0                  #ac emitter resistance(Ohm)\n",
      "\n",
      "ic_sat=(1000*(VCEQ/re))+ICQ    #ic(sarturation) (mA)\n",
      "VCE_cut=VCEQ+(ICQ*re)/1000   #VCE(cut-off)  (V)\n",
      "MP1=ICQ*re/1000\n",
      "MP2=VCEQ\n",
      "MPP=2*(min(MP1,MP2))           #maximum peak-to-peak voltage (V)\n",
      "\n",
      "print 'ic(sarturation) = ',ic_sat/1000,'A'\n",
      "print 'VCE(cut-off) = ',VCE_cut,'V'\n",
      "print 'maximum peak-to-peak voltage MPP = ',MPP,'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ic(sarturation) =  1.0435 A\n",
        "VCE(cut-off) =  8.348 V\n",
        "maximum peak-to-peak voltage MPP =  7.296 V\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-8, Page 397"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "VCC=20                #collector voltage(V)\n",
      "R1=100.0              #Base resistance1 (Ohm)\n",
      "R2=100.0              #Base resistance2 (Ohm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=8.0                #Load Resistance(Ohm)\n",
      "\n",
      "MPP=VCC                #maximum peak-to-peak voltage (V)\n",
      "PD_max=MPP**2/(40*RL)  #Maximum power dissipation(W)\n",
      "Pout_max=MPP**2/(8*RL) #Maximum output power(W)\n",
      "\n",
      "print 'Maximum power dissipation PD_max = ',PD_max,'W'\n",
      "print 'Maximum output power Pout_max = ',Pout_max,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum power dissipation PD_max =  1.25 W\n",
        "Maximum output power Pout_max =  6.25 W\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-9, Page 398"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "VCC=20                #collector voltage(V)\n",
      "R1=100.0              #Base resistance1 (Ohm)\n",
      "R2=100.0              #Base resistance2 (Ohm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=8.0                #Load Resistance(Ohm)\n",
      "Ra=15                 #adjustable resistor(Ohm)\n",
      "\n",
      "VCEQ=VCC/2            #collector-emitter voltage (V) \n",
      "I_bias=VCC/(R1+R2+Ra) #bias current(mA)\n",
      "Ic_sat=VCEQ/RL        #ic(sarturation) (mA)\n",
      "Iav=Ic_sat/math.pi    #average current (A)\n",
      "Idc=I_bias+Iav        #dc current(mA)\n",
      "Pdc=VCC*Idc           #dc input power to stage(W)\n",
      "Pout=6.25             #Output power as per example 12-8 (W)\n",
      "n=(Pout/Pdc)*100      #efficiency of stage\n",
      "\n",
      "\n",
      "print 'efficiency of stage n = ',round(n,2),'%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "efficiency of stage n =  63.66 %\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-10, Page 400"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "VCC=20                #collector voltage(V)\n",
      "R1=3.9                #Base resistance1 (KOhm)\n",
      "R2=3.9                #Base resistance2 (KOhm)\n",
      "VBE=0.7               #Base-emitter voltage drop(V)\n",
      "RL=10.0               #Load Resistance(Ohm)\n",
      "\n",
      "VCEQ=VCC/2                   #collector-emitter voltage (V) \n",
      "I_bias=(VCC-(2*VBE))/(R1+R2) #bias current(mA)\n",
      "Ic_sat=VCEQ/RL               #ic(sarturation) (mA)\n",
      "Iav=Ic_sat/math.pi           #average current (A)\n",
      "Idc=(I_bias/1000)+Iav        #dc current(mA)\n",
      "Pdc=VCC*Idc                  #dc input power to stage(W)\n",
      "Pout=VCC**2/(8*RL)           #Output power (W)\n",
      "n=(Pout/Pdc)*100             #efficiency of stage\n",
      "\n",
      "print 'efficiency of stage n = ',round(n,2),'%'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "efficiency of stage n =  77.96 %\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-11, Page 405"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "L=2*10**-6           #inductance (H)\n",
      "C=470*10**-12        #capacitance(F)\n",
      "\n",
      "fr=((2*math.pi)*((L*C)**0.5))**-1\n",
      "\n",
      "print 'Resonant frequency fr = ',round((fr*10**-6),2),'MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resonant frequency fr =  5.19 MHz\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-12, Page 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "fr=5.19*10**6        #frequency as per previous example(Hz)\n",
      "L=2*10**-6           #inductance (H)\n",
      "C=470*10**-12        #capacitance(F)\n",
      "QL=100               #quality factor of coil\n",
      "RL=1                 #Load resistance(KOhm)\n",
      "\n",
      "XL=2*math.pi*fr*L                     #inductive impedance(Ohm)\n",
      "Rp=QL*XL/1000                        #Eq. parallel resistance of coil(KOhm)\n",
      "rc=1000*Rp*RL/(Rp+RL)                #ac collector resistance(Ohm)\n",
      "Q=rc/XL                              #Q of overall circuit\n",
      "BW=(fr/Q/1000)                       #band width of amplifier(KHz)\n",
      "\n",
      "print 'band width of amplifier BW = ',round(BW,2),'KHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "band width of amplifier BW =  390.39 KHz\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-13, Page 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "VCC=15                #collector voltage(V)\n",
      "rc=867.0              #ac collector resistance as per preceding example (Ohm)\n",
      "\n",
      "MPP=2*VCC                  #Maximum peak-to-peak voltage(V)\n",
      "PD=1000*MPP**2/(40*rc)     #worst-case power dissipation(mW)\n",
      "\n",
      "print 'Worst-case power dissipation PD = ',math.ceil(PD),'mW'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Worst-case power dissipation PD =  26.0 mW\n"
       ]
      }
     ],
     "prompt_number": 91
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12-14, Page 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "PD=625                #maximum power rating at 25 deg C(mW)\n",
      "D=5                   #Derating factor(mW/deg C)\n",
      "TA=50                 #ambient temperature(deg C)\n",
      "\n",
      "DP=D*(TA-25)            #difference in power(mW)  \n",
      "PD_max=PD-DP            #maximum power rating(mW)\n",
      "\n",
      "print 'Maximum power rating PD_max = ',PD_max,'mW'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum power rating PD_max =  500 mW\n"
       ]
      }
     ],
     "prompt_number": 94
    }
   ],
   "metadata": {}
  }
 ]
}