{
 "metadata": {
  "name": "",
  "signature": "sha256:7039c5014fcc7b7ac57b07f9ca218d5a9c1cf6429694e23e4e8bce3552a45c07"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8:Multivibrators And Switching Regulators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1,Page number 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "C=0.1                      #capacitance(uF)\n",
      "R1=10                      #resistance(k ohms)\n",
      "R2=2.3                     #resistance(k ohms)\n",
      "Vcc=12.                    #supply voltage(V) \n",
      "Rl=10**3.                  #resistance(k ohms)\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "f=1/(0.693*C*(R2+R1/2))    #frequency(Hz)\n",
      "\n",
      "#Part b\n",
      "D=(1+(R2/R1))/(1+2*(R2/R1))*100          #duty cycle\n",
      " \n",
      "#Part c\n",
      "#(i)\n",
      "T1=0.693*C*(R1+R2)                        #time period through R1(ms)\n",
      "T2=0.693*R2*C                             #time period through R2(ms)\n",
      "Pavg=(Vcc/Rl)**2*(T1/(T1+T2))             #average power dissipated during current sourcing(mW)\n",
      "\n",
      "#Part d\n",
      "Pavg1=(T2/(T1+T2))*(Vcc/Rl)**2           #average power dissipated during current sinking(mW)\n",
      "\n",
      "#Results\n",
      "print\"print\",round(f,2),\"kHz\"\n",
      "print\"duty cycle is\",round(D,2),\"%\"\n",
      "print\"average power dissipated in current sourcing is\",round((Pavg/1E-3),3),\"mW\"\n",
      "print\"average power dissipated in current sinking is\",round(Pavg1/1e-3,3),\"mW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "print 1.98 kHz\n",
        "duty cycle is 84.25 %\n",
        "average power dissipated in current sourcing is 0.121 mW\n",
        "average power dissipated in current sinking is 0.023 mW\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2,Page number 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "t=1                               #time constant\n",
      "e=1.8                             #e=R1/R2 min=1.8\n",
      "e1=9.                              #e1=R1/R2 max=9\n",
      "\n",
      "#Calculations\n",
      "Betamin=1/(1+e)                 #current gain minimum\n",
      "Betamax=1/(1+e1)                #current gain maximum\n",
      "Tmax=2*t*math.log((1+Betamin)/(1-Betamin))          \n",
      "Tmin=2*t*math.log((1+Betamax)/(1-Betamax))                 \n",
      "fmin=1/Tmax                     #minimum freq(Hz)\n",
      "fmax=1/Tmin                     #maximum freq(k Hz)\n",
      "\n",
      "#Results\n",
      "print\"fmin is\",round(fmin/1E-3),\"Hz and fmax is\",round(fmax,1),\"KHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fmin is 669.0 Hz and fmax is 2.5 KHz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3,Page number 427"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "C=0.01                     #capacitance(uF)\n",
      "R2=15                      #resistance(k ohms)\n",
      "Va2=4                      #voltage(V)\n",
      "Vcc=15.                    #supply voltage(V)\n",
      "R1=33                      #resistance(k ohms)\n",
      "\n",
      "#Calculations\n",
      "Va1=0.67*Vcc               #voltage(V)\n",
      "Vamax=Va1+Va2              #Va maximum(V)\n",
      "Vamin=Va1-Va2              #Va minimum(V)\n",
      "T1max=C*(R1+R2)*(math.log((1-(Vamax/(2*Vcc)))/(1-(Vamax/Vcc))))   #time period(ms)\n",
      "T1min=C*(R1+R2)*(math.log((1-(Vamin/(2*Vcc)))/(1-(Vamin/Vcc))))   #time period(ms)\n",
      "T2=0.693*R2*C\n",
      "fmax=1/(T1min+T2)                    #maximum frequency(K Hz)\n",
      "fmin=1/(T1max+T2)                    #miniimum frequency(K Hz)\n",
      "\n",
      "#Results\n",
      "print\"minimum freq is\",round(fmin,2),\"(solution given in the textbook is incorrect)\"\n",
      "print\"maximum freq is\",round(fmax,2),\"(solution given in the textbook is incorrect)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "minimum freq is 0.89 (solution given in the textbook is incorrect)\n",
        "maximum freq is 4.1 (solution given in the textbook is incorrect)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4,Page number 433"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vi=25                         #input voltage(V) \n",
      "Vsmax=30                      #supply voltage max(V)\n",
      "Vomin=Vl=12                   #output minimum voltage or load voltage(V)\n",
      "R1=20                         #load voltage(V)\n",
      "Io=15.                        #output current(mA) \n",
      "Iq=3.                         #quinscent current of regulator(mA)\n",
      "Vo=20.                        #output voltage(V)\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "#(i)\n",
      "Vimax=Vsmax                     #maximum permissible voltage(V)\n",
      "Ro=0                            #for Vomin=beta=0\n",
      "#(ii)\n",
      "Vomax=Vi-2\n",
      "betaVomax=Vomax-Vomin                   #output voltage(V)\n",
      "R2max=(R1*betaVomax)/(Vomax-betaVomax)  #R2max(k ohms)\n",
      "#(iii)\n",
      "R3=betaVomax/Io                         #R3(k ohms)\n",
      "\n",
      "#Part b\n",
      "Vt=(Iq*betaVomax)/Io                   #common terminal fall(V)\n",
      "Vomin1=Vl+Vt                           #voltage output minimum(V)\n",
      "\n",
      "#Part c\n",
      "betaVo=Vo-Vl                          #output voltage(V)\n",
      "beta=betaVo/Vo                        #current gain\n",
      "R2=(R1*betaVo)/(Vo-betaVo)            #R2(ohms)\n",
      "\n",
      "#Results\n",
      "print\"a)i)max permissible supply voltage is\",Vimax,\"V\"\n",
      "print\"ii)output voltage range for Vi=25V is\",Vomin,\"V to\",Vomax,\"V and R2max is\",R2max,\"k ohms\"\n",
      "print\"iii)R3 is\",round(R3,2),\"kohms\"\n",
      "print\"b)Vomin is\",Vomin1,\"V\"\n",
      "print\"c)R2 is\",round(R2,2),\"ohms and R3 is\",round(R3,3),\"ohms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a)i)max permissible supply voltage is 30 V\n",
        "ii)output voltage range for Vi=25V is 12 V to 23 V and R2max is 18 k ohms\n",
        "iii)R3 is 0.73 kohms\n",
        "b)Vomin is 14.2 V\n",
        "c)R2 is 13.33 ohms and R3 is 0.733 ohms\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5,Page number 434"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "A=.0025                     #voltage gain\n",
      "Vi=8                        #input voltage(V)\n",
      "R2=1.5                      #resistance 2(k ohms)\n",
      "R1=1                        #resistance 1(k ohms)\n",
      "Vl=5                        #load voltage(V)\n",
      "\n",
      "#Calculations\n",
      "beta=R2/(R1+R2)               #current gain\n",
      "Vo=Vl/(1-beta)                #output voltage(V)\n",
      "Vo1=(A*Vi)/(1+(A*beta)-beta)  #output voltage ripple if Vi=8Vp-p\n",
      "\n",
      "#Results\n",
      "print\"Vo is\",Vo,\"V\"\n",
      "print\"expression of output voltage ripple\",round(Vo1,2),\"Vp-p\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vo is 12.5 V\n",
        "expression of output voltage ripple 0.05 Vp-p\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.6,Page number 435"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Ro=7.5                               #output resistance(ohms)\n",
      "hfe=50                          \n",
      "Ve=20                                #voltage given to emitter(V)       \n",
      "Vbe=0.8                              #base to emitter voltage(V)\n",
      "Vc=15                                #collector voltage(V)\n",
      "P=12                                 #maximum power dissipation(W)\n",
      "Ib1=5                                #for minimum load current Il=0,Ib=5\n",
      "\n",
      "#Calculations\n",
      "Io=(Vc/Ro)*10**3                      #output current(A)\n",
      "Il=76                                 #load current(mA)\n",
      "Is=Il+5                               #supply current(mA)\n",
      "Ic=Io-Is                              #collector current(A)\n",
      "Ib=Ic/hfe                             #base current(mA)\n",
      "Ie=Ic-Ib                              #emitter current(mA)\n",
      "Pt=(Ve*Ie)-(Vc*Ic)                    #power dissipated in transistor(W) \n",
      "Pl=(Ve-Vbe)*Is-Vc*Il                   #power dissipated in LR\n",
      "Vimax=(P+Vc*(Ic*10**-3))/(Ie*10**-3)  #input voltage maximum\n",
      "Iomin=hfe*Ib1                         #output current minimum(mA)\n",
      "\n",
      "#Results\n",
      "print\"power dissipated in the transistor is\",round((Pt/1E+3),2),\"W and in LR is\",round((Pl/1E+3),3),\"W\"\n",
      "print\"maximum permissible input voltage is\",round(Vimax,2),\"V\"\n",
      "print\"minimum load current for load voltage to remain stabalized is\",Iomin,\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power dissipated in the transistor is 8.83 W and in LR is 0.415 W\n",
        "maximum permissible input voltage is 21.69 V\n",
        "minimum load current for load voltage to remain stabalized is 250 mA\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7,Page number 440"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "VL=12            #load voltage(V)\n",
      "I=2.             #current at 12 V\n",
      "V=240            #dc source(V)\n",
      "d=17/50.         #duty cycle\n",
      "d1=0.6           #duty cycle\n",
      "eta1=0.8         #efficiency\n",
      "\n",
      "#Calculations\n",
      "P=VL*I                        #average load power(W)\n",
      "Isav=(1*d)/2                  #average supply current(A)\n",
      "Pav=V*Isav                    #average supply power(W)\n",
      "eta=(P/Pav)*100               #regulator efficiency\n",
      "Isav1=(1*d1)/2                #average supply current(A)\n",
      "Il=(eta1*V*Isav1)/Vdc         #load current(A)\n",
      "Po=Il*Vdc                     #power output(W)\n",
      "\n",
      "#Results\n",
      "print\"regulator efficiency is\",round(eta,1),\"%\"\n",
      "print\"average supply current is\",Il,\"A\"\n",
      "print\"power output is\",Po,\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "regulator efficiency is 58.8 %\n",
        "average supply current is 4.8 A\n",
        "power output is 57.6 W\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8,Page number 441"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Vs=200                #dc source voltage(V)\n",
      "Il=5                  #current to load voltage(A)\n",
      "Vl=15                 #load voltage(V)\n",
      "eta=.85               #efficiency\n",
      "f=20                  #oscillator frequency(Hz)\n",
      "iSmax=2.6             #peak value of supply current(A)\n",
      "P=100                 #full load power supply(W)\n",
      "pdf=0.4               #pulse duty factor\n",
      "\n",
      "#Calculations\n",
      "Isav=(Vl*Il)/(Vs*eta)   #average peak supply current(A)\n",
      "iS=(2*Isav)/pdf         #supply current(A)\n",
      "T=1000/f                #oscillation time period(uS)\n",
      "tp=pdf*T                #transistor time(us)\n",
      "d=iS/tp                 #change in iS with respect to time(A/us)\n",
      "tp1=iSmax/d             #transistor time(us)\n",
      "pdf1=tp1/T              #pulse duty factor\n",
      "Isav1=(iSmax*pdf1)/2    #average peak supply current(A)\n",
      "eta1=(P*100)/(Vs*Isav1) #efficiency\n",
      "\n",
      "#Results\n",
      "print\"peak value of supply current is\",round(Isav,3),\"A\"\n",
      "print\"pdf is\",round(pdf,3)\n",
      "print\"overall efficienc is\",round(eta1,1),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "peak value of supply current is 0.441 A\n",
        "pdf is 0.4\n",
        "overall efficienc is 81.6 %\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}