{
 "metadata": {
  "name": "",
  "signature": "sha256:2a1eb39510f3631fbcde9a4826e6d686285d8646443cf4d3538c3c9c67fda877"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 - Diode Circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_1 Pg-213\n",
      "#calculate Peak source voltage,DC load voltage With an ideal diode and With second approximation\n",
      "import math\n",
      "Vrms=110. #rms volatage in V\n",
      "Vm=Vrms/0.707 #peak source voltage\n",
      "print '%s %.1f' %(\"Peak source voltage=V\",Vm) #textbook answer wrong\n",
      "\n",
      "print '%s' %(\"(a) With an ideal diode \")\n",
      "Vpout=Vm #peak output voltage\n",
      "print '%s %.1f' %(\"\\n Peak output voltage=V\",Vpout)\n",
      "Vdc=Vm/math.pi #Dc load voltage\n",
      "print '%s %.2f' %(\"\\n DC load voltage=V \\n\",Vdc) #textbook answer wrong\n",
      "\n",
      "print '%s' %(\"(b) With second approximation\")\n",
      "Vpin=Vm #peak input voltage\n",
      "Vpout=Vpin-0.7\n",
      "print '%s %.1f' %(\"\\n Peak output voltage=V\",Vpout)\n",
      "Vdc=Vpout/math.pi #Dc load voltage\n",
      "print '%s %.1f' %(\"\\n DC load voltage=V \\n\",Vdc) #textbook answer wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Peak source voltage=V 155.6\n",
        "(a) With an ideal diode \n",
        "\n",
        " Peak output voltage=V 155.6\n",
        "\n",
        " DC load voltage=V \n",
        " 49.52\n",
        "(b) With second approximation\n",
        "\n",
        " Peak output voltage=V 154.9\n",
        "\n",
        " DC load voltage=V \n",
        " 49.3\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_2 Pg-214\n",
      "#calculate VR\n",
      "print '%s' %(\"VR = (V_NoLoad - V_FullLoad)/V_FullLoad*100%\")\n",
      "print '%s' %(\"(a) VR = 0%\")\n",
      "V_FullLoad=20. #full load voltage\n",
      "V_NoLoad=V_FullLoad#no load voltage\n",
      "print '%s %.0f' %(\"\\n V_FullLoad = V_NoLoad=V\",V_NoLoad)\n",
      "print '%s' %(\"(b) VR = 100%\")\n",
      "VR=100. #voltage regulation in %\n",
      "V_NoLoad=(VR*V_FullLoad)/(100.)+V_FullLoad\n",
      "print '%s %.0f' %(\"\\n V_NoLoad=V\",V_NoLoad)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "VR = (V_NoLoad - V_FullLoad)/V_FullLoad*100%\n",
        "(a) VR = 0%\n",
        "\n",
        " V_FullLoad = V_NoLoad=V 20\n",
        "(b) VR = 100%\n",
        "\n",
        " V_NoLoad=V 40\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_3 Pg-214\n",
      "#calculate Ratio of rectification or efficiency of halfwave rectifier,Ac input powerfrom transformer secondary\n",
      "print '%s' %(\"Ratio of rectification or efficiency of halfwave rectifier\")\n",
      "print '%s' %(\"n = 0.406 = DC power deliverd to the load/AC input powerfrom transformer secondary \")\n",
      "DC_power=500. #ddc power deliverd to the load\n",
      "n=0.406 #efficiency\n",
      "AC_in_power=DC_power/n #AC input powerfrom transformer secondary\n",
      "print '%s %.0f' %(\"\\n AC input powerfrom transformer secondary =Watt\",AC_in_power)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of rectification or efficiency of halfwave rectifier\n",
        "n = 0.406 = DC power deliverd to the load/AC input powerfrom transformer secondary \n",
        "\n",
        " AC input powerfrom transformer secondary =Watt 1232\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_4 Pg-220\n",
      "#calculate Peak value of current flowing,Average or DC current flowing,R.M.S value of current flowing, DC output power,AC input power,Efficiency of rectifier\n",
      "import math\n",
      "Rl=3.5*10.**(3.) #resistance in k-ohm\n",
      "rF=800. #secondary resistance in k-ohm\n",
      "Vm=240.# input voltage\n",
      "print '%s' %(\"(1)(a) Peak value of current flowing\")\n",
      "Im=Vm/(rF+Rl) #peak current\n",
      "print '%s %.2f' %(\"Im=mA\",Im*10**3)\n",
      "print '%s' %(\"(b) Average or DC current flowing\")\n",
      "Idc=Im/math.pi #DC current\n",
      "print '%s %.2f' %(\"Idc=mA\",Idc*10**3)\n",
      "print '%s' %(\"(c) R.M.S value of current flowing\")\n",
      "Irms=Im/2. #rms current\n",
      "print '%s %.2f' %(\"Irms=mA\",Irms*10**3)\n",
      "print '%s' %(\"(2) DC output power\")\n",
      "Pdc=(Idc)**2.*Rl #dc output power\n",
      "print '%s %.1f' %(\"Pdc=Watt\",Pdc)\n",
      "print '%s' %(\"(3) AC input power\")\n",
      "Pac=(Irms)**2.*(rF+Rl)\n",
      "print '%s %.2f' %(\"Pac=Watt\",Pac)\n",
      "print '%s' %(\"(4)Efficiency of rectifier\")\n",
      "n=(Pdc/Pac)*100. #efficiency\n",
      "print '%s %.2f' %(\"n=\",n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(1)(a) Peak value of current flowing\n",
        "Im=mA 55.81\n",
        "(b) Average or DC current flowing\n",
        "Idc=mA 17.77\n",
        "(c) R.M.S value of current flowing\n",
        "Irms=mA 27.91\n",
        "(2) DC output power\n",
        "Pdc=Watt 1.1\n",
        "(3) AC input power\n",
        "Pac=Watt 3.35\n",
        "(4)Efficiency of rectifier\n",
        "n= 32.99\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_5 Pg-221\n",
      "#calculate Peak output volatge,Average output current,Diode dissipation\n",
      "import math\n",
      "Vr=0.7 #diodes voltage drop\n",
      "Rl=820. #load resistor in ohm\n",
      "Vin=40. #input voltage in V\n",
      "print '%s' %(\"(1)  Peak output volatge: Current flows through load only when two diodes conduct. While conducting, there is voltage drop across the diode.\")\n",
      "V_drop_2=2.*Vr #voltage drop across 2 diodes\n",
      "Vm=Vin-V_drop_2 #peak voltage\n",
      "print '%s %.2f' %(\"\\nVm=V\",Vm)\n",
      "print '%s' %(\"\\n(2) Average output current\")\n",
      "Idc=(2*Vm/math.pi)/Rl #average output current\n",
      "print '%s %.0f' %(\"Idc=mA\",Idc*10**3)\n",
      "print '%s' %(\"\\n(3) Diode dissipation\")\n",
      "DD=Idc*Vr #Diode dissipation\n",
      "print '%s %.0f' %(\"=mW\",DD*10**3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(1)  Peak output volatge: Current flows through load only when two diodes conduct. While conducting, there is voltage drop across the diode.\n",
        "\n",
        "Vm=V 38.60\n",
        "\n",
        "(2) Average output current\n",
        "Idc=mA 30\n",
        "\n",
        "(3) Diode dissipation\n",
        "=mW 21\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_6 Pg-222\n",
      "#calculate RMS value of secondary voltage,,Peak secondary voltage,Peak inverse voltage of diode,Peak load voltage,DC load voltage\n",
      "import math\n",
      "Vr=0.7 #voltage drop\n",
      "Vi=120. #input voltage\n",
      "print '%s' %(\"RMS value of secondary voltage\")\n",
      "V_sec=Vi/5. #RMS value of secondary voltage\n",
      "print '%s %.0f' %(\"=V\",V_sec)\n",
      "print '%s' %(\"Peak secondary voltage\")\n",
      "Vm=V_sec*math.sqrt(2.) #Peak secondary voltage\n",
      "print '%s %.0f' %(\"=V\",Vm)\n",
      "print '%s' %(\"Peak inverse voltage of diode\")\n",
      "Vinv=-(Vm) #Peak inverse voltage of diode\n",
      "print '%s %.0f' %(\"=V\",Vinv)\n",
      "print '%s %.0f' %(\"\\nPeak load voltage=V\",Vm)\n",
      "print '%s' %(\"DC load voltage\")\n",
      "Vdc=Vm/math.pi #DC load voltage\n",
      "print '%s %.1f' %(\"=V\",Vdc)\n",
      "print '%s' %(\"Assuming second approximation\")\n",
      "print '%s' %(\"Vm'' = Vm - Vr \")\n",
      "print '%s' %(\"Peak load voltage\")\n",
      "Vm_dash=Vm-Vr #Peak load voltage\n",
      "print '%s %.1f' %(\"=V\",Vm_dash)\n",
      "print '%s' %(\"DC load voltage\")\n",
      "Vdc=Vm_dash/math.pi #DC load voltage\n",
      "print '%s %.1f' %(\"=V\",Vdc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "RMS value of secondary voltage\n",
        "=V 24\n",
        "Peak secondary voltage\n",
        "=V 34\n",
        "Peak inverse voltage of diode\n",
        "=V -34\n",
        "\n",
        "Peak load voltage=V 34\n",
        "DC load voltage\n",
        "=V 10.8\n",
        "Assuming second approximation\n",
        "Vm'' = Vm - Vr \n",
        "Peak load voltage\n",
        "=V 33.2\n",
        "DC load voltage\n",
        "=V 10.6\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_7 Pg-222\n",
      "#calculate Secondary RMS voltage,Secondary pek voltage,Half of the secondary voltage is input to the half section,Peak voltage across load,DC load current\n",
      "import math\n",
      "Vi=120. #supply voltage n V\n",
      "Rl=5.*10.**3. #load resistance\n",
      "print '%s' %(\"Secondary RMS voltage\")\n",
      "Vrms=Vi/5. #Secondary RMS voltage\n",
      "print '%s %.0f' %(\"=V\",Vrms)\n",
      "print '%s' %(\"Secondary pek voltage\")\n",
      "Vm=Vrms*math.sqrt(2.) #Secondary pek voltage\n",
      "print '%s %.0f' %(\"=V\",Vm)\n",
      "print '%s' %(\"  Half of the secondary voltage is input to the half section.\")\n",
      "print '%s' %(\"So input to the half section\")\n",
      "i=Vm/2. #input to the half section\n",
      "print '%s %.0f' %(\"=V\",i)\n",
      "print '%s' %(\"Peak voltage across load\")\n",
      "print '%s %.0f' %(\"=V\",i)\n",
      "print '%s' %(\"DC voltage across load = 17V. Since the capacitor gets changed up to peak value,\")\n",
      "print '%s' %(\"DC load current\")\n",
      "Vdc=i\n",
      "Idc=Vdc/Rl #DC load current\n",
      "print '%s %.1f' %(\"=mA\",Idc*10**3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Secondary RMS voltage\n",
        "=V 24\n",
        "Secondary pek voltage\n",
        "=V 34\n",
        "  Half of the secondary voltage is input to the half section.\n",
        "So input to the half section\n",
        "=V 17\n",
        "Peak voltage across load\n",
        "=V 17\n",
        "DC voltage across load = 17V. Since the capacitor gets changed up to peak value,\n",
        "DC load current\n",
        "=mA 3.4\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_8 Pg-227\n",
      "#calculate Ripple factor for a full wave rectifier,DC output voltage,Percentage voltage regulation\n",
      "import math\n",
      "f=50. #frequency in Hz\n",
      "C=100.*10.**(-6.) #capacitance in F\n",
      "Rl=2.*10.**3. #load resistance\n",
      "Vrms=40. #rms secondary voltage\n",
      "print '%s' %(\"(a) Ripple factor for a full wave rectifier\")\n",
      "r=1./(4.*math.sqrt(3.)*f*C*Rl) #Ripple factor for a full wave rectifier\n",
      "print '%s %.3f' %(\"=\",r)\n",
      "print '%s' %(\"(b) DC output voltage\")\n",
      "Vm=Vrms*math.sqrt(2.)\n",
      "Vdc=Vm/(1.+(1./(4.*f*C*Rl))) #DC output voltage\n",
      "print '%s %.1f' %(\"=V\",Vdc)\n",
      "print '%s' %(\"(c) Percentage voltage regulation\")\n",
      "per=100./(4.*f*C*Rl) #Percentage voltage regulation\n",
      "print '%s %.1f' %(\"=\",per)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Ripple factor for a full wave rectifier\n",
        "= 0.014\n",
        "(b) DC output voltage\n",
        "=V 55.2\n",
        "(c) Percentage voltage regulation\n",
        "= 2.5\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9 - Pg 237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_9 Pg-237\n",
      "#calculate Connected load,Ripple factor in case of shunt capacitor filter\n",
      "import math\n",
      "Vrms=300. #rms voltage in V\n",
      "f=60. #frequency\n",
      "Idc=0.2 #load current\n",
      "C=10. #shunt capacitor in microFarad\n",
      "Vm=Vrms*math.sqrt(2.) #peak voltage\n",
      "Vdc=(2*Vm)/math.pi #Dc voltage\n",
      "print '%s' %(\"Connected load\")\n",
      "Rl=Vdc/Idc #Connected load\n",
      "print '%s %.0f' %(\"Rl=ohm = (955.6)*sqrt(2) ohm\\n\",Rl)\n",
      "print '%s' %(\"Ripple factor in case of shunt capacitor filter \")\n",
      "print '%s' %(\"=2410/C*Rl\")\n",
      "r=2410./(C*Rl) #ripple factor\n",
      "print '%s %.2f' %(\"=\",r)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Connected load\n",
        "Rl=ohm = (955.6)*sqrt(2) ohm\n",
        " 1350\n",
        "Ripple factor in case of shunt capacitor filter \n",
        "=2410/C*Rl\n",
        "= 0.18\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 - Pg 238"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_10 Pg-238\n",
      "#calculate Peak voltage,DC output voltage,Ripple factor in case of capacitor filter\n",
      "import math\n",
      "f=60. #frequency in Hz\n",
      "C=100.*10.**(-6.) #capacitance in F\n",
      "Rl=1.*10.**3. #load resistance\n",
      "\n",
      "print '%s' %(\"Since the transformer is center tapped ,the rms value of voltage across half the secondary coil\")\n",
      "Vct=12.6 #voltage of center tapped transformer\n",
      "Vrms=Vct/2. #rms voltage\n",
      "\n",
      "print '%s' %(\"Peak voltage\")\n",
      "Vm=Vrms*math.sqrt(2.) #peak voltage\n",
      "print '%s %.2f' %(\"= V\\n \",Vm)\n",
      "\n",
      "print '%s' %(\"(b) DC output voltage\")\n",
      "Vdc=Vm/(1.+(1./(4.*f*C*Rl))) #DC output voltage\n",
      "print '%s %.2f' %(\"=V\\n \",Vdc)\n",
      "\n",
      "print '%s' %(\"Ripple factor in case of capacitor filter \")\n",
      "print '%s' %(\"=2410/C*Rl\")\n",
      "r=2410./(100.*Rl)*100. #ripple factor\n",
      "print '%s %.1f' %(\"\\n=\\n \",r)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Since the transformer is center tapped ,the rms value of voltage across half the secondary coil\n",
        "Peak voltage\n",
        "= V\n",
        "  8.91\n",
        "(b) DC output voltage\n",
        "=V\n",
        "  8.55\n",
        "Ripple factor in case of capacitor filter \n",
        "=2410/C*Rl\n",
        "\n",
        "=\n",
        "  2.4\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11 - Pg 238"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_11 Pg-238\n",
      "#calculate the LOad connected to the filter,Critical value of inductor,Capacitance\n",
      "import math\n",
      "Vdc=9. #dc voltage\n",
      "Idc=100.*10.**(-3.) #dc load current\n",
      "print '%s' %(\"Ripple factor with an L-C filter,r=(0.83/LC)\")\n",
      "print '%s' %(\"where L-> Henry,C->microFarad\")\n",
      "gamm=0.02 #maximum ripple\n",
      "LC=0.83/gamm\n",
      "print '%s %.1f' %(\"LC =\",LC) #let LC=42\n",
      "\n",
      "print '%s' %(\"LOad connected to the filter,\")\n",
      "RL=Vdc/Idc #load resistance in ohm\n",
      "print '%s %.0f' %(\"RL=ohm\",RL)\n",
      "\n",
      "print '%s' %(\"Critical value of inductor,\")\n",
      "Lk=RL/900. #Critical value of inductor\n",
      "print '%s %.1f' %(\"Lk=\",Lk)\n",
      "\n",
      "print '%s' %(\"Capacitance\")\n",
      "LC=42. #rounding of 41.5 to 42\n",
      "C=LC/Lk #capacitance in microFarad\n",
      "print '%s %.0f' %(\"C  =uF\",C)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ripple factor with an L-C filter,r=(0.83/LC)\n",
        "where L-> Henry,C->microFarad\n",
        "LC = 41.5\n",
        "LOad connected to the filter,\n",
        "RL=ohm 90\n",
        "Critical value of inductor,\n",
        "Lk= 0.1\n",
        "Capacitance\n",
        "C  =uF 420\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E12 - Pg 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_12 Pg-245\n",
      "#calculate Voltage across resistor,Current through series resistor\n",
      "V=20. #source voltage\n",
      "Vz=12. #zener voltage\n",
      "Vr=V-Vz #voltage across resistor \n",
      "Rs=330. #series resistance\n",
      "print '%s' %(\"Voltage across resistor \")\n",
      "print '%s %.0f' %(\"=V\",Vr)\n",
      "print '%s' %(\"Current through series resistor\")\n",
      "Iser=Vr/Rs #Current through series resistor\n",
      "print '%s %.1f' %(\"=mA\",Iser*10**3)\n",
      "print '%s' %(\"Since Zener diode is in series with resistor, current through it is equal to current flowing through resistor,i.e 24.2mA \")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage across resistor \n",
        "=V 8\n",
        "Current through series resistor\n",
        "=mA 24.2\n",
        "Since Zener diode is in series with resistor, current through it is equal to current flowing through resistor,i.e 24.2mA \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13 - Pg 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_13 Pg-245\n",
      "#calclate Voltage across resistor,Current through series resistor,Current through series load Il,Current through zener diode,Respective wattage of elements used\n",
      "V=20. #source voltage in V\n",
      "Vz=12. #zener voltage in V\n",
      "Vs=V-Vz #voltage across resistor in V \n",
      "Rs=330. #series resistance in ohm\n",
      "RL=1.5*10**3 #load resistance in ohm\n",
      "print '%s' %(\"Voltage across resistor \")\n",
      "print '%s %.0f' %(\"=V\",Vs)\n",
      "\n",
      "print '%s' %(\"(1) Current through series resistor Is\")\n",
      "Is=Vs/Rs #Current through series resistor\n",
      "print '%s %.1f' %(\"Is=mA\",Is*10**3)\n",
      "\n",
      "print '%s' %(\"(2) Current through series load Il\")\n",
      "VL=Vz #voltage across load\n",
      "IL=VL/RL #Current through series load\n",
      "print '%s %.0f' %(\"IL=mA\",IL*10**3)\n",
      "\n",
      "print '%s' %(\"(3)Current through zener diode\")\n",
      "Iz=Is-IL #Current through zener diode\n",
      "print '%s %.1f' %(\"IL=mA\",Iz*10**3)\n",
      "\n",
      "print '%s' %(\"(4)Respective wattage of elements used\")\n",
      "print '%s' %(\"(a) Series resistor -> W=Is*Vs\")\n",
      "W=Vs*Is #wattage of series resistor\n",
      "print '%s %.1f' %(\"=mW\",W*10**3)\n",
      "\n",
      "print '%s' %(\"(b) Zener diode -> W=Iz*Vz\")\n",
      "W=Vz*Iz #wattage of zener diode\n",
      "print '%s %.1f' %(\"=mW\",W*10**3)\n",
      "\n",
      "\n",
      "print '%s' %(\"(b) Load resistor -> W=IL*VL\")\n",
      "W=VL*IL #wattage of zener diode\n",
      "print '%s %.0f' %(\"=mW\",W*10**3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage across resistor \n",
        "=V 8\n",
        "(1) Current through series resistor Is\n",
        "Is=mA 24.2\n",
        "(2) Current through series load Il\n",
        "IL=mA 8\n",
        "(3)Current through zener diode\n",
        "IL=mA 16.2\n",
        "(4)Respective wattage of elements used\n",
        "(a) Series resistor -> W=Is*Vs\n",
        "=mW 193.9\n",
        "(b) Zener diode -> W=Iz*Vz\n",
        "=mW 194.9\n",
        "(b) Load resistor -> W=IL*VL\n",
        "=mW 96\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E14 - Pg 246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_14 Pg-246\n",
      "#calculate, Applying Thevenin's theorem, Thevenin voltage across the zener diode\n",
      "RL=1.*10.**3. #load resistance in ohm\n",
      "Rs=270. #series resistor in ohm\n",
      "Vs=18. #supply voltage in V\n",
      "vz=10. #xener voltage\n",
      "print '%s' %(\"Applying Thevenin''s theorem, Thevenin voltage across the zener diode\")\n",
      "Vth=(RL/(RL+Rs))*Vs #Thevenin voltage\n",
      "print '%s %.1f' %(\"Vth=V\",Vth)\n",
      "print '%sf' %(\"Thus Vth is greater than Vz(zener voltage),i.e 14.2 >10. So Zener diode is operating in the breakdown voltage.\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Applying Thevenin''s theorem, Thevenin voltage across the zener diode\n",
        "Vth=V 14.2\n",
        "Thus Vth is greater than Vz(zener voltage),i.e 14.2 >10. So Zener diode is operating in the breakdown voltage.f\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E15 - Pg 246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex4_15 Pg-246\n",
      "#calculate Average load current,Total current entering the circuit,Series resistor,Power rating of resistor\n",
      "IL1=10.*10.**(-3.) \n",
      "IL2=20.*10.**(-3.) #IL1,IL2 range of load current in A\n",
      "Vin=20. #supply voltage in V\n",
      "Izt=6.*10.**(-3.) #zener current in A\n",
      "Vz=15. #zener voltage in V\n",
      "\n",
      "print '%s' %(\"Average load current\")\n",
      "IL=(IL1+IL2)/2. # Average load current\n",
      "print '%s %.0f' %(\"\\nIL=mA\",IL*10**3)\n",
      "\n",
      "print '%s' %(\"Total current entering the circuit\")\n",
      "Is=IL+Izt #current entering the circuit\n",
      "print '%s %.0f' %(\"\\nIs=mA\",Is*10**3)\n",
      "\n",
      "print '%s' %(\"Series resistor\")\n",
      "Rs=(Vin-Vz)/Is #Series resistor in ohm\n",
      "print '%s %.0f' %(\"Rs=ohm\",Rs)\n",
      "\n",
      "print '%s' %(\"Power rating of resistor\")\n",
      "Vs=Vin-Vz \n",
      "P=(Vs**2.)/Rs #Power rating of resistor\n",
      "print '%s %.1f' %(\"\\nP=W\",P)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average load current\n",
        "\n",
        "IL=mA 15\n",
        "Total current entering the circuit\n",
        "\n",
        "Is=mA 21\n",
        "Series resistor\n",
        "Rs=ohm 238\n",
        "Power rating of resistor\n",
        "\n",
        "P=W 0.1\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}