{
 "metadata": {
  "name": "",
  "signature": "sha256:8abe21ae5b9dfede9529c5590c8986daf14d033f9400a450cd8582ee0cfe98e6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter - 7 : Voltage Regulator And Non-Linear Circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example -  7.1 : Page No - 288"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data\n",
      "bita= 50 \n",
      "R1= 1 # in k\u03a9\n",
      "R1= R1*10**3 #in \u03a9\n",
      "R2= 300 # in \u03a9\n",
      "R3= 360 # in \u03a9\n",
      "R4= 640 # in \u03a9\n",
      "V1= 10 # in V\n",
      "V2= 20 # in V\n",
      "I_B1=19.2*10**-3 # in A\n",
      "I_L= 1 #in A\n",
      "V_Z= 5.6 # in V\n",
      "V_B= R4*V1/(R3+R4) #in V\n",
      "V_BE2= V_B-V_Z # in V\n",
      "V_A= V1-V_BE2 # in V\n",
      "print \"Part (i) :-\"\n",
      "print \" The value of V_A = %0.1f volt\" %V_A\n",
      "print \" The value of V_B = %0.1f volt\" %V_B\n",
      "\n",
      "# Part (ii)\n",
      "I1= V1/(R3+R4) # in A\n",
      "#I1= .01*10**-3 # in A\n",
      "I2= (V2-V_A)/R2 # in A\n",
      "I_C2= I2-I_B1 # in A\n",
      "I_B1= (I1+I_L)/(1+bita) # in A\n",
      "print \"\\nPart (ii) :-\"\n",
      "print \" The base current of T1    = %0.1f mA\" %(I_B1*10**3)\n",
      "I_C2= I2-I_B1 # in A\n",
      "I_E2= I_C2 # in A\n",
      "print \" The emitter current of T2 = %0.1f mA\" %(I_E2*10**3)\n",
      "\n",
      "# part (iii)\n",
      "I3= (V2-V_Z)/R1 # in A\n",
      "I_Z= I3+I_E2 # in A\n",
      "print \"\\nPart (iii) :-\"\n",
      "print \" Current through zener diode = %0.1f mA\" %(I_Z*10**3)\n",
      "V_CE= V2-V1 # in V\n",
      "I_C1= bita*I_B1 # in A\n",
      "T1= V_CE*I_C1 # in W\n",
      "print \" Power dissipation           = %0.1f watt\" %T1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (i) :-\n",
        " The value of V_A = 9.2 volt\n",
        " The value of V_B = 6.4 volt\n",
        "\n",
        "Part (ii) :-\n",
        " The base current of T1    = 19.8 mA\n",
        " The emitter current of T2 = 16.2 mA\n",
        "\n",
        "Part (iii) :-\n",
        " Current through zener diode = 30.6 mA\n",
        " Power dissipation           = 9.9 watt\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example -  7.2 : Page No - 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data\n",
      "bita= 100 \n",
      "R1= 1 # in k\u03a9\n",
      "R1= R1*10**3 #in \u03a9\n",
      "R2= 300 # in \u03a9\n",
      "R3= 360 # in \u03a9\n",
      "R4= 640 # in \u03a9\n",
      "V1= 10 # in V\n",
      "V2= 20 # in V\n",
      "I_B1=19.2*10**-3 # in A\n",
      "I_L= 1 #in A\n",
      "V_Z= 5.6 # in V\n",
      "V_B= R4*V1/(R3+R4) #in V\n",
      "V_BE2= V_B-V_Z # in V\n",
      "V_A= V1-V_BE2 # in V\n",
      "print \"Part (i) :-\"\n",
      "print \" The value of V_A = %0.1f volt\" %V_A\n",
      "print \" The value of V_B = %0.1f volt\" %V_B\n",
      "\n",
      "# Part (ii)\n",
      "I1= V1/(R3+R4) # in A\n",
      "#I1= .01*10**-3 # in A\n",
      "I2= (V2-V_A)/R2 # in A\n",
      "I_C2= I2-I_B1 # in A\n",
      "I_B1= (I1+I_L)/(1+bita) # in A\n",
      "print \"\\nPart (ii) :-\"\n",
      "print \" The base current of T1    = %0.f mA\" %(I_B1*10**3)\n",
      "I_C2= I2-I_B1 # in A\n",
      "I_E2= I_C2 # in A\n",
      "print \" The emitter current of T2 = %0.1f mA\" %(I_E2*10**3)\n",
      "\n",
      "# part (iii)\n",
      "I3= (V2-V_Z)/R1 # in A\n",
      "I_Z= I3+I_E2 # in A\n",
      "print \"\\nPart (iii) :-\"\n",
      "print \" Current through zener diode = %0.1f mA\" %(I_Z*10**3)\n",
      "V_CE= V2-V1 # in V\n",
      "I_C1= bita*I_B1 # in A\n",
      "T1= V_CE*I_C1 # in W\n",
      "print \" Power dissipation           = %0.1f watt\" %T1\n",
      "\n",
      "# Note: In the part (iv), the wrong value of I_B1 and bita is putted, these two value is putted of the Example 7.1\n",
      "#          (i.e. I_B1= 19.8 mA and bita= 50) whereas in this example the value of bita is given 100 and the value of \n",
      "#          of I_B1 is calculated as 10 mA. So the answer of the last part of this example is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (i) :-\n",
        " The value of V_A = 9.2 volt\n",
        " The value of V_B = 6.4 volt\n",
        "\n",
        "Part (ii) :-\n",
        " The base current of T1    = 10 mA\n",
        " The emitter current of T2 = 26.0 mA\n",
        "\n",
        "Part (iii) :-\n",
        " Current through zener diode = 40.4 mA\n",
        " Power dissipation           = 10.0 watt\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example -  7.3 : Page No - 291"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data\n",
      "bita= 50 \n",
      "R1= 1 # in k\u03a9\n",
      "R1= R1*10**3 #in \u03a9\n",
      "R2= 500 # in \u03a9\n",
      "R3= 400 # in \u03a9\n",
      "R4= 600 # in \u03a9\n",
      "V1= 10 # in V\n",
      "V2= 20 # in V\n",
      "I_B1=19.2*10**-3 # in A\n",
      "I_L= 1 #in A\n",
      "V_Z= 5 # in V\n",
      "V_B= R4*V1/(R3+R4) #in V\n",
      "V_BE2= V_B-V_Z # in V\n",
      "V_A= V1-V_BE2 # in V\n",
      "print \"Part (i) :-\"\n",
      "print \" The value of V_A = %0.f volt\" %V_A\n",
      "print \" The value of V_B = %0.f volt\" %V_B\n",
      "\n",
      "# Part (ii)\n",
      "I1= V1/(R3+R4) # in A\n",
      "#I1= .01*10**-3 # in A\n",
      "I2= (V2-V_A)/R2 # in A\n",
      "#I2= .042 \n",
      "I_C2= I2-I_B1 # in A\n",
      "I_B1= (I1+I_L)/(1+bita) # in A\n",
      "print \"Part (ii) :-\"\n",
      "print \" The base current of T1 = %0.1f mA\" %(I_B1*10**3)\n",
      "I_C2= I2-I_B1 # in A\n",
      "I_E2= I_C2 # in A\n",
      "print \" The emitter current of T2 = %0.1f mA\" %(I_E2*10**3)\n",
      "\n",
      "# part (iii)\n",
      "I3= (V2-V_Z)/R1 # in A\n",
      "I_Z= I3+I_E2 # in A\n",
      "print \"Part (iii) :-\"\n",
      "print \" Current through zener diode = %0.f mA\" %(I_Z*10**3)\n",
      "V_CE= V2-V1 # in V\n",
      "I_C1= bita*I_B1 # in A\n",
      "T1= V_CE*I_C1 # in W\n",
      "print \" Power dissipation = %0.f watt\" %T1\n",
      "\n",
      "# Note: In the book, there is a calculation error to evaluate the value of \n",
      "#      I2 (  (20-9)/500 = 42 mA is wrong, correct value is 22 mA) So the answer is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part (i) :-\n",
        " The value of V_A = 9 volt\n",
        " The value of V_B = 6 volt\n",
        "Part (ii) :-\n",
        " The base current of T1 = 19.8 mA\n",
        " The emitter current of T2 = 2.2 mA\n",
        "Part (iii) :-\n",
        " Current through zener diode = 17 mA\n",
        " Power dissipation = 10 watt\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example -  7.4 : Page No - 292"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data\n",
      "Vmin= 2.2 # in V\n",
      "Vmax= 4.0 # in V\n",
      "I= 11 # in mA\n",
      "I= I*10**-3 #in A\n",
      "Resistance= Vmin/I # in \u03a9\n",
      "Current = Vmax/Resistance # in A\n",
      "print \" The value of resistance = %0.f \u03a9\" %Resistance\n",
      "print \" The value of current    = %0.f mA\" %(Current*10**3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The value of resistance = 200 \u03a9\n",
        " The value of current    = 20 mA\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example -  7.5 : Page No - 294"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given data\n",
      "V1= 6.2 # in V\n",
      "V2= 0.6 # in V\n",
      "V3= 0.6 # in V\n",
      "Vout= V1-V2-V3 # in V\n",
      "print \" The output voltage = %0.1f volts\" %Vout"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The output voltage = 5.0 volts\n"
       ]
      }
     ],
     "prompt_number": 21
    }
   ],
   "metadata": {}
  }
 ]
}