{
 "metadata": {
  "name": "",
  "signature": "sha256:f4a83e38558e2bc6592fc86c02570a86bc0530de75031ae379e4ed7bef896b2d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter13 - Voltage Regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.1 - page : 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "deltaVin=4 #V\n",
      "deltaVout=0.4 #V\n",
      "Vout=20 #V\n",
      "LR=(deltaVout/Vout)*100/deltaVin #%/V(Line Regulation)\n",
      "print \"Line Regulation = %0.1f %%/V \" %LR"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Line Regulation = 0.5 %/V \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.2 - page : 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "VNL=18.0 #V\n",
      "VFL=17.8 #V\n",
      "IL=50.0 #mA\n",
      "LR=(VNL-VFL)*100/VFL #%(Line Regulation)\n",
      "LdR=LR/IL #%/mA(Load Regulation)\n",
      "print \"Load Regulation = %0.3f %%/mA \" %LdR "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Load Regulation = 0.022 %/mA \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.3 - page : 419"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "VBE=0.65 #V\n",
      "RCL=1.2 #ohm\n",
      "ILmax=VBE/RCL #A\n",
      "#For Vout=0, IL=ILmax\n",
      "IL=ILmax #A\n",
      "print \"Load current = %0.2f A \" %IL "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Load current = 0.54 A \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.4 - page : 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "R=20 #kohm\n",
      "R1=20 #kohm\n",
      "R2=10 #kohm\n",
      "VZ=4.7 #V\n",
      "Vref=VZ #V\n",
      "Vout=Vref*(1+R1/R2) #V\n",
      "print \"Output Voltage = %0.1f V \" %Vout"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output Voltage = 14.1 V \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.5 - page : 427"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Vout=15 #V\n",
      "Vin=20 #V\n",
      "INL=2 #mA(INL=Iadj+Iref)\n",
      "Iadj=60 #mA(Assumed)\n",
      "Iref=INL-Iadj/1000 #mA\n",
      "Vref=1.25 #V\n",
      "R1=Vref/Iref*1000 #ohm\n",
      "VR2=Vout-Vref #V\n",
      "R2=VR2/INL*1000 #ohm\n",
      "print \"Design values are : \"\n",
      "print \"Resistance, R1 = %0.f ohm \" %R1 \n",
      "print \"Resistance, R2 = %0.3f kohm \" %(R2/1000 )"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Design values are : \n",
        "Resistance, R1 = 644 ohm \n",
        "Resistance, R2 = 6.875 kohm \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.6 - page : 429"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "RL1=100 #ohm\n",
      "RL2=1 #ohm\n",
      "RCS=7 #ohm\n",
      "VEB=0.7 #V\n",
      "Beta=25 #unitless\n",
      "#For 100 ohm Load\n",
      "Vout=5 #V(as 7805 used)\n",
      "IL=Vout/RL1 #A\n",
      "VRCS=IL*RCS #V(Voltage across RCS)\n",
      "#VRCS<VEB, hence Q1 is off\n",
      "Iout=IL; Iin=IL #A\n",
      "Iext=Iout-Iin #A\n",
      "print \"For 100 ohm load, Output current Iext = %0.2f A \" %Iext\n",
      "#For 1 ohm Load\n",
      "Vout=5 #V(as 7805 used)\n",
      "IL=Vout/RL2 #A\n",
      "ILmax=IL #A\n",
      "VRCS=IL*RCS #V(Voltage across RCS)\n",
      "#VRCS>VEB, hence Q1 is on\n",
      "Iout=(ILmax+Beta*VEB/RCS)/(Beta+1) #A\n",
      "Iext=ILmax-Iout #A\n",
      "print \"For 10 ohm load, Output current Iext = %0.3f A \" %Iext "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For 100 ohm load, Output current Iext = 0.00 A \n",
        "For 10 ohm load, Output current Iext = 4.712 A \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.7 - page : 431"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "RL=range(1,11) #ohm\n",
      "R1=5 #ohm\n",
      "Vref=5 #V\n",
      "IL=1 #A\n",
      "IQ=0 #A\n",
      "Iref=IL #A\n",
      "R1=Vref/Iref #ohm\n",
      "print \"Value of resistor R1 = %0.f ohm \" %R1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of resistor R1 = 5 ohm \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.8 - page : 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Vout=range(15,21) #V\n",
      "Vin=24 #V\n",
      "VR1=12 #V\n",
      "Vref=12 #V\n",
      "I4=0 #A(Assumed)\n",
      "Iout=1 #A(Assumed)\n",
      "R1=VR1/Iout #ohm\n",
      "#Vout=VR1*(1+R2/R1)\n",
      "R2min=R1*(min(Vout)/VR1-1) #Putting min Vout\n",
      "R2max=R1*(max(Vout)/VR1-1) #Putting min Vout\n",
      "print \"Resistance R1 = %0.f ohm \" %R1 \n",
      "print \"Minimum & maximum value of R2 are %0.f ohm & %0.f ohm \" %(R2min,R2max) \n",
      "#A pot of 10 ohm should be used.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance R1 = 12 ohm \n",
        "Minimum & maximum value of R2 are 3 ohm & 8 ohm \n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.9 - page : 438"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Vout=6 #V\n",
      "IL=100 #mA\n",
      "Vref=7.15 #V(For LM 723)\n",
      "Iref=1 #mA(Assumed)\n",
      "R1=(Vref-Vout)/Iref #kohm\n",
      "R2=Vout/Iref #kohm\n",
      "print \"Design values are : \"\n",
      "print \"R1 should be used 1.2kohm. Calculated R1 %0.2f kohm \" %R1 \n",
      "print \"R2 should be used 6.2kohm. Calculated R2 = %0.2f kohm \" %R2 \n",
      "R1=1.2; R2=6.2 #kohm\n",
      "R3=R1*R2/(R1+R2) #kohm\n",
      "print \"Resistance R3 = %0.f kohm \" %R3 \n",
      "RCL=0.65/(IL/1000) #kohm\n",
      "print \"Resistance RCL = %0.1f kohm \" %RCL "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Design values are : \n",
        "R1 should be used 1.2kohm. Calculated R1 1.15 kohm \n",
        "R2 should be used 6.2kohm. Calculated R2 = 6.00 kohm \n",
        "Resistance R3 = 1 kohm \n",
        "Resistance RCL = 6.5 kohm \n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 13.10 - page : 442"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Vout=15 #V\n",
      "IL=50 #mA\n",
      "Vin=20 #V\n",
      "PDmax=1 #W(For LM 723)\n",
      "Iref=3 #mA(From datasheet)\n",
      "PD=Vout*(IL+Iref) #mW\n",
      "print \"Required PD = %0.3f W \" %(PD/1000) \n",
      "print \"PDmax supplied by LM723 = %0.2f mW \" %PDmax \n",
      "print \"PD<PDmax, so we can use it.\"\n",
      "Vref=7.15 #V(For LM 723)\n",
      "R3=1.5 #kohm(choosen)\n",
      "R1BYR2=(Vout-Vref)/Vref \n",
      "R1=R3*(R1BYR2+1) #ohm\n",
      "print \"Resistance R1 = %0.2f kohm\" %R1 \n",
      "R2=R1/R1BYR2 #ohm\n",
      "print \"Resistance R2 = %0.2f kohm \" %R2 \n",
      "print \"Resistance R3 = %0.2f kohm \" %R3 \n",
      "RCL=0.65/(IL/1000) #ohm\n",
      "print \"Resistance RCL = %0.2f ohm \" %RCL "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required PD = 0.795 W \n",
        "PDmax supplied by LM723 = 1.00 mW \n",
        "PD<PDmax, so we can use it.\n",
        "Resistance R1 = 3.15 kohm\n",
        "Resistance R2 = 2.87 kohm \n",
        "Resistance R3 = 1.50 kohm \n",
        "Resistance RCL = 13.00 ohm \n"
       ]
      }
     ],
     "prompt_number": 32
    }
   ],
   "metadata": {}
  }
 ]
}