{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter- 11 : Voltage Regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 11.1 - Page No 337\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "I_dc=300 # in mA\n",
      "C=200 # in micro F\n",
      "V_max= 24 # in volt\n",
      "V_r_rms= 2.4*I_dc/C # in volt\n",
      "V_r_peak= sqrt(3)*V_r_rms # in volt\n",
      "V_dc= V_max-V_r_peak # in volt\n",
      "V_in_low= V_max-V_r_peak # in volt\n",
      "print \"Minimum input voltage = %0.2f volt\" %V_in_low"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum input voltage = 17.76 volt\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 11.2 - Page No 337\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "I_L= 0.5 # in amp\n",
      "R_L=25 # in ohm\n",
      "V_R=12 # in volt (since using 7812 voltage regulator)\n",
      "V_L= I_L*R_L \n",
      "R=V_R/I_L # in ohm\n",
      "print \"Resistance required = %0.f ohm\" %R\n",
      "V_out= V_R+V_L # in volt\n",
      "print \"Output voltage = %0.1f volt\" %V_out\n",
      "V_in= V_out+2 # in volt\n",
      "print \"Input voltage = %0.1f volt\" %V_in"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance required = 24 ohm\n",
        "Output voltage = 24.5 volt\n",
        "Input voltage = 26.5 volt\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 11.3 - Page No 337\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "R1= 240 # in ohm\n",
      "R2= 1.2 # in kohm\n",
      "R2=R2*10**3 # in ohm\n",
      "V_out= 1.25*(1+R2/R1) # in volt\n",
      "print \"Regulated output voltage = %0.1f volt\" %V_out"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Regulated output voltage = 7.5 volt\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 11.4 - Page No 337\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "R1= 40 # in ohm\n",
      "I_Q= 10 # in mA\n",
      "I_Q=I_Q*10**-3 # in amp\n",
      "V_REF= 15 # in volt\n",
      "# When R2 is set at minimum i.e.\n",
      "R2= 0 # in ohm\n",
      "V_out= (1+R2/R1)*V_REF + I_Q*R2 # in volt\n",
      "print \"Minimum output voltage = %0.f volt\" %V_out\n",
      "# When R2 is set at maximum i.e.\n",
      "R2= 200 # in ohm\n",
      "V_out= (1+R2/R1)*V_REF + I_Q*R2 # in volt\n",
      "print \"Minimum output voltage = %0.f volt\" %V_out"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum output voltage = 15 volt\n",
        "Minimum output voltage = 92 volt\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 11.5 - Page No 350\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "R1= 2.5 # in kohm\n",
      "R1= R1*10**3 # in ohm\n",
      "R2= 1 # in kohm\n",
      "R2= R2*10**3 # in ohm\n",
      "V_REF= 1.25 # in volt\n",
      "I= V_REF/R2 # in amp\n",
      "# This current also flows through R1. So the output voltage\n",
      "V_out= I*(R1+R2) # in volt\n",
      "print \"Output voltage = %0.3f volt\" %V_out"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage = 4.375 volt\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 11.6 - Page No 350\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "R1= 3 # in kohm\n",
      "R1= R1*10**3 # in ohm\n",
      "R2= 1 # in kohm\n",
      "R2= R2*10**3 # in ohm\n",
      "V_REF= 1.25 # in volt\n",
      "V_in=20 # in volt\n",
      "V_out= V_REF*(R1+R2)/R2 # in volt\n",
      "D=V_out/V_in*100 # in percent\n",
      "print \"Duty cycle = %0.f %%\" %D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Duty cycle = 25 %\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}