{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 02 : Power Semiconductor Diodes and Transistors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1, Page No 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "B=40.0\n",
      "R_c=10                    #ohm\n",
      "V_cc=130.0                #V\n",
      "V_B=10.0                  #V\n",
      "V_CES=1.0                 #V\n",
      "V_BES=1.5                 #V\n",
      "\n",
      "#Calculations\n",
      "I_CS=(V_cc-V_CES)/R_c     #A\n",
      "I_BS=I_CS/B                #A\n",
      "R_B1=(V_B-V_BES)/I_BS\n",
      "P_T1=V_BES*I_BS+V_CES*I_CS\n",
      "ODF=5\n",
      "I_B=ODF*I_BS\n",
      "R_B2=(V_B-V_BES)/I_B\n",
      "P_T2=V_BES*I_B+V_CES*I_CS\n",
      "B_f=I_CS/I_B\n",
      "\n",
      "#Results\n",
      "print(\"value of R_B in saturated state= %.2f ohm\" %R_B1)\n",
      "print(\"Power loss in transistor=%.2f W\" %P_T1)\n",
      "print(\"Value of R_B for an overdrive factor 5 = %.2f ohm\" %R_B2)\n",
      "print(\"Power loss in transistor = %.2f W\" %P_T2)\n",
      "print(\"Forced current gain=%.0f\" %B_f)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of R_B in saturated state= 26.36 ohm\n",
        "Power loss in transistor=13.38 W\n",
        "Value of R_B for an overdrive factor 5 = 5.27 ohm\n",
        "Power loss in transistor = 15.32 W\n",
        "Forced current gain=8\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2, Page No 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I_CEO=2*10**-3            #A\n",
      "V_CC=220.0                #V\n",
      "P_dt=I_CEO*V_CC           #instant. power loss during delay time\n",
      "t_d=.4*10**-6            #s\n",
      "f=5000\n",
      "P_d=f*I_CEO*V_CC*t_d      #avg power loss during delay time\n",
      "V_CES=2                     #V\n",
      "t_r=1*10**-6               #s\n",
      "I_CS=80                    #A\n",
      "\n",
      "#Calculations\n",
      "P_r=f*I_CS*t_r*(V_CC/2-(V_CC-V_CES)/3)            #avg power loss during rise time\n",
      "t_m=V_CC*t_r/(2*(V_CC-V_CES))\n",
      "P_rm=I_CS*V_CC**2/(4*(V_CC-V_CES))           #instant. power loss during rise time\n",
      "\n",
      "#Results\n",
      "P_on=P_d+P_r                \n",
      "print(\"Avg power loss during turn on = %.2f W\" %P_on)\n",
      "P_nt=I_CS*V_CES \n",
      "print(\"Instantaneous power loss during turn on = %.0f W\" %P_nt)\n",
      "t_n=50*10**-6\n",
      "P_n=f*I_CS*V_CES*t_n\n",
      "print(\"Avg power loss during conduction period = %.0f W\" %P_n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Avg power loss during turn on = 14.93 W\n",
        "Instantaneous power loss during turn on = 160 W\n",
        "Avg power loss during conduction period = 40 W\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 Page No 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I_CEO=2*10**-3         #A\n",
      "V_CC=220          #V\n",
      "t_d=.4*10**-6   #s\n",
      "f=5000\n",
      "V_CES=2         #V\n",
      "t_r=1*10**-6    #s\n",
      "I_CS=80         #A\n",
      "t_n=50*10**-6   #s\n",
      "t_0=40*10**-6   #s\n",
      "t_f=3*10**-6    #s\n",
      "\n",
      "#Calculations\n",
      "P_st=I_CS*V_CES  # instant. power loss during t_s\n",
      "P_s=f*I_CS*V_CES*t_f   #avg power loss during t_s\n",
      "P_f=f*t_f*(I_CS/6)*(V_CC-V_CES)        #avg power loss during fall time\n",
      "P_fm=(I_CS/4)*(V_CC-V_CES)          #peak instant power dissipation\n",
      "P_off=P_s+P_f\n",
      "\n",
      "#Results\n",
      "print(\"Total avg power loss during turn off = %.2f W\" %P_off)\n",
      "P_0t=I_CEO*V_CC\n",
      "print(\"Instantaneous power loss during t_0 = %.2f W\" %P_0t)\n",
      "P_0=f*I_CEO*V_CC*t_0              #avg power loss during t_s\n",
      "P_on=14.9339              #W    from previous eg\n",
      "P_n=40                    #W    from previous eg\n",
      "P_T=P_on+P_n+P_off+P_0     \n",
      "print(\"Total power loss = %.2f W\" %P_T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total avg power loss during turn off = 44.91 W\n",
        "Instantaneous power loss during t_0 = 0.44 W\n",
        "Total power loss = 99.93 W\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4, Page No 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "I_CS=100.0 \n",
      "V_CC=200.0 \n",
      "t_on=40*10**-6\n",
      "\n",
      "#Calculations\n",
      "P_on=(I_CS/50)*10**6*t_on*(V_CC*t_on/2-(V_CC*10**6*t_on**2/(40*3)))       #energy during turn on\n",
      "t_off=60*10**-6\n",
      "P_off=(I_CS*t_off/2-(I_CS/60)*10**6*(t_off**2)/3)*((V_CC/75)*10**6*t_off)  #energy during turn off\n",
      "P_t=P_on+P_off           #total energy\n",
      "P_avg=300.0\n",
      "f=P_avg/P_t\n",
      "\n",
      "#Results\n",
      "print(\"Allowable switching frequency = %.2f Hz\" %f)\n",
      "#in book ans is: f=1123.6 Hz. The difference in results due to difference in rounding of of digits"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Allowable switching frequency = 1125.00 Hz\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}