{
 "metadata": {
  "name": "",
  "signature": "sha256:dca2eb0dc5462992ceade27e53e297f6073a62b5b813c53a51758356342ce482"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 17: Voltage Regulators<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.1, Page Number:552 <h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%matplotlib inline"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
        "For more information, type 'help(pylab)'."
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#variable declaration\n",
      "Del_V_out=0.25;\n",
      "V_out=15;\n",
      "Del_V_in=5;    #All voltages in Volts\n",
      "\n",
      "#Calculations\n",
      "line_regulation=((Del_V_out/V_out)/Del_V_in)*100;\n",
      "\n",
      "#Result\n",
      "print('line regulation in %%V is %f' %line_regulation)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "line regulation in %V is 0.333333"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.2, Page Number: 553<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variable Declaration\n",
      "V_NL=12.0;    #No load output voltage in Volts\n",
      "V_FL=11.9;  #Full load output voltage in Volts\n",
      "I_F=10.0;     #Full load current in milli-Amperes\n",
      "\n",
      "#Calculations\n",
      "load_regulation=((V_NL-V_FL)/V_FL)*100;\n",
      "load_reg=load_regulation/I_F;\n",
      "\n",
      "#Result\n",
      "print('load regulation as percentage change from no load to full load = %f'%load_regulation)\n",
      "print('\\nload regulation as percentage change per milliampere = %f' %load_reg)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "load regulation as percentage change from no load to full load = 0.840336\n",
        "\n",
        "load regulation as percentage change per milliampere = 0.084034"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.3, Page Number: 556<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "V_REF=5.1    #Zener voltage in volts\n",
      "R2=10*10**3;\n",
      "R3=10*10**3; #resistances in ohm\n",
      "V_out=(1+(R2/R3))*V_REF;\n",
      "print('output voltage in volts = %.1f'%V_out)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "output voltage in volts = 10.2"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.4, Page Number: 557<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "R4=1;    #Resistance in Ohms\n",
      "I_L_max=0.7/R4;\n",
      "print('maximum current provided to load(in amperes) = %.1f'%I_L_max)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum current provided to load(in amperes) = 0.7"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.5, Page Number: 560<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "V_IN=12.5;    #maximum input voltage in volts\n",
      "R1=22;    #In Ohms\n",
      "\n",
      "V_OUT=0;\n",
      "V_R1=V_IN-V_OUT;   #Voltage across R1\n",
      "P_R1=(V_R1*V_R1)/R1;    #maximum power dissipated by R1\n",
      "print('maximum power dissipated by R1 in WATTS = %f'%P_R1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum power dissipated by R1 in WATTS = 7.102273"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.6, Page Number: 569<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "print('SAME AS EX-2.8 in CHAPTER-2')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SAME AS EX-2.8 in CHAPTER-2"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.7, Page Number: 572<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "I_max=700*10**-3;    #in Amperes\n",
      "R_ext=0.7/I_max;\n",
      "print('value of resistor in Ohms for which max current is 700mA = %f'%R_ext)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of resistor in Ohms for which max current is 700mA = 1.000000"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.8, Page Number: 572<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "V_OUT=24.0;    #Output voltage in Volts\n",
      "R_L=10.0;    #Load resistance in Ohms\n",
      "V_IN=30.0;    #Input voltage in Volts\n",
      "I_max=700.0*10**-3;   #maximum interal current in Amperes\n",
      "I_L=V_OUT/R_L;    #load current in amperes\n",
      "I_ext=I_L-I_max;    #current through the external pass transistor in Amperes\n",
      "P_ext_Qext=I_ext*(V_IN-V_OUT);    #power dissipated\n",
      "print('power dissiated(in WATTS) by the external pass transistor = %.1f'%P_ext_Qext)\n",
      "print('\\nFor safety purpose, we choose a power transistor with rating more than this, say 15W')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power dissiated(in WATTS) by the external pass transistor = 10.2\n",
        "\n",
        "For safety purpose, we choose a power transistor with rating more than this, say 15W"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 17.9, Page Number: 574<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "V_out=5.0;    #7805 gives output voltage of 5V\n",
      "I_L=1.0;    #constant current of 1A\n",
      "R1=V_out/I_L;\n",
      "print('The value of current-setting resistor in ohms = %d'%R1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of current-setting resistor in ohms = 5"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}