{
 "metadata": {
  "name": "ch_8"
 }, 
 "nbformat": 2, 
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown", 
     "source": [
      "<h1>Chapter 8: Voltage Regulators<h1>"
     ]
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No. 8.1 Page No:362 <h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "Vo=15.0                 #Output voltage in volt", 
      "Vr=2.0                  #Ripple voltage in volt", 
      "", 
      "#Calculations:", 
      "Vimin=Vo+3.0            #Calculating minimum input voltage  ", 
      "", 
      "Vi=Vimin + Vr/2.0       #Calculating input voltage", 
      "", 
      "Vz=Vi/2.0               #Calculating zener voltage", 
      "", 
      "Vz=10.0                 #Volatge in volt", 
      "Iz=20.0*10**-3          #Current in ampere", 
      "", 
      "R1=(Vi-Vz)/Iz           #Calculating resistance value", 
      " ", 
      "I2=50.0*10**-6          #Current ampere", 
      "R2=(Vo-Vz)/I2           #Calculating Resistance value", 
      "R2=R2/1000.0            #Calculating resistance value", 
      "", 
      "R3=Vz/I2                #Calculating resistance value", 
      "R3=R3/1000.0            #Calculating resistance value", 
      "", 
      "Vcemax=Vi+Vr/2          #Calculating volatge", 
      "", 
      "IE=50.0*10**-6          #Current in ampere", 
      "IL=50.0*10**-6          #Current in ampere", 
      "", 
      "P=(Vi-Vo)*IL            #Calculating power           ", 
      "P1=P*1000000.0          #Calculating power", 
      "", 
      "", 
      "#Results:", 
      "print('As Vz=%.1f, use Zener diode 1N758 for 10V'%Vz)", 
      "print('\\nR1= %d ohm'%R1)", 
      "print('\\nR2= %.1f kohm'%R2)", 
      "print('\\nR3= %d kohm'%R3)", 
      "print('\\nSelect C1= 50uF')", 
      "print('\\nP= %.1f mW'%P1)", 
      "print('\\nUse the transstor 2N718 for Q1')"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "As Vz=10.0, use Zener diode 1N758 for 10V", 
        "", 
        "R1= 450 ohm", 
        "", 
        "R2= 100.0 kohm", 
        "", 
        "R3= 200 kohm", 
        "", 
        "Select C1= 50uF", 
        "", 
        "P= 200.0 mW", 
        "", 
        "Use the transstor 2N718 for Q1"
       ]
      }
     ], 
     "prompt_number": 1
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No. 8.2, Page No: 366<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "IL=0.25                #Current in ampere", 
      "Vr=5.0                 #Ripple voltage in volt", 
      "", 
      "#Calculations:", 
      "R=Vr/IL                #Calculating value of resistance ", 
      "RL=10.0                #Calculating value of resistance", 
      "VL=IL*RL               #Calculating voltage", 
      "", 
      "Vo=Vr+VL               #Calculating output voltage", 
      "Vdrop=2.0              #Voltage drop in volt", 
      "Vi=Vo+Vdrop            #Calculating voltage", 
      "", 
      "#Results:", 
      "print('R= %d ohm'%R)", 
      "print('\\nVo= %.1f V'%Vo)", 
      "print('\\nVo= %.1f V'%Vi)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "R= 20 ohm", 
        "", 
        "Vo= 7.5 V", 
        "", 
        "Vo= 9.5 V"
       ]
      }
     ], 
     "prompt_number": 2
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No. 8.3, Page No: 368<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "VL=5.0                 #Voltage in volt", 
      "RL=100.0               #Resistance in ohm", 
      "", 
      "#Calculations:", 
      "IL=VL/RL               #Calculating current ", 
      "IL1=IL*1000.0          #Calculating current", 
      "#Part A", 
      "R1=7.0                 #Resistance in ohm        ", 
      "VR1=IL*R1              #Calculaing voltage drop across R1", 
      "VR1x=VR1*1000.0        #Calculatingvoltage drop across R1", 
      "", 
      "#Part B", 
      "VLb=5.0                #Voltage in volt", 
      "RLb=2.0                #Resistance in ohm", 
      "", 
      "ILb=VLb/RLb            #Calculating current", 
      "", 
      "R1=7.0                 #Resistance in ohm           ", 
      "VR1=ILb*R1             #Calculating voltage drop accross R1", 
      "", 
      "Io=0.147               #Current in ampere     ", 
      "Ic=ILb-Io              #Calculating current", 
      "", 
      "#Results:", 
      "print('Part A')", 
      "print('\\nLoad Current IL= %d mA'% IL1)", 
      "print('\\nVoltage accross R1= %d mV'%VR1x)", 
      "print('\\nAs voltage < 0.7V, Q1 is OFF')", 
      "print('\\nHence IL=Io=Ii=50 mA')", 
      "print('\\n\\nPart B')", 
      "print('\\nLoad Current IL= %.1f A'%ILb)", 
      "print('\\nVoltage accross R1= %.1f V'%VR1)", 
      "print('\\nAs voltage > 0.7V, Q1 is ON')", 
      "print('\\nHence Ic= %.3f A'%Ic)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "Part A", 
        "", 
        "Load Current IL= 50 mA", 
        "", 
        "Voltage accross R1= 350 mV", 
        "", 
        "As voltage < 0.7V, Q1 is OFF", 
        "", 
        "Hence IL=Io=Ii=50 mA", 
        "", 
        "", 
        "Part B", 
        "", 
        "Load Current IL= 2.5 A", 
        "", 
        "Voltage accross R1= 17.5 V", 
        "", 
        "As voltage > 0.7V, Q1 is ON", 
        "", 
        "Hence Ic= 2.353 A"
       ]
      }
     ], 
     "prompt_number": 1
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No. 8.4, Page No: 371<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "R1=240.0                #Resistance in ohm", 
      "R2=2000.0               #Resistance in ohm", 
      "Iadj=50.0*10**-6        #Current in ampere", 
      "Vref=1.25               #Reference voltage in volt   ", 
      "", 
      "#Calculation:", 
      "Vo=(Vref*(1+R2/R1))+(Iadj*R2)  #Calculating output voltage", 
      "", 
      "#Result:", 
      "print('Vo= %.2f V'%Vo)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "Vo= 11.77 V"
       ]
      }
     ], 
     "prompt_number": 4
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No. 8.5, Page NO:371<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "Iadjmax=100.0*10**-6          #Current in ampere", 
      "R1=240.0                      #Resistance in ohm", 
      "Vref=1.25                     #Reference voltage in volt ", 
      " ", 
      "#Calculations:", 
      "#First case: Vo=4", 
      "Vo=4.0                              #Voltage in volt", 
      "R2a1=(Vo-Vref)/(Vref/R1 + Iadjmax)  #Calculating value of resistance", 
      "R2a=R2a1/1000.0                     #Calculating value of resistance", 
      "", 
      "#First case: Vo=12", 
      "Vo=12.0                             #Voltage in volt", 
      "R2b1=(Vo-Vref)/(Vref/R1 + Iadjmax)  #Calculating value of resistance", 
      "R2b=R2b1/1000.0                     #Calculating value of resistance", 
      "", 
      "#Results:", 
      "print('\\nR2= %.2f kohm'%R2a)", 
      "print('\\nR2= %.2f kohm'%R2b)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "", 
        "R2= 0.52 kohm", 
        "", 
        "R2= 2.03 kohm"
       ]
      }
     ], 
     "prompt_number": 5
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No.8.6, Page No: 377<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "ILmax=0.5                 #Current in ampere", 
      "", 
      "#Calculations:", 
      "#Part 1", 
      "Rsc=0.7/ILmax             #Calculting value of resistance", 
      "", 
      "#Part 2", 
      "RL=100.0                  #Resistance in ohm", 
      "Vo=20.0                   #Voltage in volt", 
      "", 
      "IL1=Vo/RL                  #Calculating current", 
      "", 
      "#Part 3", 
      "RLn=10.0                 #Resistance in ohm", 
      "", 
      "IL2=Vo/RLn                #Calculating current", 
      "Von=RLn*ILmax            #Calculating voltage", 
      "", 
      "#Results:", 
      "print('Rsc= %.1f ohm'%Rsc)", 
      "print('\\nIL= %.1f A'%IL1)", 
      "print('\\nIL= %.1f A'%IL2)", 
      "print('\\nSince IL > ILmax of 0.5A, current limiting will happen')", 
      "print('\\nVo= %.1f V'%Von)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "Rsc= 1.4 ohm", 
        "", 
        "IL= 0.2 A", 
        "", 
        "IL= 2.0 A", 
        "", 
        "Since IL > ILmax of 0.5A, current limiting will happen", 
        "", 
        "Vo= 5.0 V"
       ]
      }
     ], 
     "prompt_number": 2
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No. 8.7, Page No: 378<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "R2=10000.0                #Resistance in ohm ", 
      "Vo=12.0                   #Output voltage in volt", 
      "Vref=7.15                 #Reference voltage", 
      "", 
      "#Calculations:", 
      "R1=(Vo/Vref)*R2 - R2      #Calculating resistance value", 
      "R1a=R1/1000.0             #Calculating resistance value", 
      "", 
      "#Result:", 
      "print('\\nR1= %.2f kohm'%R1a)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "", 
        "R1= 6.78 kohm"
       ]
      }
     ], 
     "prompt_number": 3
    }, 
    {
     "cell_type": "markdown", 
     "source": [
      "<h3>Example No.8.8, Page NO: 380<h3>"
     ]
    }, 
    {
     "cell_type": "code", 
     "collapsed": false, 
     "input": [
      "", 
      "#Variable Declaration:", 
      "Vref=7.15                #Reference voltage in volt", 
      "Vo=5.0                   #Output voltage in volt", 
      "", 
      "#Calculations:", 
      "k=Vref/Vo                ", 
      "k1=k-1", 
      "", 
      "#For min voltage of 2V", 
      "Vom=2.0                  ", 
      "km=Vref/Vom", 
      "km1=km-1.43", 
      "", 
      "R1a=10000.0                #Resistance in ohm", 
      "R1b=2000.0                 #Resistance in ohm", 
      " ", 
      "R2=R1a/2.145               #Calculating resistance value", 
      "R2n=R2/1000.0              #Calculating resistance value", 
      "", 
      "R1=6000.0                  #Resistance in ohm", 
      "R3=(R1*R2)/(R1+R2)         #Calculating resistance value", 
      "R3n=R3/1000.0              #Calculating resistance value", 
      "", 
      "#Results:", 
      "print('(R1b+R2)/R2= %.2f'%k)", 
      "print('\\nR1 = %.2f * R2'%k1)", 
      "print('\\n(R1a+R1b+R2)/R2= %.3f'%km)", 
      "print('\\nR1a = %.3f * R2'%km1)", 
      "print('\\nR2= %.2f kohm'%R2n)", 
      "print('\\nR3= %.2f kohm'%R3n)"
     ], 
     "language": "python", 
     "outputs": [
      {
       "output_type": "stream", 
       "stream": "stdout", 
       "text": [
        "(R1b+R2)/R2= 1.43", 
        "", 
        "R1 = 0.43 * R2", 
        "", 
        "(R1a+R1b+R2)/R2= 3.575", 
        "", 
        "R1a = 2.145 * R2", 
        "", 
        "R2= 4.66 kohm", 
        "", 
        "R3= 2.62 kohm"
       ]
      }
     ], 
     "prompt_number": 4
    }, 
    {
     "cell_type": "code", 
     "collapsed": true, 
     "input": [], 
     "language": "python", 
     "outputs": []
    }
   ]
  }
 ]
}