{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 18 : Linear and switching voltage regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.1, Page No 761"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Vs=21.0\n",
      "Vo=12.0\n",
      "Av=100.0\n",
      "\n",
      "#Calculations\n",
      "vo=(Vs*0.1)/Av#source effect is 10% of the Vs\n",
      "print(\" source effect is %3.3fV \" %vo)\n",
      "vo=(21-20)/100.0\n",
      "print(\" laod effect is %3.3fV \" %vo)\n",
      "LR=(21*10**-3 *100)/12.0\n",
      "print(\"line regulation is %3.3fpercentage \" %LR)\n",
      "LR=(10*10**-3*100)/12.0\n",
      "print(\" load effect is %3.3fpercentage  \" %LR)\n",
      "RJ=20*math.log((1.0/Av),10)\n",
      "\n",
      "#Results\n",
      "print(\"ripple rejection is %d dB \" %RJ)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " source effect is 0.021V \n",
        " laod effect is 0.010V \n",
        "line regulation is 0.175percentage \n",
        " load effect is 0.083percentage  \n",
        "ripple rejection is -39 dB \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.2, Page No 762"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Vo=12.0\n",
      "Il=40.0*10**-3\n",
      "Vs=20.0\n",
      "Vbe=.7\n",
      "Vz=0.75*Vo\n",
      "print(\"for minimum D1 current select\")\n",
      "Ir2=10.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "R2=(Vo-Vz)/Ir2\n",
      "Ie1=Il+Ir2\n",
      "print(\"specification for Q\")\n",
      "Vce1=20 \n",
      "Vs=Vce1\n",
      "Ic1=50*10**-3\n",
      "Pd=(Vs-Vo)*Ie1\n",
      "hfe=50\n",
      "Ib1=Ie1/hfe\n",
      "Ic2=5*10**-3\n",
      "R1=(Vs-(Vo+.7))/(Ic2+Ib1)\n",
      "Iz=Ie1+Ir2\n",
      "I4=1*10**-3\n",
      "R4=(Vz+Vbe)/I4\n",
      "R3=(Vo-(Vz+Vbe))/I4\n",
      "\n",
      "#Results\n",
      "print(\"The value of R3 is %.2f kohm\" %(R3/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for minimum D1 current select\n",
        "specification for Q\n",
        "The value of R3 is 2.30 kohm\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.3 Page No 765"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "I4=1.0*10**-3\n",
      "Vb2=9.8\n",
      "\n",
      "#Calculations\n",
      "print(\" for Vo=11V moving contact at top of R5\")\n",
      "Vo=11\n",
      "R3=(Vo-Vb2)/I4\n",
      "R=Vb2/I4#R=R4+R5\n",
      "print(\" for Vo=13V moving contact at bottom of R5\")\n",
      "Vo=13\n",
      "I4=Vo/(R3+R)\n",
      "R4=Vb2/I4\n",
      "R5=R-R4\n",
      "\n",
      "#Results\n",
      "print(\"The value of R5 is %.2f kohm\" %(R5/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " for Vo=11V moving contact at top of R5\n",
        " for Vo=13V moving contact at bottom of R5\n",
        "The value of R5 is 1.51 kohm\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.4, Page No 766"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "hFE3=50.0\n",
      "hFE1=20.0\n",
      "Ie1=200.0*10**-3+10*10**-3\n",
      "Ic2=1.0*1**-3\n",
      "Vs=20.0\n",
      "Vb3=13.4\n",
      "Vo=12.0\n",
      "Vbe=0.7\n",
      "\n",
      "#Calculations\n",
      "Ib1=Ie1/hFE1\n",
      "Ib3=Ib1/hFE3\n",
      "R1=(Vs-Vb3)/(Ic2+Ib3)\n",
      "print(\"select I6=.5*10**-3\")\n",
      "I6=.5*10**-3\n",
      "R6=(Vo+Vbe)/I6\n",
      "Pd=(Vs-Vo)*Ie1\n",
      "\n",
      "#Results\n",
      "print(\" peak power dissipated is %.3fnW \" %Pd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "select I6=.5*10**-3\n",
        " peak power dissipated is 1.680nW \n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.5 Page No 769"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Vr1=3.0\n",
      "Ic2=1.0*10**-3\n",
      "Ib3=0.21*10**-3\n",
      "Vbe1=0.7\n",
      "Vbe3=Vbe1\n",
      "Vs=20.0\n",
      "\n",
      "#Calculations\n",
      "R1=Vr1/(Ic2+Ib3)\n",
      "Vz2=Vo+Vbe1+Vbe3+Vr1\n",
      "Ir7=5*10**-3\n",
      "R2=(Vs-Vz2)/Ir7\n",
      "\n",
      "#Results\n",
      "print(\"The value of R2 is %.2f kohm\" %(R2/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R2 is 0.72 kohm\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.6 Page No 770"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Vc5=9.8\n",
      "Vb2=Vc5\n",
      "Vce5=3.0\n",
      "Vbe=0.7\n",
      "Vo=12.0\n",
      "\n",
      "#Calculations\n",
      "Vr9=Vc5-Vce5\n",
      "Vz2=Vr9+Vbe\n",
      "Ic5=1.0*10**-3\n",
      "R8=(Vo-Vc5)/Ic5\n",
      "Ir9=2*Ic5\n",
      "R9=Vr9/Ir9\n",
      "print(\" Iz2>>Ib5 and Iz2> Izk for the zener diode \")\n",
      "Iz2=10*10**-3\n",
      "R7=(Vo-Vz2)/Iz2\n",
      "I4=1*10**-3\n",
      "Vb6=7.5\n",
      "Vz2=Vb6\n",
      "print(\" when Vo=11V moving contact at top of R5 \")\n",
      "Vo=11\n",
      "R3=(Vo-Vb6)/I4\n",
      "R3=3.3*10**3#use standard value\n",
      "I4=(Vo-Vb6)/R3\n",
      "R=Vb6/I4#R=R4+R5\n",
      "print(\" when Vo=13V moving contact at bottom of R5\")\n",
      "Vo=13.0\n",
      "Vb6=7.5\n",
      "I4=Vo/(R3+R)\n",
      "R4=Vb6/I4\n",
      "R5=R-R4\n",
      "\n",
      "#Results\n",
      "print(\"The value of R5 is %.2f kohm\" %(R5/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Iz2>>Ib5 and Iz2> Izk for the zener diode \n",
        " when Vo=11V moving contact at top of R5 \n",
        " when Vo=13V moving contact at bottom of R5\n",
        "The value of R5 is 1.09 kohm\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.7, Page No 770"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Isc=100.0*10**-3\n",
      "Vr10=0.5\n",
      "Vo=12.0\n",
      "\n",
      "#Calculations\n",
      "R10=Vr10/Isc\n",
      "R10=4.7#use standard value\n",
      "Il=200.0*10**-3\n",
      "Vr10=Il*R10\n",
      "Vr11=Vr10-.5\n",
      "I11=1.0*10**-3\n",
      "R11=Vr11/I11\n",
      "R12=(Vo+Vr10-Vr11)/I11\n",
      "\n",
      "#Results\n",
      "print(\"The value of R12 is %.2f kohm\" %(R12/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R12 is 12.50 kohm\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.8 Page No 778"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Vo=12.0\n",
      "hFE1=20.0\n",
      "hFE2=50.0\n",
      "Il=250.0*10**-3\n",
      "Vz=0.75*Vo\n",
      "Vz=9.1#use standard value for 1N757 diode\n",
      "Iz1=10.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "R1=(Vo-Vz)/Iz1\n",
      "I3=1.0*10**-3\n",
      "print(\" when V0=12V(moving contact at top of R5)\")\n",
      "R3=(Vo-Vz)/I3\n",
      "R=Vz/I3\n",
      "print(\" when Vo=15V moving contact at bottom of R5\")\n",
      "Vo=15\n",
      "I3=Vo/(R+R3)\n",
      "R4=Vz/I3\n",
      "R5=R-R4\n",
      "Ir6=.5*10**-3\n",
      "R6=Vo/Ir6\n",
      "print(\" op-amp output current\")\n",
      "Ib2=Il/(hFE1*hFE2)\n",
      "\n",
      "#Results\n",
      "print(\"The value of Ib2 is %.2f mA\" %(Ib2*10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " when V0=12V(moving contact at top of R5)\n",
        " when Vo=15V moving contact at bottom of R5\n",
        " op-amp output current\n",
        "The value of Ib2 is 0.25 mA\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.9 Page No 782"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "I2=1.0*10**-3\n",
      "Vr2=7.15\n",
      "Vref=Vr2\n",
      "Vo=10.0\n",
      "Pdmax=1000.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "R2=Vref/I2\n",
      "R2=6.8*10**3#use standard value and recalculate the I2\n",
      "I2=Vref/R2\n",
      "R1=(Vo-Vref)/I2\n",
      "Vs=Vo+5#for satisfactory operation of series pass transistor\n",
      "Iint=25*10**-3#internal circuit current\n",
      "Pi=Vs*Iint\n",
      "print(\"maximum power dissipated in series pass transistor\")\n",
      "Pd=Pdmax-Pi\n",
      "print(\"maximum load current is \")\n",
      "Il=Pd/(Vs-Vo)\n",
      "\n",
      "#Results\n",
      "print(\"The value of Il is %.2f mA\" %(Il*10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum power dissipated in series pass transistor\n",
        "maximum load current is \n",
        "The value of Il is 125.00 mA\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.10 Page No 785"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "I1=1.0*10**-3\n",
      "Vref=1.25\n",
      "Vo=6.0\n",
      "Vs=15.0\n",
      "Il=200.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "R1=Vref/I1\n",
      "R2=(Vo-Vref)/I1\n",
      "Pd=(Vs-Vo)*Il\n",
      "\n",
      "#Results\n",
      "print(\"regulated power dissipation is %.2f W \" %Pd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "regulated power dissipation is 1.80 W \n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.11, Page No 788"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Vo=10.0\n",
      "Io=1.0\n",
      "Vce=7.0\n",
      "Vf=1.0\n",
      "\n",
      "#Calculations\n",
      "Po=Vo*Io\n",
      "print(\" linear regulator\")\n",
      "Pi=Po+(Vce*Io)\n",
      "n=(Po*100.0)/Pi#efficiency\n",
      "print(\" switching regulator\")\n",
      "Vce=1\n",
      "Pi=Po+Io*(Vce+Vf)\n",
      "n=(Po*100.0)/Pi#efficiency\n",
      "\n",
      "#Results\n",
      "print(\"The value of n is %.2f \" %(n))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " linear regulator\n",
        " switching regulator\n",
        "The value of n is 83.33 \n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.12, Page No 752"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "f=50.0*10**3\n",
      "Vo=12.0\n",
      "Vf=0.7\n",
      "Vi=30.0\n",
      "Vsat=1.0\n",
      "Io=500.0*10**-3\n",
      "Vr=100.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "T=1.0/f\n",
      "t=(Vo+Vf)/(Vi-Vsat-Vo)\n",
      "toff=T/1.75\n",
      "ton=T-toff\n",
      "Ip=2*Io\n",
      "L1=((Vi-Vsat-Vo)*ton)/Ip\n",
      "C1=Ip/(8.0*f*Vr)\n",
      "\n",
      "#Results\n",
      "print(\"The value of C1 is %.2f pF\" %(C1*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of C1 is 25.00 pF\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18.13, Page No 799"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "print(\" an MC34063 controller is for step down transformer\")\n",
      "Ib=-400.0*10**-3\n",
      "I1=1.0*10**-3\n",
      "Vref=1.25\n",
      "V0=12.0\n",
      "Ip=1.0\n",
      "\n",
      "#Calculations\n",
      "ton=8.6*10**-6\n",
      "R1=Vref/I1\n",
      "R1=1.2*10**3#use standard value\n",
      "I1=Vref/R1\n",
      "R2=(Vo-Vref)/I1\n",
      "Rsc=.33/Ip\n",
      "Ct=4.8*10**-5 *ton\n",
      "\n",
      "#Results\n",
      "print(\"The value of Ct is %.2f pF\" %(Ct*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " an MC34063 controller is for step down transformer\n",
        "The value of Ct is 0.00 pF\n"
       ]
      }
     ],
     "prompt_number": 37
    }
   ],
   "metadata": {}
  }
 ]
}