{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : Power Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1, Page No. 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# efficiency\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Pac=0.1             #in W\n",
      "Vcc=20.0            #in V\n",
      "Ic=20.0             #in mA\n",
      "\n",
      "#Calculations\n",
      "Pdc=Vcc*Ic*10**-3   #in W\n",
      "eta=(Pac/Pdc)*100   #efficiency\n",
      "\n",
      "#Result\n",
      "print(\"efficiency is ,(%%)= %.f\"%eta)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "efficiency is ,(%)= 25\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2, Page No. 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# collector current\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Pac=2.0                 #in W\n",
      "Vcc=12.0                #in V\n",
      "\n",
      "#Calculations\n",
      "Ic=(Pac*math.sqrt(2)*math.sqrt(2))/Vcc\n",
      "\n",
      "#Result\n",
      "print(\"maximum collector current is ,(A)= %.2f\" %Ic)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum collector current is ,(A)= 0.33\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3, Page No. 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# collector efficiency and power rating\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Pac=3.0                 #in W\n",
      "Pdc=10.0                #in W\n",
      "\n",
      "#Calculations\n",
      "eta=(Pac/Pdc)*100       #percentage efficieny \n",
      "\n",
      "#Result\n",
      "print(\"collector efficiency is ,      (%%) = %.f\"%eta)\n",
      "print(\"power rating of transistor is ,(W) = %.f\" %Pdc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "collector efficiency is ,      (%) = 30\n",
        "power rating of transistor is ,(W) = 10\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4, Page No. 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# power\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "dIc=100.0                             #in mA\n",
      "Rl=6.0                                #in ohm\n",
      "Rl=6.0                                #in ohm\n",
      "dVc=10.0                              #in V\n",
      "\n",
      "#Calculations\n",
      "mv=dIc*Rl*10**-3                      #in V\n",
      "pd=mv*dIc                             #in mW\n",
      "oi=(dVc/dIc)*10**3                    #in ohm\n",
      "n=math.sqrt(oi/Rl)                    #turn ratio of transformer\n",
      "tsv=dVc/n                             #om V\n",
      "Il=tsv/Rl                             #in A\n",
      "ptr= Il**2*Rl*10**3                   #in mW\n",
      "\n",
      "#Result\n",
      "print(\"(i)  power developed in loudspeaker is ,  (mW)= %.f\"%pd)\n",
      "print(\"(ii) power transferred to loudspeaker is ,(mw)= %.f\"%ptr)\n",
      "#in textbook in second case there is one point deviation in the answer."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  power developed in loudspeaker is ,  (mW)= 60\n",
        "(ii) power transferred to loudspeaker is ,(mw)= 1000\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5, Page No. 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# power\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "n=10.0                          #turn ratio\n",
      "Rl=10.0                         #ohm\n",
      "Ic=100.0                        #in mA\n",
      "\n",
      "#Result\n",
      "Rld=n**2*Rl                     #in ohm\n",
      "Irms=Ic/(math.sqrt(2))          #in mA\n",
      "P=Irms**2*Rld                    #in W\n",
      "\n",
      "#Result\n",
      "print(\"maximum power output is ,(W)= %.f\"%(P*10**-6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum power output is ,(W)= 5\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6, Page No. 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# harmonic distortions and change in power\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "#ie=15*sin 400*t+1.5*sin 800*t + 1.2*sin 1200*t + 0.5*sin 1600*t  given equation\n",
      "I2=1.5                               #in A\n",
      "I1=15.0                              #in A\n",
      "I3=1.2                               #in A\n",
      "I4=0.5                               #in A\n",
      "D2=(I2/I1)*100                       #Second percentage harmonic distortion\n",
      "D3=(I3/I1)*100                       #Third percentage harmonic distortion\n",
      "#in book I2 is mentioned wrongly in place of I1\n",
      "D4=(I4/I1)*100                       #Fourth percentage harmonic distortion\n",
      "D=math.sqrt(D2**2+D3**2+D4**2)/100   #Distortion Factor\n",
      "P1=1.0                               #assume\n",
      "P=(1+D**2)*P1                        #in W\n",
      "peri=((P-P1)/P1)*100                 #percentage increase in power due to distortion\n",
      "\n",
      "#Result\n",
      "print(\"part (i)\")\n",
      "print(\"Second percentage harmonic distortion (D2) is ,(%%) = %.f\"%D2)\n",
      "print(\"Third percentage harmonic distortion  (D3) is ,(%%) = %.f\"%D3)\n",
      "print(\"Fourth percentage harmonic distortion (D4) is ,(%%) = %.2f\"%D4)\n",
      "print(\"\\npart (ii)\")\n",
      "print(\"percentage increase in power due to distortion is ,(%%) = %.2f\"%peri)\n",
      "# answer for % increase is slightly different than book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part (i)\n",
        "Second percentage harmonic distortion (D2) is ,(%) = 10\n",
        "Third percentage harmonic distortion  (D3) is ,(%) = 8\n",
        "Fourth percentage harmonic distortion (D4) is ,(%) = 3.33\n",
        "\n",
        "part (ii)\n",
        "percentage increase in power due to distortion is ,(%) = 1.75\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7, Page No. 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# power dissipated\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vcc=15.0                        #in V\n",
      "Vpeak=24.0/2                    #in V\n",
      "Rl=100.0                        #in ohm\n",
      "\n",
      "#Calculations\n",
      "Ipeak= Vpeak/Rl                 #in A\n",
      "Pdc=Vcc*(2/(math.pi))*Ipeak     #in W\n",
      "pad=(1.0/2)*(Vpeak**2)/Rl       #in W\n",
      "pd=Pdc-pad                      #in W\n",
      "pde=pd/2                        #in W\n",
      "\n",
      "#Result\n",
      "print(\"power dissipated by each transistor is,(mW)= %.f\"%(pde*10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power dissipated by each transistor is,(mW)= 213\n"
       ]
      }
     ],
     "prompt_number": 28
    }
   ],
   "metadata": {}
  }
 ]
}