{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 09 : Transistor Biasing and Thermal Stabilization"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1, Page No 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Vcc=22.5    #in V\n",
      "Rc=5.6 #in K\n",
      "Re=1.0  #in K\n",
      "R2=10.0 #in K\n",
      "R1=90.0 #in K\n",
      "B=55.0 #beta\n",
      "\n",
      "#Calculations\n",
      "V=(R2*Vcc)/(R2+R1)                 #Thevenin Equivallent Voltage\n",
      "Rb=(R2*R1)/(R2+R1)                 #Thevenin Equivallent Resistance\n",
      "\n",
      "#For base current large compared to reverse saturation current ie Ib>>Ico it follows that Ic=B*Ib\n",
      "#Applying KVL to the base circuit\n",
      "#0.65-2.25+Ic+10*Ib=0\n",
      "#We have   -1.60+Ic+(10/55)*Ic=0\n",
      "\n",
      "Ic=1.60/(65.0/55);\n",
      "Ib=Ic/55.0\n",
      "\n",
      "#Applying KVL to the collector circuit yields\n",
      "#-22.5+6.6*Ic+Ib+Vce\n",
      "\n",
      "Vce = 22.5-(6.6*1.36)-0.025\n",
      "\n",
      "#Results\n",
      "print(\"The equivallent Vbb = %.2f Volts \" %V)\n",
      "print(\"The equivallent Rb is = %.2f ohm \" %Rb)\n",
      "print(\"As B=55 we have Ic=55*Ib \")\n",
      "print(\" Ic= %.2f milli amp \" %Ic)\n",
      "print(\"Ib= %.2f micro amp \" %Ib)\n",
      "print(\"Vce= %.2f Volts \" %Vce)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equivallent Vbb = 2.25 Volts \n",
        "The equivallent Rb is = 9.00 ohm \n",
        "As B=55 we have Ic=55*Ib \n",
        " Ic= 1.35 milli amp \n",
        "Ib= 0.02 micro amp \n",
        "Vce= 13.50 Volts \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2, Page No 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rc=4.0 #in K\n",
      "Vcc=20.0  #in V\n",
      "Vce=10.0     #in V\n",
      "Ic=2.0       #in mA\n",
      "#Ic varies from 1.75 to 2.25 and B(beta) varies from 36 to 90\n",
      "Re = (Vcc-Vce)/Ic - Rc\n",
      "#S=delta Ic/delta B\n",
      "Ic2=2.25     #in mA\n",
      "Ic1=1.75  #in mA\n",
      "B2=90.0\n",
      "B1=36.0\n",
      "\n",
      "#Calculations\n",
      "S=(Ic2-Ic1)/(B2-B1)\n",
      "S2=(S*36*(1+90))/1.75\n",
      "#S2=(1+B)*(1+(Rb/Re))/(1+B+(Rb/Re))\n",
      "Rb=(S2-1)*(1+B2)*Re/(1+B2-S2);\n",
      "Vbe=0.65       #in V\n",
      "V = Vbe + ((Rb+Re*(1+B1))*Ic1/B1);\n",
      "R1=Rb*Vcc/V\n",
      "R2=R1*V/(Vcc-V)\n",
      "\n",
      "#Results\n",
      "print(\"S2 = %.2f K \" %S2)\n",
      "print(\"Re = is %.2f B2=90 \" %Re)\n",
      "print(\"Rb= %.2f K \" %Rb)\n",
      "print(\"V =  %.2f Volts \" %V)\n",
      "print(\"R1= %.2f K \" %R1)\n",
      "print(\"R2= %.2f K \" %R2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "S2 = 17.33 K \n",
        "Re = is 1.00 B2=90 \n",
        "Rb= 20.18 K \n",
        "V =  3.43 Volts \n",
        "R1= 117.67 K \n",
        "R2= 24.35 K \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3a Page No 316"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Re=4.7    #in K\n",
      "Rb=7.75   #in K\n",
      "B1=55.0   #/beta at 25degree C\n",
      "Ic1=1.5   #in mA\n",
      "Ico1=1.0\n",
      "Vbe1=0.6     #in V\n",
      "\n",
      "#Part a\n",
      "\n",
      "Ico2=33000.0                #in nA\n",
      "Vbe2=0.225              #in V\n",
      "\n",
      "#Calculations\n",
      "M1=1/(1+(Rb/(Re*B1)))       #Stability Factor\n",
      "B2=100.0         #at 175degree C\n",
      "M2=1/(1+(Rb/(Re*B2)))       #Stability Factor\n",
      "\n",
      "print(\"Stabitity Factor at 25deree C= %.2f \" %M1)\n",
      "print(\"Stabitity Factor at 175deree C= %.2f \" %M2)\n",
      "\n",
      "if M2>M1 :\n",
      "    M1=1.0\n",
      "    M2=1.0\n",
      "\n",
      "\n",
      "#Let k = (delta Ic)/(Ic1)\n",
      "k=(1+(Rb/Re))*(M1*(Ico2-Ico1)*(10**-9)/Ic1*(10**-3))-(M1*(Vbe2-Vbe1)/(Ic1*Re))+(1+(Rb/Re))*(M2*(B2-B1)/(B2*B1));\n",
      "deltaIc=k*Ic1\n",
      "print(\"Change in Collector Current at 175degree C is = %.2f mA\" %deltaIc)\n",
      "\n",
      "\n",
      "#Given Data at -65degree C\n",
      "Ico2=1.95*(10**-3)\n",
      "B2=25.0\n",
      "Vbe2=0.78\n",
      "\n",
      "M2=1/(1+(Rb/(Re*B2)))      #Stability Factor\n",
      "print(\"Stabitity Factor at -65deree C= %.2f \" %M2)\n",
      " \n",
      "#Let k = (delta Ic)/(Ic1)\n",
      "k=(1+(Rb/Re))*(M1*(Ico2-Ico1)*(10**-9)/Ic1*(10**-3))-(M1*(Vbe2-Vbe1)/(Ic1*Re))+(1+(Rb/Re))*(M2*(B2-B1)/(B2*B1))\n",
      "deltaIc=k*Ic1\n",
      "\n",
      "#Results\n",
      "print(\"Change in Collector Current at -65degree C is = %.2f mA\" %deltaIc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stabitity Factor at 25deree C= 0.97 \n",
        "Stabitity Factor at 175deree C= 0.98 \n",
        "Change in Collector Current at 175degree C is = 0.11 mA\n",
        "Stabitity Factor at -65deree C= 0.94 \n",
        "Change in Collector Current at -65degree C is = -0.12 mA\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3b, Page No 317"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Re=4.7    #in K\n",
      "Rb=7.75   #in K\n",
      "B1=55.0   #/beta at 25degree C\n",
      "Ic1=1.5   #in mA\n",
      "Ico1=1.0\n",
      "Vbe1=0.6     #in V\n",
      "\n",
      "\n",
      "#Part a\n",
      "\n",
      "Ico2=33000.0                #in nA\n",
      "Vbe2=0.225              #in V\n",
      "\n",
      "#Calculations\n",
      "M1=1/(1+(Rb/(Re*B1)))       #Stability Factor\n",
      "#Given Data at -65degree C\n",
      "Ico2=1.95*(10**-3)\n",
      "B2=25.0         #at -65degree C\n",
      "Vbe2=0.78\n",
      "M2=1/(1+(Rb/(Re*B2)))       #Stability Factor\n",
      "\n",
      "#Let k = (delta Ic)/(Ic1)\n",
      "k=(1+(Rb/Re))*(M1*(Ico2-Ico1)*(10**-9)/Ic1*(10**-3))-(M1*(Vbe2-Vbe1)/(Ic1*Re))+(1+(Rb/Re))*(M2*(B2-B1)/(B2*B1));\n",
      "deltaIc=k*Ic1\n",
      "\n",
      "\n",
      "\n",
      "#Given Data\n",
      "Ico2=32.0         #in nA\n",
      "Vbe2=0.10      #in V\n",
      "M1=1/(1+(Rb/(Re*B1)))       #Stability Factor\n",
      "print(\"Stabitity Factor at 25deree C= %.2f \" %M1)\n",
      "B2=90.0            #at 175degree C\n",
      "M2=1/(1+(Rb/(Re*B2)))            #Stability Factor\n",
      "print(\"Stabitity Factor at 75deree C= %.2f \" %M2)\n",
      "\n",
      "if M2>M1 :\n",
      "    M1=1.0\n",
      "    M2=1.0\n",
      "\n",
      "#Let k = (delta Ic)/(Ic1)\n",
      "k=(1+(Rb/Re))*(M1*(Ico2-Ico1)*(10**-9)/Ic1*(10**-3))-(M1*(Vbe2-Vbe1)/(Ic1*Re))+(1+(Rb/Re))*(M2*(B2-B1)/(B2*B1));\n",
      "deltaIc=k*Ic1\n",
      "print(\"Change in Collector Current at 75degree C is = %.2f mA\" %deltaIc)\n",
      "\n",
      "#Given Data at -65degree C\n",
      "Ico2=1.95*(10**-3)\n",
      "B2=20.0\n",
      "Vbe2=0.38\n",
      "\n",
      "M2=1/(1+(Rb/(Re*B2)))         #Stability Factor\n",
      "print(\"Stabitity Factor at -65deree C= %.2f \" %M2)\n",
      " \n",
      "    \n",
      "#Let k = (delta Ic)/(Ic1)\n",
      "k=(1+(Rb/Re))*(M1*(Ico2-Ico1)*(10**-9)/Ic1*(10**-3))-(M1*(Vbe2-Vbe1)/(Ic1*Re))+(1+(Rb/Re))*(M2*(B2-B1)/(B2*B1));\n",
      "deltaIc=k*Ic1\n",
      "print(\"Change in Collector Current at -65degree C is = %.2f mA\" %deltaIc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stabitity Factor at 25deree C= 0.97 \n",
        "Stabitity Factor at 75deree C= 0.98 \n",
        "Change in Collector Current at 75degree C is = 0.13 mA\n",
        "Stabitity Factor at -65deree C= 0.92 \n",
        "Change in Collector Current at -65degree C is = -0.07 mA\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4 Page No 319"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "B1=150.0   #beta\n",
      "Ico1=50.0     #in nA\n",
      "\n",
      "#Given Data at 65degree C\n",
      "B2=1200.0 #beta\n",
      "Ico2=3.0    #in micro A\n",
      "\n",
      "Vbe=0.65       #in mV\n",
      "Vcc=20.0        #in V\n",
      "M=1.0   \n",
      "#Assumption: Each factor Ico,B, and Vbe cuses the same percentge change(5%)\n",
      "\n",
      "#Let Rb/Re=k\n",
      "#(1+k)*((1200-150)/(1200*150))=0.05\n",
      "\n",
      "\n",
      "#Calculations\n",
      "k=((0.05)*((1200*150)/(1200-150)))-1\n",
      "print(\"Rb/Re = %.2f  \" %k)\n",
      "#Let us check our assumption\n",
      "\n",
      "if M>(1.0/(1+(k/B1))) :\n",
      "    M=1.0\n",
      "\n",
      "#(1+(Rb/Re))*((Ico2-Ico1)/Ic1)=0.05   Since Ico2>>Ico1, we consider only Ico2\n",
      "\n",
      "Ic1=((1+k)*Ico2)/(0.05*1000)\n",
      "print(\"Ic1= %.2f mA \" %Ic1)\n",
      "\n",
      "#Vbe changes 2.5mV/degree\n",
      "DVbe=2.5*40\n",
      "#Total increment\n",
      "dVbe=2*DVbe*(10**-3)\n",
      "\n",
      "#Let l=(Ic1*Re)\n",
      "l=dVbe/0.05\n",
      "\n",
      "Re=l/Ic1\n",
      "print(\"Re= %.2f  \" %Re)\n",
      "Rb=k*Re\n",
      "print(\"Rb= %.2f  \" %Rb)\n",
      "\n",
      "B=(B1+B2)/2              #beta\n",
      "V=((Ic1/B)*Rb)+(Vbe)+(((Ic1/B)+Ic1)*Re)\n",
      "print(\"V= %.2f  Volts\" %V)\n",
      "R1=(Rb*Vcc)/V\n",
      "R2=(R1*V)/(Vcc-V)\n",
      "\n",
      "#Results\n",
      "print(\"R1= %.2f ohm\" %R1)\n",
      "print(\"R2= %.2f ohm\" %R2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rb/Re = 7.55  \n",
        "Ic1= 0.51 mA \n",
        "Re= 7.80  \n",
        "Rb= 58.87  \n",
        "V= 4.70  Volts\n",
        "R1= 250.47 ohm\n",
        "R2= 76.96 ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5 Page No 325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Vcc=30.0          #in V\n",
      "Rc=2.0           #in K\n",
      "Re=4.7           #in K\n",
      "Ic=1.5           #in mA\n",
      "\n",
      "#We know that dPc/dIc = Vcc - (2*Ic*(Rc+Re))\n",
      "#Let D=dPc/dIc\n",
      "\n",
      "D = Vcc - (2*Ic*(Re+Rc))\n",
      "\n",
      "print('Ic increases by 0.131mA over a temprature range of 35 to 75 degree C')\n",
      "print('theta<(A=(dPc/dIc)*(dIc/dTc))')\n",
      "A=D*((0.131*(10^-3))/(75-25))\n",
      "\n",
      "#Results\n",
      "print(\"theta< %.2f degreeC/W \" %(1.0/A))\n",
      "print('The upper bound on theta is so high that transistor would not violate it and therefore circuit will be safe from thermal runaway')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ic increases by 0.131mA over a temprature range of 35 to 75 degree C\n",
        "theta<(A=(dPc/dIc)*(dIc/dTc))\n",
        "theta< -4.28 degreeC/W \n",
        "The upper bound on theta is so high that transistor would not violate it and therefore circuit will be safe from thermal runaway\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6a, Page No 326"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "B=100.0 #beta\n",
      "Ico=-5.0 #in mA\n",
      "Ic=-1.0 #in mA\n",
      "Vcc=40.0 \n",
      "Re=5.0     #in ohm\n",
      "Rc=10.0   #in ohm\n",
      "\n",
      "\n",
      "#Calculations\n",
      "#Ic= BIb + (1+B)*Ico\n",
      "#Ic=B(Ib+Ico)\n",
      "Ib=-(Ic/B)+Ico\n",
      "\n",
      "print(\"Ib= %.2f mA \" %Ib)\n",
      "#Neglecting Vbe\n",
      "Rb=(5-Vcc)/(Ib*0.001)\n",
      "print(\"Rb= %.2f ohm \" %Rb)\n",
      "\n",
      "Vce=Vcc-15\n",
      "if Vce>(Vcc/2) :\n",
      "    S=(1+B)*(1+(Rb/Re))/(1+B+(Rb/Re))\n",
      "    print(\"Stability Factor is= %.2f \" %S)\n",
      "\n",
      "A=-(Vcc+(2*Ic*(Re+Rc)))*(S)*(0.007*Ico*0.01)\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"theta< %.2f degreeC/W \" %(1.0/A))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ib= -4.99 mA \n",
        "Rb= 7014.03 ohm \n",
        "Stability Factor is= 94.28 \n",
        "theta< 3.03 degreeC/W \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6b Page No 326"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "B=100.0 #beta\n",
      "Ico=-5.0 #in mA\n",
      "Ic=-1.0 #in mA\n",
      "Vcc=40.0 \n",
      "Re=5.0     #in ohm\n",
      "Rc=10.0   #in ohm\n",
      "\n",
      "#Calculations\n",
      "#Ic= BIb + (1+B)*Ico\n",
      "#Ic=B(Ib+Ico)\n",
      "Ib=-(Ic/B)+Ico\n",
      "\n",
      "#Neglecting Vbe\n",
      "Rb=(5-Vcc)/(Ib*0.001)\n",
      "\n",
      "Vce=Vcc-15\n",
      "if Vce>(Vcc/2) :\n",
      "    S=(1+B)*(1+(Rb/Re))/(1+B+(Rb/Re))\n",
      "    print(\"Stability Factor is= %.2f \" %S)\n",
      "\n",
      "A=-(Vcc+(2*Ic*(Re+Rc)))*(S)*(0.007*Ico*0.01)\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"theta< %.2f degreeC/W \" %(1.0/A))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stability Factor is= 94.28 \n",
        "theta< 3.03 degreeC/W \n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}