{
 "metadata": {
  "name": "",
  "signature": "sha256:a018f9c723f15445bbbdae4420e0d734add969219d670fe6045994b2e98c6f3f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 - Diode Switching"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate (a)Resistance (b)Forward Current (c)Power dissipation (d)Peak Reverse Voltage\n",
      "e=50.#Input voltage(in volts)\n",
      "i=20.#Output Current(in mA)\n",
      "v=0.5#Output voltage(in volts)\n",
      "ir=5.#Reverse Leakage Current(in micro ampere)\n",
      "vf=0.7#Forward voltage of diode(in volts)\n",
      "R=v*1000./ir\n",
      "print '%s %.f' %('(a)Resistance(in Kilo ohm)=',R)\n",
      "I=(e-vf)/R\n",
      "P=(e**2.)/R\n",
      "ep=-e\n",
      "print '%s %.f' %('(b)Diode Peak Reverse Voltage(in volts)=',ep)\n",
      "i=i+I\n",
      "print '%s %.1f' %('(c)Diode Forward Current(in mA)=',i)\n",
      "p=vf*i\n",
      "print '%s %.2f' %('(d)Diode Power Dissipation(in mW)=',p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Resistance(in Kilo ohm)= 100\n",
        "(b)Diode Peak Reverse Voltage(in volts)= -50\n",
        "(c)Diode Forward Current(in mA)= 20.5\n",
        "(d)Diode Power Dissipation(in mW)= 14.35\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 83"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate resistance and amplitude of output signal\n",
      "E=2.#Input voltage(in volts)\n",
      "v=0.5#Input noise voltage(in volts)\n",
      "Vf=0.7#Forward diode voltage(in volts)\n",
      "i=1.#Forward current of diode(in mA)\n",
      "V=E-Vf\n",
      "R=V/i\n",
      "print '%s %.1f %s %.1f' %('Output signal amplitude(in volts)=',V,'\\nResistance(in kilo ohm)=',R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output signal amplitude(in volts)= 1.3 \n",
        "Resistance(in kilo ohm)= 1.3\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Resistance and diode forward current\n",
      "E=10.#Input voltage(in volts)\n",
      "v=9.#Output voltage(in volts)\n",
      "i=1.#Output current(in mA)\n",
      "vf=0.7#Diode forward voltage(in volts)\n",
      "R=E-v/i\n",
      "i=E-vf/R\n",
      "print '%s %.f %s %.1f' %('Resistance(in kilo ohm)=',R,'\\nDiode forward current(in mA)=',i)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance(in kilo ohm)= 1 \n",
        "Diode forward current(in mA)= 9.3\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Resistance\n",
      "V=2.7#Output voltage(in volts)\n",
      "E=8.#Input voltage(in volts)\n",
      "i=1.#Output current(in mA)\n",
      "vf=0.7#Diode forward voltage(in volts)\n",
      "i=1.#Diode forward current(in mA)\n",
      "vb=V-vf\n",
      "R=(E-vb-vf)/(i+i)\n",
      "print '%s %.2f' %('Resistance(in kilo ohm)=',R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance(in kilo ohm)= 2.65\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 88"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Find Zener voltage and Resistance\n",
      "E=25.#Input voltage(in volts)\n",
      "V=11.#Output voltage(in volts)\n",
      "Vf=0.7#Forward diode voltage(in volts)\n",
      "i=1.#Output current(in mA)\n",
      "v=9.1#Voltage for 1N757 diode\n",
      "I=20.#Current across 1N757 diode(in mA)\n",
      "Vz=V-Vf\n",
      "Vr=E-(Vf+v)\n",
      "Iz=0.25*I\n",
      "Ir=Iz+i\n",
      "R=Vr/Ir\n",
      "print '%s %.1f %s %.1f' %('Zener voltage(in volts)=',Vz,'\\nResistance(in Kilo ohm)=',R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Zener voltage(in volts)= 10.3 \n",
        "Resistance(in Kilo ohm)= 2.5\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 92"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Capacitance and Resistance\n",
      "E=10.#Input voltage(in volts)\n",
      "f=1.#Frequency(in Khz)\n",
      "Rs=500.#Source resistance(in ohms)\n",
      "t=0.01#Tilt\n",
      "T=1./(f)\n",
      "pw=T*1000./2.\n",
      "C=pw/Rs\n",
      "R=pw/(t*C*1000.)\n",
      "print '%s %.f %s %.f' %('Capacitance(in micro farad)=',C,'\\nResistance(in kohm)=',R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitance(in micro farad)= 1 \n",
        "Resistance(in kohm)= 50\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 96"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Find Capacitance and Resistance required to design the circuit\n",
      "E=20.#Input waveform amplitude(in volts)\n",
      "f=2.#Frequency(in Khz)\n",
      "t=0.02#Tilt\n",
      "R=600.#Resistance(in ohm)\n",
      "T=1./f\n",
      "pw=T*1000./2.\n",
      "C=pw/R\n",
      "R=pw/(t*C)\n",
      "print '%s %.2f %s %.f' %('Capacitance(in micro farad)=',C,'\\nResistance(in kohm)=',25)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitance(in micro farad)= 0.42 \n",
        "Resistance(in kohm)= 25\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9 - Pg 96"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Capacitance,Resistance and Zener Voltage\n",
      "E=15.#Amplitude of input waveform(in volts)\n",
      "Rs=1.#Source Resistance(in Kilo ohm)\n",
      "V=9.#Output Voltage(in volts)\n",
      "Vf=0.7#Diode forward voltage(in volts)\n",
      "f=500.#Frequency(in hertz)\n",
      "t=0.01#Tilt\n",
      "T=1000./f\n",
      "pw=T/2.\n",
      "C=pw/Rs\n",
      "R=pw/(t*C)\n",
      "Vz=V-Vf\n",
      "print '%s %.f %s %.f %s %.1f' %('Capacitance(in micro farad)=',C,'\\nResistance(in Kilo ohm)=',R,'\\nZener Voltage(in volts)=',Vz)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitance(in micro farad)= 1 \n",
        "Resistance(in Kilo ohm)= 100 \n",
        "Zener Voltage(in volts)= 8.3\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 - Pg 98"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caption:Calculate Capacitance C1and C2,Diode reverse recovery time and input voltage\n",
      "V=12.#Output voltage(in volts)\n",
      "Vd=0.7#Diode forward voltage(in volts)\n",
      "R=1.2#Load resistance(in Kilo ohm)\n",
      "f=1.#Frequency(in KHz)\n",
      "r=10.#Ripple in output voltage(in %)\n",
      "Il=V/R\n",
      "t=1000./(2.*f)\n",
      "C2=(Il*t)*10.**(-3)/((r/(2.*100.))*V)\n",
      "C1=(2.*Il*t)*10.**(-4)/((r/(2.*100.))*V)\n",
      "trr=t/10.\n",
      "Vpp=V+((r/100.)*V)+(2.*Vd)\n",
      "Vp=Vpp/2.\n",
      "print '%s %.2f %s %.2f %s %.f %s %.1f' %('\\n C2(in micro farad)=',C2,'\\n C1(in micro farad)=',C1,'\\n Diode reverse recovery time(in micro sec)=',trr,'\\n Input voltage(in volts)=',Vp,)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " C2(in micro farad)= 8.33 \n",
        " C1(in micro farad)= 1.67 \n",
        " Diode reverse recovery time(in micro sec)= 50 \n",
        " Input voltage(in volts)= 7.3\n"
       ]
      }
     ],
     "prompt_number": 17
    }
   ],
   "metadata": {}
  }
 ]
}