{
 "metadata": {
  "name": "",
  "signature": "sha256:2de7fc45fa4af4f15b7c3a8c570a56406c01593cbaa6b905a79129b1b124ba5a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter09 : Voltage Regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.1 : page 380"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "Iq=5 #in mA\n",
      "Vo=18 #in volts\n",
      "Vreg=15 #in volts\n",
      "R1=Vreg/(10*Iq*10**-3) #in Ohms  Iq must be in Amperes here\n",
      "R2=(Vo-Vreg)/(11*Iq*10**-3) #in Ohms  Iq must be in Amperes here\n",
      "print \"the values of R1 and R2 are : %0.2f  & %0.1f ohms\"%(R1,R2) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the values of R1 and R2 are : 300.00  & 54.5 ohms\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.2 : page 381"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "Vreg=8 #in volts as IC 7808 is given\n",
      "IL=100 #in mA\n",
      "IR=100 #in mA\n",
      "Iq=0 #in mA\n",
      "RL=50 #in ohms\n",
      "# let find the value of resistor to deliver required current\n",
      "R=Vreg/(IR*10**-3) # in ohms  so current must be in amperes\n",
      "print \"Required Resistance = %0.2f ohms  \"%R \n",
      "Vo = (IR*10**-3)*R+(IL*10**-3)*RL \n",
      "print \"Vo = %0.2f Volts\"%Vo\n",
      "#considering 2 volt dropout\n",
      "Vdropout=2 #in volts\n",
      "VI=Vo+Vdropout \n",
      "print \"Input voltage, VI = %0.2f Volts \"%VI "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required Resistance = 80.00 ohms  \n",
        "Vo = 13.00 Volts\n",
        "Input voltage, VI = 15.00 Volts \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.3 : page 382"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#given data\n",
      "RL1=100 #in ohms\n",
      "RL2=8 #in ohms\n",
      "RL3=1 #in ohms\n",
      "VEBon=0.7 #in volts\n",
      "Beta=25 \n",
      "R=5 #in ohms\n",
      "#device used 7808 so V=8 volts\n",
      "V=8 \n",
      "# part(i) for a laod of 100 ohms\n",
      "IL1=V/RL1 #in amperes\n",
      "VacR1=IL1*R \n",
      "print \"Part(i) : \"\n",
      "print \"VacR = %0.2f Volts \"%VacR1\n",
      "print \"  Which is less than the given VEBon. Hence Transistor remains OFF.\"\n",
      "#so Io=IL and Ic=0\n",
      "Io1=IL1 #in amperes \n",
      "Ic1=0 \n",
      "print \"Ic and Io for the 100 ohms load are %0.2f mA & %0.2f Amperes \"%(Io1*1E3,Ic1)\n",
      "# part(ii) for a laod of 8 ohms\n",
      "IL2=V/RL2 #in amperes\n",
      "VacR2=IL2*R \n",
      "print \"Part(ii) : \"\n",
      "print \"The voltage across R will be = %0.2f Volts \"%VacR2\n",
      "print \"Which is greater than the given VEBon.Hence Transistor will be ON.\"\n",
      "#expression for Io\n",
      "Io2=((IL2+(Beta*VEBon)/R))/(Beta+1) #in amperes \n",
      "Ic2=IL2-Io2 \n",
      "print \"Ic and Io for the 8 ohms load are %0.f & %0.f Amperes  \"%(Io2*1e3,Ic2*1e3)\n",
      "\n",
      "# part(iii) for a laod of 1 ohms\n",
      "IL3=V/RL3 #in amperes\n",
      "VacR3=IL3*R \n",
      "print \"Part(iii) : \"\n",
      "print \"VacR = %0.2f Volt \"%VacR3\n",
      "print \"  Which is greater than the given VEBon.Hence Transistor will be ON.\"\n",
      "#expression for Io\n",
      "Io3=((IL3+(Beta*VEBon)/R))/(Beta+1) #in amperes \n",
      "Ic3=IL3-Io3 \n",
      "print \"Ic and Io for the 1 ohms load are %0.f & %0.3f Amperes \"%(Io3*1e3,Ic3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part(i) : \n",
        "VacR = 0.40 Volts \n",
        "  Which is less than the given VEBon. Hence Transistor remains OFF.\n",
        "Ic and Io for the 100 ohms load are 80.00 mA & 0.00 Amperes \n",
        "Part(ii) : \n",
        "The voltage across R will be = 5.00 Volts \n",
        "Which is greater than the given VEBon.Hence Transistor will be ON.\n",
        "Ic and Io for the 8 ohms load are 173 & 827 Amperes  \n",
        "Part(iii) : \n",
        "VacR = 40.00 Volt \n",
        "  Which is greater than the given VEBon.Hence Transistor will be ON.\n",
        "Ic and Io for the 1 ohms load are 442 & 7.558 Amperes \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.4 : page 384"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "#for the given IC LM317: \n",
      "Iadj=100 #in micro amperes\n",
      "Vref=1.25 #in volts\n",
      "R1=240 #in ohms\n",
      "#(i) For Vo=2 volts\n",
      "#on solving equation Vo=Vref(1+R2/R1)+R2*Iadj\n",
      "Vo=2 #in volts\n",
      "R2=(Vo-Vref)/((Vref/R1)+Iadj*10**-6) \n",
      "print \"for Output 2 volts the requires value of resistance R2 = %0.f ohms \"%(R2)\n",
      "#(i) For Vo=12 volts\n",
      "Vo1=12 #in volts\n",
      "#on solving equation Vo=Vref(1+R2/R1)+R2*Iadj\n",
      "R21=(Vo1-Vref)/(Vref/R1+Iadj*10**-6) \n",
      "print \"for Output 12 volts the requires value of resistance R2 = %0.2f kohms\"%(R21/1e3)\n",
      "#use potentiometer for adjustable value\n",
      "print \"Hence use 3kohm potentiometer to set R2.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for Output 2 volts the requires value of resistance R2 = 141 ohms \n",
        "for Output 12 volts the requires value of resistance R2 = 2.03 kohms\n",
        "Hence use 3kohm potentiometer to set R2.\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.5 : page 385"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "#for the given IC LM317: \n",
      "Iadj=100 #in micro amperes\n",
      "Vref=1.25 #in volts\n",
      "R1=240 #in ohms\n",
      "#we have output equation Vo=Vref(1+R2/R1)+R2*Iadj\n",
      "R2min=0 #in ohms\n",
      "R2max=3000 #in ohms\n",
      "Vomin=Vref*(1+R2min/R1)+R2min*Iadj*10**-6 #in volts\n",
      "Vomax=Vref*(1+R2max/R1)+R2max*Iadj*10**-6 #in volts\n",
      "print \"Minimum output voltage = %0.2f Volts \"%(Vomin)\n",
      "print \"Maximum output voltage = %0.3f Volts \"%Vomax"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum output voltage = 1.25 Volts \n",
        "Maximum output voltage = 17.175 Volts \n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.6 : page 389"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "#IC 723\n",
      "Vsense=0.7#in volts\n",
      "Vo=5 #in volts\n",
      "Im=50 #in mA\n",
      "Id=1 #in mA\n",
      "Vr=7 #in volts\n",
      "R1=(Vr-Vo)/(Id*10**-3) \n",
      "R2=Vo/(Id*10**-3) \n",
      "R3=(R1*R2)/(R1+R2) \n",
      "Rcl=Vsense/(Im*10**-3) \n",
      "print \"various resistance values for the circuit is as follows : \"\n",
      "print \"R1 = %0.2f kohm\"%(R1/1e3)\n",
      "print \"R2 = %0.2f kohm\"%(R2/1e3)\n",
      "print \"R3 = %0.2f kohm\"%(R3/1e3)\n",
      "print \"Rcl = %0.2f ohm\"%Rcl"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "various resistance values for the circuit is as follows : \n",
        "R1 = 2.00 kohm\n",
        "R2 = 5.00 kohm\n",
        "R3 = 1.43 kohm\n",
        "Rcl = 14.00 ohm\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.7 : page 390"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "# IC 723\n",
      "Id=1 #in mA\n",
      "Vsense=0.7 #in volts\n",
      "Vo=15 #in volts\n",
      "Im=50 #in mA\n",
      "Vr=7 #in volts\n",
      "R1=(Vo-Vr)/(Id*10**-3) \n",
      "R2=Vr/(Id*10**-3) \n",
      "R3=(R1*R2)/(R1+R2) \n",
      "Rcl=Vsense/(Im*10**-3) \n",
      "print \"various resistance values for the circuit is as follows : \"\n",
      "print \"R1 = %0.2f kohm\"%(R1/1e3)\n",
      "print \"R2 = %0.2f kohm\"%(R2/1e3)\n",
      "print \"R3 = %0.2f kohm\"%(R3/1e3)\n",
      "print \"Rcl = %0.2f ohm\"%Rcl"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "various resistance values for the circuit is as follows : \n",
        "R1 = 8.00 kohm\n",
        "R2 = 7.00 kohm\n",
        "R3 = 3.73 kohm\n",
        "Rcl = 14.00 ohm\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exa 9.8 : page 390"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data\n",
      "Im=100 #in mA\n",
      "Vr=7 #in volts\n",
      "R2=10 #in kohm\n",
      "Vsense=0.7 #in volts\n",
      "#using equation Vo=((R1+R2)/R2)*Vr\n",
      "#for Vo=10 volts assuming R2=10kohm\n",
      "Vo=10 #in volts\n",
      "R1=((Vo*R2)/Vr)-R2#it gives 3R2=7R1 \n",
      "print \"Part(i) : \"\n",
      "print \"Value of resistance R1 = %0.2F kohms \"%R1\n",
      "#now let output voltage is 15 volts\n",
      "Vo=15 #in volts\n",
      "R1=((Vo*R2)/Vr)-R2#it gives 3R2=7R1 \n",
      "print \"Part(ii) : \"\n",
      "print \"Value of resistance R1 = %0.2f kohms\"%R1\n",
      "R3=(R1*R2)/(R1+R2) \n",
      "print \"value of resistance R3 = %0.2f kohms\"%R3\n",
      "Rcl=Vsense/(Im*10**-3) #in ohms\n",
      "print \"Value of Rcl = %0.2f ohms\" %Rcl"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part(i) : \n",
        "Value of resistance R1 = 4.29 kohms \n",
        "Part(ii) : \n",
        "Value of resistance R1 = 11.43 kohms\n",
        "value of resistance R3 = 5.33 kohms\n",
        "Value of Rcl = 7.00 ohms\n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}