{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 04 : Thyristors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "P=.5    #P=V_g*I_g\n",
      "s=130    #s=V_g/I_g\n",
      "\n",
      "#Calculations\n",
      "I_g=math.sqrt(P/s)\n",
      "V_g=s*I_g\n",
      "E=15\n",
      "R_s=(E-V_g)/I_g    \n",
      "\n",
      "#Results\n",
      "print(\"Gate source resistance=%.2f ohm\" %R_s)\n",
      "#Answers have small variations from that in the book due to difference in the rounding off of digits."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gate source resistance=111.87 ohm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "R_s=120     #slope of load line is -120V/A. This gives gate source resistance\n",
      "print(\"gate source resistance=%.0f ohm\" %R_s)\n",
      "\n",
      "P=.4     #P=V_g*I_g\n",
      "E_s=15\n",
      "\n",
      "#Calculations\n",
      " #E_s=I_g*R_s+V_g %    after solving this\n",
      " #120*I_g**2-15*I_g+0.4=0    so\n",
      "a=120   \n",
      "b=-15\n",
      "c=0.4\n",
      "D=math.sqrt((b**2)-4*a*c)\n",
      "I_g=(-b+D)/(2*a)   \n",
      "V_g=P/I_g\n",
      "\n",
      "#Results\n",
      "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3))    \n",
      "print(\"\\nthen trigger voltage=%.3f V\" %V_g)\n",
      "I_g=(-b-D)/(2*a)   \n",
      "V_g=P/I_g\n",
      "print(\"\\ntrigger current=%.2f mA\" %(I_g*10**3))    \n",
      "print(\"\\nthen trigger voltage=%.2f V\" %V_g)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gate source resistance=120 ohm\n",
        "\n",
        "trigger current=86.44 mA\n",
        "\n",
        "then trigger voltage=4.628 V\n",
        "\n",
        "trigger current=38.56 mA\n",
        "\n",
        "then trigger voltage=10.37 V\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 Page No 150"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "#V_g=1+10*I_g\n",
      "P_gm=5     #P_gm=V_g*I_g\n",
      "#after solving % eqn becomes 10*I_g**2+I_g-5=0\n",
      "a=10.0    \n",
      "b=1.0    \n",
      "c=-5\n",
      "\n",
      "#Calculations\n",
      "I_g=(-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "E_s=15\n",
      "#using E_s=R_s*I_g+V_g\n",
      "R_s=(E_s-1)/I_g-10   \n",
      "P_gav=.3     #W\n",
      "T=20*10**-6\n",
      "f=P_gav/(P_gm*T)\n",
      "dl=f*T\n",
      "\n",
      "#Results\n",
      "print(\"Reistance=%.3f ohm\" %R_s)\n",
      "print(\"Triggering freq=%.0f kHz\" %(f/1000))\n",
      "print(\"Tduty cycle=%.2f\" %dl)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reistance=11.248 ohm\n",
        "Triggering freq=3 kHz\n",
        "Tduty cycle=0.06\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6, Page No 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "I=.1\n",
      "E=200.0\n",
      "L=0.2\n",
      "\n",
      "#Calculations\n",
      "t=I*L/E   \n",
      "R=20.0\n",
      "t1=(-L/R)*math.log(1-(R*I/E))    \n",
      "L=2.0\n",
      "t2=(-L/R)*math.log(1-(R*I/E))   \n",
      "\n",
      "#Results\n",
      "print(\"in case load consists of (a)L=.2H\")\n",
      "print(\"min gate pulse width=%.0f us\" %(t*10**6))\n",
      "print(\"(b)R=20ohm in series with L=.2H\")\n",
      "print(\"min gate pulse width=%.3f us\" %(t1*10**6))\n",
      "print(\"(c)R=20ohm in series with L=2H\")\n",
      "print(\"min gate pulse width=%.2f us\" %(t2*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "in case load consists of (a)L=.2H\n",
        "min gate pulse width=100 us\n",
        "(b)R=20ohm in series with L=.2H\n",
        "min gate pulse width=100.503 us\n",
        "(c)R=20ohm in series with L=2H\n",
        "min gate pulse width=1005.03 us\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Page No 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "def theta(th):\n",
      "    I_m=1     #supposition\n",
      "    I_av=(I_m/(2*math.pi))*(1+math.cos(math.radians(th)))\n",
      "    I_rms=math.sqrt((I_m/(2*math.pi))*((180-th)*math.pi/360+.25*math.sin(math.radians(2*th))))\n",
      "    FF=I_rms/I_av\n",
      "    I_rms=35\n",
      "    I_TAV=I_rms/FF\n",
      "    return I_TAV\n",
      "\n",
      "#Calculations\n",
      "print(\"when conduction angle=180\")\n",
      "th=0\n",
      "I_TAV=theta(th)\n",
      "print(\"avg on current rating=%.3f A\" %I_TAV)\n",
      "print(\"when conduction angle=90\")\n",
      "th=90\n",
      "I_TAV=theta(th)\n",
      "\n",
      "#Results\n",
      "print(\"avg on current rating=%.3f A\" %I_TAV)\n",
      "print(\"when conduction angle=30\")\n",
      "th=150\n",
      "I_TAV=theta(th)\n",
      "print(\"avg on current rating=%.3f A\" %I_TAV)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when conduction angle=180\n",
        "avg on current rating=22.282 A\n",
        "when conduction angle=90\n",
        "avg on current rating=15.756 A\n",
        "when conduction angle=30\n",
        "avg on current rating=8.790 A\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page No 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "def theta(th):\n",
      "    n=360.0/th\n",
      "    I=1.0     #supposition\n",
      "    I_av=I/n\n",
      "    I_rms=I/math.sqrt(n)\n",
      "    FF=I_rms/I_av\n",
      "    I_rms=35\n",
      "    I_TAV=I_rms/FF\n",
      "    return I_TAV\n",
      "\n",
      "#Calculations\n",
      "th=180.0\n",
      "I_TAV1=theta(th)\n",
      "th=90.0\n",
      "I_TAV2=theta(th)\n",
      "th=30.0\n",
      "I_TAV3=theta(th)\n",
      "\n",
      "#Results\n",
      "print(\"when conduction angle=180\")\n",
      "print(\"avg on current rating=%.3f A\" %I_TAV)\n",
      "print(\"when conduction angle=90\")\n",
      "print(\"avg on current rating=%.1f A\" %I_TAV2)\n",
      "print(\"when conduction angle=30\")\n",
      "print(\"avg on current rating=%.4f A\" %I_TAV3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when conduction angle=180\n",
        "avg on current rating=8.790 A\n",
        "when conduction angle=90\n",
        "avg on current rating=17.5 A\n",
        "when conduction angle=30\n",
        "avg on current rating=10.1036 A\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11 Page No 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "f=50.0     #Hz\n",
      "\n",
      "#Calculations\n",
      "I_sb=3000.0\n",
      "t=1/(4*f)\n",
      "T=1/(2*f)\n",
      "I=math.sqrt(I_sb**2*t/T)    \n",
      "r=(I_sb/math.sqrt(2))**2*T   \n",
      "\n",
      "#Results\n",
      "print(\"surge current rating=%.2f A\" %I)\n",
      "print(\"\\nI**2*t rating=%.0f A^2.s\" %r)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "surge current rating=2121.32 A\n",
        "\n",
        "I**2*t rating=45000 A^2.s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Page No 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "V_s=300.0 #V\n",
      "R=60.0 #ohm\n",
      "L=2.0 #H\n",
      "\n",
      "#Calculations\n",
      "t=40*10**-6 #s\n",
      "i_T=(V_s/R)*(1-math.exp(-R*t/L))\n",
      "i=.036 #A\n",
      "R1=V_s/(i-i_T)\n",
      "\n",
      "#Results\n",
      "print(\"maximum value of remedial parameter=%.3f kilo-ohm\" %(R1/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum value of remedial parameter=9.999 kilo-ohm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16 Page No 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "V_p=230.0*math.sqrt(2)\n",
      "\n",
      "#Calculations\n",
      "R=1+((1)**-1+(10)**-1)**-1\n",
      "A=V_p/R\n",
      "s=1     #s\n",
      "t_c=20*A**-2*s\n",
      "\n",
      "#Results\n",
      "print(\"fault clearance time=%.4f ms\" %(t_c*10**3))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fault clearance time=0.6890 ms\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17, Page No 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "V_s=math.sqrt(2)*230     #V\n",
      "L=15*10**-6     #H\n",
      "I=V_s/L     #I=(di/dt)_max\n",
      "R_s=10   #ohm\n",
      "v=I*R_s     #v=(dv/dt)_max\n",
      "\n",
      "#Calculations\n",
      "f=50     #Hz\n",
      "X_L=L*2*math.pi*f\n",
      "R=2\n",
      "I_max=V_s/(R+X_L)    \n",
      "FF=math.pi/math.sqrt(2)\n",
      "I_TAV1=I_max/FF    \n",
      "FF=3.98184\n",
      "I_TAV2=I_max/FF    \n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print(\"(di/dt)_max=%.3f A/usec\" %(I/10**6))\n",
      "print(\"\\n(dv/dt)_max=%.2f V/usec\" %(v/10**6))\n",
      "print(\"\\nI_rms=%.3f A\" %I_max)\n",
      "print(\"when conduction angle=90\")\n",
      "print(\"I_TAV=%.3f A\" %I_TAV1)\n",
      "print(\"when conduction angle=30\")\n",
      "print(\"I_TAV=%.3f A\" %I_TAV2)\n",
      "print(\"\\nvoltage rating=%.3f V\" %(2.75*V_s)) #rating is taken 2.75 times of peak working voltage unlike 2.5 to 3 times as mentioned int book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(di/dt)_max=21.685 A/usec\n",
        "\n",
        "(dv/dt)_max=216.85 V/usec\n",
        "\n",
        "I_rms=162.252 A\n",
        "when conduction angle=90\n",
        "I_TAV=73.039 A\n",
        "when conduction angle=30\n",
        "I_TAV=40.748 A\n",
        "\n",
        "voltage rating=894.490 V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19, Page No 186"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "T_jm=125\n",
      "th_jc=.15     #degC/W\n",
      "th_cs=0.075     #degC/W\n",
      "\n",
      "\n",
      "#Calculations\n",
      "dT=54     #dT=T_s-T_a\n",
      "P_av=120\n",
      "th_sa=dT/P_av\n",
      "T_a=40     #ambient temp\n",
      "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n",
      "if (P_av-120)<1 :\n",
      "    print(\"selection of heat sink is satisfactory\")\n",
      "\n",
      "dT=58     #dT=T_s-T_a\n",
      "P_av=120\n",
      "th_sa=dT/P_av\n",
      "T_a=40     #ambient temp\n",
      "P_av=(T_jm-T_a)/(th_sa+th_jc+th_cs)\n",
      "if (P_av-120)<1 :\n",
      "    print(\"selection of heat sink is satisfactory\")\n",
      "\n",
      "V_m=math.sqrt(2)*230\n",
      "R=2\n",
      "I_TAV=V_m/(R*math.pi)\n",
      "P_av=90\n",
      "th_sa=(T_jm-T_a)/P_av-(th_jc+th_cs)\n",
      "dT=P_av*th_sa\n",
      "print(\"for heat sink\")    \n",
      "print(\"T_s-T_a=%.2f degC\" %dT)   \n",
      "print(\"\\nP_av=%.0f W\" %P_av)\n",
      "P=(V_m/2)**2/R\n",
      "eff=P/(P+P_av)   \n",
      "print(\"\\nckt efficiency=%.3f pu\" %eff)\n",
      "a=60     #delay angle\n",
      "I_TAV=(V_m/(2*math.pi*R))*(1+math.cos(math.radians(a)))\n",
      "print(\"\\nI_TAV=%.2f A\" %I_TAV)\n",
      "dT=46\n",
      "T_s=dT+T_a\n",
      "T_c=T_s+P_av*th_cs    \n",
      "T_j=T_c+P_av*th_jc    \n",
      "\n",
      "#Results\n",
      "print(\"\\ncase temp=%.2f degC\" %T_c)\n",
      "print(\"\\njunction temp=%.2f degC\" %T_j)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for heat sink\n",
        "T_s-T_a=-20.25 degC\n",
        "\n",
        "P_av=90 W\n",
        "\n",
        "ckt efficiency=0.993 pu\n",
        "\n",
        "I_TAV=38.83 A\n",
        "\n",
        "case temp=92.75 degC\n",
        "\n",
        "junction temp=106.25 degC\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20, Page No 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "T_j=125.0     #degC\n",
      "T_s=70.0     #degC\n",
      "th_jc=.16     #degC/W\n",
      "th_cs=.08     #degC/W\n",
      "\n",
      "#Calculations\n",
      "P_av1=(T_j-T_s)/(th_jc+th_cs)    \n",
      "\n",
      "T_s=60     #degC\n",
      "P_av2=(T_j-T_s)/(th_jc+th_cs)    \n",
      "inc=(math.sqrt(P_av2)-math.sqrt(P_av1))*100/math.sqrt(P_av1)    \n",
      "\n",
      "#Results\n",
      "print(\"Total avg power loss in thristor sink combination=%.2f W\" %P_av1)\n",
      "print(\"Percentage inc in rating=%.2f\" %inc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total avg power loss in thristor sink combination=229.17 W\n",
        "Percentage inc in rating=8.71\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21, Page No 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "R=25000.0\n",
      "I_l1=.021     #I_l=leakage current\n",
      "I_l2=.025\n",
      "I_l3=.018\n",
      "I_l4=.016\n",
      " #V1=(I-I_l1)*R\n",
      " #V2=(I-I_l2)*R\n",
      " #V3=(I-I_l3)*R\n",
      " #V4=(I-I_l4)*R\n",
      " #V=V1+V2+V3+V4\n",
      "    \n",
      "#Calculations\n",
      "V=10000.0\n",
      "I_l=I_l1+I_l2+I_l3+I_l4\n",
      " #after solving\n",
      "I=((V/R)+I_l)/4\n",
      "R_c=40.0\n",
      "V1=(I-I_l1)*R    \n",
      "\n",
      "#Resluts\n",
      "print(\"voltage across SCR1=%.0f V\" %V1)\n",
      "V2=(I-I_l2)*R    \n",
      "print(\"\\nvoltage across SCR2=%.0f V\" %V2)\n",
      "V3=(I-I_l3)*R    \n",
      "print(\"\\nvoltage across SCR3=%.0f V\" %V3)\n",
      "V4=(I-I_l4)*R    \n",
      "print(\"\\nvoltage across SCR4=%.0f V\" %V4)\n",
      "\n",
      "I1=V1/R_c    \n",
      "print(\"\\ndischarge current through SCR1=%.3f A\" %I1)\n",
      "I2=V2/R_c   \n",
      "print(\"\\ndischarge current through SCR2=%.3f A\" %I2)\n",
      "I3=V3/R_c    \n",
      "print(\"\\ndischarge current through SCR3=%.3f A\" %I3)\n",
      "I4=V4/R_c    \n",
      "print(\"\\ndischarge current through SCR4=%.3f A\" %I4)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage across SCR1=2475 V\n",
        "\n",
        "voltage across SCR2=2375 V\n",
        "\n",
        "voltage across SCR3=2550 V\n",
        "\n",
        "voltage across SCR4=2600 V\n",
        "\n",
        "discharge current through SCR1=61.875 A\n",
        "\n",
        "discharge current through SCR2=59.375 A\n",
        "\n",
        "discharge current through SCR3=63.750 A\n",
        "\n",
        "discharge current through SCR4=65.000 A\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.22, Page No 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "V_r=1000     #rating of SCR\n",
      "I_r=200     #rating of SCR\n",
      "V_s=6000     #rating of String\n",
      "I_s=1000     #rating of String\n",
      "\n",
      "#Calculations\n",
      "print(\"when DRF=.1\")\n",
      "DRF=.1\n",
      "n_s=V_s/(V_r*(1-DRF))    \n",
      "print(\"number of series units=%.0f\" %math.ceil(n_s))\n",
      "n_p=I_s/(I_r*(1-DRF))    \n",
      "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))\n",
      "print(\"when DRF=.2\")\n",
      "DRF=.2\n",
      "\n",
      "#Results\n",
      "n_s=V_s/(V_r*(1-DRF))   \n",
      "print(\"number of series units=%.0f\" %math.ceil(n_s))\n",
      "n_p=I_s/(I_r*(1-DRF))    \n",
      "print(\"\\nnumber of parrallel units=%.0f\" %math.ceil(n_p))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when DRF=.1\n",
        "number of series units=7\n",
        "\n",
        "number of parrallel units=6\n",
        "when DRF=.2\n",
        "number of series units=8\n",
        "\n",
        "number of parrallel units=7\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.23, Page No 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "V1=1.6     #on state voltage drop of SCR1\n",
      "V2=1.2     #on state voltage drop of SCR2\n",
      "I1=250.0     #current rating of SCR1\n",
      "I2=350.0     #current rating of SCR2\n",
      "\n",
      "#Calculations\n",
      "R1=V1/I1\n",
      "R2=V2/I2\n",
      "I=600.0     #current to be shared\n",
      " #for SCR1 %     I*(R1+R)/(total resistance)=k*I1                    (1)\n",
      " #for SCR2 %     I*(R2+R)/(total resistance)=k*I2                    (2)\n",
      " #(1)/(2)\n",
      "R=(R2*I2-R1*I1)/(I1-I2)\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"RSequired value of resistance=%.3f ohm\" %R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "RSequired value of resistance=0.004 ohm\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.25, Page No 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "f=2000.0     #Hz\n",
      "C=0.04*10**-6\n",
      "n=.72\n",
      "\n",
      "#Calculations\n",
      "R=1/(f*C*math.log(1/(1-n)))    \n",
      "V_p=18\n",
      "V_BB=V_p/n\n",
      "R2=10**4/(n*V_BB)    \n",
      "I=4.2*10**-3     #leakage current\n",
      "R_BB=5000\n",
      "R1=(V_BB/I)-R2-R_BB\n",
      "\n",
      "#Results\n",
      "print(\"R=%.2f kilo-ohm\" %(R/1000))\n",
      "print(\"\\nR2=%.2f ohm\" %R2)\n",
      "print(\"\\nR1=%.0f ohm\" %R1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R=9.82 kilo-ohm\n",
        "\n",
        "R2=555.56 ohm\n",
        "\n",
        "R1=397 ohm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.26, Page No 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "V_p=18.0\n",
      "n=.72\n",
      "V_BB=V_p/n\n",
      "I_p=.6*10**-3\n",
      "I_v=2.5*10**-3\n",
      "V_v=1\n",
      "\n",
      "#Calculations\n",
      "R_max=V_BB*(1-n)/I_p    \n",
      "print(\"R_max=%.2f kilo-ohm\" %(R_max/1000))\n",
      "R_min=(V_BB-V_v)/I_v    \n",
      "print(\"\\nR_min=%.2f kilo-ohm\" %(R_min/1000))\n",
      "\n",
      "C=.04*10**-6\n",
      "f_min=1/(R_max*C*math.log(1/(1-n)))    \n",
      "print(\"\\nf_min=%.3f kHz\" %(f_min/1000))\n",
      "f_max=1/(R_min*C*math.log(1/(1-n)))    \n",
      "print(\"\\nf_max=%.2f kHz\" %(f_max/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R_max=11.67 kilo-ohm\n",
        "\n",
        "R_min=9.60 kilo-ohm\n",
        "\n",
        "f_min=1.683 kHz\n",
        "\n",
        "f_max=2.05 kHz\n"
       ]
      }
     ],
     "prompt_number": 17
    }
   ],
   "metadata": {}
  }
 ]
}