{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 :  Rectifiers Filters and Regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1 page no-155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Ripple Factor\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Rl=2000.0\n",
      "f=50.0\n",
      "l=20.0\n",
      "V1=0.074\n",
      "\n",
      "#Calculations and Result\n",
      "#(1)\n",
      "w=2*math.pi*f\n",
      "V=Rl/(3*2*math.sqrt(w*2))\n",
      "print(\"1.One Inductor Filter,\\nV = %.3f\\n\"%V1)\n",
      "#(2)\n",
      "Idc=1\n",
      "c=16*10**-6\n",
      "gam=Idc/(4*math.sqrt(3)*f*c*Rl)\n",
      "print(\"\\n2.Capacitor filter, \\nGamma = %.2f\\n\"%gam)\n",
      "#(3)\n",
      "gam2=(math.sqrt(2)/3)*(1.0/4*l*c*(w**2))\n",
      "print(\"\\n3. L Type filter,\\nGamma = %.4f\"%(gam2/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1.One Inductor Filter,\n",
        "V = 0.074\n",
        "\n",
        "\n",
        "2.Capacitor filter, \n",
        "Gamma = 0.09\n",
        "\n",
        "\n",
        "3. L Type filter,\n",
        "Gamma = 0.0037\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2 page no-156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# diode as a rectifier\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "vm=110.0     # rms\n",
      "x=1020.0     # Rf+Rl\n",
      "rl=1000.0\n",
      "\n",
      "#Calculations and Results\n",
      "#(a)\n",
      "Im=vm*math.sqrt(2)/x\n",
      "print(\"(a)\\nIm = %.1f mA\"%(Im*1000))\n",
      "#(b)\n",
      "Idc=Im*1000/math.pi\n",
      "print(\"\\n(b)\\nIdc = %.1f mA\"%Idc)\n",
      "#(c)\n",
      "Ir=Im*1000/2\n",
      "print(\"\\n(c)\\nIrms = %.1f mA\"%Ir)\n",
      "#(d)\n",
      "v=-(Im*rl/math.pi)\n",
      "print(\"\\n(d)\\n Vdc = %.1f V\"%v)\n",
      "#(e)\n",
      "p=Ir*x/1000\n",
      "print(\"\\n(e)\\nPi = %.2f W\"%p)\n",
      "#(f)\n",
      "rl=1.0\n",
      "lr=((vm*math.sqrt(2)/math.pi)-(Idc*rl))/(Idc*rl)\n",
      "print(\"\\n(f)\\n%% regulation = %.2f %%\"%(lr*100))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Im = 152.5 mA\n",
        "\n",
        "(b)\n",
        "Idc = 48.5 mA\n",
        "\n",
        "(c)\n",
        "Irms = 76.3 mA\n",
        "\n",
        "(d)\n",
        " Vdc = -48.5 V\n",
        "\n",
        "(e)\n",
        "Pi = 77.78 W\n",
        "\n",
        "(f)\n",
        "% regulation = 2.00 %\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4 page no-157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# diode as a rectifier\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Rl=5010.0       # ohm\n",
      "idc=0.001\n",
      "\n",
      "#Calculations\n",
      "Vrms=idc*math.pi*Rl/(2*math.sqrt(2))\n",
      "\n",
      "#Result\n",
      "print(\"Vrms = %.2f V\"%Vrms)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vrms = 5.56 V\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5 page no-164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# FWR with LC filter\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "rf=0.02\n",
      "f=60.0\n",
      "vdc=9.0\n",
      "idc=0.1\n",
      "\n",
      "\n",
      "#Calculations\n",
      "w=2*math.pi*f\n",
      "lc=math.sqrt(2)/(rf*12*w**2)\n",
      "Rl=vdc/idc\n",
      "lc1=Rl/900\n",
      "vdc=vdc+5\n",
      "vm=vdc*math.pi/2\n",
      "vrms=vm/math.sqrt(2)\n",
      "\n",
      "#Result\n",
      "print(\"\\nLC=%.1f micro\"%(lc*10**6))\n",
      "print(\"\\nRL = %d Ohm\\n\\nLC>  Rl/3w  >  Rl/1130\\nBut LC should be 25%% larger\"%Rl)\n",
      "print(\"therefore, for f= 60 Hz,the value of LC should be > Rl/900\")\n",
      "print(\"\\nIf L=0.1H, then C=%.1f micro F, This is high value.\"%(math.ceil(lc*10**6/lc1)))\n",
      "print(\"\\nIf L=1H, then C=41.5 micro F.\")\n",
      "print(\"\\n\\nTransformer Rating:\")\n",
      "print(\"Vdc=%.0fV\\nVm=%.0fV\\nVrms=%.1fV\"%(vdc,math.ceil(vm),vrms)) \n",
      "print(\"Therefore, a 15.5 - 0 -15.5 V, 1OOmA transformer is required\\nPIV=%d V\"%(2*math.ceil(vm)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "LC=41.5 micro\n",
        "\n",
        "RL = 90 Ohm\n",
        "\n",
        "LC>  Rl/3w  >  Rl/1130\n",
        "But LC should be 25% larger\n",
        "therefore, for f= 60 Hz,the value of LC should be > Rl/900\n",
        "\n",
        "If L=0.1H, then C=415.0 micro F, This is high value.\n",
        "\n",
        "If L=1H, then C=41.5 micro F.\n",
        "\n",
        "\n",
        "Transformer Rating:\n",
        "Vdc=14V\n",
        "Vm=22V\n",
        "Vrms=15.6V\n",
        "Therefore, a 15.5 - 0 -15.5 V, 1OOmA transformer is required\n",
        "PIV=44 V\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6 page no-165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Ripple Factor\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "vrpp=0.8        # V\n",
      "r=100.0\n",
      "f=60.0\n",
      "c=1050.0*10**-6\n",
      "\n",
      "\n",
      "#Calculations\n",
      "vrms=vrpp/(2*math.sqrt(3))\n",
      "vrms=math.floor(vrms*10)\n",
      "vrms=vrms/10.0\n",
      "vm=8.8\n",
      "vdc=vm-vrpp/2\n",
      "gam=vrms/vdc\n",
      "tgam=1/(4*(math.sqrt(3*c*r*f)))\n",
      "Vdc=(4*f*r*c*vm)/(1+4*f*r*c)\n",
      "\n",
      "#Result\n",
      "print(\"%% regulation, gamma = %.2f%%\"%(gam*100))\n",
      "print(\"\\nTheoretical values, gamma = %.2f%%\"%(tgam*100))\n",
      "print(\"\\nVdc = %.2f V\"%(Vdc))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "% regulation, gamma = 2.38%\n",
        "\n",
        "Theoretical values, gamma = 5.75%\n",
        "\n",
        "Vdc = 8.46 V\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7 page no-167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# power supply using pi filter\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Vdc=25.0\n",
      "Idc=0.1\n",
      "#Calculations\n",
      "R=Vdc/Idc\n",
      "Vc=Vdc+37.5\n",
      "vm=Vc+(Idc/(4.0*50))\n",
      "vrms=vm/math.sqrt(2)\n",
      "vrms=60.0     # approximated to\n",
      "print(\"\\nVrms=%.0f V\\n\\nTherefore, a transformer with 60 - 0 - 60V is chosen.\"%vrms)\n",
      "print(\"The ratings of the diode should be,\\ncurrent of 125mA and voltage = PIV = 2Vm = %.1f\"%(169.2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Vrms=60 V\n",
        "\n",
        "Therefore, a transformer with 60 - 0 - 60V is chosen.\n",
        "The ratings of the diode should be,\n",
        "current of 125mA and voltage = PIV = 2Vm = 169.2\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8 page no-169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Diode rating for FWR\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "Vdc=250.0      # V\n",
      "Idc=0.1\n",
      "rc=400.0\n",
      "L=10.0     #Ohm\n",
      "c=20*10**-6\n",
      "w=377.0\n",
      "\n",
      "\n",
      "#Calculations\n",
      "rl=Vdc/Idc\n",
      "Vm=(Vdc*math.pi/2)*(1+(rc/rl))\n",
      "Vrms=Vm/math.sqrt(2)\n",
      "Ib=2*Vm/(3*math.pi*w*L)\n",
      "rf=0.47/(4*w**2*c)\n",
      "\n",
      "#Result\n",
      "print(\"Vrms=%d V\\n\"%Vrms)\n",
      "print(\"\\nTherefore, the transformer should supply %d V rms on each side of the centre tap.\"%Vrms)\n",
      "print(\"\\nIb = %.4f A\\nRipple factor = %.4f\"%(Ib,rf))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vrms=322 V\n",
        "\n",
        "\n",
        "Therefore, the transformer should supply 322 V rms on each side of the centre tap.\n",
        "\n",
        "Ib = 0.0256 A\n",
        "Ripple factor = 0.0413\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9 page no-170"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# FWR with C type capacitor filter\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "Idc=0.02        # A\n",
      "Vdc=16.0        # V\n",
      "f=50.0\n",
      "\n",
      "#Calculations\n",
      "rl=Vdc/Idc\n",
      "x=4*math.sqrt(3)*f*0.05*rl\n",
      "C=1/x\n",
      "vm=Vdc*((1+(4*f*C*rl)))/(4*f*C*rl)\n",
      "\n",
      "print(\"C=%d microF\"%(C*10**6))\n",
      "print(\"Vm=%.2f V\"%vm)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C=72 microF\n",
        "Vm=17.39 V\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10 page no-170"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Half Wave Rectifier\n",
      "\n",
      "import math\n",
      "#Calculations\n",
      "Vdc=(100/(2*math.pi))*(-math.cos(5*math.pi/6)+math.cos(math.pi/6))\n",
      "Vrms=math.sqrt(3.1)*Vdc\n",
      "\n",
      "#Result\n",
      "print(\"Vdc=%.1f V\"%Vdc)\n",
      "print(\"Vrms=%.1fV\"%Vrms)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vdc=27.6 V\n",
        "Vrms=48.5V\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11 page no-172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# FWR with C type capacitor filter\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "vdc=30.0      # V\n",
      "idc=0.05      # A\n",
      "f=50.0        # Hz\n",
      "c=80*10**-6   # F\n",
      "\n",
      "#Calculations\n",
      "#(a)\n",
      "rl=vdc/idc\n",
      "vm=vdc+(idc/(4*f*c))\n",
      "#(b)\n",
      "s=vm*2*math.pi*f*c\n",
      "#(c)\n",
      "gam=4*math.sqrt(3)*f*c*rl\n",
      "gam=1/gam\n",
      "\n",
      "#Result\n",
      "print(\"(a)\\nRL=%.0f Ohm\\nVm=%.3fV\\nVrms=%.1fV\"%(rl,vm,vm/math.sqrt(2)))\n",
      "print(\"\\n(b)\\nI_diode swing/I_diode mean = %.2f\"%(s/idc))\n",
      "print(\"\\n(c)\\ngamma=%.2f\"%gam)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "RL=600 Ohm\n",
        "Vm=33.125V\n",
        "Vrms=23.4V\n",
        "\n",
        "(b)\n",
        "I_diode swing/I_diode mean = 16.65\n",
        "\n",
        "(c)\n",
        "gamma=0.06\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.12 page no-173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Full wave rectifier circuit\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "vm=25.0\n",
      "vp=35.4            # V\n",
      "rl=25\n",
      "\n",
      "#Calculations\n",
      "vdc=2*vp/math.pi   # V\n",
      "vrms=math.sqrt((vm**2)-vdc**2)\n",
      "im= vp/rl\n",
      "idc=2*im/math.pi\n",
      "irms=math.sqrt(1-idc**2)\n",
      "\n",
      "#Result\n",
      "print(\"Vdc=%.1f V\\nVrms=%.2f V\\nIm=%.2f A\\nIdc=%.2f A\\nIrms=%.3f A\"%(vdc,vrms,im,idc,irms))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vdc=22.5 V\n",
        "Vrms=10.82 V\n",
        "Im=1.42 A\n",
        "Idc=0.90 A\n",
        "Irms=0.433 A\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example 3.13 page no-176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Shunt regulator\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "veb=0.2         # V\n",
      "hfe=49.0\n",
      "vz=6.3          # V\n",
      "i=5*10**-3\n",
      "vi=8.0\n",
      "\n",
      "#(1)\n",
      "y=veb+vz\n",
      "print(\"1. The nominal output voltage is the sum of the transistor V_EB and zener voltage.\\nV0=%.1f V\\n\"%y)\n",
      "\n",
      "#(2)\n",
      "r1=(vi-vz)/i\n",
      "print(\"\\n2. R1 must supply 5mA to the zener diode\\nR1 = %.0f Ohm\"%r1)\n",
      "\n",
      "#(3)\n",
      "k=veb/vz\n",
      "print(\"\\n\\n3. The maximum allowable zener current is\\nIz = %.3f A\"%k)\n",
      "ibmax=k-i\n",
      "it=ibmax*(1+hfe)\n",
      "print(\"\\nTotal current range = %.2f A\"%it)\n",
      "\n",
      "#(4)\n",
      "pd=y*it\n",
      "print(\"\\n(4)\\nThe maximum power dissipation,\\nPd = %.1f W\"%pd)\n",
      "\n",
      "#(5)\n",
      "rs=(vi-y)/it\n",
      "pdr=it**2*rs\n",
      "print(\"\\n(5)\\nRs=%.2f Ohm\\nPower dissipated by Rs is P = %dW\"%(rs,pdr))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1. The nominal output voltage is the sum of the transistor V_EB and zener voltage.\n",
        "V0=6.5 V\n",
        "\n",
        "\n",
        "2. R1 must supply 5mA to the zener diode\n",
        "R1 = 340 Ohm\n",
        "\n",
        "\n",
        "3. The maximum allowable zener current is\n",
        "Iz = 0.032 A\n",
        "\n",
        "Total current range = 1.34 A\n",
        "\n",
        "(4)\n",
        "The maximum power dissipation,\n",
        "Pd = 8.7 W\n",
        "\n",
        "(5)\n",
        "Rs=1.12 Ohm\n",
        "Power dissipated by Rs is P = 2W\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}