{
 "metadata": {
  "name": "",
  "signature": "sha256:49f87810817ddb9615b6e59a9caa61ca07b12c7b29a4202a634fda7cd35deb7f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9: Semiconductor Theory and Devices"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1, Page 277"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Part (a)\n",
      "V_Z = 9.1;    # Zener voltage of zener diode, volt\n",
      "P_Z = 0.5;    # Power rating of zener diode at V_Z, W\n",
      "r_Z = 1.5;    # Slope resistance of zener diode, ohm\n",
      "V = 12;    # Nominal value of input voltage, volt\n",
      "R_L = 2.5e+03;    # Load resistance across zener diode, ohm\n",
      "\n",
      "\n",
      "I_Z = P_Z/V_Z*1e+03;    # Zener current, mA\n",
      "I_S = I_Z;    # Current through series resistor, mA\n",
      "V_S = V - V_Z;    # Voltage drop across series resistor, volt\n",
      "R_S = V_S/I_S*1e+03;    # Value of series resistance, ohm\n",
      "P_max = (I_S*1e-03)**2*R_S;    # Maximum power rating of series resistance, W\n",
      "print \"The value of series resistance  = %5.2f ohm\"%R_S\n",
      "print \"The value of maximum power rating of series resistance  = %4.2f W\"%P_max\n",
      "print \"(a) The suitable value of R_S should be 54 ohm, 0.25 W\"\n",
      "\n",
      "# Part (b)\n",
      "V_o = V_Z;    # Output voltage across zener, volt\n",
      "I_L = V_o/R_L*1e+03;    # Load current, mA\n",
      "I_Z = I_S - I_L;    # Zener current, mA\n",
      "print \"(b) The value of diode current with load resistance across zener = %5.2f mA\"%I_Z \n",
      "\n",
      "# Part (c)\n",
      "V = 12 - (0.1*12);    # Final value of input voltage after falling below 12 V, volt\n",
      "R_S = 56;    # Standard value of series resistance, ohm\n",
      "I_S = (V - V_Z)/R_S*1e+03;    # Current through series resistance, mA\n",
      "I_Z = I_S - I_L;    # Resulting diode current, mA\n",
      "delta_I_Z = 51.36 - I_Z;    # Change in zener current, mA\n",
      "delta_V_Z = delta_I_Z*1e-03*r_Z;    # Change in zener voltage, V\n",
      "change = delta_V_Z/V_Z*100;    # %age change in zener voltage\n",
      "print \"(c) The percentage change in the p.d. across the load = %4.2f percent\"%change\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of series resistance  = 52.78 ohm\n",
        "The value of maximum power rating of series resistance  = 0.16 W\n",
        "(a) The suitable value of R_S should be 54 ohm, 0.25 W\n",
        "(b) The value of diode current with load resistance across zener = 51.31 mA\n",
        "(c) The percentage change in the p.d. across the load = 0.41 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2, Page 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "\n",
      "#Variable declaration\n",
      "Diode = np.array([3, 1]);    # Declare a diode cell\n",
      "Diode_1 = [1, 15, 30, 0.5, 0.007];    # Data for Ist diode\n",
      "Diode_2 = [2, 15, 15, 1.3, 0.20];    # Data for 2nd diode\n",
      "Diode_3 = [1, 15, 2.5, 5.0, 0.67];    # Data for 3rd diode\n",
      "Resistor = np.array([5, 1])    # Declare a resistor cell\n",
      "Resistor_1 = [0.25, 0.026];    # Data for Ist resistor\n",
      "Resistor_2 = [0.5, 0.038];    # Data for 2nd resistor\n",
      "Resistor_3 = [1.0, 0.055];    # Data for 3rd resistor\n",
      "Resistor_4 = [2.5, 0.260];    # Data for 4th resistor\n",
      "Resistor_5 = [7.5, 0.280];    # Data for 5th resistor\n",
      "V = 24;    # Input voltage, volt\n",
      "\n",
      "#Calculations&Results\n",
      "V_Z = Diode_1[1];    # Zener voltage for Ist diode, volt\n",
      "V_S = V - V_Z;     # Voltage drop across series resistor for all the three diodes, volt\n",
      "\n",
      "#Part (a)\n",
      "# Diode 1\n",
      "P_Z = Diode_1[3];    # Power rating of Ist diode, W\n",
      "I_Z = P_Z/V_Z*1e+03;    # Zener current, mA\n",
      "R_S = V_S/I_Z*1e+03;    # Value of series resistance, ohm\n",
      "P_S = V_S**2/R_S;    # Power dissipation across series resistor, watt\n",
      "print \"Diode 1:\";\n",
      "print \"========\";\n",
      "print \"The value of series resistance  = %3d ohm\"%R_S;\n",
      "print \"The value of power rating of series resistance  = %3.1f W\"%P_S\n",
      "R_S = 270;    # Chosen value of series resistor, ohm\n",
      "P_S = 0.3;    # Chosen value of power rating, ohm\n",
      "print \"The suitable value of R_S should be %3d ohm, %3.1f W\"%(R_S, P_S);\n",
      "print \"Total unit cost = %5.3f pounds\\n\"%(Diode_1[4]+Resistor_2[1]);\n",
      "\n",
      "# Diode 2\n",
      "print \"Diode 2:\";\n",
      "print \"========\";\n",
      "P_Z = Diode_2[3];    # Power rating of 2nd diode, W\n",
      "I_Z = P_Z/V_Z*1e+03;    # Zener current, mA\n",
      "R_S = V_S/I_Z*1e+03;    # Value of series resistance, ohm\n",
      "P_S = V_S**2/R_S;    # Power dissipation across series resistor, watt\n",
      "print \"The value of series resistance  = %5.2f ohm\"%R_S\n",
      "print \"The value of power rating of series resistance  = %4.2f W\"%P_S\n",
      "R_S = 120;    # Chosen value of series resistor, ohm\n",
      "P_S = 1.0;    # Chosen value of power rating, ohm\n",
      "print \"The suitable value of R_S should be %3d ohm, %3.1f W\"%(R_S, P_S);\n",
      "print \"Total unit cost = %4.2f pounds\"%(Diode_2[4]+Resistor_3[1]);\n",
      "\n",
      "# Diode 3\n",
      "print \"\\nDiode 3:\";\n",
      "print \"========\";\n",
      "P_Z = Diode_3[3];    # Power rating of 3rd diode, W\n",
      "I_Z = P_Z/V_Z*1e+03;    # Zener current, mA\n",
      "R_S = V_S/I_Z*1e+03;    # Value of series resistance, ohm\n",
      "P_S = V_S**2/R_S;    # Power dissipation across series resistor, watt\n",
      "print \"The value of series resistance  = %3d ohm\"%R_S;\n",
      "print \"The value of power rating of series resistance  = %3.1f W\"%P_S\n",
      "R_S = 27;    # Chosen value of series resistor, ohm\n",
      "P_S = 7.5;    # Chosen value of power rating, ohm\n",
      "print \"The suitable value of R_S should be %3d ohm, %3.1f W\"%(R_S, P_S);\n",
      "print \"Total unit cost = %4.2f pounds\"%(Diode_3[4]+Resistor_5[1]);\n",
      "\n",
      "# Part (b)\n",
      "delta_V_Z = (5*15)/100;    # Allowable change in V_Z, volt\n",
      "delta_I_Z = 30e-03;    # Allowable change in zener current, A\n",
      "delta_VZ = np.zeros(3);\n",
      "delta_VZ_1 = 30e-03*30;    # Change in zener voltage dor diode 1, V\n",
      "delta_VZ_2 = 30e-03*15;    # Change in zener voltage dor diode 2, V\n",
      "delta_VZ_3 = 30e-03*2.5;   # Change in zener voltage dor diode 3, V\n",
      "print \"\\nThe maximum value of zener voltage change = %4.2f V\"%(max(delta_VZ_2, delta_VZ_3));\n",
      "print \"To meet the specification at lowest cost, circuit 2 would be adopted\";\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diode 1:\n",
        "========\n",
        "The value of series resistance  = 269 ohm\n",
        "The value of power rating of series resistance  = 0.3 W\n",
        "The suitable value of R_S should be 270 ohm, 0.3 W\n",
        "Total unit cost = 0.045 pounds\n",
        "\n",
        "Diode 2:\n",
        "========\n",
        "The value of series resistance  = 103.85 ohm\n",
        "The value of power rating of series resistance  = 0.78 W\n",
        "The suitable value of R_S should be 120 ohm, 1.0 W\n",
        "Total unit cost = 0.26 pounds\n",
        "\n",
        "Diode 3:\n",
        "========\n",
        "The value of series resistance  =  27 ohm\n",
        "The value of power rating of series resistance  = 3.0 W\n",
        "The suitable value of R_S should be  27 ohm, 7.5 W\n",
        "Total unit cost = 0.95 pounds\n",
        "\n",
        "The maximum value of zener voltage change = 0.45 V\n",
        "To meet the specification at lowest cost, circuit 2 would be adopted\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}